Compare commits

...

2 Commits

Author SHA1 Message Date
c17dc86d48 Merge pull request 'Changed logic in production quantity page for last scanned qr' (#183) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #183
2026-02-16 07:31:07 +00:00
dhanabalan
f5173d9861 Changed logic in production quantity page for last scanned qr
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-16 13:00:55 +05:30
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 $qrData, $pId, $bId, $sId, $lId, $iId, $succId, $sNoId, $succStat, $recQr, $prodOrder, $workCenter, $mId;
public $recent_qr;
// public $recent_qr, $clear_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_status'),
Hidden::make('sap_msg_description'), 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') TextInput::make('id')
->hidden() ->hidden()
@@ -344,7 +373,7 @@ class ProductionQuantityPage extends Page implements HasForms
->default(Filament::auth()->user()->name), ->default(Filament::auth()->user()->name),
]) ])
// ->columns(6); // ->columns(6);
->columns(['default' => 1, 'sm' => 7]); ->columns(['default' => 1, 'sm' => 8]);
} }
public function processMachine($value){ public function processMachine($value){
@@ -1353,13 +1382,13 @@ class ProductionQuantityPage extends Page implements HasForms
$this->iId = null; $this->iId = null;
// Get line + block in one shot
$line = Line::with('block')->find($lineId); $line = Line::with('block')->find($lineId);
$lineName = $line?->name; $lineName = $line?->name;
$blockName = $line?->block?->name; $blockName = $line?->block?->name;
$shiftName = $shift?->name; $shiftName = $shift?->name;
$this->recent_qr = $itemCode.' | '.$this->sNoId;
// after success insertion // after success insertion
$this->form->fill([ $this->form->fill([
@@ -1369,14 +1398,13 @@ class ProductionQuantityPage extends Page implements HasForms
'shift_id'=> $shiftName, 'shift_id'=> $shiftName,
'line_id'=> $lineName, 'line_id'=> $lineName,
'item_id'=> null, 'item_id'=> null,
//'item_code'=> null,
'serial_number'=> null, 'serial_number'=> null,
'success_msg'=> null, 'success_msg'=> null,
'production_order'=> $this->prodOrder, 'production_order'=> $this->prodOrder,
'sap_msg_status' => null, 'sap_msg_status' => null,
'sap_msg_description' => null, 'sap_msg_description' => null,
'operator_id'=> $operatorName, 'operator_id'=> $operatorName,
'recent_qr' => $itemCode.' | '.$this->sNoId, 'recent_qr' => $this->recent_qr,
]); ]);
Notification::make() Notification::make()

View File

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