diff --git a/app/Filament/Pages/PanelBoxInspectionStock.php b/app/Filament/Pages/PanelBoxInspectionStock.php index c1543f34..16fa4747 100644 --- a/app/Filament/Pages/PanelBoxInspectionStock.php +++ b/app/Filament/Pages/PanelBoxInspectionStock.php @@ -17,6 +17,7 @@ use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Facades\Filament; use Illuminate\Support\Facades\Auth; +use App\Models\InvoiceValidation; class PanelBoxInspectionStock extends Page { @@ -445,6 +446,23 @@ class PanelBoxInspectionStock extends Page } } + $panelExistsInvoice = InvoiceValidation::where('plant_id', $this->plantId) + ->where('panel_box_serial_number', $serialNumber) + // ->where('panel_box_code', $itemCode) + ->where('panel_box_supplier', $supplier) + ->first(); + + if ($panelExistsInvoice) { + Notification::make() + ->title('Duplicate Panel Box Serial Number') + ->body("Duplicate panel already exists.
Panel Box Code: $itemCode, Item Code: {$this->currentItemCode}, Serial Number: $serialNumber, Supplier Number: $supplier against invoice Number: $panelExistsInvoice->invoice_number") + ->danger() + ->seconds(2) + ->send(); + + return; + } + $serialExists = PanelBoxValidation::where('plant_id', $plantId)->where('serial_number', $serialNumber)->where('panel_box_supplier', $supplier)->first(); if ($serialExists) {