forget(['select_plant', 'select_line']); session()->forget(['selected_plant', 'selected_line']); $this->filtersForm->fill([ 'plant' => null, 'line' => null, ]); } public function boot(): void { Filament::registerRenderHook( 'panels::body.start', function () { // Check if the current route matches '/admin/production-quantity' if (Request::is('admin/sticker-reprint*')) { echo << /* Hide sidebar and topbar */ .fi-sidebar, .fi-topbar { display: none !important; } /* Expand main container to full screen */ .fi-main { margin: 0 !important; padding: 0 !important; max-width: 100% !important; /* overflow-y: auto; Allow vertical scrolling */ height: 100vh; } /* Expand page area fully */ .fi-main > .fi-page { padding: 0 !important; max-width: 100% !important; } /* Expand main container to full screen but add margin */ /* .fi-main { margin: 0.5rem -0.5rem !important; Top/Bottom: 0.5rem, Left/Right: 0.2rem padding: 0rem !important; max-width: calc(100% - 0.1rem) !important; /* Matches horizontal margin height: calc(100vh - 1rem); Matches vertical margin box-sizing: border-box; }*/ /* Expand page area fully within the main container */ /* .fi-main > .fi-page { padding: 0.2rem !important; max-width: calc(100% - 0.1rem) !important; box-sizing: border-box; } */ /* Allow scroll on body again */ body { overflow: auto; } HTML; } } ); } public function form(Form $form): Form { return $form ->statePath('filters') ->schema([ Select::make('plant_id') // ->options(Plant::pluck('name', 'id')) ->label('Plant') ->options(function (callable $get) { $userHas = Filament::auth()->user()->plant_id; return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray(); }) ->required() ->reactive() ->columnSpan(1) ->default(function () { return optional(ProductionQuantity::latest()->first())->plant_id; }) ->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) { $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 { $this->pId = $plantId; $set('validationError', null); $set('pqPlantError', null); } $this->triggerChartUpdate(); }) ->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : 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) => [ 'wire:keydown.enter' => 'processMachine($event.target.value)', ]), TextInput::make('line_id') ->label('Line') ->reactive() ->readOnly() ->required() ->afterStateUpdated(fn ($state) => $this->lNam = $state), TextInput::make('block_name') ->label('Block') ->reactive() ->readOnly() ->required() ->afterStateUpdated(fn ($state) => $this->bNam = $state), TextInput::make('shift_id') ->label('Shift') ->reactive() ->readOnly() ->required() ->afterStateUpdated(fn ($state) => $this->sNam = $state), TextInput::make('production_order') ->label('Production Order') ->reactive() ->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) => [ 'id' => 'production_order', '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') ->required(), Hidden::make('success_msg') ->required(), Hidden::make('item_id') ->required(), Hidden::make('sap_msg_status'), Hidden::make('sap_msg_description'), TextInput::make('id') ->hidden() ->readOnly(), Hidden::make('operator_id') ->default(Filament::auth()->user()->name), ]) // ->columns(6); ->columns(['default' => 1, 'sm' => 7]); } 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; } elseif (! $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; // 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->dispatch('focus-qr-input'); $this->triggerChartUpdate(); } } #[On('handleQrScan')] public function handleQrScan($value) { $this->processAllValues($value); } public function processAllValues($formQRData) { //dd($formQRData); //$formValues = []; // This will get all form data from the request //$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 } public function validateAndProcessForm($formQRData) { $user = Filament::auth()->user(); // ->name $operatorName = $user->name; $this->qrData = $formQRData; $latestProductionQuantity = ProductionQuantity::latest()->first(); if ($latestProductionQuantity) { $itemCode = optional(Item::find($latestProductionQuantity->item_id))->code; $serialNumber = $latestProductionQuantity->serial_number; $this->recQr = $itemCode && $serialNumber ? "{$itemCode} | {$serialNumber}" : null; } if (empty($formQRData)) { $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, ]); Notification::make() ->title('Invalid QR') ->body('Scan the valid QR code.
(Ex: Item_Code|Serial_Number )') ->danger() ->send(); return; } else { if (! $this->pId) { $this->form->fill([ '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, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Choose Plant') ->body('Please select a plant first.') ->danger() ->send(); return; } elseif (! $this->mNam) { $this->form->fill([ '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, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Unknown Machine') ->body("Machine can't be empty!") ->danger() ->send(); return; } elseif (! $this->lNam) { $this->form->fill([ '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 Line') ->body('Please select a line first.') ->danger() ->send(); return; } elseif (! $this->bNam) { $this->form->fill([ '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, '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; } else if ($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, 'sap_msg_status' => null, 'sap_msg_description' => null, 'operator_id'=> $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid Production Order') ->body("Must contain numeric values only.") ->danger() ->send(); return; } else if (!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, 'sap_msg_status' => null, 'sap_msg_description' => null, '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.") ->danger() ->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, // '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]{7,}(\/[A-Za-z0-9]*)?(\|)?$/', $formQRData)) { if (strpos($formQRData, '|') == false) { $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, ]); Notification::make() ->title('Invalid QR') ->body('Scan the valid QR code.
(Ex: Item_Code|Serial_Number )') ->danger() ->send(); return; } else { $splits = explode('|', $formQRData); $iCode = trim($splits[0]); $sNumberRaw = isset($splits[1]) ? trim($splits[1]) : null; if ($sNumberRaw !== null) { $sNumber = preg_replace('/\/.*/', '', $sNumberRaw); $sNumber = trim($sNumber); } else { $sNumber = null; } if (! ctype_alnum($iCode)) { $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, ]); Notification::make() ->title('Invalid Item Code') ->body('Item code must contain alpha-numeric values only.') ->danger() ->send(); return; } elseif (strlen($iCode) < 6) { $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, ]); Notification::make() ->title('Invalid Item Code') ->body('Item code must be at least 6 digits.') ->danger() ->send(); return; } else if (!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, 'sap_msg_status' => null, 'sap_msg_description' => null, 'operator_id'=> $operatorName, 'recent_qr' => $this->recQr, ]); Notification::make() ->title('Invalid Serial Number') ->body("Serial Number must contain alpha-numeric values only.") ->danger() ->duration(800) ->send(); return; } elseif (strlen($sNumber) < 9) { $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, ]); Notification::make() ->title('Invalid Serial Number') ->body('Serial Number must be at least 9 digits.') ->danger() ->duration(800) ->send(); return; } } $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, ]); Notification::make() ->title('Invalid QR') ->body('Scan the valid QR code.
(Ex: Item_Code|Serial_Number )') ->danger() ->send(); return; } else { $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, ]); } // Only search when all parent IDs are selected $parts = explode('|', $formQRData); $itemCode = trim($parts[0]); $serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null; if ($serialNumberRaw != null) { if (strpos($serialNumberRaw, '/') != false) { $serialNumber = strstr($serialNumberRaw, '/', true); // gets text before slash } else { $serialNumber = $serialNumberRaw; // keep original } $serialNumber = trim($serialNumber); } else { $serialNumber = null; } $masItem = Item::where('code', $itemCode)->first(); if (! $masItem) { $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, ]); Notification::make() ->title('Unknown Item Code') ->body('Item code does not exist in master data.') ->danger() ->send(); return; } $item = Item::where('code', $itemCode) ->where('plant_id', $this->pId) ->first(); if ($item) { $sNo = ProductionQuantity::where('serial_number', $serialNumber) ->where('plant_id', $this->pId) ->exists(); if (!$sNo) { $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' => $item->id, 'serial_number' => null, 'success_msg' => 'Y', 'production_order' => $this->prodOrder, 'sap_msg_status' => null, 'sap_msg_description' => null, 'operator_id' => $operatorName, 'recent_qr' => $this->recQr, ]); $this->succId = 'Y'; $this->iId = $item->id; } else { $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, ]); Notification::make() ->title('Duplicate Serial Number') ->body('Serial number already exist in database for choosed plant.') ->danger() ->send(); return; } } else { $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, ]); Notification::make() ->title('Unknown Item Code') ->body('Item code does not exist in master data for choosed plant.') ->danger() ->send(); return; } if ($this->succId == null) { $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, ]); Notification::make() ->title('Invalid QR Found') ->body('Please, scan the valid QR code.') ->danger() ->send(); return; } else { $parts = explode('|', $this->qrData); $itemCode = trim($parts[0]); $this->sNoId = isset($parts[1]) ? trim($parts[1]) : null; $originalQR = $this->qrData; if (strpos($originalQR, '/') != false) { // Allowed endings $allowed = ['/m', '/M', '/p', '/P', '/m|', '/M|', '/p|', '/P|']; $foundValidEnding = false; foreach ($allowed as $end) { if (str_ends_with($originalQR, $end)) { $foundValidEnding = true; break; } } if (!$foundValidEnding) { Notification::make() ->title('Invalid QR Code') ->body("Invalid QR format: '$originalQR'") ->danger() ->send(); return; } } if ($this->sNoId != null) { $this->sNoId = preg_replace('/\/.*/', '', $serialNumberRaw); $this->sNoId = trim($this->sNoId); } else { $this->sNoId = 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; //$this->qrData = preg_replace('/\/.*/', '', $this->qrData); ProductionQuantity::create([ 'plant_id'=> $this->pId, 'machine_id' => $this->mId, 'shift_id'=> $this->sId, 'line_id' => $this->lId, 'item_id'=> $this->iId, 'serial_number' => $this->sNoId, 'production_order'=> $this->prodOrder, 'operator_id'=> $operatorName, ]); $this->iId = null; $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' => $itemCode.' | '.$this->sNoId, ]); Notification::make() ->title("Valid QR Found") ->body("Valid QR code scanned: {$this->qrData}.") ->success() ->duration(1000) ->send(); $url = route('download-qr1-pdf', ['palletNo' => urlencode($originalQR)]); $this->js(<<serialNumber; // ProductionQuantity::create($formValues); $this->dispatch('productionUpdated'); // // 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')) { $this->dispatch('filtersUpdated'); } } // Override the getTitle method public function getTitle(): string { return ''; // Return an empty string to remove the title } public static function getNavigationLabel(): string { return 'Sticker Re-Print'; } public static function canAccess(): bool { return Auth::check() && Auth::user()->can('create production sticker reprint page'); } }