Changed logic in production quantity page for last scanned qr
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

This commit is contained in:
dhanabalan
2026-02-16 13:00:55 +05:30
parent 9602be624d
commit f5173d9861
2 changed files with 35 additions and 7 deletions

View File

@@ -42,6 +42,8 @@ class ProductionQuantityPage extends Page implements HasForms
public $qrData, $pId, $bId, $sId, $lId, $iId, $succId, $sNoId, $succStat, $recQr, $prodOrder, $workCenter, $mId;
public $recent_qr;
// public $recent_qr, $clear_qr;
@@ -336,6 +338,33 @@ class ProductionQuantityPage extends Page implements HasForms
Hidden::make('sap_msg_status'),
Hidden::make('sap_msg_description'),
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
// }
// // 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;
// // Combine 'code' and 'serial_number' into the desired format
// // return $itemCode && $serialNumber ? "{$itemCode} | {$serialNumber}" : null;
// $this->recQr = $itemCode && $serialNumber ? "{$itemCode} | {$serialNumber}" : null;
// })
->default(fn () => $this->recQr)
->readOnly(true),
TextInput::make('id')
->hidden()
@@ -344,7 +373,7 @@ class ProductionQuantityPage extends Page implements HasForms
->default(Filament::auth()->user()->name),
])
// ->columns(6);
->columns(['default' => 1, 'sm' => 7]);
->columns(['default' => 1, 'sm' => 8]);
}
public function processMachine($value){
@@ -1353,13 +1382,13 @@ class ProductionQuantityPage extends Page implements HasForms
$this->iId = null;
// Get line + block in one shot
$line = Line::with('block')->find($lineId);
$lineName = $line?->name;
$blockName = $line?->block?->name;
$shiftName = $shift?->name;
$this->recent_qr = $itemCode.' | '.$this->sNoId;
// after success insertion
$this->form->fill([
@@ -1369,14 +1398,13 @@ class ProductionQuantityPage extends Page implements HasForms
'shift_id'=> $shiftName,
'line_id'=> $lineName,
'item_id'=> null,
//'item_code'=> 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,
'recent_qr' => $this->recent_qr,
]);
Notification::make()

View File

@@ -45,7 +45,7 @@
</div> --}}
<div class="flex gap-6 -mt-6">
<!-- Scan QR Code -->
<div class="w-1/2">
<div class="w-full">
<label for="qr-scan-input" class="block text-sm font-medium text-gray-700 mb-2">
SCAN QR CODE
</label>
@@ -60,7 +60,7 @@
</div>
<!-- Last Scanned QR -->
<div class="w-1/2">
{{-- <div class="w-1/2">
<label for="recent-qr-input" class="block text-sm font-medium text-gray-700 mb-2">
LAST SCANNED QR
</label>
@@ -71,7 +71,7 @@
readonly
wire:model="recent_qr"
/>
</div>
</div> --}}
</div>