feat: Enhance visitor resource filters with improved date pickers and non-native selects, and configure table empty state, default sorting, and filter deferral.
This commit is contained in:
parent
15024705e0
commit
829b857ce9
@ -76,12 +76,22 @@ public static function table(Table $table): Table
|
|||||||
->options([
|
->options([
|
||||||
'GET' => 'GET',
|
'GET' => 'GET',
|
||||||
'POST' => 'POST',
|
'POST' => 'POST',
|
||||||
]),
|
])
|
||||||
|
->native(false),
|
||||||
|
|
||||||
Filter::make('date')
|
Filter::make('date')
|
||||||
->schema([
|
->schema([
|
||||||
DatePicker::make('from')->time()->autocomplete(false),
|
DatePicker::make('from')
|
||||||
DatePicker::make('until')->time()->autocomplete(false),
|
->label('Dari')
|
||||||
|
->placeholder('Pilih Tanggal')
|
||||||
|
->displayFormat('l, d F Y')
|
||||||
|
->native(false),
|
||||||
|
|
||||||
|
DatePicker::make('until')
|
||||||
|
->label('Sampai')
|
||||||
|
->placeholder('Pilih Tanggal')
|
||||||
|
->displayFormat('l, d F Y')
|
||||||
|
->native(false),
|
||||||
])
|
])
|
||||||
->query(function (Builder $query, array $data): Builder {
|
->query(function (Builder $query, array $data): Builder {
|
||||||
return $query
|
return $query
|
||||||
@ -89,8 +99,10 @@ public static function table(Table $table): Table
|
|||||||
->when($data['until'], fn (Builder $q): Builder => $q->whereDate('date', '<=', $data['until']));
|
->when($data['until'], fn (Builder $q): Builder => $q->whereDate('date', '<=', $data['until']));
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->recordActions([])
|
->emptyStateIcon(Heroicon::ChartBar)
|
||||||
->toolbarActions([]);
|
->emptyStateDescription('Setelah Anda membubat data pertama, maka akan muncul disini.')
|
||||||
|
->defaultSort('date', 'desc')
|
||||||
|
->deferFilters(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPages(): array
|
public static function getPages(): array
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user