Browse Source

Merge pull request 'Hotfix hirarki ftth' (#29) from dev-wahyu into staging

Reviewed-on: ordo/adw-backend#29
pull/3/head
ibnu 2 years ago
parent
commit
3ab89ffc77
  1. 15
      app/Http/Controllers/HierarchyFtthController.php

15
app/Http/Controllers/HierarchyFtthController.php

@ -140,8 +140,21 @@ class HierarchyFtthController extends Controller
$data = HierarchyFtth::where('project_id', $project_id)->whereNull('parent_id')->orderByRaw('id ASC')->get(); $data = HierarchyFtth::where('project_id', $project_id)->whereNull('parent_id')->orderByRaw('id ASC')->get();
$finalData = []; $finalData = [];
foreach($data as $objRow){ foreach($data as $objRow){
$objRow->children = $this->getChildren($project_id, $objRow->id);
$objRow->key = rand(1, 1000); $objRow->key = rand(1, 1000);
if (VersionGantt::where('hierarchy_ftth_id', $objRow->id)->exists()) {
$dataGantt = VersionGantt::where('hierarchy_ftth_id', $objRow->id)->get();
$progress = $this->ganttProgress('hierarchy_ftth_id', $objRow->id);
foreach ($dataGantt as $gantt) {
$gantt->key = $objRow->key;
foreach ($progress as $p) {
if ($p->id == $gantt->id) {
$gantt->progress = $p->persentase_progress;
}
}
}
$objRow->dataGantt = $dataGantt;
}
$objRow->children = $this->getChildren($project_id, $objRow->id);
$finalData[] = $objRow; $finalData[] = $objRow;
} }

Loading…
Cancel
Save