Browse Source

update count hierarchy

pull/1/head
wahyu 11 months ago
parent
commit
acb7a56a3c
  1. 9
      app/Console/Commands/CalculateProgressGantt.php
  2. 9
      app/Http/Controllers/HierarchyFtthController.php
  3. 1
      routes/web.php

9
app/Console/Commands/CalculateProgressGantt.php

@ -19,13 +19,10 @@ class CalculateProgressGantt extends Command
$hierarchy = HierarchyFtth::findOrFail($hierarchy_id);
$project = Project::find($hierarchy->project_id);
$project->calculation_status = true;
$project->save();
$data = MasterFunctionsHelper::CalculateSCurve(null, $hierarchy_id);
$project->scurve = json_encode($data);
$project->calculation_status = true;
$project->save();
$hierarchy->bobot_planning = end($data[0]['data']['percentagePlan']);
$hierarchy->progress = end($data[0]['data']['percentageReal']);
$hierarchy->save();
}
}

9
app/Http/Controllers/HierarchyFtthController.php

@ -189,7 +189,6 @@ class HierarchyFtthController extends Controller
$finalData = [];
foreach($data as $objRow){
$objRow->key = rand(1, 1000);
$this->countProgress(intval($objRow->id));
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);
@ -210,7 +209,13 @@ class HierarchyFtthController extends Controller
return response()->json(['status'=>'success','data'=>$finalData,'code'=>200], 200);
}
public function countProgressTree($hierarchy_id)
{
Artisan::call('calculate:progressgantt', [
'hierarchy_id' => $hierarchy_id
]);
return response()->json(['status'=>'success','code'=>200], 200);
}
private function getChildren($project_id, $parent_id)
{
$finalData = [];

1
routes/web.php

@ -491,6 +491,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/count-tree/{hierarchy_id}', 'HierarchyFtthController@countProgressTree');
$router->get('/hierarchy-ftths/tree-gantt/{gantt_id}', 'HierarchyFtthController@getTreeByGantt');
$router->post('/map-monitoring/search', 'MapMonitoringController@search');

Loading…
Cancel
Save