Browse Source

bug fix

modified:   app/Http/Controllers/ActivityController.php
	modified:   app/Http/Controllers/ProjectPhaseController.php
pull/3/head
Yusuf 2 years ago
parent
commit
c7a00e2401
  1. 411
      app/Http/Controllers/ActivityController.php
  2. 91
      app/Http/Controllers/ProjectPhaseController.php

411
app/Http/Controllers/ActivityController.php

@ -132,12 +132,11 @@ class ActivityController extends Controller
'created_by'=>$this->currentName, 'created_by'=>$this->currentName,
]); ]);
$resultTypeProject = TemplateGantt::where('proyek_type_id',$project $resultTypeProject = TemplateGantt::where('proyek_type_id', $project->type_proyek_id)
->type_proyek_id)
->whereNull('parent_id') ->whereNull('parent_id')
->orderByRaw('id ASC') ->orderByRaw('id ASC')
->get(); ->get();
foreach($resultTypeProject as $objRow){ foreach($resultTypeProject as $objRow){
$childActivities = TemplateGantt::where("parent_id", $objRow->id)->count(); $childActivities = TemplateGantt::where("parent_id", $objRow->id)->count();
$resultNew = Activity::create([ $resultNew = Activity::create([
@ -150,13 +149,13 @@ class ActivityController extends Controller
'end_date'=>date("Y-m-d H:i:s"), 'end_date'=>date("Y-m-d H:i:s"),
'created_by'=>$this->currentName 'created_by'=>$this->currentName
]); ]);
$this->getChildrenTemplate($id, $objRow->id, $project->type_project_id ,$proyek_id, $resultNew->id, $project->mulai_proyek); $this->getChildrenTemplate($id, $objRow->id, $project->type_project_id, $proyek_id, $resultNew->id, $project->mulai_proyek);
} }
} }
private function getChildrenTemplate($id, $parent_id, $type_proyek_id, $proyek_id, $parent_new, $firstDay) private function getChildrenTemplate($id, $parent_id, $type_proyek_id, $proyek_id, $parent_new, $firstDay)
{ {
$data = TemplateGantt::where('proyek_type_id', $type_proyek_id)->where('parent_id', $parent_id)->orderByRaw('id ASC')->get(); $data = TemplateGantt::where('parent_id', $parent_id)->orderByRaw('id ASC')->get();
foreach($data as $objRow){ foreach($data as $objRow){
$childActivities = TemplateGantt::where("parent_id", $objRow->id)->count(); $childActivities = TemplateGantt::where("parent_id", $objRow->id)->count();
$resultNew = Activity::create([ $resultNew = Activity::create([
@ -401,208 +400,224 @@ class ActivityController extends Controller
} }
$dataFinal=[]; $dataFinal=[];
foreach ($allGantt as $keyGantt) { foreach ($allGantt as $keyGantt) {
$dataProject = Project::find($keyGantt['proyek_id']); $dataProject = Project::find($keyGantt['proyek_id']);
$dataHeader = Activity::where('type_activity', 'header')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['last_gantt_id'])->first(); $dataHeader = Activity::where('type_activity', 'header')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['last_gantt_id'])->first();
if($dataHeader){ if($dataHeader){
$totalRencanaBudget = Activity::where('parent_id', $dataHeader->id)->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['last_gantt_id'])->sum("rencana_biaya"); $totalRencanaBudget = Activity::where('parent_id', $dataHeader->id)->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['last_gantt_id'])->sum("rencana_biaya");
}else{ }else{
$totalRencanaBudget = Activity::whereNull('parent_id')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['last_gantt_id'])->sum("rencana_biaya"); $totalRencanaBudget = Activity::whereNull('parent_id')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['last_gantt_id'])->sum("rencana_biaya");
}
}
if(!Activity::where("version_gantt_id", $keyGantt['last_gantt_id'])->first())
$minDate = DB::table('assign_material_to_activity as ama') continue;
->where("ama.proyek_id", $keyGantt['proyek_id'])
->join('m_activity as a', 'a.id', '=', 'ama.activity_id') $alreadyHasReport = DB::table('report_activity_material as a')
->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) ->select('a.id')
->min("plan_date"); ->join('m_activity as b', 'b.id', '=', 'a.activity_id')
->where('b.version_gantt_id', '=', $keyGantt['last_gantt_id'])
$maxDate = DB::table('assign_material_to_activity as ama') ->exists();
->where("ama.proyek_id", $keyGantt['proyek_id'])
->join('m_activity as a', 'a.id', '=', 'ama.activity_id') if(!$alreadyHasReport)
->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) continue;
->max("plan_date");
$minDate = DB::table('assign_material_to_activity as ama')
$begin = new \DateTime($minDate); ->where("ama.proyek_id", $keyGantt['proyek_id'])
$end = new \DateTime($maxDate); ->join('m_activity as a', 'a.id', '=', 'ama.activity_id')
$end2 = new \DateTime($maxDate); ->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id'])
$interval = \DateInterval::createFromDateString('1 day'); ->min("plan_date");
$period = new \DatePeriod($begin, $interval, $end);
$arr_ActualM = []; $maxDate = DB::table('assign_material_to_activity as ama')
$tempDate = []; ->where("ama.proyek_id", $keyGantt['proyek_id'])
$tempPercentage = []; ->join('m_activity as a', 'a.id', '=', 'ama.activity_id')
$tempTtlPercentPlan=0; ->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id'])
$tempTtlPercentActual=0; ->max("plan_date");
$currentACWP = 0; $begin = new \DateTime($minDate);
$budgetControlACWP = 0; $end = new \DateTime($maxDate);
$currentProgressActivity = 0; $end2 = new \DateTime($maxDate);
$currentBCWP = 0; $interval = \DateInterval::createFromDateString('1 day');
$budgetControlBCWP = 0; $period = new \DatePeriod($begin, $interval, $end);
$arr_ActualM = [];
foreach ($period as $dt) { $tempDate = [];
$tempPercentage = [];
$dataPlanM = DB::table('assign_material_to_activity as ama') $tempTtlPercentPlan=0;
->select('ama.activity_id', 'ama.qty_planning', 'ama.plan_date', 'ama.start_activity', 'a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress') $tempTtlPercentActual=0;
->join('m_activity as a', 'a.id', '=', 'ama.activity_id')
->where('ama.proyek_id', '=', $keyGantt['proyek_id']) $currentACWP = 0;
->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) $budgetControlACWP = 0;
->whereDate('ama.plan_date', $dt->format("Y-m-d")) $currentProgressActivity = 0;
->get(); $currentBCWP = 0;
$dataActualM = DB::table('report_activity_material as ram') $budgetControlBCWP = 0;
->select('ram.activity_id', 'ram.qty', 'ram.report_date', 'a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress')
->join('m_activity as a', 'a.id', '=', 'ram.activity_id') foreach ($period as $dt) {
->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) $dataPlanM = DB::table('assign_material_to_activity as ama')
->where('a.proyek_id', '=', $keyGantt['proyek_id']) ->select('ama.activity_id', 'ama.qty_planning', 'ama.plan_date', 'ama.start_activity', 'a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress')
->whereDate('ram.report_date', $dt->format("Y-m-d")) ->join('m_activity as a', 'a.id', '=', 'ama.activity_id')
->get(); ->where('ama.proyek_id', '=', $keyGantt['proyek_id'])
$dataTempPlan = []; ->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id'])
$x = 0; ->whereDate('ama.plan_date', $dt->format("Y-m-d"))
$sumPercentagePlan=0; ->get();
$totalACWP = isset($totalACWP) ? $totalACWP : 0; $dataActualM = DB::table('report_activity_material as ram')
$totalBCWP = isset($totalBCWP) ? $totalBCWP : 0; ->select('ram.activity_id', 'ram.qty', 'ram.report_date', 'a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress')
->join('m_activity as a', 'a.id', '=', 'ram.activity_id')
foreach ($dataPlanM as $keyPlanM) { ->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id'])
$sumVolPlan = DB::table('assign_material_to_activity') ->where('a.proyek_id', '=', $keyGantt['proyek_id'])
->select('activity_id', DB::raw('SUM(qty_planning) as ttl_qty_plan')) ->whereDate('ram.report_date', $dt->format("Y-m-d"))
->where('activity_id', '=', $keyPlanM->activity_id) ->get();
->groupBy('activity_id') $dataTempPlan = [];
->first(); $x = 0;
$dataTempPlan [$x]['activity_id'] = $keyPlanM->activity_id; $sumPercentagePlan=0;
$dataTempPlan [$x]['qty_plan'] = $keyPlanM->qty_planning; $totalACWP = isset($totalACWP) ? $totalACWP : 0;
$dataTempPlan [$x]['plan_date'] = $keyPlanM->plan_date; $totalBCWP = isset($totalBCWP) ? $totalBCWP : 0;
$dataTempPlan [$x]['start_activity'] = $keyPlanM->start_activity;
$dataTempPlan [$x]['bobot_planning'] = $keyPlanM->bobot_planning; foreach ($dataPlanM as $keyPlanM) {
$dataTempPlan [$x]['ttl_plan'] = $sumVolPlan->ttl_qty_plan; $sumVolPlan = DB::table('assign_material_to_activity')
$dataTempPlan [$x]['biaya_actual'] = $keyPlanM->biaya_actual; ->select('activity_id', DB::raw('SUM(qty_planning) as ttl_qty_plan'))
$dataTempPlan [$x]['duration'] = $keyPlanM->duration; ->where('activity_id', '=', $keyPlanM->activity_id)
$dataTempPlan [$x]['persentase_progress'] = $keyPlanM->persentase_progress; ->groupBy('activity_id')
$dataTempPlan [$x]['percentage'] = ($keyPlanM->qty_planning/$sumVolPlan->ttl_qty_plan)*$keyPlanM->bobot_planning; ->first();
$dataTempPlan [$x]['activity_id'] = $keyPlanM->activity_id;
$sumPercentagePlan+=($keyPlanM->qty_planning/$sumVolPlan->ttl_qty_plan)*$keyPlanM->bobot_planning; $dataTempPlan [$x]['qty_plan'] = $keyPlanM->qty_planning;
try { $dataTempPlan [$x]['plan_date'] = $keyPlanM->plan_date;
$totalBCWP += (((($keyPlanM->persentase_progress*$keyPlanM->bobot_planning)/100)/$keyPlanM->duration)* $totalRencanaBudget)/100; $dataTempPlan [$x]['start_activity'] = $keyPlanM->start_activity;
$dataTempPlan [$x]['totalBCWP'] = $totalBCWP; $dataTempPlan [$x]['bobot_planning'] = $keyPlanM->bobot_planning;
$x++; $dataTempPlan [$x]['ttl_plan'] = $sumVolPlan->ttl_qty_plan;
} catch (\Exception $e) { $dataTempPlan [$x]['biaya_actual'] = $keyPlanM->biaya_actual;
return response()->json(['message' => $e->getMessage(), $dataTempPlan [$x]['duration'] = $keyPlanM->duration;
'data' => $keyPlanM->persentase_progress, $dataTempPlan [$x]['persentase_progress'] = $keyPlanM->persentase_progress;
'data2' => $keyPlanM->bobot_planning, $dataTempPlan [$x]['percentage'] = ($keyPlanM->qty_planning/$sumVolPlan->ttl_qty_plan)*$keyPlanM->bobot_planning;
'data3' => $keyPlanM->duration, $sumPercentagePlan+=($keyPlanM->qty_planning/$sumVolPlan->ttl_qty_plan)*$keyPlanM->bobot_planning;
'data4' => $totalRencanaBudget, $totalBCWP += (((($keyPlanM->persentase_progress*$keyPlanM->bobot_planning)/100)/$keyPlanM->duration)* $totalRencanaBudget)/100;
'data5' => $keyPlanM, $dataTempPlan [$x]['totalBCWP'] = $totalBCWP;
]); $x++;
} }
}
$w = 0;
$w = 0; $dataTempReport = [];
$dataTempReport = []; $sumPercentageActual=0;
$sumPercentageActual=0; foreach ($dataActualM as $keyActualM) {
foreach ($dataActualM as $keyActualM) { $sumVolActual = DB::table('assign_material_to_activity')
$sumVolActual = DB::table('assign_material_to_activity') ->select('activity_id', DB::raw('SUM(qty_planning) as ttl_qty_plan'))
->select('activity_id', DB::raw('SUM(qty_planning) as ttl_qty_plan')) ->where('activity_id', '=', $keyActualM->activity_id)
->where('activity_id', '=', $keyActualM->activity_id) ->groupBy('activity_id')
->groupBy('activity_id') ->first();
->first(); $dataTempReport [$w]['activity_id'] = $keyActualM->activity_id;
$dataTempReport [$w]['activity_id'] = $keyActualM->activity_id; $dataTempReport [$w]['qty'] = $keyActualM->qty;
$dataTempReport [$w]['qty'] = $keyActualM->qty; $dataTempReport [$w]['report_date'] = $keyActualM->report_date;
$dataTempReport [$w]['report_date'] = $keyActualM->report_date; $dataTempReport [$w]['bobot_planning'] = $keyActualM->bobot_planning;
$dataTempReport [$w]['bobot_planning'] = $keyActualM->bobot_planning; $dataTempReport [$w]['ttl_plan'] = $sumVolActual->ttl_qty_plan;
$dataTempReport [$w]['ttl_plan'] = $sumVolActual->ttl_qty_plan; $dataTempReport [$w]['biaya_actual'] = $keyActualM->biaya_actual;
$dataTempReport [$w]['biaya_actual'] = $keyActualM->biaya_actual; $dataTempReport [$w]['duration'] = $keyActualM->duration;
$dataTempReport [$w]['duration'] = $keyActualM->duration; $dataTempReport [$w]['persentase_progress'] = $keyActualM->persentase_progress;
$dataTempReport [$w]['persentase_progress'] = $keyActualM->persentase_progress; $dataTempReport [$w]['percentage'] = ($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning;
$dataTempReport [$w]['percentage'] = ($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning;
$sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; try {
$totalACWP += $keyActualM->biaya_actual/$keyActualM->duration; $totalACWP += $keyActualM->biaya_actual/$keyActualM->duration;
$dataTempReport [$w]['totalacwp'] = $totalACWP; } catch (\Exception $e) {
$w++; return response()->json(['message' => $e->getMessage()]);
} }
$dataTempReport [$w]['totalacwp'] = $totalACWP;
$arr_ActualM[] = array( $w++;
'date'=>$dt->format("Y-m-d"), }
'percentPlan'=>$sumPercentagePlan,
'percentActual'=>$sumPercentageActual, $arr_ActualM[] = array(
'plan'=>$dataTempPlan, 'date'=>$dt->format("Y-m-d"),
'actual'=>$dataTempReport, 'percentPlan'=>$sumPercentagePlan,
); 'percentActual'=>$sumPercentageActual,
'plan'=>$dataTempPlan,
if(isset($dataPayload['period']) && $dataPayload['period'] == 'week'){ 'actual'=>$dataTempReport,
if($dt->format("w")==1){ );
if($totalACWP > 0 ){ if(isset($dataPayload['period']) && $dataPayload['period'] == 'week'){
$budgetControlACWP = $currentACWP + $totalACWP; if($dt->format("w")==1){
} if($totalACWP > 0 ){
if($totalBCWP > 0 ){ $budgetControlACWP = $currentACWP + $totalACWP;
$budgetControlBCWP = $currentBCWP + $totalBCWP; }
} if($totalBCWP > 0 ){
$budgetControlBCWP = $currentBCWP + $totalBCWP;
$tempTtlPercentPlan+= $sumPercentagePlan; }
$tempTtlPercentActual+= $sumPercentageActual;
$currentACWP += $totalACWP; $tempTtlPercentPlan+= $sumPercentagePlan;
$currentBCWP += $totalBCWP; $tempTtlPercentActual+= $sumPercentageActual;
$currentACWP += $totalACWP;
$tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2)); $currentBCWP += $totalBCWP;
$tempDate[] = array($dt->format("Y-m-d"), 0, 0);
}else if($dt->format("Y-m-d") == $end2->format("Y-m-d")) { $tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2));
// error here $tempDate[] = array($dt->format("Y-m-d"), 0, 0);
$tempTtlPercentPlan+= $sumPercentagePlan; }else if($dt->format("Y-m-d") == $end2->format("Y-m-d")) {
$tempTtlPercentActual+= $sumPercentageActual; $tempTtlPercentPlan+= $sumPercentagePlan;
$currentACWP += $totalACWP; $tempTtlPercentActual+= $sumPercentageActual;
$currentBCWP += $totalBCWP; $currentACWP += $totalACWP;
$currentBCWP += $totalBCWP;
$tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2));
$tempDate[] = array($dt->format("Y-m-d"), 0, 0); $tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2));
$tempTtlPercentPlan = 0; $tempDate[] = array($dt->format("Y-m-d"), 0, 0);
$tempTtlPercentActual = 0; $tempTtlPercentPlan = 0;
} $tempTtlPercentActual = 0;
}else{ }
$tempPercentage[] = array(round($sumPercentagePlan,2), round($sumPercentageActual,2)); }else{
$tempDate[] = array($dt->format("Y-m-d"), 0, 0); $tempPercentage[] = array(round($sumPercentagePlan,2), round($sumPercentageActual,2));
} $tempDate[] = array($dt->format("Y-m-d"), 0, 0);
} }
}
try {
if(round($totalACWP,0) > $totalRencanaBudget){ if(round($totalACWP,0) > $totalRencanaBudget){
$estimatedCost = round($totalACWP,0)+0; $estimatedCost = round($totalACWP,0)+0;
}else{ }else{
$estimatedCost = ($totalRencanaBudget+0); $estimatedCost = ($totalRencanaBudget+0);
} }
$costDeviation = $totalRencanaBudget - $estimatedCost; } catch (\Exception $e) {
if($costDeviation > 0){ return response()->json([
$potential = "SAVING"; 'message' => $e->getMessage(),
} else { "line" => 566,
$potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN"; 'gantt' => $keyGantt,
} ]);
}
$dataResponse = array( //$estimatedCost = $totalACWP > $totalRencanaBudget ? $totalACWP : $totalRencanaBudget;
"date" =>$tempDate,
"percentage" =>$tempPercentage, $costDeviation = $totalRencanaBudget - $estimatedCost;
"data_details" =>$arr_ActualM, if($costDeviation > 0){
"budget_control" =>array("current_budget"=> $totalRencanaBudget, $potential = "SAVING";
"acwp" => round($totalACWP,0), } else {
"bcwp" => round($totalBCWP,0), $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN";
"rem_to_complete" => ($totalRencanaBudget - round($totalACWP,0)), }
"add_cost_to_complete" => 0,
"estimated_at_completion" => $estimatedCost, $dataResponse = array(
"cost_deviation" => $costDeviation, "date" =>$tempDate,
"potential" => $potential, "percentage" =>$tempPercentage,
) "data_details" =>$arr_ActualM,
); "budget_control" =>array("current_budget"=> $totalRencanaBudget,
"acwp" => round($totalACWP,0),
$dataFinal[] = array( "bcwp" => round($totalBCWP,0),
"proyek_name"=> $dataProject->nama, "rem_to_complete" => ($totalRencanaBudget - round($totalACWP,0)),
"data"=>$dataResponse, "add_cost_to_complete" => 0,
"allGant"=>$allGantt "estimated_at_completion" => $estimatedCost,
); "cost_deviation" => $costDeviation,
"potential" => $potential,
return response()->json(['status'=>'success','code'=>200, 'data' => $dataFinal], 200); )
);
$dataFinal[] = array(
"proyek_name"=> $dataProject->nama,
"data"=>$dataResponse,
"allGant"=>$allGantt
);
} }
return response()->json(['status'=>'success','code'=>200, 'data' => $dataFinal], 200);
} }
private function getLatestGantt($id){ private function getLatestGantt($id){
return array( $maxGanttId = VersionGantt::where("proyek_id", $id)->max("id");
"last_gantt_id" => VersionGantt::where("proyek_id", $id)->max("id"), $data = array(
"proyek_id" => $id "last_gantt_id" => $maxGanttId,
); "proyek_id" => $id
);
return $data;
} }
public function setBaseline($gantt_id) public function setBaseline($gantt_id)

