Added supplier number logic and status column in panel box validation #986
@@ -976,7 +976,6 @@ class PanelBoxValidationResource extends Resource
|
||||
->hint(fn ($get) => $get('validationError') ? $get('validationError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Hidden::make('serial_exists')
|
||||
// ->default(false)
|
||||
->live()
|
||||
->dehydrated()
|
||||
->id('serial_exists'),
|
||||
@@ -996,6 +995,7 @@ class PanelBoxValidationResource extends Resource
|
||||
$plantId = $get('plant_id');
|
||||
$pOrder = $get('production_order');
|
||||
$inspecLotNo = $get('inspection_lot_number');
|
||||
$supplierNo = $get('panel_box_supplier');
|
||||
|
||||
$alreadyExists = PanelBoxValidation::where('serial_number', $serialNumber)
|
||||
->where('plant_id', $plantId)
|
||||
@@ -1016,18 +1016,29 @@ class PanelBoxValidationResource extends Resource
|
||||
|
||||
return;
|
||||
}
|
||||
else if(!$alreadyExists)
|
||||
{
|
||||
if($alreadyExists->panel_box_supplier != $supplierNo){
|
||||
Notification::make()
|
||||
->title('Supplier Mismatch')
|
||||
->body(
|
||||
'Supplier number does not match the existing record for this serial number. Please check the supplier number.'
|
||||
)
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$livewire->showChecklist = false;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$data = $get();
|
||||
|
||||
$hasCharacteristics = $livewire->checkIfHasCharacteristics($data);
|
||||
|
||||
\Log::info('CHARACTERISTICS RESULT', [
|
||||
'hasCharacteristics' => $hasCharacteristics,
|
||||
]);
|
||||
|
||||
if ($hasCharacteristics) {
|
||||
|
||||
\Log::info('SETTING SHOW CHECKLIST TRUE');
|
||||
|
||||
$livewire->showChecklist = true;
|
||||
$livewire->dispatch('close-modal');
|
||||
return;
|
||||
@@ -1868,6 +1879,16 @@ class PanelBoxValidationResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->label('Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'Ok' => 'success',
|
||||
'NotOk' => 'danger',
|
||||
default => 'gray',
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
|
||||
Reference in New Issue
Block a user