Browse Source

Merge pull request 'update endpoint' (#13) from dev-wahyun into staging

Reviewed-on: ibnu/generic-ospro-backend#13
pull/1/head
farhantock 11 months ago
parent
commit
52bf2f5594
  1. 39
      app/Http/Controllers/ProjectCarausellController.php

39
app/Http/Controllers/ProjectCarausellController.php

@ -16,34 +16,19 @@ class ProjectCarausellController extends Controller
$projectData = Project::query() $projectData = Project::query()
->select("id","nama","kode_sortname","pm_id","budget_health","calculation_status","mulai_proyek","akhir_proyek","rencana_biaya","company","scurve") ->select("id","nama","kode_sortname","pm_id","budget_health","calculation_status","mulai_proyek","akhir_proyek","rencana_biaya","company","scurve")
->get(); ->get();
$projectRisk = ProjectRisks::query()
->select('proyek_id','description','level_risk','preventive_risk')
->get();
$projectIssue = ProjectIssues::query()
->select('proyek_id','description','level_issue')
->get();
$arr = []; $arr = [];
foreach($projectData as $project) { foreach($projectData as $project) {
$riskProject = []; $projectRisk = ProjectRisks::query()
$issueProject = []; ->select('proyek_id','description','level_risk','preventive_risk')
foreach ($projectRisk as $risk) { ->where('proyek_id', $project['id'])
if ($risk['proyek_id'] === $project['id']) { ->get()
$riskProject[] = [ ->toArray();
'level_risk' => $risk['level_risk'], $projectIssue = ProjectIssues::query()
'preventive_risk' => $risk['preventive_risk'], ->select('proyek_id','description','level_issue')
'description' => $risk['description'] ->where('proyek_id',$project['id'])
]; ->get()
} ->toArray();
}
foreach ($projectIssue as $issue) {
if ($issue['proyek_id'] === $project['id']) {
$issueProject[] = [
'level_issue' => $issue['level_issue'],
'description' => $issue['description']
];
}
}
$ganttData = VersionGantt::query() $ganttData = VersionGantt::query()
->select('id', 'name_version','hierarchy_ftth_id','cost_to_complete','proyek_id','calculation_type') ->select('id', 'name_version','hierarchy_ftth_id','cost_to_complete','proyek_id','calculation_type')
->where('proyek_id',$project['id']) ->where('proyek_id',$project['id'])
@ -63,11 +48,9 @@ class ProjectCarausellController extends Controller
"rencana_biaya" => $project['rencana_biaya'], "rencana_biaya" => $project['rencana_biaya'],
"company" => $project['company'], "company" => $project['company'],
"scurve" => $project['scurve'], "scurve" => $project['scurve'],
"project_risk" => $riskProject,
"project_issues" => $issueProject
], ],
"project_manager" => $projectManager, "project_manager" => $projectManager,
"project_risk" => $riskProject, "project_risk" => $projectRisk,
"project_issue" => $projectIssue, "project_issue" => $projectIssue,
"gantt"=> $ganttData "gantt"=> $ganttData
]; ];

Loading…
Cancel
Save