Added gernr column on resource file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
This commit is contained in:
@@ -95,6 +95,7 @@ class RequestCharacteristicResource extends Resource
|
||||
$set('machine_id', null);
|
||||
$set('item_id', null);
|
||||
$set('aufnr', null);
|
||||
$set('gernr', null);
|
||||
$set('machine_name', null);
|
||||
$set('characteristic_approver_master_id', null);
|
||||
$set('approver_type', null);
|
||||
@@ -126,6 +127,7 @@ class RequestCharacteristicResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_id', null);
|
||||
$set('aufnr', null);
|
||||
$set('gernr', null);
|
||||
$set('machine_name', null);
|
||||
$set('characteristic_approver_master_id', null);
|
||||
$set('approver_type', null);
|
||||
@@ -213,6 +215,7 @@ class RequestCharacteristicResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
if (! $state) {
|
||||
$set('aufnr', null);
|
||||
$set('gernr', null);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
@@ -237,6 +240,9 @@ class RequestCharacteristicResource extends Resource
|
||||
return false;
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
if (! $state) {
|
||||
$set('gernr', null);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->default(function () {
|
||||
@@ -246,6 +252,32 @@ class RequestCharacteristicResource extends Resource
|
||||
})
|
||||
->readOnly(fn ($get) => ($get('item_id') == null))
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\TextInput::make('gernr')
|
||||
->label('Serial Number')
|
||||
->reactive()
|
||||
->minLength(13)
|
||||
->readOnly(fn (callable $get) => (! $get('aufnr')))
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
// ->rules([
|
||||
// function (callable $get) {
|
||||
// return Rule::unique('class_characteristics', 'gernr')
|
||||
// ->where('plant_id', $get('plant_id'))
|
||||
// ->ignore($get('id'));
|
||||
// },
|
||||
// ])
|
||||
// ->validationMessages([
|
||||
// 'unique' => "The 'GERNR' has already been taken.", // The GERNR has already been taken for this plant.
|
||||
// ])
|
||||
->required(function (callable $get) {
|
||||
$appTyp = $get('approver_type');
|
||||
if ($appTyp == 'Stop') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}),
|
||||
Forms\Components\Select::make('machine_name')
|
||||
->label('Machine Name')
|
||||
->reactive()
|
||||
@@ -333,6 +365,9 @@ class RequestCharacteristicResource extends Resource
|
||||
$set('current_value', null);
|
||||
$set('update_value', null);
|
||||
}
|
||||
if ($appTyp != 'Stop') {
|
||||
$set('gernr', null);
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->default(function () {
|
||||
@@ -443,8 +478,9 @@ class RequestCharacteristicResource extends Resource
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$jobNo = $get('aufnr');
|
||||
$sNo = $get('gernr');
|
||||
$updId = $get('id');
|
||||
$pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('characteristic_name', $value)->latest()->first();
|
||||
$pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('gernr', $sNo)->where('characteristic_name', $value)->latest()->first();
|
||||
|
||||
if ($pendingExists) {
|
||||
if ($updId && $pendingExists->id == $updId) {
|
||||
@@ -966,6 +1002,11 @@ class RequestCharacteristicResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('gernr')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('characteristicApproverMaster.machine_name')
|
||||
->label('Machine Name')
|
||||
->alignCenter()
|
||||
@@ -1236,8 +1277,11 @@ class RequestCharacteristicResource extends Resource
|
||||
->label('Job Number')
|
||||
->placeholder('Enter Job Number')
|
||||
->numeric()
|
||||
->minlength(7)
|
||||
->maxlength(10),
|
||||
TextInput::make('gernr')
|
||||
->label('Serial Number')
|
||||
->placeholder('Enter Serial Number')
|
||||
->numeric(),
|
||||
TextInput::make('work_flow_id')
|
||||
->label('Work Flow ID')
|
||||
->placeholder('Enter Work Flow ID'),
|
||||
@@ -1313,7 +1357,7 @@ class RequestCharacteristicResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['model_type']) && empty($data['work_flow_id']) && empty($data['machine_name']) && empty($data['request_type']) && empty($data['master_characteristic_field']) && empty($data['approver_status1']) && empty($data['approver_status2']) && empty($data['approver_status3']) && empty($data['approver_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['gernr']) && empty($data['model_type']) && empty($data['work_flow_id']) && empty($data['machine_name']) && empty($data['request_type']) && empty($data['master_characteristic_field']) && empty($data['approver_status1']) && empty($data['approver_status2']) && empty($data['approver_status3']) && empty($data['approver_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -1339,6 +1383,10 @@ class RequestCharacteristicResource extends Resource
|
||||
$query->where('aufnr', 'like', '%'.$data['aufnr'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['gernr'])) {
|
||||
$query->where('gernr', 'like', '%'.$data['gernr'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['model_type'])) {
|
||||
$query->where('model_type', 'like', '%'.$data['model_type'].'%');
|
||||
}
|
||||
@@ -1436,6 +1484,10 @@ class RequestCharacteristicResource extends Resource
|
||||
$indicators[] = 'Job No: '.$data['aufnr'];
|
||||
}
|
||||
|
||||
if (! empty($data['gernr'])) {
|
||||
$indicators[] = 'Serial No: '.$data['gernr'];
|
||||
}
|
||||
|
||||
if (! empty($data['model_type'])) {
|
||||
$indicators[] = 'Model Type: '.$data['model_type'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user