|
|
|
@ -16,8 +16,13 @@ class ActivityController extends Controller
|
|
|
|
|
{ |
|
|
|
|
public function getByGanttId($id, $proyek_id) |
|
|
|
|
{ |
|
|
|
|
$gantt = VersionGantt::find($id); |
|
|
|
|
if(Activity::where('proyek_id', $proyek_id)->where("version_gantt_id", $id)->count() == 0) { |
|
|
|
|
if(!$gantt->hierarchy_ftth_id) { |
|
|
|
|
$this->cloneTemplate($id, $proyek_id); |
|
|
|
|
} else { |
|
|
|
|
$this->cloneTemplate($id, $proyek_id, $gantt->hierarchy_ftth_id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$dataGantt = $this->getDataActivity($id); |
|
|
|
@ -120,10 +125,21 @@ class ActivityController extends Controller
|
|
|
|
|
return $finalData; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function cloneTemplate($id, $proyek_id) |
|
|
|
|
{ |
|
|
|
|
private function cloneTemplate($id, $proyek_id, $hierarchy_ftth_id = null) { |
|
|
|
|
$project = Project::find($proyek_id); |
|
|
|
|
|
|
|
|
|
if($hierarchy_ftth_id){ |
|
|
|
|
$gantt = VersionGantt::find($id); |
|
|
|
|
$rootActivity = Activity::create([ |
|
|
|
|
'version_gantt_id'=>$id, |
|
|
|
|
'proyek_id'=>$proyek_id, |
|
|
|
|
'name'=> $gantt->name_version, |
|
|
|
|
'start_date'=> $project->mulai_proyek, |
|
|
|
|
'end_date'=> $project->akhir_proyek, |
|
|
|
|
'rencana_biaya'=> $project->rencana_biaya, |
|
|
|
|
'type_activity'=> 'project', |
|
|
|
|
'created_by'=>$this->currentName, |
|
|
|
|
]); |
|
|
|
|
} else { |
|
|
|
|
$rootActivity = Activity::create([ |
|
|
|
|
'version_gantt_id'=>$id, |
|
|
|
|
'proyek_id'=>$proyek_id, |
|
|
|
@ -135,6 +151,7 @@ class ActivityController extends Controller
|
|
|
|
|
'type_activity'=> 'project', |
|
|
|
|
'created_by'=>$this->currentName, |
|
|
|
|
]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$resultTypeProject = TemplateGantt::where('proyek_type_id', $project->type_proyek_id) |
|
|
|
|
->whereNull('parent_id') |
|
|
|
|