Added inspection lot number in panel box validation resource page
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 26s

This commit is contained in:
dhanabalan
2026-08-20 09:18:05 +05:30
parent 9f2ffa46ce
commit 3b890374e0
2 changed files with 97 additions and 10 deletions

View File

@@ -24,6 +24,10 @@ use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Tables\Filters\Filter;
use Str;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use App\Filament\Exports\PanelBoxValidationExporter;
use App\Filament\Imports\PanelBoxValidationImporter;
class PanelBoxValidationResource extends Resource
{
@@ -172,6 +176,40 @@ class PanelBoxValidationResource extends Resource
$set('production_order', request()->get('production_order'));
}
}),
Forms\Components\TextInput::make('inspection_lot_number')
->label('Inspec Lot No')
->placeholder('Scan the valid Inspec Lot No')
->minLength(7)
->maxLength(14)
->reactive()
->readOnly(fn (callable $get) => $get('item_id'))
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
if (! is_numeric($get('inspection_lot_number'))) {
$set('inspecOrdError', 'Must be a numeric value.');
$set('item_id', null);
$set('sticker_master_id', null);
$set('uom', null);
$set('serial_number', null);
} else {
$set('inspecOrdError', null);
$set('inspection_lot_number', $state);
$set('inspection', $state);
}
})
->default(fn ($get) => $get('inspection') ?? session('last_selected_inspection'))
->extraAttributes(fn ($get) => [
'class' => $get('inspecOrdError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('inspecOrdError') ? $get('inspecOrdError') : null)
->hintColor('danger')
->required(),
Forms\Components\Hidden::make('inspection')
->default(fn () => session('last_selected_inspection'))
->afterStateHydrated(function ($state, $set) {
if (! $state && request()->has('inspection_lot_number')) {
$set('inspection_lot_number', request()->get('inspection_lot_number'));
}
}),
Forms\Components\TextInput::make('item_id')
->label('Item Code')
// ->id('item_id')
@@ -186,6 +224,7 @@ class PanelBoxValidationResource extends Resource
$pId = $get('line_id');
$plantId = $get('plant_id');
$plaCode = Plant::find($plantId)?->code;
$inspecLotNo = $get('inspection_lot_number');
$set('part_validation_type', null);
$set('show_validation_image', false);
$set('validation1_image_url', null);
@@ -584,6 +623,15 @@ class PanelBoxValidationResource extends Resource
$set('item_id', null);
return;
}
else if($existInMaster->inspection_lot_number != $inspecLotNo){
Notification::make()
->title('Panel GR Found')
->body("Inspection Lot Number code not match for Production Order (Or) Doc No'{$pOrder}' and Item '{$itemCode}'.")
->danger()
->send();
$set('item_id', null);
return;
}
else if($existInMaster->quantity == '' || $existInMaster->quantity == null){
Notification::make()
->title('Panel GR Found')
@@ -1619,6 +1667,11 @@ class PanelBoxValidationResource extends Resource
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('inspection_lot_number')
->label('Inspection Lot No')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('serial_number')
->label('Serial Number')
->alignCenter()
@@ -1628,52 +1681,62 @@ class PanelBoxValidationResource extends Resource
->label('Serial Number Panel')
->alignCenter()
->searchable()
->sortable(),
->sortable()
->visible(fn ($record) => $record?->stickerMaster?->serial_number_panel == 1),
Tables\Columns\TextColumn::make('pack_slip_panel')
->label('Pack Slip Panel')
->alignCenter()
->searchable()
->sortable(),
->sortable()
->visible(fn ($record) => $record?->stickerMaster?->pack_slip_panel == 1),
Tables\Columns\TextColumn::make('name_plate_panel')
->label('Name Plate Panel')
->alignCenter()
->searchable()
->sortable(),
->sortable()
->visible(fn ($record) => $record?->stickerMaster?->name_plate_panel == 1),
Tables\Columns\TextColumn::make('tube_sticker_panel')
->label('Tube Sticker Panel')
->alignCenter()
->searchable()
->sortable(),
->sortable()
->visible(fn ($record) => $record?->stickerMaster?->tube_sticker_panel == 1),
Tables\Columns\TextColumn::make('warranty_card_panel')
->label('Warranty Card Panel')
->alignCenter()
->searchable()
->sortable(),
->sortable()
->visible(fn ($record) => $record?->stickerMaster?->warranty_card_panel == 1),
Tables\Columns\TextColumn::make('part_validation1')
->label('Part Validation 1')
->alignCenter()
->searchable()
->sortable(),
->sortable()
->visible(fn ($record) => $record?->stickerMaster?->part_validation1 != null),
Tables\Columns\TextColumn::make('part_validation2')
->label('Part Validation 2')
->alignCenter()
->searchable()
->sortable(),
->sortable()
->visible(fn ($record) => $record?->stickerMaster?->part_validation2 != null),
Tables\Columns\TextColumn::make('part_validation3')
->label('Part Validation 3')
->alignCenter()
->searchable()
->sortable(),
->sortable()
->visible(fn ($record) => $record?->stickerMaster?->part_validation3 != null),
Tables\Columns\TextColumn::make('part_validation4')
->label('Part Validation 4')
->alignCenter()
->searchable()
->sortable(),
->sortable()
->visible(fn ($record) => $record?->stickerMaster?->part_validation4 != null),
Tables\Columns\TextColumn::make('part_validation5')
->label('Part Validation 5')
->alignCenter()
->searchable()
->sortable(),
->sortable()
->visible(fn ($record) => $record?->stickerMaster?->part_validation5 != null),
Tables\Columns\TextColumn::make('panel_box_supplier')
->label('Panel Box Supplier')
->alignCenter()
@@ -1909,6 +1972,22 @@ class PanelBoxValidationResource extends Resource
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
])
->headerActions([
ImportAction::make()
->label('Import Panel Box Validation')
->color('warning')
->importer(PanelBoxValidationImporter::class)
->visible(function () {
return Filament::auth()->user()->can('view import panel box validation');
}),
ExportAction::make()
->label('Export Panel Box Validation')
->color('warning')
->exporter(PanelBoxValidationExporter::class)
->visible(function () {
return Filament::auth()->user()->can('view export panel box validation');
}),
]);
}