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
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 26s
This commit is contained in:
@@ -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');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
'last_selected_plant_id',
|
||||
'last_selected_line',
|
||||
'last_selected_production',
|
||||
'last_selected_inspection',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -117,6 +118,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
'production_order' => $this->data['production_order'] ?? null,
|
||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
])
|
||||
);
|
||||
}
|
||||
@@ -220,6 +222,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
$plant = $this->form->getState()['plant'] ?? null;
|
||||
$line = $this->form->getState()['line'] ?? null;
|
||||
$production = $this->form->getState()['production'] ?? null;
|
||||
$inspection = $this->form->getState()['inspection'] ?? null;
|
||||
|
||||
// $this->skipChecklistValidation = false;
|
||||
// $this->showChecklist = false;
|
||||
@@ -244,6 +247,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
'plant_id' => null,
|
||||
'line_id' => null,
|
||||
'production_order' => null,
|
||||
'inspection_lot_number' => null,
|
||||
]);
|
||||
|
||||
|
||||
@@ -260,6 +264,9 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
if ($production) {
|
||||
session(['last_selected_production' => $production]);
|
||||
}
|
||||
if ($inspection) {
|
||||
session(['last_selected_inspection' => $inspection]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
@@ -270,6 +277,7 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
'production_order' => $this->data['production_order'] ?? null,
|
||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user