Browse Source

Merge pull request 'staging upload 23-05-22' (#61) from staging into master

Reviewed-on: ordo/adw-backend#61
pull/3/head
ibnu 1 year ago
parent
commit
714937d037
  1. 2
      app/Helpers/MasterFunctionsHelper.php
  2. 24
      app/Http/Controllers/HierarchyFtthController.php
  3. 1
      routes/web.php

2
app/Helpers/MasterFunctionsHelper.php

@ -225,7 +225,7 @@ class MasterFunctionsHelper {
// $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; // $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning;
// if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ // if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){
if($checkStatusActivity->status_activity == 'done'){ 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; // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual;
}else{ }else{
if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){

24
app/Http/Controllers/HierarchyFtthController.php

@ -150,6 +150,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) public function getTreeByProject($project_id)
{ {
$this->countProgress(intval($project_id)); $this->countProgress(intval($project_id));

1
routes/web.php

@ -448,6 +448,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout
$router->put('/hierarchy-ftths/{id}', 'HierarchyFtthController@update'); $router->put('/hierarchy-ftths/{id}', 'HierarchyFtthController@update');
$router->delete('/hierarchy-ftths/{id}', 'HierarchyFtthController@destroy'); $router->delete('/hierarchy-ftths/{id}', 'HierarchyFtthController@destroy');
$router->get('/hierarchy-ftths/tree/{project_id}', 'HierarchyFtthController@getTreeByProject'); $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'); $router->post('/map-monitoring/search', 'MapMonitoringController@search');
}); });

Loading…
Cancel
Save