Added characteristics type in product characteristics master filter #144
@@ -417,12 +417,12 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
// TextInput::make('coil_number')
|
||||
// ->label('Coil Number')
|
||||
// ->placeholder(placeholder: 'Enter Coil Number'),
|
||||
// Select::make('status')
|
||||
// ->label('Status')
|
||||
// ->options([
|
||||
// 'Ok' => 'OK',
|
||||
// 'NotOk' => 'Not Ok'
|
||||
// ]),
|
||||
Select::make('characteristics_type')
|
||||
->label('Characteristics Type')
|
||||
->options([
|
||||
'Product' => 'Product',
|
||||
'Process' => 'Process'
|
||||
]),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
@@ -436,7 +436,7 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['work_group_master']) && empty($data['Machine']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['work_group_master']) && empty($data['Machine']) && empty($data['characteristics_type']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -460,6 +460,10 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
$query->where('machine_id', $data['Machine']);
|
||||
}
|
||||
|
||||
if (!empty($data['characteristics_type'])) {
|
||||
$query->where('characteristics_type', $data['characteristics_type']);
|
||||
}
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
@@ -494,6 +498,10 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
$indicators[] = 'Machine: ' . Machine::where('id', $data['Machine'])->value('work_center');
|
||||
}
|
||||
|
||||
if (!empty($data['characteristics_type'])) {
|
||||
$indicators[] = 'Characteristics Type: ' . $data['characteristics_type'];
|
||||
}
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$indicators[] = 'From: ' . $data['created_from'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user