Compare commits
3 Commits
ba9e85a4e9
...
1ebada1787
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ebada1787 | ||
|
|
d107f1be18 | ||
|
|
9ce3b34f75 |
@@ -154,6 +154,10 @@ class ProductionPlanResource extends Resource
|
|||||||
// $currentPath = url()->current();
|
// $currentPath = url()->current();
|
||||||
// $currentPath = $_SERVER['REQUEST_URI'];
|
// $currentPath = $_SERVER['REQUEST_URI'];
|
||||||
// dd($currentPath);
|
// dd($currentPath);
|
||||||
|
|
||||||
|
$isUpdate = !empty($get('id'));
|
||||||
|
if (!$isUpdate)
|
||||||
|
{
|
||||||
$exists = ProductionPlan::where('plant_id', $get('plant_id'))
|
$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'))
|
||||||
@@ -166,6 +170,7 @@ class ProductionPlanResource extends Resource
|
|||||||
$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),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ class ShiftResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
$set('block_id', null);
|
$set('block_id', null);
|
||||||
// Ensure `linestop_id` is not cleared
|
|
||||||
if (!$plantId) {
|
if (!$plantId) {
|
||||||
$set('sPlantError', 'Please select a plant first.');
|
$set('sPlantError', 'Please select a plant first.');
|
||||||
return;
|
return;
|
||||||
@@ -79,7 +78,6 @@ class ShiftResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$blockId = $get('block_id');
|
$blockId = $get('block_id');
|
||||||
$set('name', null);
|
$set('name', null);
|
||||||
// Ensure `linestop_id` is not cleared
|
|
||||||
if (!$blockId) {
|
if (!$blockId) {
|
||||||
$set('sBlockError', 'Please select a block first.');
|
$set('sBlockError', 'Please select a block first.');
|
||||||
return;
|
return;
|
||||||
@@ -101,7 +99,6 @@ class ShiftResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$nameId = $get('name');
|
$nameId = $get('name');
|
||||||
$set('start_time', null);
|
$set('start_time', null);
|
||||||
// Ensure `linestop_id` is not cleared
|
|
||||||
if (!$nameId) {
|
if (!$nameId) {
|
||||||
$set('sNameError', 'Scan the valid name.');
|
$set('sNameError', 'Scan the valid name.');
|
||||||
return;
|
return;
|
||||||
@@ -128,7 +125,6 @@ class ShiftResource extends Resource
|
|||||||
$nameId = $get('start_time');
|
$nameId = $get('start_time');
|
||||||
// $set('duration', null);
|
// $set('duration', null);
|
||||||
$set('end_time', self::calculateEndTime($state, $get('duration')));
|
$set('end_time', self::calculateEndTime($state, $get('duration')));
|
||||||
// Ensure `linestop_id` is not cleared
|
|
||||||
if (!$nameId) {
|
if (!$nameId) {
|
||||||
$set('sStartTimeError', 'Choose the valid start time.');
|
$set('sStartTimeError', 'Choose the valid start time.');
|
||||||
return;
|
return;
|
||||||
@@ -158,7 +154,6 @@ class ShiftResource extends Resource
|
|||||||
$duration = $get('duration');
|
$duration = $get('duration');
|
||||||
// $set('end_time', null);
|
// $set('end_time', null);
|
||||||
$set('end_time', self::calculateEndTime($get('start_time'), $state));
|
$set('end_time', self::calculateEndTime($get('start_time'), $state));
|
||||||
// Ensure `linestop_id` is not cleared
|
|
||||||
if (!$duration) {
|
if (!$duration) {
|
||||||
$set('sDurationError', 'Scan the valid duration.');
|
$set('sDurationError', 'Scan the valid duration.');
|
||||||
return;
|
return;
|
||||||
@@ -182,7 +177,6 @@ class ShiftResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$endTime = $get('end_time');
|
$endTime = $get('end_time');
|
||||||
$set('end_time', self::calculateEndTime($get('start_time'), $state));
|
$set('end_time', self::calculateEndTime($get('start_time'), $state));
|
||||||
// Ensure `linestop_id` is not cleared
|
|
||||||
if (!$endTime) {
|
if (!$endTime) {
|
||||||
$set('sEndTimeError', 'Choose the valid start time & duration.');
|
$set('sEndTimeError', 'Choose the valid start time & duration.');
|
||||||
return;
|
return;
|
||||||
@@ -310,6 +304,4 @@ class ShiftResource extends Resource
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user