91
app/Http/Controllers/ProjectPhaseController.php

@ -1,4 +1,3 @@
<<<<<<< HEAD
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers;
@ -82,92 +81,4 @@ class ProjectPhaseController extends Controller
return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200); return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200);
} }
} }
=======
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\ProjectPhase;
class ProjectPhaseController extends Controller
{
public function add(Request $request)
{
$this->validate($request, [
'name' => 'required',
]);
$data = $request->all();
$data['created_by'] = $this->currentName;
if(!ProjectPhase::create($data))
return response()->json(['status'=>'failed','message'=>'Failed to add data','code'=> 500], 500);
return response()->json(['status'=>'success','message'=>'data added!','code'=>200], 200);
}
public function edit($id){
if(!$id || (int) $id < 0 || $id=="")
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400);
if(!$result = ProjectPhase::find($id))
return response()->json(['status'=>'failed','message'=>'Failed to get data!','code'=> 404], 404);
return response()->json(['status'=>'success','code'=>200,'data'=>$result], 200);
}
public function update(Request $request, $id)
{
if(!$id || (int) $id < 0 || $id=="")
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400);
if(!$data = ProjectPhase::find($id))
return response()->json(['status'=>'failed','message'=>'data role not found!','code'=>400], 400);
if(!$data->update($request->all()))
return response()->json(['status'=>'failed','message'=>'data project type failed updated!','code'=>400], 400);
return response()->json(['status'=>'success','message'=>'data project type successfully updated!','code'=>200], 200);
}
public function delete($id)
{
if(!$data = ProjectPhase::find($id))
return response()->json(['status'=>'failed','message'=>'data project type not found!','code'=>400], 400);
if(!$data->delete())
return response()->json(['status'=>'failed','message'=>'data project type failed deleted!','code'=>400], 400);
return response()->json(['status'=>'success','message'=>'data project type successfully deleted!','code'=>200], 200);
}
public function search(Request $request)
{
$payload = $request->all();
dd($payload);
$dataBuilder = $this->setUpPayload($payload, 'm_proyek_phase');
$builder = $dataBuilder['builder'];
$countBuilder = $dataBuilder['count'];
$dataGet = $builder->get();
$totalRecord = $countBuilder->count();
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200);
}
public function list()
{
$data = ProjectPhase::all();
$countData = $data->count();
if(!$data)
return response()->json(['status'=>'failed','message'=>'failed get list project type, please try again later!','code'=>400], 400);
return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200);
}
}
>>>>>>> 3ef5875 (Dashboard PMO & Project Phase)
Loading…
Cancel
Save