Additional Changes
This commit is contained in:
@@ -70,7 +70,7 @@ class TaskController extends Controller
|
||||
|
||||
return Inertia::render('TaskManagement::Tasks/Index', [
|
||||
'project' => $project,
|
||||
'projects' => Project::select('id', 'ulid', 'name')->get(),
|
||||
'projects' => Project::with('parentProject:id,ulid,name,code')->get(['id', 'ulid', 'name', 'code', 'project_type', 'parent_project_id']),
|
||||
'employees' => $employees,
|
||||
'availableMaterials' => $availableMaterials,
|
||||
'delayReasons' => collect(\Modules\ProjectManagement\Enums\DelayReason::cases())->map(fn ($r) => [
|
||||
@@ -98,6 +98,7 @@ class TaskController extends Controller
|
||||
'assigned_users' => 'nullable|array',
|
||||
'assigned_users.*' => 'string',
|
||||
'labor_cost' => 'nullable|numeric|min:0',
|
||||
'equipment_cost' => 'nullable|numeric|min:0',
|
||||
'estimated_hours' => 'nullable|numeric|min:0',
|
||||
'start_date' => 'nullable|date',
|
||||
'end_date' => 'nullable|date|after_or_equal:start_date',
|
||||
@@ -118,6 +119,9 @@ class TaskController extends Controller
|
||||
if (empty($validated['labor_cost'])) {
|
||||
$validated['labor_cost'] = 0;
|
||||
}
|
||||
if (empty($validated['equipment_cost'])) {
|
||||
$validated['equipment_cost'] = 0;
|
||||
}
|
||||
if (empty($validated['estimated_hours'])) {
|
||||
$validated['estimated_hours'] = 0;
|
||||
}
|
||||
@@ -154,6 +158,7 @@ class TaskController extends Controller
|
||||
'assigned_users' => 'nullable|array',
|
||||
'assigned_users.*' => 'string',
|
||||
'labor_cost' => 'nullable|numeric|min:0',
|
||||
'equipment_cost' => 'nullable|numeric|min:0',
|
||||
'estimated_hours' => 'nullable|numeric|min:0',
|
||||
'actual_hours' => 'nullable|numeric|min:0',
|
||||
'start_date' => 'nullable|date',
|
||||
@@ -174,6 +179,9 @@ class TaskController extends Controller
|
||||
if (array_key_exists('labor_cost', $validated) && empty($validated['labor_cost'])) {
|
||||
$validated['labor_cost'] = 0;
|
||||
}
|
||||
if (array_key_exists('equipment_cost', $validated) && empty($validated['equipment_cost'])) {
|
||||
$validated['equipment_cost'] = 0;
|
||||
}
|
||||
if (array_key_exists('estimated_hours', $validated) && empty($validated['estimated_hours'])) {
|
||||
$validated['estimated_hours'] = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user