Updated quality validaiton report filter functionality
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m34s
Laravel Larastan / larastan (pull_request) Failing after 3m53s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m34s
Laravel Larastan / larastan (pull_request) Failing after 3m53s
This commit is contained in:
@@ -34,6 +34,8 @@ class QualityValidationExporter extends Exporter
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('stickerMaster.item.description')
|
||||
->label('ITEM DESCRIPTION'),
|
||||
ExportColumn::make('uom')
|
||||
->label('UNIT OF MEASURE'),
|
||||
ExportColumn::make('serial_number_motor')
|
||||
|
||||
@@ -51,6 +51,7 @@ class QualityValidationResource extends Resource
|
||||
->statePath('data')
|
||||
->schema(components: [
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant Name')
|
||||
->relationship('plant', 'name')
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
@@ -94,6 +95,7 @@ class QualityValidationResource extends Resource
|
||||
->default(fn () => session('last_selected_plant_id')),
|
||||
|
||||
Forms\Components\Select::make('line_id')
|
||||
->label('Line Name')
|
||||
->relationship('line', titleAttribute: 'name')
|
||||
->reactive()
|
||||
->required()
|
||||
@@ -104,7 +106,6 @@ class QualityValidationResource extends Resource
|
||||
}
|
||||
|
||||
return Line::where('plant_id', $plantId)
|
||||
->where('type', 'FG Line') // Filter by type
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
})
|
||||
@@ -130,7 +131,7 @@ class QualityValidationResource extends Resource
|
||||
Forms\Components\Hidden::make('line')
|
||||
->default(fn () => session('last_selected_line')),
|
||||
Forms\Components\Hidden::make('sticker_master_id')
|
||||
// ->relationship('stickerMaster', 'id')
|
||||
// ->relationship('stickerMaster', 'id')
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('uom')
|
||||
->required(),
|
||||
@@ -2347,6 +2348,7 @@ class QualityValidationResource extends Resource
|
||||
->hintColor('danger'),
|
||||
|
||||
Forms\Components\TextInput::make('part_validation1')
|
||||
->label('Part Validation 1')
|
||||
->hidden(fn (callable $get) => ! $get('part_validation1_visible'))
|
||||
->default('')
|
||||
->reactive()
|
||||
@@ -2444,6 +2446,7 @@ class QualityValidationResource extends Resource
|
||||
->reactive(),
|
||||
|
||||
Forms\Components\TextInput::make('part_validation2')
|
||||
->label('Part Validation 2')
|
||||
->hidden(fn (callable $get) => ! $get('part_validation2_visible'))
|
||||
->default('')
|
||||
->required()
|
||||
@@ -2538,6 +2541,7 @@ class QualityValidationResource extends Resource
|
||||
->reactive(),
|
||||
|
||||
Forms\Components\TextInput::make('part_validation3')
|
||||
->label('Part Validation 3')
|
||||
->hidden(fn (callable $get) => ! $get('part_validation3_visible'))
|
||||
->default('')
|
||||
->required()
|
||||
@@ -2631,6 +2635,7 @@ class QualityValidationResource extends Resource
|
||||
->reactive(),
|
||||
|
||||
Forms\Components\TextInput::make('part_validation4')
|
||||
->label('Part Validation 4')
|
||||
->hidden(fn (callable $get) => ! $get('part_validation4_visible'))
|
||||
->default('')
|
||||
->required()
|
||||
@@ -2715,6 +2720,7 @@ class QualityValidationResource extends Resource
|
||||
->reactive(),
|
||||
|
||||
Forms\Components\TextInput::make('part_validation5')
|
||||
->label('Part Validation 5')
|
||||
->hidden(fn (callable $get) => ! $get('part_validation5_visible'))
|
||||
->default('')
|
||||
->required()
|
||||
@@ -2873,11 +2879,11 @@ class QualityValidationResource extends Resource
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->label('Plant Name')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('line.name')
|
||||
->label('Line')
|
||||
->label('Line Name')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
@@ -2893,6 +2899,10 @@ class QualityValidationResource extends Resource
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stickerMaster.item.description')
|
||||
->label('Item Description')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('uom')
|
||||
->label('Unit of Measure')
|
||||
->alignCenter()
|
||||
@@ -2992,6 +3002,11 @@ class QualityValidationResource extends Resource
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
@@ -3007,17 +3022,22 @@ class QualityValidationResource extends Resource
|
||||
->label('Advanced Filters')
|
||||
->form([
|
||||
Select::make('Plant')
|
||||
->label('Select Plant')
|
||||
->label('Search by Plant Name')
|
||||
->nullable()
|
||||
// ->options(function () {
|
||||
// return Plant::pluck('name', 'id');
|
||||
// })
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||
} else {
|
||||
return Plant::whereHas('qualityValidations', function ($query) {
|
||||
$query->whereNotNull('id');
|
||||
})->orderBy('code')->pluck('name', 'id');
|
||||
}
|
||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('sticker_master_id', null);
|
||||
$set('sap_msg_status', null);
|
||||
@@ -3025,20 +3045,23 @@ class QualityValidationResource extends Resource
|
||||
$set('operator_id', null);
|
||||
}),
|
||||
Select::make('Line')
|
||||
->label('Select Line')
|
||||
->label('Search by Line Name')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Line::where('plant_id', $plantId)
|
||||
->where('type', 'FG Line') // Filter by type
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
return Line::whereHas('qualityValidations', function ($query) use ($plantId) {
|
||||
if ($plantId) {
|
||||
$query->where('plant_id', $plantId);
|
||||
}
|
||||
})->pluck('name', 'id');
|
||||
// return Line::where('plant_id', $plantId)->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('sticker_master_id', null);
|
||||
$set('sap_msg_status', null);
|
||||
@@ -3053,6 +3076,8 @@ class QualityValidationResource extends Resource
|
||||
Select::make('sticker_master_id')
|
||||
->label('Search by Item Code')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$pId = $get('Plant');
|
||||
|
||||
@@ -3062,12 +3087,12 @@ class QualityValidationResource extends Resource
|
||||
}
|
||||
$query->whereHas('qualityValidations');
|
||||
})->pluck('code', 'id');
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
}),
|
||||
Select::make('sap_msg_status')
|
||||
->label('Select SAP Message Status')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
|
||||
@@ -3076,12 +3101,13 @@ class QualityValidationResource extends Resource
|
||||
} else {
|
||||
return QualityValidation::where('plant_id', $plantId)->whereNotNull('sap_msg_status')->select('sap_msg_status')->distinct()->pluck('sap_msg_status', 'sap_msg_status');
|
||||
}
|
||||
})
|
||||
// ->options(QualityValidation::whereNotNull('sap_msg_status')->select('sap_msg_status')->distinct()->pluck('sap_msg_status', 'sap_msg_status'))
|
||||
->reactive(),
|
||||
}),
|
||||
// ->options(QualityValidation::whereNotNull('sap_msg_status')->select('sap_msg_status')->distinct()->pluck('sap_msg_status', 'sap_msg_status'))
|
||||
Select::make('operator_id')
|
||||
->label('Created By')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
$lineId = $get('Line');
|
||||
@@ -3092,9 +3118,7 @@ class QualityValidationResource extends Resource
|
||||
} else { // if ($plantId && $lineId)
|
||||
return QualityValidation::where('plant_id', $plantId)->where('line_id', $lineId)->whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
}),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
@@ -3127,11 +3151,11 @@ class QualityValidationResource extends Resource
|
||||
}
|
||||
|
||||
if (! empty($data['production_order'])) {
|
||||
$query->where('production_order', $data['production_order']);
|
||||
$query->where('production_order', 'like', '%'.$data['production_order'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['serial_number'])) {
|
||||
$query->where('serial_number', $data['serial_number']);
|
||||
$query->where('serial_number', 'like', '%'.$data['serial_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['sap_msg_status'])) {
|
||||
@@ -3166,7 +3190,7 @@ class QualityValidationResource extends Resource
|
||||
$indicators = [];
|
||||
|
||||
if (! empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
|
||||
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
@@ -3176,7 +3200,7 @@ class QualityValidationResource extends Resource
|
||||
}
|
||||
|
||||
if (! empty($data['Line'])) {
|
||||
$indicators[] = 'Line: '.Line::where('id', $data['Line'])->value('name');
|
||||
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
|
||||
}
|
||||
|
||||
if (! empty($data['production_order'])) {
|
||||
@@ -3189,7 +3213,7 @@ class QualityValidationResource extends Resource
|
||||
|
||||
if (! empty($data['sticker_master_id'])) {
|
||||
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
||||
$indicators[] = 'Item Codes: '.$itemCode;
|
||||
$indicators[] = 'Item Code: '.$itemCode;
|
||||
}
|
||||
|
||||
if (! empty($data['sap_msg_status'])) {
|
||||
|
||||
@@ -41,6 +41,11 @@ class Line extends Model
|
||||
return $this->belongsTo(Block::class);
|
||||
}
|
||||
|
||||
public function qualityValidations()
|
||||
{
|
||||
return $this->hasMany(QualityValidation::class);
|
||||
}
|
||||
|
||||
public function testingPanelReadings()
|
||||
{
|
||||
return $this->hasMany(TestingPanelReading::class);
|
||||
|
||||
@@ -50,12 +50,12 @@ class Plant extends Model
|
||||
|
||||
public function invoiceValidations()
|
||||
{
|
||||
return $this->hasMany(InvoiceValidation::class, 'sticker_master_id');
|
||||
return $this->hasMany(InvoiceValidation::class, 'plant_id');
|
||||
}
|
||||
|
||||
public function qualityValidations()
|
||||
{
|
||||
return $this->hasMany(QualityValidation::class, 'sticker_master_id');
|
||||
return $this->hasMany(QualityValidation::class, 'plant_id');
|
||||
}
|
||||
|
||||
public function testingPanelReadings()
|
||||
|
||||
Reference in New Issue
Block a user