diff --git a/app/Console/Commands/syncHumanResourceIntegration.php b/app/Console/Commands/syncHumanResourceIntegration.php new file mode 100644 index 0000000..7b4ef5f --- /dev/null +++ b/app/Console/Commands/syncHumanResourceIntegration.php @@ -0,0 +1,77 @@ +message != 'success') + return; + + if(!is_int($response->total) || $response->total == 0) + return; + + $totalPage = $response->last_page; + echo "\nTotal Page = " . $totalPage; + $currentResponse = $response; + for($i = 1; $i <= $totalPage; $i++){ + echo "\nCurrent Page = " . $i; + $employeesPageData = $currentResponse->data; + foreach($employeesPageData as $employee){ + HumanResource::firstOrCreate( + ['ktp_number' => $employee->emp_id], + [ + 'name' => $employee->name, + 'employee_type' => 'employee', + 'status_resource' => 'active', + 'role_id' => 24, + 'created_by' => 'integration' + ], + ); + } + echo "\n------------------------------------------\n"; + $currentResponse = MasterFunctionsHelper::curlReq(str_replace('1', $i, $url)); + } + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index cdba880..a379d80 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -13,6 +13,7 @@ class Kernel extends ConsoleKernel * @var array */ protected $commands = [ + Commands\syncHumanResourceIntegration::class ]; /** @@ -23,5 +24,7 @@ class Kernel extends ConsoleKernel */ protected function schedule(Schedule $schedule) { - } + $schedule->command('sync:integration-human-resources')->twiceDaily(); + } + } diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php new file mode 100644 index 0000000..a5092cf --- /dev/null +++ b/app/Helpers/MasterFunctionsHelper.php @@ -0,0 +1,519 @@ +max("id"); + $data = array( + "last_gantt_id" => $maxGanttId, + "proyek_id" => $id + ); + return $data; + } + + // dipake di dashboard project & bod + public function getSCurve($request){ + $allGantt = []; + if(!is_int($request)){ + $dataPayload = $request->all(); + if(isset($dataPayload['gantt_id'])){ + $allGantt = $dataPayload['gantt_id']; + }else{ + $allGantt[] = MasterFunctionsHelper::getLatestGantt($dataPayload['project_id']); + } + } else { + $allGantt[] = MasterFunctionsHelper::getLatestGantt($request); + } + foreach($allGantt as $gantt){ + $gantt = VersionGantt::where('id', $gantt['last_gantt_id'])->first()->toArray(); + if($gantt['calculation_type'] == 'simple') { + // to do + return MasterFunctionsHelper::calculateProgressBasedOnSimple($gantt); + } else { + return MasterFunctionsHelper::calculateProgressBasedOnReportMaterial($gantt); + } + } + } + + public function calculateProgressBasedOnReportMaterial($keyGantt) + { + DB::enableQueryLog(); + + $dataFinal=[]; + $dataPayload = []; + $dataPayload['period'] = 'week'; + + $dataProject = Project::find($keyGantt['proyek_id']); + $dataHeader = Activity::where('type_activity', 'header')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['id'])->first(); + if(isset($dataPayload['end_date']) && $dataPayload['end_date'] > $dataProject->akhir_proyek){ + $dataPayload['end_date'] = $dataProject->akhir_proyek; + } + + if($dataHeader){ + $totalRencanaBudget = Activity::where('parent_id', $dataHeader->id)->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['id'])->sum("rencana_biaya"); + }else{ + $totalRencanaBudget = Activity::whereNull('parent_id')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['id'])->sum("rencana_biaya"); + } + + if(!Activity::where("version_gantt_id", $keyGantt['id'])->first()) + return $dataFinal; + + $alreadyHasReport = DB::table('report_activity_material as a') + ->select('a.id') + ->join('m_activity as b', 'b.id', '=', 'a.activity_id') + ->where('b.version_gantt_id', '=', $keyGantt['id']) + ->exists(); + + if(!$alreadyHasReport) + return $dataFinal; + + $minDate = Activity::where('version_gantt_id', $keyGantt['id'])->whereNull('parent_id')->pluck('start_date')->first(); + + $begin = new \DateTime($minDate.' Monday'); + if(isset($dataPayload['end_date'])){ + $maxDate = $dataPayload['end_date']; + $end = new \DateTime($maxDate); + /* $interval = \DateInterval::createFromDateString('1 day'); */ // should be using this but its bugged + $interval = new \DateInterval('P7D'); + } else { + $maxDate = DB::table('assign_material_to_activity as ama') + ->where("ama.proyek_id", $keyGantt['proyek_id']) + ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') + ->where('a.version_gantt_id', '=', $keyGantt['id']) + ->max("plan_date"); // plan date overlapped with assign_material_to_activity's, it should be m_activity's + $end = new \DateTime($maxDate. ' Friday'); + $interval = new \DateInterval('P7D'); + } + $period = new \DatePeriod($begin, $interval, $end); + + $arr_ActualM = []; + $tempDate = []; + $tempPercentagePlan = []; + $tempPercentagePlanWhr = []; + $tempPercentageReal = []; + $tempTtlPercentPlan=0; + $tempTtlPercentActual=0; + + $currentACWP = 0; + $currentBCWP = 0; + + foreach ($period as $dt) { + $minSevenDays = new \Datetime($dt->format("Y-m-d")); + $minSevenDays = $minSevenDays->modify('-7 day')->format("Y-m-d"); + $dataPlanM = DB::table('assign_material_to_activity as ama') + ->select('ama.activity_id', 'ama.qty_planning', 'ama.plan_date', 'ama.start_activity', 'a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress') + ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') + ->where('ama.proyek_id', '=', $keyGantt['proyek_id']) + ->where('a.version_gantt_id', '=', $keyGantt['id']) + ->whereDate('ama.plan_date', '<=',$dt->format("Y-m-d")) + ->whereDate('ama.plan_date', '>', $minSevenDays) + ->get(); + $dataActualM = DB::table('report_activity_material as ram') + ->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') + ->where('a.version_gantt_id', '=', $keyGantt['id']) + ->where('a.proyek_id', '=', $keyGantt['proyek_id']) + ->whereDate('ram.report_date', '<=',$dt->format("Y-m-d")) + ->whereDate('ram.report_date', '>',$minSevenDays) + ->get(); + $dataTempPlan = []; + $x = 0; + $sumPercentagePlan=0; + $totalACWP = isset($totalACWP) ? $totalACWP : 0; + $totalBCWP = isset($totalBCWP) ? $totalBCWP : 0; + + foreach ($dataPlanM as $keyPlanM) { + $sumVolPlan = DB::table('assign_material_to_activity') + ->select('activity_id', DB::raw('SUM(qty_planning) as ttl_qty_plan')) + ->where('activity_id', '=', $keyPlanM->activity_id) + ->groupBy('activity_id') + ->first(); + $dataTempPlan [$x]['activity_id'] = $keyPlanM->activity_id; + $dataTempPlan [$x]['qty_plan'] = $keyPlanM->qty_planning; + $dataTempPlan [$x]['plan_date'] = $keyPlanM->plan_date; + $dataTempPlan [$x]['start_activity'] = $keyPlanM->start_activity; + $dataTempPlan [$x]['bobot_planning'] = $keyPlanM->bobot_planning; + $dataTempPlan [$x]['ttl_plan'] = $sumVolPlan->ttl_qty_plan; + $dataTempPlan [$x]['biaya_actual'] = $keyPlanM->biaya_actual; + $dataTempPlan [$x]['duration'] = $keyPlanM->duration; + $dataTempPlan [$x]['persentase_progress'] = $keyPlanM->persentase_progress; + try { + $dataTempPlan [$x]['percentage'] = ($keyPlanM->qty_planning/$sumVolPlan->ttl_qty_plan)*$keyPlanM->bobot_planning; + $sumPercentagePlan+=($keyPlanM->qty_planning/$sumVolPlan->ttl_qty_plan)*$keyPlanM->bobot_planning; + $totalBCWP += (((($keyPlanM->persentase_progress*$keyPlanM->bobot_planning)/100)/$keyPlanM->duration)* $totalRencanaBudget)/100; + $dataTempPlan [$x]['totalBCWP'] = $totalBCWP; + } catch (\DivisionByZeroError $e) { + return response()->json(['message' => $e->getMessage()]); + } + $x++; + } + + $w = 0; + $dataTempReport = []; + $sumPercentageActual=0; + foreach ($dataActualM as $keyActualM) { + $sumVolActual = DB::table('assign_material_to_activity') + ->select('activity_id', DB::raw('SUM(qty_planning) as ttl_qty_plan')) + ->where('activity_id', '=', $keyActualM->activity_id) + ->groupBy('activity_id') + ->first(); + $dataTempReport [$w]['activity_id'] = $keyActualM->activity_id; + $dataTempReport [$w]['qty'] = $keyActualM->qty; + $dataTempReport [$w]['report_date'] = $keyActualM->report_date; + $dataTempReport [$w]['bobot_planning'] = $keyActualM->bobot_planning; + $dataTempReport [$w]['ttl_plan'] = $sumVolActual->ttl_qty_plan; + $dataTempReport [$w]['biaya_actual'] = $keyActualM->biaya_actual; + $dataTempReport [$w]['duration'] = $keyActualM->duration; + $dataTempReport [$w]['persentase_progress'] = $keyActualM->persentase_progress; + try { + $dataTempReport [$w]['percentage'] = ($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; + $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; + $totalACWP += $keyActualM->biaya_actual/$keyActualM->duration; + } catch (\DivisionByZeroError $e) { + return response()->json(['message' => $e->getMessage()]); + } + $dataTempReport [$w]['totalacwp'] = $totalACWP; + $w++; + } + + $arr_ActualM[] = array( + 'date'=>$dt->format("Y-m-d"), + 'percentPlan'=>$sumPercentagePlan, + 'percentActual'=>$sumPercentageActual, + 'plan'=>$dataTempPlan, + 'actual'=>$dataTempReport, + ); + if(isset($dataPayload['period']) && $dataPayload['period'] == 'week'){ + $tempTtlPercentPlan+= $sumPercentagePlan; + $tempTtlPercentActual+= $sumPercentageActual; + + if($tempTtlPercentPlan >= 100 || $tempTtlPercentActual >= 100){ + if($tempTtlPercentActual >= 100) + $tempTtlPercentActual = 100; + if($tempTtlPercentPlan >= 100) + $tempTtlPercentPlan = 100; + } + + $currentACWP += $totalACWP; + $currentBCWP += $totalBCWP; + + $tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2)); + $tempPercentagePlan[] = round($tempTtlPercentPlan, 2); + $tempPercentagePlanWhr[] = ["weekly period", $tempPercentagePlan]; + $tempPercentageReal[] = round($tempTtlPercentActual, 2); + if($tempTtlPercentPlan >= 100 && $tempTtlPercentActual >= 100){ + break; + } + }else{ + $tempPercentage[] = array(round($sumPercentagePlan,2), round($sumPercentageActual,2)); + $tempPercentagePlan[] = round($sumPercentagePlan, 2); + $tempPercentageReal[] = round($sumPercentageActual, 2); + } + $tempDate[] = array($dt->format("Y-m-d")); + } + + try { + if(round($totalACWP,0) > $totalRencanaBudget){ + $estimatedCost = round($totalACWP,0)+0; + }else{ + $estimatedCost = ($totalRencanaBudget+0); + } + } catch (\DivisionByZeroError $e) { + return response()->json([ + 'message' => $e->getMessage(), + "line" => 566, + 'gantt' => $keyGantt, + ]); + } + $estimatedCost = $totalACWP > $totalRencanaBudget ? $totalACWP : $totalRencanaBudget; + + $costDeviation = $totalRencanaBudget - $estimatedCost; + if($costDeviation > 0){ + $potential = "SAVING"; + } else { + $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN"; + } + + $dataResponse = array( + "date" =>$tempDate, + "percentage" =>$tempPercentage, + "percentagePlan" => $tempPercentagePlan, + "percentageReal" => $tempPercentageReal, + "data_details" =>$arr_ActualM, + "budget_control" =>array("current_budget"=> $totalRencanaBudget, + "acwp" => round($totalACWP,0), + "bcwp" => round($totalBCWP,0), + "rem_to_complete" => ($totalRencanaBudget - round($totalACWP,0)), + "add_cost_to_complete" => 0, + "estimated_at_completion" => $estimatedCost, + "cost_deviation" => $costDeviation, + "potential" => $potential, + ) + ); + + $dataFinal[] = array( + "proyek_name"=> $dataProject->nama, + "data"=>$dataResponse, + "gantt"=>$keyGantt + ); + + return $dataFinal; + } + + public function calculateProgressBasedOnSimple($keyGantt){ + DB::enableQueryLog(); + + $dataFinal=[]; + $dataPayload = []; + $dataPayload['period'] = 'week'; + + $dataProject = Project::find($keyGantt['proyek_id']); + $dataHeader = Activity::where('type_activity', 'header')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['id'])->first(); + if(isset($dataPayload['end_date']) && $dataPayload['end_date'] > $dataProject->akhir_proyek){ + $dataPayload['end_date'] = $dataProject->akhir_proyek; + } + + if($dataHeader){ + $totalRencanaBudget = Activity::where('parent_id', $dataHeader->id)->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['id'])->sum("rencana_biaya"); + }else{ + $totalRencanaBudget = Activity::whereNull('parent_id')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['id'])->sum("rencana_biaya"); + } + + if(!Activity::where("version_gantt_id", $keyGantt['id'])->first()) + return $dataFinal; + + // $alreadyHasReport = DB::table('report_activity_material as a') + // ->select('a.id') + // ->join('m_activity as b', 'b.id', '=', 'a.activity_id') + // ->where('b.version_gantt_id', '=', $keyGantt['id']) + // ->exists(); + + // if(!$alreadyHasReport) + // return $dataFinal; + + $minDate = Activity::where('version_gantt_id', $keyGantt['id'])->whereNull('parent_id')->pluck('start_date')->first(); + + $begin = new \DateTime($minDate.' Monday'); + if(isset($dataPayload['end_date'])){ + $maxDate = $dataPayload['end_date']; + $end = new \DateTime($maxDate); + /* $interval = \DateInterval::createFromDateString('1 day'); */ // should be using this but its bugged + $interval = new \DateInterval('P7D'); + } else { + // $maxDate = DB::table('assign_material_to_activity as ama') + // ->where("ama.proyek_id", $keyGantt['proyek_id']) + // ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') + // ->where('a.version_gantt_id', '=', $keyGantt['id']) + // ->max("plan_date"); // plan date overlapped with assign_material_to_activity's, it should be m_activity's + $maxDate = Activity::where('version_gantt_id', $keyGantt['id'])->whereNull('parent_id')->pluck('end_date')->first(); + $end = new \DateTime($maxDate. ' Friday'); + $interval = new \DateInterval('P7D'); + } + $period = new \DatePeriod($begin, $interval, $end); + + $arr_ActualM = []; + $tempDate = []; + $tempPercentagePlan = []; + $tempPercentagePlanWhr = []; + $tempPercentageReal = []; + $tempTtlPercentPlan=0; + $tempTtlPercentActual=0; + + $currentACWP = 0; + $currentBCWP = 0; + + foreach ($period as $dt) { + $minSevenDays = new \Datetime($dt->format("Y-m-d")); + $minSevenDays = $minSevenDays->modify('-7 day')->format("Y-m-d"); + + $dataPlanM = DB::table('m_activity') + ->select('id as activity_id', 'bobot_planning', 'start_date', 'biaya_actual', 'duration', 'persentase_progress') + // ->join('m_activity as a', 'a.id', '=', 'activity_id') + ->where('proyek_id', '=', $keyGantt['proyek_id']) + ->where('type_activity', '=', 'task') + ->where('version_gantt_id', '=', $keyGantt['id']) + ->whereDate('start_date', '<=',$dt->format("Y-m-d")) + ->whereDate('start_date', '>', $minSevenDays) + ->get(); + + $dataActualM = DB::table('m_activity as a') + ->select('mapl.id as id_progress_log', 'mapl.activity_id', 'mapl.variance', 'mapl.created_at', 'a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress') + ->join('m_activity_progress_log as mapl', 'a.id', '=', 'mapl.activity_id') + ->where('a.version_gantt_id', '=', $keyGantt['id']) + ->where('a.type_activity', '=', 'task') + ->where('mapl.variance', '>', 0) + ->where('a.proyek_id', '=', $keyGantt['proyek_id']) + ->whereDate('mapl.created_at', '<=',$dt->format("Y-m-d")) + ->whereDate('mapl.created_at', '>',$minSevenDays) + ->get(); + $dataTempPlan = []; + $x = 0; + $sumPercentagePlan=0; + $totalACWP = isset($totalACWP) ? $totalACWP : 0; + $totalBCWP = isset($totalBCWP) ? $totalBCWP : 0; + + foreach ($dataPlanM as $keyPlanM) { + + $dataTempPlan [$x]['activity_id'] = $keyPlanM->activity_id; + $dataTempPlan [$x]['qty_plan'] = $keyPlanM->bobot_planning; + $dataTempPlan [$x]['plan_date'] = $keyPlanM->start_date; + $dataTempPlan [$x]['start_activity'] = $keyPlanM->start_date; + $dataTempPlan [$x]['bobot_planning'] = $keyPlanM->bobot_planning; + $dataTempPlan [$x]['ttl_plan'] = $keyPlanM->bobot_planning; + $dataTempPlan [$x]['biaya_actual'] = $keyPlanM->biaya_actual; + $dataTempPlan [$x]['duration'] = $keyPlanM->duration; + $dataTempPlan [$x]['persentase_progress'] = $keyPlanM->persentase_progress; + try { + $dataTempPlan [$x]['percentage'] = $keyPlanM->bobot_planning; + $sumPercentagePlan+=$keyPlanM->bobot_planning; + $totalBCWP += 0; + $dataTempPlan [$x]['totalBCWP'] = $totalBCWP; + } catch (\DivisionByZeroError $e) { + return response()->json(['message' => $e->getMessage()]); + } + $x++; + } + + $w = 0; + $dataTempReport = []; + $sumPercentageActual=0; + foreach ($dataActualM as $keyActualM) { + $sumVolActual = DB::table('m_activity_progress_log') + ->select('id', DB::raw('SUM(variance) as ttl_percen_act')) + ->where('id', '=', $keyActualM->id_progress_log) + ->groupBy('id') + ->first(); + $dataTempReport [$w]['id_progress_log'] = $keyActualM->id_progress_log; + // $dataTempReport [$w]['qty'] = $keyActualM->qty; + $dataTempReport [$w]['report_date'] = $keyActualM->created_at; + $dataTempReport [$w]['bobot_planning'] = $keyActualM->bobot_planning; + // $dataTempReport [$w]['ttl_plan'] = $sumVolActual->ttl_percen_act ? $sumVolActual->ttl_percen_act : 0; + $dataTempReport [$w]['biaya_actual'] = $keyActualM->biaya_actual; + $dataTempReport [$w]['duration'] = $keyActualM->duration; + $dataTempReport [$w]['persentase_progress'] = $keyActualM->persentase_progress; + try { + $dataTempReport [$w]['percentage'] = $sumVolActual->ttl_percen_act ? ($sumVolActual->ttl_percen_act/100)*$keyActualM->bobot_planning : 0; + $sumPercentageActual+=$sumVolActual->ttl_percen_act ? ($sumVolActual->ttl_percen_act/100)*$keyActualM->bobot_planning : 0; + $totalACWP += $keyActualM->biaya_actual/$keyActualM->duration; + } catch (\DivisionByZeroError $e) { + return response()->json(['message' => $e->getMessage()]); + } + $dataTempReport [$w]['totalacwp'] = $totalACWP; + $w++; + } + + $arr_ActualM[] = array( + 'date'=>$dt->format("Y-m-d"), + 'percentPlan'=>$sumPercentagePlan, + 'percentActual'=>$sumPercentageActual, + 'plan'=>$dataTempPlan, + 'actual'=>$dataTempReport, + ); + if(isset($dataPayload['period']) && $dataPayload['period'] == 'week'){ + $tempTtlPercentPlan+= $sumPercentagePlan; + $tempTtlPercentActual+= $sumPercentageActual; + + if($tempTtlPercentPlan >= 100 || $tempTtlPercentActual >= 100){ + if($tempTtlPercentActual >= 100) + $tempTtlPercentActual = 100; + if($tempTtlPercentPlan >= 100) + $tempTtlPercentPlan = 100; + } + + $currentACWP += $totalACWP; + $currentBCWP += $totalBCWP; + + $tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2)); + $tempPercentagePlan[] = round($tempTtlPercentPlan, 2); + $tempPercentagePlanWhr[] = ["weekly period", $tempPercentagePlan]; + $tempPercentageReal[] = round($tempTtlPercentActual, 2); + if($tempTtlPercentPlan >= 100 && $tempTtlPercentActual >= 100){ + break; + } + }else{ + $tempPercentage[] = array(round($sumPercentagePlan,2), round($sumPercentageActual,2)); + $tempPercentagePlan[] = round($sumPercentagePlan, 2); + $tempPercentageReal[] = round($sumPercentageActual, 2); + } + $tempDate[] = array($dt->format("Y-m-d")); + } + + try { + if(round($totalACWP,0) > $totalRencanaBudget){ + $estimatedCost = round($totalACWP,0)+0; + }else{ + $estimatedCost = ($totalRencanaBudget+0); + } + } catch (\DivisionByZeroError $e) { + return response()->json([ + 'message' => $e->getMessage(), + "line" => 566, + 'gantt' => $keyGantt, + ]); + } + $estimatedCost = $totalACWP > $totalRencanaBudget ? $totalACWP : $totalRencanaBudget; + + $costDeviation = $totalRencanaBudget - $estimatedCost; + if($costDeviation > 0){ + $potential = "SAVING"; + } else { + $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN"; + } + + $dataResponse = array( + "date" =>$tempDate, + "percentage" =>$tempPercentage, + "percentagePlan" => $tempPercentagePlan, + "percentageReal" => $tempPercentageReal, + "data_details" =>$arr_ActualM, + "budget_control" =>array("current_budget"=> $totalRencanaBudget, + "acwp" => round($totalACWP,0), + "bcwp" => round($totalBCWP,0), + "rem_to_complete" => ($totalRencanaBudget - round($totalACWP,0)), + "add_cost_to_complete" => 0, + "estimated_at_completion" => $estimatedCost, + "cost_deviation" => $costDeviation, + "potential" => $potential, + ) + ); + + $dataFinal[] = array( + "proyek_name"=> $dataProject->nama, + "data"=>$dataResponse, + "gantt"=>$keyGantt, + ); + + return $dataFinal; + } + +} diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 19c7182..467147d 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -3,14 +3,12 @@ namespace App\Http\Controllers; use App\Models\Activity; use App\Models\CommentActivity; -use App\Models\Holiday; use App\Models\Link; use App\Models\Project; -use App\Models\ReportActivity; use App\Models\TemplateGantt; -use App\Models\UserToActivity; +use App\Models\TmpImport; use App\Models\VersionGantt; -use Illuminate\Support\Facades\DB; +use App\Models\UserToActivity; use Illuminate\Http\Request; class ActivityController extends Controller @@ -28,14 +26,17 @@ class ActivityController extends Controller private function getDataActivity($id) { - $checkHeader = Activity::where('version_gantt_id', $id)->where('type_activity', 'header')->count(); $finalData = []; + $checkHeader = Activity::where('version_gantt_id', $id)->where('type_activity', 'header')->count(); $finalData = []; if($checkHeader > 0){ $dataHeader = Activity::where('version_gantt_id', $id)->where('type_activity', 'header')->first(); $startDate = date_create($dataHeader->start_date); $endDate = date_create($dataHeader->end_date); $dataHeader->start_date = date_format($startDate,"Y-m-d H:i:s"); $dataHeader->end_date = date_format($endDate,"Y-m-d H:i:s"); - $dataHeader->type = "project"; + $dataHeader->progress = $dataHeader->persentase_progress / 100; + $dataHeader->planned_start = isset($dataHeader->planned_start) ? date_format(date_create($dataHeader->planned_start),"Y-m-d H:i:s") : NULL; + $dataHeader->planned_end = isset($dataHeader->planned_end) ? date_format(date_create($dataHeader->planned_end),"Y-m-d H:i:s") : NULL; + $dataHeader->type = "header"; $dataHeader->text = $dataHeader->name; $finalData[] = $dataHeader; $data = Activity::where('version_gantt_id', $id)->where('parent_id', $dataHeader->id)->orderBy('id', 'asc')->get(); @@ -45,20 +46,22 @@ class ActivityController extends Controller foreach($data as $objRow){ $type = "project"; + $dataChildren = $this->getChildren($id, $objRow->id); + $startDate = date_create($objRow->start_date); + $endDate = date_create($objRow->end_date); + if($objRow->type_activity=="milestone") $type = $objRow->type_activity; if(empty($dataChildren)) $type = "task"; + $objRow->text = $objRow->name; $objRow->parent = $objRow->parent_id ? $objRow->parent_id : null; - $startDate = date_create($objRow->start_date); - $endDate = date_create($objRow->end_date); $objRow->start_date = date_format($startDate,"Y-m-d H:i:s"); $objRow->end_date = date_format($endDate,"Y-m-d H:i:s"); $objRow->planned_start = isset($objRow->planned_start) ? date_format(date_create($objRow->planned_start),"Y-m-d H:i:s") : NULL; $objRow->planned_end = isset($objRow->planned_end) ? date_format(date_create($objRow->planned_end),"Y-m-d H:i:s") : NULL; - $objRow->progress = (int) $objRow->persentase_progress / 100; - $dataChildren = $this->getChildren($id, $objRow->id); + $objRow->progress = $objRow->persentase_progress / 100; $objRow->type = $type; $finalData[] = $objRow; $finalData = array_merge($finalData, $dataChildren); @@ -186,7 +189,10 @@ class ActivityController extends Controller $parent = $data['parent_id'] ?? null; if($parent){ - Activity::find($parent)->update(["type_activity"=>"project"]); + $parentData = Activity::find($parent); + if($parentData->parent_id) { + $parentData->update(["type_activity" => "project"]); + } CommentActivity::where('activity_id', $parent)->delete(); UserToActivity::where('activity_id', $parent)->delete(); } @@ -212,16 +218,11 @@ class ActivityController extends Controller if(empty($id) || !is_int((int)$id)) return response()->json(['status'=>'failed', 'action'=>'error','message'=>'id is required!','code'=>400], 400); - $updateBobot = false; + $updateBobot = true; if(!$data = Activity::find($id)) return response()->json(['status'=>'failed', 'action'=>'error','message'=>'Data not found!','code'=> 404], 404); $dataUpdate = $request->all(); - $oldRencanaBiaya = $data->rencana_biaya; - $newRencanaBiaya = str_replace(",",".",$request->rencana_biaya); - if($oldRencanaBiaya != $newRencanaBiaya) - $updateBobot = true; - $dataUpdate['name'] = $request->text; $dataUpdate['persentase_progress'] = $request->progress*100; $dataUpdate['updated_by'] = $this->currentName; @@ -278,378 +279,154 @@ class ActivityController extends Controller $dataGet = $builder->get(); $totalRecord = $countBuilder->count(); return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); - } + } - public function getPercentagePerDay(Request $request) + // before upload file + public function importOld(Request $request) { - $dataPayload = $request->all(); - $allGantt = []; - foreach ($dataPayload['project_id'] as $val) { - $allGantt[] = $this->getLatestGantt($val); - } + $data = $request->all(); - $dataFinal=[]; - foreach ($allGantt as $val) { - $dataProject = Project::find($val['proyek_id']); - $holidays = Holiday::where("version_gantt_id", $val['last_gantt_id'])->where("proyek_id", $val['proyek_id'])->get(); - $dateHoliday = []; //$holiday->all(); - foreach ($holidays as $holiday) { - $startH = new \DateTime($holiday->date); - $endH = clone $startH; - $endH->modify('+'.$holiday->duration.' day'); - $intervalH = \DateInterval::createFromDateString('1 day'); - $periodH = new \DatePeriod($startH, $intervalH, $endH); - foreach ($periodH as $dt) { - $dateHoliday[] = $dt->format("Y-m-d"); - } - } - $verGantt = VersionGantt::find($val['last_gantt_id']); - $configOff = $verGantt->config_dayoff; - if($configOff && $configOff!= ""){ - $dayOff = explode(",", $verGantt->config_dayoff); - $dayOff = array_map( - function($value) { return (int)$value; }, - $dayOff - ); - }else{ - $dayOff = []; - } - $checkHeader = Activity::where('type_activity', 'header')->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->count(); - if($checkHeader > 0){ - $dataHeader = Activity::where('type_activity', 'header')->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->first(); - $minDate = Activity::where('parent_id', $dataHeader->id)->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->min("start_date"); - $maxDate = Activity::where('parent_id', $dataHeader->id)->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->max("end_date"); - }else{ - $minDate = Activity::whereNull('parent_id')->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->min("start_date"); - $maxDate = Activity::whereNull('parent_id')->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->max("end_date"); - } + $data['created_by'] = $this->currentName; - $begin = new \DateTime($minDate); - $end = new \DateTime($maxDate); - $end = $end->modify( '+1 day' ); - $interval = \DateInterval::createFromDateString('1 day'); - $period = new \DatePeriod($begin, $interval, $end); - $checkHeader = Activity::where('type_activity', 'header')->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->count(); - if($checkHeader > 0){ - $dataHeader = Activity::where('type_activity', 'header')->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->first(); - $totalRencanaBudget = Activity::select(DB::raw('sum(cast(rencana_biaya as integer))'))->where('parent_id', $dataHeader->id)->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->first(); - }else{ - $totalRencanaBudget = Activity::select(DB::raw('sum(cast(rencana_biaya as integer))'))->whereNull('parent_id')->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->first(); - } + Activity::where('version_gantt_id', $data['ganttId'])->delete(); - $totalRencanaBudget = $totalRencanaBudget->sum; - $currentPercentage = 0; - $dataDate = []; - $dataPercen = []; - foreach ($period as $dt) { - $weekDay = $dt->format("w"); - $currentDate = $dt->format("Y-m-d"); - if(!in_array($weekDay, $dayOff) && !in_array($currentDate, $dateHoliday)) - { - $totalPercentage = 0; - $checkHeader = Activity::where('type_activity', 'header')->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->count(); - if($checkHeader > 0){ - $dataHeader = Activity::where('type_activity', 'header')->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->first(); - $dataActivity = Activity::whereRaw("'".$currentDate."' BETWEEN DATE(m_activity.start_date) AND DATE(m_activity.end_date)")->where('parent_id', $dataHeader->id)->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->get(); - }else{ - $dataActivity = Activity::whereRaw("'".$currentDate."' BETWEEN DATE(m_activity.start_date) AND DATE(m_activity.end_date)")->whereNull('parent_id')->where("proyek_id", $val['proyek_id'])->where("version_gantt_id", $val['last_gantt_id'])->get(); - } - - foreach ($dataActivity as $activity) { - $duration = $activity->duration; - if($totalRencanaBudget > 0 && $duration > 0){ - $totalPercentage = $totalPercentage + ((($activity->rencana_biaya/$totalRencanaBudget)*100)/$duration); - } - } - $currentPercentage = $currentPercentage + $totalPercentage; - $dataDate[] = $currentDate; - $dataPercen[] = $currentPercentage; - }else{ - $dataDate[] = $currentDate; - $dataPercen[] = "dateOff"; - } - } - $dataPercentage = array( - "date"=>$dataDate, - "percentage"=>$dataPercen - ); - $dataFinal[] = array( - "proyek_name"=> $dataProject->nama, - "data"=>$dataPercentage - ); - } + $projectId = VersionGantt::where('id', $data['ganttId'])->first()->proyek_id; - if($dataFinal){ - return response()->json(['status'=>'success','code'=>200,'data'=>$dataFinal, 'totalRecord'=>1], 200); - }else{ - return response()->json(['status'=>'failed','message'=>'failed get list percentage day, please try again later!','code'=>400], 400); - } - } + $activityStack = []; + foreach ($data['activities'] as $i => $activity_row) { + $startDate = \DateTime::createFromFormat('d-m-y', $activity_row['start_date']); + $endDate = \DateTime::createFromFormat('d-m-y', $activity_row['end_date']); - public function getCalculateCurvaS(Request $request) // for adw (plan & actual == date) - { - DB::enableQueryLog(); - $dataPayload = $request->all(); - $allGantt = []; - if(isset($dataPayload['gannt_id'])){ - $allGantt = $dataPayload['gannt_id']; - }else{ - foreach ($dataPayload['project_id'] as $val) { - $allGantt[] = $this->getLatestGantt($val); + $input['name'] = $activity_row['name']; + $input['proyek_id'] = $projectId; + $input['version_gantt_id'] = $data['ganttId']; + $input['parent_id'] = null; + $input['start_date'] = $startDate->format('Y-m-d'); + $input['end_date'] = $endDate->format('Y-m-d'); + $input['duration'] = $activity_row['duration']; + $input['bobot_planning'] = $activity_row['weight']; + $input['persentase_progress'] = 0; + $input['type_activity'] = $i == 0 ? "header" : "task"; + $input['created_by'] = $this->currentName; + + if (!$activity = Activity::create($input)) { + Activity::where('version_gantt_id', $data['ganttId'])->delete(); + return response()->json(['status' => 'error', 'message' => 'Input failed on ' . $activity['name'], 'code' => 500], 500); } - } - $dataFinal=[]; - foreach ($allGantt as $keyGantt) { - $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(); - 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"); - }else{ - $totalRencanaBudget = Activity::whereNull('parent_id')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['last_gantt_id'])->sum("rencana_biaya"); + $data['activities'][$i]['activity_id'] = $activity->id; + + if ($i == 0) { + $activity->type_activity = "project"; + $activity->save(); + $activity->level = $activity_row['level']; + array_push($activityStack, $activity); + continue; } - if(!Activity::where("version_gantt_id", $keyGantt['last_gantt_id'])->first()) - continue; - - $alreadyHasReport = DB::table('report_activity_material as a') - ->select('a.id') - ->join('m_activity as b', 'b.id', '=', 'a.activity_id') - ->where('b.version_gantt_id', '=', $keyGantt['last_gantt_id']) - ->exists(); - - if(!$alreadyHasReport) - continue; - - $minDate = DB::table('assign_material_to_activity as ama') - ->where("ama.proyek_id", $keyGantt['proyek_id']) - ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') - ->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) - ->min("plan_date"); - - $maxDate = DB::table('assign_material_to_activity as ama') - ->where("ama.proyek_id", $keyGantt['proyek_id']) - ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') - ->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) - ->max("plan_date"); - - $begin = new \DateTime($minDate); - $end = new \DateTime($maxDate); - $end2 = new \DateTime($maxDate); - $interval = \DateInterval::createFromDateString('1 day'); - $period = new \DatePeriod($begin->modify('-1 days'), $interval, $end); - $arr_ActualM = []; - $tempDate = []; - $tempPercentage = []; - $tempTtlPercentPlan=0; - $tempTtlPercentActual=0; - - $currentACWP = 0; - $currentBCWP = 0; - - foreach ($period as $dt) { - $dataPlanM = DB::table('assign_material_to_activity as ama') - ->select('ama.activity_id', 'ama.qty_planning', 'ama.plan_date', 'ama.start_activity', 'a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress') - ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') - ->where('ama.proyek_id', '=', $keyGantt['proyek_id']) - ->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) - ->whereDate('ama.plan_date', $dt->format("Y-m-d")) - ->get(); - $dataActualM = DB::table('report_activity_material as ram') - ->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') - ->where('a.version_gantt_id', '=', $keyGantt['last_gantt_id']) - ->where('a.proyek_id', '=', $keyGantt['proyek_id']) - ->whereDate('ram.report_date', $dt->format("Y-m-d")) - ->get(); - $dataTempPlan = []; - $x = 0; - $sumPercentagePlan=0; - $totalACWP = isset($totalACWP) ? $totalACWP : 0; - $totalBCWP = isset($totalBCWP) ? $totalBCWP : 0; - - foreach ($dataPlanM as $keyPlanM) { - $sumVolPlan = DB::table('assign_material_to_activity') - ->select('activity_id', DB::raw('SUM(qty_planning) as ttl_qty_plan')) - ->where('activity_id', '=', $keyPlanM->activity_id) - ->groupBy('activity_id') - ->first(); - $dataTempPlan [$x]['activity_id'] = $keyPlanM->activity_id; - $dataTempPlan [$x]['qty_plan'] = $keyPlanM->qty_planning; - $dataTempPlan [$x]['plan_date'] = $keyPlanM->plan_date; - $dataTempPlan [$x]['start_activity'] = $keyPlanM->start_activity; - $dataTempPlan [$x]['bobot_planning'] = $keyPlanM->bobot_planning; - $dataTempPlan [$x]['ttl_plan'] = $sumVolPlan->ttl_qty_plan; - $dataTempPlan [$x]['biaya_actual'] = $keyPlanM->biaya_actual; - $dataTempPlan [$x]['duration'] = $keyPlanM->duration; - $dataTempPlan [$x]['persentase_progress'] = $keyPlanM->persentase_progress; - $dataTempPlan [$x]['percentage'] = ($keyPlanM->qty_planning/$sumVolPlan->ttl_qty_plan)*$keyPlanM->bobot_planning; - $sumPercentagePlan+=($keyPlanM->qty_planning/$sumVolPlan->ttl_qty_plan)*$keyPlanM->bobot_planning; - $totalBCWP += (((($keyPlanM->persentase_progress*$keyPlanM->bobot_planning)/100)/$keyPlanM->duration)* $totalRencanaBudget)/100; - $dataTempPlan [$x]['totalBCWP'] = $totalBCWP; - $x++; - } + $activity->level = $activity_row['level']; - $w = 0; - $dataTempReport = []; - $sumPercentageActual=0; - foreach ($dataActualM as $keyActualM) { - $sumVolActual = DB::table('assign_material_to_activity') - ->select('activity_id', DB::raw('SUM(qty_planning) as ttl_qty_plan')) - ->where('activity_id', '=', $keyActualM->activity_id) - ->groupBy('activity_id') - ->first(); - $dataTempReport [$w]['activity_id'] = $keyActualM->activity_id; - $dataTempReport [$w]['qty'] = $keyActualM->qty; - $dataTempReport [$w]['report_date'] = $keyActualM->report_date; - $dataTempReport [$w]['bobot_planning'] = $keyActualM->bobot_planning; - $dataTempReport [$w]['ttl_plan'] = $sumVolActual->ttl_qty_plan; - $dataTempReport [$w]['biaya_actual'] = $keyActualM->biaya_actual; - $dataTempReport [$w]['duration'] = $keyActualM->duration; - $dataTempReport [$w]['persentase_progress'] = $keyActualM->persentase_progress; - $dataTempReport [$w]['percentage'] = ($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; - } catch (\Exception $e) { - return response()->json(['message' => $e->getMessage()]); - } - $dataTempReport [$w]['totalacwp'] = $totalACWP; - $w++; + if ($lastStack = end($activityStack)) { + $levelLowerThanLastStack = $activity->level < $lastStack->level; + $levelEqualWithLastStack = $activity->level == $lastStack->level; + + if ($levelLowerThanLastStack) { + $lastStackIsNotRight = $levelLowerThanLastStack; + do { + array_pop($activityStack); + $lastStack = end($activityStack); + if ($activity->level > $lastStack->level) + $lastStackIsNotRight = false; + } while ($lastStackIsNotRight); } - $arr_ActualM[] = array( - 'date'=>$dt->format("Y-m-d"), - 'percentPlan'=>$sumPercentagePlan, - 'percentActual'=>$sumPercentageActual, - 'plan'=>$dataTempPlan, - 'actual'=>$dataTempReport, - ); - if(isset($dataPayload['period']) && $dataPayload['period'] == 'week'){ - $tempTtlPercentPlan+= $sumPercentagePlan; - $tempTtlPercentActual+= $sumPercentageActual; - $currentACWP += $totalACWP; - $currentBCWP += $totalBCWP; - - $tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2)); - $tempDate[] = array($dt->format("Y-m-d"), 0, 0); - }else{ - $tempPercentage[] = array(round($sumPercentagePlan,2), round($sumPercentageActual,2)); - $tempDate[] = array($dt->format("Y-m-d"), 0, 0); + if ($levelEqualWithLastStack) { + array_pop($activityStack); } } + $activity->parent_id = $activityStack[count($activityStack) - 1]->id ?? null; + // there should be better way to except / filter attribute level before save because it's cause error + // cant use except() / filter() on $activity collection somehow + unset($activity->level); + $activity->save(); + $activity->level = $activity_row['level']; - try { - if(round($totalACWP,0) > $totalRencanaBudget){ - $estimatedCost = round($totalACWP,0)+0; - }else{ - $estimatedCost = ($totalRencanaBudget+0); - } - } catch (\Exception $e) { - return response()->json([ - 'message' => $e->getMessage(), - "line" => 566, - 'gantt' => $keyGantt, - ]); - } - $estimatedCost = $totalACWP > $totalRencanaBudget ? $totalACWP : $totalRencanaBudget; - - $costDeviation = $totalRencanaBudget - $estimatedCost; - if($costDeviation > 0){ - $potential = "SAVING"; - } else { - $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN"; + if (@$activityStack[count($activityStack) - 1]->level != $activity->level && $activity->level != $data['activities'][$i - 1]['level']) { + array_push($activityStack, $activity); } - $dataResponse = array( - "date" =>$tempDate, - "percentage" =>$tempPercentage, - "data_details" =>$arr_ActualM, - "budget_control" =>array("current_budget"=> $totalRencanaBudget, - "acwp" => round($totalACWP,0), - "bcwp" => round($totalBCWP,0), - "rem_to_complete" => ($totalRencanaBudget - round($totalACWP,0)), - "add_cost_to_complete" => 0, - "estimated_at_completion" => $estimatedCost, - "cost_deviation" => $costDeviation, - "potential" => $potential, - ) - ); + if ($activity->level < @$data['activities'][$i + 1]['level']) { + unset($activity->level); + $activity->type_activity = "project"; + $activity->save(); + $activity->level = $activity_row['level']; + } - $dataFinal[] = array( - "proyek_name"=> $dataProject->nama, - "data"=>$dataResponse, - "allGant"=>$allGantt - ); + if (!empty($activity_row['predecessor'])) { + $key = array_search($activity_row['predecessor'], array_column($data['activities'], 'no')); + + if (!$predecessorActivity = Activity::find($data['activities'][$key]['activity_id'])) + continue; + + $predecessorFinishDate = new \DateTime($predecessorActivity->end_date); + $interval = $predecessorFinishDate->diff(new \DateTime($activity->start_date)); + $diff = $interval->days; + + Link::create([ + 'created_by' => $this->currentName, + 's_activity_id' => $predecessorActivity->id, + 't_activity_id' => $activity->id, + 'type_link' => 0, + 'code_link' => 'FS', + 'version_gantt_id' => $data['ganttId'], + 'lag' => $diff > 1 ? $diff : null, + ]); + } } - - return response()->json(['status'=>'success','code'=>200, 'data' => $dataFinal], 200); - - } - - private function getLatestGantt($id){ - $maxGanttId = VersionGantt::where("proyek_id", $id)->max("id"); - $data = array( - "last_gantt_id" => $maxGanttId, - "proyek_id" => $id - ); - return $data; - } - - public function setBaseline($gantt_id) + return response()->json(['stack' => $activityStack, 'status' => 'success', 'message' => 'Data imported!', 'projectId' => $projectId, 'code' => 200], 200); + } + + public function import(Request $request) { - $activities = Activity::where("version_gantt_id", $gantt_id)->get(); - - foreach ($activities as $activity) { - $activity->update([ - "planned_start"=>$activity->start_date, - "planned_end"=>$activity->end_date, - ]); - } + $data = $request->all(); + $data['created_by'] = $this->currentName; + Activity::where('version_gantt_id', $data['gantt_id'])->delete(); + $projectId = VersionGantt::where('id', $data['gantt_id'])->first()->proyek_id; + // get data excel + $excel = TmpImport::latest('id')->first(); - return response()->json(['status'=>'success','message'=>'Set baseline success!','code'=> 200], 200); - } + return response()->json(['stack' => $excel, 'status' => 'success', 'message' => 'Data imported!', 'data' => $data, 'code' => 200], 200); + } - public function synchronizeReport($gantt_id) + public function uploadTmpImport(Request $request) { - $activities = Activity::where("version_gantt_id", $gantt_id)->get(); - $reports = []; - - foreach($activities as $activity) { - $activity_id = $activity->id; - $countReports = ReportActivity::where('activity_id', $activity_id)->count(); - if ($countReports === 1) { - $dataReports = ReportActivity::where('activity_id', $activity_id)->orderBy('report_date')->get(); - foreach($dataReports as $dr) { - $reports[] = array( - 'activity_id'=>$activity_id, - 'min_date'=>$dr->report_date, - 'max_date'=>date_modify(date_create($dr->report_date), "1 days") - ); + if($request->hasFile('dokumen')){ + $document = $request->file('dokumen'); + $gantt_id = $request->gantt_id; + $name = $document->getClientOriginalName(); + + $result = $document->move($this->pathTmpImport, $name); + if($result){ + $data = [ + 'gantt_id' => (int)$gantt_id, + 'file' => $name, + 'type_dokumen' => $request->type_dokumen + ]; + + $result = TmpImport::create($data); + + if(!$result){ + unlink($this->pathTmpImport.$name); + return response()->json(['status'=>'failed','message'=>'Upload failed!','code'=> 500], 500); } - } - if ($countReports > 1) { - $firstReport = ReportActivity::where('activity_id', $activity_id)->orderBy('report_date')->first(); - $lastReport = ReportActivity::where('activity_id', $activity_id)->orderByDesc('report_date')->first(); - $reports[] = array( - 'activity_id'=>$activity_id, - 'min_date'=>$firstReport->report_date, - 'max_date'=>date_modify(date_create($lastReport->report_date), "1 days") - ); + return response()->json(['status'=>'success','message'=>'Upload successful!','code'=>200], 200); } + return response()->json(['status'=>'failed','message'=>'Upload failed!','code'=> 500], 500); } - - for ($i=0; $i < count($reports); $i++) { - $activity = Activity::find($reports[$i]['activity_id']); - $activity->start_date = $reports[$i]['min_date']; - $activity->end_date = $reports[$i]['max_date']; - $activity->save(); - } - - return response()->json(['status'=>'success','message'=>'Synchronize to report success!','code'=>200], 200); + return response()->json(['status'=>'failed','message'=>'File is required!','code'=>400], 400); } } diff --git a/app/Http/Controllers/AssignMaterialController.php b/app/Http/Controllers/AssignMaterialController.php index 0122c01..5a89147 100644 --- a/app/Http/Controllers/AssignMaterialController.php +++ b/app/Http/Controllers/AssignMaterialController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\AssignMaterial; use App\Models\RequestMaterial; +use App\Models\Activity; use App\Models\ReportActivityMaterial; use Datatables; @@ -23,23 +24,30 @@ class AssignMaterialController extends Controller 'qty_planning' => 'required' ]); + $activity = Activity::where('id', $request->activity_id)->first(); + $checkStock = RequestMaterial::where("id", $request->material_id)->first(); $currentStock = $checkStock->qty; if((int)$currentStock < (int)$request->qty_planning){ return response()->json(['status'=>'failed','message'=>'Stock is not enough!','code'=> 500]); } + + $start_date = $activity->start_date; + $start_date = substr($start_date, 0, 19); // remove the timezone offset + $startDate = new \DateTime(date("Y-m-d", strtotime($start_date))); + $planDate = new \DateTime(date("Y-m-d", strtotime($request->plan_date))); $data = $request->all(); $data['created_by'] = $this->currentName; $data['budget'] = $checkStock->price; $data['qty_planning'] = $this->sanitizeDecimal($data['qty_planning']); - $result = AssignMaterial::create($data); - if(!$result) - return response()->json(['status'=>'failed','message'=>'Failed to add data!','code'=> 500]); - - return response()->json(['status'=>'success','message'=>'Data added!', 'code'=>200]); - + if ($planDate > $startDate) { + $result = AssignMaterial::create($data); + return response()->json(['status'=>'success','message'=>'Data added!', 'code'=>200], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'Failed to add data!','code'=> 400], 400); + } } public function update(Request $request, $id){ @@ -104,11 +112,13 @@ class AssignMaterialController extends Controller public function datatables(Request $request){ $id_activity = $request->query('idact'); + $type = $request->query('type') ?? "material"; $data = AssignMaterial::select( "assign_material_to_activity.*","m.description as material_name", "m.uom as uom" ) ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") ->where('assign_material_to_activity.activity_id', $id_activity) + ->where('assign_material_to_activity.type', $type) ->orderBy('plan_date', 'desc') ->get(); return Datatables::of($data) @@ -124,14 +134,16 @@ class AssignMaterialController extends Controller $id_activity = $request->query('idact'); $data = AssignMaterial::select( - AssignMaterial::raw( - 'SUM(qty_planning) as qty_planning'), + AssignMaterial::raw('SUM(qty_planning) as qty_planning'), "m.description as material_name", - "assign_material_to_activity.activity_id as activity_id" + "assign_material_to_activity.activity_id", + "assign_material_to_activity.type" + // "assign_material_to_activity.material_id", ) ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") ->groupBy("m.description") ->groupBy("assign_material_to_activity.activity_id") + ->groupBy("assign_material_to_activity.type") ->where("assign_material_to_activity.activity_id", $id_activity)->get(); return Datatables::of($data) ->addIndexColumn() @@ -170,9 +182,16 @@ class AssignMaterialController extends Controller ->where('description', '=', $row->material_name)->first(); return $val_uom ? $val_uom->uom : null; }) + ->addColumn('assign_material_id', function($row){ + $assignMaterial =AssignMaterial::select('assign_material_to_activity.id')->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") + ->where('activity_id', $row->activity_id)->where('m.description', $row->material_name)->first(); + return $assignMaterial ? $assignMaterial->id : null; + }) ->addColumn('action', function($row){ - $actionBtn = ''; - $actionBtn .= ''; + $dataPlan = AssignMaterial::select('assign_material_to_activity.id')->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") + ->where('activity_id', $row->activity_id)->where('m.description', $row->material_name)->first(); + $actionBtn = ''; + $actionBtn .= ''; return $actionBtn; }) ->rawColumns(['action'])->make(true); @@ -184,8 +203,6 @@ class AssignMaterialController extends Controller ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") ->where('assign_material_to_activity.activity_id', $id_activity)->get(); foreach ($data as $key) { - # code... - $val_qty_sum = ReportActivityMaterial::where('assign_material_id', '=', $key->id)->sum("qty"); } $countData = $data->count(); diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 67ad016..bb31e8c 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -8,7 +8,9 @@ use Illuminate\Support\Facades\Hash; use App\Models\User; use App\Models\Role; - +use Illuminate\Http\JsonResponse; +use Illuminate\Support\Facades\Password; +use Illuminate\Validation\ValidationException; class AuthController extends Controller { public function __construct() @@ -26,48 +28,65 @@ class AuthController extends Controller if(empty($username) || empty($password)) return response()->json(['status'=>'error','message'=>'You must fill all the fields'], 400); - $user = User::where('username', $username)->where('password', md5($password))->first(); - - if($is_mobile){ - $fcm_token = $request->fcm_token; - - if(!$fcm_token || $fcm_token=="") - return response()->json(['status'=>'error','message'=>'FCM Token is required'], 400); - - $dataUpdateFcm = array( - "fcm_token"=>$fcm_token - ); - - $hr = User::find($user->id); - - if($hr) - $hr->update($dataUpdateFcm); - } - - $dataRole = Role::find($user->role_id); - - if($dataRole) - $user->role = $dataRole; - - if (! $token =Auth::login($user)) - return response()->json(['error' => 'Unauthorized'], 401); - - $ttl = 60; - if($remember) - $ttl = 10080; - - // todo : change existing md5 hashed function to laravel's originally bcrypt - /* $token = auth()->setTTL($ttl)->attempt(['username' => $username, 'password' => Hash::make($password)]); */ - /* dd(response()->json(['code'=>'200', 'token' => $token, 'ttl' => $ttl])); */ - - return response()->json([ - 'code' => 200, - 'data' => array( - 'data_user' => $user, - 'access_token' => $token, - 'token_type' => 'bearer', - 'expires_in' => auth()->factory()->getTTL() * $ttl, - ), - ]); + $usernameCheck = false; + $passwordCheck = false; + + if (User::where('username', $username)->exists()) + $usernameCheck = true; + + if (User::where('password', md5($password))->exists()) + $passwordCheck = true; + + if ($usernameCheck & $passwordCheck){ + $user = User::where('username', $username)->where('password', md5($password))->first(); + if($is_mobile){ + $fcm_token = $request->fcm_token; + + if(!$fcm_token || $fcm_token=="") + return response()->json(['status'=>'error','message'=>'FCM Token is required'], 400); + + $dataUpdateFcm = array( + "fcm_token"=>$fcm_token + ); + + $hr = User::find($user->id); + + if($hr) + $hr->update($dataUpdateFcm); + } + + $dataRole = Role::find($user->role_id); + + if($dataRole) + $user->role = $dataRole; + + if (! $token =Auth::login($user)) + return response()->json(['error' => 'Unauthorized'], 401); + + $ttl = 60; + if($remember) + $ttl = 10080; + + // todo : change existing md5 hashed function to laravel's originally bcrypt + /* $token = auth()->setTTL($ttl)->attempt(['username' => $username, 'password' => Hash::make($password)]); */ + /* dd(response()->json(['code'=>'200', 'token' => $token, 'ttl' => $ttl])); */ + + return response()->json([ + 'code' => 200, + 'data' => array( + 'data_user' => $user, + 'access_token' => $token, + 'token_type' => 'bearer', + 'expires_in' => auth()->factory()->getTTL() * $ttl, + ), + ]); + }else { + if (!$usernameCheck && !$passwordCheck) + return response()->json(['code' => 201, 'message' => "username and password doesn't match"], 201); + if (!$passwordCheck) + return response()->json(['code' => 201, 'message' => "password doesn't match"], 201); + if (!$usernameCheck) + return response()->json(['code' => 201, 'message' => "username doesn't match"], 201); + } } } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 742db50..31cc056 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,13 +2,16 @@ namespace App\Http\Controllers; use Illuminate\Support\Facades\DB; - +use Illuminate\Support\Facades\Http; use Laravel\Lumen\Routing\Controller as BaseController; +use App\Models\ReportK3Detail; + class Controller extends BaseController { protected $pathImage = "assets/image/"; protected $pathDocument = "assets/file/project/"; + protected $pathTmpImport = "assets/file/tmpimport/"; protected $pathActivityDocument = "assets/file/activity/"; protected $listJoinAll = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth']; @@ -210,7 +213,7 @@ class Controller extends BaseController return $query; } - protected function calculateAllCost($activity, $proyek_id){ + protected function calculateAllCost($activity_id, $proyek_id){ $humanCostPlanning = $this->calculateAllHumanCost($activity_id, $proyek_id); $materialCostPlanning = $this->calculateMaterialCost($activity_id, $proyek_id); $toolsCostPlanning = 0; @@ -250,4 +253,44 @@ class Controller extends BaseController $totalCost = AssignMaterial::selectRaw("ISNULL(qty_planning,0)*ISNULL(budget,0) as totalCost")->where("proyek_id", $proyek_id)->where("activity_id", $activity_id)->sum("totalCost"); return $totalCost; } + + protected function getLoc($lat, $lng){ + // $response = Http::get(config('api.nominatim') . "/reverse?lat=".$lat."&lon=".$lng."&format=json"); + // return $response->json; + + $url = config('api.nominatim') . "/reverse?lat=".$lat."&lon=".$lng."&format=json"; + // $token = config('api.adw_token'); + $response = $this->curlRequest($url); + return $response; + } + + private function curlRequest($url){ + $ch = curl_init(); + // $headers = [ + // 'Authorization: '.$token + // ]; + curl_setopt($ch, CURLOPT_URL, $url); + // curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + + $response = curl_exec($ch); + if ($response === false) + $response = curl_error($ch); + curl_close($ch); + + return json_decode($response); + } + + protected function addDetailK3($dataDetail, $report_id){ + foreach ($dataDetail as $value) { + $dataNew = array( + "report_k3_id"=>$report_id, + "checklist_k3_id"=>$value['checklist_id'], + "name_checklist_k3"=>$value['checklist_name'], + "created_by"=>$this->currentName + ); + + ReportK3Detail::create($dataNew); + } + } } diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php index ec845e2..b17643f 100644 --- a/app/Http/Controllers/DashboardBoDController.php +++ b/app/Http/Controllers/DashboardBoDController.php @@ -2,11 +2,22 @@ namespace App\Http\Controllers; +<<<<<<< HEAD +use App\Helpers\MasterFunctionsHelper; +use App\Models\Divisi; +use App\Models\Project; +use App\Models\ProjectPhase; +use App\Models\User; +use App\Models\UserToVersionGantt; +use Illuminate\Support\Collection; +use Illuminate\Support\Facades\DB; +======= use App\Models\Project; use App\Models\Divisi; use App\Models\ProjectPhase; use Illuminate\Support\Collection; use DB; +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 class DashboardBoDController extends Controller { @@ -16,12 +27,81 @@ class DashboardBoDController extends Controller return $year; } +<<<<<<< HEAD + private function curlReq($url, $token){ + $ch = curl_init(); + $headers = [ + 'Authorization: '.$token + ]; + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + + $response = curl_exec($ch); + if ($response === false) + $response = curl_error($ch); + curl_close($ch); + + return json_decode($response); + } + + private function getInvoiceIntegration($search) { + if(empty($search)) + return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); + + $url = str_replace("SEARCH", $search, config('api.adw').'/project_cost?project_no=SEARCH'); + $token = config('api.adw_token'); + $response = $this->curlReq($url, $token); + + if(@$response->data->project_no == "") + return null; + + return $response; + } + + // to do + public function getCompanyCashFlow($year = '%') { + $year = $this->interpolateYear($year); + $totalExpenditure = $totalInvoice = $totalPaidInvoice = 0; +======= public function getCompanyCashFlow($year = '%') { $year = $this->interpolateYear($year); +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 // we can't use eloquent's sum() method because someone decided to use varchar as datatype in rencana_biaya field $totalBudgets = Project::select(DB::raw('SUM(CAST("rencana_biaya" AS DOUBLE PRECISION))')) ->where('mulai_proyek', 'like', $year) +<<<<<<< HEAD + /* ->orWhere('akhir_proyek', 'like', $year) */ + ->pluck('sum') + ->first(); + + $projects = Project::where('mulai_proyek', 'like', $year) + /* ->orWhere('akhir_proyek', 'like', $year) */ + ->get(); + foreach($projects as $project){ + $project->expenses = 0; + + $resp = null; + if($project->kode_sortname != ""){ + $resp = $this->getInvoiceIntegration($project->kode_sortname); + /* $resp = $project->kode_sortname; */ + $cost = $resp->data->total_cost ?? 0; + $cost = substr($cost, 0, strpos($cost, ".")); + $totalExpenditure+= (int) $cost; + $totalInvoice += $resp->data->total_invoice_amount ?? 0; + $totalPaidInvoice += $resp->data->total_invoice_paid_amount ?? 0; + } + + } + + return response()->json([ + 'data' => [ + 'total_budget' => (int) $totalBudgets ?? 0, + 'total_expenditure' => $totalExpenditure, + 'total_invoice' => $totalInvoice, + 'total_paid_invoice' => $totalPaidInvoice , +======= ->pluck('sum') ->first(); @@ -31,10 +111,66 @@ class DashboardBoDController extends Controller 'total_expenditure' => rand(0,10), // to do integrasi 'total_invoice' => rand(0,10), 'total_paid_invoice' => rand(0,10), +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 ] ], 200); } +<<<<<<< HEAD + public function getInvoiceOutstanding($year = '%'){ + $year = $this->interpolateYear($year); + $projects = Project::where('mulai_proyek', 'like', $year) + /* ->orWhere('akhir_proyek', 'like', $year) */ + ->get(); + $return = []; + foreach($projects as $project){ + $resp = null; + if($project->kode_sortname != ""){ + $resp = $this->getInvoiceIntegration($project->kode_sortname); + array_push($return, [ + 'project' => $project->nama, + 'project_code' => $project->kode_sortname, + 'invoiced' => $resp->data->total_invoice_amount ?? 0, + 'paid' => $resp->data->total_invoice_paid_amount ?? 0, + 'response' => $resp, + ]); + } + } + + return response()->json([ + 'data' => $return + ], 200); + } + + public function getTotalProjectPerScheduleHealth($year = '%'){ + $year = $this->interpolateYear($year); + + $return = [ + 'behind-schedule' => 0, + 'warning' => 0, + 'on-schedule' => 0, + ]; + + $projects = Project::where('mulai_proyek', 'like', $year)->get(); + foreach($projects as $project) { + $project->scurve = MasterFunctionsHelper::getSCurve($project->id); + try { + if(@$project->scurve['difference'] > 0 && @$project->scurve['difference'] <= 5) + $return['warning'] += 1; + elseif(@$project->scurve['difference'] > 5 && @$project->scurve['difference'] <= 100) + $return['behind-schedule'] += 1; + elseif(@$project->scurve['difference'] == 0) + $return['on-schedule'] += 1; + } catch (\Error $e) { + return response()->json(['msg' => $e->getMessage(), 'data' => $project], 200); + } + } + + return response()->json(['data' => $return, 'q' => $projects], 200); + } + + public function getTotalProjectScheduleHealthPerDivision($year = '%'){ +======= public function getProjectPerScheduleHealth($year = '%'){ $year = $this->interpolateYear($year); // get data plan (vol) in % @@ -49,14 +185,36 @@ class DashboardBoDController extends Controller } public function getProjectScheduleHealthPerDivision($year = '%'){ +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 $year = $this->interpolateYear($year); $divisions = Divisi::whereNull('parent')->get(); foreach($divisions as $division){ +<<<<<<< HEAD + + $scheduleData = new Collection(); + $behindSchedule = $warning = $onSchedule = 0; + + $projects = Project::where('mulai_proyek', 'like', $year)->where('divisi_id', $division->id)->get(); + foreach($projects as $project) { + $project->scurve = MasterFunctionsHelper::getSCurve($project->id); + if(@$project->scurve['difference'] > 0 && @$project->scurve['difference'] <= 5) + $warning++; + elseif(@$project->scurve['difference'] > 5 && @$project->scurve['difference'] <= 100) + $behindSchedule++; + elseif(@$project->scurve['difference'] == 0) + $onSchedule++; + } + + $scheduleData->prepend($behindSchedule, 'behindSchedule'); + $scheduleData->prepend($warning, 'warning'); + $scheduleData->prepend($onSchedule, 'onSchedule'); +======= $scheduleData = new Collection(); $scheduleData->prepend(rand(0, 10), 'behindSchedule'); $scheduleData->prepend(rand(0, 10), 'warning'); $scheduleData->prepend(rand(0, 10), 'onSchedule'); +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 $division->scheduleData = $scheduleData; } return response()->json([ @@ -66,6 +224,15 @@ class DashboardBoDController extends Controller ], 200); } +<<<<<<< HEAD + public function getTotalProjectPerBudgetHealth($year = '%'){ + $year = $this->interpolateYear($year); + return response()->json([ + 'data' => [ + 'overrun' => Project::where('mulai_proyek', 'like', $year)->where('budget_health', 'overrun')->count(), + 'warning' => Project::where('mulai_proyek', 'like', $year)->where('budget_health', 'warning')->count(), + 'on-budget' => Project::where('mulai_proyek', 'like', $year)->where('budget_health', 'on-budget')->count(), +======= public function getProjectPerBudgetHealth($year = '%'){ $year = $this->interpolateYear($year); return response()->json([ @@ -73,10 +240,44 @@ class DashboardBoDController extends Controller 'overrun' => rand(0,10), 'warning' => rand(0,10), 'on-budget' => rand(0,10), +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 ] ], 200); } +<<<<<<< HEAD + private function countTotalProjectByBudgetHealthInDivision($divisi, $year, $health){ + return Project::where('divisi_id', $divisi) + ->where('mulai_proyek', 'like', $year) + /* ->orWhere('akhir_proyek', 'like', $year) */ + ->where('budget_health', $health) + ->count(); + } + + + public function getTotalProjectBudgetHealthPerDivision($year = '%'){ + $year = $this->interpolateYear($year); + $divisions = Divisi::select('id','name') + ->with('children') + ->whereNull('parent') + ->get(); + // to do : count in more than 1 level child + foreach($divisions as $division){ + $budgetData = new Collection(); + $budgetData->prepend($this->countTotalProjectByBudgetHealthInDivision($division->id, $year, 'overrun'), 'overrun'); + $budgetData->prepend($this->countTotalProjectByBudgetHealthInDivision($division->id, $year, 'warning'), 'warning'); + $budgetData->prepend($this->countTotalProjectByBudgetHealthInDivision($division->id, $year, 'on-budget'), 'on-budget'); + foreach($division->children as $d){ + $budgetData['overrun'] += $this->countTotalProjectByBudgetHealthInDivision($d->id, $year, 'overrun'); + $budgetData['warning'] += $this->countTotalProjectByBudgetHealthInDivision($d->id, $year, 'warning'); + $budgetData['on-budget'] += $this->countTotalProjectByBudgetHealthInDivision($d->id, $year, 'on-budget'); + } + unset($division->children); + $division->budgetData = $budgetData; + } + foreach($divisions as $division){ + } +======= public function getProjectBudgetHealthPerDivision($year = '%'){ $year = $this->interpolateYear($year); @@ -88,6 +289,7 @@ class DashboardBoDController extends Controller $budgetData->prepend(rand(0, 10), 'onBudget'); $division->budgetData = $budgetData; } +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 return response()->json([ 'data' => [ $divisions @@ -95,11 +297,22 @@ class DashboardBoDController extends Controller ], 200); } +<<<<<<< HEAD + public function getTotalProjectPerPhase($year = '%'){ + $year = $this->interpolateYear($year); + $projectPhases = ProjectPhase::orderBy('order')->get(); + foreach($projectPhases as $phase){ + $phase->totalProject = Project::where('phase_id', $phase->id) + ->where('mulai_proyek', 'like', $year) + /* ->orWhere('akhir_proyek', 'like', $year) */ + ->count(); +======= public function getProjectPerPhase($year = '%'){ $year = $this->interpolateYear($year); $projectPhases = ProjectPhase::orderBy('order')->get(); foreach($projectPhases as $phase){ $phase->totalProject = rand(0,10); +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 } return response()->json([ 'data' => [ @@ -111,19 +324,31 @@ class DashboardBoDController extends Controller private function countTotalProjectInDivision($id, $year){ return Project::where('divisi_id', $id) ->where('mulai_proyek', 'like', $year) +<<<<<<< HEAD + /* ->orWhere('akhir_proyek', 'like', $year) */ +======= +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 ->count(); } public function getTotalProjectPerDivision($year = '%') { $year = $this->interpolateYear($year); +<<<<<<< HEAD + $divisions = Divisi::select('id','name') +======= $totalProjectPerDivision = Divisi::select('id','name') +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 ->with('children') ->whereNull('parent') ->get(); // to do : count in more than 1 level child +<<<<<<< HEAD + foreach($divisions as $v){ +======= foreach($totalProjectPerDivision as $v){ +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 $v->total = $this->countTotalProjectInDivision($v->id, $year); foreach($v->children as $d){ $v->total += $this->countTotalProjectInDivision($d->id, $year); @@ -132,13 +357,21 @@ class DashboardBoDController extends Controller } return response()->json([ +<<<<<<< HEAD + 'data' => $divisions +======= 'data' => $totalProjectPerDivision +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 ], 200); } private function countTotalProjectValueInDivision($id, $year){ return Project::select(DB::raw('SUM(CAST("rencana_biaya" AS DOUBLE PRECISION))')) ->where('mulai_proyek', 'like', $year) +<<<<<<< HEAD + /* ->orWhere('akhir_proyek', 'like', $year) */ +======= +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 ->where('divisi_id', $id) ->pluck('sum') ->first(); @@ -147,13 +380,21 @@ class DashboardBoDController extends Controller public function getTotalProjectValuePerDivision($year = '%') { $year = $this->interpolateYear($year); +<<<<<<< HEAD + $divisions = Divisi::select('id','name') +======= $totalProjectValuePerDivision = Divisi::select('id','name') +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 ->with('children') ->whereNull('parent') ->get(); // to do : count in more than 1 level child +<<<<<<< HEAD + foreach($divisions as $v){ +======= foreach($totalProjectValuePerDivision as $v){ +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 $v->total = $this->countTotalProjectValueInDivision($v->id, $year); foreach($v->children as $d){ $v->total += $this->countTotalProjectValueInDivision($d->id, $year); @@ -162,9 +403,46 @@ class DashboardBoDController extends Controller } return response()->json([ +<<<<<<< HEAD + 'data' => $divisions + ], 200); + } + + + public function getDetailExpenditure($year = '%'){ + $year = $this->interpolateYear($year); + $projects = Project::where('mulai_proyek', 'like', $year) + /* ->orWhere('akhir_proyek', 'like', $year) */ + ->orderBy('id', 'desc') + ->get(); + foreach($projects as $project){ + $lastGantt = MasterFunctionsHelper::getLatestGantt($project->id); + + if($project->kode_sortname != ""){ + $resp = $this->getInvoiceIntegration($project->kode_sortname); + $project->invoice = [ + 'invoiced' => $resp->data->total_invoice_amount ?? 0, + 'paid' => $resp->data->total_invoice_paid_amount ?? 0, + ]; + } + + $project->pm = User::find($project->pm_id); + /* $project->header = Activity::where('proyek_id', $project->id)->where('version_gantt_id', $lastGantt['last_gantt_id'])->whereNull('parent_id')->first(); */ + $project->scurve = MasterFunctionsHelper::getSCurve($project->id); + $project->manPowers = UserToVersionGantt::where('version_gantt_id', $lastGantt['last_gantt_id'])->count(); + $project->lastGanttId = MasterFunctionsHelper::getLatestGantt($project->id); + } + + return response()->json([ + 'data' => $projects, + 'total_manpowers' => User::count() + ], 200); + } +======= 'data' => $totalProjectValuePerDivision ], 200); } +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 } diff --git a/app/Http/Controllers/MapMonitoringController.php b/app/Http/Controllers/MapMonitoringController.php new file mode 100644 index 0000000..26b36cb --- /dev/null +++ b/app/Http/Controllers/MapMonitoringController.php @@ -0,0 +1,83 @@ +addHour(7)->format('Y-m-d'); + // get distinct human assign project + $hr_assign_project = DB::table('assign_hr_to_proyek') + ->select('user_id') + ->whereIn('proyek_id', $request->project_id) + ->distinct() + ->get(); + // get position hr in presensi + $tmp = []; + foreach($hr_assign_project as $key){ + $presensi = DB::table('t_clock_in_out as tcio') + ->select('tcio.id as clock_in_out_id','mu.id as user_id', 'mu.name as fullname', 'tcio.clock_in', 'tcio.clock_out', 'tcio.clock_in_lat', 'tcio.clock_in_lng', + 'tcio.clock_out_lat', 'tcio.clock_out_lng', 'tcio.clock_in_loc', 'tcio.clock_out_loc', 'tcio.clock_in_boundary', + 'tcio.clock_out_boundary', 'mu.username', 'tcio.date_presence', 'tcio.created_at') + ->join('m_users as mu', 'mu.id', '=', 'tcio.user_id') + ->where('mu.id', $key->user_id) + ->orderBy('tcio.id', 'DESC') + ->first(); + $project = DB::table('assign_hr_to_proyek as ahtp') + ->select('ahtp.proyek_id as id', 'mp.nama as project_name') + ->join('m_proyek as mp', 'mp.id', '=', 'ahtp.proyek_id') + ->whereIn('ahtp.proyek_id', $request->project_id) + ->where('ahtp.user_id', $key->user_id) + ->get(); + if($presensi && isset($presensi->user_id)){ + $image = DB::table('m_image')->select('image')->where('category', 'presensi')->where('ref_id', $presensi->clock_in_out_id)->first(); + $tmp[] = array( + 'user_id' => $presensi->user_id, + 'clock_in' => $presensi->clock_in, + 'clock_out' => $presensi->clock_out, + 'date_presence' => $presensi->date_presence, + 'clock_in_lat' => $presensi->clock_in_lat, + 'clock_in_lng' => $presensi->clock_in_lng, + 'clock_out_lat' => $presensi->clock_out_lat, + 'clock_out_lng' => $presensi->clock_out_lng, + 'clock_in_loc' => $presensi->clock_in_loc, + 'clock_out_loc' => $presensi->clock_out_loc, + 'clock_in_boundary' => $presensi->clock_in_boundary, + 'clock_out_boundary' => $presensi->clock_out_boundary, + 'username' => $presensi->username, + 'name' => $presensi->fullname, + 'image_selfie' => isset($image->image) ? $image->image : '-', + 'created_at' => $presensi->created_at, + 'presence_status' => $presensi->date_presence == $dateNow ? true : false,//true, //status date_presence, + 'projects' => $project + ); + } + } + return response()->json(['status'=>'success','code'=>200, 'data' => $tmp, 'totalRecord'=>count($tmp)], 200); + } + + public function list() + { + $data = Presence::all(); + $countData = $data->count(); + + if($data){ + return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'failed get list presence, please try again later!','code'=>400], 400); + } + } + + +} diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 3feced9..3dba574 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -5,8 +5,7 @@ namespace App\Http\Controllers; use Log; use Illuminate\Http\Request; use App\Models\Presence; -use GuzzleHttp\Client; -use Illuminate\Support\Facades\Http; +use App\Models\ReportK3; use Carbon\Carbon; use Illuminate\Support\Facades\DB; @@ -17,22 +16,64 @@ class PresenceController extends Controller $this->validate($request, [ 'user_id' => 'required' ]); + + $checkLocation = $this->checkLocation($request); + $statusBoundary = false; + $date = date_create($request->clock_time); + // assign and in boundary + if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){ + $statusBoundary = true; + } + // not assign + if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ + $data=array( + 'id' => null, + 'boundary' => $statusBoundary + ); + return response()->json(['status'=>'failed', 'data'=>$data, 'message'=>'Tidak dapat melakukan presensi. Anda belum di assign ke area kerja.','code'=>200], 200); + } + // assign and not in boundary + if($checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ + $data=array( + 'id' => null, + 'boundary' => true + ); + return response()->json(['status'=>'failed', 'data'=>$data, 'message'=>'Tidak dapat melakukan presensi. Anda berada di luar area kerja.','code'=>200], 200); + } if($request->type=="out"){ - - $clock_out_loc = "-"; + $clock_out_loc = $this->getLoc($request->clock_out_lat, $request->clock_out_lng)->display_name; $dataUpdate = array( "clock_out"=>$request->clock_time, "clock_out_lat" => $request->clock_out_lat, "clock_out_lng" => $request->clock_out_lng, "updated_by"=>$this->currentName, - "clock_out_loc" => $clock_out_loc + "clock_out_loc" => $clock_out_loc, + "clock_out_boundary" => $statusBoundary ); $resultUpdate = $this->updateFormAdd($dataUpdate, $request->user_id); if($resultUpdate && $resultUpdate > 0){ - return response()->json(['status'=>'success', 'id'=>$resultUpdate,'message'=>'clock out success!','code'=>200], 200); + if($statusBoundary){ + for ($i=0; $i < count($checkLocation); $i++) { + # code... + DB::table('clock_in_out_boundary')->insert([ + "clock_in_out_id" => $resultUpdate, + "user_id" => $request->user_id, + "activity_id" => $checkLocation[$i]['activity_id'], + "type" => $request->type, + "created_at" => $date, + "created_by" => $this->currentName + ]); + }; + }; + $data=array( + 'id' => $resultUpdate, + 'boundary' => $statusBoundary + ); + + return response()->json(['status'=>'success', 'data'=>$data,'message'=>'clock out success!','code'=>200], 200); } else{ return response()->json(['status'=>'failed','message'=>'clock out failed please try again!','code'=>400], 400); @@ -40,31 +81,224 @@ class PresenceController extends Controller die(); } - $date = date_create($request->clock_time); - $onlyDate = date_format($date,"Y-m-d"); - - - $clock_in_loc = "-"; + $onlyDate = date_format($date,"Y-m-d"); + $clock_in_loc = $this->getLoc($request->clock_in_lat, $request->clock_in_lng)->display_name; $dataAdd = array( 'user_id'=> $request->user_id, 'clock_in'=> $request->clock_time, 'date_presence'=> $onlyDate, - 'created_by' =>$this->currentName, + 'created_by' => $this->currentName, 'clock_in_lat' => $request->clock_in_lat, 'clock_in_lng' => $request->clock_in_lng, - 'clock_in_loc' => $clock_in_loc + 'clock_in_loc' => $clock_in_loc, + 'clock_in_boundary' => $statusBoundary ); $result = Presence::create($dataAdd); + $data=array( + 'id' => $result->id, + 'boundary' => $statusBoundary + ); + if($result){ + if($statusBoundary){ + for ($i=0; $i < count($checkLocation); $i++) { + # code... + DB::table('clock_in_out_boundary')->insert([ + "clock_in_out_id" => $result->id, + "user_id" => $request->user_id, + "activity_id" => $checkLocation[$i]['activity_id'], + "type" => $request->type, + "created_at" => $date, + "created_by" => $this->currentName + ]); + }; + }; + return response()->json(['status'=>'success', 'data' => $data,'message'=>'clock in successfully!','code'=>200], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'clock in failed!','code'=>400], 400); + } + } - if($result){ - return response()->json(['status'=>'success', 'id'=>$result->id,'message'=>'clock in successfully!','code'=>200], 200); + public function reportK3(Request $request){ + // return response()->json(['status'=>'success', 'message'=>$request->report_k3['detail'],'code'=>200], 200); + + $this->validate($request, [ + 'user_id' => 'required' + ]); + + $checkLocation = $this->checkLocation($request); + $statusBoundary = false; + $date = date_create($request->time); + // assign and in boundary + if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){ + $statusBoundary = true; + } + + // not assign + if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ + $data=array( + 'id' => null, + 'boundary' => $statusBoundary + ); + return response()->json(['status'=>'failed', 'data'=>$data, 'message'=>'Tidak dapat melakukan presensi. Anda belum di assign ke area kerja.','code'=>200], 200); + } + // assign and not in boundary + if($checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ + $data=array( + 'id' => null, + 'boundary' => true + ); + return response()->json(['status'=>'failed', 'data'=>$data, 'message'=>'Tidak dapat melakukan presensi. Anda berada di luar area kerja.','code'=>200], 200); + } + + if($request->clock_in_out['type']=="out"){ + $clock_out_loc = $this->getLoc($request->clock_in_out['clock_out_lat'], $request->clock_in_out['clock_out_lng'])->display_name; + $dataUpdate = array( + "clock_out"=>$request->time, + "clock_out_lat" => $request->clock_in_out['clock_out_lat'], + "clock_out_lng" => $request->clock_in_out['clock_out_lng'], + "updated_by"=>$this->currentName, + "clock_out_loc" => $clock_out_loc, + "clock_out_boundary" => $statusBoundary + ); + + $resultUpdate = $this->updateFormAdd($dataUpdate, $request->user_id); + if($resultUpdate && $resultUpdate > 0){ + if($statusBoundary){ + for ($i=0; $i < count($checkLocation); $i++) { + # code... + DB::table('clock_in_out_boundary')->insert([ + "clock_in_out_id" => $resultUpdate, + "user_id" => $request->user_id, + "activity_id" => $checkLocation[$i]['activity_id'], + "type" => $request->clock_in_out['type'], + "created_at" => $date, + "created_by" => $this->currentName + ]); + }; + }; + $data=array( + 'presence_id' => $resultUpdate, + 'boundary' => $statusBoundary + ); + + return response()->json(['status'=>'success', 'data'=>$data,'message'=>'clock out success!','code'=>200], 200); + } + else{ + return response()->json(['status'=>'failed','message'=>'clock out failed please try again!','code'=>400], 400); + } + die(); + } + + $onlyDate = date_format($date,"Y-m-d"); + $clock_in_loc = $this->getLoc($request->clock_in_out['clock_in_lat'], $request->clock_in_out['clock_in_lng'])->display_name; + + $dataFormK3 = array( + "user_id" => $request->user_id, + "proyek_id" => $request->report_k3['proyek_id'], + "report_date" => $request->time, + "description" => $request->report_k3['description'] + ); + + $dataFormPresence = array( + 'user_id' => $request->user_id, + 'clock_in' => $request->time, + 'date_presence' => $onlyDate, + 'created_by' => $this->currentName, + 'clock_in_lat' => $request->clock_in_out['clock_in_lat'], + 'clock_in_lng' => $request->clock_in_out['clock_in_lng'], + 'clock_in_loc' => $clock_in_loc, + 'clock_in_boundary' => $statusBoundary + ); + + $result = Presence::create($dataFormPresence); + $data=array( + 'presence_id' => $result->id, + 'boundary' => $statusBoundary + ); + if($result){ + if($statusBoundary){ + $insertk3 = $this->insertK3($dataFormK3, $request->report_k3['detail']) ; + for ($i=0; $i < count($checkLocation); $i++) { + # code... + DB::table('clock_in_out_boundary')->insert([ + "clock_in_out_id" => $result->id, + "user_id" => $request->user_id, + "activity_id" => $checkLocation[$i]['activity_id'], + "type" => $request->type, + "created_at" => $date, + "created_by" => $this->currentName + ]); + }; + $data['report_id'] = $insertk3->id; + }; + return response()->json(['status'=>'success', 'data'=> $data, 'message'=>'clock in successfully!','code'=>200], 200); }else{ return response()->json(['status'=>'failed','message'=>'clock in failed!','code'=>400], 400); } } + private function insertK3($params, $details){ + $insert = ReportK3::create($params); + if($insert && $details){ + $this->addDetailK3($details, $insert->id); + } + return $insert; + } + + private function checkLocation($params){ + // cek user tersebut apakah punya assign task yang ada bondary nya + // geom ada di table activity + // $clock_time = + $geom = DB::table("assign_hr_to_activity as ahta")->select("ma.geom", "ma.id") + ->join("m_activity as ma", "ma.id", "=", "ahta.activity_id") + ->where("ahta.user_id", $params->user_id) + ->whereNotNull("ma.geom") + ->whereDate("ma.start_date", "<=", $params->time) + ->whereDate("ma.end_date", ">=", $params->time) + ->get(); + $temp = []; + if (count($geom) > 0) { + foreach($geom as $dataGeom){ + $valGeom = json_decode($dataGeom->geom); + if($params->clock_in_out['type']=="out"){ + $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary")); + }else{ + $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary")); + } + foreach ($check as $key) { + // assign and in boundary + if($key->boundary){ + $temp[]=array( + "activity_id" => $dataGeom->id, + "boundary" => $key->boundary, + "status_assign" => true + ); + } + } + // assign and not in boundary + if(count($temp) < 1){ + $temp[]=array( + "activity_id" => null, + "boundary" => false, + "status_assign" => true + // "geom" => $geom, + // "cek" => $check[0]->boundary + ); + } + } + }else{ + // not assign + $temp[]=array( + "activity_id" => null, + "boundary" => false, + "status_assign" => false + ); + } + return $temp; + } + public function edit($id){ if(!$id || (int) $id < 0 || $id==""){ return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); @@ -80,14 +314,10 @@ class PresenceController extends Controller } } - - public function clockinout($id) { $dateTimeNow = Carbon::now()->addHour(7); $dataPresence = Presence::where('user_id', $id)->orderBy('id', 'DESC')->first(); - - if($dataPresence){ $dateNow = date("Y-m-d"); @@ -126,12 +356,9 @@ class PresenceController extends Controller } private function updateFormAdd($data, $id){ - $date = date_create($data['clock_out']); - $onlyDate = date_format($date,"Y-m-d"); - $dataPresence = Presence::where('user_id',$id) ->where("clock_in", "<=", $data["clock_out"]) ->orderByDesc("id") @@ -166,7 +393,6 @@ class PresenceController extends Controller die(); } - if($result){ return response()->json(['status'=>'success','message'=>'data presence successfully updated!','code'=>200], 200); }else{ @@ -185,7 +411,6 @@ class PresenceController extends Controller die(); } - if($delete){ return response()->json(['status'=>'success','message'=>'data presence successfully deleted!','code'=>200], 200); }else{ @@ -200,9 +425,6 @@ class PresenceController extends Controller $builder = $dataBuilder['builder']; $countBuilder = $dataBuilder['count']; $dataGet = $builder->get(); - $finalData = []; - - $totalRecord = $countBuilder->count(); return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); } @@ -229,17 +451,16 @@ class PresenceController extends Controller $clock_in_lat = $objRow->clock_in_lat; $clock_in_lng = $objRow->clock_in_lng; $objRow->clock_in_loc = ""; - if (isset($clock_in_lat) && isset($clock_in_lng)) { - $response = Http::get(config('api.nominatim') . "/reverse?lat=".$clock_in_lat."&lon=".$clock_in_lng."&format=json"); - $objRow->clock_in_loc = $response->json()["display_name"]; + if (isset($clock_in_lat) && isset($clock_in_lng)) { + $objRow->clock_in_loc = $this->getLoc($clock_in_lat, $clock_in_lng)->display_name; } $clock_out_lat = $objRow->clock_out_lat; $clock_out_lng = $objRow->clock_out_lng; $objRow->clock_out_loc = ""; - if (isset($clock_out_lat) && isset($clock_out_lng)) { - $response = Http::get(config('api.nominatim') . "/reverse?lat=".$clock_out_lat."&lon=".$clock_out_lng."&format=json"); - $objRow->clock_out_loc = $response->json()["display_name"]; + if (isset($clock_out_lat) && isset($clock_out_lng) && $clock_out_lng != null) { + $locAddress = $this->getLoc($clock_out_lat, $clock_out_lng); + $objRow->clock_out_loc = isset($locAddress->display_name) ? $locAddress->display_name : "-"; } @@ -247,5 +468,6 @@ class PresenceController extends Controller $presence->clock_out_loc = $objRow->clock_out_loc; $presence->save(); } + return response()->json(['status'=>'success','message'=>'success update!','code'=>200], 200); } } diff --git a/app/Http/Controllers/ProjectCommentController.php b/app/Http/Controllers/ProjectCommentController.php new file mode 100644 index 0000000..6b5f72f --- /dev/null +++ b/app/Http/Controllers/ProjectCommentController.php @@ -0,0 +1,57 @@ +all(); + + $data['created_by'] = $this->currentName; + + $result = ProjectComment::create($data); + + if($result){ + return response()->json(['status'=>'success','message'=>'add comment successfully!','code'=>200], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'add comment failed!','code'=>400], 400); + } + } + + public function update(Request $request, $id) + { + if(!$id || (int) $id < 0 || $id==""){ + return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); + } + + $data = ProjectComment::find($id); + + if($data){ + $result = $data->update($request->all()); + }else{ + return response()->json(['status'=>'failed','message'=>'data project not found!','code'=>400], 400); + die(); + } + + if($result){ + return response()->json(['status'=>'success','message'=>'data project successfully updated!','code'=>200], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'data project failed updated!','code'=>400], 400); + } + } + + public function search(Request $request) + { + $payload = $request->all(); + $dataBuilder = $this->setUpPayload($payload, 'm_project_comment'); + $builder = $dataBuilder['builder']; + $countBuilder = $dataBuilder['count']; + $dataGet = $builder->get(); + $totalRecord = $countBuilder->count(); + return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); + } +} diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 4c18e2c..359e14a 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -26,7 +26,7 @@ use App\Models\ActivityDokumen; use App\Models\Holiday; use App\Models\ReportActivity; use App\Models\OfficeHours; -use DB; +use Illuminate\Support\Facades\DB; const API_GEOLOCATION = "https://nominatim.oslogdev.com/search/ADDR?format=json&addressdetails=1&limit=1"; diff --git a/app/Http/Controllers/ProjectToChecklistK3Controller.php b/app/Http/Controllers/ProjectToChecklistK3Controller.php index 99413ba..3fb5a8e 100644 --- a/app/Http/Controllers/ProjectToChecklistK3Controller.php +++ b/app/Http/Controllers/ProjectToChecklistK3Controller.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\ProjectToChecklistK3; +use App\Models\ChecklistK3; class ProjectToChecklistK3Controller extends Controller { @@ -122,6 +123,12 @@ class ProjectToChecklistK3Controller extends Controller $builder = $dataBuilder['builder']; $countBuilder = $dataBuilder['count']; $dataGet = $builder->get(); + + foreach($dataGet as $key => $value) { + $checklist = ChecklistK3::where('id', $value->checklist_k3_id)->first(); + $dataGet[$key]->checklist_k3_name = $checklist->name; + } + $totalRecord = $countBuilder->count(); return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); } diff --git a/app/Http/Controllers/ReportActivityMaterialController.php b/app/Http/Controllers/ReportActivityMaterialController.php index 04ae220..fd61e5f 100644 --- a/app/Http/Controllers/ReportActivityMaterialController.php +++ b/app/Http/Controllers/ReportActivityMaterialController.php @@ -9,13 +9,13 @@ use App\Models\AssignMaterial; use Datatables; class ReportActivityMaterialController extends Controller -{ +{ private function sanitizeDecimal($number) { $number = str_replace(".","",$number); $number = str_replace(",",".",$number); return $number; } - + public function add(Request $request){ $this->validate($request, [ @@ -23,16 +23,24 @@ class ReportActivityMaterialController extends Controller 'qty' => 'required' ]); + $activity = Activity::where('id', $request->activity_id)->first(); + + $start_date = $activity->start_date; + $start_date = substr($start_date, 0, 19); // remove the timezone offset + $startDate = new \DateTime(date("Y-m-d", strtotime($start_date))); + $reportDate = new \DateTime(date("Y-m-d", strtotime($request->report_date))); + $data = $request->all(); $data['created_by'] = $this->currentName; - $data['assign_material_id'] = AssignMaterial::where('activity_id', $request->activity_id)->pluck('id')->first(); + /* $data['assign_material_id'] = AssignMaterial::where('activity_id', $request->activity_id)->pluck('id')->first(); */ + $data['assign_material_id'] = $request->assign_material_id; $data['qty'] = $this->sanitizeDecimal($data['qty']); - - if(!ReportActivityMaterial::create($data)) - return response()->json(['status'=>'failed','message'=>'Input progress report activity failed created','code'=>400]); - - $this->countForProgress($request->activity_id); - return response()->json(['status'=>'success','message'=>'Input progress report activity created','code'=>200]); + if($reportDate > $startDate){ + $created = ReportActivityMaterial::create($data); + return response()->json(['status'=>'success','message'=>'Input progress report activity created','code'=>200,'data'=>array('report_id'=>$created->id)]); + } else { + return response()->json(['status'=>'failed','message'=>'Input progress report activity failed created','code'=>400,'data'=>null], 400); + } } public function updateStatusStartFinish(Request $request){ @@ -68,79 +76,6 @@ class ReportActivityMaterialController extends Controller return response()->json(['status'=>'success','message'=> 'Data deleted!','code'=>200], 200); } - private function countForProgress($id) - { - - $dataActivity = Activity::find($id); - $dataPlan = AssignMaterial::where('activity_id', $id)->get(); - $tmpPercentage1 = []; - if(!$dataPlan->isEmpty()){ - - foreach ($dataPlan as $value) { - # code... - $price = $value->material_id; - $qty_plan = $value->qty_planning; - $status_activity = $value->status_activity; - - $getDataVolActual = ReportActivityMaterial::where('assign_material_id', '=', $value->id)->sum("qty"); - $percentage1 = ($getDataVolActual * 100) / $qty_plan; - - if($status_activity == 'done'){ - $tmpPercentage1[] = $percentage1 > 100 ? 100 : $percentage1; - }else if($status_activity == 'on-progress'){ - $tmpPercentage1[] = $percentage1 >= 100 ? 90 : $percentage1; - }else{ - $tmpPercentage1[] = $percentage1 >= 100 ? 90 : $percentage1; - } - } - $totalPercentage = array_sum($tmpPercentage1) / count($tmpPercentage1); - }else{ - $totalPercentage = 0; - } - - - - - $dataUpdate = array( - "persentase_progress" => $totalPercentage, - "updated_by" => $this->currentName - ); - return $dataActivity->update($dataUpdate); - } - - public function countForProgressTest() - { - $dataPlan = AssignMaterial::where('activity_id', 807)->get(); - $tmpPercentage1 = []; - - if(!$dataPlan->isEmpty()){ - foreach ($dataPlan as $value) { - # code... - $price = $value->material_id; - $qty_plan = $value->qty_planning; - $status_activity = $value->status_activity; - - $getDataVolActual = ReportActivityMaterial::where('assign_material_id', '=', $value->id)->sum("qty"); - $percentage1 = ($getDataVolActual * 100) / $qty_plan; - $percentage1 = ($getDataVolActual * 100) / $qty_plan; - if($status_activity == 'done'){ - $tmpPercentage1[] = $percentage1 > 100 ? 100 : $percentage1; - }else if($status_activity == 'on-progress'){ - $tmpPercentage1[] = $percentage1 >= 100 ? 90 : $percentage1; - }else{ - $tmpPercentage1[] = $percentage1 >= 100 ? 90 : $percentage1; - } - - - } - $totalPercentage = array_sum($tmpPercentage1) / count($tmpPercentage1); - }else{ - $totalPercentage = 0; - } - - return response()->json(['status'=>'success','code'=>200,'data'=>$dataPlan, 'tmpPercentage1'=> $tmpPercentage1, 'totalPercentage'=> $totalPercentage], 200); - } - public function search(Request $request) { $payload = $request->all(); @@ -166,31 +101,37 @@ class ReportActivityMaterialController extends Controller public function datatables(Request $request){ $id_activity = $request->query('idAct'); - $id_assign_material_id= $request->query('idAmi'); $type = $request->query('type'); + $materialName = $request->query('materialName'); if($type == 'plan'){ $data = AssignMaterial::select("assign_material_to_activity.*","m.description as material_name", "m.uom as uom") ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") ->where('assign_material_to_activity.activity_id', $id_activity) + ->where('m.description', $materialName) ->orderBy('assign_material_to_activity.id', 'asc') ->get(); return Datatables::of($data) ->addIndexColumn() ->addColumn('action', function($row){ - $actionBtn = ''; + $actionBtn = ''; + $actionBtn .= ''; return $actionBtn; }) ->rawColumns(['action'])->make(true); }else{ $data = ReportActivityMaterial::select("report_activity_material.*", "u.name as human_resource") + ->join("assign_material_to_activity as amta", "amta.id", "=", "report_activity_material.assign_material_id") + ->join("m_req_material as m", "m.id", "=", "amta.material_id") ->join("m_users as u", "u.id", "=", "report_activity_material.user_id") ->where('report_activity_material.activity_id', $id_activity) + ->where('m.description', $materialName) ->orderBy('report_activity_material.report_date', 'asc') ->get(); return Datatables::of($data) ->addIndexColumn() ->addColumn('action', function($row){ - $actionBtn = ''; + $actionBtn = ''; + $actionBtn .= ''; return $actionBtn; }) ->rawColumns(['action'])->make(true); diff --git a/app/Http/Controllers/ReportK3Controller.php b/app/Http/Controllers/ReportK3Controller.php index 310e435..6cc5342 100644 --- a/app/Http/Controllers/ReportK3Controller.php +++ b/app/Http/Controllers/ReportK3Controller.php @@ -8,7 +8,7 @@ use App\Models\ReportK3Detail; use App\Models\ProjectToChecklistK3; use App\Models\ChecklistK3; use App\Models\Image; -use DB; +use Illuminate\Support\Facades\DB; class ReportK3Controller extends Controller { @@ -35,19 +35,6 @@ class ReportK3Controller extends Controller return response()->json(['status'=>'failed','message'=>'add data report k3 failed!','code'=>400], 400); } } - - private function addDetailK3($dataDetail, $report_id){ - foreach ($dataDetail as $value) { - $dataNew = array( - "report_k3_id"=>$report_id, - "checklist_k3_id"=>$value['checklist_id'], - "name_checklist_k3"=>$value['checklist_name'], - "created_by"=>$this->currentName - ); - - ReportK3Detail::create($dataNew); - } - } public function edit($id){ if(!$id || (int) $id < 0 || $id==""){ @@ -123,12 +110,20 @@ class ReportK3Controller extends Controller $resultData = DB::table($dataChild['table_name'])->where($columnSelf,$value->{$columnForeign})->get(); $value->childData = $resultData; $value->k3_checked = $resultData->pluck("name_checklist_k3")->all(); - $dataImage = Image::where("category", "report_k3")->where("ref_id", $value->id)->first(); - if($dataImage){ - $value->image = $dataImage->image; - }else{ - $value->image = null; + // $dataImage = Image::where("category", "report_k3")->where("ref_id", $value->id)->first(); + // if($dataImage){ + // $value->image = $dataImage->image; + // }else{ + // $value->image = null; + // } + $dataImage = Image::where("category", "report_k3")->where("ref_id", $value->id)->get(); + $images = []; + if (count($dataImage) > 0) { + foreach($dataImage as $reportImage) { + array_push($images, $reportImage); + } } + $value->image = $images; $idsChecklist = $resultData->pluck("checklist_k3_id")->all(); $CheklistK3Ids = ProjectToChecklistK3::whereNotIn("checklist_k3_id", $idsChecklist)->where("proyek_id", $value->proyek_id)->pluck("checklist_k3_id"); $value->k3_not_checked = ChecklistK3::whereIn("id", $CheklistK3Ids)->pluck("name")->all(); diff --git a/app/Http/Controllers/ShowHideColumnController.php b/app/Http/Controllers/ShowHideColumnController.php index 5492ab7..a2db693 100644 --- a/app/Http/Controllers/ShowHideColumnController.php +++ b/app/Http/Controllers/ShowHideColumnController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\UserToVersionGantt; use App\Models\ShowHideColumn; +use App\Models\GanttColumnByType; class ShowHideColumnController extends Controller { @@ -111,11 +112,21 @@ class ShowHideColumnController extends Controller $success--; } } - + if($success > 0){ return response()->json(['status'=>'success','message'=>'data show hide column successfully updated!','code'=>200], 200); }else{ return response()->json(['status'=>'failed','message'=>'data show hide column failed updated!','code'=>400], 400); } } + + public function getColumnByType($type = 'detail') + { + $data = GanttColumnByType::where("calculation_type", $type)->get(); + if(!$data) + return response()->json(['status'=>'failed','message'=>'No data found!','code'=> 404], 404); + + return response()->json(['status'=>'success','code'=>200,'data'=>$data], 200); + } + } diff --git a/app/Http/Controllers/UserToActivityController.php b/app/Http/Controllers/UserToActivityController.php index 2b9b403..8cf9ad6 100644 --- a/app/Http/Controllers/UserToActivityController.php +++ b/app/Http/Controllers/UserToActivityController.php @@ -134,7 +134,39 @@ class UserToActivityController extends Controller }else{ return response()->json(['status'=>'failed','message'=>'failed get list user to activity gantt, please try again later!','code'=>400], 400); } - } + } + + public function listFiltered(Request $request) + { + $startDate = $request->start_date; + $endDate = $request->end_date; + $userId = $request->user_id; + $proyekId = $request->proyek_id; + + if (isset($proyekId)) { + $data = UserToActivity::select('assign_hr_to_activity.id', 'assign_hr_to_activity.activity_id', 'm_activity.name', 'm_activity.kode_sortname', 'm_activity.start_date', 'm_activity.end_date') + ->join('m_activity', 'assign_hr_to_activity.activity_id', '=', 'm_activity.id') + ->where('m_activity.start_date', '=', $startDate) + ->where('m_activity.end_date', '=', $endDate) + ->where('assign_hr_to_activity.user_id', '=', $userId) + ->where('assign_hr_to_activity.proyek_id', '=', $proyekId) + ->get(); + }else { + $data = UserToActivity::select('assign_hr_to_activity.id', 'assign_hr_to_activity.activity_id', 'm_activity.name', 'm_activity.kode_sortname', 'm_activity.start_date', 'm_activity.end_date') + ->join('m_activity', 'assign_hr_to_activity.activity_id', '=', 'm_activity.id') + ->where('m_activity.start_date', '=', $startDate) + ->where('m_activity.end_date', '=', $endDate) + ->where('assign_hr_to_activity.user_id', '=', $userId) + ->get(); + } + $countData = $data->count(); + + if($data){ + return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'failed get list user to activity gantt, please try again later!','code'=>400], 400); + } + } public function datatables(Request $request){ $id_activity = $request->query('idact'); diff --git a/app/Http/Controllers/VersionGanttController.php b/app/Http/Controllers/VersionGanttController.php index 9406237..dbd7a6a 100644 --- a/app/Http/Controllers/VersionGanttController.php +++ b/app/Http/Controllers/VersionGanttController.php @@ -6,11 +6,10 @@ use Illuminate\Http\Request; use App\Models\VersionGantt; class VersionGanttController extends Controller -{ +{ public function add(Request $request){ $this->validate($request, [ 'name_version' => 'required', - 'description' => 'required', 'proyek_id' => 'required' ]); $data = $request->all(); @@ -36,7 +35,7 @@ class VersionGanttController extends Controller return response()->json(['status'=>'failed','message'=>'data version gantt Project not found!','code'=>400], 400); die(); } - + if($result){ return response()->json(['status'=>'success','message'=>'version gantt Project successfully updated!','code'=>200], 200); }else{ @@ -54,7 +53,7 @@ class VersionGanttController extends Controller return response()->json(['status'=>'failed','message'=>'data version gantt Project not found!','code'=>400], 400); die(); } - + if($delete){ return response()->json(['status'=>'success','message'=>'version gantt Project successfully deleted!','code'=>200], 200); diff --git a/app/Http/Controllers/WaypointController.php b/app/Http/Controllers/WaypointController.php index f2d47ce..6702ca8 100644 --- a/app/Http/Controllers/WaypointController.php +++ b/app/Http/Controllers/WaypointController.php @@ -28,6 +28,32 @@ class WaypointController extends Controller } } + public function addBulk(Request $request) + { + $data = $request->all(); + $now = date("Y-m-d H:i:s"); + $data_send = array(); + + if (isset($data['wp_records']) && count($data['wp_records']) > 0) { + foreach($data['wp_records'] as $userLoc) { + $userLoc['created_at'] = $now; + $userLoc['created_by'] = $this->currentName; + $userLoc['updated_at'] = $now; + $userLoc['updated_by'] = $this->currentName; + $data_send[] = $userLoc; + } + $result = Waypoint::insert($data_send); + if($result){ + return response()->json(['status'=>'success','message'=>'add waypoint successfully!','code'=>200], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'add waypoint failed!','code'=>400], 400); + } + } + else { + return response()->json(['status'=>'failed','message'=>'add waypoint failed!','code'=>400], 400); + } + } + public function edit($id){ if(!$id || (int) $id < 0 || $id==""){ return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); diff --git a/app/Imports/ActivityImport.php b/app/Imports/ActivityImport.php new file mode 100644 index 0000000..e69de29 diff --git a/app/Models/Activity.php b/app/Models/Activity.php index 52708f4..bffd2ec 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -3,11 +3,13 @@ namespace App\Models; use App\Models\AssignMaterial; +use App\Models\ActivityProgressLog; use App\Models\AssignTools; use App\Models\ReportActivityMaterial; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Arr; use Illuminate\Support\Facades\DB; +use Carbon\Carbon; class Activity extends Model { @@ -16,6 +18,7 @@ class Activity extends Model const CREATED_AT = 'created_at'; const UPDATED_AT = 'updated_at'; + // persentase bobot gak kepake yg dipakenya bobot_planning protected $fillable = [ 'proyek_id', 'parent_id', 'kode_sortname', 'name', 'rencana_biaya', 'start_date', 'end_date', 'area_kerja', 'biaya_actual', 'persentase_bobot', 'persentase_progress', @@ -27,32 +30,67 @@ class Activity extends Model ]; protected $appends = [ - 'jobs_done', 'assign_hr', 'assign_material', 'assign_tools' + 'jobs_done', 'assign_hr', 'assign_material', 'assign_tools', 'assign_expense' ]; + + public function getStartDateAttribute($value) + { + return Carbon::createFromTimestamp(strtotime($value)) + ->timezone(env('APP_TIMEZONE')) + ->toDateTimeString(); + } + + public function getEndDateAttribute($value) + { + return Carbon::createFromTimestamp(strtotime($value)) + ->timezone(env('APP_TIMEZONE')) + ->toDateTimeString(); + } + + public static function boot() { parent::boot(); + static::updating(function($data) { + $data->logPersentaseProgress(); + }); + static::updated(function($data) { $data->updateBobot(); $data->updateCostPlanning(); - $data->updatePersentaseProgress(); - $data->updateCostActual(); + if($data->bobot_planning){ + $data->updatePersentaseProgress(); + $data->updateCostActual(); + } + // if($data->start_date != request()->start_date || $data->end_date != request()->end_date) { + // $data->updateStartEndDateHeader(); + // } }); static::deleted(function($data) { if(Activity::where("parent_id", $data->parent_id)->count() == 0) Activity::find($data->parent_id)->update(["type_activity"=>"task"]); + $data->updateBobot(true); $data->updateCostPlanning(); - $data->updatePersentaseProgress(); - $data->updateCostActual(); + if($data->bobot_planning){ + $data->updatePersentaseProgress(); + $data->updateCostActual(); + } + $data->updateStartEndDateHeader(); }); } - private function updateBobot() + private function updateBobot($isDelete = false) { +<<<<<<< HEAD + $root = Activity::where('version_gantt_id', $this->version_gantt_id) + ->where("proyek_id", $this->proyek_id) + ->whereNull('parent_id') + ->first(); +======= $rootActivity = Activity::where('version_gantt_id', $this->version_gantt_id) ->where("proyek_id", $this->proyek_id) ->where('type_activity', 'header') @@ -72,16 +110,25 @@ class Activity extends Model ->where("parent_id", $rootActivity->id) ->first(); } +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 - - if($totalCost->sum > 0){ + if($root->rencana_biaya > 0){ $activities = Activity::where("proyek_id", $this->proyek_id)->where("version_gantt_id", $this->version_gantt_id)->get(); foreach ($activities as $activity) { - $activity->update([ - "bobot_planning" => ( (int)$activity->rencana_biaya / $totalCost->sum ) * 100, - "updated_by" => auth()->user() ? auth()->user()->name : "system", + if($isDelete && $activity->id == $this->id) + continue; + + $activity->bobot_planning = ( (int)$activity->rencana_biaya / $root->rencana_biaya) * 100; + $activity->updated_by = auth()->user() ? auth()->user()->name : "system"; + $activity->saveQuietly(); + + } + } else { + if($parent = Activity::find($this->parent_id)){ + $totalChildWeight = Activity::where("parent_id", $this->parent_id)->sum('bobot_planning'); + $parent->update([ + "bobot_planning" => $totalChildWeight ]); - $activity->save(); } } } @@ -99,14 +146,25 @@ class Activity extends Model private function updatePersentaseProgress() { - $siblings = Activity::where("parent_id", $this->parent_id); - $sumProgress = $siblings->sum("persentase_progress"); - $totalChild = $siblings->count(); - - $this->persentage_progress = $sumProgress / $totalChild; if($parent = Activity::find($this->parent_id)){ + $parentActWeight = $parent->bobot_planning; + + if ($parentActWeight == 0) { + $parent->update([ + "persentase_progress" => 0 + ]); + return; + } + + $totalChildProportionalProgress = 0; + $childs = Activity::where("parent_id", $parent->id)->get(); + foreach($childs as $child){ + $currentActWeight = $child->bobot_planning; + $currentActProportionalProgress = ($currentActWeight / $parentActWeight) * $child->persentase_progress; + $totalChildProportionalProgress += $currentActProportionalProgress; + } $parent->update([ - "persentase_progress" => $sumProgress / $totalChild, + "persentase_progress" => $totalChildProportionalProgress ]); } } @@ -123,22 +181,45 @@ class Activity extends Model } } + private function logPersentaseProgress() + { + ActivityProgressLog::create([ + 'version_gantt_id' => $this->version_gantt_id, + 'activity_id' => request()->id, + 'old_percentage' => $this->persentase_progress, + 'new_percentage' => request()->persentase_progress, + 'variance' => $this->persentase_progress - request()->persentase_progress, + 'created_by'=> "system" + ]); + } + + private function updateStartEndDateHeader() + { + $earliestStartDate = Activity::where('version_gantt_id', $this->version_gantt_id)->whereNotNull('parent_id')->oldest('start_date')->pluck('start_date')->first(); + $latestEndDate = Activity::where('version_gantt_id', $this->version_gantt_id)->whereNotNull('parent_id')->latest('end_date')->pluck('end_date')->first(); + if($header = Activity::where('version_gantt_id', $this->version_gantt_id)->whereNull('parent_id')->first()) { + $header->start_date = $earliestStartDate; + $header->end_date = $latestEndDate; + $header->saveQuietly(); + } + } + public function getJobsDoneAttribute() { +<<<<<<< HEAD + if(!ReportActivityMaterial::where('activity_id', $this->id)->first()) +======= $tmpPercentage = []; if(!ReportActivityMaterial::where('activity_id', $this->id)->first()) return 0; if(!$dataPlan = AssignMaterial::where('activity_id', $this->id)->get()) +>>>>>>> 3f193ec38ec78bd3d323b4aa304c5e1ab52425b6 return 0; - foreach ($dataPlan as $value) { - $tmpPercentage[] = 100; - $getDataVolActual = ReportActivityMaterial::where('assign_material_id', '=', $value->id)->sum("qty"); - $percentage = ($getDataVolActual * 100) / $value->qty_planning; - if($value->status_activity != 'done'){ - $tmpPercentage[] = $percentage >= 100 ? 90 : $percentage; - } - } - return array_sum($tmpPercentage) > 0 ? array_sum($tmpPercentage) / count($tmpPercentage) : 0; + if(!$dataPlan = AssignMaterial::where('activity_id', $this->id)->get()) + return 0; + if($dataPlan[0]->status_activity == 'done') + return 100; + return $this->persentase_progress; } public function getAssignHrAttribute() @@ -155,6 +236,17 @@ class Activity extends Model return Arr::flatten(AssignMaterial::select("m.description as name") ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") ->where('assign_material_to_activity.activity_id', $this->id) + ->where('assign_material_to_activity.type', "material") + ->get() + ->toArray()); + } + + public function getAssignExpenseAttribute() + { + return Arr::flatten(AssignMaterial::select("m.description as name") + ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id") + ->where('assign_material_to_activity.activity_id', $this->id) + ->where('assign_material_to_activity.type', "expense") ->get() ->toArray()); } diff --git a/app/Models/ActivityProgressLog.php b/app/Models/ActivityProgressLog.php new file mode 100644 index 0000000..0746c92 --- /dev/null +++ b/app/Models/ActivityProgressLog.php @@ -0,0 +1,19 @@ +table) + ->select('id', 'user_id', 'clock_in', 'clock_out', 'clock_in_lat', 'clock_in_lng', 'clock_out_lat', 'clock_out_lng', 'clock_in_loc', 'clock_out_loc', 'clock_in_boundary', 'clock_out_boundary') + ->whereBetween('created_at', [$payload->time_from, $payload->time_to]) + ->orderBy('created_at', 'desc') + ->get(); + + return $users; + } +} diff --git a/app/Models/Presence.php b/app/Models/Presence.php index e5276cc..620a91e 100644 --- a/app/Models/Presence.php +++ b/app/Models/Presence.php @@ -3,6 +3,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\DB; class Presence extends Model { @@ -14,7 +15,7 @@ class Presence extends Model protected $fillable = [ 'user_id', 'clock_in', 'clock_out', 'date_presence', 'clock_in_lat', 'clock_in_lng', 'clock_out_lat', 'clock_out_lng', - 'clock_in_loc', 'clock_out_loc', + 'clock_in_loc', 'clock_out_loc','clock_in_boundary', 'clock_out_boundary', 'created_at', 'created_by', 'updated_at', 'updated_by' ]; } diff --git a/app/Models/ProjectComment.php b/app/Models/ProjectComment.php new file mode 100644 index 0000000..57ec97f --- /dev/null +++ b/app/Models/ProjectComment.php @@ -0,0 +1,24 @@ +timezone(env('APP_TIMEZONE')) + ->toDateTimeString(); + } + public static function boot() { parent::boot(); static::created(function($data) { - $activity = Activity::find($data->activity_id); $assignedMaterial = AssignMaterial::find($data->assign_material_id); - $activity->biaya_actual += floatval($assignedMaterial->budget) * floatval($data->qty); - $activity->save(); + $biayaActual = $activity->biaya_actual + floatval($assignedMaterial->budget) * floatval($data->qty); + + $dataPlan = AssignMaterial::where('activity_id', $activity->id)->get(); + if($dataPlan[0]->status_activity == 'done'){ + $percentage = 100; + } else { + $totalPlan = $dataPlan->sum('qty_planning'); + $totalVolumeActual = ReportActivityMaterial::where('activity_id', '=', $activity->id)->sum("qty"); + $percentage = ($totalVolumeActual * 100) / $totalPlan; + $percentage = $percentage >= config('app.max_percentage_not_done') ? config('app.max_percentage_not_done') : $percentage; + } + $activity->update([ + "persentase_progress" => $percentage, + "biaya_actual" => $biayaActual, + ]); + + $activity->save(); }); static::deleted(function($data) { @@ -37,6 +59,17 @@ class ReportActivityMaterial extends Model $assignedMaterial = AssignMaterial::find($data->assign_material_id); $activity->biaya_actual -= floatval($assignedMaterial->budget) * floatval($data->qty); + + $dataPlan = AssignMaterial::where('activity_id', $activity->id)->get(); + if($dataPlan[0]->status_activity == 'done'){ + $activity->persentase_progress = 100; + } else { + $totalPlan = $dataPlan->sum('qty_planning'); + $totalVolumeActual = ReportActivityMaterial::where('activity_id', '=', $activity->id)->sum("qty"); + $percentage = ($totalVolumeActual * 100) / $totalPlan; + $activity->persentase_progress = $percentage >= config('app.max_percentage_not_done') ? config('app.max_percentage_not_done') : $percentage; + } + $activity->save(); }); diff --git a/app/Models/RequestMaterial.php b/app/Models/RequestMaterial.php index c4239fd..550d2d5 100644 --- a/app/Models/RequestMaterial.php +++ b/app/Models/RequestMaterial.php @@ -3,6 +3,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use Carbon\Carbon; class RequestMaterial extends Model { @@ -35,4 +36,33 @@ class RequestMaterial extends Model 'updated_by', 'price' ]; + + public function getRequiredDateAttribute($value) + { + return Carbon::createFromTimestamp(strtotime($value)) + ->timezone(env('APP_TIMEZONE')) + ->toDateTimeString(); + } + + public function getFomDateAttribute($value) + { + return Carbon::createFromTimestamp(strtotime($value)) + ->timezone(env('APP_TIMEZONE')) + ->toDateTimeString(); + } + + public function getPrDateAttribute($value) + { + return Carbon::createFromTimestamp(strtotime($value)) + ->timezone(env('APP_TIMEZONE')) + ->toDateTimeString(); + } + + public function getPoDateAttribute($value) + { + return Carbon::createFromTimestamp(strtotime($value)) + ->timezone(env('APP_TIMEZONE')) + ->toDateTimeString(); + } + } diff --git a/app/Models/TmpImport.php b/app/Models/TmpImport.php new file mode 100644 index 0000000..a7a2311 --- /dev/null +++ b/app/Models/TmpImport.php @@ -0,0 +1,17 @@ +rencana_biaya -= $salary; + if ($activity->rencana_biaya < 0) { + $activity->rencana_biaya = 0; + } $activity->save(); }); diff --git a/app/Models/VersionGantt.php b/app/Models/VersionGantt.php index 0cea0b5..1cf1787 100644 --- a/app/Models/VersionGantt.php +++ b/app/Models/VersionGantt.php @@ -12,14 +12,16 @@ class VersionGantt extends Model const UPDATED_AT = 'updated_at'; protected $fillable = [ - 'name_version', + 'name_version', 'description', 'date_base_line', 'proyek_id', 'config_dayoff', - 'created_at', - 'created_by', - 'updated_at', + 'auto_schedule', + 'calculation_type', + 'created_at', + 'created_by', + 'updated_at', 'updated_by' ]; } diff --git a/bootstrap/app.php b/bootstrap/app.php index 5f8ccca..af68fb8 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -6,7 +6,7 @@ require_once __DIR__.'/../vendor/autoload.php'; dirname(__DIR__) ))->bootstrap(); -date_default_timezone_set(env('APP_TIMEZONE', 'UTC')); +date_default_timezone_set(env('APP_TIMEZONE', 'Asia/Jakarta')); /* |-------------------------------------------------------------------------- @@ -97,7 +97,6 @@ $app->routeMiddleware([ */ $app->register(App\Providers\CatchAllOptionsRequestsProvider::class); - $app->register(App\Providers\AuthServiceProvider::class); $app->register(Tymon\JWTAuth\Providers\LumenServiceProvider::class); $app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class); diff --git a/composer.json b/composer.json index 6602dc4..26c3321 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,9 @@ "phpunit/phpunit": "^9.5.10" }, "autoload": { + "files": [ + "app/Helpers/MasterFunctionsHelper.php" + ], "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", diff --git a/config/app.php b/config/app.php index 2ab666c..7ed1c88 100644 --- a/config/app.php +++ b/config/app.php @@ -5,5 +5,8 @@ 'cost_health_danger_threshold' => 0, 'schedule_health_warning_threshold' => 30, 'schedule_health_danger_threshold' => 0, + 'timezone' => env('APP_TIMEZONE', 'Asia/Jakarta'), + 'app_timezone' => env('APP_TIMEZONE', 'Asia/Jakarta'), + 'max_percentage_not_done' => 95, ]; ?> diff --git a/rest-client.http b/rest-client.http index 6417009..03878db 100644 --- a/rest-client.http +++ b/rest-client.http @@ -1,812 +1,1105 @@ -@token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvYXBpLXN0YWdpbmctYWR3Lm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjU5NDc0MDY3LCJleHAiOjE2NjAwNzg4NjcsIm5iZiI6MTY1OTQ3NDA2NywianRpIjoia0ljaHBFOEpiaFI0TjN3UyIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.PxGL0NcRtxzhG2J21Ca-zgMbr1anY7vhNzEOpZHSNOk - - -# @hostname = https://kit-api.ospro.id/api -# @hostname = https://ospro-api.ospro.id/api -# @hostname = https://api-iu.ospro.id/api -# @hostname = https://api-staging-adw.ospro.id/api -@hostname = http://localhost:8099/api -# @hostname = http://103.73.125.81:8444/api - -###### login -POST {{hostname}}/login -# Authorization: Bearer xxx -# X-REQUEST-TYPE: GraphQL -content-type: application/json - -{ - "username": "admin", - "password": "admin123" -} - -###### Tools Req -### add -POST {{hostname}}/req-tools/add -Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvb3Nwcm8tYXBpLm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjUyODYzNzM4LCJleHAiOjE2NTI5NTAxMzgsIm5iZiI6MTY1Mjg2MzczOCwianRpIjoia2ZwNnhwc0ZZZ0dFNEtGSSIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.f7a0M-GKYgacXtaEmZJUs2UOPFXaigEwGu8OfZ117kI - -content-type: application/json - -{ - "asset_type": "Alat Berat 1", - "asset_name": "Beco", - "required_date":"2021-12-16", - "qty": 10, - "uom": "Kg", - "description": "test Data", - "created_by":"admin", - "proyek_id":1 -} - -### update -PUT {{hostname}}/req-tools/update/3 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "qty": 332, -} - -### search -POST {{hostname}}/req-tools/search -Authorization: Bearer {{token}} -content-type: application/json - -{ - "paging":{ - "start":0, - "length":10 - }, - "columns":[ - { - "name":"asset_type", - "logic_operator":"like", - "value":"", - "operator":"AND" - }, - { - "name":"status", - "logic_operator":"<>", - "value":"receipt to site", - "operator":"AND" - } - ], - "joins":[], - "orders":{ - "columns":[ - "id" - ], - "ascending":false - } -} - -### delete -DELETE {{hostname}}/req-tools/delete/13 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - - -###### Menu -### add -POST {{hostname}}/menu/add -Authorization: {{token}} -content-type: application/json - -{ - "alias_name": "Alat Berat 1", - "icon": "#", - "name":"2021-12-16", - "parent_id": 23, - "sequence": 100, - "url": "test Data" -} - -### update -PUT {{hostname}}/req-tools/update/3 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "qty": 332, -} - -### search -POST {{hostname}}/menu/search -Authorization: Bearer {{token}} -content-type: application/json - -{ - "paging":{ - "start":0, - "length":10 - }, - "columns":[ - { - "name":"name", - "logic_operator":"like", - "value":"", - "operator":"AND" - } - ], - "joins":[ - { - "name":"m_menu", - "column_join":"parent_id", - "column_results":["name"], - } - ], - "orders":{ - "columns":[ - "id" - ], - "ascending":false - } -} - -### delete -DELETE {{hostname}}/req-tools/delete/13 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - - -###### Material Req -### add -POST {{hostname}}/request-material/add -Authorization: Bearer {{token}} -content-type: application/json - -{ - "description": "Lempengan Besi", - "required_date": "2022-05-04", - "qty": "1000", - "uom": "Lembar", - "fom_date": "2022-05-04", - "proyek_id": 29, - "price":10 - } - -### update -PUT {{hostname}}/request-material/update/20 -Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvb3Nwcm8tYXBpLm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjQyMTE1NjQyLCJleHAiOjE2NDIyMDIwNDIsIm5iZiI6MTY0MjExNTY0MiwianRpIjoiVWt1UjRnZjVUMHQ5YXRQWSIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.ftCrSs5v7GxqxW64ZcfZn40Opxom5YoFcDMMF1TvWrk -Content-Type: application/x-www-form-urlencoded -Accept: application/json - -{ - "description": "Pebble", - "fom_date": "2022-01-12T09:59:26.190Z", - "id": 20, - "po_date": null, - "pr_date": null, - "qty": "10", - "qty_received": "100", - "received_date": null, - "required_date": "2022-01-12T09:59:07.739Z", - "status": "fom", - "uom": "kg" -} - - - -### search -POST {{hostname}}/request-material/search -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "paging":{ - "start":0, - "length":10 - }, - "columns":[ - { - "name":"description", - "logic_operator":"like", - "value":"", - "operator":"AND" - } - ], - "joins":[], - "orders":{ - "columns":[ - "id" - ], - "ascending":false - } -} - -### delete -DELETE {{hostname}}/request-material/delete/2 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - - -###### Human Resource -### add -POST {{hostname}}/human-resource/add -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "role_id" : 1, - "username" : "ibnu", - "password" : "test", - "name" : "ibnu", - "phone_number" : "083823134569", - "email" : "ibnu@gmail.com", - "address" : "gria pesona madani", - "ktp_number" : "3212141105950004", - "employee_type" : "freelance" -} - -### update -PUT {{hostname}}/human-resource/update/8 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "address" : "gria pesona madani 1" -} - - -### delete -DELETE {{hostname}}/human-resource/delete/8 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -### search -POST {{hostname}}/human-resource/search -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "paging":{ - "start":0, - "length":10 - }, - "columns":[ - { - "name":"name", - "logic_operator":"like", - "value":"", - "operator":"AND" - } - ], - "joins":[], - "orders":{ - "columns":[ - "id" - ], - "ascending":false - } -} - - -###### Material Resource -### add -POST {{hostname}}/material-resource/add -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "id": 3, - "name": "Batangan Besi", - "uom": "truck", - "unit_price": 500000, - "description": "Pasir", - "qty": 1000 -} - -### update -PUT {{hostname}}/material-resource/update/5 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "uom" : "Batang" -} - - -### delete -DELETE {{hostname}}/material-resource/delete/5 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -### search -POST {{hostname}}/material-resource/search -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "paging":{ - "start":0, - "length":10 - }, - "columns":[ - { - "name":"name", - "logic_operator":"like", - "value":"", - "operator":"AND" - } - ], - "joins":[], - "orders":{ - "columns":[ - "id" - ], - "ascending":false - } -} - - -###### Tools Resource -### add -POST {{hostname}}/tools-resource/add -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "name": "Excavator Belco", - "description": "Excavator Belco", - "uom":"unit", - "qty": "100", - "asset_type": "Alat Berat" -} - -### update -PUT {{hostname}}/tools-resource/update/5 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "name" : "Excavator Kobelco" -} - - -### delete -DELETE {{hostname}}/tools-resource/delete/5 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -### search -POST {{hostname}}/tools-resource/search -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "paging":{ - "start":0, - "length":10 - }, - "columns":[ - { - "name":"name", - "logic_operator":"like", - "value":"", - "operator":"AND" - } - ], - "joins":[], - "orders":{ - "columns":[ - "id" - ], - "ascending":false - } -} - - -###### Project - -### list -GET {{hostname}}/project/list -Authorization: Bearer {{token}} -content-type: application/json - - -### add -POST {{hostname}}/project/add -Authorization: Bearer {{token}} -content-type: application/json - -{ - "nama": "Excavator Belco", - "keterangan": "Excavator Belco", - "mulai_proyek":"2022/01/11", - "akhir_proyek": "2022/05/11" -} - -### update -PUT {{hostname}}/project/update/5 -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "name" : "Excavator Kobelco" -} - - -### delete -DELETE {{hostname}}/project/delete/19 -Authorization: Bearer {{token}} -content-type: application/json - -### search -POST {{hostname}}/tools-resource/search -Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM -content-type: application/json - -{ - "paging":{ - "start":0, - "length":10 - }, - "columns":[ - { - "name":"name", - "logic_operator":"like", - "value":"", - "operator":"AND" - } - ], - "joins":[], - "orders":{ - "columns":[ - "id" - ], - "ascending":false - } -} - -### dashboard -GET {{hostname}}/project/dashboard/47 -Authorization: Bearer {{token}} -content-type: application/json - - -###### Divisi - -### list -GET {{hostname}}/divisi/list -Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvb3Nwcm8tYXBpLm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjQxNDYwNDcyLCJleHAiOjE2NDE0NjQwNzIsIm5iZiI6MTY0MTQ2MDQ3MiwianRpIjoiRjRxYmJ3U25YcEw0OXN0QyIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.CLm_ZOEW5GCyGJuIcRNIRD8m1XxIeSCH60QK2HxF8d0 -content-type: application/json - - - -###### Activity -### get data by id version -GET {{hostname}}/activity/33/29/get -Authorization: Bearer {{token}} -content-type: application/json - -###### Rate Sallary - -### list -GET {{hostname}}/project-role/list -Authorization: Bearer {{token}} -content-type: application/json - - - -###### Rate Sallary - -### list -GET {{hostname}}/rate-sallary/list -Authorization: Bearer {{token}} -content-type: application/json - - -### add -POST {{hostname}}/rate-sallary/add -Authorization: Bearer {{token}} -content-type: application/json - -{ - "project_role_id" : 4, - "cost" : 2000, - "type_rate" : "UMR Jatim" -} - -### update -PUT {{hostname}}/rate-sallary/update/{id} -Authorization: Bearer {{token}} -content-type: application/json - -{ - "project_role_id" : 4, - "cost" : 2000, - "type_rate" : "UMR Jatim" -} - -### delete -POST {{hostname}}/rate-sallary/delete/{id} -Authorization: Bearer {{token}} -content-type: application/json - -{ - "project_role_id" : 4, - "cost" : 2000, - "type_rate" : "UMR Jatim" -} - - - -### search -POST {{hostname}}/dashboard/percentage-planning-actual -Authorization: Bearer {{token}} -content-type: application/json - -{ - "paging":{ - "start":0, - "length":10 - }, - "columns":[ - { - "name":"proyek_id", - "logic_operator":"in", - "value":[7,6,4], - "operator":"AND" - }, - { - "name":"version_gantt_id", - "logic_operator":"=", - "value":3, - "operator":"AND" - } - ], - "joins":[], - "orders":{ - "columns":[ - "proyek_id" - ], - "ascending":true - } -} - - -### -POST {{hostname}}/dashboard/cost-planning-actual -Authorization: Bearer {{token}} -content-type: application/json - -{ - "project_id" : [11] -} - - -### -POST {{hostname}}/dashboard/percentage-planning-actual -Authorization: Bearer {{token}} -content-type: application/json - -{ - "project_id" : [11] -} - - -###### project participants -### add -POST {{hostname}}/project-participants/add -Authorization: Bearer {{token}} -content-type: application/json - -{ - "proyek_id" : 11, - "tittle" : "investor", - "name" : "ibnu" -} - - -# get('/project-participants/edit/{id}', 'ProjectParticipantsController@edit'); -### update -# PUT {{hostname}}//project-participants/update/11 - -# POST {{hostname}}/project-participants/search -# DELETE {{hostname}}/project-participants/delete/{id} -# GET {{hostname}}/project-participants/list - -### -GET {{hostname}}/project-participants/list -Authorization: Bearer {{token}} -content-type: application/json - - -### -GET {{hostname}}/project-participants/proyek_id/11 -Authorization: Bearer {{token}} -content-type: application/json - -### -DELETE {{hostname}}/project-participants/delete/1 -Authorization: Bearer {{token}} -content-type: application/json - -### -DELETE {{hostname}}/project-participants/delete-by-proyek/7 -Authorization: Bearer {{token}} -content-type: application/json - -###### project-approval -POST {{hostname}}/project-approval/add -Authorization: Bearer {{token}} -content-type: application/json - -{ - "proyek_id" : 7, - "tittle" : "investor", - "name" : "koko", - "date_approval" : "2022/01/21" -} - -### -get {{hostname}}/project-approval/edit/{id} - - -put {{hostname}}/project-approval/update/{id} -post {{hostname}}/project-approval/search -delete {{hostname}}/project-approval/delete/{id} -get {{hostname}}/project-approval/list - -###### project-milestone -post {{hostname}}/project-milestone/add -Authorization: Bearer {{token}} -content-type: application/json - -{ - "proyek_id" : 7, - "status" : "Build 2. Finish eksekusi", - "due_date" : "2022/01/21", - "deadline" : "2022/01/21" -} - -### -get {{hostname}}/project-milestone/edit/{id} -put {{hostname}}/project-milestone/update/{id} -post {{hostname}}/project-milestone/search -delete {{hostname}}/project-milestone/delete/{id} -get {{hostname}}/project-milestone/list -get {{hostname}}/project-milestone/select - - -### -GET {{hostname}}/template-gantt/get-tree/3 -Authorization: Bearer {{token}} -content-type: application/json - -### -POST {{hostname}}/folder-document-proyek/add -Authorization: Bearer {{token}} -content-type: application/json - -{ - "proyek_id": "12", - "name_folder": "test 1", - "parent_id" : 1 -} - - -### -GET {{hostname}}/folder-document-proyek/list -Authorization: Bearer {{token}} -content-type: application/json - - -### -GET {{hostname}}/folder-document-proyek/get-tree/12 -Authorization: Bearer {{token}} -content-type: application/json - - - -### -POST {{hostname}}/human-resource/select -Authorization: Bearer {{token}} -content-type: application/json - -{ - "idact" : "362", - "idProyek": "11" -} - - -### -POST https://ospro-api.ospro.id/api/dashboard/status-proyek -Authorization: Bearer {{token}} -content-type: application/json - -{ - "project_id": [11] -} - - -### -POST {{hostname}}/activity/get-percentage -Authorization: Bearer {{token}} -content-type: application/json - -{ - "project_id": [11] -} - - -### -POST {{hostname}}/activity/get-curva-s -Authorization: Bearer {{token}} -content-type: application/json - -{ - "project_id": [47], - "period": "week" -} - - -### -POST {{hostname}}/dashboard/curva-s -Authorization: Bearer {{token}} -content-type: application/json - -{ - "project_id": [15] -} - - -### -POST {{hostname}}/presence/search -Authorization: Bearer {{token}} -content-type: application/json - -{ - "paging":{ - "start":0, - "length":10 - }, - "columns":[], - "joins": [ - { - "name": "m_users", - "column_join": "user_id", - "column_results": [ - "name", - "ktp_number" - ] - } - ], - "orders":{ - "columns":[ - "id" - ], - "ascending":true - } -} - - - -### -POST {{hostname}}/assign-material/ForReportActivityByMaterial -Authorization: Bearer {{token}} -content-type: application/json - -{ - "idact": 387 -} - - -###### -GET {{hostname}}/presence/clockinout/262 -Authorization: Bearer {{token}} -content-type: application/json - - -###### - -POST {{hostname}}/presence/add -Authorization: Bearer {{token}} -content-type: application/json - -{ - "clock_out_lat": -6.2622811, - "clock_out_lng": 106.7881746, - "clock_time": "2022-04-25T16:40:17+07:00", - "type": "out", - "user_id": 262 -} \ No newline at end of file +@token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODQ0NFwvYXBpXC9sb2dpbiIsImlhdCI6MTY3NzQ3NzIzMSwiZXhwIjoxNjc4MDgyMDMxLCJuYmYiOjE2Nzc0NzcyMzEsImp0aSI6ImR5WWhRY3ZIbUJEcmFKMG0iLCJzdWIiOjEsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ.9zT6CBbQholzIdQ9ZBDoxMvrR-PKvIYkGzdNB6bim0Y + +@hostname = https://adw-api.ospro.id/api +# @hostname = https://ospro-api.ospro.id/api +# @hostname = https://api-iu.ospro.id/api +# @hostname = https://api-staging-adw.ospro.id/api +# @hostname = http://localhost:8444/api +# @hostname = http://103.73.125.81:8444/api +# @hostname = http://localhost:8444/adw-backend/api + +###### login +POST {{hostname}}/login +# Authorization: Bearer xxx +# X-REQUEST-TYPE: GraphQL 1123150023 +content-type: application/json + +{ + "username": "admin", + "password": "1nt3gr4s14" +} + +###### Tools Req +### add +POST {{hostname}}/req-tools/add +Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvb3Nwcm8tYXBpLm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjUyODYzNzM4LCJleHAiOjE2NTI5NTAxMzgsIm5iZiI6MTY1Mjg2MzczOCwianRpIjoia2ZwNnhwc0ZZZ0dFNEtGSSIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.f7a0M-GKYgacXtaEmZJUs2UOPFXaigEwGu8OfZ117kI + +content-type: application/json + +{ + "asset_type": "Alat Berat 1", + "asset_name": "Beco", + "required_date":"2021-12-16", + "qty": 10, + "uom": "Kg", + "description": "test Data", + "created_by":"admin", + "proyek_id":1 +} + +### update +PUT {{hostname}}/req-tools/update/3 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "qty": 332, +} + +### search +POST {{hostname}}/req-tools/search +Authorization: Bearer {{token}} +content-type: application/json + +{ + "paging":{ + "start":0, + "length":10 + }, + "columns":[ + { + "name":"asset_type", + "logic_operator":"like", + "value":"", + "operator":"AND" + }, + { + "name":"status", + "logic_operator":"<>", + "value":"receipt to site", + "operator":"AND" + } + ], + "joins":[], + "orders":{ + "columns":[ + "id" + ], + "ascending":false + } +} + +### delete +DELETE {{hostname}}/req-tools/delete/13 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + + +###### Menu +### add +POST {{hostname}}/menu/add +Authorization: {{token}} +content-type: application/json + +{ + "alias_name": "Alat Berat 1", + "icon": "#", + "name":"2021-12-16", + "parent_id": 23, + "sequence": 100, + "url": "test Data" +} + +### update +PUT {{hostname}}/req-tools/update/3 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "qty": 332, +} + +### search +POST {{hostname}}/menu/search +Authorization: Bearer {{token}} +content-type: application/json + +{ + "paging":{ + "start":0, + "length":10 + }, + "columns":[ + { + "name":"name", + "logic_operator":"like", + "value":"", + "operator":"AND" + } + ], + "joins":[ + { + "name":"m_menu", + "column_join":"parent_id", + "column_results":["name"], + } + ], + "orders":{ + "columns":[ + "id" + ], + "ascending":false + } +} + +### delete +DELETE {{hostname}}/req-tools/delete/13 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + + +###### Material Req +### add +POST {{hostname}}/request-material/add +Authorization: Bearer {{token}} +content-type: application/json + +{ + "description": "Lempengan Besi", + "required_date": "2022-05-04", + "qty": "1000", + "uom": "Lembar", + "fom_date": "2022-05-04", + "proyek_id": 29, + "price":10 + } + +### update +PUT {{hostname}}/request-material/update/20 +Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvb3Nwcm8tYXBpLm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjQyMTE1NjQyLCJleHAiOjE2NDIyMDIwNDIsIm5iZiI6MTY0MjExNTY0MiwianRpIjoiVWt1UjRnZjVUMHQ5YXRQWSIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.ftCrSs5v7GxqxW64ZcfZn40Opxom5YoFcDMMF1TvWrk +Content-Type: application/x-www-form-urlencoded +Accept: application/json + +{ + "description": "Pebble", + "fom_date": "2022-01-12T09:59:26.190Z", + "id": 20, + "po_date": null, + "pr_date": null, + "qty": "10", + "qty_received": "100", + "received_date": null, + "required_date": "2022-01-12T09:59:07.739Z", + "status": "fom", + "uom": "kg" +} + + + +### search +POST {{hostname}}/request-material/search +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "paging":{ + "start":0, + "length":10 + }, + "columns":[ + { + "name":"description", + "logic_operator":"like", + "value":"", + "operator":"AND" + } + ], + "joins":[], + "orders":{ + "columns":[ + "id" + ], + "ascending":false + } +} + +### delete +DELETE {{hostname}}/request-material/delete/2 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + + +###### Human Resource +### add +POST {{hostname}}/human-resource/add +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "role_id" : 1, + "username" : "ibnu", + "password" : "test", + "name" : "ibnu", + "phone_number" : "083823134569", + "email" : "ibnu@gmail.com", + "address" : "gria pesona madani", + "ktp_number" : "3212141105950004", + "employee_type" : "freelance" +} + +### update +PUT {{hostname}}/human-resource/update/8 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "address" : "gria pesona madani 1" +} + + +### delete +DELETE {{hostname}}/human-resource/delete/8 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +### search +POST {{hostname}}/human-resource/search +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "paging":{ + "start":0, + "length":10 + }, + "columns":[ + { + "name":"name", + "logic_operator":"like", + "value":"", + "operator":"AND" + } + ], + "joins":[], + "orders":{ + "columns":[ + "id" + ], + "ascending":false + } +} + + +###### Material Resource +### add +POST {{hostname}}/material-resource/add +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "id": 3, + "name": "Batangan Besi", + "uom": "truck", + "unit_price": 500000, + "description": "Pasir", + "qty": 1000 +} + +### update +PUT {{hostname}}/material-resource/update/5 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "uom" : "Batang" +} + + +### delete +DELETE {{hostname}}/material-resource/delete/5 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +### search +POST {{hostname}}/material-resource/search +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "paging":{ + "start":0, + "length":10 + }, + "columns":[ + { + "name":"name", + "logic_operator":"like", + "value":"", + "operator":"AND" + } + ], + "joins":[], + "orders":{ + "columns":[ + "id" + ], + "ascending":false + } +} + + +###### Tools Resource +### add +POST {{hostname}}/tools-resource/add +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "name": "Excavator Belco", + "description": "Excavator Belco", + "uom":"unit", + "qty": "100", + "asset_type": "Alat Berat" +} + +### update +PUT {{hostname}}/tools-resource/update/5 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "name" : "Excavator Kobelco" +} + + +### delete +DELETE {{hostname}}/tools-resource/delete/5 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +### search +POST {{hostname}}/tools-resource/search +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "paging":{ + "start":0, + "length":10 + }, + "columns":[ + { + "name":"name", + "logic_operator":"like", + "value":"", + "operator":"AND" + } + ], + "joins":[], + "orders":{ + "columns":[ + "id" + ], + "ascending":false + } +} + + +###### Project + +### list +GET {{hostname}}/project/list +Authorization: Bearer {{token}} +content-type: application/json + + +### add +POST {{hostname}}/project/add +Authorization: Bearer {{token}} +content-type: application/json + +{ + "nama": "Excavator Belco", + "keterangan": "Excavator Belco", + "mulai_proyek":"2022/01/11", + "akhir_proyek": "2022/05/11" +} + +### update +PUT {{hostname}}/project/update/5 +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "name" : "Excavator Kobelco" +} + + +### delete +DELETE {{hostname}}/project/delete/19 +Authorization: Bearer {{token}} +content-type: application/json + +### search +POST {{hostname}}/tools-resource/search +Authorization: Bearer dFWBXe6qQQm_s4DyH68yVt:APA91bFTms-pjqm-9OkugufLF2yjtOTJZQBlVxY8FC5iYq3owmWzGZtlPSSHholMeUxeE0TRQ6pFfEKvy5xRHnufPu4dJNiY-2gRGHKch6o4iWU9gp3GDHQ7sm-ySsE9keCMKzmQ11aM +content-type: application/json + +{ + "paging":{ + "start":0, + "length":10 + }, + "columns":[ + { + "name":"name", + "logic_operator":"like", + "value":"", + "operator":"AND" + } + ], + "joins":[], + "orders":{ + "columns":[ + "id" + ], + "ascending":false + } +} + +### dashboard +GET {{hostname}}/project/dashboard/47 +Authorization: Bearer {{token}} +content-type: application/json + + +###### Divisi + +### list +GET {{hostname}}/divisi/list +Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvb3Nwcm8tYXBpLm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjQxNDYwNDcyLCJleHAiOjE2NDE0NjQwNzIsIm5iZiI6MTY0MTQ2MDQ3MiwianRpIjoiRjRxYmJ3U25YcEw0OXN0QyIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.CLm_ZOEW5GCyGJuIcRNIRD8m1XxIeSCH60QK2HxF8d0 +content-type: application/json + + + +###### Activity +### get data by id version +GET {{hostname}}/activity/33/29/get +Authorization: Bearer {{token}} +content-type: application/json + +###### Rate Sallary + +### list +GET {{hostname}}/project-role/list +Authorization: Bearer {{token}} +content-type: application/json + + + +###### Rate Sallary + +### list +GET {{hostname}}/rate-sallary/list +Authorization: Bearer {{token}} +content-type: application/json + + +### add +POST {{hostname}}/rate-sallary/add +Authorization: Bearer {{token}} +content-type: application/json + +{ + "project_role_id" : 4, + "cost" : 2000, + "type_rate" : "UMR Jatim" +} + +### update +PUT {{hostname}}/rate-sallary/update/{id} +Authorization: Bearer {{token}} +content-type: application/json + +{ + "project_role_id" : 4, + "cost" : 2000, + "type_rate" : "UMR Jatim" +} + +### delete +POST {{hostname}}/rate-sallary/delete/{id} +Authorization: Bearer {{token}} +content-type: application/json + +{ + "project_role_id" : 4, + "cost" : 2000, + "type_rate" : "UMR Jatim" +} + + + +### search +POST {{hostname}}/dashboard/percentage-planning-actual +Authorization: Bearer {{token}} +content-type: application/json + +{ + "paging":{ + "start":0, + "length":10 + }, + "columns":[ + { + "name":"proyek_id", + "logic_operator":"in", + "value":[7,6,4], + "operator":"AND" + }, + { + "name":"version_gantt_id", + "logic_operator":"=", + "value":3, + "operator":"AND" + } + ], + "joins":[], + "orders":{ + "columns":[ + "proyek_id" + ], + "ascending":true + } +} + + +### +POST {{hostname}}/dashboard/cost-planning-actual +Authorization: Bearer {{token}} +content-type: application/json + +{ + "project_id" : [11] +} + + +### +POST {{hostname}}/dashboard/percentage-planning-actual +Authorization: Bearer {{token}} +content-type: application/json + +{ + "project_id" : [11] +} + + +###### project participants +### add +POST {{hostname}}/project-participants/add +Authorization: Bearer {{token}} +content-type: application/json + +{ + "proyek_id" : 11, + "tittle" : "investor", + "name" : "ibnu" +} + + +# get('/project-participants/edit/{id}', 'ProjectParticipantsController@edit'); +### update +# PUT {{hostname}}//project-participants/update/11 + +# POST {{hostname}}/project-participants/search +# DELETE {{hostname}}/project-participants/delete/{id} +# GET {{hostname}}/project-participants/list + +### +GET {{hostname}}/project-participants/list +Authorization: Bearer {{token}} +content-type: application/json + + +### +GET {{hostname}}/project-participants/proyek_id/11 +Authorization: Bearer {{token}} +content-type: application/json + +### +DELETE {{hostname}}/project-participants/delete/1 +Authorization: Bearer {{token}} +content-type: application/json + +### +DELETE {{hostname}}/project-participants/delete-by-proyek/7 +Authorization: Bearer {{token}} +content-type: application/json + +###### project-approval +POST {{hostname}}/project-approval/add +Authorization: Bearer {{token}} +content-type: application/json + +{ + "proyek_id" : 7, + "tittle" : "investor", + "name" : "koko", + "date_approval" : "2022/01/21" +} + +### +get {{hostname}}/project-approval/edit/{id} + + +put {{hostname}}/project-approval/update/{id} +post {{hostname}}/project-approval/search +delete {{hostname}}/project-approval/delete/{id} +get {{hostname}}/project-approval/list + +###### project-milestone +post {{hostname}}/project-milestone/add +Authorization: Bearer {{token}} +content-type: application/json + +{ + "proyek_id" : 7, + "status" : "Build 2. Finish eksekusi", + "due_date" : "2022/01/21", + "deadline" : "2022/01/21" +} + +### +get {{hostname}}/project-milestone/edit/{id} +put {{hostname}}/project-milestone/update/{id} +post {{hostname}}/project-milestone/search +delete {{hostname}}/project-milestone/delete/{id} +get {{hostname}}/project-milestone/list +get {{hostname}}/project-milestone/select + + +### +GET {{hostname}}/template-gantt/get-tree/3 +Authorization: Bearer {{token}} +content-type: application/json + +### +POST {{hostname}}/folder-document-proyek/add +Authorization: Bearer {{token}} +content-type: application/json + +{ + "proyek_id": "12", + "name_folder": "test 1", + "parent_id" : 1 +} + + +### +GET {{hostname}}/folder-document-proyek/list +Authorization: Bearer {{token}} +content-type: application/json + + +### +GET {{hostname}}/folder-document-proyek/get-tree/12 +Authorization: Bearer {{token}} +content-type: application/json + + + +### +POST {{hostname}}/human-resource/select +Authorization: Bearer {{token}} +content-type: application/json + +{ + "idact" : "362", + "idProyek": "11" +} + + +### +POST https://ospro-api.ospro.id/api/dashboard/status-proyek +Authorization: Bearer {{token}} +content-type: application/json + +{ + "project_id": [11] +} + + +### +POST {{hostname}}/activity/get-percentage +Authorization: Bearer {{token}} +content-type: application/json + +{ + "project_id": [11] +} + + +### +POST {{hostname}}/activity/get-curva-s +Authorization: Bearer {{token}} +content-type: application/json + +{ + "project_id": [47], + "period": "week" +} + + +### +POST {{hostname}}/dashboard/curva-s +Authorization: Bearer {{token}} +content-type: application/json + +{ + "project_id": [15] +} + +### +GET https://adw-api.ospro.id/api/request-material/get-material-integration?name=c +Authorization: Bearer {{token}} +content-type: application/json + +### +POST {{hostname}}/presence/search +Authorization: Bearer {{token}} +content-type: application/json + +{ + "paging":{ + "start":0, + "length":10 + }, + "columns":[], + "joins": [ + { + "name": "m_users", + "column_join": "user_id", + "column_results": [ + "username", + "name" + ] + } + ], + "orders":{ + "columns":[ + "id" + ], + "ascending":true + } +} + + +### +POST {{hostname}}/report-k3/search +Authorization: Bearer {{token}} +content-type: application/json + +{ + "paging": { + "start": 0, + "length": 10 + }, + "filter_columns": [ + { + "name": "name", + "value": "", + "table_name": "m_users" + } + ], + "columns": [ + { + "name": "report_date", + "logic_operator": "range", + "value": "2023-02-21 00:00:00", + "value1": "2023-02-21 23:59:59", + "operator": "AND" + }, + { + "name": "name", + "logic_operator": "ilike", + "value": "", + "operator": "AND", + "table_name": "m_users" + }, + { + "name": "proyek_id", + "logic_operator": "in", + "value": [ + 80, + 79, + 78, + 76, + 75, + 74, + 73, + 72, + 71, + 66, + 64, + 63, + 62, + 58, + 57, + 49, + 48, + 47, + 37, + 31 + ] + } + ], + "joins": [ + { + "name": "m_users", + "column_join": "user_id", + "column_results": [ + "name" + ] + }, + { + "name": "m_proyek", + "column_join": "proyek_id", + "column_results": [ + "nama" + ] + } + ], + "orders": { + "columns": [ + "id" + ], + "ascending": false + }, + "child_data": { + "table_name": "t_report_k3_detail", + "column_table": "report_k3_id", + "column_name": "id" + } +} + + + +### +POST {{hostname}}/assign-material/ForReportActivityByMaterial +Authorization: Bearer {{token}} +content-type: application/json + +{ + "idact": 387 +} + + +###### +GET {{hostname}}/presence/clockinout/262 +Authorization: Bearer {{token}} +content-type: application/json + +###### +POST {{hostname}}/presence/add +Authorization: Bearer {{token}} +content-type: application/json + +{ + "clock_in_lat": -6.16678379060529, + "clock_in_lng": 106.9175039866567, + "clock_time": "2023-02-16T14:48:17+07:00", + "type": "in", + "user_id": 1247 +} + +###### +POST {{hostname}}/presence/add +Authorization: Bearer {{token}} +content-type: application/json + +{ + "clock_in_lat": -1.4264273154149407, + "clock_in_lng": 113.98530036945851, + "clock_time": "2023-02-13T16:40:17+07:00", + "type": "in", + "user_id": 1 +} + +###### +# POST {{hostname}}/ +GET {{hostname}}/assign-material/datatablesForReportActivity?draw=2&columns[0][data]=material_name&columns[0][name]=material_name&columns[0][searchable]=true&columns[0][orderable]=true&columns[0][search][value]=&columns[0][search][regex]=false&columns[1][data]=type&columns[1][name]=type&columns[1][searchable]=true&columns[1][orderable]=true&columns[1][search][value]=&columns[1][search][regex]=false&columns[2][data]=qty_planning&columns[2][name]=&columns[2][searchable]=true&columns[2][orderable]=true&columns[2][search][value]=&columns[2][search][regex]=false&columns[3][data]=qty_sum&columns[3][name]=&columns[3][searchable]=true&columns[3][orderable]=true&columns[3][search][value]=&columns[3][search][regex]=false&columns[4][data]=uom&columns[4][name]=uom&columns[4][searchable]=true&columns[4][orderable]=true&columns[4][search][value]=&columns[4][search][regex]=false&columns[5][data]=action&columns[5][name]=action&columns[5][searchable]=true&columns[5][orderable]=true&columns[5][search][value]=&columns[5][search][regex]=false&order[0][column]=0&order[0][dir]=asc&start=0&length=10&search[value]=&search[regex]=false&idact=2511&_=1675418553660 +Authorization: Bearer {{token}} +content-type: application/json + +###### +GET {{hostname}}/dashboard/get-total-project-per-schedule-health +Authorization: Bearer {{token}} +content-type: application/json + +###### +GET {{hostname}}/dashboard/get-detail-expenditure +Authorization: Bearer {{token}} +content-type: application/json + + +###### +GET {{hostname}}/presence/bulk-update-location +Authorization: Bearer {{token}} +content-type: application/json + + +##### +GET https://nominatim.oslogdev.com/reverse?lat=-6.2622811&lon=106.7881746&format=json + +###### + +POST {{hostname}}/waypoint/add +Authorization: Bearer {{token}} +content-type: application/json +{ + "user_id": 1247, + "lat": -6.2622811, + "lng": 106.7881746, + "wptime": "2023-02-07T10:40:17+07:00", + "speed": 0, + "angle": 0, + "satelite": 0 +} + +###### +POST {{hostname}}/map-monitoring/search +Authorization: Bearer {{token}} +content-type: application/json + +{ + "project_id" : [75, 76, 78] +} + +###### +POST {{hostname}}/waypoint/add-bulk +Authorization: Bearer {{token}} +content-type: application/json + +{ + "wp_records": [ + { + "user_id": 1247, + "lon": 106.88702067952579, + "lat": -6.193331793510694, + "wptime": "2023-02-07T10:40:17+07:00", + "speed": 0, + "angle": 0, + "satelite": 0, + "datesend": "2023-02-07T10:40:17+07:00" + }, + { + "user_id": 1247, + "lon": 106.88731982052337, + "lat": -6.1933255977790225, + "wptime": "2023-02-07T10:41:17+07:00", + "speed": 0, + "angle": 0, + "satelite": 0, + "datesend": "2023-02-07T10:41:17+07:00" + }, + { + "user_id": 1247, + "lon": 106.88765896352822, + "lat": -6.193328086924183, + "wptime": "2023-02-07T10:42:17+07:00", + "speed": 0, + "angle": 0, + "satelite": 0, + "datesend": "2023-02-07T10:42:17+07:00" + }, + { + "user_id": 1247, + "lon": 106.88812637133634, + "lat": -6.1933373805197505, + "wptime": "2023-02-07T10:43:17+07:00", + "speed": 0, + "angle": 0, + "satelite": 0, + "datesend": "2023-02-07T10:43:17+07:00" + }, + { + "user_id": 1247, + "lon": 106.88867721532353, + "lat": -6.1933448515770095, + "wptime": "2023-02-07T10:44:17+07:00", + "speed": 0, + "angle": 0, + "satelite": 0, + "datesend": "2023-02-07T10:44:17+07:00" + } + ] +} + +##### +POST {{hostname}}/map-monitoring/search +Authorization: Bearer {{token}} +content-type: application/json + +{ + "time_from": "2023-02-10 00:00:00", + "time_to": "2023-02-10 23:59:00", +} + +# { +# "columns": [ +# { +# "logic_operator": "range", +# "name": "created_at", +# "operator": "AND", +# "value": "2023-02-10 00:00:00", +# "value1": "2023-02-10 23:59:00" +# } +# ], +# "joins": [ +# { +# "column_join": "user_id", +# "column_results": [ +# "username", "name" +# ], +# "name": "m_users" +# } +# ], +# "orders": { +# "ascending": false, +# "columns": [ +# "created_at" +# ] +# }, +# "paging": { +# "length": 25, +# "start": 0 +# } +# } + + +<<<<<<< HEAD +GET /stock_master?name=SEARCH + +###### +GET {{hostname}}/request-material/get-material-integration +Authorization: Bearer {{token}} +content-type: application/json + + +###### +POST {{hostname}}/presence/reportk3 +Authorization: Bearer {{token}} +content-type: application/json + +{ + "time" : "2023-02-16T14:48:17+07:00", // untuk report date, time_clockin/out + "user_id": 1247, + "clock_in_out": { + "clock_in_lat": -6.16678379060529, + "clock_in_lng": 106.9175039866567, + "type": "in" + }, + "report_k3": { + "proyek_id": "", + "description": "", + "detail": [{ + "checklist_id": 1, + "checklist_name": "" + }, + { + "checklist_id": 2, + "checklist_name": "" + }] + + } +} diff --git a/routes/web.php b/routes/web.php index b636078..337e6e3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,37 +1,38 @@ get('/', function () use ($router) { - return $router->app->version(); + return $router->app->version(); }); $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($router) { - $router->post('/login', 'AuthController@login'); - - $router->post('/menu/add', 'MenuController@add'); - $router->get('/menu/edit/{id}', 'MenuController@edit'); - $router->put('/menu/update/{id}', 'MenuController@update'); - $router->delete('/menu/delete/{id}', 'MenuController@delete'); - $router->post('/menu/search', 'MenuController@search'); - $router->get('/menu/management/{id}', 'MenuController@listMenu'); - $router->get('/menu/list', 'MenuController@list'); - $router->post('/role-menu/add', 'RoleMenuController@add'); - $router->put('/role-menu/update/{id}', 'RoleMenuController@update'); - $router->delete('/role-menu/delete/{id}', 'RoleMenuController@delete'); - $router->delete('/role-menu/delete-byrole/{id}', 'RoleMenuController@deleteByRole'); - $router->post('/role-menu/search', 'RoleMenuController@search'); - $router->get('/role-menu/get-role/{id}', 'RoleMenuController@listMenu'); - - $router->group(['middleware' => ['auth', 'cors']], function () use ($router) { - - $router->get('/dashboard/get-company-cashflow[/{year}]', 'DashboardBoDController@getCompanyCashFlow'); // project expenditure - $router->get('/dashboard/get-invoice-outstanding[/{year}]', 'DashboardBoDController@getInvoiceOutstanding'); // project invoice vs cash in - $router->get('/dashboard/get-project-per-schedule-health[/{year}]', 'DashboardBoDController@getProjectPerScheduleHealth'); - $router->get('/dashboard/get-project-per-budget-health[/{year}]', 'DashboardBoDController@getProjectPerBudgetHealth'); - $router->get('/dashboard/get-project-schedule-health-per-division[/{year}]', 'DashboardBoDController@getProjectScheduleHealthPerDivision'); - $router->get('/dashboard/get-project-budget-health-per-division[/{year}]', 'DashboardBoDController@getProjectBudgetHealthPerDivision'); - $router->get('/dashboard/get-project-per-phase[/{year}]', 'DashboardBoDController@getProjectPerPhase'); // todo - $router->get('/dashboard/get-total-project-per-division[/{year}]', 'DashboardBoDController@getTotalProjectPerDivision'); // done - $router->get('/dashboard/get-total-project-value-per-division[/{year}]', 'DashboardBoDController@getTotalProjectValuePerDivision'); // done + $router->post('/login', 'AuthController@login'); + + $router->post('/menu/add', 'MenuController@add'); + $router->get('/menu/edit/{id}', 'MenuController@edit'); + $router->put('/menu/update/{id}', 'MenuController@update'); + $router->delete('/menu/delete/{id}', 'MenuController@delete'); + $router->post('/menu/search', 'MenuController@search'); + $router->get('/menu/management/{id}', 'MenuController@listMenu'); + $router->get('/menu/list', 'MenuController@list'); + $router->post('/role-menu/add', 'RoleMenuController@add'); + $router->put('/role-menu/update/{id}', 'RoleMenuController@update'); + $router->delete('/role-menu/delete/{id}', 'RoleMenuController@delete'); + $router->delete('/role-menu/delete-byrole/{id}', 'RoleMenuController@deleteByRole'); + $router->post('/role-menu/search', 'RoleMenuController@search'); + $router->get('/role-menu/get-role/{id}', 'RoleMenuController@listMenu'); + + $router->group(['middleware' => ['auth', 'cors']], function () use ($router) { + + $router->get('/dashboard/get-company-cashflow[/{year}]', 'DashboardBoDController@getCompanyCashFlow'); // project expenditure + $router->get('/dashboard/get-invoice-outstanding[/{year}]', 'DashboardBoDController@getInvoiceOutstanding'); // project invoice vs cash in + $router->get('/dashboard/get-total-project-per-schedule-health[/{year}]', 'DashboardBoDController@getTotalProjectPerScheduleHealth'); + $router->get('/dashboard/get-total-project-per-budget-health[/{year}]', 'DashboardBoDController@getTotalProjectPerBudgetHealth'); + $router->get('/dashboard/get-total-project-schedule-health-per-division[/{year}]', 'DashboardBoDController@getTotalProjectScheduleHealthPerDivision'); + $router->get('/dashboard/get-total-project-budget-health-per-division[/{year}]', 'DashboardBoDController@getTotalProjectBudgetHealthPerDivision'); + $router->get('/dashboard/get-total-project-per-phase[/{year}]', 'DashboardBoDController@getTotalProjectPerPhase'); + $router->get('/dashboard/get-total-project-per-division[/{year}]', 'DashboardBoDController@getTotalProjectPerDivision'); + $router->get('/dashboard/get-total-project-value-per-division[/{year}]', 'DashboardBoDController@getTotalProjectValuePerDivision'); + $router->get('/dashboard/get-detail-expenditure[/{year}]', 'DashboardBoDController@getDetailExpenditure'); $router->post('/role/search', 'RoleController@search'); $router->post('/role/add', 'RoleController@add'); @@ -40,384 +41,405 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout $router->delete('/role/delete/{id}', 'RoleController@delete'); $router->get('/role/list', 'RoleController@list'); - $router->post('/document-project/upload', 'ProjectDokumenController@uploadProjectDokumen'); - $router->get('/document-project/get/{id}', 'ProjectDokumenController@dokumenByProyekId'); - $router->delete('/document-project/delete/{id}', 'ProjectDokumenController@delete'); - $router->post('/document-project/search', 'ProjectDokumenController@searchDocProject'); + $router->post('/document-project/upload', 'ProjectDokumenController@uploadProjectDokumen'); + $router->get('/document-project/get/{id}', 'ProjectDokumenController@dokumenByProyekId'); + $router->delete('/document-project/delete/{id}', 'ProjectDokumenController@delete'); + $router->post('/document-project/search', 'ProjectDokumenController@searchDocProject'); $router->get('/document-project/download/{id}', 'ProjectDokumenController@downloadDokumen'); - $router->post('/document-activity/upload', 'ActivityDokumenController@uploadProjectDokumen'); - $router->get('/document-activity/get/{id}', 'ActivityDokumenController@dokumenByActivityId'); - $router->delete('/document-activity/delete/{id}', 'ActivityDokumenController@delete'); - $router->post('/document-activity/search', 'ActivityDokumenController@searchDocProject'); - $router->get('/document-activity/download/{id}', 'ActivityDokumenController@downloadDokumen'); - - $router->post('/project/search', 'ProjectController@search'); - $router->post('/project/add', 'ProjectController@add'); - $router->put('/project/update/{id}', 'ProjectController@update'); - $router->get('/project/edit/{id}', 'ProjectController@edit'); - $router->delete('/project/delete/{id}', 'ProjectController@delete'); - $router->get('/project/list', 'ProjectController@list'); - $router->get('/project/dashboard/{id}', 'ProjectController@dashboard'); - $router->get('/project/list-user/{id}', 'ProjectController@getListProjectTask'); - $router->post('/project-charter/search', 'ProjectCharterController@search'); - $router->post('/project-charter/add', 'ProjectCharterController@add'); - $router->put('/project-charter/update/{id}', 'ProjectCharterController@update'); - - $router->post('/divisi/add', 'DivisiController@add'); - $router->get('/divisi/edit/{id}', 'DivisiController@edit'); - $router->put('/divisi/update/{id}', 'DivisiController@update'); - $router->post('/divisi/search', 'DivisiController@search'); - $router->delete('/divisi/delete/{id}', 'DivisiController@delete'); - $router->get('/divisi/list', 'DivisiController@list'); - - $router->post('/config-alert/search', 'ConfigAlertController@search'); - $router->post('/config-alert/add', 'ConfigAlertController@add'); - $router->get('/config-alert/edit/{id}', 'ConfigAlertController@edit'); - $router->put('/config-alert/update/{id}', 'ConfigAlertController@update'); - $router->delete('/config-alert/delete/{id}', 'ConfigAlertController@delete'); - $router->get('/config-alert/list', 'ConfigAlertController@list'); - - $router->post('/config-alert-to-user/search', 'ConfigAlertUserController@search'); - $router->post('/config-alert-to-user/add', 'ConfigAlertUserController@add'); - $router->put('/config-alert-to-user/update/{id}', 'ConfigAlertUserController@update'); - $router->delete('/config-alert-to-user/delete/{id}', 'ConfigAlertUserController@delete'); - $router->get('/config-alert/get-user/{id}', 'ConfigAlertUserController@getConfigUser'); - - $router->post('/human-resource/search', 'HumanResourceController@search'); - $router->post('/human-resource/add', 'HumanResourceController@add'); - $router->get('/human-resource/edit/{id}', 'HumanResourceController@edit'); - $router->put('/human-resource/update/{id}', 'HumanResourceController@update'); - $router->delete('/human-resource/delete/{id}', 'HumanResourceController@delete'); - $router->get('/human-resource/list', 'HumanResourceController@list'); - $router->get('/human-resource/select', 'HumanResourceController@select'); - $router->post('/human-resource/check-old-password/{id}', 'HumanResourceController@checkOldPassword'); - - $router->post('/project-role/search', 'ProjectRoleController@search'); - $router->post('/project-role/add', 'ProjectRoleController@add'); - $router->get('/project-role/edit/{id}', 'ProjectRoleController@edit'); - $router->put('/project-role/update/{id}', 'ProjectRoleController@update'); - $router->delete('/project-role/delete/{id}', 'ProjectRoleController@delete'); - $router->get('/project-role/list', 'ProjectRoleController@list'); - $router->get('/project-role/select', 'ProjectRoleController@select'); - - $router->post('/project-type/search', 'ProjectTypeController@search'); - $router->post('/project-type/add', 'ProjectTypeController@add'); - $router->get('/project-type/edit/{id}', 'ProjectTypeController@edit'); - $router->put('/project-type/update/{id}', 'ProjectTypeController@update'); - $router->delete('/project-type/delete/{id}', 'ProjectTypeController@delete'); - $router->get('/project-type/list', 'ProjectTypeController@list'); - - $router->post('/project-phase/search', 'ProjectPhaseController@search'); - $router->post('/project-phase/add', 'ProjectPhaseController@add'); - $router->get('/project-phase/edit/{id}', 'ProjectPhaseController@edit'); - $router->put('/project-phase/update/{id}', 'ProjectPhaseController@update'); - $router->delete('/project-phase/delete/{id}', 'ProjectPhaseController@delete'); - $router->get('/project-phase/list', 'ProjectPhaseController@list'); - - $router->post('/user-to-project/assign', 'UserProyekController@assignUserProyek'); - - $router->post('/request-material/add', 'RequestMaterialController@add'); - $router->post('/request-material/search', 'RequestMaterialController@search'); - $router->get('/request-material/edit/{id}', 'RequestMaterialController@edit'); - $router->put('/request-material/update/{id}', 'RequestMaterialController@update'); - $router->delete('/request-material/delete/{id}', 'RequestMaterialController@delete'); - $router->get('/request-material/list', 'RequestMaterialController@list'); - $router->get('/request-material/get-material-integration', 'RequestMaterialController@getMaterialIntegration'); - - $router->put('/request-material/update-warehouse-site/{id}', 'RequestMaterialController@updateWarehouseSite'); - - $router->post('/material-to-project/assign', 'MaterialProjectController@assignMaterial'); - - $router->post('/material-resource/add', 'MaterialResourceController@add'); - $router->post('/material-resource/search', 'MaterialResourceController@search'); - $router->get('/material-resource/update/{id}', 'MaterialResourceController@edit'); - $router->put('/material-resource/update/{id}', 'MaterialResourceController@update'); - $router->delete('/material-resource/delete/{id}', 'MaterialResourceController@delete'); - $router->get('/material-resource/list', 'MaterialResourceController@list'); - $router->get('/material-resource/select', 'MaterialResourceController@select'); - - $router->post('/tools-to-project/assign', 'ToolsProjectController@assignTools'); - $router->get('/tools-to-project/search', 'ToolsProjectController@searchTools'); - - $router->post('/tools-resource/add', 'ToolsResourceController@add'); - $router->post('/tools-resource/search', 'ToolsResourceController@search'); - $router->get('/tools-resource/edit/{id}', 'ToolsResourceController@edit'); - $router->put('/tools-resource/update/{id}', 'ToolsResourceController@update'); - $router->delete('/tools-resource/delete/{id}', 'ToolsResourceController@delete'); - $router->get('/tools-resource/list', 'ToolsResourceController@list'); - $router->get('/tools-resource/select', 'ToolsResourceController@select'); - - $router->post('/req-tools/add', 'ToolsRequestController@add'); - $router->get('/req-tools/edit/{id}', 'ToolsRequestController@edit'); - $router->put('/req-tools/update/{id}', 'ToolsRequestController@update'); - $router->post('/req-tools/search', 'ToolsRequestController@search'); - $router->delete('/req-tools/delete/{id}', 'ToolsRequestController@delete'); - $router->get('/req-tools/list', 'ToolsRequestController@list'); - - $router->post('/version-gantt/add', 'VersionGanttController@add'); - $router->get('/version-gantt/edit/{id}', 'VersionGanttController@edit'); - $router->put('/version-gantt/update/{id}', 'VersionGanttController@update'); - $router->post('/version-gantt/search', 'VersionGanttController@search'); - $router->delete('/version-gantt/delete/{id}', 'VersionGanttController@delete'); - $router->get('/version-gantt/list', 'VersionGanttController@list'); - - $router->post('/user-to-version-gantt/add', 'UserToVersionGanttController@add'); - $router->post('/user-to-version-gantt/add-multiple', 'UserToVersionGanttController@addMultiple'); - $router->get('/user-to-version-gantt/edit/{id}', 'UserToVersionGanttController@edit'); - $router->put('/user-to-version-gantt/update/{id}', 'UserToVersionGanttController@update'); - $router->post('/user-to-version-gantt/search', 'UserToVersionGanttController@search'); - $router->delete('/user-to-version-gantt/delete/{id}', 'UserToVersionGanttController@delete'); - $router->get('/user-to-version-gantt/list', 'UserToVersionGanttController@list'); - $router->get('/user-to-version-gantt/get-by-gantt/{gantt_id}', 'UserToVersionGanttController@getByUserGantt'); - - $router->post('/user-to-activity/add', 'UserToActivityController@add'); - $router->post('/user-to-activity/add-multiple', 'UserToActivityController@addMultiple'); - $router->get('/user-to-activity/edit/{id}', 'UserToActivityController@edit'); - $router->put('/user-to-activity/update/{id}', 'UserToActivityController@update'); - $router->post('/user-to-activity/search', 'UserToActivityController@search'); - $router->delete('/user-to-activity/delete/{id}', 'UserToActivityController@delete'); - $router->get('/user-to-activity/list', 'UserToActivityController@list'); - $router->get('/user-to-activity/datatables', 'UserToActivityController@datatables'); - - $router->get('/sumVolActualM/{id}', 'ActivityController@sumVolumeActualMaterial'); - $router->get('/activity/{id}/{proyek_id}/get', 'ActivityController@getByGanttId'); - $router->get('/activity/search', 'ActivityController@search'); - $router->post('/task', 'ActivityController@add'); - $router->get('/task/edit/{id}', 'ActivityController@edit'); - $router->put('/task/{id}', 'ActivityController@update'); - $router->put('/task/update-regular/{id}', 'ActivityController@updateRegular'); - $router->delete('/task/{id}', 'ActivityController@delete'); - $router->get('/task/get-update/{id}', 'ActivityController@getUpdate'); - $router->post('/activity/get-percentage', 'ActivityController@getPercentagePerDay'); - $router->get('/activity/set-baseline/{gantt_id}', 'ActivityController@setBaseline'); - $router->post('/activity/get-curva-s', 'ActivityController@getCalculateCurvaS'); - $router->get('/activity/synchronize-report/{gantt_id}', 'ActivityController@synchronizeReport'); - - $router->post('/link', 'LinkController@add'); - $router->put('/link/{id}', 'LinkController@update'); - $router->delete('/link/{id}', 'LinkController@delete'); - - $router->post('/template-gantt/add', 'TemplateGanttController@add'); - $router->get('/template-gantt/edit/{id}', 'TemplateGanttController@edit'); - $router->put('/template-gantt/update/{id}', 'TemplateGanttController@update'); - $router->post('/template-gantt/search', 'TemplateGanttController@search'); - $router->delete('/template-gantt/delete/{id}', 'TemplateGanttController@delete'); - $router->get('/template-gantt/list', 'TemplateGanttController@list'); - $router->get('/template-gantt/get-tree/{id}', 'TemplateGanttController@getTreeByTypeProject'); - - $router->post('/comment-activity/add', 'CommentActivityController@add'); - $router->get('/comment-activity/edit/{id}', 'CommentActivityController@edit'); - $router->put('/comment-activity/update/{id}', 'CommentActivityController@update'); - $router->post('/comment-activity/search', 'CommentActivityController@search'); - $router->delete('/comment-activity/delete/{id}', 'CommentActivityController@delete'); - $router->get('/comment-activity/list', 'CommentActivityController@list'); - - $router->post('/presence/add', 'PresenceController@add'); - $router->get('/presence/edit/{id}', 'PresenceController@edit'); - $router->put('/presence/update/{id}', 'PresenceController@update'); - $router->post('/presence/search', 'PresenceController@search'); - $router->delete('/presence/delete/{id}', 'PresenceController@delete'); - $router->get('/presence/list', 'PresenceController@list'); - $router->get('/presence/clockinout/{id}', 'PresenceController@clockinout'); - $router->get('/presence/bulk-update-location', 'PresenceController@bulkUpdateLocation'); - - $router->post('/permit/add', 'AbsentController@add'); - $router->get('/permit/edit/{id}', 'AbsentController@edit'); - $router->put('/permit/update/{id}', 'AbsentController@update'); - $router->post('/permit/search', 'AbsentController@search'); - $router->delete('/permit/delete/{id}', 'AbsentController@delete'); - $router->get('/permit/list', 'AbsentController@list'); - - $router->post('/assign-tools/add', 'AssignToolsController@add'); - $router->get('/assign-tools/edit/{id}', 'AssignToolsController@edit'); - $router->put('/assign-tools/update/{id}', 'AssignToolsController@update'); - $router->post('/assign-tools/search', 'AssignToolsController@search'); - $router->delete('/assign-tools/delete/{id}', 'AssignToolsController@delete'); - $router->get('/assign-tools/list', 'AssignToolsController@list'); - $router->get('/assign-tools/datatables', 'AssignToolsController@datatables'); - - $router->post('/assign-material/add', 'AssignMaterialController@add'); - $router->get('/assign-material/edit/{id}', 'AssignMaterialController@edit'); - $router->put('/assign-material/update/{id}', 'AssignMaterialController@update'); - $router->post('/assign-material/search', 'AssignMaterialController@search'); - $router->delete('/assign-material/delete/{id}', 'AssignMaterialController@delete'); - $router->get('/assign-material/list', 'AssignMaterialController@list'); - $router->get('/assign-material/datatables', 'AssignMaterialController@datatables'); - $router->get('/assign-material/datatablesForReportActivity', 'AssignMaterialController@datatablesForReportActivity'); - $router->post('/assign-material/ForReportActivityByMaterial', 'AssignMaterialController@ForReportActivityByMaterial'); - - $router->post('/image/search', 'ImageController@search'); - $router->delete('/image/delete/{id}', 'ImageController@delete'); - $router->delete('/image/delete/{id}/{category}', 'ImageController@deleteByRef'); - $router->post('/image/upload', 'ImageController@uploadImage'); - $router->get('/image/{id}/{category}', 'ImageController@getByRefId'); - - $router->post('/panic-button/add', 'PanicButtonController@add'); - $router->get('/panic-button/edit/{id}', 'PanicButtonController@edit'); - $router->put('/panic-button/update/{id}', 'PanicButtonController@update'); - $router->post('/panic-button/search', 'PanicButtonController@search'); - $router->delete('/panic-button/delete/{id}', 'PanicButtonController@delete'); - $router->get('/panic-button/list', 'PanicButtonController@list'); - - $router->post('/rate-sallary/add', 'RateSallaryController@add'); - $router->get('/rate-sallary/edit/{id}', 'RateSallaryController@edit'); - $router->put('/rate-sallary/update/{id}', 'RateSallaryController@update'); - $router->post('/rate-sallary/search', 'RateSallaryController@search'); - $router->delete('/rate-sallary/delete/{id}', 'RateSallaryController@delete'); - $router->get('/rate-sallary/list', 'RateSallaryController@list'); - - $router->post('/project-participants/add', 'ProjectParticipantsController@add'); - $router->get('/project-participants/edit/{id}', 'ProjectParticipantsController@edit'); - $router->put('/project-participants/update/{id}', 'ProjectParticipantsController@update'); - $router->post('/project-participants/search', 'ProjectParticipantsController@search'); - $router->delete('/project-participants/delete/{id}', 'ProjectParticipantsController@delete'); - $router->delete('/project-participants/delete-by-proyek/{id}', 'ProjectParticipantsController@deleteByProyek'); - $router->get('/project-participants/list', 'ProjectParticipantsController@list'); - $router->get('/project-participants/{where}/{val}', 'ProjectParticipantsController@customWhere'); - - $router->post('/project-approval/add', 'ProjectApprovalController@add'); - $router->get('/project-approval/edit/{id}', 'ProjectApprovalController@edit'); - $router->put('/project-approval/update/{id}', 'ProjectApprovalController@update'); - $router->post('/project-approval/search', 'ProjectApprovalController@search'); - $router->delete('/project-approval/delete/{id}', 'ProjectApprovalController@delete'); - $router->delete('/project-approval/delete-by-proyek/{id}', 'ProjectApprovalController@deleteByProyek'); - $router->get('/project-approval/list', 'ProjectApprovalController@list'); - $router->get('/project-approval/{where}/{val}', 'ProjectApprovalController@customWhere'); - - $router->post('/project-milestone/add', 'ProjectMileStoneController@add'); - $router->get('/project-milestone/edit/{id}', 'ProjectMileStoneController@edit'); - $router->put('/project-milestone/update/{id}', 'ProjectMileStoneController@update'); - $router->post('/project-milestone/search', 'ProjectMileStoneController@search'); - $router->delete('/project-milestone/delete/{id}', 'ProjectMileStoneController@delete'); - $router->delete('/project-milestone/delete-by-proyek/{id}', 'ProjectMileStoneController@deleteByProyek'); - $router->get('/project-milestone/list', 'ProjectMileStoneController@list'); - $router->get('/project-milestone/select', 'ProjectMileStoneController@select'); - $router->get('/project-milestone/{where}/{val}', 'ProjectMileStoneController@customWhere'); - - $router->post('/report-activity/add', 'ReportActivityController@add'); - $router->get('/report-activity/edit/{id}', 'ReportActivityController@edit'); - $router->put('/report-activity/update/{id}', 'ReportActivityController@update'); - $router->post('/report-activity/search', 'ReportActivityController@search'); - $router->delete('/report-activity/delete/{id}', 'ReportActivityController@delete'); - $router->get('/report-activity/list', 'ReportActivityController@list'); - $router->post('/report-activity/search-point', 'ReportActivityController@searchPoint'); - $router->get('/report-activity/datatables', 'ReportActivityController@datatables'); - - $router->post('/report-activity-material/add', 'ReportActivityMaterialController@add'); - $router->post('/report-activity-material/search', 'ReportActivityMaterialController@search'); - $router->delete('/report-activity-material/delete/{id}', 'ReportActivityMaterialController@delete'); - $router->get('/report-activity-material/list', 'ReportActivityMaterialController@list'); - $router->get('/report-activity-material/datatables', 'ReportActivityMaterialController@datatables'); - $router->post('/report-activity-material/update-status', 'ReportActivityMaterialController@updateStatusStartFinish'); - $router->get('/report-activity-material/test', 'ReportActivityMaterialController@countForProgressTest'); - - - $router->post('/waypoint/add', 'WaypointController@add'); - $router->get('/waypoint/edit/{id}', 'WaypointController@edit'); - $router->put('/waypoint/update/{id}', 'WaypointController@update'); - $router->post('/waypoint/search', 'WaypointController@search'); - $router->delete('/waypoint/delete/{id}', 'WaypointController@delete'); - $router->get('/waypoint/list', 'WaypointController@list'); - - $router->post('/holiday/add', 'HolidayController@add'); - $router->get('/holiday/edit/{id}', 'HolidayController@edit'); - $router->put('/holiday/update/{id}', 'HolidayController@update'); - $router->post('/holiday/search', 'HolidayController@search'); - $router->delete('/holiday/delete/{id}', 'HolidayController@delete'); - $router->get('/holiday/list', 'HolidayController@list'); - $router->get('/holiday/datatables', 'HolidayController@datatables'); - - $router->post('/satuan/add', 'SatuanController@add'); - $router->get('/satuan/edit/{id}', 'SatuanController@edit'); - $router->put('/satuan/update/{id}', 'SatuanController@update'); - $router->post('/satuan/search', 'SatuanController@search'); - $router->delete('/satuan/delete/{id}', 'SatuanController@delete'); - $router->get('/satuan/list', 'SatuanController@list'); - - $router->post('/checklist-k3/add', 'ChecklistK3Controller@add'); - $router->get('/checklist-k3/edit/{id}', 'ChecklistK3Controller@edit'); - $router->put('/checklist-k3/update/{id}', 'ChecklistK3Controller@update'); - $router->post('/checklist-k3/search', 'ChecklistK3Controller@search'); - $router->delete('/checklist-k3/delete/{id}', 'ChecklistK3Controller@delete'); - $router->get('/checklist-k3/list', 'ChecklistK3Controller@list'); - - $router->post('/report-k3/add', 'ReportK3Controller@add'); - $router->get('/report-k3/edit/{id}', 'ReportK3Controller@edit'); - $router->put('/report-k3/update/{id}', 'ReportK3Controller@update'); - $router->post('/report-k3/search', 'ReportK3Controller@search'); - $router->delete('/report-k3/delete/{id}', 'ReportK3Controller@delete'); - $router->get('/report-k3/list', 'ReportK3Controller@list'); - - $router->post('/report-k3-detail/add', 'ReportK3DetailController@add'); - $router->get('/report-k3-detail/edit/{id}', 'ReportK3DetailController@edit'); - $router->put('/report-k3-detail/update/{id}', 'ReportK3DetailController@update'); - $router->post('/report-k3-detail/search', 'ReportK3DetailController@search'); - $router->delete('/report-k3-detail/delete/{id}', 'ReportK3DetailController@delete'); - $router->get('/report-k3-detail/list', 'ReportK3DetailController@list'); - - $router->post('/user-to-proyek/add', 'UserToProyekController@add'); - $router->get('/user-to-proyek/edit/{id}', 'UserToProyekController@edit'); - $router->put('/user-to-proyek/update/{id}', 'UserToProyekController@update'); - $router->post('/user-to-proyek/search', 'UserToProyekController@search'); - $router->delete('/user-to-proyek/delete/{id}', 'UserToProyekController@delete'); - $router->get('/user-to-proyek/list', 'UserToProyekController@list'); - $router->get('/user-to-proyek/select', 'UserToProyekController@select'); - $router->get('/user-to-proyek/get-employee-integration', 'UserToProyekController@getEmployeeIntegration'); - - $router->post('/folder-document-proyek/add', 'FolderDocumentProyekController@add'); - $router->get('/folder-document-proyek/edit/{id}', 'FolderDocumentProyekController@edit'); - $router->put('/folder-document-proyek/update/{id}', 'FolderDocumentProyekController@update'); - $router->post('/folder-document-proyek/search', 'FolderDocumentProyekController@search'); - $router->delete('/folder-document-proyek/delete/{id}', 'FolderDocumentProyekController@delete'); - $router->get('/folder-document-proyek/list', 'FolderDocumentProyekController@list'); - $router->get('/folder-document-proyek/get-tree/{id}', 'FolderDocumentProyekController@getTree'); - - $router->post('/office-hours/add', 'OfficeHoursController@add'); - $router->get('/office-hours/edit/{id}', 'OfficeHoursController@edit'); - $router->put('/office-hours/update/{id}', 'OfficeHoursController@update'); - $router->post('/office-hours/search', 'OfficeHoursController@search'); - $router->delete('/office-hours/delete/{id}', 'OfficeHoursController@delete'); - $router->get('/office-hours/list', 'OfficeHoursController@list'); - - $router->get('/gantt-show-hide/get-by-gantt/{gantt_id}', 'ShowHideColumnController@getByUserGantt'); - $router->post('/gantt-show-hide/add', 'ShowHideColumnController@add'); - $router->post('/gantt-show-hide/update/{gantt_id}', 'ShowHideColumnController@update'); - - - $router->post('/shift/add', 'ShiftController@add'); - $router->get('/shift/edit/{id}', 'ShiftController@edit'); - $router->put('/shift/update/{id}', 'ShiftController@update'); - $router->post('/shift/search', 'ShiftController@search'); - $router->delete('/shift/delete/{id}', 'ShiftController@delete'); - $router->get('/shift/list', 'ShiftController@list'); - - $router->post('/user-monthly-shift/add', 'UserMonthlyShiftController@add'); - $router->put('/user-monthly-shift/update/{id}', 'UserMonthlyShiftController@update'); - $router->post('/user-monthly-shift/search', 'UserMonthlyShiftController@search'); - $router->delete('/user-monthly-shift/delete/{id}', 'UserMonthlyShiftController@delete'); - $router->delete('/user-monthly-shift/delete-at/{yyyymm}', 'UserMonthlyShiftController@deleteYYYYMM'); - $router->get('/user-monthly-shift/list', 'UserMonthlyShiftController@list'); - $router->post('/user-monthly-shift/import', 'UserMonthlyShiftController@import'); - $router->get('/user-monthly-shift/list/{yyyymm}', 'UserMonthlyShiftController@listYYYYMM'); - - $router->post('/user-to-shift/add', 'UserToShiftController@add'); - $router->get('/user-to-shift/edit/{id}', 'UserToShiftController@edit'); - $router->put('/user-to-shift/update/{id}', 'UserToShiftController@update'); - $router->post('/user-to-shift/search', 'UserToShiftController@search'); - $router->delete('/user-to-shift/delete/{id}', 'UserToShiftController@delete'); - $router->get('/user-to-shift/list', 'UserToShiftController@list'); - - $router->post('/control-monitoring/search', 'ControlMonitoringController@search'); - $router->get('/currency/list', 'CurrencyController@list'); - - $router->post('/project-to-checklist-k3/add', 'ProjectToChecklistK3Controller@add'); - $router->post('/project-to-checklist-k3/add-multiple', 'ProjectToChecklistK3Controller@addMultiple'); - $router->get('/project-to-checklist-k3/edit/{id}', 'ProjectToChecklistK3Controller@edit'); - $router->put('/project-to-checklist-k3/update/{id}', 'ProjectToChecklistK3Controller@update'); - $router->post('/project-to-checklist-k3/search', 'ProjectToChecklistK3Controller@search'); - $router->delete('/project-to-checklist-k3/delete/{id}', 'ProjectToChecklistK3Controller@delete'); - $router->get('/project-to-checklist-k3/list', 'ProjectToChecklistK3Controller@list'); - }); + $router->post('/document-activity/upload', 'ActivityDokumenController@uploadProjectDokumen'); + $router->get('/document-activity/get/{id}', 'ActivityDokumenController@dokumenByActivityId'); + $router->delete('/document-activity/delete/{id}', 'ActivityDokumenController@delete'); + $router->post('/document-activity/search', 'ActivityDokumenController@searchDocProject'); + $router->get('/document-activity/download/{id}', 'ActivityDokumenController@downloadDokumen'); + + $router->post('/project/search', 'ProjectController@search'); + $router->post('/project/add', 'ProjectController@add'); + $router->put('/project/update/{id}', 'ProjectController@update'); + $router->get('/project/edit/{id}', 'ProjectController@edit'); + $router->get('/project/detail/{id}', 'ProjectController@detail'); + $router->delete('/project/delete/{id}', 'ProjectController@delete'); + $router->get('/project/list', 'ProjectController@list'); + $router->get('/project/set-baseline/{gantt_id}', 'ProjectController@setBaseline'); + $router->get('/project/synchronize-report/{gantt_id}', 'ProjectController@synchronizeReport'); + $router->get('/project/manpower/{proyek_id}', 'ProjectController@getManpower'); + $router->get('/project/manpower/assigned/{gantt_id}', 'ProjectController@getAssignedHR'); + + $router->post('/project/get-s-curve', 'ProjectController@getSCurve'); + $router->post('/project/get-overdue-activities', 'ProjectController@getOverdueActivities'); + $router->post('/project/get-integration-invoice', 'ProjectController@getInvoiceIntegration'); + $router->post('/project/get-report-distribution', 'ProjectController@getReportDistribution'); + + /* $router->get('/project/get-expenditure/{id}/{date?}', 'ProjectController@getExpenditure'); */ + /* $router->get('/project/get-total-expenditure/{id}', 'ProjectController@getTotalExpenditure'); */ + /* $router->get('/project/get-status-health-schedule/{id}', 'ProjectController@getStatusSchedule'); */ + /* $router->get('/project/get-status-health-budget/{id}', 'ProjectController@getStatusBudget'); */ + + + $router->post('/project-charter/search', 'ProjectCharterController@search'); + $router->post('/project-charter/add', 'ProjectCharterController@add'); + $router->put('/project-charter/update/{id}', 'ProjectCharterController@update'); + + $router->post('/divisi/add', 'DivisiController@add'); + $router->get('/divisi/edit/{id}', 'DivisiController@edit'); + $router->put('/divisi/update/{id}', 'DivisiController@update'); + $router->post('/divisi/search', 'DivisiController@search'); + $router->delete('/divisi/delete/{id}', 'DivisiController@delete'); + $router->get('/divisi/list', 'DivisiController@list'); + + $router->post('/config-alert/search', 'ConfigAlertController@search'); + $router->post('/config-alert/add', 'ConfigAlertController@add'); + $router->get('/config-alert/edit/{id}', 'ConfigAlertController@edit'); + $router->put('/config-alert/update/{id}', 'ConfigAlertController@update'); + $router->delete('/config-alert/delete/{id}', 'ConfigAlertController@delete'); + $router->get('/config-alert/list', 'ConfigAlertController@list'); + + $router->post('/config-alert-to-user/search', 'ConfigAlertUserController@search'); + $router->post('/config-alert-to-user/add', 'ConfigAlertUserController@add'); + $router->put('/config-alert-to-user/update/{id}', 'ConfigAlertUserController@update'); + $router->delete('/config-alert-to-user/delete/{id}', 'ConfigAlertUserController@delete'); + $router->get('/config-alert/get-user/{id}', 'ConfigAlertUserController@getConfigUser'); + + $router->post('/human-resource/search', 'HumanResourceController@search'); + $router->post('/human-resource/add', 'HumanResourceController@add'); + $router->get('/human-resource/edit/{id}', 'HumanResourceController@edit'); + $router->put('/human-resource/update/{id}', 'HumanResourceController@update'); + $router->delete('/human-resource/delete/{id}', 'HumanResourceController@delete'); + $router->get('/human-resource/list', 'HumanResourceController@list'); + $router->get('/human-resource/select', 'HumanResourceController@select'); + $router->post('/human-resource/check-old-password/{id}', 'HumanResourceController@checkOldPassword'); + + $router->post('/project-role/search', 'ProjectRoleController@search'); + $router->post('/project-role/add', 'ProjectRoleController@add'); + $router->get('/project-role/edit/{id}', 'ProjectRoleController@edit'); + $router->put('/project-role/update/{id}', 'ProjectRoleController@update'); + $router->delete('/project-role/delete/{id}', 'ProjectRoleController@delete'); + $router->get('/project-role/list', 'ProjectRoleController@list'); + $router->get('/project-role/select', 'ProjectRoleController@select'); + + $router->post('/project-type/search', 'ProjectTypeController@search'); + $router->post('/project-type/add', 'ProjectTypeController@add'); + $router->get('/project-type/edit/{id}', 'ProjectTypeController@edit'); + $router->put('/project-type/update/{id}', 'ProjectTypeController@update'); + $router->delete('/project-type/delete/{id}', 'ProjectTypeController@delete'); + $router->get('/project-type/list', 'ProjectTypeController@list'); + + $router->post('/project-phase/search', 'ProjectPhaseController@search'); + $router->post('/project-phase/add', 'ProjectPhaseController@add'); + $router->get('/project-phase/edit/{id}', 'ProjectPhaseController@edit'); + $router->put('/project-phase/update/{id}', 'ProjectPhaseController@update'); + $router->delete('/project-phase/delete/{id}', 'ProjectPhaseController@delete'); + $router->get('/project-phase/list', 'ProjectPhaseController@list'); + + $router->post('/user-to-project/assign', 'UserProyekController@assignUserProyek'); + + $router->post('/request-material/add', 'RequestMaterialController@add'); + $router->post('/request-material/search', 'RequestMaterialController@search'); + $router->get('/request-material/edit/{id}', 'RequestMaterialController@edit'); + $router->put('/request-material/update/{id}', 'RequestMaterialController@update'); + $router->delete('/request-material/delete/{id}', 'RequestMaterialController@delete'); + $router->get('/request-material/list', 'RequestMaterialController@list'); + $router->get('/request-material/get-material-integration', 'RequestMaterialController@getMaterialIntegration'); + + $router->put('/request-material/update-warehouse-site/{id}', 'RequestMaterialController@updateWarehouseSite'); + + $router->post('/material-to-project/assign', 'MaterialProjectController@assignMaterial'); + + $router->post('/material-resource/add', 'MaterialResourceController@add'); + $router->post('/material-resource/search', 'MaterialResourceController@search'); + $router->get('/material-resource/update/{id}', 'MaterialResourceController@edit'); + $router->put('/material-resource/update/{id}', 'MaterialResourceController@update'); + $router->delete('/material-resource/delete/{id}', 'MaterialResourceController@delete'); + $router->get('/material-resource/list', 'MaterialResourceController@list'); + $router->get('/material-resource/select', 'MaterialResourceController@select'); + + $router->post('/tools-to-project/assign', 'ToolsProjectController@assignTools'); + $router->get('/tools-to-project/search', 'ToolsProjectController@searchTools'); + + $router->post('/tools-resource/add', 'ToolsResourceController@add'); + $router->post('/tools-resource/search', 'ToolsResourceController@search'); + $router->get('/tools-resource/edit/{id}', 'ToolsResourceController@edit'); + $router->put('/tools-resource/update/{id}', 'ToolsResourceController@update'); + $router->delete('/tools-resource/delete/{id}', 'ToolsResourceController@delete'); + $router->get('/tools-resource/list', 'ToolsResourceController@list'); + $router->get('/tools-resource/select', 'ToolsResourceController@select'); + + $router->post('/req-tools/add', 'ToolsRequestController@add'); + $router->get('/req-tools/edit/{id}', 'ToolsRequestController@edit'); + $router->put('/req-tools/update/{id}', 'ToolsRequestController@update'); + $router->post('/req-tools/search', 'ToolsRequestController@search'); + $router->delete('/req-tools/delete/{id}', 'ToolsRequestController@delete'); + $router->get('/req-tools/list', 'ToolsRequestController@list'); + + $router->post('/version-gantt/add', 'VersionGanttController@add'); + $router->get('/version-gantt/edit/{id}', 'VersionGanttController@edit'); + $router->put('/version-gantt/update/{id}', 'VersionGanttController@update'); + $router->post('/version-gantt/search', 'VersionGanttController@search'); + $router->delete('/version-gantt/delete/{id}', 'VersionGanttController@delete'); + $router->get('/version-gantt/list', 'VersionGanttController@list'); + + $router->post('/user-to-version-gantt/add', 'UserToVersionGanttController@add'); + $router->post('/user-to-version-gantt/add-multiple', 'UserToVersionGanttController@addMultiple'); + $router->get('/user-to-version-gantt/edit/{id}', 'UserToVersionGanttController@edit'); + $router->put('/user-to-version-gantt/update/{id}', 'UserToVersionGanttController@update'); + $router->post('/user-to-version-gantt/search', 'UserToVersionGanttController@search'); + $router->delete('/user-to-version-gantt/delete/{id}', 'UserToVersionGanttController@delete'); + $router->get('/user-to-version-gantt/list', 'UserToVersionGanttController@list'); + $router->get('/user-to-version-gantt/get-by-gantt/{gantt_id}', 'UserToVersionGanttController@getByUserGantt'); + + $router->post('/user-to-activity/add', 'UserToActivityController@add'); + $router->post('/user-to-activity/add-multiple', 'UserToActivityController@addMultiple'); + $router->get('/user-to-activity/edit/{id}', 'UserToActivityController@edit'); + $router->put('/user-to-activity/update/{id}', 'UserToActivityController@update'); + $router->post('/user-to-activity/search', 'UserToActivityController@search'); + $router->post('/user-to-activity/list-filtered', 'UserToActivityController@listFiltered'); + $router->delete('/user-to-activity/delete/{id}', 'UserToActivityController@delete'); + $router->get('/user-to-activity/list', 'UserToActivityController@list'); + $router->get('/user-to-activity/datatables', 'UserToActivityController@datatables'); + + $router->get('/sumVolActualM/{id}', 'ActivityController@sumVolumeActualMaterial'); + $router->get('/activity/{id}/{proyek_id}/get', 'ActivityController@getByGanttId'); + $router->get('/activity/search', 'ActivityController@search'); + $router->post('/activity/import', 'ActivityController@import'); + $router->post('/task', 'ActivityController@add'); + $router->get('/task/edit/{id}', 'ActivityController@edit'); + $router->put('/task/{id}', 'ActivityController@update'); + $router->put('/task/update-regular/{id}', 'ActivityController@updateRegular'); + $router->delete('/task/{id}', 'ActivityController@delete'); + $router->get('/task/get-update/{id}', 'ActivityController@getUpdate'); + $router->post('/tmp-import/upload', 'ActivityController@uploadTmpImport'); + + $router->post('/link', 'LinkController@add'); + $router->put('/link/{id}', 'LinkController@update'); + $router->delete('/link/{id}', 'LinkController@delete'); + + $router->post('/template-gantt/add', 'TemplateGanttController@add'); + $router->get('/template-gantt/edit/{id}', 'TemplateGanttController@edit'); + $router->put('/template-gantt/update/{id}', 'TemplateGanttController@update'); + $router->post('/template-gantt/search', 'TemplateGanttController@search'); + $router->delete('/template-gantt/delete/{id}', 'TemplateGanttController@delete'); + $router->get('/template-gantt/list', 'TemplateGanttController@list'); + $router->get('/template-gantt/get-tree/{id}', 'TemplateGanttController@getTreeByTypeProject'); + + $router->post('/comment-activity/add', 'CommentActivityController@add'); + $router->get('/comment-activity/edit/{id}', 'CommentActivityController@edit'); + $router->put('/comment-activity/update/{id}', 'CommentActivityController@update'); + $router->post('/comment-activity/search', 'CommentActivityController@search'); + $router->delete('/comment-activity/delete/{id}', 'CommentActivityController@delete'); + $router->get('/comment-activity/list', 'CommentActivityController@list'); + + $router->post('/presence/add', 'PresenceController@add'); + $router->get('/presence/edit/{id}', 'PresenceController@edit'); + $router->put('/presence/update/{id}', 'PresenceController@update'); + $router->post('/presence/search', 'PresenceController@search'); + $router->delete('/presence/delete/{id}', 'PresenceController@delete'); + $router->get('/presence/list', 'PresenceController@list'); + $router->get('/presence/clockinout/{id}', 'PresenceController@clockinout'); + $router->post('/presence/reportk3', 'PresenceController@reportK3'); + $router->get('/presence/bulk-update-location', 'PresenceController@bulkUpdateLocation'); + + $router->post('/permit/add', 'AbsentController@add'); + $router->get('/permit/edit/{id}', 'AbsentController@edit'); + $router->put('/permit/update/{id}', 'AbsentController@update'); + $router->post('/permit/search', 'AbsentController@search'); + $router->delete('/permit/delete/{id}', 'AbsentController@delete'); + $router->get('/permit/list', 'AbsentController@list'); + + $router->post('/assign-tools/add', 'AssignToolsController@add'); + $router->get('/assign-tools/edit/{id}', 'AssignToolsController@edit'); + $router->put('/assign-tools/update/{id}', 'AssignToolsController@update'); + $router->post('/assign-tools/search', 'AssignToolsController@search'); + $router->delete('/assign-tools/delete/{id}', 'AssignToolsController@delete'); + $router->get('/assign-tools/list', 'AssignToolsController@list'); + $router->get('/assign-tools/datatables', 'AssignToolsController@datatables'); + + $router->post('/assign-material/add', 'AssignMaterialController@add'); + $router->get('/assign-material/edit/{id}', 'AssignMaterialController@edit'); + $router->put('/assign-material/update/{id}', 'AssignMaterialController@update'); + $router->post('/assign-material/search', 'AssignMaterialController@search'); + $router->delete('/assign-material/delete/{id}', 'AssignMaterialController@delete'); + $router->get('/assign-material/list', 'AssignMaterialController@list'); + $router->get('/assign-material/datatables', 'AssignMaterialController@datatables'); + $router->get('/assign-material/datatablesForReportActivity', 'AssignMaterialController@datatablesForReportActivity'); + $router->post('/assign-material/ForReportActivityByMaterial', 'AssignMaterialController@ForReportActivityByMaterial'); + + $router->post('/image/search', 'ImageController@search'); + $router->delete('/image/delete/{id}', 'ImageController@delete'); + $router->delete('/image/delete/{id}/{category}', 'ImageController@deleteByRef'); + $router->post('/image/upload', 'ImageController@uploadImage'); + $router->get('/image/{id}/{category}', 'ImageController@getByRefId'); + + $router->post('/panic-button/add', 'PanicButtonController@add'); + $router->get('/panic-button/edit/{id}', 'PanicButtonController@edit'); + $router->put('/panic-button/update/{id}', 'PanicButtonController@update'); + $router->post('/panic-button/search', 'PanicButtonController@search'); + $router->delete('/panic-button/delete/{id}', 'PanicButtonController@delete'); + $router->get('/panic-button/list', 'PanicButtonController@list'); + + $router->post('/rate-sallary/add', 'RateSallaryController@add'); + $router->get('/rate-sallary/edit/{id}', 'RateSallaryController@edit'); + $router->put('/rate-sallary/update/{id}', 'RateSallaryController@update'); + $router->post('/rate-sallary/search', 'RateSallaryController@search'); + $router->delete('/rate-sallary/delete/{id}', 'RateSallaryController@delete'); + $router->get('/rate-sallary/list', 'RateSallaryController@list'); + + $router->post('/project-participants/add', 'ProjectParticipantsController@add'); + $router->get('/project-participants/edit/{id}', 'ProjectParticipantsController@edit'); + $router->put('/project-participants/update/{id}', 'ProjectParticipantsController@update'); + $router->post('/project-participants/search', 'ProjectParticipantsController@search'); + $router->delete('/project-participants/delete/{id}', 'ProjectParticipantsController@delete'); + $router->delete('/project-participants/delete-by-proyek/{id}', 'ProjectParticipantsController@deleteByProyek'); + $router->get('/project-participants/list', 'ProjectParticipantsController@list'); + $router->get('/project-participants/{where}/{val}', 'ProjectParticipantsController@customWhere'); + + $router->post('/project-approval/add', 'ProjectApprovalController@add'); + $router->get('/project-approval/edit/{id}', 'ProjectApprovalController@edit'); + $router->put('/project-approval/update/{id}', 'ProjectApprovalController@update'); + $router->post('/project-approval/search', 'ProjectApprovalController@search'); + $router->delete('/project-approval/delete/{id}', 'ProjectApprovalController@delete'); + $router->delete('/project-approval/delete-by-proyek/{id}', 'ProjectApprovalController@deleteByProyek'); + $router->get('/project-approval/list', 'ProjectApprovalController@list'); + $router->get('/project-approval/{where}/{val}', 'ProjectApprovalController@customWhere'); + + $router->post('/project-milestone/add', 'ProjectMileStoneController@add'); + $router->get('/project-milestone/edit/{id}', 'ProjectMileStoneController@edit'); + $router->put('/project-milestone/update/{id}', 'ProjectMileStoneController@update'); + $router->post('/project-milestone/search', 'ProjectMileStoneController@search'); + $router->delete('/project-milestone/delete/{id}', 'ProjectMileStoneController@delete'); + $router->delete('/project-milestone/delete-by-proyek/{id}', 'ProjectMileStoneController@deleteByProyek'); + $router->get('/project-milestone/list', 'ProjectMileStoneController@list'); + $router->get('/project-milestone/select', 'ProjectMileStoneController@select'); + $router->get('/project-milestone/{where}/{val}', 'ProjectMileStoneController@customWhere'); + + $router->post('/report-activity/add', 'ReportActivityController@add'); + $router->get('/report-activity/edit/{id}', 'ReportActivityController@edit'); + $router->put('/report-activity/update/{id}', 'ReportActivityController@update'); + $router->post('/report-activity/search', 'ReportActivityController@search'); + $router->delete('/report-activity/delete/{id}', 'ReportActivityController@delete'); + $router->get('/report-activity/list', 'ReportActivityController@list'); + $router->post('/report-activity/search-point', 'ReportActivityController@searchPoint'); + $router->get('/report-activity/datatables', 'ReportActivityController@datatables'); + + $router->post('/report-activity-material/add', 'ReportActivityMaterialController@add'); + $router->post('/report-activity-material/search', 'ReportActivityMaterialController@search'); + $router->delete('/report-activity-material/delete/{id}', 'ReportActivityMaterialController@delete'); + $router->get('/report-activity-material/list', 'ReportActivityMaterialController@list'); + $router->get('/report-activity-material/datatables', 'ReportActivityMaterialController@datatables'); + $router->post('/report-activity-material/update-status', 'ReportActivityMaterialController@updateStatusStartFinish'); + + $router->post('/waypoint/add', 'WaypointController@add'); + $router->post('/waypoint/add-bulk', 'WaypointController@addBulk'); + $router->get('/waypoint/edit/{id}', 'WaypointController@edit'); + $router->put('/waypoint/update/{id}', 'WaypointController@update'); + $router->post('/waypoint/search', 'WaypointController@search'); + $router->delete('/waypoint/delete/{id}', 'WaypointController@delete'); + $router->get('/waypoint/list', 'WaypointController@list'); + + $router->post('/holiday/add', 'HolidayController@add'); + $router->get('/holiday/edit/{id}', 'HolidayController@edit'); + $router->put('/holiday/update/{id}', 'HolidayController@update'); + $router->post('/holiday/search', 'HolidayController@search'); + $router->delete('/holiday/delete/{id}', 'HolidayController@delete'); + $router->get('/holiday/list', 'HolidayController@list'); + $router->get('/holiday/datatables', 'HolidayController@datatables'); + + $router->post('/satuan/add', 'SatuanController@add'); + $router->get('/satuan/edit/{id}', 'SatuanController@edit'); + $router->put('/satuan/update/{id}', 'SatuanController@update'); + $router->post('/satuan/search', 'SatuanController@search'); + $router->delete('/satuan/delete/{id}', 'SatuanController@delete'); + $router->get('/satuan/list', 'SatuanController@list'); + + $router->post('/checklist-k3/add', 'ChecklistK3Controller@add'); + $router->get('/checklist-k3/edit/{id}', 'ChecklistK3Controller@edit'); + $router->put('/checklist-k3/update/{id}', 'ChecklistK3Controller@update'); + $router->post('/checklist-k3/search', 'ChecklistK3Controller@search'); + $router->delete('/checklist-k3/delete/{id}', 'ChecklistK3Controller@delete'); + $router->get('/checklist-k3/list', 'ChecklistK3Controller@list'); + + $router->post('/report-k3/add', 'ReportK3Controller@add'); + $router->get('/report-k3/edit/{id}', 'ReportK3Controller@edit'); + $router->put('/report-k3/update/{id}', 'ReportK3Controller@update'); + $router->post('/report-k3/search', 'ReportK3Controller@search'); + $router->delete('/report-k3/delete/{id}', 'ReportK3Controller@delete'); + $router->get('/report-k3/list', 'ReportK3Controller@list'); + + $router->post('/report-k3-detail/add', 'ReportK3DetailController@add'); + $router->get('/report-k3-detail/edit/{id}', 'ReportK3DetailController@edit'); + $router->put('/report-k3-detail/update/{id}', 'ReportK3DetailController@update'); + $router->post('/report-k3-detail/search', 'ReportK3DetailController@search'); + $router->delete('/report-k3-detail/delete/{id}', 'ReportK3DetailController@delete'); + $router->get('/report-k3-detail/list', 'ReportK3DetailController@list'); + + $router->post('/user-to-proyek/add', 'UserToProyekController@add'); + $router->get('/user-to-proyek/edit/{id}', 'UserToProyekController@edit'); + $router->put('/user-to-proyek/update/{id}', 'UserToProyekController@update'); + $router->post('/user-to-proyek/search', 'UserToProyekController@search'); + $router->delete('/user-to-proyek/delete/{id}', 'UserToProyekController@delete'); + $router->get('/user-to-proyek/list', 'UserToProyekController@list'); + $router->get('/user-to-proyek/select', 'UserToProyekController@select'); + $router->get('/user-to-proyek/get-employee-integration', 'UserToProyekController@getEmployeeIntegration'); + + $router->post('/folder-document-proyek/add', 'FolderDocumentProyekController@add'); + $router->get('/folder-document-proyek/edit/{id}', 'FolderDocumentProyekController@edit'); + $router->put('/folder-document-proyek/update/{id}', 'FolderDocumentProyekController@update'); + $router->post('/folder-document-proyek/search', 'FolderDocumentProyekController@search'); + $router->delete('/folder-document-proyek/delete/{id}', 'FolderDocumentProyekController@delete'); + $router->get('/folder-document-proyek/list', 'FolderDocumentProyekController@list'); + $router->get('/folder-document-proyek/get-tree/{id}', 'FolderDocumentProyekController@getTree'); + + $router->post('/office-hours/add', 'OfficeHoursController@add'); + $router->get('/office-hours/edit/{id}', 'OfficeHoursController@edit'); + $router->put('/office-hours/update/{id}', 'OfficeHoursController@update'); + $router->post('/office-hours/search', 'OfficeHoursController@search'); + $router->delete('/office-hours/delete/{id}', 'OfficeHoursController@delete'); + $router->get('/office-hours/list', 'OfficeHoursController@list'); + + $router->get('/gantt-show-hide/get-by-gantt/{gantt_id}', 'ShowHideColumnController@getByUserGantt'); + $router->post('/gantt-show-hide/add', 'ShowHideColumnController@add'); + $router->post('/gantt-show-hide/update/{gantt_id}', 'ShowHideColumnController@update'); + $router->get('/gantt-show-hide/get-column-by-type/{type}', 'ShowHideColumnController@getColumnByType'); + + + $router->post('/shift/add', 'ShiftController@add'); + $router->get('/shift/edit/{id}', 'ShiftController@edit'); + $router->put('/shift/update/{id}', 'ShiftController@update'); + $router->post('/shift/search', 'ShiftController@search'); + $router->delete('/shift/delete/{id}', 'ShiftController@delete'); + $router->get('/shift/list', 'ShiftController@list'); + + $router->post('/user-monthly-shift/add', 'UserMonthlyShiftController@add'); + $router->put('/user-monthly-shift/update/{id}', 'UserMonthlyShiftController@update'); + $router->post('/user-monthly-shift/search', 'UserMonthlyShiftController@search'); + $router->delete('/user-monthly-shift/delete/{id}', 'UserMonthlyShiftController@delete'); + $router->delete('/user-monthly-shift/delete-at/{yyyymm}', 'UserMonthlyShiftController@deleteYYYYMM'); + $router->get('/user-monthly-shift/list', 'UserMonthlyShiftController@list'); + $router->post('/user-monthly-shift/import', 'UserMonthlyShiftController@import'); + $router->get('/user-monthly-shift/list/{yyyymm}', 'UserMonthlyShiftController@listYYYYMM'); + + $router->post('/user-to-shift/add', 'UserToShiftController@add'); + $router->get('/user-to-shift/edit/{id}', 'UserToShiftController@edit'); + $router->put('/user-to-shift/update/{id}', 'UserToShiftController@update'); + $router->post('/user-to-shift/search', 'UserToShiftController@search'); + $router->delete('/user-to-shift/delete/{id}', 'UserToShiftController@delete'); + $router->get('/user-to-shift/list', 'UserToShiftController@list'); + + $router->post('/control-monitoring/search', 'ControlMonitoringController@search'); + $router->get('/currency/list', 'CurrencyController@list'); + + $router->post('/project-to-checklist-k3/add', 'ProjectToChecklistK3Controller@add'); + $router->post('/project-to-checklist-k3/add-multiple', 'ProjectToChecklistK3Controller@addMultiple'); + $router->get('/project-to-checklist-k3/edit/{id}', 'ProjectToChecklistK3Controller@edit'); + $router->put('/project-to-checklist-k3/update/{id}', 'ProjectToChecklistK3Controller@update'); + $router->post('/project-to-checklist-k3/search', 'ProjectToChecklistK3Controller@search'); + $router->delete('/project-to-checklist-k3/delete/{id}', 'ProjectToChecklistK3Controller@delete'); + $router->get('/project-to-checklist-k3/list', 'ProjectToChecklistK3Controller@list'); + + $router->post('/project-comment/add', 'ProjectCommentController@add'); + $router->put('/project-comment/update/{id}', 'ProjectCommentController@update'); + $router->post('/project-comment/search', 'ProjectCommentController@search'); + + $router->post('/map-monitoring/search', 'MapMonitoringController@search'); + }); });