|
|
@ -480,7 +480,7 @@ class ProjectController extends Controller |
|
|
|
|
|
|
|
|
|
|
|
return response()->json(['status' => 'success', 'code' => 200, 'data' => $userProyek, 'totalRecord' => $totalRecord], 200); |
|
|
|
return response()->json(['status' => 'success', 'code' => 200, 'data' => $userProyek, 'totalRecord' => $totalRecord], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
public function detail(Request $request, $id, $gantt_id = null){ |
|
|
|
public function detail(Request $request, $id, $gantt_id = null, $s_curve = null){ |
|
|
|
if(empty($id) || !is_int((int)$id)) |
|
|
|
if(empty($id) || !is_int((int)$id)) |
|
|
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
|
|
|
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); |
|
|
|
|
|
|
|
|
|
|
@ -495,33 +495,42 @@ class ProjectController extends Controller |
|
|
|
$ganttId = $gantt_id; |
|
|
|
$ganttId = $gantt_id; |
|
|
|
} |
|
|
|
} |
|
|
|
$result->projectManager = User::where('id', $result->pm_id)->value('name'); |
|
|
|
$result->projectManager = User::where('id', $result->pm_id)->value('name'); |
|
|
|
$result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->where("version_gantt_id", $ganttId)->first(); |
|
|
|
|
|
|
|
// dd($result->header->start_date); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$actualStartExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_start')->exists(); |
|
|
|
if (isset($s_curve)) { |
|
|
|
$actualEndExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_end')->exists(); |
|
|
|
$result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->first(); |
|
|
|
|
|
|
|
$actualStartExist = Activity::where('proyek_id', $id)->whereNotNull('actual_start')->exists(); |
|
|
|
|
|
|
|
$actualEndExist = Activity::where('proyek_id', $id)->whereNotNull('actual_end')->exists(); |
|
|
|
|
|
|
|
$query = Activity::where('proyek_id', $id); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->where("version_gantt_id", $ganttId)->first(); |
|
|
|
|
|
|
|
$actualStartExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_start')->exists(); |
|
|
|
|
|
|
|
$actualEndExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_end')->exists(); |
|
|
|
|
|
|
|
$query = Activity::where('version_gantt_id', $ganttId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($actualStartExist) { |
|
|
|
if ($actualStartExist) { |
|
|
|
$startDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
$startDate = $query->orderBy('actual_start')->value('start_date'); |
|
|
|
->orderBy('actual_start') |
|
|
|
} else { |
|
|
|
->value('start_date'); |
|
|
|
$startDate = $query->orderBy('start_date')->value('start_date'); |
|
|
|
} else { |
|
|
|
} |
|
|
|
$startDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
|
|
|
|
->orderBy('start_date') |
|
|
|
if ($actualEndExist) { |
|
|
|
->value('start_date'); |
|
|
|
$endDate = $query->orderByDesc('actual_end')->value('end_date'); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if ($actualEndExist) { |
|
|
|
$endDate = $query->orderByDesc('end_date')->value('end_date'); |
|
|
|
$endDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
} |
|
|
|
->orderByDesc('actual_end') |
|
|
|
|
|
|
|
->value('end_date'); |
|
|
|
$plannedStart = Activity::where('version_gantt_id', $ganttId) |
|
|
|
} else { |
|
|
|
->orderBy('planned_start') |
|
|
|
$endDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
->value('planned_start'); |
|
|
|
->orderByDesc('end_date') |
|
|
|
$plannedEnd = Activity::where('version_gantt_id', $ganttId) |
|
|
|
->value('end_date'); |
|
|
|
->orderByDesc('planned_end') |
|
|
|
} |
|
|
|
->value('planned_end'); |
|
|
|
$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], 200); |
|
|
|
$result->header->planned_start = $plannedStart; |
|
|
|
|
|
|
|
$result->header->planned_end = $plannedEnd; |
|
|
|
|
|
|
|
return response()->json(['status'=>'success','code'=> 200,'data'=>$result, 'gantt'=>$ganttId], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getOverdueActivities(Request $request){ |
|
|
|
public function getOverdueActivities(Request $request){ |
|
|
|