From 05e34cb66d49da293cdd722f4e2845bd1382267b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 22 May 2023 08:44:40 +0700 Subject: [PATCH 1/2] Gantt ftth parents --- .../Controllers/HierarchyFtthController.php | 24 +++++++++++++++++++ routes/web.php | 1 + 2 files changed, 25 insertions(+) diff --git a/app/Http/Controllers/HierarchyFtthController.php b/app/Http/Controllers/HierarchyFtthController.php index 388bb2a..6df56a9 100644 --- a/app/Http/Controllers/HierarchyFtthController.php +++ b/app/Http/Controllers/HierarchyFtthController.php @@ -149,6 +149,30 @@ class HierarchyFtthController extends Controller } } } + + public function getTreeByGantt($gantt_id) + { + $finalData = []; + $gantt = VersionGantt::find($gantt_id); + if ($gantt->hierarchy_ftth_id) { + $ftth = HierarchyFtth::find($gantt->hierarchy_ftth_id); + array_push($finalData, $ftth); + if($ftth->parent_id){ + $this->getParents($finalData, $ftth->parent_id); + } + } else { + return response()->json(['status'=>'success','data'=>$finalData,'code'=>200], 200); + } + return response()->json(['status'=>'success','data'=>$finalData,'code'=>200], 200); + } + + public function getParents(&$data, $id){ + $ftth = HierarchyFtth::find($id); + array_push($data, $ftth); + if ($ftth->parent_id) { + $this->getParents($data, $ftth->parent_id); + } + } public function getTreeByProject($project_id) { diff --git a/routes/web.php b/routes/web.php index eb8fe09..d2861e8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -448,6 +448,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout $router->put('/hierarchy-ftths/{id}', 'HierarchyFtthController@update'); $router->delete('/hierarchy-ftths/{id}', 'HierarchyFtthController@destroy'); $router->get('/hierarchy-ftths/tree/{project_id}', 'HierarchyFtthController@getTreeByProject'); + $router->get('/hierarchy-ftths/tree-gantt/{gantt_id}', 'HierarchyFtthController@getTreeByGantt'); $router->post('/map-monitoring/search', 'MapMonitoringController@search'); }); From 02eff6fb8cc629c85a16c10e3e532335c224cde0 Mon Sep 17 00:00:00 2001 From: ibnu Date: Mon, 22 May 2023 14:17:13 +0700 Subject: [PATCH 2/2] fix curva S site --- app/Helpers/MasterFunctionsHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 96a61d2..96311e1 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -225,7 +225,7 @@ class MasterFunctionsHelper { // $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; // if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ if($checkStatusActivity->status_activity == 'done'){ - $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; + $sumPercentageActual+=$keyActualM->bobot_planning; // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; }else{ if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ @@ -271,7 +271,7 @@ class MasterFunctionsHelper { // $tempTtlPercentPlan = 100; if($tempTtlPercentActual >= $keyGantt['progress']) - $tempTtlPercentActual = $keyGantt['progress']; + $tempTtlPercentActual = $keyGantt['progress']; if($tempTtlPercentPlan >= 100) $tempTtlPercentPlan = 100; // $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual