ranjith-dev #423
@@ -34,6 +34,8 @@ class QualityValidationExporter extends Exporter
|
|||||||
->label('SERIAL NUMBER'),
|
->label('SERIAL NUMBER'),
|
||||||
ExportColumn::make('stickerMaster.item.code')
|
ExportColumn::make('stickerMaster.item.code')
|
||||||
->label('ITEM CODE'),
|
->label('ITEM CODE'),
|
||||||
|
ExportColumn::make('stickerMaster.item.description')
|
||||||
|
->label('ITEM DESCRIPTION'),
|
||||||
ExportColumn::make('uom')
|
ExportColumn::make('uom')
|
||||||
->label('UNIT OF MEASURE'),
|
->label('UNIT OF MEASURE'),
|
||||||
ExportColumn::make('serial_number_motor')
|
ExportColumn::make('serial_number_motor')
|
||||||
|
|||||||
@@ -1198,17 +1198,23 @@ class InvoiceValidationResource extends Resource
|
|||||||
->inlineLabel(false)
|
->inlineLabel(false)
|
||||||
->inline(),
|
->inline(),
|
||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Search by Plant Name')
|
||||||
->nullable()
|
->nullable()
|
||||||
// ->options(function () {
|
->searchable()
|
||||||
// return Plant::pluck('name', 'id');
|
->reactive()
|
||||||
// })
|
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$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('invoiceValidations', 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): void {
|
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||||
$set('sticker_master_id', null);
|
$set('sticker_master_id', null);
|
||||||
$set('operator_id', null);
|
$set('operator_id', null);
|
||||||
@@ -1222,6 +1228,8 @@ class InvoiceValidationResource extends Resource
|
|||||||
Select::make('sticker_master_id')
|
Select::make('sticker_master_id')
|
||||||
->label('Search by Item Code')
|
->label('Search by Item Code')
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$pId = $get('Plant');
|
$pId = $get('Plant');
|
||||||
|
|
||||||
@@ -1234,9 +1242,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
$query->whereHas('invoiceValidations');
|
$query->whereHas('invoiceValidations');
|
||||||
})->pluck('code', 'id');
|
})->pluck('code', 'id');
|
||||||
})
|
}),
|
||||||
->searchable()
|
|
||||||
->reactive(),
|
|
||||||
Select::make('scanned_status')
|
Select::make('scanned_status')
|
||||||
->label('Scanned Status')
|
->label('Scanned Status')
|
||||||
->nullable()
|
->nullable()
|
||||||
@@ -1356,7 +1362,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
$indicators = [];
|
$indicators = [];
|
||||||
|
|
||||||
if (! empty($data['Plant'])) {
|
if (! empty($data['Plant'])) {
|
||||||
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
|
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
|
||||||
} else {
|
} else {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class QualityValidationResource extends Resource
|
|||||||
->statePath('data')
|
->statePath('data')
|
||||||
->schema(components: [
|
->schema(components: [
|
||||||
Forms\Components\Select::make('plant_id')
|
Forms\Components\Select::make('plant_id')
|
||||||
|
->label('Plant Name')
|
||||||
->relationship('plant', 'name')
|
->relationship('plant', 'name')
|
||||||
->reactive()
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
@@ -94,6 +95,7 @@ class QualityValidationResource extends Resource
|
|||||||
->default(fn () => session('last_selected_plant_id')),
|
->default(fn () => session('last_selected_plant_id')),
|
||||||
|
|
||||||
Forms\Components\Select::make('line_id')
|
Forms\Components\Select::make('line_id')
|
||||||
|
->label('Line Name')
|
||||||
->relationship('line', titleAttribute: 'name')
|
->relationship('line', titleAttribute: 'name')
|
||||||
->reactive()
|
->reactive()
|
||||||
->required()
|
->required()
|
||||||
@@ -104,7 +106,6 @@ class QualityValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Line::where('plant_id', $plantId)
|
return Line::where('plant_id', $plantId)
|
||||||
->where('type', 'FG Line') // Filter by type
|
|
||||||
->pluck('name', 'id')
|
->pluck('name', 'id')
|
||||||
->toArray();
|
->toArray();
|
||||||
})
|
})
|
||||||
@@ -130,7 +131,7 @@ class QualityValidationResource extends Resource
|
|||||||
Forms\Components\Hidden::make('line')
|
Forms\Components\Hidden::make('line')
|
||||||
->default(fn () => session('last_selected_line')),
|
->default(fn () => session('last_selected_line')),
|
||||||
Forms\Components\Hidden::make('sticker_master_id')
|
Forms\Components\Hidden::make('sticker_master_id')
|
||||||
// ->relationship('stickerMaster', 'id')
|
// ->relationship('stickerMaster', 'id')
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\Hidden::make('uom')
|
Forms\Components\Hidden::make('uom')
|
||||||
->required(),
|
->required(),
|
||||||
@@ -2347,6 +2348,7 @@ class QualityValidationResource extends Resource
|
|||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation1')
|
Forms\Components\TextInput::make('part_validation1')
|
||||||
|
->label('Part Validation 1')
|
||||||
->hidden(fn (callable $get) => ! $get('part_validation1_visible'))
|
->hidden(fn (callable $get) => ! $get('part_validation1_visible'))
|
||||||
->default('')
|
->default('')
|
||||||
->reactive()
|
->reactive()
|
||||||
@@ -2444,6 +2446,7 @@ class QualityValidationResource extends Resource
|
|||||||
->reactive(),
|
->reactive(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation2')
|
Forms\Components\TextInput::make('part_validation2')
|
||||||
|
->label('Part Validation 2')
|
||||||
->hidden(fn (callable $get) => ! $get('part_validation2_visible'))
|
->hidden(fn (callable $get) => ! $get('part_validation2_visible'))
|
||||||
->default('')
|
->default('')
|
||||||
->required()
|
->required()
|
||||||
@@ -2538,6 +2541,7 @@ class QualityValidationResource extends Resource
|
|||||||
->reactive(),
|
->reactive(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation3')
|
Forms\Components\TextInput::make('part_validation3')
|
||||||
|
->label('Part Validation 3')
|
||||||
->hidden(fn (callable $get) => ! $get('part_validation3_visible'))
|
->hidden(fn (callable $get) => ! $get('part_validation3_visible'))
|
||||||
->default('')
|
->default('')
|
||||||
->required()
|
->required()
|
||||||
@@ -2631,6 +2635,7 @@ class QualityValidationResource extends Resource
|
|||||||
->reactive(),
|
->reactive(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation4')
|
Forms\Components\TextInput::make('part_validation4')
|
||||||
|
->label('Part Validation 4')
|
||||||
->hidden(fn (callable $get) => ! $get('part_validation4_visible'))
|
->hidden(fn (callable $get) => ! $get('part_validation4_visible'))
|
||||||
->default('')
|
->default('')
|
||||||
->required()
|
->required()
|
||||||
@@ -2715,6 +2720,7 @@ class QualityValidationResource extends Resource
|
|||||||
->reactive(),
|
->reactive(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation5')
|
Forms\Components\TextInput::make('part_validation5')
|
||||||
|
->label('Part Validation 5')
|
||||||
->hidden(fn (callable $get) => ! $get('part_validation5_visible'))
|
->hidden(fn (callable $get) => ! $get('part_validation5_visible'))
|
||||||
->default('')
|
->default('')
|
||||||
->required()
|
->required()
|
||||||
@@ -2873,11 +2879,11 @@ class QualityValidationResource extends Resource
|
|||||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||||
}),
|
}),
|
||||||
Tables\Columns\TextColumn::make('plant.name')
|
Tables\Columns\TextColumn::make('plant.name')
|
||||||
->label('Plant')
|
->label('Plant Name')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('line.name')
|
Tables\Columns\TextColumn::make('line.name')
|
||||||
->label('Line')
|
->label('Line Name')
|
||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
@@ -2893,6 +2899,10 @@ class QualityValidationResource extends Resource
|
|||||||
->label('Item Code')
|
->label('Item Code')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('stickerMaster.item.description')
|
||||||
|
->label('Item Description')
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('uom')
|
Tables\Columns\TextColumn::make('uom')
|
||||||
->label('Unit of Measure')
|
->label('Unit of Measure')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -2992,6 +3002,11 @@ class QualityValidationResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable()
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('updated_by')
|
||||||
|
->label('Updated By')
|
||||||
|
->alignCenter()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
Tables\Columns\TextColumn::make('deleted_at')
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
->label('Deleted At')
|
->label('Deleted At')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
@@ -3007,17 +3022,22 @@ class QualityValidationResource extends Resource
|
|||||||
->label('Advanced Filters')
|
->label('Advanced Filters')
|
||||||
->form([
|
->form([
|
||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Search by Plant Name')
|
||||||
->nullable()
|
->nullable()
|
||||||
// ->options(function () {
|
->searchable()
|
||||||
// return Plant::pluck('name', 'id');
|
->reactive()
|
||||||
// })
|
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$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) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('sticker_master_id', null);
|
$set('sticker_master_id', null);
|
||||||
$set('sap_msg_status', null);
|
$set('sap_msg_status', null);
|
||||||
@@ -3025,20 +3045,23 @@ class QualityValidationResource extends Resource
|
|||||||
$set('operator_id', null);
|
$set('operator_id', null);
|
||||||
}),
|
}),
|
||||||
Select::make('Line')
|
Select::make('Line')
|
||||||
->label('Select Line')
|
->label('Search by Line Name')
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Line::where('plant_id', $plantId)
|
return Line::whereHas('qualityValidations', function ($query) use ($plantId) {
|
||||||
->where('type', 'FG Line') // Filter by type
|
if ($plantId) {
|
||||||
->pluck('name', 'id')
|
$query->where('plant_id', $plantId);
|
||||||
->toArray();
|
}
|
||||||
|
})->pluck('name', 'id');
|
||||||
|
// return Line::where('plant_id', $plantId)->pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('sticker_master_id', null);
|
$set('sticker_master_id', null);
|
||||||
$set('sap_msg_status', null);
|
$set('sap_msg_status', null);
|
||||||
@@ -3053,6 +3076,8 @@ class QualityValidationResource extends Resource
|
|||||||
Select::make('sticker_master_id')
|
Select::make('sticker_master_id')
|
||||||
->label('Search by Item Code')
|
->label('Search by Item Code')
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$pId = $get('Plant');
|
$pId = $get('Plant');
|
||||||
|
|
||||||
@@ -3062,12 +3087,12 @@ class QualityValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
$query->whereHas('qualityValidations');
|
$query->whereHas('qualityValidations');
|
||||||
})->pluck('code', 'id');
|
})->pluck('code', 'id');
|
||||||
})
|
}),
|
||||||
->searchable()
|
|
||||||
->reactive(),
|
|
||||||
Select::make('sap_msg_status')
|
Select::make('sap_msg_status')
|
||||||
->label('Select SAP Message Status')
|
->label('Select SAP Message Status')
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
|
|
||||||
@@ -3076,12 +3101,13 @@ class QualityValidationResource extends Resource
|
|||||||
} else {
|
} else {
|
||||||
return QualityValidation::where('plant_id', $plantId)->whereNotNull('sap_msg_status')->select('sap_msg_status')->distinct()->pluck('sap_msg_status', 'sap_msg_status');
|
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'))
|
// ->options(QualityValidation::whereNotNull('sap_msg_status')->select('sap_msg_status')->distinct()->pluck('sap_msg_status', 'sap_msg_status'))
|
||||||
->reactive(),
|
|
||||||
Select::make('operator_id')
|
Select::make('operator_id')
|
||||||
->label('Created By')
|
->label('Created By')
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
$lineId = $get('Line');
|
$lineId = $get('Line');
|
||||||
@@ -3092,9 +3118,7 @@ class QualityValidationResource extends Resource
|
|||||||
} else { // if ($plantId && $lineId)
|
} 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');
|
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')
|
DateTimePicker::make(name: 'created_from')
|
||||||
->label('Created From')
|
->label('Created From')
|
||||||
->placeholder(placeholder: 'Select From DateTime')
|
->placeholder(placeholder: 'Select From DateTime')
|
||||||
@@ -3127,11 +3151,11 @@ class QualityValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['production_order'])) {
|
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'])) {
|
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'])) {
|
if (! empty($data['sap_msg_status'])) {
|
||||||
@@ -3166,7 +3190,7 @@ class QualityValidationResource extends Resource
|
|||||||
$indicators = [];
|
$indicators = [];
|
||||||
|
|
||||||
if (! empty($data['Plant'])) {
|
if (! empty($data['Plant'])) {
|
||||||
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
|
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
|
||||||
} else {
|
} else {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
@@ -3176,7 +3200,7 @@ class QualityValidationResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['Line'])) {
|
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'])) {
|
if (! empty($data['production_order'])) {
|
||||||
@@ -3189,7 +3213,7 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
if (! empty($data['sticker_master_id'])) {
|
if (! empty($data['sticker_master_id'])) {
|
||||||
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
||||||
$indicators[] = 'Item Codes: '.$itemCode;
|
$indicators[] = 'Item Code: '.$itemCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['sap_msg_status'])) {
|
if (! empty($data['sap_msg_status'])) {
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ class Line extends Model
|
|||||||
return $this->belongsTo(Block::class);
|
return $this->belongsTo(Block::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function qualityValidations()
|
||||||
|
{
|
||||||
|
return $this->hasMany(QualityValidation::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function testingPanelReadings()
|
public function testingPanelReadings()
|
||||||
{
|
{
|
||||||
return $this->hasMany(TestingPanelReading::class);
|
return $this->hasMany(TestingPanelReading::class);
|
||||||
|
|||||||
@@ -50,12 +50,12 @@ class Plant extends Model
|
|||||||
|
|
||||||
public function invoiceValidations()
|
public function invoiceValidations()
|
||||||
{
|
{
|
||||||
return $this->hasMany(InvoiceValidation::class, 'sticker_master_id');
|
return $this->hasMany(InvoiceValidation::class, 'plant_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function qualityValidations()
|
public function qualityValidations()
|
||||||
{
|
{
|
||||||
return $this->hasMany(QualityValidation::class, 'sticker_master_id');
|
return $this->hasMany(QualityValidation::class, 'plant_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testingPanelReadings()
|
public function testingPanelReadings()
|
||||||
|
|||||||
Reference in New Issue
Block a user