ID column added to run update func in Production Plan Resource
This commit is contained in:
@@ -154,17 +154,22 @@ class ProductionPlanResource extends Resource
|
||||
// $currentPath = url()->current();
|
||||
// $currentPath = $_SERVER['REQUEST_URI'];
|
||||
// dd($currentPath);
|
||||
$exists = ProductionPlan::where('plant_id', $get('plant_id'))
|
||||
|
||||
$isUpdate = !empty($get('id'));
|
||||
if (!$isUpdate)
|
||||
{
|
||||
$exists = ProductionPlan::where('plant_id', $get('plant_id'))
|
||||
->where('shift_id', $get('shift_id'))
|
||||
->where('line_id', $get('line_id'))
|
||||
->whereDate('created_at', today())
|
||||
->exists();
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
$set('line_id', null);
|
||||
$set('ppLineError', 'Production plan already updated.');
|
||||
return;
|
||||
if ($exists)
|
||||
{
|
||||
$set('line_id', null);
|
||||
$set('ppLineError', 'Production plan already updated.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
$set('ppLineError', null);
|
||||
}
|
||||
@@ -203,6 +208,9 @@ class ProductionPlanResource extends Resource
|
||||
->label('Production Quantity')
|
||||
->readOnly()
|
||||
->default(0),
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user