Added item id select box in wire master packing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 1m50s
Laravel Larastan / larastan (pull_request) Failing after 3m14s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 1m50s
Laravel Larastan / larastan (pull_request) Failing after 3m14s
This commit is contained in:
@@ -65,30 +65,50 @@ class WireMasterPackingResource extends Resource
|
||||
return [];
|
||||
}
|
||||
|
||||
return CustomerPoMaster::where('plant_id', $plantId)->pluck('customer_po', 'id');
|
||||
// return CustomerPoMaster::where('plant_id', $plantId)->pluck('customer_po', 'id');
|
||||
return CustomerPoMaster::where('plant_id', $plantId)->distinct()->pluck('customer_po', 'customer_po');
|
||||
|
||||
})
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
if (!$state) {
|
||||
$set('item', null);
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$customerPo = CustomerPoMaster::find($state);
|
||||
$set('item_id', null);
|
||||
$set('wire_packing_number', null);
|
||||
|
||||
if ($customerPo && $customerPo->item_id) {
|
||||
$item = Item::find($customerPo->item_id);
|
||||
// $customerPo = CustomerPoMaster::find($state);
|
||||
|
||||
$set('item', $item?->code);
|
||||
} else {
|
||||
$set('item', null);
|
||||
}
|
||||
// if ($customerPo && $customerPo->item_id) {
|
||||
// $item = Item::find($customerPo->item_id);
|
||||
|
||||
// $set('item', $item?->code);
|
||||
// } else {
|
||||
// $set('item', null);
|
||||
// }
|
||||
}),
|
||||
Forms\Components\TextInput::make('item')
|
||||
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item Code')
|
||||
->reactive()
|
||||
->readOnly()
|
||||
->dehydrated(false),
|
||||
->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')
|
||||
->label('Scan Wire Packing No')
|
||||
->reactive()
|
||||
|
||||
Reference in New Issue
Block a user