|
|
|
@ -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) |
|
|
|
|
{ |
|
|
|
|