Added reprint functionality in pallet validation resource page
This commit is contained in:
@@ -476,7 +476,48 @@ class PalletValidationResource extends Resource
|
|||||||
Tables\Actions\RestoreBulkAction::make(),
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
|
// ->headerActions([
|
||||||
->headerActions([
|
->headerActions([
|
||||||
|
Tables\Actions\Action::make('reprint_pallet')
|
||||||
|
->label('Re-Print Pallet QR')
|
||||||
|
->form([
|
||||||
|
Select::make('plant')
|
||||||
|
->options(Plant::pluck('name', 'id')->toArray())
|
||||||
|
->label('Select Plant')
|
||||||
|
->required()
|
||||||
|
->reactive(),
|
||||||
|
Select::make('pallet_list')
|
||||||
|
->label('Select Pallet')
|
||||||
|
->searchable()
|
||||||
|
->required()
|
||||||
|
->reactive()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$plantId = $get('plant');
|
||||||
|
|
||||||
|
if (!$plantId) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return PalletValidation::query()
|
||||||
|
->where('plant_id', $plantId)
|
||||||
|
->whereNotNull('pallet_number')
|
||||||
|
->where('pallet_number','!=', '')
|
||||||
|
->select('pallet_number')
|
||||||
|
->distinct()
|
||||||
|
->orderBy('pallet_number')
|
||||||
|
->pluck('pallet_number', 'pallet_number')
|
||||||
|
->toArray();
|
||||||
|
}),
|
||||||
|
|
||||||
|
])
|
||||||
|
->action(function (array $data) {
|
||||||
|
$selectedPalletNumber = $data['pallet_list'];
|
||||||
|
return redirect()->route('download-qr-pdf', ['palletNo' => $selectedPalletNumber]);
|
||||||
|
|
||||||
|
})
|
||||||
|
->visible(function() {
|
||||||
|
return Filament::auth()->user()->can('view reprint pallet number');
|
||||||
|
}),
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
->importer(PalletValidationImporter::class)
|
->importer(PalletValidationImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user