Browse Source

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

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

37
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();
$arr = [];
foreach($projectData as $project) {
$projectRisk = ProjectRisks::query() $projectRisk = ProjectRisks::query()
->select('proyek_id','description','level_risk','preventive_risk') ->select('proyek_id','description','level_risk','preventive_risk')
->get(); ->where('proyek_id', $project['id'])
->get()
->toArray();
$projectIssue = ProjectIssues::query() $projectIssue = ProjectIssues::query()
->select('proyek_id','description','level_issue') ->select('proyek_id','description','level_issue')
->get(); ->where('proyek_id',$project['id'])
->get()
$arr = []; ->toArray();
foreach($projectData as $project) {
$riskProject = [];
$issueProject = [];
foreach ($projectRisk as $risk) {
if ($risk['proyek_id'] === $project['id']) {
$riskProject[] = [
'level_risk' => $risk['level_risk'],
'preventive_risk' => $risk['preventive_risk'],
'description' => $risk['description']
];
}
}
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