From dc95259fc5bbbc01d63bf80e439f68d7da5394bb Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sun, 20 Sep 2026 10:50:49 +0530 Subject: [PATCH] fix conflict issue in sticker pdf service --- app/Exports/ProductionPlanExport.php | 9 +- app/Filament/Exports/ProcessOrderExporter.php | 17 +- app/Filament/Imports/ProcessOrderImporter.php | 415 +++- app/Filament/Pages/LocatorValidation.php | 1208 +++++------ app/Filament/Pages/ProductionCalender.php | 6 + app/Filament/Pages/ProductionQuantityPage.php | 136 +- app/Filament/Pages/ProductionRejectReason.php | 1821 +++++++++-------- app/Filament/Pages/ProductionTarget.php | 16 + app/Filament/Pages/RfqDashboard.php | 49 +- app/Filament/Pages/Welcome.php | 2 + .../Pages/CreateInvoiceValidation.php | 2 +- .../Resources/ItemCharacteristicResource.php | 20 + app/Filament/Resources/ItemResource.php | 3 - app/Filament/Resources/LineResource.php | 10 +- .../Pages/CreateProcessOrder.php | 18 + .../Pages/EditProcessOrder.php | 65 + .../Resources/ProductionPlanResource.php | 3 +- .../Pages/EditRfqTransporterBid.php | 3 - .../Pages/CreateSerialValidation.php | 56 + .../StickerStructureDetailResource.php | 43 +- .../Pages/CreateStickerValidation.php | 166 +- app/Http/Controllers/MachineController.php | 92 +- app/Http/Controllers/PdfController.php | 14 +- app/Livewire/ProductionTargetPlan.php | 334 +-- app/Models/Line.php | 1 + app/Models/ProductionQuantity.php | 3 +- app/Models/StickerStructureDetail.php | 5 + app/Providers/AppServiceProvider.php | 13 + app/Services/StickerPdfService.php | 20 +- ...82850_create_sticker_validations_table.php | 2 +- database/seeders/PermissionSeeder.php | 12 + package-lock.json | 915 ++++++++- package.json | 5 + .../views/fields/generate-template.blade.php | 2 + .../views/filament/pages/welcome.blade.php | 103 +- .../create-sticker-validation.blade.php | 26 + resources/views/forms/calendar.blade.php | 94 +- .../livewire/production-target-plan.blade.php | 31 +- .../livewire/sticker-validation.blade.php | 6 +- routes/api.php | 40 +- routes/console.php | 2 +- vite.config.js | 22 +- 42 files changed, 3844 insertions(+), 1966 deletions(-) diff --git a/app/Exports/ProductionPlanExport.php b/app/Exports/ProductionPlanExport.php index 92a4eca..f3278a1 100644 --- a/app/Exports/ProductionPlanExport.php +++ b/app/Exports/ProductionPlanExport.php @@ -34,6 +34,7 @@ class ProductionPlanExport implements FromArray, WithHeadings, WithMapping // Add dynamic headings for each date: Target / Produced foreach ($this->dates as $date) { + $headings[] = $date . ' - Line Capacity'; $headings[] = $date . ' - Target Plan'; $headings[] = $date . ' - Produced Quantity'; } @@ -43,19 +44,17 @@ class ProductionPlanExport implements FromArray, WithHeadings, WithMapping public function map($row): array { - $mapped = [ + $mapped = [ $row['plant_name'] ?? '', $row['line_name'] ?? '', $row['item_code'] ?? '', ]; - // Add daily target and produced quantity for each date foreach ($this->dates as $date) { - // $mapped[] = $row['daily_target_dynamic'] ?? 0; + $mapped[] = $row['daily_line_capacity'][$date] ?? '-'; $mapped[] = $row['daily_target_dynamic'][$date] ?? '-'; - $mapped[] = $row['produced_quantity'][$date] ?? 0; + $mapped[] = $row['produced_quantity'][$date] ?? '-'; } - return $mapped; } diff --git a/app/Filament/Exports/ProcessOrderExporter.php b/app/Filament/Exports/ProcessOrderExporter.php index 833edcb..e2da8b6 100644 --- a/app/Filament/Exports/ProcessOrderExporter.php +++ b/app/Filament/Exports/ProcessOrderExporter.php @@ -24,32 +24,41 @@ class ProcessOrderExporter extends Exporter }), ExportColumn::make('plant.code') ->label('PLANT CODE'), + ExportColumn::make('line.name') + ->label('LINE NAME'), ExportColumn::make('item.code') ->label('ITEM CODE'), + ExportColumn::make('item.description') + ->label('ITEM DESCRIPTION'), ExportColumn::make('process_order') ->label('PROCESS ORDER'), ExportColumn::make('coil_number') ->label('COIL NUMBER'), ExportColumn::make('order_quantity') ->label('ORDER QUANTITY'), + ExportColumn::make('updated_order_quantity') + ->label('UPDATED ORDER QUANTITY'), ExportColumn::make('received_quantity') ->label('RECEIVED QUANTITY'), ExportColumn::make('sfg_number') ->label('SFG NUMBER'), ExportColumn::make('machine_name') - ->label('MACHINE ID'), + ->label('MACHINE NAME'), + ExportColumn::make('scrap_quantity') + ->label('SCRAP QUANTITY'), + ExportColumn::make('rework_status') + ->label('REWORK STATUS'), ExportColumn::make('created_at') ->label('CREATED AT'), - ExportColumn::make('updated_at') - ->label('UPDATED AT'), ExportColumn::make('created_by') ->label('CREATED BY'), + ExportColumn::make('updated_at') + ->label('UPDATED AT'), ExportColumn::make('updated_by') ->label('UPDATED BY'), ExportColumn::make('deleted_at') ->enabledByDefault(false) ->label('DELETED AT'), - ]; } diff --git a/app/Filament/Imports/ProcessOrderImporter.php b/app/Filament/Imports/ProcessOrderImporter.php index 9534cb6..24b2f06 100644 --- a/app/Filament/Imports/ProcessOrderImporter.php +++ b/app/Filament/Imports/ProcessOrderImporter.php @@ -3,13 +3,16 @@ namespace App\Filament\Imports; use App\Models\Item; +use App\Models\Line; use App\Models\Plant; use App\Models\ProcessOrder; +use App\Models\ProductCharacteristicsMaster; use App\Models\User; use Filament\Actions\Imports\Exceptions\RowImportFailedException; use Filament\Actions\Imports\ImportColumn; use Filament\Actions\Imports\Importer; use Filament\Actions\Imports\Models\Import; +use Filament\Facades\Filament; use Str; class ProcessOrderImporter extends Importer @@ -22,10 +25,15 @@ class ProcessOrderImporter extends Importer ImportColumn::make('plant') ->requiredMapping() ->exampleHeader('PLANT CODE') - ->example('1000') + ->example('1200') ->label('PLANT CODE') ->relationship(resolveUsing: 'code') ->rules(['required']), + ImportColumn::make('line') + ->exampleHeader('LINE NAME') + ->example('Poly Wrapped Wire SFG') + ->label('LINE NAME') + ->relationship(resolveUsing: 'name'), ImportColumn::make('item') ->requiredMapping() ->exampleHeader('ITEM CODE') @@ -34,68 +42,393 @@ class ProcessOrderImporter extends Importer ->relationship(resolveUsing: 'code') ->rules(['required']), ImportColumn::make('process_order') + ->requiredMapping() ->exampleHeader('PROCESS ORDER') - ->example('202500123456') + ->example('202601123456') ->label('PROCESS ORDER') ->rules(['required']), + ImportColumn::make('order_quantity') + ->requiredMapping() + ->exampleHeader('ORDER QUANTITY') + ->example('1000') + ->label('ORDER QUANTITY') + ->rules(['required']), + ImportColumn::make('updated_order_quantity') + ->exampleHeader('UPDATED ORDER QUANTITY') + ->label('UPDATED ORDER QUANTITY'), + ImportColumn::make('coil_number') + ->exampleHeader('COIL NUMBER') + // ->example('01') + ->label('COIL NUMBER'), + ImportColumn::make('received_quantity') + ->exampleHeader('RECEIVED QUANTITY') + // ->example('01') + ->label('RECEIVED QUANTITY'), + ImportColumn::make('sfg_number') + ->exampleHeader('SFG NUMBER') + // ->example('200000220613-72') + ->label('SFG NUMBER'), + ImportColumn::make('machine_name') + ->exampleHeader('MACHINE NAME') + // ->example('WMIWRM13 - 2-L2') + ->label('MACHINE NAME'), + ImportColumn::make('scrap_quantity') + ->exampleHeader('SCRAP QUANTITY') + // ->example('0') + ->label('SCRAP QUANTITY'), + ImportColumn::make('rework_status') + ->exampleHeader('REWORK STATUS') + // ->example('0') + ->label('REWORK STATUS'), + ImportColumn::make('created_at') + ->exampleHeader('CREATED AT') + // ->example('2026-02-20 13:00:00') + ->label('CREATED AT'), + ImportColumn::make('updated_at') + ->exampleHeader('UPDATED AT') + // ->example('2026-02-20 13:00:00') + ->label('UPDATED AT'), ImportColumn::make('created_by') ->exampleHeader('CREATED BY') - ->example('RAW01234') - ->label('CREATED BY') - ->rules(['required']), + // ->example('RAW01234') + ->label('CREATED BY'), + ImportColumn::make('updated_by') + ->exampleHeader('UPDATED BY') + // ->example('RAW01234') + ->label('UPDATED BY'), ]; } public function resolveRecord(): ?ProcessOrder { $warnMsg = []; - $plant = Plant::where('code', $this->data['plant'])->first(); - $itemCode = Item::where('code', $this->data['item'])->first(); - $iCode = trim($this->data['item']); - - if (! $plant) { - $warnMsg[] = 'Plant not found'; - } elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) { - $warnMsg[] = 'Invalid item code found'; - } elseif (! $itemCode) { - $warnMsg[] = 'Item Code not found'; - } - + $plant = null; + $plantCod = trim($this->data['plant']) ?? ''; + $plantId = null; + $iCode = trim($this->data['item']) ?? ''; + $itemId = null; + $lineNam = trim($this->data['line']) ?? ''; + $lineId = null; $processOrder = trim($this->data['process_order'] ?? ''); + $coilNo = trim($this->data['coil_number'] ?? ''); + $sfgNo = trim($this->data['sfg_number'] ?? ''); + $machineName = trim($this->data['machine_name'] ?? ''); + $orderQuan = trim($this->data['order_quantity'] ?? ''); + $updatedOrderQuan = trim($this->data['updated_order_quantity'] ?? ''); + $scrapQuan = trim($this->data['scrap_quantity'] ?? ''); + $reworkStatus = trim($this->data['rework_status'] ?? ''); + $recQuan = trim($this->data['received_quantity'] ?? ''); + $createdAt = trim($this->data['created_at'] ?? ''); + $createdBy = trim($this->data['created_by'] ?? ''); + $updatedAt = trim($this->data['updated_at'] ?? ''); + $updatedBy = trim($this->data['updated_by'] ?? ''); + // $user = Filament::auth()->user(); + // $operatorName = $user->name; - if ($processOrder == '') { - $warnMsg[] = 'Process Order cannot be empty'; + if ($plantCod == null || $plantCod == '') { + $warnMsg[] = "Plant code can't be empty!"; + } elseif (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,6}$/', $plantCod)) { + $warnMsg[] = 'Invalid plant code found'; + } + if ($iCode == null || $iCode == '') { + $warnMsg[] = "Item code can't be empty!"; + } elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) { + $warnMsg[] = 'Invalid item code found!'; + } + if ($machineName != null && $machineName != '' && Str::length($machineName) > 18) { + $warnMsg[] = 'Invalid machine name found!'; + } + if ($processOrder == null || $processOrder == '') { + $warnMsg[] = "Process order can't be empty!"; + } elseif ($processOrder && (Str::contains($processOrder, '.') || Str::contains($processOrder, 'E', ignoreCase: true))) { + $warnMsg[] = 'Invalid process order found!'; + } + if ($lineNam == null || $lineNam == '') { + $warnMsg[] = "Line name can't be empty!"; + } + if ($orderQuan == null || $orderQuan == '') { + $warnMsg[] = "Order quantity can't be empty!"; + } elseif ($orderQuan == 0 || $orderQuan == '0') { + $warnMsg[] = "Order quantity can't be zero!"; + } elseif (Str::length($orderQuan) >= 1 && ! is_numeric($orderQuan)) { + $warnMsg[] = 'Invalid order quantity found!'; + } + if ($updatedOrderQuan == null || $updatedOrderQuan == '' || $updatedOrderQuan == 0 || $updatedOrderQuan == '0') { + $updatedOrderQuan = $orderQuan; + } elseif (Str::length($updatedOrderQuan) >= 1 && ! is_numeric($updatedOrderQuan)) { + $warnMsg[] = 'Invalid Updated order quantity found!'; } - $user = User::where('name', $this->data['created_by'])->first(); - if (! $user) { - $warnMsg[] = 'User not found'; + if ($coilNo == null || $coilNo == '') { + $coilNo = '0'; } - - if ($plant && $processOrder != '') { - - $existingOrder = ProcessOrder::where('plant_id', $plant->id) - ->where('process_order', $processOrder) - ->first(); - - if ($existingOrder && $existingOrder->item_id !== ($itemCode->id ?? null)) { - $warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code'; - } + if ($scrapQuan == null || $scrapQuan == '') { + $scrapQuan = 0; + } + if ($recQuan == null || $recQuan == '') { + $recQuan = 0; + } + if ($reworkStatus == null || $reworkStatus = '' || $reworkStatus == 0 || $reworkStatus = '0') { + $reworkStatus = 0; + } elseif ($reworkStatus == 1 || $reworkStatus = '1') { + $reworkStatus = 1; + } else { + $warnMsg[] = 'Invalid rework status found!'; } if (! empty($warnMsg)) { throw new RowImportFailedException(implode(', ', $warnMsg)); } - return ProcessOrder::create([ - 'plant_id' => $plant->id, - 'item_id' => $itemCode->id, - 'process_order' => trim($this->data['process_order']), - 'coil_number' => '0', - 'order_quantity' => 0, - 'received_quantity' => 0, - 'created_by' => $user->name, - ]); + $plant = Plant::where('code', $plantCod)->first(); + if (! $plant) { + $warnMsg[] = 'Plant not found!'; + } else { + $plantId = $plant->id; + } + + // TESTING PURPOSE ONLY - TO CHECK DUPLICATE PROCESS ORDER WITH SAME COIL NUMBER FOR THE SAME PLANT + // $existing = ProcessOrder::where('plant_id', $plantId)->where('process_order', $processOrder)->first(); + // if ($existing) { + // $existing = ProcessOrder::where('plant_id', $plantId)->where('process_order', $processOrder)->where('coil_number', $coilNo)->first(); + // if ($existing) { + // $warnMsg[] = 'Process Order with coil number already exists!'; + // } else { + // $warnMsg[] = 'Process order already exists!'; + // } + // } else { + // $warnMsg[] = 'New process order found!'; + // } + // if (! empty($warnMsg)) { + // throw new RowImportFailedException(implode(', ', $warnMsg)); + // } + + $itemCode = Item::where('code', $iCode)->first(); + if (! $itemCode) { + $warnMsg[] = 'Item code not found!'; + } else { + if ($plantId) { + $itemCode = Item::where('code', $iCode)->where('plant_id', $plantId)->first(); + if (! $itemCode) { + $warnMsg[] = 'Item code not found for the given plant!'; + } else { + $itemId = $itemCode->id; + } + } + } + + $lineExists = Line::where('name', $lineNam)->first(); + if (! $lineExists) { + $warnMsg[] = 'Line name not found!'; + } else { + if ($plantId) { + $lineAgainstPlant = Line::where('name', $lineNam)->where('plant_id', $plantId)->first(); + if (! $lineAgainstPlant) { + $warnMsg[] = 'Line name not found for the given plant!'; + } else { + $lineId = $lineAgainstPlant->id; + } + } + } + + if ($plantId && $itemId && $lineId && $processOrder != '') { + $existingOrder = ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + ->first(); + + if ($existingOrder && $existingOrder->item_id !== ($itemId ?? null)) { + $warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code!'; + } + + // $masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('item_id', $itemId)->first(); + + // if (! $masterExist) { + // $warnMsg[] = 'Characteristics master not found for the given plant!'; + // } else { + // $masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->where('item_id', $itemId)->first(); + + // if (! $masterExist) { + // $warnMsg[] = 'Characteristics master not found for the given line!'; + // } + // } + } + + // $user = User::where('name', $this->data['created_by'])->first(); + // if (! $user) { + // $warnMsg[] = 'User not found!'; + // } + + if (! $createdBy) { + $createdBy = Filament::auth()->user()->name; + $updatedBy = Filament::auth()->user()->name; + } elseif (! $updatedBy) { + $updatedBy = Filament::auth()->user()->name; + } + + if (! empty($warnMsg)) { + throw new RowImportFailedException(implode(', ', $warnMsg)); + } + + $existing = ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + // ->where('coil_number', $coilNo) + ->first(); + + $receivedQty = ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + ->sum('received_quantity'); + + if ($existing) { + $liveOrdQuan = (float) $existing->order_quantity; + $liveUpdatedOrdQuan = (float) $existing->updated_order_quantity; + + $allowedIncrease = $liveOrdQuan * 0.10; + + $maxAllowedQty = $liveOrdQuan + $allowedIncrease; + $minAllowedQty = $liveOrdQuan - $allowedIncrease; + + if ($liveUpdatedOrdQuan > $maxAllowedQty) { + throw new RowImportFailedException( + "Updated order quantity cannot exceed 10% of existing order quantity. Max allowed: {$maxAllowedQty}!" + ); + } elseif ($liveUpdatedOrdQuan < $minAllowedQty) { + throw new RowImportFailedException( + "Updated order quantity cannot decrease -10% of existing order quantity. Min allowed: {$minAllowedQty}!" + ); + } elseif ($liveUpdatedOrdQuan < $receivedQty) { + throw new RowImportFailedException( + "Updated order quantity cannot decrease below its received quantity {$receivedQty}!" + ); + } + } + + if ($coilNo != null && $coilNo != '' && $scrapQuan && $reworkStatus && $recQuan && $createdAt && $createdBy && $updatedAt && $updatedBy && Filament::auth()->user()->hasRole('Super Admin')) { + $existingCoil = ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + ->where('line_id', $lineId) + ->where('coil_number', $coilNo) + ->first(); + + // $existingProcess = ProcessOrder::where('plant_id', $plantId) + // ->where('process_order', $processOrder) + // ->where('line_id', $lineId) + // ->first(); + + if ($existing) { + $existUpdateOrdQuan = $existing->updated_order_quantity; + } else { + $existUpdateOrdQuan = $updatedOrderQuan; + } + + if (! $existingCoil) { + ProcessOrder::Create( + [ + 'plant_id' => $plantId, + 'line_id' => $lineId, + 'process_order' => $processOrder, + 'item_id' => $itemId, + 'coil_number' => $coilNo, + 'order_quantity' => $orderQuan, + 'updated_order_quantity' => $existUpdateOrdQuan, + 'received_quantity' => $recQuan, + 'scrap_quantity' => $scrapQuan, + 'sfg_number' => $sfgNo, + 'machine_name' => $machineName, + 'rework_status' => $reworkStatus, + 'created_at' => $createdAt, + 'updated_at' => $updatedAt, + 'created_by' => $createdBy, + 'updated_by' => $updatedBy, + ] + ); + } else { + ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + ->where('line_id', $lineId) + ->where('coil_number', $coilNo) + ->update([ + // 'order_quantity' => $orderQty, + 'received_quantity' => $recQuan, + 'scrap_quantity' => $scrapQuan, + // 'sfg_number' => $sfgNo, + // 'machine_name' => $machineId, + 'rework_status' => $reworkStatus, + 'updated_by' => $updatedBy, + 'updated_at' => $updatedAt, + ]); + } + } else { + $coilNo = '0'; + // $existing = ProcessOrder::where('plant_id', $plantId) + // ->where('process_order', $processOrder) + // // ->where('coil_number', $coilNo) + // ->first(); + + if ($existing) { + $existUpdateOrdQuan = $existing->updated_order_quantity; + } else { + $existUpdateOrdQuan = $updatedOrderQuan; + } + + if (! $existing && ($coilNo == '0' || $coilNo == 0)) { + ProcessOrder::create([ + 'plant_id' => $plantId, + 'line_id' => $lineId, + 'item_id' => $itemId, + 'process_order' => $processOrder, + 'coil_number' => '0', + 'order_quantity' => $orderQuan, + 'updated_order_quantity' => $existUpdateOrdQuan, + 'received_quantity' => 0, + 'scrap_quantity' => 0, + 'created_by' => $createdBy, + 'updated_by' => $updatedBy, + ]); + } elseif (! $existing) { + ProcessOrder::Create( + [ + 'plant_id' => $plantId, + 'line_id' => $lineId, + 'item_id' => $itemId, + 'process_order' => $processOrder, + 'coil_number' => $coilNo, + 'order_quantity' => $orderQuan, + 'updated_order_quantity' => $existUpdateOrdQuan, + 'received_quantity' => $recQuan, + 'scrap_quantity' => $scrapQuan ?? 0, + 'sfg_number' => $sfgNo, + 'machine_name' => $machineName, + 'rework_status' => $reworkStatus, + // 'created_at' => $createdAt, + // 'updated_at' => $updatedAt, + 'created_by' => $createdBy, + 'updated_by' => $updatedBy, + ] + ); + } else {// $coilNo = '0' + if ($existing->process_order == $processOrder) { + throw new RowImportFailedException('Process order already exist for the given plant!'); + } elseif ($existing->rework_status == 1 && $reworkStatus == 0) { + throw new RowImportFailedException('Rework coil number already exist for the given Plant and Process Order!'); + } else { + ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + ->where('coil_number', $coilNo) + ->update([ + // 'order_quantity' => $orderQty, + 'received_quantity' => $recQuan, + 'scrap_quantity' => $scrapQuan, + // 'sfg_number' => $sfgNo, + // 'machine_name' => $machineId, + 'rework_status' => $reworkStatus, + 'updated_by' => $updatedBy, + // 'updated_at' => $updatedAt, + ]); + } + } + } + + return null; // return new ProcessOrder(); } diff --git a/app/Filament/Pages/LocatorValidation.php b/app/Filament/Pages/LocatorValidation.php index 1810efd..99c64a1 100644 --- a/app/Filament/Pages/LocatorValidation.php +++ b/app/Filament/Pages/LocatorValidation.php @@ -6,22 +6,16 @@ use App\Models\Locator; use App\Models\LocatorInvoiceValidation; use App\Models\PalletValidation; use App\Models\Plant; -use Barryvdh\DomPDF\Facade\Pdf; use Filament\Facades\Filament; -use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\Section; use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; -use Filament\Pages\Page; -use Filament\Forms\Contracts\HasForms; use Filament\Forms\Concerns\InteractsWithForms; +use Filament\Forms\Contracts\HasForms; use Filament\Forms\Form; -use Filament\Forms\Components\Actions; -use Filament\Forms\Components\ViewField; use Filament\Notifications\Notification; +use Filament\Pages\Page; use Illuminate\Support\Facades\Auth; -use SimpleSoftwareIO\QrCode\Facades\QrCode; -use Mpdf\Mpdf; class LocatorValidation extends Page implements HasForms { @@ -35,12 +29,18 @@ class LocatorValidation extends Page implements HasForms use InteractsWithForms; - public $pId, $palletNo, $serialNo; + public $pId; + + public $palletNo; + + public $serialNo; public bool $disableSerialNo = false; + public bool $disablePalletNo = false; public $locatorNumber; + public $state = []; public $plantId; @@ -54,7 +54,7 @@ class LocatorValidation extends Page implements HasForms public function mount() { $this->form->fill([ - 'plant_id'=>$this->plantId, + 'plant_id' => $this->plantId, 'pallet_quantity' => 0, ]); } @@ -69,9 +69,10 @@ class LocatorValidation extends Page implements HasForms Select::make('plant_id') ->label('Plant') ->reactive() - //->options(Plant::pluck('name', 'id')) + // ->options(Plant::pluck('name', 'id')) ->options(function (callable $get) { $userHas = Filament::auth()->user()->plant_id; + return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); }) ->required(), @@ -80,7 +81,7 @@ class LocatorValidation extends Page implements HasForms ->minLength(10) ->reactive() // ->readonly(fn () => $this->disablePalletNo) - ->readOnly(fn (callable $get) => !$get('plant_id') || !empty($get('scan_serial_no')) || !empty($get('scan_locator_no'))) + ->readOnly(fn (callable $get) => ! $get('plant_id') || ! empty($get('scan_serial_no')) || ! empty($get('scan_locator_no'))) ->extraAttributes([ 'wire:keydown.enter' => 'processPalletNo($event.target.value)', ]), @@ -89,7 +90,7 @@ class LocatorValidation extends Page implements HasForms ->minLength(9) ->reactive() // ->readOnly(fn () => $this->disableSerialNo) - ->readOnly(fn (callable $get) => !$get('plant_id') || !empty($get('scan_pallet_no')) || !empty($get('scan_locator_no'))) + ->readOnly(fn (callable $get) => ! $get('plant_id') || ! empty($get('scan_pallet_no')) || ! empty($get('scan_locator_no'))) ->extraAttributes([ 'wire:keydown.enter' => 'processSerialNo($event.target.value)', ]), @@ -97,7 +98,7 @@ class LocatorValidation extends Page implements HasForms ->label('Scan Locator No') ->minLength(7) ->reactive() - ->readOnly(fn (callable $get) => !$get('plant_id') || (!$get('scan_pallet_no') && !$get('scan_serial_no'))) + ->readOnly(fn (callable $get) => ! $get('plant_id') || (! $get('scan_pallet_no') && ! $get('scan_serial_no'))) ->extraAttributes([ 'id' => 'scan_locator_no', 'wire:keydown.enter' => 'processLocatorNo($event.target.value)', @@ -108,7 +109,7 @@ class LocatorValidation extends Page implements HasForms ->default('0') ->readOnly(), ]) - ->columns(5) + ->columns(5), ]); } @@ -118,7 +119,7 @@ class LocatorValidation extends Page implements HasForms $plantId = trim($plantId) ?? null; - $palletNo= $this->form->getState()['scan_pallet_no']; + $palletNo = $this->form->getState()['scan_pallet_no']; $palletNo = trim($palletNo) ?? null; @@ -132,88 +133,83 @@ class LocatorValidation extends Page implements HasForms $operatorName = Filament::auth()->user()->name; - if ($serialNo && $scanLocator) - { + if ($serialNo && $scanLocator) { return; } - if ($palletNo == null || $palletNo == '') - { + if ($palletNo == null || $palletNo == '') { Notification::make() ->title("Pallet number can't be empty!") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (strlen($palletNo) < 10) - { + } elseif (strlen($palletNo) < 10) { Notification::make() ->title("Pallet number '$palletNo' must be at least 10 digits.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $Palletexists = PalletValidation::where('pallet_number', $palletNo) - ->where('plant_id', $plantId)->first(); - if(!$Palletexists) - { + ->where('plant_id', $plantId)->first(); + if (! $Palletexists) { Notification::make() ->title("Pallet number '$palletNo' does not found in pallet table.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); - return; + + return; } $locators = PalletValidation::where('plant_id', $plantId) - ->where('pallet_number', $palletNo) - ->get(); + ->where('pallet_number', $palletNo) + ->get(); - $query = PalletValidation::where('plant_id', $plantId) - ->where('pallet_number', $palletNo); + $query = PalletValidation::where('plant_id', $plantId) + ->where('pallet_number', $palletNo); $palletRow = PalletValidation::where('plant_id', $plantId) - ->where('pallet_number', $palletNo) - ->first(); + ->where('pallet_number', $palletNo) + ->first(); $locatorNumber = $palletRow->locator_number; @@ -240,51 +236,46 @@ class LocatorValidation extends Page implements HasForms // $count = 0; // } $count = PalletValidation::where('plant_id', $plantId) - ->where('locator_number', $locatorNumber) - ->count('locator_number'); + ->where('locator_number', $locatorNumber) + ->count('locator_number'); $pallets = $query->first(); - if ($pallets) - { + if ($pallets) { $this->locatorNumber = $pallets->locator_number; - } - else - { + } else { $this->locatorNumber = ''; } - $allCompleted = $locators->every(function ($pallet) - { + $allCompleted = $locators->every(function ($pallet) { return $pallet->pallet_status == 'Completed'; }); $notAlreadyCompleted = PalletValidation::where('plant_id', $plantId) ->where('pallet_number', $palletNo) ->whereNull('pallet_status') - ->orWhere('pallet_status', '=','') + ->orWhere('pallet_status', '=', '') // ->where('locator_number', $this->scanLocator) ->first(); - if($notAlreadyCompleted) - { + if ($notAlreadyCompleted) { Notification::make() ->title("Pallet number '{$palletNo}' does not completed the master packing.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } @@ -299,18 +290,17 @@ class LocatorValidation extends Page implements HasForms // 'scan_locator_no' => $locatorNumber, // ]); - $this->form->fill([ - 'plant_id' => $plantId, + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => $locatorNumber, 'pallet_quantity' => $count, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); - if ($this->locatorNumber) - { + if ($this->locatorNumber) { Notification::make() ->title("Press 'Remove Pallet' button to remove Pallet number : '$palletNo' from Locator number : '$locatorNumber'..!") ->info() @@ -318,7 +308,7 @@ class LocatorValidation extends Page implements HasForms ->send(); } - $this->dispatch('loadData' ,$palletNo,$locatorNumber,$plantId); + $this->dispatch('loadData', $palletNo, $locatorNumber, $plantId); } } @@ -338,126 +328,116 @@ class LocatorValidation extends Page implements HasForms $operatorName = Filament::auth()->user()->name; - if ($palletNo && $scanLocator) - { + if ($palletNo && $scanLocator) { return; - } - else if ($palletNo) - { + } elseif ($palletNo) { return; } - if ($serialNo == null || $serialNo == '') - { + if ($serialNo == null || $serialNo == '') { Notification::make() ->title("Serial number can't be empty!") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (strlen($serialNo) < 9 || strlen($serialNo) > 20) - { + } elseif (strlen($serialNo) < 9 || strlen($serialNo) > 20) { Notification::make() - ->title("Serial number should contain minimum 9 digits and maximum 20 digits.") + ->title('Serial number should contain minimum 9 digits and maximum 20 digits.') ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (!ctype_alnum($serialNo)) - { + } elseif (! ctype_alnum($serialNo)) { Notification::make() ->title("Serial number '$serialNo' must contain alpha-numeric values only.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $invoicesnoexists = LocatorInvoiceValidation::where('plant_id', $plantId) - ->where('serial_number', $serialNo) - ->where('scanned_status', '=','Scanned') - ->first(); + ->where('serial_number', $serialNo) + ->where('scanned_status', '=', 'Scanned') + ->first(); $invoiceNo = $invoicesnoexists?->invoice_number; - if ($invoicesnoexists) - { + if ($invoicesnoexists) { Notification::make() ->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process..!") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $existingRecord = PalletValidation::where('plant_id', $plantId) - ->where('serial_number', $serialNo) - ->where(function ($query) { - $query->where('pallet_number', '!=', '') - ->whereNotNull('pallet_number'); - }) - ->first(); + ->where('serial_number', $serialNo) + ->where(function ($query) { + $query->where('pallet_number', '!=', '') + ->whereNotNull('pallet_number'); + }) + ->first(); $existingLocator = PalletValidation::where('plant_id', $plantId) - ->where('serial_number', $serialNo) - ->first(); + ->where('serial_number', $serialNo) + ->first(); $palletnumber = $existingRecord?->pallet_number; $locatorNo = $existingLocator?->locator_number; - if ($existingRecord) - { + if ($existingRecord) { Notification::make() ->title("Scanned serial number '$serialNo' already exist in pallet number '$palletnumber'!
Scan the valid new serial number to proceed...") ->danger() @@ -471,23 +451,20 @@ class LocatorValidation extends Page implements HasForms // 'scanned_by' => $operatorName, // ]); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); - $this->dispatch('loadLocator' ,'',$plantId); + $this->dispatch('loadLocator', '', $plantId); return; - } - else - { + } else { $this->disableSerialNo = true; if ($locatorNo) { @@ -499,23 +476,22 @@ class LocatorValidation extends Page implements HasForms } $count = PalletValidation::where('plant_id', $plantId) - ->where('locator_number', $locatorNo) - ->count('locator_number'); + ->where('locator_number', $locatorNo) + ->count('locator_number'); $this->form->fill([ - 'plant_id' => $plantId, + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => null, 'scan_locator_no' => $locatorNo, 'pallet_quantity' => $count, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); - $this->dispatch('focus-scan-locator-no'); - $this->dispatch('loadserialNo' ,$serialNo,$plantId); + $this->dispatch('loadserialNo', $serialNo, $plantId); } } @@ -528,7 +504,7 @@ class LocatorValidation extends Page implements HasForms $this->plantId = $plantId; - $palletNo= $this->form->getState()['scan_pallet_no']; + $palletNo = $this->form->getState()['scan_pallet_no']; $palletNo = trim($palletNo) ?? null; @@ -544,60 +520,55 @@ class LocatorValidation extends Page implements HasForms $this->locators = PalletValidation::where('plant_id', $plantId)->where('locator_number', '11111')->get(); - if (!$palletNo && !$serialNo) - { + if (! $palletNo && ! $serialNo) { return; } - if ($scanLocator == null || $scanLocator == '') - { + if ($scanLocator == null || $scanLocator == '') { Notification::make() ->title("Locator number can't be empty!") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (strlen($scanLocator) < 7) - { + } elseif (strlen($scanLocator) < 7) { Notification::make() ->title("Locator number '$scanLocator' must be at least 7 digits.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $exists = Locator::where('plant_id', $plantId) - ->where('locator_number', $scanLocator) - ->first(); + ->where('locator_number', $scanLocator) + ->first(); - if(!$exists) - { + if (! $exists) { Notification::make() ->title("Locator number '{$scanLocator}' does not exist in the master.") ->danger() @@ -611,24 +582,24 @@ class LocatorValidation extends Page implements HasForms // 'pallet_quantity' => 0, // ]); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); - $this->dispatch('loadLocator' ,'',$plantId); + $this->dispatch('loadLocator', '', $plantId); + return; } $locator = Locator::where('locator_number', $scanLocator) - ->where('plant_id', $plantId) - ->first(); + ->where('plant_id', $plantId) + ->first(); if ($locator->locator_quantity >= 2) { // Use >= for simplicity Notification::make() @@ -637,75 +608,72 @@ class LocatorValidation extends Page implements HasForms ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); + $this->dispatch('loadLocator', '', $plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $this->locators = PalletValidation::where('plant_id', $plantId) - ->where('locator_number', $scanLocator) - ->get(); + ->where('locator_number', $scanLocator) + ->get(); - if ($palletNo) - { - if (strlen($palletNo) < 10) - { + if ($palletNo) { + if (strlen($palletNo) < 10) { Notification::make() ->title("Pallet number '$palletNo' must be at least 10 digits.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $notAlreadyCompleted = PalletValidation::where('plant_id', $plantId) ->where('pallet_number', $palletNo) ->whereNull('pallet_status') - ->orWhere('pallet_status', '=','') + ->orWhere('pallet_status', '=', '') // ->where('locator_number', $this->scanLocator) ->first(); - if($notAlreadyCompleted) - { + if ($notAlreadyCompleted) { Notification::make() ->title("Pallet number '{$palletNo}' does not completed the master packing.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } @@ -713,137 +681,125 @@ class LocatorValidation extends Page implements HasForms ->where('plant_id', $plantId) ->first(); - if ($locatorExist && $locatorExist->locator_number && $locatorExist->locator_number != $scanLocator) - { + if ($locatorExist && $locatorExist->locator_number && $locatorExist->locator_number != $scanLocator) { Notification::make() ->title("Pallet number '$palletNo' is already assigned to locator number '{$locatorExist->locator_number}'.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); return; } - if ($locatorExist && $locatorExist->locator_number == $scanLocator) - { + if ($locatorExist && $locatorExist->locator_number == $scanLocator) { Notification::make() ->title("Press 'Remove Pallet' button to remove Pallet number : '$palletNo' from Locator number : '$scanLocator'..!") ->info() ->duration(2000) ->send(); - } - else - { + } else { Notification::make() ->title("Press 'Add Pallet' button to add Pallet number : '$palletNo' into Locator number : '$scanLocator'..!") ->info() ->duration(2000) ->send(); } - } - else - { + } else { if ($serialNo == '' || $serialNo == null) { Notification::make() - ->title("Serial number is required to add or remove when pallet number is empty.") + ->title('Serial number is required to add or remove when pallet number is empty.') ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => null, 'scan_locator_no' => $scanLocator, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (strlen($serialNo) < 9 || strlen($serialNo) > 20) - { + } elseif (strlen($serialNo) < 9 || strlen($serialNo) > 20) { Notification::make() - ->title("Serial number should contain minimum 9 digits and maximum 20 digits.") + ->title('Serial number should contain minimum 9 digits and maximum 20 digits.') ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (!ctype_alnum($serialNo)) - { + } elseif (! ctype_alnum($serialNo)) { Notification::make() ->title("Serial number '$serialNo' must contain alpha-numeric values only.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $invoicesnoexists = LocatorInvoiceValidation::where('plant_id', $plantId) ->where('serial_number', $serialNo) - ->where('scanned_status', '=','Scanned') + ->where('scanned_status', '=', 'Scanned') ->first(); $invoiceNo = $invoicesnoexists?->invoice_number; - if ($invoicesnoexists) - { + if ($invoicesnoexists) { Notification::make() ->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process..!") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } @@ -851,61 +807,55 @@ class LocatorValidation extends Page implements HasForms ->where('plant_id', $plantId) ->first(); - if ($serialExist && $serialExist->locator_number && $serialExist->locator_number != $scanLocator) - { + if ($serialExist && $serialExist->locator_number && $serialExist->locator_number != $scanLocator) { Notification::make() ->title("Serial number '$serialNo' is already assigned to locator number '{$serialExist->locator_number}'.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if ($serialExist && $serialExist->pallet_number && $serialExist->pallet_number != null && $serialExist->pallet_number != '') - { + } elseif ($serialExist && $serialExist->pallet_number && $serialExist->pallet_number != null && $serialExist->pallet_number != '') { Notification::make() ->title("Serial number '$serialNo' already exists in pallet number '{$serialExist->pallet_number}'.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); - return; + + return; } - //heretocontinue + // heretocontinue - if ($serialExist && $serialExist->locator_number == $scanLocator) - { + if ($serialExist && $serialExist->locator_number == $scanLocator) { Notification::make() ->title("Press 'Remove Serial Number' button to remove Serial number : '$serialNo' from Locator number : '$scanLocator'..!") ->info() ->duration(2000) ->send(); - } - else - { + } else { Notification::make() ->title("Press 'Add Serial Number' button to add Serial number : '$serialNo' into Locator number : '$scanLocator'..!") ->info() @@ -919,16 +869,16 @@ class LocatorValidation extends Page implements HasForms ->count('locator_number'); $this->form->fill([ - 'plant_id' => $plantId, + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => $scanLocator, 'pallet_quantity' => $count, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); - $this->dispatch('loadLocator' ,$scanLocator,$plantId); + $this->dispatch('loadLocator', $scanLocator, $plantId); } public function addPallet() @@ -939,7 +889,7 @@ class LocatorValidation extends Page implements HasForms $this->plantId = $plantId; - $palletNo= $this->form->getState()['scan_pallet_no']; + $palletNo = $this->form->getState()['scan_pallet_no']; $palletNo = trim($palletNo) ?? null; @@ -953,8 +903,7 @@ class LocatorValidation extends Page implements HasForms $operatorName = Filament::auth()->user()->name; - if (!$palletNo && !$serialNo) - { + if (! $palletNo && ! $serialNo) { return; } @@ -965,70 +914,67 @@ class LocatorValidation extends Page implements HasForms ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (strlen($scanLocator) < 7) - { + } elseif (strlen($scanLocator) < 7) { Notification::make() ->title("Locator number '$scanLocator' must be at least 7 digits.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => $scanLocator, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $exists = Locator::where('locator_number', $scanLocator) - ->where('plant_id', $plantId) - ->first(); + ->where('plant_id', $plantId) + ->first(); - if (!$exists) - { + if (! $exists) { Notification::make() ->title("Locator number '{$scanLocator}' does not exist in the master.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $locator = Locator::where('locator_number', $scanLocator) - ->where('plant_id', $plantId) - ->first(); + ->where('plant_id', $plantId) + ->first(); if ($locator->locator_quantity >= 2) { Notification::make() @@ -1037,94 +983,90 @@ class LocatorValidation extends Page implements HasForms ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } - if($palletNo) - { - if (strlen($palletNo) < 10) - { + if ($palletNo) { + if (strlen($palletNo) < 10) { Notification::make() ->title("Pallet number '$palletNo' must be at least 10 digits.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } - $Palletexists = PalletValidation::where('pallet_number', $palletNo)->where('plant_id', $plantId)->first(); + $Palletexists = PalletValidation::where('pallet_number', $palletNo)->where('plant_id', $plantId)->first(); - if(!$Palletexists) - { + if (! $Palletexists) { Notification::make() ->title("Pallet number '$palletNo' does not found in pallet table.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $notAlreadyCompleted = PalletValidation::where('plant_id', $plantId) - ->where('pallet_number', $palletNo) - ->whereNull('pallet_status') - ->orWhere('pallet_status', '=','') + ->where('pallet_number', $palletNo) + ->whereNull('pallet_status') + ->orWhere('pallet_status', '=', '') // ->where('locator_number', $this->scanLocator) - ->first(); + ->first(); - if($notAlreadyCompleted) - { + if ($notAlreadyCompleted) { Notification::make() ->title("Pallet number '{$palletNo}' does not completed the master packing.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } @@ -1135,24 +1077,24 @@ class LocatorValidation extends Page implements HasForms // ->where('locator_number', $this->scanLocator) ->first(); - if ($alreadyAssigned) - { + if ($alreadyAssigned) { Notification::make() ->title("Pallet number '{$palletNo}' is already added into locator number '{$alreadyAssigned->locator_number}'.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); + $this->dispatch('loadLocator', '', $plantId); $this->form->fill([ - 'plant_id' => $plantId, + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } @@ -1166,8 +1108,7 @@ class LocatorValidation extends Page implements HasForms // ->where('locator_number', $scanLocator) // ->count('locator_number'); - if ($updatedRows > 0) - { + if ($updatedRows > 0) { Notification::make() ->title("Scanned pallet number '$palletNo' added into locator number '$scanLocator' successfully.") ->success() @@ -1179,143 +1120,135 @@ class LocatorValidation extends Page implements HasForms $locator->increment('locator_quantity'); Locator::where('plant_id', $plantId) - ->where('locator_number', $scanLocator) - ->update(['updated_at' => now(), 'operator_id' => $operatorName]); + ->where('locator_number', $scanLocator) + ->update(['updated_at' => now(), 'operator_id' => $operatorName]); PalletValidation::where('plant_id', $plantId) ->where('pallet_number', $palletNo) ->where('locator_number', $scanLocator) - ->update(['locator_quantity' => $locator->locator_quantity,'updated_at' => now(), 'updated_by' => $operatorName]); + ->update(['locator_quantity' => $locator->locator_quantity, 'updated_at' => now(), 'updated_by' => $operatorName]); PalletValidation::where('plant_id', $plantId) ->where('locator_number', $scanLocator) ->update(['locator_quantity' => $locator->locator_quantity, 'updated_at' => now()]); - $this->form->fill([ - 'plant_id' => $plantId, - 'scan_serial_no' => null, - 'scan_pallet_no' => null, - 'scan_locator_no' => null, - 'pallet_quantity' => null, - 'created_by' => $operatorName, - 'updated_by' => $operatorName, - ]); - $this->dispatch('loadLocator' ,$scanLocator,$plantId); + $this->form->fill([ + 'plant_id' => $plantId, + 'scan_serial_no' => null, + 'scan_pallet_no' => null, + 'scan_locator_no' => null, + 'pallet_quantity' => null, + 'created_by' => $operatorName, + 'updated_by' => $operatorName, + ]); + $this->dispatch('loadLocator', $scanLocator, $plantId); + return; - } - else - { + } else { Notification::make() ->title("pallet number failed to add into locator number '$scanLocator'") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } - } - else - { + } else { if ($serialNo == '' || $serialNo == null) { Notification::make() - ->title("Serial number is required to add when pallet number is empty.") + ->title('Serial number is required to add when pallet number is empty.') ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (strlen($serialNo) < 9 || strlen($serialNo) > 20) - { + } elseif (strlen($serialNo) < 9 || strlen($serialNo) > 20) { Notification::make() - ->title("Serial number should contain minimum 9 digits and maximum 20 digits.") + ->title('Serial number should contain minimum 9 digits and maximum 20 digits.') ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (!ctype_alnum($serialNo)) - { + } elseif (! ctype_alnum($serialNo)) { Notification::make() ->title("Serial number '$serialNo' must contain alpha-numeric values only.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $invoicesnoexists = LocatorInvoiceValidation::where('plant_id', $plantId) ->where('serial_number', $serialNo) - ->where('scanned_status', '=','Scanned') + ->where('scanned_status', '=', 'Scanned') ->first(); $invoiceNo = $invoicesnoexists?->invoice_number; - if ($invoicesnoexists) - { + if ($invoicesnoexists) { Notification::make() ->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process..!") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } @@ -1325,26 +1258,25 @@ class LocatorValidation extends Page implements HasForms ->where('pallet_number', '!=', null) ->first(); - if($palletexists) - { + if ($palletexists) { Notification::make() ->title("Serial number '$serialNo' already exists in pallet number '{$palletexists->pallet_number}'.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); - return; + + return; } $exists = PalletValidation::where('plant_id', $plantId) @@ -1353,49 +1285,47 @@ class LocatorValidation extends Page implements HasForms ->where('locator_number', '!=', null) ->first(); - if ($exists) - { + if ($exists) { Notification::make() ->title("Serial number '$serialNo' already exists in locator number '{$exists->locator_number}'.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } PalletValidation::create([ - 'plant_id' => $plantId, - 'pallet_number' => null, - 'locator_number' => $scanLocator, - 'serial_number' => $serialNo, - 'locator_quantity'=> $locator->locator_quantity, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, - 'updated_by' => $operatorName, - 'updated_at' => now(), - 'scanned_at' => now(), + 'plant_id' => $plantId, + 'pallet_number' => null, + 'locator_number' => $scanLocator, + 'serial_number' => $serialNo, + 'locator_quantity' => $locator->locator_quantity, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + 'updated_by' => $operatorName, + 'updated_at' => now(), + 'scanned_at' => now(), ]); Locator::where('plant_id', $plantId) - ->where('locator_number', $scanLocator) - ->update(['updated_at' => now(), 'operator_id' => $operatorName]); + ->where('locator_number', $scanLocator) + ->update(['updated_at' => now(), 'operator_id' => $operatorName]); PalletValidation::where('plant_id', $plantId) - ->where('locator_number', $scanLocator) - ->update(['locator_quantity' => $locator->locator_quantity, 'updated_at' => now()]); - + ->where('locator_number', $scanLocator) + ->update(['locator_quantity' => $locator->locator_quantity, 'updated_at' => now()]); Notification::make() ->title("Scanned serial number '$serialNo' added into locator number '$scanLocator' successfully.") @@ -1406,20 +1336,20 @@ class LocatorValidation extends Page implements HasForms // $count = PalletValidation::where('plant_id', $plantId) // ->where('locator_number', $scanLocator) // ->count('locator_number'); - $this->form->fill([ - 'plant_id' => $plantId, - 'scan_serial_no' => null, - 'scan_pallet_no' => null, - 'scan_locator_no' => null, - 'pallet_quantity' => null, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, - ]); + $this->form->fill([ + 'plant_id' => $plantId, + 'scan_serial_no' => null, + 'scan_pallet_no' => null, + 'scan_locator_no' => null, + 'pallet_quantity' => null, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + ]); // $this->disableSerialNo = false; // $this->disablePalletNo = false; - $this->dispatch('loadLocator' ,$scanLocator,$plantId); + $this->dispatch('loadLocator', $scanLocator, $plantId); } } @@ -1446,8 +1376,7 @@ class LocatorValidation extends Page implements HasForms $operatorName = Filament::auth()->user()->name; - if (!$palletNo && !$serialNo) - { + if (! $palletNo && ! $serialNo) { return; } @@ -1458,151 +1387,143 @@ class LocatorValidation extends Page implements HasForms ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (strlen($scanLocator) < 7) - { + } elseif (strlen($scanLocator) < 7) { Notification::make() ->title("Locator number '$scanLocator' must be at least 7 digits.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $exists = Locator::where('locator_number', $scanLocator) - ->where('plant_id', $plantId) - ->first(); + ->where('plant_id', $plantId) + ->first(); - if (!$exists) - { + if (! $exists) { Notification::make() ->title("Locator number '{$scanLocator}' does not exist in the master.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } - if($palletNo) - { - if (strlen($palletNo) < 10) - { + if ($palletNo) { + if (strlen($palletNo) < 10) { Notification::make() ->title("Pallet number '$palletNo' must be at least 10 digits.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } - $Palletexists = PalletValidation::where('pallet_number', $palletNo)->where('plant_id', $plantId)->first(); - if(!$Palletexists) - { + $Palletexists = PalletValidation::where('pallet_number', $palletNo)->where('plant_id', $plantId)->first(); + if (! $Palletexists) { Notification::make() ->title("Pallet number '$palletNo' does not found in pallet table.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $notAlreadyCompleted = PalletValidation::where('plant_id', $plantId) ->where('pallet_number', $palletNo) ->whereNull('pallet_status') - ->orWhere('pallet_status', '=','') + ->orWhere('pallet_status', '=', '') // ->where('locator_number', $this->scanLocator) ->first(); - if($notAlreadyCompleted) - { + if ($notAlreadyCompleted) { Notification::make() ->title("Pallet number '{$palletNo}' does not completed the master packing.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $palletValidation = PalletValidation::where('pallet_number', $palletNo) ->where('plant_id', $plantId) ->where('locator_number', '!=', '') - ->where('locator_number', '!=',null) + ->where('locator_number', '!=', null) ->first(); - if ($palletValidation && $palletValidation->locator_number != $scanLocator) - { + if ($palletValidation && $palletValidation->locator_number != $scanLocator) { Notification::make() ->title("Pallet number '$palletNo' is exists in locator number '$palletValidation->locator_number'
Scan the valid locator number to remove pallet number.") ->danger() @@ -1610,55 +1531,54 @@ class LocatorValidation extends Page implements HasForms ->send(); $this->dispatch('loadLocator', '', $plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $palletRecord = PalletValidation::where('plant_id', $plantId) - ->where('pallet_number', $palletNo) - ->whereNotNull('locator_number') - ->where('locator_number', '!=', '') - ->first(); + ->where('pallet_number', $palletNo) + ->whereNotNull('locator_number') + ->where('locator_number', '!=', '') + ->first(); - if (!$palletRecord) - { + if (! $palletRecord) { Notification::make() ->title("Pallet number '{$palletNo}' doesn't exist in locator number.
Add locator number to proceed...") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => $scanLocator, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $updatedRows = PalletValidation::where('plant_id', $plantId) - ->where('pallet_number', $palletNo) - ->update([ - 'locator_number' => null, - 'locator_quantity' => 0, - 'updated_at' => now(), - 'updated_by' => $operatorName, - ]); + ->where('pallet_number', $palletNo) + ->update([ + 'locator_number' => null, + 'locator_quantity' => 0, + 'updated_at' => now(), + 'updated_by' => $operatorName, + ]); // if ($updatedRows > 0) // { @@ -1680,30 +1600,29 @@ class LocatorValidation extends Page implements HasForms // ->where('locator_number', $scanLocator) // ->update(['locator_quantity' => $locator->locator_quantity, 'updated_at' => now()]); - if ($updatedRows > 0) - { + if ($updatedRows > 0) { $locator = Locator::where('locator_number', $scanLocator) ->where('plant_id', $plantId) ->first(); - if ($locator && $locator->locator_quantity > 0) { - $locator->locator_quantity = $locator->locator_quantity - 1; - $locator->save(); - } + if ($locator && $locator->locator_quantity > 0) { + $locator->locator_quantity = $locator->locator_quantity - 1; + $locator->save(); + } Locator::where('plant_id', $plantId) ->where('locator_number', $scanLocator) ->update([ 'updated_at' => now(), - 'operator_id' => $operatorName + 'operator_id' => $operatorName, ]); PalletValidation::where('plant_id', $plantId) ->where('locator_number', $scanLocator) ->update([ 'locator_quantity' => $locator->locator_quantity, - 'updated_at' => now() + 'updated_at' => now(), ]); Notification::make() @@ -1712,164 +1631,154 @@ class LocatorValidation extends Page implements HasForms ->duration(500) ->send(); - $this->dispatch('loadLocator' ,$scanLocator,$plantId); + $this->dispatch('loadLocator', $scanLocator, $plantId); $this->form->fill([ - 'plant_id' => $plantId, + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => null, - 'created_by' => $operatorName, - 'updated_by' => $operatorName, + 'created_by' => $operatorName, + 'updated_by' => $operatorName, ]); - } - else - { + } else { Notification::make() - ->title("No matching pallet found or locator number already empty.") + ->title('No matching pallet found or locator number already empty.') ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => $palletNo, 'scan_locator_no' => $scanLocator, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } - } - else - { - if ($serialNo == '' || $serialNo == null) - { + } else { + if ($serialNo == '' || $serialNo == null) { Notification::make() - ->title("Serial number is required to remove when pallet number is empty.") + ->title('Serial number is required to remove when pallet number is empty.') ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (strlen($serialNo) < 9 || strlen($serialNo) > 20) - { + } elseif (strlen($serialNo) < 9 || strlen($serialNo) > 20) { Notification::make() - ->title("Serial number should contain minimum 9 digits and maximum 20 digits.") + ->title('Serial number should contain minimum 9 digits and maximum 20 digits.') ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; - } - else if (!ctype_alnum($serialNo)) - { + } elseif (! ctype_alnum($serialNo)) { Notification::make() ->title("Serial number '$serialNo' must contain alpha-numeric values only.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $invoicesnoexists = LocatorInvoiceValidation::where('plant_id', $plantId) - ->where('serial_number', $serialNo) - ->where('scanned_status', '=','Scanned') - ->first(); + ->where('serial_number', $serialNo) + ->where('scanned_status', '=', 'Scanned') + ->first(); $invoiceNo = $invoicesnoexists?->invoice_number; - if ($invoicesnoexists) - { + if ($invoicesnoexists) { Notification::make() ->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process..!") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $exists = PalletValidation::where('serial_number', $serialNo) - ->where('plant_id', $plantId) - ->first(); + ->where('plant_id', $plantId) + ->first(); - if (!$exists) { + if (! $exists) { Notification::make() ->title("Serial number '{$serialNo}' doesn't exist in the pallet table to remove.
Add serial number to proceed...") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => null, 'scan_locator_no' => $scanLocator, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $existsInPallet = PalletValidation::where('serial_number', $serialNo) - ->where('pallet_number', '!=', '') - ->where('pallet_number', '!=',null) - ->where('plant_id', $plantId) - ->first(); + ->where('pallet_number', '!=', '') + ->where('pallet_number', '!=', null) + ->where('plant_id', $plantId) + ->first(); if ($existsInPallet) { Notification::make() @@ -1878,25 +1787,25 @@ class LocatorValidation extends Page implements HasForms ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } $existsInPallet = PalletValidation::where('serial_number', $serialNo) - ->where('locator_number', '!=', '') - ->where('locator_number', '!=',null) - ->where('plant_id', $plantId) - ->first(); + ->where('locator_number', '!=', '') + ->where('locator_number', '!=', null) + ->where('plant_id', $plantId) + ->first(); if ($existsInPallet && $existsInPallet->locator_number != $scanLocator) { Notification::make() @@ -1905,17 +1814,17 @@ class LocatorValidation extends Page implements HasForms ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => $serialNo, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } @@ -1923,11 +1832,10 @@ class LocatorValidation extends Page implements HasForms ->where('serial_number', $serialNo) ->forceDelete(); - if ($deleted > 0) - { + if ($deleted > 0) { Locator::where('plant_id', $plantId) - ->where('locator_number', $scanLocator) - ->update(['updated_at' => now(), 'operator_id' => $operatorName]); + ->where('locator_number', $scanLocator) + ->update(['updated_at' => now(), 'operator_id' => $operatorName]); Notification::make() ->title("Scanned serial number '{$serialNo}' removed from locator number '$scanLocator' successfully.") @@ -1937,34 +1845,32 @@ class LocatorValidation extends Page implements HasForms $this->dispatch('loadLocator', $scanLocator, $plantId); $this->form->fill([ - 'plant_id' => $plantId, + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => null, - 'created_by' => $operatorName, - 'updated_by' => $operatorName, + 'created_by' => $operatorName, + 'updated_by' => $operatorName, ]); - } - else - { + } else { Notification::make() ->title("Serial number failed to remove from locator number '$scanLocator'.") ->danger() ->duration(5000) ->send(); - $this->dispatch('loadLocator' ,'',$plantId); - $this->form->fill - ([ - 'plant_id' => $plantId, + $this->dispatch('loadLocator', '', $plantId); + $this->form->fill([ + 'plant_id' => $plantId, 'scan_serial_no' => null, 'scan_pallet_no' => null, 'scan_locator_no' => null, 'pallet_quantity' => 0, - 'created_by' => $operatorName, - 'scanned_by' => $operatorName, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, ]); + return; } } diff --git a/app/Filament/Pages/ProductionCalender.php b/app/Filament/Pages/ProductionCalender.php index ef4ea37..c926c1d 100644 --- a/app/Filament/Pages/ProductionCalender.php +++ b/app/Filament/Pages/ProductionCalender.php @@ -19,6 +19,7 @@ use Filament\Forms\Components\ViewField; use Filament\Notifications\Notification; use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\Hidden; +use Illuminate\Support\Facades\Auth; class ProductionCalender extends Page { @@ -160,4 +161,9 @@ class ProductionCalender extends Page } } + public static function canAccess(): bool + { + return Auth::check() && Auth::user()->can('view production calender page'); + } + } diff --git a/app/Filament/Pages/ProductionQuantityPage.php b/app/Filament/Pages/ProductionQuantityPage.php index 780f37e..1386d3f 100644 --- a/app/Filament/Pages/ProductionQuantityPage.php +++ b/app/Filament/Pages/ProductionQuantityPage.php @@ -403,6 +403,9 @@ class ProductionQuantityPage extends Page implements HasForms public function processMachine($value) { $plantId = $this->pId; + $plantCode = Plant::find($plantId); + + $PlaCo = $plantCode->code; $this->mNam = $value; $now = Carbon::now()->format('H:i:s'); @@ -412,6 +415,72 @@ class ProductionQuantityPage extends Page implements HasForms $machine = Machine::where('plant_id', $plantId)->where('work_center', $this->mNam)->with('line.block')->first(); + $machinenotAgaPlant = Machine::where('work_center', $this->mNam)->first(); + + $machineAgaPlant = Machine::where('plant_id', $plantId)->where('work_center', $this->mNam)->first(); + + if (!$machinenotAgaPlant) { + Notification::make() + ->title('Unknown WorkCenter') + ->body("Work Center not found") + ->danger() + ->send(); + $this->form->fill([ + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, + 'sap_msg_status' => null, + 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + 'recent_qr' => $this->recQr, + ]); + return; + } + else if (!$machineAgaPlant) { + Notification::make() + ->title('Unknown WorkCenter') + ->body("Work Center not found against plant code $PlaCo") + ->danger() + ->send(); + + $this->form->fill([ + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, + 'sap_msg_status' => null, + 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + 'recent_qr' => $this->recQr, + ]); + return; + } + + $rec = ProductionQuantity::where('plant_id', $plantId)->where('machine_id', $machineAgaPlant->id)->latest()->first(); + + if($rec) + { + + $item = Item::where('id', $rec->item_id)->where('plant_id', $plantId)->first(); + + $itemCode = $item?->code ?? ''; + $serialNo = $rec->serial_number ?? ''; + + $this->recQr = $itemCode . ' | ' . $serialNo; + + } + if ($machine) { $this->lNam = Line::where('id', $machine->line_id)->value('name'); $this->bNam = $machine->line->block->name ?? null; @@ -436,15 +505,6 @@ class ProductionQuantityPage extends Page implements HasForms 'recent_qr' => $this->recQr, ]); $this->triggerChartUpdate(); - } else { - - Notification::make() - ->title('Unknown WorkCenter') - ->body('Work Center not found') - ->danger() - ->send(); - - return; } } @@ -1065,46 +1125,6 @@ class ProductionQuantityPage extends Page implements HasForms $iCode = trim($splits[0]); $sNumber = isset($splits[1]) ? trim($splits[1]) : null; - // $machine = Machine::where('work_center', $this->mNam)->where('plant_id', $this->pId)->first(); - - // $this->mId = $machine->id; - - // $lineId = $machine->line_id; - // $this->lId = $lineId; - - // $line = Line::find($lineId); - // if (! $line) { - // Notification::make() - // ->title('Invalid Line') - // ->body('Line associated with the machine not found.') - // ->danger() - // ->send(); - - // return; - // } - - // $blockId = $line->block_id; - // $this->bId = $blockId; - - // $shift = Shift::where('block_id', $blockId)->first(); - // if (! $shift) { - // Notification::make() - // ->title('No Shift Found') - // ->body('No shift associated with this block.') - // ->danger() - // ->send(); - - // return; - // } - - // $shiftId = $shift->id; - // $this->sId = $shiftId; - - // $line = Line::with('block')->find($lineId); - - // $lineName = $line?->name; - // $blockName = $line?->block?->name; - // $shiftName = $shift?->name; if (! ctype_alnum($iCode)) { @@ -1121,7 +1141,7 @@ class ProductionQuantityPage extends Page implements HasForms 'sap_msg_status' => null, 'sap_msg_description' => null, 'operator_id' => $operatorName, - 'recent_qr' => $this->recent_qr, + 'recent_qr' => $this->recQr, ]); Notification::make() @@ -1145,7 +1165,7 @@ class ProductionQuantityPage extends Page implements HasForms 'sap_msg_status' => null, 'sap_msg_description' => null, 'operator_id' => $operatorName, - 'recent_qr' => $this->recent_qr, + 'recent_qr' => $this->recQr, ]); Notification::make() @@ -1169,7 +1189,7 @@ class ProductionQuantityPage extends Page implements HasForms 'sap_msg_status' => null, 'sap_msg_description' => null, 'operator_id' => $operatorName, - 'recent_qr' => $this->recent_qr, + 'recent_qr' => $this->recQr, ]); Notification::make() @@ -1194,7 +1214,7 @@ class ProductionQuantityPage extends Page implements HasForms 'sap_msg_status' => null, 'sap_msg_description' => null, 'operator_id' => $operatorName, - 'recent_qr' => $this->recent_qr, + 'recent_qr' => $this->recQr, ]); Notification::make() @@ -1221,7 +1241,7 @@ class ProductionQuantityPage extends Page implements HasForms 'sap_msg_status' => null, 'sap_msg_description' => null, 'operator_id' => $operatorName, - 'recent_qr' => $this->recent_qr, + 'recent_qr' => $this->recQr, ]); Notification::make() @@ -1376,13 +1396,10 @@ class ProductionQuantityPage extends Page implements HasForms ->title('Invalid QR Found') // {$operatorName} ->body('Please, scan the valid QR code.') ->danger() - // ->persistent() ->send(); return; } else { - // // Perform any additional processing or database operations - // $this->saveFormData($formValues); $parts = explode('|', $this->qrData); $itemCode = trim($parts[0]); @@ -1467,7 +1484,7 @@ class ProductionQuantityPage extends Page implements HasForms 'sap_msg_status' => null, 'sap_msg_description' => null, 'operator_id' => $operatorName, - 'recent_qr' => $this->recent_qr, + 'recent_qr' => $this->recQr, ]); return; @@ -1489,7 +1506,6 @@ class ProductionQuantityPage extends Page implements HasForms // $this->recent_qr = $itemCode.' | '.$this->sNoId; // after success insertion $this->form->fill([ - 'plant_id' => $this->pId, 'machine_id' => $this->mNam, 'block_name' => $this->bNam, @@ -1502,7 +1518,7 @@ class ProductionQuantityPage extends Page implements HasForms 'sap_msg_status' => null, 'sap_msg_description' => null, 'operator_id' => $operatorName, - 'recent_qr' => $this->recent_qr, + 'recent_qr' => $itemCode.' | '.$this->sNoId, ]); Notification::make() diff --git a/app/Filament/Pages/ProductionRejectReason.php b/app/Filament/Pages/ProductionRejectReason.php index 5dab06a..ec2dd66 100644 --- a/app/Filament/Pages/ProductionRejectReason.php +++ b/app/Filament/Pages/ProductionRejectReason.php @@ -15,7 +15,9 @@ use Filament\Forms\Components\Hidden; use Filament\Notifications\Notification; use App\Models\Item; use App\Models\Line; +use App\Models\Machine; use App\Models\Plant; +use App\Models\ProductionPlan; use App\Models\ProductionQuantity; use App\Models\Shift; use Livewire\Attributes\On; @@ -30,10 +32,43 @@ class ProductionRejectReason extends Page protected static string $view = 'filament.pages.production-reject-reason'; - public $qrData, $pId, $bId, $sId, $lId, $iId, $succId, $sNoId, $succStat, $recQr, $prodOrder; + public $qrData; - // public $recent_qr, $clear_qr; + public $pId; + public $mId; + + public $mNam; + + public $bId; + + public $bNam; + + public $sId; + + public $sNam; + + public $lId; + + public $lNam; + + public $iId; + + public $succId; + + public $sNoId; + + public $succStat; + + public $recQr; + + public $prodOrder; + + public $workCenter; + + public $recent_qr; + + // public $recent_qr, $clear_qr; use HasFiltersForm; @@ -115,38 +150,53 @@ class ProductionRejectReason extends Page ); } - public function form(Form $form): Form + public function form(Form $form): Form { return $form ->statePath('filters') ->schema([ Select::make('plant_id') + ->options(Plant::pluck('name', 'id')) ->label('Plant') ->reactive() ->required() ->columnSpan(1) - //->options(Plant::pluck('name', 'id')) - ->options(function (callable $get) { - $userHas = Filament::auth()->user()->plant_id; - return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); - }) ->default(function () { return optional(ProductionQuantity::latest()->first())->plant_id; }) - ->afterStateUpdated(function ($state, $set, callable $get,$livewire) { + ->afterStateUpdated(function ($state, $set, callable $get, $livewire) { $plantId = $get('plant_id'); $set('block_name', null); + $now = Carbon::now()->format('H:i:s'); + $shiftType = ($now >= '08:00:00' && $now <= '19:29:59') + ? 'Day' + : 'Night'; + + $set('shift_id', $shiftType); + session(['select_plant' => $state]); - if (!$plantId) - { + if (! $plantId) { $set('pqPlantError', 'Please select a plant first.'); + $this->form->fill([ + 'plant_id' => $this->pId, + 'block_name' => null, + 'shift_id' => null, + 'line_id' => null, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => null, + 'sap_msg_status' => null, + 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + 'recent_qr' => $this->recQr, + ]); + return; - } - else - { + } else { $this->pId = $plantId; $set('validationError', null); $set('pqPlantError', null); @@ -156,263 +206,301 @@ class ProductionRejectReason extends Page ->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null) ->hintColor('danger'), - // Block Filter - Select::make('block_name') + // Select::make('line_id') + // ->relationship('line', 'name') + // ->required() + // ->columnSpan(1) + // ->options(function (callable $get) { + // if (!$get('plant_id')) { + // return []; + // } + + // return \App\Models\Line::where('plant_id', $get('plant_id')) + // ->pluck('name', 'id') + // ->toArray(); + // }) + // ->reactive() + // ->default(function () { + // return optional(ProductionQuantity::latest()->first())->line_id; + // }) + // ->afterStateUpdated(function ($state, callable $set, callable $get) { + // if($get('id')) + // { + // $getShift = ProductionQuantity::where('id', $get('id'))->first(); + // if($getShift->line_id) + // { + // $set('line_id', $getShift->line_id); + // $set('pqLineError', null); + // } + // } + + // $lineId = $get('line_id'); + // $set('item_code', null); + + // $now = Carbon::now()->format('H:i:s'); + // $shiftType = ($now >= '08:00:00' && $now <= '19:29:59') + // ? 'Day' + // : 'Night'; + + // $set('shift', $shiftType); + + // session(['select_line' => $state]); + // // dd(session('select_line')); + + // $this->triggerChartUpdate(); + + // if (!$lineId) { + // $set('pqLineError', 'Please select a line first.'); + // return; + // } + // else + // { + // $this->lId = $lineId; + // $set('validationError', null); + // $set('pqLineError', null); + // $set('item_id', null); + // // $set('item_description', null); + // $set('serial_number', null); + // } + // }) + // ->extraAttributes(fn ($get) => [ + // 'class' => $get('pqLineError') ? 'border-red-500' : '', + // ]) + // ->hint(fn ($get) => $get('pqLineError') ? $get('pqLineError') : null) + // ->hintColor('danger'), + + TextInput::make('machine_id') + ->label('Machine') + ->required() + ->columnSpan(1) + ->reactive() + ->afterStateUpdated(function ($state, callable $set, callable $get) { + $plantId = $get('plant_id'); + $machineId = $get('machine_id'); + + $this->mNam = $machineId; + + }) + ->extraAttributes(fn ($get) => [ + // 'class' => $get('pqLineError') ? 'border-red-500' : '', + 'wire:keydown.enter' => 'processMachine($event.target.value)', + ]), + // ->hint(fn ($get) => $get('pqLineError') ? $get('pqLineError') : null) + // ->hintColor('danger'), + + TextInput::make('line_id') + ->label('Line') + ->reactive() + ->readOnly() + ->required() + ->afterStateUpdated(fn ($state) => $this->lNam = $state), + + TextInput::make('block_name') ->label('Block') - ->required() - // ->nullable() ->reactive() - ->columnSpan(1) - ->options(function (callable $get) { - if (!$get('plant_id')) { - return []; - } - - return \App\Models\Block::where('plant_id', $get('plant_id')) - ->pluck('name', 'id') - ->toArray(); - }) - ->default(function () { - $latestShiftId = optional(ProductionQuantity::latest()->first())->shift_id; - return optional(Shift::where('id', $latestShiftId)->first())->block_id; - }) - ->afterStateUpdated(function ($state, callable $set, callable $get) { - if($get('id')) - { - $getShift = ProductionQuantity::where('id', $get('id'))->first(); - $getBlock = Shift::where('id', $getShift->shift_id)->first(); - if($getBlock->block_id) - { - $set('block_name', $getBlock->block_id); - $set('pqBlockError', null); - } - } - - $blockId = $get('block_name'); - $set('shift_id', null); - - if (!$blockId) { - $set('pqBlockError', 'Please select a block first.'); - return; - } - else - { - $this->bId = $blockId; - $set('validationError', null); - $set('pqBlockError', null); - } - }) - ->extraAttributes(fn ($get) => [ - 'class' => $get('pqBlockError') ? 'border-red-500' : '', - ]) - ->hint(fn ($get) => $get('pqBlockError') ? $get('pqBlockError') : null) - ->hintColor('danger'), - - Select::make('shift_id') - ->relationship('shift', 'name') + ->readOnly() ->required() - ->columnSpan(1) - // ->nullable() - ->options(function (callable $get) { - if (!$get('plant_id') || !$get('block_name')) { - return []; - } + ->afterStateUpdated(fn ($state) => $this->bNam = $state), - return Shift::where('plant_id', $get('plant_id')) - ->where('block_id', $get('block_name')) - ->pluck('name', 'id') - ->toArray(); - }) + TextInput::make('shift_id') + ->label('Shift') ->reactive() - ->default(function () { - return optional(ProductionQuantity::latest()->first())->shift_id; - }) - ->afterStateUpdated(function ($state, callable $set, callable $get) { - if($get('id')) - { - $getShift = ProductionQuantity::where('id', $get('id'))->first(); - if($getShift->shift_id) - { - $set('shift_id', $getShift->shift_id); - $set('pqShiftError', null); - } - } - - $curShiftId = $get('shift_id'); - - $set('line_id', null); - - if (!$curShiftId) { - $set('pqShiftError', 'Please select a shift first.'); - return; - } - else - { - $this->sId = $curShiftId; - $set('validationError', null); - $set('pqShiftError', null); - } - }) - ->extraAttributes(fn ($get) => [ - 'class' => $get('pqShiftError') ? 'border-red-500' : '', - ]) - ->hint(fn ($get) => $get('pqShiftError') ? $get('pqShiftError') : null) - ->hintColor('danger'), - - Select::make('line_id') - ->relationship('line', 'name') + ->readOnly() ->required() - ->columnSpan(1) - ->options(function (callable $get) { - if (!$get('plant_id') || !$get('block_name') || !$get('shift_id')) { - return []; - } - - return \App\Models\Line::where('plant_id', $get('plant_id')) - ->pluck('name', 'id') - ->toArray(); - }) + ->afterStateUpdated(fn ($state) => $this->sNam = $state), + TextInput::make('production_order') + ->label('Production Order') ->reactive() - ->default(function () { - return optional(ProductionQuantity::latest()->first())->line_id; - }) - ->afterStateUpdated(function ($state, callable $set, callable $get) { - if($get('id')) - { - $getShift = ProductionQuantity::where('id', $get('id'))->first(); - if($getShift->line_id) - { - $set('line_id', $getShift->line_id); - $set('pqLineError', null); - } - } - - $lineId = $get('line_id'); - $set('item_code', null); - - - session(['select_line' => $state]); - // dd(session('select_line')); - - $this->triggerChartUpdate(); - - if (!$lineId) { - $set('pqLineError', 'Please select a line first.'); - return; - } - else - { - $this->lId = $lineId; - $set('validationError', null); - $set('pqLineError', null); + ->required() + ->minLength(7) + ->maxLength(14) + // ->columnSpan(1) + ->columnSpan(['default' => 1, 'sm' => 1]) + ->afterStateUpdated(function ($state, callable $get, callable $set): void { + if (! is_numeric($get('production_order')) || ! preg_match('/^[1-9][0-9]{6,13}$/', $get('production_order'))) { + $set('productionError', 'Must be a numeric value with 7 to 14 digits.'); + $set('production_order', null); + $set('item_code', null); $set('item_id', null); // $set('item_description', null); $set('serial_number', null); + $set('validationError', null); + $this->prodOrder = null; + } else { + $set('productionError', null); + $set('production_order', $state); + $set('item_code', null); + $set('item_id', null); + // $set('item_description', null); + $set('serial_number', null); + $set('validationError', null); + $this->prodOrder = $state; + // if (empty($state)) { + // } } }) ->extraAttributes(fn ($get) => [ - 'class' => $get('pqLineError') ? 'border-red-500' : '', + 'id' => 'scan_locator_no', + 'class' => $get('productionError') ? 'border-red-500' : '', ]) - ->hint(fn ($get) => $get('pqLineError') ? $get('pqLineError') : null) + ->hint(fn ($get) => $get('productionError') ? $get('productionError') : null) ->hintColor('danger'), - TextInput::make('production_order') - ->label('Production Order') - ->reactive() - ->required() - ->minLength(7) - ->maxLength(14) - //->columnSpan(1) - ->columnSpan(['default' => 1, 'sm' => 1]) - ->afterStateUpdated(function ($state, callable $get, callable $set): void { - if(!is_numeric($get('production_order')) || !preg_match('/^[1-9][0-9]{6,13}$/', $get('production_order'))) - { - $set('productionError', "Must be a numeric value with 7 to 14 digits."); - $set('production_order', null); - $set('item_code', null); - $set('item_id', null); - // $set('item_description', null); - $set('serial_number', null); - $set('validationError', null); - $this->prodOrder = null; - } - else - { - $set('productionError', null); - $set('production_order', $state); - $set('item_code', null); - $set('item_id', null); - // $set('item_description', null); - $set('serial_number', null); - $set('validationError', null); - $this->prodOrder = $state; - // if (empty($state)) { - // } - } - }) - ->extraAttributes(fn ($get) => [ - 'class' => $get('productionError') ? 'border-red-500' : '', - ]) - ->hint(fn ($get) => $get('productionError') ? $get('productionError') : null) - ->hintColor('danger'), - - // TextInput::make('item_code') - // ->label('Item Code') - // ->columnSpan(1) - // ->autofocus(true) - // //->reactive() - // ->live(onBlur: true) // avoids per-keystroke triggering - // ->default(fn () => $this->clear_qr) - // ->extraAttributes([ - // 'wire:keydown.enter' => 'processAllValues($event.target.value)', - // ]), - - Hidden::make('serial_number') + Hidden::make('serial_number') ->required(), - Hidden::make('success_msg') + Hidden::make('success_msg') ->required(), - Hidden::make('item_id') + Hidden::make('item_id') ->required(), - Hidden::make('sap_msg_status'), - Hidden::make('sap_msg_description'), + Hidden::make('sap_msg_status'), + Hidden::make('sap_msg_description'), - TextInput::make('recent_qr') + TextInput::make('recent_qr') ->label('Last scanned QR') ->reactive() ->columnSpan(['default' => 1, 'sm' => 2]) - //->columnSpan(2) - // ->default(function () { - // // Get the latest 'item_id' foreign key from 'production_quantities' table - // $latestProductionQuantity = ProductionQuantity::latest()->first(); - // if (!$latestProductionQuantity) { - // return null; // Return null if no production quantities exist - // } + // ->columnSpan(2) + // ->default(function () { + // // Get the latest 'item_id' foreign key from 'production_quantities' table + // $latestProductionQuantity = ProductionQuantity::latest()->first(); + // if (!$latestProductionQuantity) { + // return null; // Return null if no production quantities exist + // } - // // Get the corresponding 'code' from 'items' table where 'id' matches 'item_id' - // $itemCode = optional(Item::find($latestProductionQuantity->item_id))->code; + // // Get the corresponding 'code' from 'items' table where 'id' matches 'item_id' + // $itemCode = optional(Item::find($latestProductionQuantity->item_id))->code; - // // Get the latest 'serial_number' from 'production_quantities' table - // $serialNumber = $latestProductionQuantity->serial_number; + // // Get the latest 'serial_number' from 'production_quantities' table + // $serialNumber = $latestProductionQuantity->serial_number; - // // Combine 'code' and 'serial_number' into the desired format - // // return $itemCode && $serialNumber ? "{$itemCode} | {$serialNumber}" : null; + // // Combine 'code' and 'serial_number' into the desired format + // // return $itemCode && $serialNumber ? "{$itemCode} | {$serialNumber}" : null; - // $this->recQr = $itemCode && $serialNumber ? "{$itemCode} | {$serialNumber}" : null; + // $this->recQr = $itemCode && $serialNumber ? "{$itemCode} | {$serialNumber}" : null; - // }) + // }) ->default(fn () => $this->recQr) ->readOnly(true), - TextInput::make('id') + TextInput::make('id') ->hidden() ->readOnly(), - Hidden::make('operator_id') + Hidden::make('operator_id') ->default(Filament::auth()->user()->name), ]) // ->columns(6); - ->columns(['default' => 1, 'sm' => 7]); + ->columns(['default' => 1, 'sm' => 8]); } + public function processMachine($value) + { + $plantId = $this->pId; + $plantCode = Plant::find($plantId); + + $PlaCo = $plantCode->code; + $this->mNam = $value; + + $now = Carbon::now()->format('H:i:s'); + $this->sNam = ($now >= '08:00:00' && $now <= '19:29:59') + ? 'Day' + : 'Night'; + + $machine = Machine::where('plant_id', $plantId)->where('work_center', $this->mNam)->with('line.block')->first(); + + $machinenotAgaPlant = Machine::where('work_center', $this->mNam)->first(); + + $machineAgaPlant = Machine::where('plant_id', $plantId)->where('work_center', $this->mNam)->first(); + + if (!$machinenotAgaPlant) { + Notification::make() + ->title('Unknown WorkCenter') + ->body("Work Center not found") + ->danger() + ->send(); + $this->form->fill([ + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, + 'sap_msg_status' => null, + 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + 'recent_qr' => $this->recQr, + ]); + return; + } + else if (!$machineAgaPlant) { + Notification::make() + ->title('Unknown WorkCenter') + ->body("Work Center not found against plant code $PlaCo") + ->danger() + ->send(); + + $this->form->fill([ + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, + 'sap_msg_status' => null, + 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + 'recent_qr' => $this->recQr, + ]); + return; + } + + $NotOk = 'Not Ok'; + + $rec = ProductionQuantity::where('plant_id', $plantId)->where('machine_id', $machineAgaPlant->id)->where('success_status', $NotOk)->latest()->first(); + + if($rec) + { + + $item = Item::where('id', $rec->item_id)->where('plant_id', $plantId)->first(); + + $itemCode = $item?->code ?? ''; + $serialNo = $rec->serial_number ?? ''; + + $this->recQr = $itemCode . ' | ' . $serialNo; + + } + + if ($machine) { + $this->lNam = Line::where('id', $machine->line_id)->value('name'); + $this->bNam = $machine->line->block->name ?? null; + + // dd($lineName, $blockName); + + session(['select_line' => $machine->line_id]); + + $this->form->fill([ + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, + 'sap_msg_status' => null, + 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + 'recent_qr' => $this->recQr, + ]); + $this->triggerChartUpdate(); + } + } // Method to process the value when Enter is pressed @@ -425,21 +513,21 @@ class ProductionRejectReason extends Page public function processAllValues($formQRData) { - //dd($formQRData); - //$formValues = []; + // dd($formQRData); + // $formValues = []; // This will get all form data from the request - //$this->clear_qr = null; + // $this->clear_qr = null; $this->qrData = null; $this->iId = null; $this->succId = null; $this->sNoId = null; $this->succStat = null; - $this->validateAndProcessForm( $formQRData); // Process the form values + $this->validateAndProcessForm($formQRData); // Process the form values } public function validateAndProcessForm($formQRData) { - $user = Filament::auth()->user(); //->name + $user = Filament::auth()->user(); // ->name $operatorName = $user->name; $this->qrData = $formQRData; @@ -453,687 +541,724 @@ class ProductionRejectReason extends Page if (empty($formQRData)) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid QR') - ->body("Scan the valid QR code.
(Ex: Item_Code|Serial_Number )") + ->body('Scan the valid QR code.
(Ex: Item_Code|Serial_Number )') ->danger() ->send(); + return; - } - else - { - if (!$this->pId) { + } else { + if (! $this->pId) { $this->form->fill([ - 'plant_id'=> null, - 'block_name'=> null, - 'shift_id'=> null, - 'line_id'=> null, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> null, + 'plant_id' => null, + 'machine_id' => null, + 'block_name' => null, + 'shift_id' => null, + 'line_id' => null, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => null, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Choose Plant') - ->body("Please select a plant first.") + ->body('Please select a plant first.') ->danger() ->send(); + return; - } - else if (!$this->bId) { + } elseif (! $this->mNam) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> null, - 'shift_id'=> null, - 'line_id'=> null, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> null, + 'plant_id' => $this->pId, + 'machine_id' => null, + 'block_name' => null, + 'shift_id' => null, + 'line_id' => null, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => null, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() - ->title('Choose Block') - ->body("Please select a block first.") + ->title('Unknown Machine') + ->body("Machine can't be empty!") ->danger() ->send(); + return; - } - else if (!$this->sId) { + } elseif (! $this->lNam) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> null, - 'line_id'=> null, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> null, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => null, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => null, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Choose Shift') - ->body("Please select a shift first.") - ->danger() - ->send(); - return; - } - else if (!$this->lId) { - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> null, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> null, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Choose Line') - ->body("Please select a line first.") + ->body('Please select a line first.') ->danger() ->send(); + return; - } - else if (!$this->prodOrder) { + } elseif (! $this->bNam) { + $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> null, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => null, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, + 'recent_qr' => $this->recQr, + ]); + Notification::make() + ->title('Choose Line') + ->body('Please select a Block first.') + ->danger() + ->send(); + + return; + } elseif (! $this->sNam) { + $this->form->fill([ + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => null, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => null, + 'sap_msg_status' => null, + 'sap_msg_description' => null, + 'operator_id' => $operatorName, + 'recent_qr' => $this->recQr, + ]); + Notification::make() + ->title('Choose Shift') + ->body('Please select a shift first.') + ->danger() + ->send(); + + return; + } elseif (! $this->prodOrder) { + $this->form->fill([ + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => null, + 'sap_msg_status' => null, + 'sap_msg_description' => null, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Please scan the production order first.') ->danger() ->send(); + return; } - if(!is_numeric($this->prodOrder)) - { + if (! is_numeric($this->prodOrder)) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> null, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => null, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid Production Order') - ->body("Must contain numeric values only.") + ->body('Must contain numeric values only.') ->danger() ->send(); + return; - } - else if (!preg_match('/^[1-9][0-9]{6,13}$/', $this->prodOrder)) - { + } elseif (! preg_match('/^[1-9][0-9]{6,13}$/', $this->prodOrder)) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> null, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => null, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid Production Order') - ->body("Must be a numeric value with 7 to 14 digits.
Must start with a non-zero digit.") + ->body('Must be a numeric value with 7 to 14 digits.
Must start with a non-zero digit.') ->danger() ->send(); + return; } - // ******************************** + // $exists = \App\Models\ProductionPlan::where('plant_id', $this->pId) + // ->where('shift_id', $this->sId) + // ->where('line_id', $this->lId) + // ->whereDate('created_at', today()) + // ->latest() + // ->exists(); - $exists = \App\Models\ProductionPlan::where('plant_id', $this->pId) - ->where('shift_id', $this->sId) - ->where('line_id', $this->lId) - ->whereDate('created_at', today()) - ->latest() - ->exists(); + // if ($exists) + // { + // $currentDate = date('Y-m-d'); - if ($exists) - { - $currentDate = date('Y-m-d'); + // $shiftId = Shift::where('id', $this->sId) + // ->first(); - $shiftId = Shift::where('id', $this->sId) - ->first(); + // [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; + // $hRs = (int) $hRs; + // //$miNs = (int) $miNs;-*/ - [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; - $hRs = (int) $hRs; - //$miNs = (int) $miNs;-*/ + // $totalMinutes = $hRs * 60 + $miNs; - $totalMinutes = $hRs * 60 + $miNs; + // $from_dt = $currentDate . ' ' . $shiftId->start_time; - $from_dt = $currentDate . ' ' . $shiftId->start_time; + // $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); - $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); + // $currentDateTime = date('Y-m-d H:i:s'); - $currentDateTime = date('Y-m-d H:i:s'); + // // Check if current date time is within the range + // if (!($currentDateTime >= $from_dt && $currentDateTime < $to_dt)) { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - // Check if current date time is within the range - if (!($currentDateTime >= $from_dt && $currentDateTime < $to_dt)) { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Invalid Shift') + // ->body("Please select a valid shift.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // else + // { + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // } + // } + // else + // { + // $existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId) + // ->where('shift_id', $this->sId) + // ->where('line_id', $this->lId) + // ->whereDate('created_at', Carbon::yesterday()) + // ->latest() + // ->exists(); - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Invalid Shift') - ->body("Please select a valid shift.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - else - { - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - } - } - else - { - $existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId) - ->where('shift_id', $this->sId) - ->where('line_id', $this->lId) - ->whereDate('created_at', Carbon::yesterday()) - ->latest() - ->exists(); + // if ($existShifts) //if ($existShifts->count() > 0) + // { // record exist on yesterday + // //$currentDate = date('Y-m-d'); + // $yesterday = date('Y-m-d', strtotime('-1 days')); - if ($existShifts) //if ($existShifts->count() > 0) - { // record exist on yesterday - //$currentDate = date('Y-m-d'); - $yesterday = date('Y-m-d', strtotime('-1 days')); + // $shiftId = Shift::where('id', $this->sId) + // ->first(); - $shiftId = Shift::where('id', $this->sId) - ->first(); + // [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; + // $hRs = (int) $hRs; + // // $miNs = (int) $miNs;-*/ - [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; - $hRs = (int) $hRs; - // $miNs = (int) $miNs;-*/ + // $totalMinutes = $hRs * 60 + $miNs; - $totalMinutes = $hRs * 60 + $miNs; + // $from_dt = $yesterday . ' ' . $shiftId->start_time; - $from_dt = $yesterday . ' ' . $shiftId->start_time; + // $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); - $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); + // $currentDateTime = date('Y-m-d H:i:s'); - $currentDateTime = date('Y-m-d H:i:s'); + // // Check if current date time is within the range + // if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // } + // else + // { + // $currentDate = date('Y-m-d'); - // Check if current date time is within the range - if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - } - else - { - $currentDate = date('Y-m-d'); + // $shiftId = Shift::where('id', $this->sId) + // ->first(); - $shiftId = Shift::where('id', $this->sId) - ->first(); + // [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; + // $hRs = (int) $hRs; + // // $miNs = (int) $miNs;-*/ - [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; - $hRs = (int) $hRs; - // $miNs = (int) $miNs;-*/ + // $totalMinutes = $hRs * 60 + $miNs; - $totalMinutes = $hRs * 60 + $miNs; + // $from_dt = $currentDate . ' ' . $shiftId->start_time; - $from_dt = $currentDate . ' ' . $shiftId->start_time; + // $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); - $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); + // $currentDateTime = date('Y-m-d H:i:s'); - $currentDateTime = date('Y-m-d H:i:s'); + // // Check if current date time is within the range + // if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - // Check if current date time is within the range - if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Plan Not Found') + // ->body("Please set production plan first.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // else + // { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Plan Not Found') - ->body("Please set production plan first.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - else - { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Invalid Shift') + // ->body("Please select a valid shift.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // } + // } + // else + // { // record not exist on yesterday - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Invalid Shift') - ->body("Please select a valid shift.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - } - } - else - { // record not exist on yesterday + // //$currentDate = date('Y-m-d'); + // $yesterday = date('Y-m-d', strtotime('-1 days')); - //$currentDate = date('Y-m-d'); - $yesterday = date('Y-m-d', strtotime('-1 days')); + // $shiftId = Shift::where('id', $this->sId) + // ->first(); - $shiftId = Shift::where('id', $this->sId) - ->first(); + // [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; + // $hRs = (int) $hRs; + // // $miNs = (int) $miNs;-*/ - [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; - $hRs = (int) $hRs; - // $miNs = (int) $miNs;-*/ + // $totalMinutes = $hRs * 60 + $miNs; - $totalMinutes = $hRs * 60 + $miNs; + // $from_dt = $yesterday . ' ' . $shiftId->start_time; - $from_dt = $yesterday . ' ' . $shiftId->start_time; + // $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); - $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); + // $currentDateTime = date('Y-m-d H:i:s'); - $currentDateTime = date('Y-m-d H:i:s'); + // // Check if current date time is within the range + // if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - // Check if current date time is within the range - if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Plan Not Found') + // ->body("Please set production plan first.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // else + // { + // $currentDate = date('Y-m-d'); - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Plan Not Found') - ->body("Please set production plan first.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - else - { - $currentDate = date('Y-m-d'); + // $shiftId = Shift::where('id', $this->sId) + // ->first(); - $shiftId = Shift::where('id', $this->sId) - ->first(); + // [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; + // $hRs = (int) $hRs; + // // $miNs = (int) $miNs;-*/ - [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; - $hRs = (int) $hRs; - // $miNs = (int) $miNs;-*/ + // $totalMinutes = $hRs * 60 + $miNs; - $totalMinutes = $hRs * 60 + $miNs; + // $from_dt = $currentDate . ' ' . $shiftId->start_time; - $from_dt = $currentDate . ' ' . $shiftId->start_time; + // $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); - $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); + // $currentDateTime = date('Y-m-d H:i:s'); - $currentDateTime = date('Y-m-d H:i:s'); + // // Check if current date time is within the range + // if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - // Check if current date time is within the range - if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Plan Not Found') + // ->body("Please set production plan first.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // else + // { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Plan Not Found') - ->body("Please set production plan first.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - else - { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Invalid Shift') + // ->body("Please select a valid shift.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // } + // } + // } - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Invalid Shift') - ->body("Please select a valid shift.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - } - } - } + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); - // ******************************** - - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); } - if (!preg_match('/^[a-zA-Z0-9]{6,}+\|[1-9][a-zA-Z0-9]{8,}+(\|)?$/', $formQRData)) { - if (strpos($formQRData, '|') === false) { + if (! preg_match('/^[a-zA-Z0-9]{6,}+\|[1-9][a-zA-Z0-9]{8,}+(\|)?$/', $formQRData)) { + + if (strpos($formQRData, '|') == false) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid QR') - ->body("Scan the valid QR code.
(Ex: Item_Code|Serial_Number )") + ->body('Scan the valid QR code.
(Ex: Item_Code|Serial_Number )') ->danger() ->send(); + return; - } - else - { + } else { $splits = explode('|', $formQRData); $iCode = trim($splits[0]); $sNumber = isset($splits[1]) ? trim($splits[1]) : null; - if (!ctype_alnum($iCode)) { + + if (! ctype_alnum($iCode)) { + $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid Item Code') - ->body("Item code must contain alpha-numeric values only.") + ->body('Item code must contain alpha-numeric values only.') ->danger() ->send(); + return; - } - else if (strlen($iCode) < 6) { + } elseif (strlen($iCode) < 6) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid Item Code') - ->body("Item code must be at least 6 digits.") + ->body('Item code must be at least 6 digits.') ->danger() ->send(); + return; - } - else if (!ctype_alnum($sNumber)) { + } elseif (! ctype_alnum($sNumber)) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid Serial Number') - ->body("Serial Number must contain alpha-numeric values only.") + ->body('Serial Number must contain alpha-numeric values only.') ->danger() ->duration(800) ->send(); + return; - } - else if (strlen($sNumber) < 9) { + } elseif (strlen($sNumber) < 9) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid Serial Number') - ->body("Serial Number must be at least 9 digits.") + ->body('Serial Number must be at least 9 digits.') ->danger() ->duration(800) ->send(); + return; } } $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid QR') - ->body("Scan the valid QR code.
(Ex: Item_Code|Serial_Number )") + ->body('Scan the valid QR code.
(Ex: Item_Code|Serial_Number )') ->danger() ->send(); + return; - } - else - { + } else { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); } @@ -1145,27 +1270,28 @@ class ProductionRejectReason extends Page // Fetch item using item code and plant_id $masItem = Item::where('code', $itemCode)->first(); - if (!$masItem) - { + if (! $masItem) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Unknown Item Code') - ->body("Item code does not exist in master data.") + ->body('Item code does not exist in master data.') ->danger() ->send(); + return; } @@ -1173,143 +1299,225 @@ class ProductionRejectReason extends Page ->where('plant_id', $this->pId) ->first(); - if ($item) - { + if ($item) { $sNo = ProductionQuantity::where('serial_number', $serialNumber)->where('plant_id', $this->pId)->exists(); - if (!$sNo) - { + if (! $sNo) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> $item->id, - 'serial_number'=> null, - 'success_msg'=> 'Y', - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => $item->id, + 'serial_number' => null, + 'success_msg' => 'Y', + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); $this->succId = 'Y'; $this->iId = $item->id; - } - else - { + } else { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Duplicate Serial Number') - ->body("Serial number already exist in database for choosed plant.") + ->body('Serial number already exist in database for choosed plant.') ->danger() ->send(); + return; } - } - else - { + } else { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Unknown Item Code') - ->body("Item code does not exist in master data for choosed plant.") + ->body('Item code does not exist in master data for choosed plant.') ->danger() ->send(); + return; } - if ($this->succId === null) { + if ($this->succId == null) { $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() - ->title("Invalid QR Found") // {$operatorName} - ->body("Please, scan the valid QR code.") - ->danger() - // ->persistent() - ->send(); + ->title('Invalid QR Found') // {$operatorName} + ->body('Please, scan the valid QR code.') + ->danger() + ->send(); + return; - } - else - { - // // Perform any additional processing or database operations - // $this->saveFormData($formValues); + } else { $parts = explode('|', $this->qrData); $itemCode = trim($parts[0]); $this->sNoId = isset($parts[1]) ? trim($parts[1]) : null; + $machine = Machine::where('work_center', $this->mNam)->where('plant_id', $this->pId)->first(); + + if (! $machine) { + Notification::make() + ->title('Unknown Machine') + ->body("Work center {$this->mNam} not found for this plant.") + ->danger() + ->send(); + + return; + } + + $this->mId = $machine->id; + + $this->lId = $machine->line_id; + + $line = Line::find($this->lId); + if (! $line) { + Notification::make() + ->title('Invalid Line') + ->body('Line associated with the machine not found.') + ->danger() + ->send(); + + return; + } + + $this->bId = $line->block_id; + + $shift = Shift::where('block_id', $this->bId)->first(); + if (! $shift) { + Notification::make() + ->title('No Shift Found') + ->body('No shift associated with this block.') + ->danger() + ->send(); + + return; + } + + $this->sId = $shift->id; + + $currentMonth = Carbon::now()->month; + $currentYear = Carbon::now()->year; + + // $line = Line::with('block')->find($this->lId); + + // $this->lNam = $line?->name; + // $this->bNam = $line?->block?->name; + // $this->sNam = $shift?->name; + + $hasPlan = ProductionPlan::where('plant_id', $this->pId) + ->where('line_id', $this->lId) + ->where('item_id', $this->iId) + ->whereMonth('created_at', $currentMonth) + ->whereYear('created_at', $currentYear) + ->where('plan_quantity', '>', 0) + ->exists(); + + if (! $hasPlan) { + Notification::make() + ->title('No Production Plan') + ->body('Scanned Item Code has no plan quantity for current month/year.') + ->danger() + ->send(); + + $this->form->fill([ + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, + 'sap_msg_status' => null, + 'sap_msg_description' => null, + 'operator_id' => $operatorName, + 'recent_qr' => $this->recQr, + ]); + + return; + } + ProductionQuantity::create([ - 'plant_id'=> $this->pId, - 'shift_id'=> $this->sId, + 'plant_id' => $this->pId, + 'machine_id' => $this->mId, + 'shift_id' => $this->sId, 'line_id' => $this->lId, - 'item_id'=> $this->iId, + 'item_id' => $this->iId, 'serial_number' => $this->sNoId, - 'production_order'=> $this->prodOrder, - 'operator_id'=> $operatorName, + 'production_order' => $this->prodOrder, + 'operator_id' => $operatorName, 'success_status'=>'Not Ok', ]); $this->iId = null; + // $this->recent_qr = $itemCode.' | '.$this->sNoId; // after success insertion $this->form->fill([ - - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - //'item_code'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, + 'plant_id' => $this->pId, + 'machine_id' => $this->mNam, + 'block_name' => $this->bNam, + 'shift_id' => $this->sNam, + 'line_id' => $this->lNam, + 'item_id' => null, + 'serial_number' => null, + 'success_msg' => null, + 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, - 'operator_id'=> $operatorName, + 'operator_id' => $operatorName, 'recent_qr' => $itemCode.' | '.$this->sNoId, ]); Notification::make() - ->title("Valid QR Found") // {$operatorName} + ->title('Valid QR Found') // {$operatorName} ->body("Valid QR code scanned: {$this->qrData}.") ->success() ->duration(200) @@ -1330,6 +1538,7 @@ class ProductionRejectReason extends Page // // Optionally, you can emit an event or perform a redirect after saving // $this->emit('formSaved', $model->id); } + public function triggerChartUpdate(): void { if (session()->has('select_plant') && session()->has('select_line')) { diff --git a/app/Filament/Pages/ProductionTarget.php b/app/Filament/Pages/ProductionTarget.php index 0d301bc..f8d4ede 100644 --- a/app/Filament/Pages/ProductionTarget.php +++ b/app/Filament/Pages/ProductionTarget.php @@ -11,6 +11,7 @@ use Filament\Forms\Components\Section; use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Notifications\Notification; +use Illuminate\Support\Facades\Auth; class ProductionTarget extends Page { @@ -30,13 +31,16 @@ class ProductionTarget extends Page ->schema([ Select::make('plant_id') ->label('Plant') + ->relationship('plant', 'name') ->reactive() + // ->searchable() ->options(function (callable $get) { $userHas = Filament::auth()->user()->plant_id; return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); }) ->required() ->afterStateUpdated(function ($state, callable $get, $set) { + // dd($state); $set('line_id', null); $set('year', null); $set('month', null); @@ -45,6 +49,8 @@ class ProductionTarget extends Page Select::make('line_id') ->label('Line') ->required() + ->relationship('line', 'name') + // ->searchable() ->columnSpan(1) ->options(function (callable $get) { if (!$get('plant_id')) { @@ -58,6 +64,8 @@ class ProductionTarget extends Page ->reactive() ->afterStateUpdated(function ($state, callable $get, $set) { $plantId = $get('plant_id'); + + $set('year', null); $set('month', null); $this->dispatch('loadData',$plantId, $state, '', ''); @@ -65,7 +73,9 @@ class ProductionTarget extends Page Select::make('year') ->label('Year') ->reactive() + // ->searchable() ->options([ + '2025' => '2025', '2026' => '2026', '2027' => '2027', '2028' => '2028', @@ -93,6 +103,7 @@ class ProductionTarget extends Page Select::make('month') ->label('Month') ->reactive() + // ->searchable() ->options([ '01' => 'January', '02' => 'February', @@ -170,4 +181,9 @@ class ProductionTarget extends Page $this->dispatch('loadData1' ,$plantId, $lineId, $year, $month); } + + public static function canAccess(): bool + { + return Auth::check() && Auth::user()->can('view production target page'); + } } diff --git a/app/Filament/Pages/RfqDashboard.php b/app/Filament/Pages/RfqDashboard.php index 3454c83..4e296ee 100644 --- a/app/Filament/Pages/RfqDashboard.php +++ b/app/Filament/Pages/RfqDashboard.php @@ -61,14 +61,55 @@ class RfqDashboard extends Page // session()->forget('rfq_number'); // }), + // Select::make('rfq_number') + // ->label('Select RFQ Number') + // ->reactive() + // ->options(function (callable $get) { + + // return RequestQuotation::orderBy('rfq_number') + // ->pluck('rfq_number', 'id') + // ->toArray(); + // }) + // ->afterStateUpdated(function ($state, callable $set) { + // session(['rfq_id' => $state]); + // $set('transport_name', null); + // session()->forget('transport_name'); + // }), + Select::make('rfq_number') ->label('Select RFQ Number') ->reactive() - ->options(function (callable $get) { + ->options(function () { - return RequestQuotation::orderBy('rfq_number') - ->pluck('rfq_number', 'id') - ->toArray(); + $user = Filament::auth()->user(); + + if ($user?->hasAnyRole(['Super Admin', 'RFQ Supervisor'])) { + return RequestQuotation::orderBy('rfq_number') + ->pluck('rfq_number', 'id') + ->toArray(); + } + + $userName = $user?->name; + + $masterIds = \App\Models\SpotRateTransportMaster::whereRaw( + "user_name::jsonb @> ?", + [json_encode([$userName])] + ) + ->pluck('id') + ->unique() + ->toArray(); + + if (empty($masterIds)) { + return []; + } + + return RequestQuotation::whereIn( + 'spot_rate_transport_master_id', + $masterIds + ) + ->orderBy('rfq_number') + ->pluck('rfq_number', 'id') + ->toArray(); }) ->afterStateUpdated(function ($state, callable $set) { session(['rfq_id' => $state]); diff --git a/app/Filament/Pages/Welcome.php b/app/Filament/Pages/Welcome.php index 8a90e2e..7448d20 100644 --- a/app/Filament/Pages/Welcome.php +++ b/app/Filament/Pages/Welcome.php @@ -10,6 +10,8 @@ class Welcome extends Page protected static string $view = 'filament.pages.welcome'; + protected static ?string $navigationGroup = 'IIOT'; + public function getHeading(): string { return ''; diff --git a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php index a6eeba8..fee6939 100644 --- a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php +++ b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php @@ -139,7 +139,7 @@ class CreateInvoiceValidation extends CreateRecord $user1 = Filament::auth()->user(); - $user1->notify(new PushAlertNotification()); + // $user1->notify(new PushAlertNotification()); $this->form->fill([ 'plant_id' => $plantId, diff --git a/app/Filament/Resources/ItemCharacteristicResource.php b/app/Filament/Resources/ItemCharacteristicResource.php index d5c9edf..075b69f 100644 --- a/app/Filament/Resources/ItemCharacteristicResource.php +++ b/app/Filament/Resources/ItemCharacteristicResource.php @@ -2,6 +2,8 @@ namespace App\Filament\Resources; +use App\Filament\Exports\ItemCharacteristicExporter; +use App\Filament\Imports\ItemCharacteristicImporter; use App\Filament\Resources\ItemCharacteristicResource\Pages; use App\Filament\Resources\ItemCharacteristicResource\RelationManagers; use App\Models\Item; @@ -15,6 +17,8 @@ use Filament\Tables; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\SoftDeletingScope; +use Filament\Tables\Actions\ExportAction; +use Filament\Tables\Actions\ImportAction; class ItemCharacteristicResource extends Resource { @@ -924,6 +928,22 @@ class ItemCharacteristicResource extends Resource Tables\Actions\ForceDeleteBulkAction::make(), Tables\Actions\RestoreBulkAction::make(), ]), + ]) + ->headerActions([ + ImportAction::make() + ->label('Import Item Characteristics') + ->color('warning') + ->importer(ItemCharacteristicImporter::class) + ->visible(function() { + return Filament::auth()->user()->can('view import item characteristics'); + }), + ExportAction::make() + ->label('Export Item Characteristics') + ->color('warning') + ->exporter(ItemCharacteristicExporter::class) + ->visible(function() { + return Filament::auth()->user()->can('view export item characteristics'); + }), ]); } diff --git a/app/Filament/Resources/ItemResource.php b/app/Filament/Resources/ItemResource.php index eda7340..a11dd21 100644 --- a/app/Filament/Resources/ItemResource.php +++ b/app/Filament/Resources/ItemResource.php @@ -82,9 +82,6 @@ class ItemResource extends Resource Forms\Components\TextInput::make('category') ->label('Category') ->placeholder('Scan the Category'), - Forms\Components\TextInput::make('category') - ->label('Category') - ->placeholder('Scan the Category'), Forms\Components\TextInput::make('code') ->required() ->placeholder('Scan the valid code') diff --git a/app/Filament/Resources/LineResource.php b/app/Filament/Resources/LineResource.php index 9b9dd2c..c9561c5 100644 --- a/app/Filament/Resources/LineResource.php +++ b/app/Filament/Resources/LineResource.php @@ -216,7 +216,10 @@ class LineResource extends Resource ]) ->hint(fn ($get) => $get('lTypeError') ? $get('lTypeError') : null) ->hintColor('danger'), - + Forms\Components\TextInput::make('line_capacity') + ->label('Line Capacity') + ->required() + ->reactive(), Forms\Components\TextInput::make('no_of_operation') ->label('No of Operation') ->required() @@ -1061,6 +1064,11 @@ class LineResource extends Resource ->alignCenter() ->sortable() ->searchable(), + Tables\Columns\TextColumn::make('line_capacity') + ->label('Line Capacity') + ->alignCenter() + ->sortable() + ->searchable(), Tables\Columns\TextColumn::make('no_of_operation') ->label('No of Operation') ->alignCenter() diff --git a/app/Filament/Resources/ProcessOrderResource/Pages/CreateProcessOrder.php b/app/Filament/Resources/ProcessOrderResource/Pages/CreateProcessOrder.php index 1c87a8a..c31d730 100644 --- a/app/Filament/Resources/ProcessOrderResource/Pages/CreateProcessOrder.php +++ b/app/Filament/Resources/ProcessOrderResource/Pages/CreateProcessOrder.php @@ -3,10 +3,28 @@ namespace App\Filament\Resources\ProcessOrderResource\Pages; use App\Filament\Resources\ProcessOrderResource; +use App\Models\ProcessOrder; use Filament\Actions; +use Filament\Facades\Filament; +use Filament\Notifications\Notification; use Filament\Resources\Pages\CreateRecord; class CreateProcessOrder extends CreateRecord { protected static string $resource = ProcessOrderResource::class; + + protected function afterCreate(): void + { + $plantId = $this->data['plant_id']; + $processOrder = $this->data['process_order']; + $updatedQty = (float) $this->data['updated_order_quantity']; + + ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + ->update([ + 'updated_order_quantity' => $updatedQty, + 'updated_by' => Filament::auth()->user()->name, + ]); + } + } diff --git a/app/Filament/Resources/ProcessOrderResource/Pages/EditProcessOrder.php b/app/Filament/Resources/ProcessOrderResource/Pages/EditProcessOrder.php index d652766..256b57f 100644 --- a/app/Filament/Resources/ProcessOrderResource/Pages/EditProcessOrder.php +++ b/app/Filament/Resources/ProcessOrderResource/Pages/EditProcessOrder.php @@ -3,13 +3,78 @@ namespace App\Filament\Resources\ProcessOrderResource\Pages; use App\Filament\Resources\ProcessOrderResource; +use App\Models\ProcessOrder; use Filament\Actions; +use Filament\Facades\Filament; +use Filament\Notifications\Notification; use Filament\Resources\Pages\EditRecord; class EditProcessOrder extends EditRecord { protected static string $resource = ProcessOrderResource::class; + protected function beforeSave(): void + { + $plantId = $this->data['plant_id'] ?? null; + $processOrder = $this->data['process_order'] ?? null; + $extraQty = (float) ($this->data['updated_order_quantity'] ?? 0); + $extraQtyRaw = $this->data['updated_order_quantity'] ?? ''; + + if (!preg_match('/^\d+(\.\d{1,3})?$/', $extraQtyRaw)) { + Notification::make() + ->title('Invalid Quantity') + ->body('Only positive numbers with up to 3 decimal places are allowed.') + ->danger() + ->send(); + + $this->halt(); // stop save + } + + if ($extraQty < 0) + { + Notification::make() + ->title('Invalid Quantity') + ->body('Negative values are not allowed.') + ->danger() + ->send(); + + $this->halt(); + } + + if ($extraQty > 0) { + + $order = ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + ->first(); + + if ($order) { + + $baseQty = (float) $order->order_quantity; + $maxAllowed = $baseQty * 0.10; + + $maxFinalQty = $baseQty + $maxAllowed; + + if ($extraQty > $maxFinalQty) { + Notification::make() + ->title('Limit Exceeded') + ->body("You can only increase the order by 10% (Max allowed: {$maxFinalQty}).") + ->danger() + ->send(); + + $this->halt(); // stops save + } + + ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + ->update([ + 'updated_order_quantity' => $extraQty, + 'updated_by' => Filament::auth()->user()?->name, + ]); + } + } + } + + protected function getHeaderActions(): array { return [ diff --git a/app/Filament/Resources/ProductionPlanResource.php b/app/Filament/Resources/ProductionPlanResource.php index a23ae85..9754e6e 100644 --- a/app/Filament/Resources/ProductionPlanResource.php +++ b/app/Filament/Resources/ProductionPlanResource.php @@ -437,7 +437,7 @@ class ProductionPlanResource extends Resource ->sortable() ->searchable(), Tables\Columns\TextColumn::make('line.name') - ->label('Plant') + ->label('Line') ->alignCenter() ->sortable() ->searchable(), @@ -476,7 +476,6 @@ class ProductionPlanResource extends Resource // ->label('Shift') // ->alignCenter() // ->sortable(), // ->searchable(), - Tables\Columns\TextColumn::make('created_at') ->label('Created At') ->dateTime() diff --git a/app/Filament/Resources/RfqTransporterBidResource/Pages/EditRfqTransporterBid.php b/app/Filament/Resources/RfqTransporterBidResource/Pages/EditRfqTransporterBid.php index 910be8a..d4c0467 100644 --- a/app/Filament/Resources/RfqTransporterBidResource/Pages/EditRfqTransporterBid.php +++ b/app/Filament/Resources/RfqTransporterBidResource/Pages/EditRfqTransporterBid.php @@ -158,9 +158,6 @@ class EditRfqTransporterBid extends EditRecord $body )); } - - - } protected function getHeaderActions(): array diff --git a/app/Filament/Resources/SerialValidationResource/Pages/CreateSerialValidation.php b/app/Filament/Resources/SerialValidationResource/Pages/CreateSerialValidation.php index f39bddc..a05891b 100644 --- a/app/Filament/Resources/SerialValidationResource/Pages/CreateSerialValidation.php +++ b/app/Filament/Resources/SerialValidationResource/Pages/CreateSerialValidation.php @@ -15,6 +15,9 @@ use Storage; use Maatwebsite\Excel\Facades\Excel; use Livewire\Livewire; use Str; +use Firebase\JWT\JWT; +use Firebase\JWT\Key; + class CreateSerialValidation extends CreateRecord { @@ -67,6 +70,8 @@ class CreateSerialValidation extends CreateRecord $invoiceNumber = trim($invoiceNumber); + $parts = explode('.', $invoiceNumber); + $this->showCapacitorInput = false; $user = Filament::auth()->user(); @@ -90,9 +95,60 @@ class CreateSerialValidation extends CreateRecord //..GET SERIAL INVOICE API + // $decodedJwt = JWT::decode($invoiceNumber, new Key('dummy_key', 'HS256')); // replace 'dummy_key' with actual key if needed + // if (!$decodedJwt || !isset($decodedJwt->data)) { + // Notification::make() + // ->title("Invalid e-Invoice QR data or format received...") + // ->info() + // ->seconds(1) + // ->send(); + // return; + // } + + // $documentData = $decodedJwt->data; // This should be JSON string containing DocNo + + // // Extract DocNo using regex + // preg_match('/"DocNo"\s*:\s*"([^"]+)"/', $documentData, $matches); + // if (isset($matches[1])) { + // $this->invoiceNumber = $matches[1]; + // } else { + // Notification::make() + // ->title("DocNo not found in QR data...") + // ->info() + // ->seconds(1) + // ->send(); + // return; + // } //.. + // Decode JWT payload + $payloadJson = base64_decode(strtr($parts[1], '-_', '+/')); + + + $payload = json_decode($payloadJson, true); + + + if (!isset($payload['data'])) { + throw new \Exception('Invalid payload'); + } + + $documentData = $payload['data']; + + + + // Extract DocNo + preg_match('/"DocNo"\s*:\s*"([^"]+)"/', $documentData, $matches); + + if (!isset($matches[1])) { + // throw new \Exception('DocNo not found'); + } + + if (isset($matches[1])) { + $invoiceNumber = $matches[1]; + //dd($invoiceNumber); + } + $updateStatus = $this->form->getState()['update_invoice'] ?? null; $this->invoiceNumber = trim($this->form->getState()['invoice_number']) ?? $invoiceNumber; diff --git a/app/Filament/Resources/StickerStructureDetailResource.php b/app/Filament/Resources/StickerStructureDetailResource.php index a6c8981..b969d5e 100644 --- a/app/Filament/Resources/StickerStructureDetailResource.php +++ b/app/Filament/Resources/StickerStructureDetailResource.php @@ -124,36 +124,57 @@ class StickerStructureDetailResource extends Resource { return $table ->columns([ - Tables\Columns\TextColumn::make('id') - ->label('ID') - ->numeric() - ->sortable(), + Tables\Columns\TextColumn::make('No.') + ->label('No.') + ->getStateUsing(function ($record, $livewire, $column, $rowLoop) { + $paginator = $livewire->getTableRecords(); + $perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10; + $currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1; + + return ($currentPage - 1) * $perPage + $rowLoop->iteration; + }), + Tables\Columns\TextColumn::make('plant.code') + ->label('Plant Code') + ->alignCenter(), + Tables\Columns\TextColumn::make('itemCharacteristic.item.code') + ->label('Item') + ->alignCenter(), Tables\Columns\TextColumn::make('sticker_id') - ->label('Sticker ID'), + ->label('Sticker ID') + ->alignCenter(), Tables\Columns\TextColumn::make('sticker_width') - ->label('Sticker Width'), + ->label('Sticker Width') + ->alignCenter(), Tables\Columns\TextColumn::make('sticker_height') - ->label('Sticker Height'), + ->label('Sticker Height') + ->alignCenter(), Tables\Columns\TextColumn::make('sticker_lmargin') - ->label('Sticker Left Margin'), + ->label('Sticker Left Margin') + ->alignCenter(), Tables\Columns\TextColumn::make('sticker_rmargin') - ->label('Sticker Right Margin'), + ->label('Sticker Right Margin') + ->alignCenter(), Tables\Columns\TextColumn::make('sticker_tmargin') - ->label('Sticker Top Margin'), + ->label('Sticker Top Margin') + ->alignCenter(), Tables\Columns\TextColumn::make('sticker_bmargin') - ->label('Sticker Bottom Margin'), + ->label('Sticker Bottom Margin') + ->alignCenter(), Tables\Columns\TextColumn::make('created_at') ->label('Created At') + ->alignCenter() ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('updated_at') ->label('Updated At') + ->alignCenter() ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('deleted_at') ->label('Deleted At') + ->alignCenter() ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), diff --git a/app/Filament/Resources/StickerValidationResource/Pages/CreateStickerValidation.php b/app/Filament/Resources/StickerValidationResource/Pages/CreateStickerValidation.php index 4ec31b3..804faba 100644 --- a/app/Filament/Resources/StickerValidationResource/Pages/CreateStickerValidation.php +++ b/app/Filament/Resources/StickerValidationResource/Pages/CreateStickerValidation.php @@ -387,20 +387,179 @@ class CreateStickerValidation extends CreateRecord // ]); } + + // foreach ($stickers as $sticker) { + + // // $printerName = $this->getCupsPrinterNameByIp($sticker['print_ip']); + + // \Log::info("Looking up printer for IP: " . $sticker['print_ip']); + // $printerName = $this->getCupsPrinterNameByIp($sticker['print_ip']); + // \Log::info("Found printer: " . ($printerName ?? 'NULL')); + + // if (! $printerName) { + // Notification::make() + // ->danger() + // ->title('Printer Not Found') + // ->body("No CUPS printer configured for IP: {$sticker['print_ip']}") + // ->send(); + // return; + // } + + // $structure = StickerStructureDetail::findOrFail($sticker['sticker_id']); + // $itemCharacteristic = ItemCharacteristic::where('plant_id', $this->plantId) + // ->where('id', $sticker['item_characteristic']) + // ->firstOrFail(); + + // $dynamicElements = StickerDetail::where( + // 'sticker_structure_detail_id', + // $structure->id + // )->where('element_type', 'Dynamic')->get(); + + + + // /** STEP 3: Stream PDF to CUPS (STDIN) */ + // $process = proc_open( + // 'lp -d ' . escapeshellarg($printerName) . ' -o fit-to-page -', + // [ + // ['pipe', 'r'], // STDIN + // ['pipe', 'w'], // STDOUT + // ['pipe', 'w'], // STDERR + // ], + // $pipes + // ); + + + // if (! is_resource($process)) { + // Notification::make() + // ->danger() + // ->title('Print Failed') + // ->body('Unable to start CUPS print process.') + // ->send(); + // return; + // // continue; + // } + + // $pdfContent = (new StickerPdfService())->generatePdf1( + // $structure->sticker_id, + // $dynamicElements, + // $itemCharacteristic, + // $serialNumber, + // $serNo + // ); + + // fwrite($pipes[0], $pdfContent); + // fclose($pipes[0]); + + // $stderr = stream_get_contents($pipes[2]); + // fclose($pipes[1]); + // fclose($pipes[2]); + + // $status = proc_close($process); + + // if ($status != 0) { + // Notification::make() + // ->danger() + // ->title('Print Failed') + // ->body("CUPS error: {$stderr}") + // ->send(); + // return; + // } + // } + + + foreach ($stickers as $sticker) + { + + \Log::info("Looking up printer for IP: " . $sticker['print_ip']); + + $printerName = $this->getCupsPrinterNameByIp($sticker['print_ip']); + + \Log::info("Found printer: " . ($printerName ?? 'NULL')); + + if (! $printerName) { + Notification::make() + ->danger() + ->title('Printer Not Found') + ->body("No CUPS printer configured for IP: {$sticker['print_ip']}") + ->send(); + return; + } + + $structure = StickerStructureDetail::findOrFail($sticker['sticker_id']); + + $itemCharacteristic = ItemCharacteristic::where('plant_id', $this->plantId) + ->where('id', $sticker['item_characteristic']) + ->firstOrFail(); + + $dynamicElements = StickerDetail::where( + 'sticker_structure_detail_id', + $structure->id + )->where('element_type', 'Dynamic')->get(); + + $pdfContent = (new StickerPdfService())->generatePdf1( + $structure->sticker_id, + $dynamicElements, + $itemCharacteristic, + $serialNumber, + $serNo + ); + + $tempPdfPath = storage_path('app/temp_sticker_' . uniqid() . '.pdf'); + file_put_contents($tempPdfPath, $pdfContent); + + exec( + "lp -d " . escapeshellarg($printerName) . " " . escapeshellarg($tempPdfPath), + $output, + $status + ); + + \Log::info("LP Output:", $output); + \Log::info("LP Status: " . $status); + + if ($status != 0) { + Notification::make() + ->danger() + ->title('Print Failed') + ->body("CUPS error while printing.") + ->send(); + + if (file_exists($tempPdfPath)) { + unlink($tempPdfPath); + } + + return; + } + + if (file_exists($tempPdfPath)) { + unlink($tempPdfPath); + } + } + + Notification::make() + ->success() + ->title('Sticker Printed') + ->body("Sticker for Serial Number: $serialNumber printed successfully!") + ->seconds(3) + ->send(); + + // [$itemCode, $serialNumber] = explode('|', $serNo); + + // $this->dispatch('open-sticker-pdf', [ + // 'url' => url("/sticker/pdf/{$itemCode}/{$serialNumber}/$this->plantId/$this->ref_number") + // ]); + } protected function getCupsPrinterNameByIp(string $ip): ?string { - // exec('lpstat -v 2>&1', $output, $status); - exec('lpstat -h cups:631 -v 2>&1', $output, $status); if ($status != 0 || empty($output)) { return null; } - foreach ($output as $line){ + foreach ($output as $line) { $parts = explode(':', $line, 2); if (count($parts) < 2) continue; @@ -411,6 +570,7 @@ class CreateStickerValidation extends CreateRecord return $printerName; } } + return null; } } diff --git a/app/Http/Controllers/MachineController.php b/app/Http/Controllers/MachineController.php index 007b054..ae31220 100644 --- a/app/Http/Controllers/MachineController.php +++ b/app/Http/Controllers/MachineController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\ItemCharacteristic; use App\Models\Line; use App\Models\Machine; use App\Models\Plant; @@ -33,29 +34,28 @@ class MachineController extends Controller public function get_all_data(Request $request) { $expectedUser = env('API_AUTH_USER'); - $expectedPw = env('API_AUTH_PW'); - $header_auth = $request->header('Authorization'); - $expectedToken = $expectedUser . ':' . $expectedPw; + $expectedPw = env('API_AUTH_PW'); + $header_auth = $request->header('Authorization'); + $expectedToken = $expectedUser.':'.$expectedPw; - if ("Bearer " . $expectedToken != $header_auth) - { + if ('Bearer '.$expectedToken != $header_auth) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => 'Invalid authorization token!' + 'status_description' => 'Invalid authorization token!', ], 403); } - $machines = Machine::with('plant')->with('workGroupMaster')->orderBy('plant_id')->get(); - $machinesData = $machines->map(function($machine) { + $machines = ItemCharacteristic::with('plant')->with('workGroupMaster')->orderBy('plant_id')->get(); + $machinesData = $machines->map(function ($machine) { return [ - 'plant_code' => $machine->plant ? (String)$machine->plant->code : "", - 'group_work_center' => $machine->workGroupMaster ? (String)$machine->workGroupMaster->name : "", - 'work_center' => $machine->work_center ?? "", + 'plant_code' => $machine->plant ? (string) $machine->plant->code : '', + 'group_work_center' => $machine->workGroupMaster ? (string) $machine->workGroupMaster->name : '', + 'work_center' => $machine->work_center ?? '', ]; }); return response()->json([ - 'machines' => $machinesData + 'machines' => $machinesData, ]); } @@ -65,80 +65,70 @@ class MachineController extends Controller public function get_data(Request $request) { $expectedUser = env('API_AUTH_USER'); - $expectedPw = env('API_AUTH_PW'); - $header_auth = $request->header('Authorization'); - $expectedToken = $expectedUser . ':' . $expectedPw; + $expectedPw = env('API_AUTH_PW'); + $header_auth = $request->header('Authorization'); + $expectedToken = $expectedUser.':'.$expectedPw; - if ("Bearer " . $expectedToken != $header_auth) - { + if ('Bearer '.$expectedToken != $header_auth) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => 'Invalid authorization token!' + 'status_description' => 'Invalid authorization token!', ], 403); } $plantCode = $request->header('plant-code'); $lineName = $request->header('line-name'); - if ($plantCode == null || $plantCode == '') - { + if ($plantCode == null || $plantCode == '') { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Plant code can't be empty!" + 'status_description' => "Plant code can't be empty!", ], 400); - } - else if (Str::length($plantCode) < 4 || !is_numeric($plantCode) || !preg_match('/^[1-9]\d{3,}$/', $plantCode)) - { + } elseif (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Invalid plant code found!" + 'status_description' => 'Invalid plant code found!', ], 400); - } - else if ($lineName == null || $lineName == '' || Str::length($lineName) <= 0) - { + } elseif ($lineName == null || $lineName == '' || Str::length($lineName) <= 0) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Line name can't be empty!" + 'status_description' => "Line name can't be empty!", ], 400); } $plant = Plant::where('code', $plantCode)->first(); - if (!$plant) - { + if (! $plant) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Plant Code '{$plantCode}' not found!" + 'status_description' => "Plant Code '{$plantCode}' not found!", ], 400); } $plantId = $plant->id; $line = Line::where('name', $lineName)->first(); - if (!$line) - { + if (! $line) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Line Name '{$lineName}' not found!" + 'status_description' => "Line Name '{$lineName}' not found!", ], 400); } $line = Line::where('name', $lineName)->where('plant_id', $plantId)->first(); - if (!$line) - { + if (! $line) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Line Name '{$lineName}' not found for the plant!" + 'status_description' => "Line Name '{$lineName}' not found for the plant!", ], 400); } - $lineId = $line->id;//no_of_operation + $lineId = $line->id; // no_of_operation $lineWorkGroup1Id = $line->work_group1_id; $lineWorkGroup2Id = $line->work_group2_id; - if ($line->no_of_operation == null || $line->no_of_operation == '' || $line->no_of_operation == 0 || !is_numeric($line->no_of_operation)) - { + if ($line->no_of_operation == null || $line->no_of_operation == '' || $line->no_of_operation == 0 || ! is_numeric($line->no_of_operation)) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Group work center not found for the plant & line!" + 'status_description' => 'Group work center not found for the plant & line!', ], 400); } @@ -146,26 +136,22 @@ class MachineController extends Controller $lineWorkGroupIds = []; for ($i = 1; $i <= $line->no_of_operation; $i++) { $curWorkGroupId = $line->{"work_group{$i}_id"}; - if (in_array($curWorkGroupId, $lineWorkGroupIds)) - { + if (in_array($curWorkGroupId, $lineWorkGroupIds)) { continue; - } - else - { + } else { $lineWorkGroupIds[] = $curWorkGroupId; } $test[] = [ - 'group_work_center' => WorkGroupMaster::where('id', $curWorkGroupId)->first()->name ?? "", - 'operation_number' => WorkGroupMaster::where('id', $curWorkGroupId)->first()->operation_number ?? "", + 'group_work_center' => WorkGroupMaster::where('id', $curWorkGroupId)->first()->name ?? '', + 'operation_number' => WorkGroupMaster::where('id', $curWorkGroupId)->first()->operation_number ?? '', 'work_centers' => Machine::where('plant_id', $plantId)->where('work_group_master_id', $curWorkGroupId)->orderBy('work_center')->pluck('work_center')->toArray() ?? [], ]; } - if($lineWorkGroupIds) - { + if ($lineWorkGroupIds) { return response()->json([ - 'machines' => $test + 'machines' => $test, ]); } // $machines = Machine::with('plant')->with('workGroupMaster')->orderBy('plant_id')->get(); @@ -203,7 +189,7 @@ class MachineController extends Controller /** * Update the specified resource in storage. - */ + */ public function update(Request $request, string $id) { // diff --git a/app/Http/Controllers/PdfController.php b/app/Http/Controllers/PdfController.php index 03ac47e..25664ac 100644 --- a/app/Http/Controllers/PdfController.php +++ b/app/Http/Controllers/PdfController.php @@ -1034,12 +1034,24 @@ class PdfController extends Controller ->where('id', $itemCharacteristicId) ->first(); - return (new StickerPdfService())->generatePdf1( + // return (new StickerPdfService())->generatePdf1( + // $structure->sticker_id, + // $dynamicElements, + // $itemCharacteristic, + // $serialNumber + // ); + $pdfBytes = (new StickerPdfService())->generatePdf1( $structure->sticker_id, $dynamicElements, $itemCharacteristic, $serialNumber ); + + + // Return as downloadable/streamed PDF + return response($pdfBytes, 200) + ->header('Content-Type', 'application/pdf') + ->header('Content-Disposition', 'inline; filename="sticker.pdf"'); } return abort(404); diff --git a/app/Livewire/ProductionTargetPlan.php b/app/Livewire/ProductionTargetPlan.php index 960885f..cb52e0b 100644 --- a/app/Livewire/ProductionTargetPlan.php +++ b/app/Livewire/ProductionTargetPlan.php @@ -44,8 +44,139 @@ class ProductionTargetPlan extends Component return $dates; } - public function loadProductionData($plantId, $lineId, $month, $year){ + // public function loadProductionData($plantId, $lineId, $month, $year){ + // if (!$plantId || !$lineId || !$month || !$year) { + // $this->records = []; + // $this->dates = []; + // $this->leaveDates = []; + // return; + // } + + // $this->dates = $this->getMonthDates($month, $year); + + // $data = ProductionPlan::query() + // ->join('items', 'items.id', '=', 'production_plans.item_id') + // ->join('lines', 'lines.id', '=', 'production_plans.line_id') + // ->join('plants', 'plants.id', '=', 'production_plans.plant_id') + // ->where('production_plans.plant_id', $plantId) + // ->where('production_plans.line_id', $lineId) + // ->whereMonth('production_plans.created_at', $month) + // ->whereYear('production_plans.created_at', $year) + // ->select( + // 'production_plans.created_at', + // 'production_plans.operator_id', + // 'plants.name as plant', + // 'items.code as item_code', + // 'items.description as item_description', + // 'lines.name as line_name', + // 'production_plans.leave_dates' + // ) + // ->first(); + + // if ($data && $data->leave_dates) { + // $this->leaveDates = array_map('trim', explode(',', $data->leave_dates)); + // } + + // $producedData = ProductionQuantity::selectRaw(" + // plant_id, + // line_id, + // item_id, + // DATE(created_at) as prod_date, + // COUNT(*) as total_qty + // ") + // ->where('plant_id', $plantId) + // ->where('line_id', $lineId) + // ->whereMonth('created_at', $month) + // ->whereYear('created_at', $year) + // ->groupBy('plant_id', 'line_id', 'item_id', DB::raw('DATE(created_at)')) + // ->get() + // ->groupBy(function ($row) { + // return $row->plant_id . '_' . $row->line_id . '_' . $row->item_id; + // }) + // ->map(function ($group) { + // return $group->keyBy('prod_date'); + // }); + + // $this->records = ProductionPlan::query() + // ->join('items', 'items.id', '=', 'production_plans.item_id') + // ->join('lines', 'lines.id', '=', 'production_plans.line_id') + // ->join('plants', 'plants.id', '=', 'production_plans.plant_id') + // ->where('production_plans.plant_id', $plantId) + // ->where('production_plans.line_id', $lineId) + // ->whereMonth('production_plans.created_at', $month) + // ->whereYear('production_plans.created_at', $year) + // ->select( + // 'production_plans.item_id', + // 'production_plans.plant_id', + // 'production_plans.line_id', + // 'production_plans.plan_quantity', + // 'production_plans.working_days', + // 'items.code as item_code', + // 'items.description as item_description', + // 'lines.name as line_name', + // 'plants.name as plant_name' + // ) + // ->get() + // ->map(function ($row) use ($producedData) { + + // $row = $row->toArray(); + + // $remainingQty = $row['plan_quantity']; + // // $remainingDays = $row['working_days']; + // $remainingDays = (int) ($row['working_days'] ?? 0); + + // $row['daily_target_dynamic'] = []; + // $row['produced_quantity'] = []; + + // $key = $row['plant_id'].'_'.$row['line_id'].'_'.$row['item_id']; + + // foreach ($this->dates as $date) { + + // // Skip leave dates + // if (in_array($date, $this->leaveDates)) { + // $row['daily_target_dynamic'][$date] = '-'; + // $row['produced_quantity'][$date] = '-'; + // continue; + // } + + // $todayTarget = $remainingDays > 0 + // ? round($remainingQty / $remainingDays, 2) + // : 0; + + // //$todayTarget = $remainingDays > 0 + // // ? $remainingQty / $remainingDays + // // : 0; + + // $producedQty = isset($producedData[$key][$date]) + // ? $producedData[$key][$date]->total_qty + // : 0; + + // $row['daily_target_dynamic'][$date] = $todayTarget; + // $row['produced_quantity'][$date] = $producedQty; + + // // Carry forward pending + // $remainingQty -= $producedQty; + // if ($remainingQty < 0) { + // $remainingQty = 0; + // } + + // if ($remainingDays > 0) { + // $remainingDays--; + // } + + // // $remainingDays--; + // } + + // return $row; + // }) + // ->toArray(); + // } + + + + public function loadProductionData($plantId, $lineId, $month, $year) + { if (!$plantId || !$lineId || !$month || !$year) { $this->records = []; $this->dates = []; @@ -53,52 +184,10 @@ class ProductionTargetPlan extends Component return; } - $this->dates = $this->getMonthDates($month, $year); + $dates = $this->getMonthDates($month, $year); + $this->dates = $dates; - $data = ProductionPlan::query() - ->join('items', 'items.id', '=', 'production_plans.item_id') - ->join('lines', 'lines.id', '=', 'production_plans.line_id') - ->join('plants', 'plants.id', '=', 'production_plans.plant_id') - ->where('production_plans.plant_id', $plantId) - ->where('production_plans.line_id', $lineId) - ->whereMonth('production_plans.created_at', $month) - ->whereYear('production_plans.created_at', $year) - ->select( - 'production_plans.created_at', - 'production_plans.operator_id', - 'plants.name as plant', - 'items.code as item_code', - 'items.description as item_description', - 'lines.name as line_name', - 'production_plans.leave_dates' - ) - ->first(); - - if ($data && $data->leave_dates) { - $this->leaveDates = array_map('trim', explode(',', $data->leave_dates)); - } - - $producedData = ProductionQuantity::selectRaw(" - plant_id, - line_id, - item_id, - DATE(created_at) as prod_date, - COUNT(*) as total_qty - ") - ->where('plant_id', $plantId) - ->where('line_id', $lineId) - ->whereMonth('created_at', $month) - ->whereYear('created_at', $year) - ->groupBy('plant_id', 'line_id', 'item_id', DB::raw('DATE(created_at)')) - ->get() - ->groupBy(function ($row) { - return $row->plant_id . '_' . $row->line_id . '_' . $row->item_id; - }) - ->map(function ($group) { - return $group->keyBy('prod_date'); - }); - - $this->records = ProductionPlan::query() + $plans = ProductionPlan::query() ->join('items', 'items.id', '=', 'production_plans.item_id') ->join('lines', 'lines.id', '=', 'production_plans.line_id') ->join('plants', 'plants.id', '=', 'production_plans.plant_id') @@ -112,111 +201,96 @@ class ProductionTargetPlan extends Component 'production_plans.line_id', 'production_plans.plan_quantity', 'production_plans.working_days', + 'production_plans.leave_dates', 'items.code as item_code', 'items.description as item_description', 'lines.name as line_name', + 'lines.line_capacity as line_capacity', 'plants.name as plant_name' ) + ->get(); + + $leaveDates = []; + + if ($plans->isNotEmpty() && $plans[0]->leave_dates) { + $leaveDates = array_map('trim', explode(',', $plans[0]->leave_dates)); + } + + $this->leaveDates = $leaveDates; + + $producedData = ProductionQuantity::selectRaw(" + plant_id, + line_id, + item_id, + DATE(created_at) as prod_date, + COUNT(*) as total_qty + ") + ->where('plant_id', $plantId) + ->where('line_id', $lineId) + ->whereMonth('created_at', $month) + ->whereYear('created_at', $year) + ->groupBy('plant_id', 'line_id', 'item_id', DB::raw('DATE(created_at)')) ->get() - // ->map(function ($row) use ($producedData) { - // $row = $row->toArray(); + ->groupBy(fn($row) => + $row->plant_id . '_' . $row->line_id . '_' . $row->item_id + ) + ->map(fn($group) => $group->keyBy('prod_date')); - // $row['daily_target'] = ($row['working_days'] > 0) - // ? round($row['plan_quantity'] / $row['working_days'], 2) - // : 0; - // // $key = $row['plant_id'].'_'.$row['line_id'].'_'.$row['item_id']; + $records = []; - // // foreach ($this->dates as $date) { - // // $found = $producedData[$key][$date] ?? null; - // // $row['produced_quantity'][$date] = $found->total_qty ?? 0; - // // } + foreach ($plans as $plan) { - // $remainingDays = $row['working_days']; - // $pendingQty = 0; + $row = $plan->toArray(); - // $row['daily_target_dynamic'] = []; - // $row['produced_quantity'] = []; + $remainingQty = (float) $row['plan_quantity']; + $remainingDays = (int) ($row['working_days'] ?? 0); - // $key = $row['plant_id'].'_'.$row['line_id'].'_'.$row['item_id']; + $lineCapacity = (float) ($row['line_capacity'] ?? 0); + $dailyLineCapacity = (float) ($row['line_capacity'] ?? 0); - // foreach ($this->dates as $date) { - // $found = $producedData[$key][$date] ?? null; - // $producedQty = $found->total_qty ?? 0; + $row['daily_line_capacity'] = []; + $row['daily_target_dynamic'] = []; + $row['produced_quantity'] = []; - // // today's adjusted target - // $todayTarget = $baseDailyTarget; + $key = $row['plant_id'].'_'.$row['line_id'].'_'.$row['item_id']; - // if ($remainingDays > 1 && $pendingQty > 0) { - // $todayTarget += $pendingQty / $remainingDays; - // } + foreach ($dates as $date) { - // $row['daily_target_dynamic'][$date] = round($todayTarget, 2); - // $row['produced_quantity'][$date] = $producedQty; - - // // calculate today's shortfall - // $pendingQty += ($todayTarget - $producedQty); - - // if ($pendingQty < 0) { - // $pendingQty = 0; - // } - - // $remainingDays--; - // } - - // return $row; - // }) - ->map(function ($row) use ($producedData) { - - $row = $row->toArray(); - - $remainingQty = $row['plan_quantity']; - $remainingDays = $row['working_days']; - - $row['daily_target_dynamic'] = []; - $row['produced_quantity'] = []; - - $key = $row['plant_id'].'_'.$row['line_id'].'_'.$row['item_id']; - - foreach ($this->dates as $date) { - - // Skip leave dates - if (in_array($date, $this->leaveDates)) { - $row['daily_target_dynamic'][$date] = '-'; - $row['produced_quantity'][$date] = '-'; - continue; - } - - $todayTarget = $remainingDays > 0 - ? round($remainingQty / $remainingDays, 2) - : 0; - - //$todayTarget = $remainingDays > 0 - // ? $remainingQty / $remainingDays - // : 0; - - $producedQty = isset($producedData[$key][$date]) - ? $producedData[$key][$date]->total_qty - : 0; - - $row['daily_target_dynamic'][$date] = $todayTarget; - $row['produced_quantity'][$date] = $producedQty; - - // Carry forward pending - $remainingQty -= $producedQty; - if ($remainingQty < 0) { - $remainingQty = 0; - } - - $remainingDays--; + // Skip leave dates fast + if (isset($leaveDates) && in_array($date, $leaveDates)) { + $row['daily_line_capacity'][$date] = '-'; + $row['daily_target_dynamic'][$date] = '-'; + $row['produced_quantity'][$date] = '-'; + continue; } - return $row; - }) - ->toArray(); + $todayTarget = $remainingDays > 0 + ? round($remainingQty / $remainingDays, 2) + : 0; + + $producedQty = $producedData[$key][$date]->total_qty ?? 0; + + $row['daily_target_dynamic'][$date] = $todayTarget; + $row['produced_quantity'][$date] = $producedQty; + $row['daily_line_capacity'][$date] = $dailyLineCapacity; + + // Carry forward remaining qty + $remainingQty = max(0, $remainingQty - $producedQty); + + if ($remainingDays > 0) { + $remainingDays--; + } + } + + $records[] = $row; + } + + $this->records = $records; } + public function exportProductionData() { return Excel::download( diff --git a/app/Models/Line.php b/app/Models/Line.php index 00b2631..ac2a2ca 100644 --- a/app/Models/Line.php +++ b/app/Models/Line.php @@ -16,6 +16,7 @@ class Line extends Model "block_id", "name", "type", + "line_capacity", "group_work_center", "no_of_operation", "work_group1_id", diff --git a/app/Models/ProductionQuantity.php b/app/Models/ProductionQuantity.php index c97aef3..f278f63 100644 --- a/app/Models/ProductionQuantity.php +++ b/app/Models/ProductionQuantity.php @@ -23,7 +23,8 @@ class ProductionQuantity extends Model "serial_number", "production_order", "operator_id", - // "success_status", + "success_status", + "reject_reason", // "no_of_employee", // "list_of_employee", "created_at", diff --git a/app/Models/StickerStructureDetail.php b/app/Models/StickerStructureDetail.php index a9be47b..8b61361 100644 --- a/app/Models/StickerStructureDetail.php +++ b/app/Models/StickerStructureDetail.php @@ -37,4 +37,9 @@ class StickerStructureDetail extends Model return $this->belongsTo(ItemCharacteristic::class, 'item_characteristic_id'); } + public function item(): BelongsTo + { + return $this->belongsTo(Item::class, 'item_id'); + } + } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index e685c8c..fe53036 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,10 +2,13 @@ namespace App\Providers; +use App\Filament\Pages\NotificationSettings; use App\Models\AlertMailRule; use App\Models\User; use App\Policies\PermissionPolicy; use App\Policies\RolePolicy; +use DB; +use Filament\Facades\Filament; use Filament\Support\Assets\Js; use Filament\Support\Facades\FilamentAsset; use Illuminate\Console\Scheduling\Schedule; @@ -40,6 +43,16 @@ class AppServiceProvider extends ServiceProvider // $view->with('forgotPasswordUrl', route('password.request')); // }); + DB::listen(function ($query) { + if ($query->time > 1000) { // > 1 sec + logger()->warning('Slow query', [ + 'sql' => $query->sql, + 'time' => $query->time + ]); + } + }); + + Gate::before(function (User $user, string $ability) { return $user->isSuperAdmin() ? true : null; }); diff --git a/app/Services/StickerPdfService.php b/app/Services/StickerPdfService.php index eaacf68..04f5f6e 100644 --- a/app/Services/StickerPdfService.php +++ b/app/Services/StickerPdfService.php @@ -895,7 +895,8 @@ class StickerPdfService if ( ($row->element_type) == 'Dynamic' ) { - $qrContent = $serNo ?? ''; + $qrContent = $itemCode . '|' . ($serNo ?? ''); + $pdf->write2DBarcode( $qrContent, 'QRCODE,H', @@ -1018,22 +1019,9 @@ class StickerPdfService } } - // $pdfContent = $pdf->Output('', 'S'); // 'S' returns string - - // // Encode as base64 - // return base64_encode($pdfContent); - - - // $pdfContent = $pdf->Output('', 'S'); - - // return response($pdfContent) - // ->header('Content-Type', 'application/pdf') - // ->header('Content-Disposition', 'inline; filename="sticker.pdf"'); - $pdfContent = $pdf->Output('', 'S'); // 'S' returns the PDF as a string - - // Return the PDF as a response try { - $pdfContent = $pdf->Output('', 'S'); // 'S' returns the PDF as a string + $pdfContent = $pdf->Output('', 'S'); + return response($pdfContent) ->header('Content-Type', 'application/pdf') ->header('Content-Disposition', 'inline; filename="sticker.pdf"'); diff --git a/database/migrations/2025_12_24_182850_create_sticker_validations_table.php b/database/migrations/2025_12_24_182850_create_sticker_validations_table.php index 490f920..fc86660 100644 --- a/database/migrations/2025_12_24_182850_create_sticker_validations_table.php +++ b/database/migrations/2025_12_24_182850_create_sticker_validations_table.php @@ -19,7 +19,7 @@ return new class extends Migration production_order TEXT DEFAULT NULL, serial_number TEXT DEFAULT NULL, status TEXT DEFAULT NULL, - sticker_id TEXT DEFAULT NULL + sticker_id TEXT DEFAULT NULL, created_at TIMESTAMP NOT NULL DEFAULT NOW(), updated_at TIMESTAMP NOT NULL DEFAULT NOW(), diff --git a/database/seeders/PermissionSeeder.php b/database/seeders/PermissionSeeder.php index ae385c7..20080dc 100644 --- a/database/seeders/PermissionSeeder.php +++ b/database/seeders/PermissionSeeder.php @@ -171,5 +171,17 @@ class PermissionSeeder extends Seeder Permission::updateOrCreate(['name' => 'view import sticker printing']); Permission::updateOrCreate(['name' => 'view export sticker printing']); + + Permission::updateOrCreate(['name' => 'view import request quotation']); + Permission::updateOrCreate(['name' => 'view export request quotation']); + + Permission::updateOrCreate(['name' => 'view rfq dashboard']); + Permission::updateOrCreate(['name' => 'view rfq overview dashboard']); + + Permission::updateOrCreate(['name' => 'view production calender page']); + Permission::updateOrCreate(['name' => 'view production target page']); + + + } } diff --git a/package-lock.json b/package-lock.json index 3514847..bdd85ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,15 @@ { - "name": "pds", + "name": "qds", "lockfileVersion": 2, "requires": true, "packages": { "": { + "dependencies": { + "react": "^19.2.3", + "react-dom": "^19.2.3" + }, "devDependencies": { + "@vitejs/plugin-react": "^5.1.2", "autoprefixer": "^10.4.20", "axios": "^1.7.4", "chartjs-plugin-datalabels": "^2.2.0", @@ -27,6 +32,298 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz", + "integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", + "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.5", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-module-transforms": "^7.28.3", + "@babel/helpers": "^7.28.4", + "@babel/parser": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/traverse": "^7.28.5", + "@babel/types": "^7.28.5", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz", + "integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.28.5", + "@babel/types": "^7.28.5", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", + "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.27.2", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", + "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.28.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz", + "integrity": "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.28.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", + "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.28.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.4.tgz", + "integrity": "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", + "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.5" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", + "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", + "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", + "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/parser": "^7.27.2", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz", + "integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.5", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.5", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", + "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.3", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.3.tgz", @@ -445,17 +742,25 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", - "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { @@ -467,15 +772,6 @@ "node": ">=6.0.0" } }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", @@ -483,10 +779,11 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" @@ -544,6 +841,13 @@ "node": ">=14" } }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.53.tgz", + "integrity": "sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.40.1", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.40.1.tgz", @@ -804,12 +1108,78 @@ "win32" ] }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, "node_modules/@types/estree": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", "dev": true }, + "node_modules/@vitejs/plugin-react": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.1.2.tgz", + "integrity": "sha512-EcA07pHJouywpzsoTUqNh5NwGayl2PPVEJKUSinGGSxFGYn+shYbqMGBg6FXDqgXum9Ou/ecb+411ssw8HImJQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.5", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.53", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.18.0" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, "node_modules/ansi-regex": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", @@ -1252,6 +1622,13 @@ "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" } }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -1278,6 +1655,24 @@ "node": ">=4" } }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -1561,6 +1956,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -1795,6 +2200,39 @@ "jiti": "bin/jiti.js" } }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/laravel-vite-plugin": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/laravel-vite-plugin/-/laravel-vite-plugin-1.2.0.tgz", @@ -1920,6 +2358,13 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, "node_modules/mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -2233,6 +2678,37 @@ } ] }, + "node_modules/react": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", + "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.3" + } + }, + "node_modules/react-refresh": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", + "integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -2364,6 +2840,22 @@ "tslib": "^2.1.0" } }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -2954,6 +3446,13 @@ "node": ">=10" } }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, "node_modules/yaml": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.1.tgz", @@ -3042,6 +3541,207 @@ "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", "dev": true }, + "@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + } + }, + "@babel/compat-data": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz", + "integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==", + "dev": true + }, + "@babel/core": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", + "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.5", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-module-transforms": "^7.28.3", + "@babel/helpers": "^7.28.4", + "@babel/parser": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/traverse": "^7.28.5", + "@babel/types": "^7.28.5", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + } + }, + "@babel/generator": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz", + "integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==", + "dev": true, + "requires": { + "@babel/parser": "^7.28.5", + "@babel/types": "^7.28.5", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", + "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.27.2", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + } + } + }, + "@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "dev": true + }, + "@babel/helper-module-imports": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", + "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", + "dev": true, + "requires": { + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" + } + }, + "@babel/helper-module-transforms": { + "version": "7.28.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz", + "integrity": "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.28.3" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", + "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", + "dev": true + }, + "@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "dev": true + }, + "@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "dev": true + }, + "@babel/helpers": { + "version": "7.28.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.4.tgz", + "integrity": "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==", + "dev": true, + "requires": { + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.4" + } + }, + "@babel/parser": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", + "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", + "dev": true, + "requires": { + "@babel/types": "^7.28.5" + } + }, + "@babel/plugin-transform-react-jsx-self": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", + "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/plugin-transform-react-jsx-source": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", + "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.27.1" + } + }, + "@babel/template": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", + "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.27.1", + "@babel/parser": "^7.27.2", + "@babel/types": "^7.27.1" + } + }, + "@babel/traverse": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz", + "integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.5", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.5", + "debug": "^4.3.1" + } + }, + "@babel/types": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", + "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" + } + }, "@esbuild/aix-ppc64": { "version": "0.25.3", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.3.tgz", @@ -3232,13 +3932,22 @@ } }, "@jridgewell/gen-mapping": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", - "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", "dev": true, "requires": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, @@ -3248,12 +3957,6 @@ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true }, - "@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true - }, "@jridgewell/sourcemap-codec": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", @@ -3261,9 +3964,9 @@ "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.1.0", @@ -3310,6 +4013,12 @@ "dev": true, "optional": true }, + "@rolldown/pluginutils": { + "version": "1.0.0-beta.53", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.53.tgz", + "integrity": "sha512-vENRlFU4YbrwVqNDZ7fLvy+JR1CRkyr01jhSiDpE1u6py3OMzQfztQU2jxykW3ALNxO4kSlqIDeYyD0Y9RcQeQ==", + "dev": true + }, "@rollup/rollup-android-arm-eabi": { "version": "4.40.1", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.40.1.tgz", @@ -3450,12 +4159,67 @@ "dev": true, "optional": true }, + "@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "requires": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "requires": { + "@babel/types": "^7.28.2" + } + }, "@types/estree": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", "dev": true }, + "@vitejs/plugin-react": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.1.2.tgz", + "integrity": "sha512-EcA07pHJouywpzsoTUqNh5NwGayl2PPVEJKUSinGGSxFGYn+shYbqMGBg6FXDqgXum9Ou/ecb+411ssw8HImJQ==", + "dev": true, + "requires": { + "@babel/core": "^7.28.5", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.53", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.18.0" + } + }, "ansi-regex": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", @@ -3754,6 +4518,12 @@ "yargs": "^17.7.2" } }, + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, "cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -3771,6 +4541,15 @@ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "dev": true }, + "debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "requires": { + "ms": "^2.1.3" + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -3979,6 +4758,12 @@ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -4139,6 +4924,24 @@ "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", "dev": true }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, "laravel-vite-plugin": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/laravel-vite-plugin/-/laravel-vite-plugin-1.2.0.tgz", @@ -4225,6 +5028,12 @@ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, "mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -4402,6 +5211,25 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "react": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", + "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==" + }, + "react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", + "requires": { + "scheduler": "^0.27.0" + } + }, + "react-refresh": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", + "integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==", + "dev": true + }, "read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -4491,6 +5319,17 @@ "tslib": "^2.1.0" } }, + "scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==" + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + }, "shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -4860,6 +5699,12 @@ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, "yaml": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.1.tgz", diff --git a/package.json b/package.json index b77f813..a122699 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "dev": "vite" }, "devDependencies": { + "@vitejs/plugin-react": "^5.1.2", "autoprefixer": "^10.4.20", "axios": "^1.7.4", "chartjs-plugin-datalabels": "^2.2.0", @@ -14,5 +15,9 @@ "postcss": "^8.4.47", "tailwindcss": "^3.4.13", "vite": "^6.0.11" + }, + "dependencies": { + "react": "^19.2.3", + "react-dom": "^19.2.3" } } diff --git a/resources/views/fields/generate-template.blade.php b/resources/views/fields/generate-template.blade.php index a1d67b1..feb8976 100644 --- a/resources/views/fields/generate-template.blade.php +++ b/resources/views/fields/generate-template.blade.php @@ -115,3 +115,5 @@ $sticker_id = $attributes->get('sticker_id'); + + diff --git a/resources/views/filament/pages/welcome.blade.php b/resources/views/filament/pages/welcome.blade.php index 91caa77..fd39490 100644 --- a/resources/views/filament/pages/welcome.blade.php +++ b/resources/views/filament/pages/welcome.blade.php @@ -1,19 +1,96 @@ -

Welcome to CRI Digital Manufacturing IIOT

+ +
+

+ CRI Digital Manufacturing IIoT Platform +

+

+ Complete visibility, traceability, and control across your manufacturing operations +

+
-
- CRI Digital Manufacturing IIoT -
+ +
+ CRI Digital Manufacturing IIoT +
-

- This dashboard provides real-time visibility into your manufacturing operations, - enabling you to monitor production, track performance, and make data-driven decisions - across plants and linesโ€”all from one centralized platform. -

+ +
+

+ CRI Digital Manufacturing IIoT is built to deliver + end-to-end traceability, real-time insights, and operational transparency + across plants, lines, and production processes. +

+ +

+ The platform ensures right quality and on-time delivery by enabling + complete tracking of materials, production orders, and finished goodsโ€”helping teams + make faster, data-driven decisions with confidence. +

+
+ + +
+
+

๐Ÿ” Traceability

+

+ Track materials, batches, and serials from input to dispatch. +

+
+ +
+

โœ… Quality Assurance

+

+ Validate process data and ensure first-time-right production. +

+
+ +
+

โฑ On-Time Delivery

+

+ Identify delays early and meet production commitments. +

+
+ +
+

๐Ÿ“Š Real-Time Insights

+

+ Monitor performance and take quick corrective actions. +

+
+
+ + +
+

24ร—7 Support

+

+ Our dedicated IIoT support team is available round-the-clock to ensure + uninterrupted operations and quick issue resolution. +

+

+ ๐Ÿ“ž Support Contact: +91 8925899458 / +91 8925899459 +

+ {{--

+ ๐Ÿ“ž Technical Support Contact: 9952468104 / 9100832269 +

--}} +
+ + +
+

Our Team

+
+
๐Ÿ‘ค Jothikumar
+
๐Ÿ‘ค Dhanabalan
+
๐Ÿ‘ค Shibu
+
๐Ÿ‘ค Ranjith
+
๐Ÿ‘ค Srimathi
+
๐Ÿ‘ค Gokul
+
+
diff --git a/resources/views/filament/resources/sticker-validation-resource/create-sticker-validation.blade.php b/resources/views/filament/resources/sticker-validation-resource/create-sticker-validation.blade.php index 0b05873..4a33ee1 100644 --- a/resources/views/filament/resources/sticker-validation-resource/create-sticker-validation.blade.php +++ b/resources/views/filament/resources/sticker-validation-resource/create-sticker-validation.blade.php @@ -67,3 +67,29 @@ window.addEventListener('open-stickers-sequence', async (event) => { }); + + diff --git a/resources/views/forms/calendar.blade.php b/resources/views/forms/calendar.blade.php index 113f799..1e22410 100644 --- a/resources/views/forms/calendar.blade.php +++ b/resources/views/forms/calendar.blade.php @@ -64,88 +64,58 @@ document.addEventListener('DOMContentLoaded', function () { }); - // var calendar = new FullCalendar.Calendar(calendarEl, { - // initialView: 'dayGridMonth', - // height: 600, - // showNonCurrentDates: true, + // function updateWorkingDays(date) { + // let totalDays = new Date( + // date.getFullYear(), + // date.getMonth()+1, + // 0 + // ).getDate(); - // dateClick: function(info) { + // let workingDays = totalDays - selectedDates.length; + // // document.querySelector('input[name="working_days"]').value = workingDays; - // let viewMonth = calendar.view.currentStart.getMonth(); - // let clickedMonth = info.date.getMonth(); + // const input = document.querySelector('#working_days'); - // // let month = info.date.getMonth() + 1; // JS month: 0-11 โ†’ 1-12 - // // let year = info.date.getFullYear(); + // input.value = workingDays; - // if (viewMonth != clickedMonth) { - // return; // Ignore next/prev month dates - // } + // input.dispatchEvent(new Event('input')); - // let dateStr = info.dateStr; + // const monthInput = document.querySelector('#month'); + // monthInput.value = date.getMonth() + 1; // 1โ€“12 month number + // monthInput.dispatchEvent(new Event('input')); - // if (selectedDates.includes(dateStr)) { - // selectedDates = selectedDates.filter(d => d !== dateStr); + // const yearInput = document.querySelector('#year'); + // yearInput.value = date.getFullYear(); + // yearInput.dispatchEvent(new Event('input')); - // calendar.getEvents().forEach(event => { - // if (event.startStr == dateStr) { - // event.remove(); - // } - // }); + // const selectedDatesInput = document.querySelector('#selected_dates'); + // selectedDatesInput.value = selectedDates.join(','); + // selectedDatesInput.dispatchEvent(new Event('input')); - // } else { - // selectedDates.push(dateStr); - - // calendar.addEvent({ - // start: dateStr, - // display: 'background', - // color: '#f03f17' - // }); - // } - - // updateWorkingDays(info.date); - // } - // }); - - // yearSelect.addEventListener('change', function () { - // let year = this.value; - // if (!year) return; - - // let currentDate = calendar.getDate(); - // let newDate = new Date(year, currentDate.getMonth(), 1); - - // calendar.gotoDate(newDate); - // }); + // } function updateWorkingDays(date) { let totalDays = new Date( date.getFullYear(), - date.getMonth()+1, + date.getMonth() + 1, 0 ).getDate(); let workingDays = totalDays - selectedDates.length; - // document.querySelector('input[name="working_days"]').value = workingDays; - const input = document.querySelector('#working_days'); - - input.value = workingDays; - - input.dispatchEvent(new Event('input')); - - const monthInput = document.querySelector('#month'); - monthInput.value = date.getMonth() + 1; // 1โ€“12 month number - monthInput.dispatchEvent(new Event('input')); - - const yearInput = document.querySelector('#year'); - yearInput.value = date.getFullYear(); - yearInput.dispatchEvent(new Event('input')); - - const selectedDatesInput = document.querySelector('#selected_dates'); - selectedDatesInput.value = selectedDates.join(','); - selectedDatesInput.dispatchEvent(new Event('input')); + // Set values only + document.querySelector('#working_days').value = workingDays; + document.querySelector('#month').value = date.getMonth() + 1; + document.querySelector('#year').value = date.getFullYear(); + document.querySelector('#selected_dates').value = selectedDates.join(','); + // Trigger only ONE update (important) + document + .querySelector('#selected_dates') + .dispatchEvent(new Event('input')); } + calendar.render(); }); diff --git a/resources/views/livewire/production-target-plan.blade.php b/resources/views/livewire/production-target-plan.blade.php index fee20f1..2d8a6db 100644 --- a/resources/views/livewire/production-target-plan.blade.php +++ b/resources/views/livewire/production-target-plan.blade.php @@ -4,17 +4,6 @@
- {{-- - - - - - - - - - - --}} @@ -22,21 +11,29 @@ - @foreach($dates as $date) - --}} + @endforeach @foreach($dates as $date) + - + + + {{-- --}} @endforeach @@ -58,8 +55,12 @@ @if(in_array($date, $leaveDates)) + @else {{-- --}} + @@ -72,7 +73,7 @@ @empty - diff --git a/resources/views/livewire/sticker-validation.blade.php b/resources/views/livewire/sticker-validation.blade.php index e54fd64..887a09a 100644 --- a/resources/views/livewire/sticker-validation.blade.php +++ b/resources/views/livewire/sticker-validation.blade.php @@ -12,7 +12,7 @@ - + {{-- --}} @@ -24,7 +24,7 @@ @forelse($records as $index => $record) - + {{-- --}} @@ -32,7 +32,7 @@ @empty - + @endforelse diff --git a/routes/api.php b/routes/api.php index 2250049..e53ad49 100644 --- a/routes/api.php +++ b/routes/api.php @@ -192,42 +192,4 @@ Route::post('file/store', [SapFileController::class, 'store'])->name('file.store Route::post('/print-pdf', [PrintController::class, 'print']); - - Route::post('/push/subscribe', function (Request $request) { - - $user = Filament::auth()->user(); - abort_if(!$user, 401); - - $request->validate([ - 'endpoint' => 'required|string', - 'keys.p256dh' => 'required|string', - 'keys.auth' => 'required|string', - ]); - - // WebPushSubscription::updateOrCreate( - // ['endpoint' => $request->endpoint], - // [ - // 'subscribable_type' => get_class($user), - // 'subscribable_id' => $user->id, - // 'public_key' => $request->keys['p256dh'], - // 'auth_token' => $request->keys['auth'], - // 'content_encoding' => $request->contentEncoding ?? 'aesgcm', - // ] - // ); - - WebPushSubscription::updateOrCreate( - [ - 'endpoint' => $request->endpoint, - 'subscribable_type' => get_class($user), - 'subscribable_id' => $user->id, - ], - [ - 'public_key' => $request->keys['p256dh'], - 'auth_token' => $request->keys['auth'], - 'content_encoding' => $request->contentEncoding ?? 'aesgcm', - ] - ); - - - return response()->json(['success' => true]); -}); +Route::get('/sticker/preview/{serial}', [PrintController::class, 'preview']); diff --git a/routes/console.php b/routes/console.php index 3353679..9fea2c9 100644 --- a/routes/console.php +++ b/routes/console.php @@ -12,7 +12,7 @@ Artisan::command('inspire', function () { Artisan::command('auto:scheduler', function () { $this->call('custom:scheduler'); -})->everyMinute(); +})->everyMinute()->withoutOverlapping(); // Schedule::command('send:invoice-report'); diff --git a/vite.config.js b/vite.config.js index f27c2aa..89caa55 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,12 +1,32 @@ import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; +import react from '@vitejs/plugin-react' export default defineConfig({ plugins: [ laravel({ - input: ['resources/css/app.css', 'resources/js/app.js', 'resources/js/filament-chart-js-plugins.js', 'resources/css/filament/admin/theme.css',], + input: ['resources/css/app.css', 'resources/js/app.js', 'resources/js/filament-chart-js-plugins.js', 'resources/css/filament/admin/theme.css'], // input: ['resources/css/app.css', 'resources/js/app.js',], refresh: true, }), ], }); + +// export default defineConfig({ +// server: { +// host: '127.0.0.1', +// port: 5173, +// }, +// plugins: [ +// laravel({ +// input: [ +// 'resources/css/app.css', +// 'resources/js/app.jsx', +// 'resources/js/filament-chart-js-plugins.js', +// 'resources/css/filament/admin/theme.css', +// ], +// refresh: true, +// }), +// react(), +// ], +// })
NoCreated DatetimeCreated ByPlantLineItem CodeProduction Plan Dates
NoLine Item Code + Production Plan Dates
+ {{-- + {{ $date }} + {{ $date }}
Line Capacity Target PlanProduced Quantity + Produced Quantity + Produced Quantity
- --{{ $record['daily_target'] ?? '-' }} + {{ $record['daily_line_capacity'][$date] ?? '-' }} + {{ $record['daily_target_dynamic'][$date] ?? '-' }}
+ No production plan data found.
NoSticker IDSticker IDProduction Order Serial Number Status
{{ $index + 1 }}{{ $record->sticker_id }}{{ $record->sticker_id }}{{ $refNumber }} {{ $record['serial_number'] }} {{ $record->status }}
No serial numbers found.No serial numbers found.