|
|
@ -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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($s_curve)) { |
|
|
|
|
|
|
|
$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(); |
|
|
|
$actualStartExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_start')->exists(); |
|
|
|
$actualEndExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_end')->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') |
|
|
|
|
|
|
|
->value('start_date'); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$startDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
$startDate = $query->orderBy('start_date')->value('start_date'); |
|
|
|
->orderBy('start_date') |
|
|
|
|
|
|
|
->value('start_date'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($actualEndExist) { |
|
|
|
if ($actualEndExist) { |
|
|
|
$endDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
$endDate = $query->orderByDesc('actual_end')->value('end_date'); |
|
|
|
->orderByDesc('actual_end') |
|
|
|
|
|
|
|
->value('end_date'); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$endDate = Activity::where('version_gantt_id', $ganttId) |
|
|
|
$endDate = $query->orderByDesc('end_date')->value('end_date'); |
|
|
|
->orderByDesc('end_date') |
|
|
|
|
|
|
|
->value('end_date'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$plannedStart = Activity::where('version_gantt_id', $ganttId) |
|
|
|
|
|
|
|
->orderBy('planned_start') |
|
|
|
|
|
|
|
->value('planned_start'); |
|
|
|
|
|
|
|
$plannedEnd = Activity::where('version_gantt_id', $ganttId) |
|
|
|
|
|
|
|
->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){ |
|
|
|