Merge pull request 'ranjith-dev' (#805) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 47s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 47s
Reviewed-on: #805
This commit was merged in pull request #805.
This commit is contained in:
@@ -71,44 +71,8 @@ class WireMasterPackingResource extends Resource
|
|||||||
})
|
})
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function ($state, callable $set) {
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
if (!$state) {
|
|
||||||
$set('item_id', null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$set('item_id', null);
|
|
||||||
$set('wire_packing_number', null);
|
$set('wire_packing_number', null);
|
||||||
|
|
||||||
// $customerPo = CustomerPoMaster::find($state);
|
|
||||||
|
|
||||||
// if ($customerPo && $customerPo->item_id) {
|
|
||||||
// $item = Item::find($customerPo->item_id);
|
|
||||||
|
|
||||||
// $set('item', $item?->code);
|
|
||||||
// } else {
|
|
||||||
// $set('item', null);
|
|
||||||
// }
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Forms\Components\Select::make('item_id')
|
|
||||||
->label('Item Code')
|
|
||||||
->reactive()
|
|
||||||
->searchable()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
|
|
||||||
$customerPoId = $get('customer_po_master_id');
|
|
||||||
|
|
||||||
if (!$customerPoId) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Item::whereIn(
|
|
||||||
'id',
|
|
||||||
CustomerPoMaster::where('customer_po', $customerPoId)
|
|
||||||
->pluck('item_id')
|
|
||||||
)->pluck('code', 'id');
|
|
||||||
})
|
|
||||||
->required(),
|
|
||||||
Forms\Components\TextInput::make('wire_packing_number')
|
Forms\Components\TextInput::make('wire_packing_number')
|
||||||
->label('Scan Wire Packing No')
|
->label('Scan Wire Packing No')
|
||||||
->reactive()
|
->reactive()
|
||||||
|
|||||||
@@ -54,8 +54,6 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
|
|
||||||
$customerPo = trim($this->form->getState()['customer_po_master_id'])?? null;
|
$customerPo = trim($this->form->getState()['customer_po_master_id'])?? null;
|
||||||
|
|
||||||
$selectedItem = trim($this->form->getState()['item_id'])?? null;
|
|
||||||
|
|
||||||
$wirePackNo = trim($this->form->getState()['wire_packing_number'])?? null;
|
$wirePackNo = trim($this->form->getState()['wire_packing_number'])?? null;
|
||||||
|
|
||||||
$wirePackNo = trim($wirePackNo) ?? null;
|
$wirePackNo = trim($wirePackNo) ?? null;
|
||||||
@@ -166,30 +164,6 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$itemId = Item::where('code', $materialCode)
|
|
||||||
->where('plant_id', $plantId)
|
|
||||||
->value('id');
|
|
||||||
|
|
||||||
if($itemId != $selectedItem){
|
|
||||||
Notification::make()
|
|
||||||
->title("Item Code Mismatch")
|
|
||||||
->body("Scanned Item Code '$materialCode' does not match the selected Item in the form.")
|
|
||||||
->danger()
|
|
||||||
->duration(5000)
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->form->fill([
|
|
||||||
'process_order' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'customer_po_master_id' => $customerPo,
|
|
||||||
'wire_packing_number' => $wirePackNo,
|
|
||||||
'Sno_quantity' => 0,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
'scanned_by' => $operatorName,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$icodeAgaCPoPlant = CustomerPoMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
|
$icodeAgaCPoPlant = CustomerPoMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
if(!$icodeAgaCPoPlant)
|
if(!$icodeAgaCPoPlant)
|
||||||
@@ -282,7 +256,7 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
{
|
{
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Scanned Weight Exceeds PO Quantity")
|
->title("Scanned Weight Exceeds PO Quantity")
|
||||||
->body("Scanned weight '$weight' and already scanned weight '$alreadyScannedQty' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPoRecord->name' and Item '$materialCode'")
|
->body("Scanned weight '$weight' and already scanned weight '$alreadyScannedQty' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPoRecord->customer_po' and Item '$materialCode'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
->send();
|
->send();
|
||||||
|
|||||||
Reference in New Issue
Block a user