solved filter of item code logic in panel box validations page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m55s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 23s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 53s
Laravel Pint / pint (pull_request) Successful in 3m40s
Laravel Larastan / larastan (pull_request) Failing after 4m57s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m55s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 23s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 53s
Laravel Pint / pint (pull_request) Successful in 3m40s
Laravel Larastan / larastan (pull_request) Failing after 4m57s
This commit is contained in:
@@ -1826,26 +1826,23 @@ class PanelBoxValidationResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('Item', null);
|
$set('Item', null);
|
||||||
}),
|
}),
|
||||||
Select::make('Item')
|
Select::make('sticker_master_id')
|
||||||
->label('Search by Item Code')
|
->label('Search by Item Code')
|
||||||
->nullable()
|
->nullable()
|
||||||
->searchable()
|
->searchable()
|
||||||
->reactive()
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$pId = $get('Plant');
|
||||||
|
|
||||||
if (empty($plantId)) {
|
// if (empty($pId)) {
|
||||||
return [];
|
// return [];
|
||||||
}
|
// }
|
||||||
|
return Item::whereHas('stickerMasters', function ($query) use ($pId) {
|
||||||
return Item::whereHas('productionCharacteristics', function ($query) use ($plantId) {
|
if ($pId) {
|
||||||
if ($plantId) {
|
$query->where('plant_id', $pId);
|
||||||
$query->where('plant_id', $plantId);
|
|
||||||
}
|
}
|
||||||
|
$query->whereHas('panelBoxValidations');
|
||||||
})->pluck('code', 'id');
|
})->pluck('code', 'id');
|
||||||
})
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
$set('production_order', null);
|
|
||||||
}),
|
}),
|
||||||
TextInput::make('production_order')
|
TextInput::make('production_order')
|
||||||
->label('Production Order / Doc No')
|
->label('Production Order / Doc No')
|
||||||
@@ -1893,8 +1890,14 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$query->where('line_id', $data['Line']);
|
$query->where('line_id', $data['Line']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['Item'])) {
|
if (! empty($data['sticker_master_id'])) {
|
||||||
$query->where('item_id', $data['Item']);
|
$stickerMasterIds = StickerMaster::where('item_id', $data['sticker_master_id'])
|
||||||
|
->pluck('id')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
if (! empty($stickerMasterIds)) {
|
||||||
|
$query->whereIn('sticker_master_id', $stickerMasterIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['production_order'])) {
|
if (! empty($data['production_order'])) {
|
||||||
@@ -1934,8 +1937,9 @@ class PanelBoxValidationResource extends Resource
|
|||||||
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
|
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['Item'])) {
|
if (! empty($data['sticker_master_id'])) {
|
||||||
$indicators[] = 'Item Code: '.Item::where('id', $data['Item'])->value('code');
|
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
||||||
|
$indicators[] = 'Item Code: '.$itemCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['production_order'])) {
|
if (! empty($data['production_order'])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user