diff --git a/app/Filament/Resources/InvoiceValidationResource.php b/app/Filament/Resources/InvoiceValidationResource.php index 01cbaed..f83da66 100644 --- a/app/Filament/Resources/InvoiceValidationResource.php +++ b/app/Filament/Resources/InvoiceValidationResource.php @@ -136,23 +136,23 @@ class InvoiceValidationResource extends Resource ->reactive() ->readOnly(fn (callable $get) => empty($get('invoice_number'))) ->disabled(fn (Get $get) => empty($get('invoice_number'))) - ->extraAttributes([ - 'id' => 'serial_number_input', - 'x-data' => '{ value: "" }', - 'x-model' => 'value', - 'wire:keydown.enter.prevent' => 'processSerial(value)', // Using wire:keydown - ]) - // ->dehydrated(false) // Do not trigger Livewire syncing // ->extraAttributes([ // 'id' => 'serial_number_input', - // 'x-on:keydown.enter.prevent' => " - // let serial = \$event.target.value; - // if (serial.trim() != '') { - // \$wire.dispatch('process-scan', serial); - // \$event.target.value = ''; - // } - // ", + // 'x-data' => '{ value: "" }', + // 'x-model' => 'value', + // 'wire:keydown.enter.prevent' => 'processSerial(value)', // Using wire:keydown // ]) + ->dehydrated(false) // Do not trigger Livewire syncing + ->extraAttributes([ + 'id' => 'serial_number_input', + 'x-on:keydown.enter.prevent' => " + let serial = \$event.target.value; + if (serial.trim() != '') { + \$wire.dispatch('process-scan', serial); + \$event.target.value = ''; + } + ", + ]) ->afterStateUpdated(function ($state, callable $set, callable $get, callable $livewire) { $set('update_invoice', 0); // $this->dispatch('focus-serial-number'); diff --git a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php index c2fbeb6..eed5b2f 100644 --- a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php +++ b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php @@ -2261,7 +2261,7 @@ class CreateInvoiceValidation extends CreateRecord ]; } - public function processSerial($serNo) + public function processSer($serNo) { $serNo = trim($serNo); $mSerNo = $serNo; @@ -3765,11 +3765,11 @@ class CreateInvoiceValidation extends CreateRecord } } - // #[On('process-scan')] - // public function processSerial($serial) - // { - // $this->processSer($serial); // Your duplicate check + mail logic - // } + #[On('process-scan')] + public function processSerial($serial) + { + $this->processSer($serial); + } public function getHeading(): string {