diff --git a/app/Filament/Resources/GuardPatrolEntryResource.php b/app/Filament/Resources/GuardPatrolEntryResource.php index f3a1272..0b56f41 100644 --- a/app/Filament/Resources/GuardPatrolEntryResource.php +++ b/app/Filament/Resources/GuardPatrolEntryResource.php @@ -136,7 +136,6 @@ class GuardPatrolEntryResource extends Resource ->toArray(); }) ->required() - // ->searchable() ->reactive() // ->default(function () { // return optional(GuardPatrolEntry::where('created_by', Filament::auth()->user()?->name)->latest()->first())->check_point_name_id; @@ -231,27 +230,22 @@ class GuardPatrolEntryResource extends Resource Tables\Columns\TextColumn::make('plant.name') ->label('Plant') ->alignCenter() - ->searchable() ->sortable(), Tables\Columns\TextColumn::make('guardNames.name') //guard_name_id ->label('Guard Name') ->alignCenter() - ->searchable() ->sortable(), Tables\Columns\TextColumn::make('checkPointNames.name') //check_point_name_id ->label('Check Point Name') ->alignCenter() - ->searchable() ->sortable(), // Tables\Columns\TextColumn::make('reader_code') // ->label('Reader Code') // ->alignCenter() - // ->searchable() // ->sortable(), Tables\Columns\TextColumn::make('patrol_time') ->label('Patrol Time') ->dateTime() - ->searchable() ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('created_at') @@ -261,7 +255,6 @@ class GuardPatrolEntryResource extends Resource ->sortable(), Tables\Columns\TextColumn::make('created_by') ->label('Created By') - ->searchable() ->alignCenter(), Tables\Columns\TextColumn::make('updated_at') ->label('Updated At') @@ -270,7 +263,6 @@ class GuardPatrolEntryResource extends Resource ->sortable(), Tables\Columns\TextColumn::make('updated_by') ->label('Updated By') - ->searchable() ->alignCenter(), Tables\Columns\TextColumn::make('deleted_at') ->label('Deleted At') @@ -296,7 +288,7 @@ class GuardPatrolEntryResource extends Resource // $set('sap_msg_status', null); // }), Select::make('Guard Name') - ->label('Search by Guard Name') + ->label('Select Guard Name') ->options(function (callable $get) { $plantId = $get('Plant'); if (!$plantId) { @@ -305,10 +297,9 @@ class GuardPatrolEntryResource extends Resource return GuardName::where('plant_id', $plantId)->pluck('name', 'id')->toArray(); }) - ->searchable() ->reactive(), Select::make('Check Point Name') - ->label('Search by Check Point Name') + ->label('Select Check Point Name') ->options(function (callable $get) { $plantId = $get('Plant'); if (!$plantId) { @@ -317,11 +308,19 @@ class GuardPatrolEntryResource extends Resource return CheckPointName::where('plant_id', $plantId)->pluck('name', 'id')->toArray(); }) - ->searchable() ->reactive(), - TextInput::make('Created By') + Select::make('Created By') ->label('Created By') - ->placeholder('Enter Created By'), + ->placeholder('Select Created By') + ->options(function (callable $get) { + $plantId = $get('Plant'); + if (!$plantId) { + return []; + } + + return GuardPatrolEntry::where('plant_id', $plantId)->orderBy('patrol_time', 'asc')->get()->unique('created_by')->pluck('created_by', 'created_by')->toArray();//, 'id' + }) + ->reactive(), DateTimePicker::make(name: 'From Patrol Time') ->label('From Patrol Time') ->beforeOrEqual('To Patrol Time')