Browse Source

Handling empty gantt

pull/3/head
Wahyu Ramadhan 1 year ago
parent
commit
fbf20963a0
  1. 6
      app/Helpers/MasterFunctionsHelper.php
  2. 6
      app/Http/Controllers/DashboardBoDController.php

6
app/Helpers/MasterFunctionsHelper.php

@ -35,10 +35,16 @@ class MasterFunctionsHelper {
public function getLatestGantt($id){ public function getLatestGantt($id){
$maxGanttId = VersionGantt::where("proyek_id", $id)->max("id"); $maxGanttId = VersionGantt::where("proyek_id", $id)->max("id");
if(!$maxGanttId){
$data = array(
"proyek_id" => $id
);
} else {
$data = array( $data = array(
"last_gantt_id" => $maxGanttId, "last_gantt_id" => $maxGanttId,
"proyek_id" => $id "proyek_id" => $id
); );
}
return $data; return $data;
} }

6
app/Http/Controllers/DashboardBoDController.php

@ -319,8 +319,12 @@ class DashboardBoDController extends Controller
$project->pm = User::find($project->pm_id); $project->pm = User::find($project->pm_id);
/* $project->header = Activity::where('proyek_id', $project->id)->where('version_gantt_id', $lastGantt['last_gantt_id'])->whereNull('parent_id')->first(); */ /* $project->header = Activity::where('proyek_id', $project->id)->where('version_gantt_id', $lastGantt['last_gantt_id'])->whereNull('parent_id')->first(); */
$project->scurve = MasterFunctionsHelper::getSCurve($project->id); if(!isset($lastGantt['last_gantt_id'])){
$project->manPowers = 0;
} else {
$project->manPowers = UserToVersionGantt::where('version_gantt_id', $lastGantt['last_gantt_id'])->count(); $project->manPowers = UserToVersionGantt::where('version_gantt_id', $lastGantt['last_gantt_id'])->count();
$project->scurve = MasterFunctionsHelper::getSCurve($project->id);
}
$project->lastGanttId = MasterFunctionsHelper::getLatestGantt($project->id); $project->lastGanttId = MasterFunctionsHelper::getLatestGantt($project->id);
} }

Loading…
Cancel
Save