Added required mapping for import columns and Updated plant selection logic in various resources on Advanced Filters
This commit is contained in:
@@ -26,107 +26,107 @@ class StickerMasterImporter extends Importer
|
|||||||
->relationship(resolveUsing: 'code')
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('serial_number_motor')
|
ImportColumn::make('serial_number_motor')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Serial Number Motor')
|
->exampleHeader('Serial Number Motor')
|
||||||
->label('SERIAL NUMBER MOTOR')
|
->label('SERIAL NUMBER MOTOR')
|
||||||
->example('1'),
|
->example('1'),
|
||||||
ImportColumn::make('serial_number_pump')
|
ImportColumn::make('serial_number_pump')
|
||||||
//->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Serial Number Pump')
|
->exampleHeader('Serial Number Pump')
|
||||||
->label('SERIAL NUMBER PUMP')
|
->label('SERIAL NUMBER PUMP')
|
||||||
->example('1'),
|
->example('1'),
|
||||||
ImportColumn::make('serial_number_pumpset')
|
ImportColumn::make('serial_number_pumpset')
|
||||||
//->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Serial Number PumpSet')
|
->exampleHeader('Serial Number PumpSet')
|
||||||
->label('SERIAL NUMBER PUMPSET')
|
->label('SERIAL NUMBER PUMPSET')
|
||||||
->example(''),
|
->example(''),
|
||||||
ImportColumn::make('pack_slip_motor')
|
ImportColumn::make('pack_slip_motor')
|
||||||
//->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Pack Slip Motor')
|
->exampleHeader('Pack Slip Motor')
|
||||||
->label('PACK SLIP MOTOR')
|
->label('PACK SLIP MOTOR')
|
||||||
->example('1'),
|
->example('1'),
|
||||||
ImportColumn::make('pack_slip_pump')
|
ImportColumn::make('pack_slip_pump')
|
||||||
//->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Pack Slip Pump')
|
->exampleHeader('Pack Slip Pump')
|
||||||
->label('PACK SLIP PUMP')
|
->label('PACK SLIP PUMP')
|
||||||
->example('1'),
|
->example('1'),
|
||||||
ImportColumn::make('pack_slip_pumpset')
|
ImportColumn::make('pack_slip_pumpset')
|
||||||
//->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Pack Slip PumpSet')
|
->exampleHeader('Pack Slip PumpSet')
|
||||||
->label('PACK SLIP PUMPSET')
|
->label('PACK SLIP PUMPSET')
|
||||||
->example(''),
|
->example(''),
|
||||||
ImportColumn::make('name_plate_motor')
|
ImportColumn::make('name_plate_motor')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Name Plate Motor')
|
->exampleHeader('Name Plate Motor')
|
||||||
->label('NAME PLATE MOTOR')
|
->label('NAME PLATE MOTOR')
|
||||||
->example('1'),
|
->example('1'),
|
||||||
ImportColumn::make('name_plate_pump')
|
ImportColumn::make('name_plate_pump')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Name Plate Pump')
|
->exampleHeader('Name Plate Pump')
|
||||||
->label('NAME PLATE PUMP')
|
->label('NAME PLATE PUMP')
|
||||||
->example('1'),
|
->example('1'),
|
||||||
ImportColumn::make('name_plate_pumpset')
|
ImportColumn::make('name_plate_pumpset')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Name Plate PumpSet')
|
->exampleHeader('Name Plate PumpSet')
|
||||||
->label('NAME PLATE PUMPSET')
|
->label('NAME PLATE PUMPSET')
|
||||||
->example(''),
|
->example(''),
|
||||||
ImportColumn::make('tube_sticker_motor')
|
ImportColumn::make('tube_sticker_motor')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Tube Sticker Motor')
|
->exampleHeader('Tube Sticker Motor')
|
||||||
->label('TUBE STICKER MOTOR')
|
->label('TUBE STICKER MOTOR')
|
||||||
->example('1'),
|
->example('1'),
|
||||||
ImportColumn::make('tube_sticker_pump')
|
ImportColumn::make('tube_sticker_pump')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Tube Sticker Pump')
|
->exampleHeader('Tube Sticker Pump')
|
||||||
->label('TUBE STICKER PUMP')
|
->label('TUBE STICKER PUMP')
|
||||||
->example('1'),
|
->example('1'),
|
||||||
ImportColumn::make('tube_sticker_pumpset')
|
ImportColumn::make('tube_sticker_pumpset')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Tube Sticker PumpSet')
|
->exampleHeader('Tube Sticker PumpSet')
|
||||||
->label('TUBE STICKER PUMPSET')
|
->label('TUBE STICKER PUMPSET')
|
||||||
->example(''),
|
->example(''),
|
||||||
ImportColumn::make('warranty_card')
|
ImportColumn::make('warranty_card')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Warranty Card')
|
->exampleHeader('Warranty Card')
|
||||||
->label('WARRANTY CARD')
|
->label('WARRANTY CARD')
|
||||||
->example('1'),
|
->example('1'),
|
||||||
ImportColumn::make('part_validation1')
|
ImportColumn::make('part_validation1')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Part Validation 1')
|
->exampleHeader('Part Validation 1')
|
||||||
->label('PART VALIDATION 1')
|
->label('PART VALIDATION 1')
|
||||||
->example('12345'),
|
->example('12345'),
|
||||||
ImportColumn::make('part_validation2')
|
ImportColumn::make('part_validation2')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Part Validation 2')
|
->exampleHeader('Part Validation 2')
|
||||||
->label('PART VALIDATION 2')
|
->label('PART VALIDATION 2')
|
||||||
->example('23456'),
|
->example('23456'),
|
||||||
ImportColumn::make('part_validation3')
|
ImportColumn::make('part_validation3')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Part Validation 3')
|
->exampleHeader('Part Validation 3')
|
||||||
->label('PART VALIDATION 3')
|
->label('PART VALIDATION 3')
|
||||||
->example('34567'),
|
->example('34567'),
|
||||||
ImportColumn::make('part_validation4')
|
ImportColumn::make('part_validation4')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Part Validation 4')
|
->exampleHeader('Part Validation 4')
|
||||||
->label('PART VALIDATION 4')
|
->label('PART VALIDATION 4')
|
||||||
->example('45678'),
|
->example('45678'),
|
||||||
ImportColumn::make('part_validation5')
|
ImportColumn::make('part_validation5')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Part Validation 5')
|
->exampleHeader('Part Validation 5')
|
||||||
->label('PART VALIDATION 5')
|
->label('PART VALIDATION 5')
|
||||||
->example('56789'),
|
->example('56789'),
|
||||||
ImportColumn::make('laser_part_validation1')
|
ImportColumn::make('laser_part_validation1')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Laser Part Validation 1')
|
->exampleHeader('Laser Part Validation 1')
|
||||||
->label('LASER PART VALIDATION 1')
|
->label('LASER PART VALIDATION 1')
|
||||||
->example('67890'),
|
->example('67890'),
|
||||||
ImportColumn::make('laser_part_validation2')
|
ImportColumn::make('laser_part_validation2')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Laser Part Validation 2')
|
->exampleHeader('Laser Part Validation 2')
|
||||||
->label('LASER PART VALIDATION 2')
|
->label('LASER PART VALIDATION 2')
|
||||||
->example('78901'),
|
->example('78901'),
|
||||||
ImportColumn::make('panel_box_code')
|
ImportColumn::make('panel_box_code')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Panel Box Code')
|
->exampleHeader('Panel Box Code')
|
||||||
->label('PANEL BOX CODE')
|
->label('PANEL BOX CODE')
|
||||||
->example('123456'),
|
->example('123456'),
|
||||||
@@ -138,13 +138,13 @@ class StickerMasterImporter extends Importer
|
|||||||
->example('0')
|
->example('0')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('material_type')
|
ImportColumn::make('material_type')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->integer()
|
->integer()
|
||||||
->exampleHeader('Material Type')
|
->exampleHeader('Material Type')
|
||||||
->label('MATERIAL TYPE')
|
->label('MATERIAL TYPE')
|
||||||
->example(''),
|
->example(''),
|
||||||
ImportColumn::make('bundle_quantity')
|
ImportColumn::make('bundle_quantity')
|
||||||
// ->requiredMapping()
|
->requiredMapping()
|
||||||
->integer()
|
->integer()
|
||||||
->exampleHeader('Bundle Quantity')
|
->exampleHeader('Bundle Quantity')
|
||||||
->label('BUNDLE QUANTITY')
|
->label('BUNDLE QUANTITY')
|
||||||
|
|||||||
@@ -329,8 +329,12 @@ class EbReadingResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ class GrMasterResource extends Resource
|
|||||||
}
|
}
|
||||||
// else if (preg_match('/E CODE\s*:\s*(\S+)/i', $text, $matches)) {
|
// else if (preg_match('/E CODE\s*:\s*(\S+)/i', $text, $matches)) {
|
||||||
|
|
||||||
|
|
||||||
// $item2 = $matches[1];
|
// $item2 = $matches[1];
|
||||||
// dd($item2);
|
// dd($item2);
|
||||||
// }
|
// }
|
||||||
@@ -189,7 +188,6 @@ class GrMasterResource extends Resource
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Item Code not matched')
|
->title('Item Code not matched')
|
||||||
->body("Item Code: {$item->code} not matched with the uploaded pdf code $item1.")
|
->body("Item Code: {$item->code} not matched with the uploaded pdf code $item1.")
|
||||||
|
|||||||
@@ -283,8 +283,12 @@ class GuardPatrolEntryResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive(),
|
->reactive(),
|
||||||
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
|
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
|||||||
@@ -1025,8 +1025,12 @@ class InvoiceValidationResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||||
|
|||||||
@@ -716,8 +716,12 @@ class LocatorInvoiceValidationResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||||
|
|||||||
@@ -189,8 +189,12 @@ class LocatorResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||||
|
|||||||
@@ -469,8 +469,12 @@ class MotorTestingMasterResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
|||||||
@@ -281,8 +281,12 @@ class PalletValidationResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||||
|
|||||||
@@ -438,8 +438,12 @@ class ProductionLineStopResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id'); // Assuming 'name' is the column you want to display
|
// return Plant::pluck('name', 'id'); // Assuming 'name' is the column you want to display
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
|||||||
@@ -588,8 +588,12 @@ class ProductionPlanResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id'); // Assuming 'name' is the column you want to display
|
// return Plant::pluck('name', 'id'); // Assuming 'name' is the column you want to display
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
|||||||
@@ -1044,8 +1044,12 @@ class ProductionQuantityResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id'); // Assuming 'name' is the column you want to display
|
// return Plant::pluck('name', 'id'); // Assuming 'name' is the column you want to display
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
|||||||
@@ -2318,8 +2318,12 @@ class QualityValidationResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
|||||||
@@ -466,8 +466,12 @@ class ReworkLocatorInvoiceValidationResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||||
|
|||||||
@@ -1006,8 +1006,12 @@ class SerialValidationResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||||
|
|||||||
@@ -168,8 +168,12 @@ class WeightValidationResource extends Resource
|
|||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Select Plant')
|
->label('Select Plant')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options(function () {
|
// ->options(function () {
|
||||||
return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
|
// })
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive(),
|
->reactive(),
|
||||||
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
|
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
|||||||
Reference in New Issue
Block a user