|
|
@ -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']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$actualStartExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_start')->exists(); |
|
|
|
|
|
|
|
$actualEndExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_end')->exists(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($actualStartExist) { |
|
|
|
|
|
|
|
$startDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
|
|
|
|
->orderBy('actual_start') |
|
|
|
|
|
|
|
->value('start_date'); |
|
|
|
|
|
|
|
} else { |
|
|
|
$startDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
$startDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
->orderBy('start_date') |
|
|
|
->orderBy('start_date') |
|
|
|
->value('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) |
|
|
|
$endDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
->orderByDesc('end_date') |
|
|
|
->orderByDesc('end_date') |
|
|
|
->value('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); |
|
|
@ -470,11 +484,20 @@ class ProjectController extends Controller |
|
|
|
if(!$result) |
|
|
|
if(!$result) |
|
|
|
return response()->json(['status'=>'failed','message'=> 'Project not found!','code'=> 404], 404); |
|
|
|
return response()->json(['status'=>'failed','message'=> 'Project not found!','code'=> 404], 404); |
|
|
|
//TODO possible overdue bug |
|
|
|
//TODO possible overdue bug |
|
|
|
if(isset($payload['till_date'])) |
|
|
|
if(isset($payload['till_date'])) { |
|
|
|
|
|
|
|
if (isset($payload['scurve'])) { |
|
|
|
$overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$payload['till_date'])->orderBy('end_date', 'asc')->get(); |
|
|
|
$overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$payload['till_date'])->orderBy('end_date', 'asc')->get(); |
|
|
|
else |
|
|
|
} else { |
|
|
|
|
|
|
|
$overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$payload['till_date'])->orderBy('end_date', 'asc')->get(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
if (isset($payload['scurve'])) { |
|
|
|
$overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get(); |
|
|
|
$overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
$result->overdueActivities = $overdueActivities; |
|
|
|
$result->overdueActivities = $overdueActivities; |
|
|
|
|
|
|
|
|
|
|
|
return response()->json(['status'=>'success','code'=> 200,'data'=>$result], 200); |
|
|
|
return response()->json(['status'=>'success','code'=> 200,'data'=>$result], 200); |
|
|
|