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 = url()->current();
|
||||||
// $currentPath = $_SERVER['REQUEST_URI'];
|
// $currentPath = $_SERVER['REQUEST_URI'];
|
||||||
// dd($currentPath);
|
// 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('shift_id', $get('shift_id'))
|
||||||
->where('line_id', $get('line_id'))
|
->where('line_id', $get('line_id'))
|
||||||
->whereDate('created_at', today())
|
->whereDate('created_at', today())
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if ($exists)
|
if ($exists)
|
||||||
{
|
{
|
||||||
$set('line_id', null);
|
$set('line_id', null);
|
||||||
$set('ppLineError', 'Production plan already updated.');
|
$set('ppLineError', 'Production plan already updated.');
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$set('ppLineError', null);
|
$set('ppLineError', null);
|
||||||
}
|
}
|
||||||
@@ -203,6 +208,9 @@ class ProductionPlanResource extends Resource
|
|||||||
->label('Production Quantity')
|
->label('Production Quantity')
|
||||||
->readOnly()
|
->readOnly()
|
||||||
->default(0),
|
->default(0),
|
||||||
|
Forms\Components\TextInput::make('id')
|
||||||
|
->hidden()
|
||||||
|
->readOnly(),
|
||||||
])
|
])
|
||||||
->columns(2),
|
->columns(2),
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user