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
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
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user