Added logic for item code filteration in table section
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
This commit is contained in:
@@ -24,6 +24,7 @@ use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use App\Models\Plant;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class AsrsItemValidationResource extends Resource
|
||||
{
|
||||
@@ -148,7 +149,11 @@ class AsrsItemValidationResource extends Resource
|
||||
Tables\Columns\TextColumn::make('item_code')
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->searchable(query: function ($query, string $search) {
|
||||
$itemCode = explode('|', trim($search))[0];
|
||||
$query->where('item_code', $itemCode);
|
||||
})
|
||||
// ->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item_description')
|
||||
->label('Item Description')
|
||||
@@ -238,12 +243,17 @@ class AsrsItemValidationResource extends Resource
|
||||
}
|
||||
|
||||
return AsrsItemValidation::where('plant_id', $plantId)
|
||||
->distinct()
|
||||
->pluck('item_code', 'item_code')
|
||||
->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Rework', null);
|
||||
}),
|
||||
TextInput::make('uom')
|
||||
->label('UOM')
|
||||
->reactive()
|
||||
->placeholder('Enter UOM'),
|
||||
Select::make('status')
|
||||
->label('Status')
|
||||
->reactive()
|
||||
@@ -286,6 +296,7 @@ class AsrsItemValidationResource extends Resource
|
||||
if (
|
||||
empty($data['Plant']) &&
|
||||
empty($data['item_code']) &&
|
||||
empty($data['uom']) &&
|
||||
empty($data['status']) &&
|
||||
empty($data['created_from']) &&
|
||||
empty($data['created_to'])
|
||||
@@ -311,7 +322,9 @@ class AsrsItemValidationResource extends Resource
|
||||
if (! empty($data['item_code'])) {
|
||||
$query->where('item_code', 'like', '%'.$data['item_code'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['uom'])) {
|
||||
$query->where('uom', 'like', '%'.$data['uom'].'%');
|
||||
}
|
||||
if (!empty($data['status'])) {
|
||||
|
||||
if ($data['status'] == 'NotUpdated') {
|
||||
@@ -351,6 +364,10 @@ class AsrsItemValidationResource extends Resource
|
||||
$indicators[] = 'Item Code: '.$data['item_code'];
|
||||
}
|
||||
|
||||
if (! empty($data['uom'])) {
|
||||
$indicators[] = 'UOM: '.$data['uom'];
|
||||
}
|
||||
|
||||
if (! empty($data['status'])) {
|
||||
$indicators[] = 'Status: '.$data['status'];
|
||||
}
|
||||
@@ -369,7 +386,15 @@ class AsrsItemValidationResource extends Resource
|
||||
->filtersFormMaxHeight('280px')
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\EditAction::make()
|
||||
->hidden(function ($record): bool {
|
||||
if (auth()->user()?->hasRole('SuperAdmin')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return empty($record->status)
|
||||
|| trim(strtolower($record->status)) == 'updated';
|
||||
}),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
|
||||
Reference in New Issue
Block a user