Browse Source

fix schedule dashboard project

pull/3/head
wahyu 1 year ago
parent
commit
0b13e01b49
  1. 26
      app/Http/Controllers/ProjectController.php

26
app/Http/Controllers/ProjectController.php

@ -448,13 +448,27 @@ class ProjectController extends Controller
// dd($result->header->start_date); // dd($result->header->start_date);
$ganttId = $gantt['last_gantt_id']; $ganttId = $gantt['last_gantt_id'];
$startDate = Activity::where('version_gantt_id', $ganttId) $actualStartExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_start')->exists();
->orderBy('start_date') $actualEndExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_end')->exists();
->value('start_date');
$endDate = Activity::where('version_gantt_id', $ganttId) if ($actualStartExist) {
->orderByDesc('end_date') $startDate = Activity::where('version_gantt_id', $ganttId)
->value('end_date'); ->orderBy('actual_start')
->value('start_date');
} else {
$startDate = Activity::where('version_gantt_id', $ganttId)
->orderBy('start_date')
->value('start_date');
}
if ($actualEndExist) {
$endDate = Activity::where('version_gantt_id', $ganttId)
->orderByDesc('actual_end')
->value('end_date');
} else {
$endDate = Activity::where('version_gantt_id', $ganttId)
->orderByDesc('end_date')
->value('end_date');
}
$result->header->start_date = $startDate; $result->header->start_date = $startDate;
$result->header->end_date = $endDate; $result->header->end_date = $endDate;
return response()->json(['status'=>'success','code'=> 200,'data'=>$result, 'gantt'=>$gantt], 200); return response()->json(['status'=>'success','code'=> 200,'data'=>$result, 'gantt'=>$gantt], 200);

Loading…
Cancel
Save