|
|
|
@ -48,8 +48,10 @@ class ActivityController extends Controller
|
|
|
|
|
$dataHeader->planned_start = isset($dataHeader->planned_start) ? date_format(date_create($dataHeader->planned_start), "Y-m-d H:i:s") : NULL; |
|
|
|
|
$dataHeader->planned_end = isset($dataHeader->planned_end) ? date_format(date_create($dataHeader->planned_end), "Y-m-d H:i:s") : NULL; |
|
|
|
|
|
|
|
|
|
$dataHeader->actual_start = isset($dataHeader->actual_start) ? date_format(date_create($dataHeader->actual_start), "Y-m-d") : NULL; |
|
|
|
|
$dataHeader->actual_end = isset($dataHeader->actual_end) ? date_format(date_create($dataHeader->actual_end), "Y-m-d") : NULL; |
|
|
|
|
$actualStart = $this->getActivityFirst($dataHeader->id); |
|
|
|
|
$dataHeader->actual_start = date_format(date_create($actualStart), "Y-m-d"); |
|
|
|
|
$actualEnd = $this->getActivityLast($dataHeader->id); |
|
|
|
|
$dataHeader->actual_end = isset($actualEnd) ? date_format(date_create($actualEnd), "Y-m-d") : NULL; |
|
|
|
|
|
|
|
|
|
$dataHeader->type = "header"; |
|
|
|
|
$dataHeader->text = $dataHeader->name; |
|
|
|
@ -77,8 +79,10 @@ class ActivityController extends Controller
|
|
|
|
|
$objRow->planned_start = isset($objRow->planned_start) ? date_format(date_create($objRow->planned_start), "Y-m-d H:i:s") : NULL; |
|
|
|
|
$objRow->planned_end = isset($objRow->planned_end) ? date_format(date_create($objRow->planned_end), "Y-m-d H:i:s") : NULL; |
|
|
|
|
|
|
|
|
|
$objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; |
|
|
|
|
$objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL; |
|
|
|
|
$actualStart = $this->getActivityFirst($objRow->id); |
|
|
|
|
$objRow->actual_start = isset($actualStart) ? date_format(date_create($actualStart), "Y-m-d") : NULL; |
|
|
|
|
$actualEnd = $this->getActivityLast($objRow->id); |
|
|
|
|
$objRow->actual_end = isset($actualEnd) ? date_format(date_create($actualEnd), "Y-m-d") : NULL; |
|
|
|
|
|
|
|
|
|
$objRow->progress = $objRow->persentase_progress / 100; |
|
|
|
|
$objRow->type = $type; |
|
|
|
@ -124,16 +128,21 @@ class ActivityController extends Controller
|
|
|
|
|
$objRow->planned_start = isset($objRow->planned_start) ? date_format(date_create($objRow->planned_start), "Y-m-d H:i:s") : NULL; |
|
|
|
|
$objRow->planned_end = isset($objRow->planned_end) ? date_format(date_create($objRow->planned_end), "Y-m-d H:i:s") : NULL; |
|
|
|
|
|
|
|
|
|
$objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; |
|
|
|
|
$objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL; |
|
|
|
|
|
|
|
|
|
$dataChildren = $this->getChildren($gantt_id, $objRow->id); |
|
|
|
|
if ($objRow->type_activity == "milestone") { |
|
|
|
|
$objRow->type = $objRow->type_activity; |
|
|
|
|
$objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; |
|
|
|
|
} elseif (empty($dataChildren)) { |
|
|
|
|
$objRow->type = "task"; |
|
|
|
|
$objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; |
|
|
|
|
$objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL; |
|
|
|
|
} else { |
|
|
|
|
$objRow->type = "project"; |
|
|
|
|
$actualStart = $this->getActivityFirst($objRow->id); |
|
|
|
|
$objRow->actual_start = isset($actualStart) ? date_format(date_create($actualStart), "Y-m-d") : NULL; |
|
|
|
|
|
|
|
|
|
$actualEnd = $this->getActivityLast($objRow->id); |
|
|
|
|
$objRow->actual_end = isset($actualEnd) ? date_format(date_create($actualEnd), "Y-m-d") : NULL; |
|
|
|
|
} |
|
|
|
|
$finalData[] = $objRow; |
|
|
|
|
$finalData = array_merge($finalData, $dataChildren); |
|
|
|
@ -141,6 +150,28 @@ class ActivityController extends Controller
|
|
|
|
|
return $finalData; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getActivityFirst($parentId){ |
|
|
|
|
$activity = Activity::where('parent_id', $parentId)->orderByRaw('start_date ASC')->first(); |
|
|
|
|
if($activity->type_activity == "task"){ |
|
|
|
|
// Log::info("activity ", [$activity]); |
|
|
|
|
return $activity->actual_start; |
|
|
|
|
}else{ |
|
|
|
|
return $this->getActivityFirst($activity->id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getActivityLast($parentId){ |
|
|
|
|
$activity = Activity::where('parent_id', $parentId)->orderByRaw('start_date DESC')->first(); |
|
|
|
|
if($activity->type_activity == "task"){ |
|
|
|
|
// Log::info("activity ", [$activity]); |
|
|
|
|
return $activity->actual_end; |
|
|
|
|
}else{ |
|
|
|
|
return $this->getActivityLast($activity->id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function cloneTemplate($id, $proyek_id, $hierarchy_ftth_id = null) |
|
|
|
|
{ |
|
|
|
|
$project = Project::find($proyek_id); |
|
|
|
|