|
|
@ -82,10 +82,35 @@ class VersionGanttController extends Controller |
|
|
|
$payload = $request->all(); |
|
|
|
$payload = $request->all(); |
|
|
|
$dataBuilder = $this->setUpPayload($payload, 'm_version_gantt'); |
|
|
|
$dataBuilder = $this->setUpPayload($payload, 'm_version_gantt'); |
|
|
|
$builder = $dataBuilder['builder']; |
|
|
|
$builder = $dataBuilder['builder']; |
|
|
|
$countBuilder = $dataBuilder['count']; |
|
|
|
// $countBuilder = $dataBuilder['count']; |
|
|
|
|
|
|
|
$progress = $this->ganttProgress($request->columns[0]["name"], $request->columns[0]["value"]); |
|
|
|
$dataGet = $builder->get(); |
|
|
|
$dataGet = $builder->get(); |
|
|
|
$totalRecord = $countBuilder->count(); |
|
|
|
// Loop through $dataGet collection |
|
|
|
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); |
|
|
|
foreach ($dataGet as $item) { |
|
|
|
|
|
|
|
// Loop through $progress collection |
|
|
|
|
|
|
|
foreach ($progress as $progressItem) { |
|
|
|
|
|
|
|
// Check if both have the same id |
|
|
|
|
|
|
|
if ($item->id == $progressItem->id) { |
|
|
|
|
|
|
|
// Set the progress of $item to the corresponding progress of $progressItem |
|
|
|
|
|
|
|
dd($progressItem); |
|
|
|
|
|
|
|
$item->progress = $progressItem->persentase_progress; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// $totalRecord = $countBuilder->count(); |
|
|
|
|
|
|
|
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet], 200); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function ganttProgress($column, $value){ |
|
|
|
|
|
|
|
$progress = VersionGantt::select('m_version_gantt.id','m_activity.persentase_progress', 'm_activity.progress') |
|
|
|
|
|
|
|
->join('m_activity', 'm_version_gantt.id', '=', 'm_activity.version_gantt_id') |
|
|
|
|
|
|
|
->where("m_version_gantt.".$column, $value) |
|
|
|
|
|
|
|
->where('m_activity.type_activity', "project") |
|
|
|
|
|
|
|
->where('m_activity.parent_id', null) |
|
|
|
|
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $progress; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function list() |
|
|
|
public function list() |
|
|
|