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