diff --git a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
index 86c6575f..b61653b1 100644
--- a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
+++ b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
@@ -4030,7 +4030,136 @@ class CreateInvoiceValidation extends CreateRecord
// TN01/BOX22/SERIAL999 >> PANEL BOX QR
// /^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/
- if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/', $serNo, $matches)) {
+
+ if (preg_match('/^(\d+)\/(\d+)\/(\d+)\/(\d+)$/', $serNo, $matches)) {
+
+ $itemCode = $matches[2];
+ $serialNumber = $matches[1] . $matches[3] . $matches[4];
+
+ $supplierNo = $matches[1];
+ $supplierSNo = implode('/', array_slice($matches, 3));
+ $panelBoxCode = $matches[2];
+
+ $record = InvoiceValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->first();
+
+ if (! $record) {
+ Notification::make()
+ ->title('Serial Number Not Found
Serial \''.$serialNumber.'\' not found in database for choosed plant.')
+ // ->body("Serial '$serialNumber' not found in database for choosed plant.")..........
+ ->danger()
+ ->seconds(3)
+ ->send();
+
+ $this->dispatch('play-warn-sound');
+
+ $this->form->fill([
+ 'plant_id' => $plantId,
+ 'invoice_number' => $invoiceNumber,
+ 'serial_number' => null,
+ 'total_quantity' => $totQuan,
+ 'update_invoice' => false,
+ 'scanned_quantity' => $scanSQuan,
+ ]);
+
+ return;
+ }
+
+ $record1 = InvoiceValidation::where('serial_number', $serialNumber)
+ ->where('plant_id', $plantId)
+ ->whereHas('stickerMasterRelation.item', function ($query) use ($itemCode) {
+ $query->where('plant_id', $this->plantId)->where('code', $itemCode);
+ })
+ ->first();
+
+ if (! $record1) {
+ Notification::make()
+ ->title('Unknown: Item Code')
+ ->body("Item code '$itemCode' with serial number '$serialNumber' not found.")
+ ->danger()
+ ->seconds(3)
+ ->send();
+
+ $this->dispatch('playWarnSound');
+
+ $this->form->fill([
+ 'plant_id' => $plantId,
+ 'invoice_number' => $invoiceNumber,
+ 'serial_number' => null,
+ 'total_quantity' => $totQuan,
+ 'update_invoice' => false,
+ 'scanned_quantity' => $scanSQuan,
+ ]);
+
+ return;
+ }
+
+ $invoiceUpdate = InvoiceValidation::where('plant_id', $plantId)
+ ->where('invoice_number', $invoiceNumber)
+ ->where('sticker_master_id', $record1->sticker_master_id)
+ ->where('serial_number', $serialNumber)
+ ->update([
+ 'scanned_status' => 'Scanned',
+ 'panel_box_supplier' => $supplierNo,
+ 'panel_box_serial_number' => $supplierSNo,
+ 'panel_box_code' => $panelBoxCode,
+ ]);
+
+ $scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
+
+ if($totQuan == $scannedQuantity){
+ Notification::make()
+ ->title('Completed: Panel Box Invoice')
+ ->body("Panel Box invoice '$invoiceNumber' completed the scanning process.
Scan the next 'Panel Box Invoice' to proceed!")
+ ->warning()
+ ->seconds(3)
+ ->send();
+
+ $this->dispatch('playNotificationSound');
+
+ $filename = $invoiceNumber.'.xlsx';
+ $directory = "uploads/temp/{$plantCode}";
+ $disk = Storage::disk('local');
+ $filePath = $directory.'/'.$filename;
+ // $fullPath = null;
+ if ($disk->exists($filePath)) {
+ // $fullPath = $disk->path($filePath);
+ $disk->delete($filePath);
+ }
+
+ $this->form->fill([
+ 'plant_id' => $plantId,
+ 'invoice_number' => null,
+ 'serial_number' => null,
+ 'total_quantity' => 0,
+ 'update_invoice' => false,
+ 'scanned_quantity' => 0,
+ ]);
+
+ $this->dispatch('refreshCompletedInvoice', invoiceNumber: $invoiceNumber, plantId: $plantId, isSerial: true);
+
+ return;
+ }
+
+ if($invoiceUpdate){
+ Notification::make()
+ ->title("Panel Box Success")
+ ->body("Panel Box Serial '$serialNumber' updated successfully.")
+ ->success()
+ ->seconds(3)
+ ->send();
+ $this->form->fill([
+ 'plant_id' => $plantId,
+ 'invoice_number' => $invoiceNumber,
+ 'serial_number' => null,
+ 'total_quantity' => $totQuan,
+ 'update_invoice' => false,
+ 'scanned_quantity' => $scannedQuantity,
+ ]);
+ return;
+ }
+
+ }
+ else if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/', $serNo, $matches)) {
Notification::make()
->danger()
->title('Invalid Serial QR Format')