From 96222016f0a33802f0c2834043d9c0e0105292fb Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 26 Jul 2023 16:53:19 +0700 Subject: [PATCH 01/62] Format ActivityController --- app/Http/Controllers/ActivityController.php | 740 ++++++++++---------- app/Http/Controllers/ProjectController.php | 7 +- 2 files changed, 380 insertions(+), 367 deletions(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 126fc02..15e6cb4 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -20,58 +20,59 @@ class ActivityController extends Controller { public function getByGanttId($id, $proyek_id) { - $gantt = VersionGantt::find($id); - if(Activity::where('proyek_id', $proyek_id)->where("version_gantt_id", $id)->count() == 0) { - if(!$gantt->hierarchy_ftth_id) { - $this->cloneTemplate($id, $proyek_id); - } else { - $this->cloneTemplate($id, $proyek_id, $gantt->hierarchy_ftth_id); - } + $gantt = VersionGantt::find($id); + if (Activity::where('proyek_id', $proyek_id)->where("version_gantt_id", $id)->count() == 0) { + if (!$gantt->hierarchy_ftth_id) { + $this->cloneTemplate($id, $proyek_id); + } else { + $this->cloneTemplate($id, $proyek_id, $gantt->hierarchy_ftth_id); + } } $dataGantt = $this->getDataActivity($id); - return response()->json(['status'=>'success','data'=> $dataGantt,'code'=>200], 200); + return response()->json(['status' => 'success', 'data' => $dataGantt, 'code' => 200], 200); } private function getDataActivity($id) { - $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->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('sortorder', 'asc')->get(); - }else{ - $data = Activity::where('version_gantt_id', $id)->whereNull('parent_id')->orderBy('sortorder', 'asc')->get(); + $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->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('sortorder', 'asc')->get(); + } else { + $data = Activity::where('version_gantt_id', $id)->whereNull('parent_id')->orderBy('sortorder', 'asc')->get(); } - foreach($data as $objRow){ + 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") + if ($objRow->type_activity == "milestone") $type = $objRow->type_activity; - if(empty($dataChildren)) + if (empty($dataChildren)) $type = "task"; $objRow->text = $objRow->name; $objRow->parent = $objRow->parent_id ? $objRow->parent_id : null; - $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 = $objRow->persentase_progress / 100; + $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 = $objRow->persentase_progress / 100; $objRow->type = $type; $finalData[] = $objRow; $finalData = array_merge($finalData, $dataChildren); @@ -79,23 +80,22 @@ class ActivityController extends Controller $dataLink = Link::where('version_gantt_id', $id)->get(); $finalLink = []; - foreach($dataLink as $objRow) - { + foreach ($dataLink as $objRow) { $dataRow = array( - 'id'=>$objRow->id, - 'source'=>$objRow->s_activity_id, - 'target'=>$objRow->t_activity_id, - 'type'=>$objRow->type_link, - 'code'=>$objRow->code_link + 'id' => $objRow->id, + 'source' => $objRow->s_activity_id, + 'target' => $objRow->t_activity_id, + 'type' => $objRow->type_link, + 'code' => $objRow->code_link ); - if($objRow->lag) + if ($objRow->lag) $dataRow['lag'] = $objRow->lag; $finalLink[] = $dataRow; } $resultData = array( - "data"=>$finalData, - "links"=>$finalLink + "data" => $finalData, + "links" => $finalLink ); return $resultData; @@ -105,22 +105,22 @@ class ActivityController extends Controller { $finalData = []; $data = Activity::where('version_gantt_id', $gantt_id)->where('parent_id', $parent_id)->orderBy('sortorder', 'asc')->get(); - foreach($data as $objRow){ + foreach ($data as $objRow) { $objRow->parent = $parent_id; $objRow->text = $objRow->name; - $objRow->progress = (float)$objRow->persentase_progress/100; + $objRow->progress = (float) $objRow->persentase_progress / 100; $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->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; $dataChildren = $this->getChildren($gantt_id, $objRow->id); - if($objRow->type_activity=="milestone"){ + if ($objRow->type_activity == "milestone") { $objRow->type = $objRow->type_activity; - }elseif(empty($dataChildren)){ + } elseif (empty($dataChildren)) { $objRow->type = "task"; - }else{ + } else { $objRow->type = "project"; } $finalData[] = $objRow; @@ -129,54 +129,55 @@ class ActivityController extends Controller return $finalData; } - private function cloneTemplate($id, $proyek_id, $hierarchy_ftth_id = null) { - $project = Project::find($proyek_id); - if($hierarchy_ftth_id){ - $gantt = VersionGantt::find($id); - $rootActivity = Activity::create([ - 'version_gantt_id'=>$id, - 'proyek_id'=>$proyek_id, - 'name'=> $gantt->name_version, - 'start_date'=> $project->mulai_proyek, - 'end_date'=> $project->akhir_proyek, - 'rencana_biaya'=> $project->rencana_biaya, - 'type_activity'=> 'project', - 'created_by'=>$this->currentName, - 'sortorder'=>1 - ]); - } else { - $rootActivity = Activity::create([ - 'version_gantt_id'=>$id, - 'proyek_id'=>$proyek_id, - 'name'=> $project->nama, - 'kode_sortname'=>$project->kode_sortname, - 'start_date'=> $project->mulai_proyek, - 'end_date'=> $project->akhir_proyek, - 'rencana_biaya'=> $project->rencana_biaya, - 'type_activity'=> 'project', - 'created_by'=>$this->currentName, - 'sortorder'=>1 - ]); - } + private function cloneTemplate($id, $proyek_id, $hierarchy_ftth_id = null) + { + $project = Project::find($proyek_id); + if ($hierarchy_ftth_id) { + $gantt = VersionGantt::find($id); + $rootActivity = Activity::create([ + 'version_gantt_id' => $id, + 'proyek_id' => $proyek_id, + 'name' => $gantt->name_version, + 'start_date' => $project->mulai_proyek, + 'end_date' => $project->akhir_proyek, + 'rencana_biaya' => $project->rencana_biaya, + 'type_activity' => 'project', + 'created_by' => $this->currentName, + 'sortorder' => 1 + ]); + } else { + $rootActivity = Activity::create([ + 'version_gantt_id' => $id, + 'proyek_id' => $proyek_id, + 'name' => $project->nama, + 'kode_sortname' => $project->kode_sortname, + 'start_date' => $project->mulai_proyek, + 'end_date' => $project->akhir_proyek, + 'rencana_biaya' => $project->rencana_biaya, + 'type_activity' => 'project', + 'created_by' => $this->currentName, + 'sortorder' => 1 + ]); + } $resultTypeProject = TemplateGantt::where('proyek_type_id', $project->type_proyek_id) ->whereNull('parent_id') ->orderByRaw('id ASC') ->get(); - foreach($resultTypeProject as $objRow){ + foreach ($resultTypeProject as $objRow) { $childActivities = TemplateGantt::where("parent_id", $objRow->id)->count(); - $max = Activity::where('version_gantt_id', $id)->max('sortorder'); + $max = Activity::where('version_gantt_id', $id)->max('sortorder'); $resultNew = Activity::create([ - 'type_activity'=> $childActivities > 0 ? "project" : "task", - 'version_gantt_id'=>$id, - 'parent_id'=>$rootActivity->id, - 'proyek_id'=>$proyek_id, - 'name'=> $objRow->name_activity, - 'start_date'=>date("Y-m-d H:i:s"), - 'end_date'=>date("Y-m-d H:i:s"), - 'created_by'=>$this->currentName, - 'sortorder'=>$max+1 + 'type_activity' => $childActivities > 0 ? "project" : "task", + 'version_gantt_id' => $id, + 'parent_id' => $rootActivity->id, + 'proyek_id' => $proyek_id, + 'name' => $objRow->name_activity, + 'start_date' => date("Y-m-d H:i:s"), + 'end_date' => date("Y-m-d H:i:s"), + 'created_by' => $this->currentName, + 'sortorder' => $max + 1 ]); $this->getChildrenTemplate($id, $objRow->id, $project->type_project_id, $proyek_id, $resultNew->id, $project->mulai_proyek); } @@ -185,19 +186,19 @@ class ActivityController extends Controller private function getChildrenTemplate($id, $parent_id, $type_proyek_id, $proyek_id, $parent_new, $firstDay) { $data = TemplateGantt::where('parent_id', $parent_id)->orderByRaw('id ASC')->get(); - foreach($data as $objRow){ + foreach ($data as $objRow) { $childActivities = TemplateGantt::where("parent_id", $objRow->id)->count(); - $max = Activity::where('version_gantt_id', $id)->max('sortorder'); + $max = Activity::where('version_gantt_id', $id)->max('sortorder'); $resultNew = Activity::create([ - 'type_activity'=> $childActivities > 0 ? "project" : "task", - 'version_gantt_id'=>$id, - 'parent_id'=>$parent_new, - 'proyek_id'=>$proyek_id, - 'name'=> $objRow->name_activity, - 'start_date'=>$firstDay, - 'end_date'=>$firstDay, - 'created_by'=>$this->currentName, - 'sortorder'=>$max+1 + 'type_activity' => $childActivities > 0 ? "project" : "task", + 'version_gantt_id' => $id, + 'parent_id' => $parent_new, + 'proyek_id' => $proyek_id, + 'name' => $objRow->name_activity, + 'start_date' => $firstDay, + 'end_date' => $firstDay, + 'created_by' => $this->currentName, + 'sortorder' => $max + 1 ]); $this->getChildrenTemplate($id, $objRow->id, $type_proyek_id, $proyek_id, $resultNew->id, $firstDay); } @@ -206,127 +207,130 @@ class ActivityController extends Controller public function add(Request $request) { $this->validate($request, [ - 'version_gantt_id'=>'required' + 'version_gantt_id' => 'required' ]); $data = $request->all(); $data['name'] = $request->text; $data['persentase_progress'] = $request->progress; $data['created_by'] = $this->currentName; - $max = Activity::where('version_gantt_id', $request->version_gantt_id)->max('sortorder'); - $data['sortorder'] = $max + 1; + $max = Activity::where('version_gantt_id', $request->version_gantt_id)->max('sortorder'); + $data['sortorder'] = $max + 1; $data['type_activity'] = "task"; $parent = $data['parent_id'] ?? null; - if($parent){ + if ($parent) { $parentData = Activity::find($parent); - if($parentData->parent_id) { + if ($parentData->parent_id) { $parentData->update(["type_activity" => "project"]); } CommentActivity::where('activity_id', $parent)->delete(); UserToActivity::where('activity_id', $parent)->delete(); } - if(!$result = Activity::create($data)) - return response()->json(['status'=>'failed','action'=>'error','code'=> 500], 500); + if (!$result = Activity::create($data)) + return response()->json(['status' => 'failed', 'action' => 'error', 'code' => 500], 500); - return response()->json(['status'=>'success','action'=>'inserted', 'tid'=>$result->id,'code'=>200], 200); + return response()->json(['status' => 'success', 'action' => 'inserted', 'tid' => $result->id, 'code' => 200], 200); } - public function edit($id){ - if(empty($id) || !is_int((int)$id)) - return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); + public function edit($id) + { + if (empty($id) || !is_int((int) $id)) + return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400); - if(!$result = Activity::find($id)) - return response()->json(['status'=>'failed','message'=>'Data not found!','code'=> 404], 404); + if (!$result = Activity::find($id)) + return response()->json(['status' => 'failed', 'message' => 'Data not found!', 'code' => 404], 404); - return response()->json(['status'=>'success','code'=>200,'data'=> $result], 200); + return response()->json(['status' => 'success', 'code' => 200, 'data' => $result], 200); } public function update(Request $request, $id) { - if(empty($id) || !is_int((int)$id)) - return response()->json(['status'=>'failed', 'action'=>'error','message'=>'id is required!','code'=>400], 400); + if (empty($id) || !is_int((int) $id)) + return response()->json(['status' => 'failed', 'action' => 'error', 'message' => 'id is required!', 'code' => 400], 400); $updateBobot = true; - if(!$data = Activity::find($id)) - return response()->json(['status'=>'failed', 'action'=>'error','message'=>'Data not found!','code'=> 404], 404); + if (!$data = Activity::find($id)) + return response()->json(['status' => 'failed', 'action' => 'error', 'message' => 'Data not found!', 'code' => 404], 404); $dataUpdate = $request->all(); $dataUpdate['name'] = $request->text; - $dataUpdate['persentase_progress'] = $request->progress*100; + $dataUpdate['persentase_progress'] = $request->progress * 100; $dataUpdate['updated_by'] = $this->currentName; - unset($dataUpdate['sortorder']); - if($data->type_activity!='header') + unset($dataUpdate['sortorder']); + if ($data->type_activity != 'header') $dataUpdate['type_activity'] = $request->type; - - if($request->has("target")){ - $this->updateOrder($id, $request->target); + + if ($request->has("target")) { + $this->updateOrder($id, $request->target); } - if(!$data->update($dataUpdate)) - return response()->json(['status'=>'failed', 'action'=>'error','message'=>'data activity failed updated!','code'=>400], 400); + if (!$data->update($dataUpdate)) + return response()->json(['status' => 'failed', 'action' => 'error', 'message' => 'data activity failed updated!', 'code' => 400], 400); - return response()->json(['status'=>'success','update_bobot'=> $updateBobot, 'data'=>$dataUpdate, 'action'=>'updated','message'=>'Activity updated!','code'=>200], 200); + return response()->json(['status' => 'success', 'update_bobot' => $updateBobot, 'data' => $dataUpdate, 'action' => 'updated', 'message' => 'Activity updated!', 'code' => 200], 200); } - private function updateOrder($taskId, $target){ - $nextTask = false; - $targetId = $target; - - if(strpos($target, "next:") === 0){ - $targetId = substr($target, strlen("next:")); - $nextTask = true; - } - - if($targetId == "null") - return; - - $targetOrder = Activity::find($targetId)->sortorder; - if($nextTask) - $targetOrder++; - - Activity::where("sortorder", ">=", $targetOrder)->increment("sortorder"); - - $updatedTask = Activity::find($taskId); - $updatedTask->sortorder = $targetOrder; - $updatedTask->save(); - } - - public function updateRegular(Request $request, $id){ - if(empty($id) || !is_int((int)$id)) - return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); + private function updateOrder($taskId, $target) + { + $nextTask = false; + $targetId = $target; + + if (strpos($target, "next:") === 0) { + $targetId = substr($target, strlen("next:")); + $nextTask = true; + } + + if ($targetId == "null") + return; + + $targetOrder = Activity::find($targetId)->sortorder; + if ($nextTask) + $targetOrder++; + + Activity::where("sortorder", ">=", $targetOrder)->increment("sortorder"); + + $updatedTask = Activity::find($taskId); + $updatedTask->sortorder = $targetOrder; + $updatedTask->save(); + } + + public function updateRegular(Request $request, $id) + { + if (empty($id) || !is_int((int) $id)) + return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400); $data = Activity::find($id); - if(!$data = Activity::find($id)) - return response()->json(['status'=>'failed','message'=>'Data not found!','code'=> 404], 404); + if (!$data = Activity::find($id)) + return response()->json(['status' => 'failed', 'message' => 'Data not found!', 'code' => 404], 404); - if(!$data->update($request->all())) - return response()->json(['status'=>'failed','message'=>'Failed to update!','code'=> 500], 500); + if (!$data->update($request->all())) + return response()->json(['status' => 'failed', 'message' => 'Failed to update!', 'code' => 500], 500); - return response()->json(['status'=>'success','message'=>'Activity Updated!','code'=> 200], 200); + return response()->json(['status' => 'success', 'message' => 'Activity Updated!', 'code' => 200], 200); } public function delete($id) { - if(!$data = Activity::find($id)) - return response()->json(['status'=>'failed', 'action'=>'error','message'=> 'Data not found!','code'=> 404], 404); + if (!$data = Activity::find($id)) + return response()->json(['status' => 'failed', 'action' => 'error', 'message' => 'Data not found!', 'code' => 404], 404); - if(!$data->delete()) - return response()->json(['status'=>'failed', 'action'=>'error','message'=>'data activity failed deleted!','code'=> 500], 500); + if (!$data->delete()) + return response()->json(['status' => 'failed', 'action' => 'error', 'message' => 'data activity failed deleted!', 'code' => 500], 500); - return response()->json(['status'=>'success', "action"=>"deleted",'message'=>'data activity successfully deleted!','code'=>200], 200); + return response()->json(['status' => 'success', "action" => "deleted", 'message' => 'data activity successfully deleted!', 'code' => 200], 200); } public function getUpdate($id) { - if(!$data = Activity::find($id)) - return response()->json(['status'=>'failed', 'action'=>'error','message'=> 'Data not found!','code'=>400], 400); + if (!$data = Activity::find($id)) + return response()->json(['status' => 'failed', 'action' => 'error', 'message' => 'Data not found!', 'code' => 400], 400); $data->progress = (float) $data->persentase_progress / 100; $data->rencana_biaya = str_replace(".", ",", $data->rencana_biaya); - return response()->json(['status'=>'success', "data"=> $data,'code'=>200], 200); + return response()->json(['status' => 'success', "data" => $data, 'code' => 200], 200); } public function search(Request $request) @@ -336,88 +340,89 @@ class ActivityController extends Controller $countBuilder = $dataBuilder['count']; $dataGet = $builder->get(); $totalRecord = $countBuilder->count(); - return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); - } + return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet, 'totalRecord' => $totalRecord], 200); + } - // before upload file - public function importOld(Request $request) + // before upload file + public function importOld(Request $request) { - $data = $request->all(); + $data = $request->all(); $data['created_by'] = $this->currentName; Activity::where('version_gantt_id', $data['ganttId'])->delete(); $projectId = VersionGantt::where('id', $data['ganttId'])->first()->proyek_id; - $dayOffs = VersionGantt::find($data['ganttId'])->first()->config_dayoff; + $dayOffs = VersionGantt::find($data['ganttId'])->first()->config_dayoff; $activityStack = []; - $hasWeight = false; - - foreach ($data['activities'] as $key => $value) { - if(isset($value['weight']) && $value['weight'] != null && $value['weight'] != 0){ - $hasWeight = true; - break; - } - } - - if(!$hasWeight){ - foreach ($data['activities'] as $key => $value) { - if($key == 0){ - $data['activities'][$key]['weight'] = 100; - } else { - $parentWeight = 0; - $siblingsCount = 1; - - $i = $key; - while($i > 0){ - if ($data['activities'][$i - 1]['level'] == $data['activities'][$key]['level']-1){ - $parentWeight = $data['activities'][$i - 1]['weight']; - break; - } - if ($data['activities'][$key]['level'] == $data['activities'][$i]['level']){ - $siblingsCount++; - } - $i--; - } - - $i = $key+1; - while($i < count($data['activities'])){ - if ($data['activities'][$i]['level'] == $data['activities'][$key]['level']-1){ - break; - } - // Log::info('level '.$data['activities'][$key]['level'].' i level '.$data['activities'][$i]['level']); - if ($data['activities'][$key]['level'] == $data['activities'][$i]['level']){ - $siblingsCount++; - } - $i++; - } - - $data['activities'][$key]['weight'] = $parentWeight / $siblingsCount; - } - }; - } - $projectStart = Project::select('mulai_proyek')->where('id', $projectId)->first(); + $hasWeight = false; + + foreach ($data['activities'] as $key => $value) { + if (isset($value['weight']) && $value['weight'] != null && $value['weight'] != 0) { + $hasWeight = true; + break; + } + } + + if (!$hasWeight) { + foreach ($data['activities'] as $key => $value) { + if ($key == 0) { + $data['activities'][$key]['weight'] = 100; + } else { + $parentWeight = 0; + $siblingsCount = 1; + + $i = $key; + while ($i > 0) { + if ($data['activities'][$i - 1]['level'] == $data['activities'][$key]['level'] - 1) { + $parentWeight = $data['activities'][$i - 1]['weight']; + break; + } + if ($data['activities'][$key]['level'] == $data['activities'][$i]['level']) { + $siblingsCount++; + } + $i--; + } + + $i = $key + 1; + while ($i < count($data['activities'])) { + if ($data['activities'][$i]['level'] == $data['activities'][$key]['level'] - 1) { + break; + } + // Log::info('level '.$data['activities'][$key]['level'].' i level '.$data['activities'][$i]['level']); + if ($data['activities'][$key]['level'] == $data['activities'][$i]['level']) { + $siblingsCount++; + } + $i++; + } + + $data['activities'][$key]['weight'] = $parentWeight / $siblingsCount; + } + } + ; + } + $projectStart = Project::select('mulai_proyek')->where('id', $projectId)->first(); foreach ($data['activities'] as $i => $activity_row) { $startDate = new \DateTime($projectStart->mulai_proyek); - $endDate = clone $startDate; - $endDate->modify('-1 day'); - $daysRemaining = $activity_row['duration']; - - // Loop until the remaining days become zero - while ($daysRemaining > 0) { - $endDate->modify('+1 day'); - - // Check if the current day is a day off (Sunday or Saturday) - $currentDayOfWeek = (int)$endDate->format('w'); - if (strpos($dayOffs, (string)$currentDayOfWeek) !== false) { - continue; // Skip the day off and continue to the next day - } - - $daysRemaining--; // Decrease the remaining days by one - } - $endDate->setTime(23, 59, 59); + $endDate = clone $startDate; + $endDate->modify('-1 day'); + $daysRemaining = $activity_row['duration']; + + // Loop until the remaining days become zero + while ($daysRemaining > 0) { + $endDate->modify('+1 day'); + + // Check if the current day is a day off (Sunday or Saturday) + $currentDayOfWeek = (int) $endDate->format('w'); + if (strpos($dayOffs, (string) $currentDayOfWeek) !== false) { + continue; // Skip the day off and continue to the next day + } + + $daysRemaining--; // Decrease the remaining days by one + } + $endDate->setTime(23, 59, 59); $input['name'] = $activity_row['name']; $input['proyek_id'] = $projectId; $input['version_gantt_id'] = $data['ganttId']; @@ -428,8 +433,8 @@ class ActivityController extends Controller $input['bobot_planning'] = $activity_row['weight']; $input['persentase_progress'] = 0; $input['type_activity'] = $i == 0 ? "header" : "task"; - $input['created_by'] = $this->currentName; - $input['sortorder'] = $activity_row['no']; + $input['created_by'] = $this->currentName; + $input['sortorder'] = $activity_row['no']; if (!$activity = Activity::create($input)) { Activity::where('version_gantt_id', $data['ganttId'])->delete(); @@ -439,7 +444,7 @@ class ActivityController extends Controller $data['activities'][$i]['activity_id'] = $activity->id; if ($i == 0) { - $activity->type_activity = "project"; + $activity->type_activity = "project"; $activity->save(); $activity->level = $activity_row['level']; array_push($activityStack, $activity); @@ -468,7 +473,7 @@ class ActivityController extends Controller } $activity->parent_id = $activityStack[count($activityStack) - 1]->id ?? null; - array_push($activityStack, $activity); + array_push($activityStack, $activity); // 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); @@ -484,23 +489,23 @@ class ActivityController extends Controller $activity->type_activity = "project"; $activity->save(); $activity->level = $activity_row['level']; - } - if (isset($data['activities'][$i]['nik']) && $data['activities'][$i]['nik'] != '') { - $user = User::where("ktp_number", $data['activities'][$i]['nik'])->first(); - $userProyek = UserToProyek::where("user_id", $user->id) - ->where("proyek_id", $projectId) - ->first(); - - $dataInsert = array( - "user_id" => $user->id, - "activity_id" => $activity->id, - "role_proyek_id" => $userProyek->project_role, - "proyek_id" => $projectId, - "created_by" => $this->currentName, - "version_gantt_id" => $data['ganttId'] - ); - UserToActivity::create($dataInsert); - } + } + if (isset($data['activities'][$i]['nik']) && $data['activities'][$i]['nik'] != '') { + $user = User::where("ktp_number", $data['activities'][$i]['nik'])->first(); + $userProyek = UserToProyek::where("user_id", $user->id) + ->where("proyek_id", $projectId) + ->first(); + + $dataInsert = array( + "user_id" => $user->id, + "activity_id" => $activity->id, + "role_proyek_id" => $userProyek->project_role, + "proyek_id" => $projectId, + "created_by" => $this->currentName, + "version_gantt_id" => $data['ganttId'] + ); + UserToActivity::create($dataInsert); + } if (!empty($activity_row['predecessor'])) { $key = array_search($activity_row['predecessor'], array_column($data['activities'], 'no')); @@ -525,35 +530,36 @@ class ActivityController extends Controller } return response()->json(['stack' => $activityStack, 'status' => 'success', 'message' => 'Data imported!', 'projectId' => $projectId, 'code' => 200], 200); - } + } - private function getLatestGantt($id){ + private function getLatestGantt($id) + { $maxGanttId = VersionGantt::where("proyek_id", $id)->max("id"); - $data = array( - "last_gantt_id" => $maxGanttId, - "proyek_id" => $id - ); - return $data; + $data = array( + "last_gantt_id" => $maxGanttId, + "proyek_id" => $id + ); + return $data; } public function getCalculateCurvaS(Request $request) // for adw (plan & actual == date) { $dataPayload = $request->all(); - $allGantt = []; - if(isset($dataPayload['gannt_id'])){ - $allGantt = $dataPayload['gannt_id']; - }else{ + $allGantt = []; + if (isset($dataPayload['gannt_id'])) { + $allGantt = $dataPayload['gannt_id']; + } else { foreach ($dataPayload['project_id'] as $val) { $allGantt[] = $this->getLatestGantt($val); } } - $dataFinal=[]; + $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){ + 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{ + } else { $totalRencanaBudget = Activity::whereNull('parent_id')->where("proyek_id", $keyGantt['proyek_id'])->where("version_gantt_id", $keyGantt['last_gantt_id'])->sum("rencana_biaya"); } $minDate = DB::table('assign_material_to_activity as ama') @@ -574,8 +580,8 @@ class ActivityController extends Controller $arr_ActualM = []; $tempDate = []; $tempPercentage = []; - $tempTtlPercentPlan=0; - $tempTtlPercentActual=0; + $tempTtlPercentPlan = 0; + $tempTtlPercentActual = 0; $currentACWP = 0; $budgetControlACWP = 0; $currentProgressActivity = 0; @@ -598,7 +604,7 @@ class ActivityController extends Controller ->get(); $dataTempPlan = []; $x = 0; - $sumPercentagePlan=0; + $sumPercentagePlan = 0; $totalACWP = isset($totalACWP) ? $totalACWP : 0; $totalBCWP = isset($totalBCWP) ? $totalBCWP : 0; foreach ($dataPlanM as $keyPlanM) { @@ -607,117 +613,118 @@ class ActivityController extends Controller ->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; + $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++; } $w = 0; $dataTempReport = []; - $sumPercentageActual=0; + $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; - $totalACWP += $keyActualM->biaya_actual/$keyActualM->duration; - $dataTempReport [$w]['totalacwp'] = $totalACWP; + $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; + $totalACWP += $keyActualM->biaya_actual / $keyActualM->duration; + $dataTempReport[$w]['totalacwp'] = $totalACWP; $w++; } $arr_ActualM[] = array( - 'date'=>$dt->format("Y-m-d"), - 'percentPlan'=>$sumPercentagePlan, - 'percentActual'=>$sumPercentageActual, - 'plan'=>$dataTempPlan, - 'actual'=>$dataTempReport, + 'date' => $dt->format("Y-m-d"), + 'percentPlan' => $sumPercentagePlan, + 'percentActual' => $sumPercentageActual, + 'plan' => $dataTempPlan, + 'actual' => $dataTempReport, ); - if(isset($dataPayload['period']) && $dataPayload['period'] == 'week'){ - if($dt->format("w")==1){ - if($totalACWP > 0 ){ + if (isset($dataPayload['period']) && $dataPayload['period'] == 'week') { + if ($dt->format("w") == 1) { + if ($totalACWP > 0) { $budgetControlACWP = $currentACWP + $totalACWP; } - if($totalBCWP > 0 ){ + if ($totalBCWP > 0) { $budgetControlBCWP = $currentBCWP + $totalBCWP; } - $tempTtlPercentPlan+= $sumPercentagePlan; - $tempTtlPercentActual+= $sumPercentageActual; + $tempTtlPercentPlan += $sumPercentagePlan; + $tempTtlPercentActual += $sumPercentageActual; $currentACWP += $totalACWP; $currentBCWP += $totalBCWP; - $tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2)); + $tempPercentage[] = array(round($tempTtlPercentPlan, 2), round($tempTtlPercentActual, 2)); $tempDate[] = array($dt->format("Y-m-d"), 0, 0); - }else if($dt->format("Y-m-d") == $end2->format("Y-m-d")) { - $tempTtlPercentPlan+= $sumPercentagePlan; - $tempTtlPercentActual+= $sumPercentageActual; + } else if ($dt->format("Y-m-d") == $end2->format("Y-m-d")) { + $tempTtlPercentPlan += $sumPercentagePlan; + $tempTtlPercentActual += $sumPercentageActual; $currentACWP += $totalACWP; $currentBCWP += $totalBCWP; - $tempPercentage[] = array(round($tempTtlPercentPlan,2), round($tempTtlPercentActual,2)); + $tempPercentage[] = array(round($tempTtlPercentPlan, 2), round($tempTtlPercentActual, 2)); $tempDate[] = array($dt->format("Y-m-d"), 0, 0); $tempTtlPercentPlan = 0; $tempTtlPercentActual = 0; } - }else{ - $tempPercentage[] = array(round($sumPercentagePlan,2), round($sumPercentageActual,2)); + } else { + $tempPercentage[] = array(round($sumPercentagePlan, 2), round($sumPercentageActual, 2)); $tempDate[] = array($dt->format("Y-m-d"), 0, 0); } } - if(round($totalACWP,0) > $totalRencanaBudget){ - $estimatedCost = round($totalACWP,0)+0; - }else{ - $estimatedCost = ($totalRencanaBudget+0); + if (round($totalACWP, 0) > $totalRencanaBudget) { + $estimatedCost = round($totalACWP, 0) + 0; + } else { + $estimatedCost = ($totalRencanaBudget + 0); } $costDeviation = $totalRencanaBudget - $estimatedCost; - if($costDeviation > 0){ + if ($costDeviation > 0) { $potential = "SAVING"; } else { $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN"; } $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, + "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, ) ); $dataFinal[] = array( - "proyek_name"=> $dataProject->nama, - "data"=>$dataResponse, - "allGant"=>$allGantt + "proyek_name" => $dataProject->nama, + "data" => $dataResponse, + "allGant" => $allGantt ); } - return response()->json(['status'=>'success','code'=>200, 'data' => $dataFinal], 200); + return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataFinal], 200); } - + public function import(Request $request) { - $data = $request->all(); + $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; @@ -725,46 +732,47 @@ class ActivityController extends Controller $excel = TmpImport::latest('id')->first(); return response()->json(['stack' => $excel, 'status' => 'success', 'message' => 'Data imported!', 'data' => $data, 'code' => 200], 200); - } + } public function uploadTmpImport(Request $request) { - if($request->hasFile('dokumen')){ - $document = $request->file('dokumen'); - $gantt_id = $request->gantt_id; - $name = $document->getClientOriginalName(); + if ($request->hasFile('dokumen')) { + $document = $request->file('dokumen'); + $gantt_id = $request->gantt_id; + $name = $document->getClientOriginalName(); $result = $document->move($this->pathTmpImport, $name); - if($result){ + if ($result) { $data = [ - 'gantt_id' => (int)$gantt_id, + '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 (!$result) { + unlink($this->pathTmpImport . $name); + return response()->json(['status' => 'failed', 'message' => 'Upload failed!', 'code' => 500], 500); } - return response()->json(['status'=>'success','message'=>'Upload successful!','code'=>200], 200); + return response()->json(['status' => 'success', 'message' => 'Upload successful!', 'code' => 200], 200); } - return response()->json(['status'=>'failed','message'=>'Upload failed!','code'=> 500], 500); + return response()->json(['status' => 'failed', 'message' => 'Upload failed!', 'code' => 500], 500); } - return response()->json(['status'=>'failed','message'=>'File is required!','code'=>400], 400); + return response()->json(['status' => 'failed', 'message' => 'File is required!', 'code' => 400], 400); } - public function importUpdate(Request $request) { - $data = $request->all(); - foreach ($data as $value) { - $activity = Activity::find($value['id']); - $activity->duration = $value['duration']; - $activity->start_date = $value['start_date']; - $activity->end_date = $value['end_date']; - $activity->save(); - } - return response()->json(['status'=>'success','data'=>$request,'message'=>'Update successful!','code'=>200], 200); - } -} + public function importUpdate(Request $request) + { + $data = $request->all(); + foreach ($data as $value) { + $activity = Activity::find($value['id']); + $activity->duration = $value['duration']; + $activity->start_date = $value['start_date']; + $activity->end_date = $value['end_date']; + $activity->save(); + } + return response()->json(['status' => 'success', 'data' => $request, 'message' => 'Update successful!', 'code' => 200], 200); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 6e8ca66..d1d58b2 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -393,9 +393,14 @@ class ProjectController extends Controller public function setBaseline($gantt_id) { - $activities = Activity::where("version_gantt_id", $gantt_id)->get(); + $activities = Activity::where("version_gantt_id", $gantt_id)->orderBy('id')->get(); foreach ($activities as $activity) { + $successor = Link::where('t_activity_id', $activity->id)->first(); + if ($successor) { + $predecessor = Activity::find($successor->s_activity_id); + $activity->start_date = $predecessor->end_date; + } $activity->update([ "planned_start"=>$activity->start_date, "planned_end"=>$activity->end_date, From 4293e375b7c1e2f1a1d4e547e058d7f822821af4 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 27 Jul 2023 10:36:26 +0700 Subject: [PATCH 02/62] Fix set baseline --- app/Http/Controllers/ProjectController.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index d1d58b2..6e8ca66 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -393,14 +393,9 @@ class ProjectController extends Controller public function setBaseline($gantt_id) { - $activities = Activity::where("version_gantt_id", $gantt_id)->orderBy('id')->get(); + $activities = Activity::where("version_gantt_id", $gantt_id)->get(); foreach ($activities as $activity) { - $successor = Link::where('t_activity_id', $activity->id)->first(); - if ($successor) { - $predecessor = Activity::find($successor->s_activity_id); - $activity->start_date = $predecessor->end_date; - } $activity->update([ "planned_start"=>$activity->start_date, "planned_end"=>$activity->end_date, From 039bca44ba42b1faa815f434b562ee10cdb1cddb Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 27 Jul 2023 14:50:10 +0700 Subject: [PATCH 03/62] Fix sync report --- app/Http/Controllers/ProjectController.php | 42 +++++++++++++++------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 6e8ca66..43dadf9 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -349,6 +349,25 @@ class ProjectController extends Controller return response()->json(['status'=>'success','code'=>200, 'data' => $data], 200); } + public static function setSyncDate($activity_id, $activity, $report) { + $status = ReportActivityMaterial::select('description')->where('activity_id', $activity_id)->first(); + if (isset($status) && $status != 'done') { + $minDate = date_create($report->report_date); + $maxDate = date_create($report->report_date); + date_add($maxDate, date_interval_create_from_date_string($activity->duration . " days")); + } else { + $material = AssignMaterial::where('activity_id', $activity_id)->first(); + $minDate = $material->start_activity; + $maxDate = $material->finish_activity; + } + $reports = array( + 'activity_id' => $activity_id, + 'min_date' => $minDate, + 'max_date' => $maxDate + ); + return $reports; + } + public function synchronizeReport($gantt_id) { $activities = Activity::where("version_gantt_id", $gantt_id)->get(); @@ -360,21 +379,12 @@ class ProjectController extends Controller if ($countReports === 1) { $dataReports = ReportActivityMaterial::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") - ); + $reports[] = ProjectController::setSyncDate($activity_id, $activity, $dr); } } if ($countReports > 1) { $firstReport = ReportActivityMaterial::where('activity_id', $activity_id)->orderBy('report_date')->first(); - $lastReport = ReportActivityMaterial::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") - ); + $reports[] = ProjectController::setSyncDate($activity_id, $activity, $firstReport); } $activity->reports = $reports; } @@ -383,8 +393,16 @@ class ProjectController extends Controller for ($i=0; $i < count($reports); $i++) { $activity = Activity::find($reports[$i]['activity_id']); + $successor = Link::where('t_activity_id', $activity->id)->first(); + if ($successor) { + $predecessor = Activity::find($successor->s_activity_id); + $activity->start_date = $predecessor->end_date; + $reports[$i]['max_date']->modify('1 day'); + } else { + $reports[$i]['max_date']->modify('-1 day'); + } $activity->start_date = $reports[$i]['min_date']; - $activity->end_date = $reports[$i]['max_date']; + $activity->end_date = $reports[$i]['max_date']->setTime(23,59,59); $activity->save(); } From b25723c9367db426234d94fc7e33ede690c7657d Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 28 Jul 2023 08:54:46 +0700 Subject: [PATCH 04/62] Fix dayoff --- app/Http/Controllers/ActivityController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 15e6cb4..708b3a5 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -353,7 +353,7 @@ class ActivityController extends Controller Activity::where('version_gantt_id', $data['ganttId'])->delete(); $projectId = VersionGantt::where('id', $data['ganttId'])->first()->proyek_id; - $dayOffs = VersionGantt::find($data['ganttId'])->first()->config_dayoff; + $dayOffs = VersionGantt::where('id', $data['ganttId'])->first()->config_dayoff; $activityStack = []; From b0b2c7b89f722bf98ec6e96692566e79559b5695 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 28 Jul 2023 10:35:12 +0700 Subject: [PATCH 05/62] Fix Sync Report --- app/Http/Controllers/ProjectController.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 43dadf9..158b77e 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -350,20 +350,21 @@ class ProjectController extends Controller } public static function setSyncDate($activity_id, $activity, $report) { - $status = ReportActivityMaterial::select('description')->where('activity_id', $activity_id)->first(); - if (isset($status) && $status != 'done') { + $status = AssignMaterial::select('status_activity')->where('activity_id', $activity_id)->first(); + if (isset($status->status_activity) && $status->status_activity != 'done') { $minDate = date_create($report->report_date); $maxDate = date_create($report->report_date); date_add($maxDate, date_interval_create_from_date_string($activity->duration . " days")); } else { $material = AssignMaterial::where('activity_id', $activity_id)->first(); - $minDate = $material->start_activity; - $maxDate = $material->finish_activity; + $minDate = date_create($material->start_activity); + $maxDate = date_create($material->finish_activity); } $reports = array( 'activity_id' => $activity_id, 'min_date' => $minDate, - 'max_date' => $maxDate + 'max_date' => $maxDate, + 'status' => $status->status_activity ); return $reports; } @@ -397,8 +398,8 @@ class ProjectController extends Controller if ($successor) { $predecessor = Activity::find($successor->s_activity_id); $activity->start_date = $predecessor->end_date; - $reports[$i]['max_date']->modify('1 day'); - } else { + } + if($reports[$i]['status'] != 'done'){ $reports[$i]['max_date']->modify('-1 day'); } $activity->start_date = $reports[$i]['min_date']; From 8c817ac2f3b51cf83542e6ac0439ee852bb32e4f Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 1 Aug 2023 15:28:20 +0700 Subject: [PATCH 06/62] Fix handling default value --- app/Http/Controllers/ActivityController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 708b3a5..978276d 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -462,8 +462,12 @@ class ActivityController extends Controller do { array_pop($activityStack); $lastStack = end($activityStack); - if ($activity->level > $lastStack->level) + if ($lastStack) { + if ($activity->level > $lastStack->level) + $lastStackIsNotRight = false; + } else { $lastStackIsNotRight = false; + } } while ($lastStackIsNotRight); } From af788c2d49b9e4599bbf04b5c17df1bc805c7c3b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 2 Aug 2023 10:49:41 +0700 Subject: [PATCH 07/62] Fix default column showed --- app/Http/Controllers/ShowHideColumnController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ShowHideColumnController.php b/app/Http/Controllers/ShowHideColumnController.php index a2db693..be5292f 100644 --- a/app/Http/Controllers/ShowHideColumnController.php +++ b/app/Http/Controllers/ShowHideColumnController.php @@ -45,12 +45,12 @@ class ShowHideColumnController extends Controller $success = 0; - foreach ($columns as $column) { + foreach ($columns as $key => $column) { $dataAdd = array( 'version_gantt_id'=>$request->version_gantt_id, 'user_id'=>$this->currentId, - 'column_name'=>$column, - 'show'=>true, + 'column_name'=>$key, + 'show'=>$column, 'created_by'=>$this->currentName ); From 5afcf08a59272084c09903485ad9440f87588027 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 4 Aug 2023 13:31:23 +0700 Subject: [PATCH 08/62] Update gantt update local storage --- app/Http/Controllers/ActivityController.php | 26 +++++++++++++++++++++ routes/web.php | 1 + 2 files changed, 27 insertions(+) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 978276d..57d665f 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -312,6 +312,32 @@ class ActivityController extends Controller return response()->json(['status' => 'success', 'message' => 'Activity Updated!', 'code' => 200], 200); } + public function batchUpdate(Request $request, $ganttId) + { + $entities = $request->all(); + if (empty($ganttId) || !is_int((int) $ganttId)) + return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400); + $activity = Activity::where('version_gantt_id',$ganttId)->get(); + $link = Link::where('version_gantt_id', $ganttId)->get(); + if (!$activity) + return response()->json(['status' => 'failed', 'message' => 'Activity not found!', 'code' => 404], 404); + if (!$link) + return response()->json(['status' => 'failed', 'message' => 'Link not found!', 'code' => 404], 404); + foreach ($entities as $entity) { + if ($entity['entity'] == "task") { + $activityToUpdate = $activity->firstWhere('id', $entity['data']['id']); + $entity['data']['name'] = $entity['data']['text']; + if(!$activityToUpdate->update($entity['data'])) + return response()->json(['status' => 'failed', 'message' => 'Failed to update activity !', 'code' => 500], 500); + } else if ($entity['entity'] == "link"){ + $linkToUpdate = $link->firstWhere('id', $entity['data']['id']); + if(!$linkToUpdate->update($entity['data'])) + return response()->json(['status' => 'failed', 'message' => 'Failed to update link !', 'code' => 500], 500); + } + } + return response()->json(['status' => 'success', 'message' => 'Activity Updated!', 'code' => 200], 200); + } + public function delete($id) { if (!$data = Activity::find($id)) diff --git a/routes/web.php b/routes/web.php index 03f769c..a9bcb99 100644 --- a/routes/web.php +++ b/routes/web.php @@ -207,6 +207,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout $router->post('/activity/import', 'ActivityController@import'); $router->post('/activity/import-update', 'ActivityController@importUpdate'); $router->post('/activity/import-old', 'ActivityController@importOld'); + $router->post('/activity/batch-update/{ganttId}', 'ActivityController@batchUpdate'); $router->post('/task', 'ActivityController@add'); $router->get('/task/edit/{id}', 'ActivityController@edit'); $router->put('/task/{id}', 'ActivityController@update'); From eee1bdcfc1292cee5204ac9ed33d94529b57c0fa Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 7 Aug 2023 09:33:26 +0700 Subject: [PATCH 09/62] Optimize map monitoring --- .../Controllers/MapMonitoringController.php | 14 +++--- app/Http/Controllers/ProjectController.php | 48 ------------------- 2 files changed, 7 insertions(+), 55 deletions(-) diff --git a/app/Http/Controllers/MapMonitoringController.php b/app/Http/Controllers/MapMonitoringController.php index 26b36cb..637983a 100644 --- a/app/Http/Controllers/MapMonitoringController.php +++ b/app/Http/Controllers/MapMonitoringController.php @@ -22,24 +22,24 @@ class MapMonitoringController extends Controller ->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') + ->pluck('user_id'); + // get position hr in presensi + $presences = 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) + ->whereIn('mu.id', $hr_assign_project) ->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) + ->whereIn('ahtp.user_id', $hr_assign_project) ->get(); + $tmp = []; + foreach($presences as $presensi){ 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( diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 158b77e..104fcf2 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -224,54 +224,6 @@ class ProjectController extends Controller if(!$data) return response()->json(['status'=>'failed','message'=>'Data not found!','code'=> 404], 404); - $scheduleWarningThreshold = 10; - $scheduleDangerThreshold = 5; - foreach($data as $d){ - $progress = $costVariance = $actualCost = 0; - $lastActivity = null; - $scheduleHealth = "on-track"; - $rootActivity = Activity::whereNull('parent_id')->where('proyek_id', $d->id)->orderBy('version_gantt_id', 'desc')->first(); - if($rootActivity){ - $costVariance = (int)$d->rencana_biaya - (int)$rootActivity->biaya_actual; - $actualCost = $rootActivity->biaya_actual ?? 0; - $progress = $rootActivity->persentase_progress ?? 0; - - $timeleft = strtotime($d->mulai_proyek) - strtotime($rootActivity->end_date); - $date1 = new \DateTime(date("Y-m-d", strtotime($d->mulai_proyek))); - $date2 = new \DateTime(date("Y-m-d", strtotime($rootActivity->end_date))); - $daysRemaining = $date2->diff($date1); - $daysRemaining = $daysRemaining->d; - - if($daysRemaining <= $scheduleDangerThreshold) { - $scheduleHealth = "danger"; - } elseif ($daysRemaining <= $scheduleWarningThreshold) { - $scheduleHealth = "warning"; - } - $lastActivity = date("d/m/Y", strtotime($rootActivity->end_date)); - } - $d->plannedInterval = date("d/m/Y", strtotime($d->mulai_proyek)) . " - " . date("d/m/Y", strtotime($d->akhir_proyek)); - $d->plannedCost = $d->rencana_biaya; - $d->actualCost = $actualCost; - $d->lastActivity = $lastActivity ?? "-"; - $d->costVariance = $costVariance; - $d->costHealth = $d->budget_health; - $d->scheduleHealth = $scheduleHealth; - $d->progress = $progress; - $d->lastGanttId = VersionGantt::where("proyek_id", $d->id)->orderBy('id', 'desc')->first()->id ?? null; - $d->manpower = UserToProyek::where("proyek_id", $d->id)->count() ?? 0; - $d->projectManager = DB::table('m_proyek') - ->join('m_users', 'm_users.id', '=', 'm_proyek.pm_id') - ->where('m_proyek.id', $d->id) - ->pluck('m_users.name') - ->first(); - if($d->area_kerja != ''){ - $d->geolocation = $this->httpReq($d->area_kerja); - $d->geolocation = []; - } else { - $d->geolocation = []; - } - } - $totalPlannedCost = array_sum(array_map('intval', array_column($data->toArray(), 'plannedCost'))); $totalActualCost = $data->sum('actualCost'); $manpowers = User::count(); From 89992a4bcbb016e3637c45b9dd253a79c6d4aaa1 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 7 Aug 2023 10:14:52 +0700 Subject: [PATCH 10/62] Fix map monitoring --- app/Http/Controllers/MapMonitoringController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/MapMonitoringController.php b/app/Http/Controllers/MapMonitoringController.php index 637983a..93b29fe 100644 --- a/app/Http/Controllers/MapMonitoringController.php +++ b/app/Http/Controllers/MapMonitoringController.php @@ -22,24 +22,24 @@ class MapMonitoringController extends Controller ->select('user_id') ->whereIn('proyek_id', $request->project_id) ->distinct() - ->pluck('user_id'); - // get position hr in presensi - $presences = DB::table('t_clock_in_out as tcio') + ->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') - ->whereIn('mu.id', $hr_assign_project) + ->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) - ->whereIn('ahtp.user_id', $hr_assign_project) + ->where('ahtp.user_id', $key->user_id) ->get(); - $tmp = []; - foreach($presences as $presensi){ 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( @@ -60,7 +60,7 @@ class MapMonitoringController extends Controller '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 + 'projects' => $project ); } } From a01f1ca25eacb56c4f172f4ef3733025634eaf78 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 7 Aug 2023 10:16:29 +0700 Subject: [PATCH 11/62] Add formatting --- .../Controllers/MapMonitoringController.php | 105 ++++++++++-------- 1 file changed, 60 insertions(+), 45 deletions(-) diff --git a/app/Http/Controllers/MapMonitoringController.php b/app/Http/Controllers/MapMonitoringController.php index 93b29fe..efec73f 100644 --- a/app/Http/Controllers/MapMonitoringController.php +++ b/app/Http/Controllers/MapMonitoringController.php @@ -15,56 +15,71 @@ class MapMonitoringController extends Controller // default map monitoring shows today's presence lat lon in the map public function search(Request $request) - { + { $dateNow = Carbon::today()->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(); + ->select('user_id') + ->whereIn('proyek_id', $request->project_id) + ->distinct() + ->get(); // get position hr in presensi $tmp = []; - foreach($hr_assign_project as $key){ + 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)){ + ->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 + '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); + return response()->json(['status' => 'success', 'code' => 200, 'data' => $tmp, 'totalRecord' => count($tmp)], 200); } public function list() @@ -72,12 +87,12 @@ class MapMonitoringController extends Controller $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); + 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); } } - -} + +} \ No newline at end of file From 5cd80e434864e27d62148809cc0c11d4fa7fe1ce Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 7 Aug 2023 10:57:10 +0700 Subject: [PATCH 12/62] Remove unnecessary column --- app/Http/Controllers/MapMonitoringController.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/app/Http/Controllers/MapMonitoringController.php b/app/Http/Controllers/MapMonitoringController.php index efec73f..0dda48a 100644 --- a/app/Http/Controllers/MapMonitoringController.php +++ b/app/Http/Controllers/MapMonitoringController.php @@ -35,15 +35,9 @@ class MapMonitoringController extends Controller '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) @@ -61,19 +55,12 @@ class MapMonitoringController extends Controller '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 ); From d782797bef6db1e75f9ed4b1685c3fdf9f6ae0c7 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 10 Aug 2023 12:07:20 +0700 Subject: [PATCH 13/62] Fix date range --- app/Helpers/MasterFunctionsHelper.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index a537ed8..0a817d5 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -189,14 +189,19 @@ class MasterFunctionsHelper /* $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') + $actualMaxDate = 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'); - $end->modify('next Friday'); - $end->modify('next Friday'); + ->max("a.end_date"); // plan date overlapped with assign_material_to_activity's, it should be m_activity's + $plannedMaxDate = 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("a.planned_end"); // plan date overlapped with assign_material_to_activity's, it should be m_activity' + $maxDate = max(new \DateTime($plannedMaxDate), new \DateTime($actualMaxDate)); + $end = $maxDate; + $end->modify('last month'); $interval = new \DateInterval('P7D'); } $period = new \DatePeriod($begin, $interval, $end); From 15e18b79017c6b736fd6954545d8239bb8c0426b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 11 Aug 2023 11:43:08 +0700 Subject: [PATCH 14/62] Fix report activity after update --- app/Http/Controllers/ActivityController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 57d665f..5158b05 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -327,8 +327,10 @@ class ActivityController extends Controller if ($entity['entity'] == "task") { $activityToUpdate = $activity->firstWhere('id', $entity['data']['id']); $entity['data']['name'] = $entity['data']['text']; + $entity['data']['persentase_progress'] = $entity['data']['progress'] * 100; if(!$activityToUpdate->update($entity['data'])) return response()->json(['status' => 'failed', 'message' => 'Failed to update activity !', 'code' => 500], 500); + $updatedJobsDone = $activityToUpdate->jobs_done; } else if ($entity['entity'] == "link"){ $linkToUpdate = $link->firstWhere('id', $entity['data']['id']); if(!$linkToUpdate->update($entity['data'])) From 70740213add4cf8397e146f6c0bff5d3008d3919 Mon Sep 17 00:00:00 2001 From: ibnu Date: Sat, 12 Aug 2023 18:58:35 +0700 Subject: [PATCH 15/62] update test optimalisasi API project search --- app/Http/Controllers/Controller.php | 73 ++++++++++++++++++++++ app/Http/Controllers/ProjectController.php | 13 ++++ rest-client.http | 72 ++++++++++++++++++++- routes/web.php | 2 +- 4 files changed, 156 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index c431f28..bd2fd2d 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -97,6 +97,79 @@ class Controller extends BaseController return $data; } + // new version for custom select in selfTable + protected function setUpPayloadSelect($condition, $tableSelf) + { + $alias = "selfTable"; + $builder = DB::table($tableSelf." AS ".$alias); + // $builder = $builder->select($alias.".*"); + if($condition){ + if(isset($condition['select'])){ + foreach($condition['select'] as $select){ + $builder = $builder->select($alias.".".$select); + } + } + if(isset($condition['joins'])){ + $no = 0; + foreach($condition['joins'] as $join){ + $tableJoin = isset($join['name1']) ? $join['name1'] : $alias; + $tableName = $join['name']; + $columnJoin = $join['column_join']; // foreign key table sini + $columnSelf = isset($join['column_self']) ? $join['column_self'] : "id"; // primary key table lawan + $columnResult = $join['column_results']; + + foreach($columnResult as $sColumn){ + $builder = $builder->addSelect($tableName.".".$sColumn." as join_".$this->listJoinAll[$no]."_".$sColumn); + } + $builder = $builder->leftJoin($tableName, $tableJoin.".".$columnJoin, '=', $tableName.'.'.$columnSelf); + $no++; + } + } + + if(isset($condition['columns'])){ + $listWhere = $condition['columns']; + + $builder = $builder->where(function ($query) use($listWhere, $alias){ + foreach($listWhere as $where){ + $value = $where['value']; + if($value && $value!="" && $value!=" "){ + $column = $where['name']; + $operator = strtolower($where['logic_operator']); // like, =, <>, range + $value2 = isset($where['value1']) ? $where['value1'] : ""; + $tableColumn = isset($where['table_name']) ? $where['table_name'] : $alias; + $query = $this->whereCondition($query, $operator, $tableColumn, $column, $value, $value2); + } + } + }); + } + + if(isset($condition['group_column'])){ + $builder = $this->groupWhere($builder, $condition['group_column'], $alias); + } + + $data['count'] = clone $builder; + + if(isset($condition['paging'])){ + $builder = $builder->offset($condition['paging']['start'])->limit($condition['paging']['length']); + } + + if(isset($condition['orders'])){ + $orders = $condition['orders']; + $sortBy = $orders['ascending'] ? "ASC" : "DESC"; + $columnOrder = $orders['columns']; + foreach($columnOrder as $column){ + $builder = $builder->orderBy($alias.".".$column, $sortBy); + } + } + }else{ + $builder = $builder->select($alias.".*"); + } + $data['builder'] = $builder; + return $data; + } + + + private function groupWhere($oldBuilder, $groupWhere, $alias) { $builder = $oldBuilder; diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 104fcf2..9d50370 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -216,6 +216,19 @@ class ProjectController extends Controller return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); } + public function searchCustom(Request $request) + { + $payload = $request->all(); + + $dataBuilder = $this->setUpPayloadSelect($payload, 'm_proyek'); + $builder = $dataBuilder['builder']; + $countBuilder = $dataBuilder['count']; + $dataGet = $builder->get(); + $totalRecord = $countBuilder->count(); + + return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); + } + public function list() { $data = Project::orderBy('id', 'desc')->get(); diff --git a/rest-client.http b/rest-client.http index 03878db..772aee0 100644 --- a/rest-client.http +++ b/rest-client.http @@ -1,10 +1,12 @@ -@token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODQ0NFwvYXBpXC9sb2dpbiIsImlhdCI6MTY3NzQ3NzIzMSwiZXhwIjoxNjc4MDgyMDMxLCJuYmYiOjE2Nzc0NzcyMzEsImp0aSI6ImR5WWhRY3ZIbUJEcmFKMG0iLCJzdWIiOjEsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ.9zT6CBbQholzIdQ9ZBDoxMvrR-PKvIYkGzdNB6bim0Y +@token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODQ0NFwvYXBpXC9sb2dpbiIsImlhdCI6MTY5MTc2MDYyNCwiZXhwIjoxNjkyMzY1NDI0LCJuYmYiOjE2OTE3NjA2MjQsImp0aSI6Ikd2bEFPTE4yZ2FuRFdVbjEiLCJzdWIiOjEsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ.XNGbsmcgQ-CkV8vLlvnItGKM0R1am5X5b6qUFOR1DRo +@tokenS = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hZHctYXBpLm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjkxNTcyMTIwLCJleHAiOjE2OTIxNzY5MjAsIm5iZiI6MTY5MTU3MjEyMCwianRpIjoiVUdqbnhLRVdlZzYyTTBnayIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.5QqK0dLW5jzbVOkSCSW0mFo0K7ycGOBW9NCG_2Zldm4 -@hostname = https://adw-api.ospro.id/api + +# @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://localhost:8444/api # @hostname = http://103.73.125.81:8444/api # @hostname = http://localhost:8444/adw-backend/api @@ -402,6 +404,59 @@ GET {{hostname}}/project/list Authorization: Bearer {{token}} content-type: application/json +### +POST {{hostname}}/project/search +Authorization: Bearer {{token}} +content-type: application/json + +{ + "columns": [ + { + "name": "nama", + "logic_operator": "ilike", + "value": "", + "operator": "AND" + } + ], + "select": ["kode_sortname", "nama", "mulai_proyek"], + "joins": [ + { + "name": "m_users", + "column_join": "pm_id", + "column_results": [ + "name", + "username" + ] + }, + { + "name": "m_type_proyek", + "column_join": "type_proyek_id", + "column_results": [ + "name", + "description" + ] + } + ], + "orders": { + "columns": [ + "id" + ], + "ascending": false + }, + "paging": { + "start": 0, + "length": 10 + } +} + +### +POST https://adw-api.ospro.id/api/project/search +Authorization: Bearer {{tokenS}} +content-type: application/json + +{ + "columns":[{"name":"nama","logic_operator":"ilike","value":"","operator":"AND"}],"joins":[{"name":"m_users","column_join":"pm_id","column_results":["name","username"]},{"name":"m_type_proyek","column_join":"type_proyek_id","column_results":["name","description"]}],"orders":{"columns":["id"],"ascending":false},"paging":{"start":0,"length":10} +} ### add POST {{hostname}}/project/add @@ -1103,3 +1158,14 @@ content-type: application/json } } + +####### +POST {{hostname}}/project/get-s-curve +Authorization: Bearer {{token}} +content-type: application/json + +{ + "period":"week", + "project_id":"118", + "gantt_id":"287" +} \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index a9bcb99..f7f8f93 100644 --- a/routes/web.php +++ b/routes/web.php @@ -53,7 +53,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout $router->post('/document-activity/search', 'ActivityDokumenController@searchDocProject'); $router->get('/document-activity/download/{id}', 'ActivityDokumenController@downloadDokumen'); - $router->post('/project/search', 'ProjectController@search'); + $router->post('/project/search', 'ProjectController@searchCustom'); $router->post('/project/add', 'ProjectController@add'); $router->put('/project/update/{id}', 'ProjectController@update'); $router->get('/project/edit/{id}', 'ProjectController@edit'); From 71e21226d265760b05ae52f9e2543eee9bf57d88 Mon Sep 17 00:00:00 2001 From: ibnu Date: Mon, 14 Aug 2023 07:28:43 +0700 Subject: [PATCH 16/62] update logic setUpPayload custom select --- app/Http/Controllers/Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index bd2fd2d..abad8b3 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -106,7 +106,7 @@ class Controller extends BaseController if($condition){ if(isset($condition['select'])){ foreach($condition['select'] as $select){ - $builder = $builder->select($alias.".".$select); + $builder = $builder->addSelect($alias.".".$select); } } if(isset($condition['joins'])){ From 2eeb504119c54d91c03194209fa7f75b27ac666b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 14 Aug 2023 10:32:46 +0700 Subject: [PATCH 17/62] Fix update actual cost --- app/Models/Activity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Activity.php b/app/Models/Activity.php index 1b98d03..eefcea4 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -71,8 +71,8 @@ class Activity extends Model $data->updateCostPlanning(); if($data->bobot_planning){ $data->updatePersentaseProgress(); - $data->updateCostActual(); } + $data->updateCostActual(); // if($data->start_date != request()->start_date || $data->end_date != request()->end_date) { // $data->updateStartEndDateHeader(); // } @@ -86,8 +86,8 @@ class Activity extends Model $data->updateCostPlanning(); if($data->bobot_planning){ $data->updatePersentaseProgress(); - $data->updateCostActual(); } + $data->updateCostActual(); $data->updateStartEndDateHeader(); }); From 9e60faf622801258c52ab5ec6c7dff624153a9b1 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 15 Aug 2023 09:02:24 +0700 Subject: [PATCH 18/62] Removing s curve from select --- app/Http/Controllers/ProjectController.php | 39 +++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 9d50370..7b186c5 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -231,7 +231,44 @@ class ProjectController extends Controller public function list() { - $data = Project::orderBy('id', 'desc')->get(); + $data = Project::select( + 'id', + 'kode_sortname', + 'jumlah_stakeholder', + 'nama', + 'mulai_proyek', + 'akhir_proyek', + 'area_kerja', + 'lokasi_kantor', + 'rencana_biaya', + 'biaya_actual', + 'company', + 'pm_id', + 'type_proyek_id', + 'divisi_id', + 'persentase_progress', + 'keterangan', + 'durasi_proyek', + 'progress_by_worklog', + 'status', + 'currency_symbol', + 'currency_code', + 'currency_name', + 'project_objectives', + 'considered_success_when', + 'potential_risk', + 'testing_environment', + 'currency_code', + 'currency_symbol', + 'currency_name', + 'budget_health', + 'phase_id', + 'calculation_status', + 'created_at', + 'created_by', + 'updated_at', + 'updated_by' + )->orderBy('id', 'desc')->get(); $countData = $data->count(); if(!$data) From 1e6fe6f1232edcd920c7baf2500452a3d14bca14 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 15 Aug 2023 10:05:57 +0700 Subject: [PATCH 19/62] Use only required column hr list --- app/Http/Controllers/HumanResourceController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/HumanResourceController.php b/app/Http/Controllers/HumanResourceController.php index 8e23f87..9e47627 100644 --- a/app/Http/Controllers/HumanResourceController.php +++ b/app/Http/Controllers/HumanResourceController.php @@ -112,7 +112,7 @@ class HumanResourceController extends Controller public function list() { - $data = HumanResource::all(); + $data = HumanResource::select('id', 'name')->get(); $countData = $data->count(); if($data){ From 4cd909c8ed4938389cc827d45f0d3d5809f6af17 Mon Sep 17 00:00:00 2001 From: ibnu Date: Tue, 15 Aug 2023 10:41:00 +0700 Subject: [PATCH 20/62] update search --- app/Http/Controllers/ProjectController.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 9d50370..5149d0d 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -214,24 +214,11 @@ class ProjectController extends Controller $totalRecord = $countBuilder->count(); return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); - } - - public function searchCustom(Request $request) - { - $payload = $request->all(); - - $dataBuilder = $this->setUpPayloadSelect($payload, 'm_proyek'); - $builder = $dataBuilder['builder']; - $countBuilder = $dataBuilder['count']; - $dataGet = $builder->get(); - $totalRecord = $countBuilder->count(); - - return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); - } + } public function list() { - $data = Project::orderBy('id', 'desc')->get(); + $data = Project::select("id", "nama", "kode_sortname")->orderBy('id', 'desc')->get(); $countData = $data->count(); if(!$data) @@ -254,7 +241,7 @@ class ProjectController extends Controller } try { $projectsByType = DB::table('m_proyek') - ->select('m_type_proyek.name', DB::raw('count(*) as total')) + ->select('m_type_proyek.name', DB::raw('count(id) as total')) ->join('m_type_proyek', 'm_type_proyek.id', '=', 'm_proyek.type_proyek_id') ->groupBy('m_type_proyek.name') ->get(); From 6050cd6a1e24b2d555fba97c411c1baa7d720f55 Mon Sep 17 00:00:00 2001 From: ibnu Date: Tue, 15 Aug 2023 10:48:01 +0700 Subject: [PATCH 21/62] update logic cek location --- app/Http/Controllers/PresenceController.php | 28 +++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 36ee625..00980cc 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -263,11 +263,35 @@ class PresenceController extends Controller 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)."'), + if($valGeom->type == "FeatureCollection"){ + // return count($valGeom->features); + $multiArea = $valGeom->features; + foreach($multiArea as $area){ + $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")); + if($check[0]->boundary){ + break; + } + } + }else{ + $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)."'), + if($valGeom->type == "FeatureCollection"){ + // return count($valGeom->features); + $multiArea = $valGeom->features; + foreach($multiArea as $area){ + $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary")); + if($check[0]->boundary){ + break; + } + } + }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")); + } } if(count($check)>0){ if($check[0]->boundary){ From 8fee272740a6dd9dfa4831b1ea84e7f48f333ca5 Mon Sep 17 00:00:00 2001 From: ibnu Date: Tue, 15 Aug 2023 14:58:55 +0700 Subject: [PATCH 22/62] update logic multi area clockinout --- app/Http/Controllers/PresenceController.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 00980cc..7490ab8 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -263,13 +263,12 @@ class PresenceController extends Controller foreach($geom as $dataGeom){ $valGeom = json_decode($dataGeom->geom); if($params->clock_in_out['type']=="out"){ - if($valGeom->type == "FeatureCollection"){ - // return count($valGeom->features); + if($valGeom->type == "FeatureCollection"){ $multiArea = $valGeom->features; foreach($multiArea as $area){ $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")); - if($check[0]->boundary){ + if($check[0]->boundary == true){ break; } } @@ -278,13 +277,12 @@ class PresenceController extends Controller ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary")); } }else{ - if($valGeom->type == "FeatureCollection"){ - // return count($valGeom->features); + if($valGeom->type == "FeatureCollection"){ $multiArea = $valGeom->features; foreach($multiArea as $area){ $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary")); - if($check[0]->boundary){ + if($check[0]->boundary == true){ break; } } @@ -338,6 +336,7 @@ class PresenceController extends Controller ->whereDate("ma.end_date", ">=", $params->time) ->get(); $temp = []; + // return json_encode($geom); if (count($geom) > 0) { foreach($geom as $dataGeom){ $valGeom = json_decode($dataGeom->geom); @@ -348,7 +347,7 @@ class PresenceController extends Controller foreach($multiArea as $area){ $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")); - if($check[0]->boundary){ + if($check[0]->boundary == true){ break; } } @@ -363,7 +362,7 @@ class PresenceController extends Controller foreach($multiArea as $area){ $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary")); - if($check[0]->boundary){ + if($check[0]->boundary == true){ break; } } From 9ec799d787d5db77e55c210cc4da12693e723413 Mon Sep 17 00:00:00 2001 From: ibnu Date: Tue, 15 Aug 2023 15:04:36 +0700 Subject: [PATCH 23/62] update logic multi area clockinout --- app/Http/Controllers/PresenceController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 7490ab8..722607c 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -266,9 +266,9 @@ class PresenceController extends Controller if($valGeom->type == "FeatureCollection"){ $multiArea = $valGeom->features; foreach($multiArea as $area){ - $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'), + $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary")); - if($check[0]->boundary == true){ + if($check[0]->boundary){ break; } } @@ -282,7 +282,7 @@ class PresenceController extends Controller foreach($multiArea as $area){ $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary")); - if($check[0]->boundary == true){ + if($check[0]->boundary){ break; } } @@ -345,9 +345,9 @@ class PresenceController extends Controller // return count($valGeom->features); $multiArea = $valGeom->features; foreach($multiArea as $area){ - $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'), + $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary")); - if($check[0]->boundary == true){ + if($check[0]->boundary){ break; } } @@ -362,7 +362,7 @@ class PresenceController extends Controller foreach($multiArea as $area){ $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary")); - if($check[0]->boundary == true){ + if($check[0]->boundary){ break; } } From 2ac211ffafef1cc97ede96a36891b091b4c61ca4 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 15 Aug 2023 15:05:44 +0700 Subject: [PATCH 24/62] Fix multiarea geom --- app/Http/Controllers/PresenceController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 00980cc..018052e 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -267,7 +267,7 @@ class PresenceController extends Controller // return count($valGeom->features); $multiArea = $valGeom->features; foreach($multiArea as $area){ - $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'), + $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary")); if($check[0]->boundary){ break; From a0cff6bf7083e40e86e65635b587b73497bd43d4 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 15 Aug 2023 16:00:12 +0700 Subject: [PATCH 25/62] Fix project list map monitoring --- app/Http/Controllers/ProjectController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 1787d88..e2d25ce 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -278,7 +278,7 @@ class ProjectController extends Controller } try { $projectsByType = DB::table('m_proyek') - ->select('m_type_proyek.name', DB::raw('count(id) as total')) + ->select('m_type_proyek.name', DB::raw('count(m_type_proyek.id) as total')) ->join('m_type_proyek', 'm_type_proyek.id', '=', 'm_proyek.type_proyek_id') ->groupBy('m_type_proyek.name') ->get(); From b8784cf6ffbf0e8da4fd64c820d0561916b3e999 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 16 Aug 2023 13:27:46 +0700 Subject: [PATCH 26/62] Fix type milestone --- app/Http/Controllers/ActivityController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 5158b05..6124751 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -216,7 +216,9 @@ class ActivityController extends Controller $data['created_by'] = $this->currentName; $max = Activity::where('version_gantt_id', $request->version_gantt_id)->max('sortorder'); $data['sortorder'] = $max + 1; - $data['type_activity'] = "task"; + if (!isset($data['type_activity'])) { + $data['type_activity'] = "task"; + } $parent = $data['parent_id'] ?? null; if ($parent) { From e56c4597d275da9f3d1b8c67536b20a655de0dda Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 16 Aug 2023 13:53:39 +0700 Subject: [PATCH 27/62] Fix sync report --- app/Http/Controllers/ProjectController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index e2d25ce..32eaeec 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -340,7 +340,10 @@ class ProjectController extends Controller public static function setSyncDate($activity_id, $activity, $report) { $status = AssignMaterial::select('status_activity')->where('activity_id', $activity_id)->first(); - if (isset($status->status_activity) && $status->status_activity != 'done') { + if (!isset($status->status_activity)) { + $status->status_activity = 'open'; + } + if ($status->status_activity != 'done') { $minDate = date_create($report->report_date); $maxDate = date_create($report->report_date); date_add($maxDate, date_interval_create_from_date_string($activity->duration . " days")); From c7ef95542519a74a080e3e91e3889c44af4627f5 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 16 Aug 2023 14:38:04 +0700 Subject: [PATCH 28/62] Fix period range --- app/Helpers/MasterFunctionsHelper.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 0a817d5..07e2c74 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -201,7 +201,6 @@ class MasterFunctionsHelper ->max("a.planned_end"); // plan date overlapped with assign_material_to_activity's, it should be m_activity' $maxDate = max(new \DateTime($plannedMaxDate), new \DateTime($actualMaxDate)); $end = $maxDate; - $end->modify('last month'); $interval = new \DateInterval('P7D'); } $period = new \DatePeriod($begin, $interval, $end); From fc35b7869e1e7507a573070701469f7389dc0f5c Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 16 Aug 2023 16:18:15 +0700 Subject: [PATCH 29/62] Formatting --- .../Controllers/DashboardBoDController.php | 163 ++++++++++-------- 1 file changed, 89 insertions(+), 74 deletions(-) diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php index 56ba219..8d437b1 100644 --- a/app/Http/Controllers/DashboardBoDController.php +++ b/app/Http/Controllers/DashboardBoDController.php @@ -14,16 +14,18 @@ use Illuminate\Support\Facades\Log; class DashboardBoDController extends Controller { - private function interpolateYear($year){ - if($year) - $year = '%'.$year.'%'; + private function interpolateYear($year) + { + if ($year) + $year = '%' . $year . '%'; return $year; } - private function curlReq($url, $token){ + private function curlReq($url, $token) + { $ch = curl_init(); $headers = [ - 'Authorization: '.$token + 'Authorization: ' . $token ]; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); @@ -37,7 +39,8 @@ class DashboardBoDController extends Controller return json_decode($response); } - private function getInvoiceIntegration($search) { + private function getInvoiceIntegration($search) + { // if(empty($search)) // return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); // @@ -52,30 +55,31 @@ class DashboardBoDController extends Controller } // to do - public function getCompanyCashFlow($year = '%') { + public function getCompanyCashFlow($year = '%') + { $year = $this->interpolateYear($year); $totalExpenditure = $totalInvoice = $totalPaidInvoice = 0; // 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) - /* ->orWhere('akhir_proyek', 'like', $year) */ + /* ->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){ + foreach ($projects as $project) { $project->expenses = 0; $resp = null; - if($project->kode_sortname != ""){ + 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; + $totalExpenditure += (int) $cost; $totalInvoice += $resp->data->total_invoice_amount ?? 0; $totalPaidInvoice += $resp->data->total_invoice_paid_amount ?? 0; } @@ -87,20 +91,21 @@ class DashboardBoDController extends Controller 'total_budget' => (int) $totalBudgets ?? 0, 'total_expenditure' => $totalExpenditure, 'total_invoice' => $totalInvoice, - 'total_paid_invoice' => $totalPaidInvoice , + 'total_paid_invoice' => $totalPaidInvoice, ] ], 200); } - public function getInvoiceOutstanding($year = '%'){ + 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){ + foreach ($projects as $project) { $resp = null; - if($project->kode_sortname != ""){ + if ($project->kode_sortname != "") { $resp = $this->getInvoiceIntegration($project->kode_sortname); array_push($return, [ 'project' => $project->nama, @@ -117,7 +122,8 @@ class DashboardBoDController extends Controller ], 200); } - public function getTotalProjectPerScheduleHealth($year = '%'){ + public function getTotalProjectPerScheduleHealth($year = '%') + { $year = $this->interpolateYear($year); $return = [ @@ -127,48 +133,49 @@ class DashboardBoDController extends Controller ]; $projects = Project::where('mulai_proyek', 'like', $year)->get(); - foreach($projects as $project) { - $project->scurve = MasterFunctionsHelper::getSCurve($project->id); - $selisihProgress = 0; - if($project->scurve && $project->scurve[0]){ - $planningArray = $project->scurve[0]['data']['percentagePlan']; - $actualArray = $project->scurve[0]['data']['percentageReal']; - $planningProgress = !empty($planningArray) ? $planningArray[count($planningArray) - 1] : 0; - $actualProgress = !empty($actualArray) ? $actualArray[count($actualArray) - 1] : 0; - } - $selisihProgress = $planningProgress - $actualProgress; + foreach ($projects as $project) { + $project->scurve = MasterFunctionsHelper::getSCurve($project->id); + $selisihProgress = 0; + if ($project->scurve && $project->scurve[0]) { + $planningArray = $project->scurve[0]['data']['percentagePlan']; + $actualArray = $project->scurve[0]['data']['percentageReal']; + $planningProgress = !empty($planningArray) ? $planningArray[count($planningArray) - 1] : 0; + $actualProgress = !empty($actualArray) ? $actualArray[count($actualArray) - 1] : 0; + } + $selisihProgress = $planningProgress - $actualProgress; try { - if($selisihProgress > 0 && $selisihProgress <= 5) - $return['warning'] += 1; - elseif($selisihProgress == 0) - $return['on-schedule'] += 1; - else - $return['behind-schedule'] += 1; + if ($selisihProgress > 0 && $selisihProgress <= 5) + $return['warning'] += 1; + elseif ($selisihProgress == 0) + $return['on-schedule'] += 1; + else + $return['behind-schedule'] += 1; } catch (\Error $e) { - return response()->json(['msg' => $e->getMessage(), 'data' => $project], 200); + return response()->json(['msg' => $e->getMessage(), 'data' => $project], 200); } } return response()->json(['data' => $return, 'q' => $projects], 200); } - public function getTotalProjectScheduleHealthPerDivision($year = '%'){ + public function getTotalProjectScheduleHealthPerDivision($year = '%') + { $year = $this->interpolateYear($year); $divisions = Divisi::whereNull('parent')->get(); - foreach($divisions as $division){ + foreach ($divisions as $division) { $scheduleData = new Collection(); $behindSchedule = $warning = $onSchedule = 0; $projects = Project::where('mulai_proyek', 'like', $year)->where('divisi_id', $division->id)->get(); - foreach($projects as $project) { + foreach ($projects as $project) { $project->scurve = MasterFunctionsHelper::getSCurve($project->id); - if(@$project->scurve['difference'] > 0 && @$project->scurve['difference'] <= 5) + if (@$project->scurve['difference'] > 0 && @$project->scurve['difference'] <= 5) $warning++; - elseif(@$project->scurve['difference'] > 5 && @$project->scurve['difference'] <= 100) + elseif (@$project->scurve['difference'] > 5 && @$project->scurve['difference'] <= 100) $behindSchedule++; - elseif(@$project->scurve['difference'] == 0) + elseif (@$project->scurve['difference'] == 0) $onSchedule++; } @@ -184,7 +191,8 @@ class DashboardBoDController extends Controller ], 200); } - public function getTotalProjectPerBudgetHealth($year = '%'){ + public function getTotalProjectPerBudgetHealth($year = '%') + { $year = $this->interpolateYear($year); return response()->json([ 'data' => [ @@ -195,28 +203,30 @@ class DashboardBoDController extends Controller ], 200); } - private function countTotalProjectByBudgetHealthInDivision($divisi, $year, $health){ + private function countTotalProjectByBudgetHealthInDivision($divisi, $year, $health) + { return Project::where('divisi_id', $divisi) ->where('mulai_proyek', 'like', $year) - /* ->orWhere('akhir_proyek', 'like', $year) */ + /* ->orWhere('akhir_proyek', 'like', $year) */ ->where('budget_health', $health) ->count(); } - public function getTotalProjectBudgetHealthPerDivision($year = '%'){ + public function getTotalProjectBudgetHealthPerDivision($year = '%') + { $year = $this->interpolateYear($year); - $divisions = Divisi::select('id','name') + $divisions = Divisi::select('id', 'name') ->with('children') ->whereNull('parent') ->get(); // to do : count in more than 1 level child - foreach($divisions as $division){ + 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){ + 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'); @@ -224,7 +234,7 @@ class DashboardBoDController extends Controller unset($division->children); $division->budgetData = $budgetData; } - foreach($divisions as $division){ + foreach ($divisions as $division) { } return response()->json([ 'data' => [ @@ -233,14 +243,15 @@ class DashboardBoDController extends Controller ], 200); } - public function getTotalProjectPerPhase($year = '%'){ + public function getTotalProjectPerPhase($year = '%') + { $year = $this->interpolateYear($year); $projectPhases = ProjectPhase::orderBy('order')->get(); - foreach($projectPhases as $phase){ + foreach ($projectPhases as $phase) { $phase->totalProject = Project::where('phase_id', $phase->id) - ->where('mulai_proyek', 'like', $year) - /* ->orWhere('akhir_proyek', 'like', $year) */ - ->count(); + ->where('mulai_proyek', 'like', $year) + /* ->orWhere('akhir_proyek', 'like', $year) */ + ->count(); } return response()->json([ 'data' => [ @@ -249,24 +260,26 @@ class DashboardBoDController extends Controller ], 200); } - private function countTotalProjectInDivision($id, $year){ + private function countTotalProjectInDivision($id, $year) + { return Project::where('divisi_id', $id) ->where('mulai_proyek', 'like', $year) ->count(); } - public function getTotalProjectPerDivision($year = '%') { + public function getTotalProjectPerDivision($year = '%') + { $year = $this->interpolateYear($year); - $divisions = Divisi::select('id','name') + $divisions = Divisi::select('id', 'name') ->with('children') ->whereNull('parent') ->get(); // to do : count in more than 1 level child - foreach($divisions as $v){ + foreach ($divisions as $v) { $v->total = $this->countTotalProjectInDivision($v->id, $year); - foreach($v->children as $d){ + foreach ($v->children as $d) { $v->total += $this->countTotalProjectInDivision($d->id, $year); } unset($v->children); @@ -277,27 +290,29 @@ class DashboardBoDController extends Controller ], 200); } - private function countTotalProjectValueInDivision($id, $year){ + private function countTotalProjectValueInDivision($id, $year) + { return Project::select(DB::raw('SUM(CAST("rencana_biaya" AS DOUBLE PRECISION))')) ->where('mulai_proyek', 'like', $year) - /* ->orWhere('akhir_proyek', 'like', $year) */ + /* ->orWhere('akhir_proyek', 'like', $year) */ ->where('divisi_id', $id) ->pluck('sum') ->first(); } - public function getTotalProjectValuePerDivision($year = '%') { + public function getTotalProjectValuePerDivision($year = '%') + { $year = $this->interpolateYear($year); - $divisions = Divisi::select('id','name') + $divisions = Divisi::select('id', 'name') ->with('children') ->whereNull('parent') ->get(); // to do : count in more than 1 level child - foreach($divisions as $v){ + foreach ($divisions as $v) { $v->total = $this->countTotalProjectValueInDivision($v->id, $year); - foreach($v->children as $d){ + foreach ($v->children as $d) { $v->total += $this->countTotalProjectValueInDivision($d->id, $year); } unset($v->children); @@ -309,16 +324,17 @@ class DashboardBoDController extends Controller } - public function getDetailExpenditure($year = '%'){ + 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){ + foreach ($projects as $project) { $lastGantt = MasterFunctionsHelper::getLatestGantt($project->id); - if($project->kode_sortname != ""){ + if ($project->kode_sortname != "") { $resp = $this->getInvoiceIntegration($project->kode_sortname); $project->invoice = [ 'invoiced' => $resp->data->total_invoice_amount ?? 0, @@ -328,12 +344,12 @@ class DashboardBoDController extends Controller $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(); */ - if(!isset($lastGantt['last_gantt_id'])){ - $project->manPowers = 0; - } else { - $project->manPowers = UserToVersionGantt::where('version_gantt_id', $lastGantt['last_gantt_id'])->count(); - $project->scurve = MasterFunctionsHelper::getSCurve($project->id); - } + if (!isset($lastGantt['last_gantt_id'])) { + $project->manPowers = 0; + } else { + $project->manPowers = UserToVersionGantt::where('version_gantt_id', $lastGantt['last_gantt_id'])->count(); + $project->scurve = MasterFunctionsHelper::getSCurve($project->id); + } $project->lastGanttId = MasterFunctionsHelper::getLatestGantt($project->id); } @@ -342,5 +358,4 @@ class DashboardBoDController extends Controller 'total_manpowers' => User::count() ], 200); } -} - +} \ No newline at end of file From d850aef744bc27f572687875eb31b59a4ebb27c5 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 18 Aug 2023 09:04:54 +0700 Subject: [PATCH 30/62] Fix batch update sortorder --- app/Http/Controllers/ActivityController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 6124751..4ba8865 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -330,6 +330,9 @@ class ActivityController extends Controller $activityToUpdate = $activity->firstWhere('id', $entity['data']['id']); $entity['data']['name'] = $entity['data']['text']; $entity['data']['persentase_progress'] = $entity['data']['progress'] * 100; + if (isset($entity['data']['target'])) { + $this->updateOrder($entity['data']['id'], $entity['data']['target']); + } if(!$activityToUpdate->update($entity['data'])) return response()->json(['status' => 'failed', 'message' => 'Failed to update activity !', 'code' => 500], 500); $updatedJobsDone = $activityToUpdate->jobs_done; From 7bf4b74ee397d3ee44491e7b7cb4a486b043277d Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 18 Aug 2023 11:38:21 +0700 Subject: [PATCH 31/62] fix calculate scurve --- app/Helpers/MasterFunctionsHelper.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 07e2c74..681e39b 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -604,6 +604,12 @@ class MasterFunctionsHelper ->where('activity_id', '=', $keyActualM->activity_id) ->groupBy('activity_id') ->first(); + if (!isset($sumVolActual)) { + $sumVolActual = (object) [ + 'activity_id' => $keyActualM->activity_id, + 'ttl_qty_plan' => "0" + ]; + } $sumReportActual = DB::table('report_activity_material') ->where('activity_id', $keyActualM->activity_id) ->sum('qty'); @@ -623,18 +629,29 @@ class MasterFunctionsHelper ->where('activity_id', '=', $keyActualM->activity_id) ->orderBy('status_activity', 'ASC') ->first(); - $dataTempReport[$w]['percentage'] = ($keyActualM->qty / $sumVolActual->ttl_qty_plan) * $keyActualM->bobot_planning; + if (!isset($checkStatusActivity)) { + $checkStatusActivity = (object) [ + 'activity_id' => $keyActualM->activity_id, + 'status_activity' => 'open' + ]; + } + if ($sumVolActual->ttl_qty_plan == "0") { + $actual = 0; + } else { + $actual = $keyActualM->qty / $sumVolActual->ttl_qty_plan; + } + $dataTempReport[$w]['percentage'] = $actual * $keyActualM->bobot_planning; // $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; // if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ if ($checkStatusActivity->status_activity == 'done') { $sumPercentageActual += $keyActualM->bobot_planning / $reportCount; // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; } else { - if ($keyActualM->qty / $sumVolActual->ttl_qty_plan >= 1 || (int) $sumVolActual->ttl_qty_plan == (int) $sumReportActual) { - $sumPercentageActual += (($keyActualM->qty / $sumVolActual->ttl_qty_plan) * $keyActualM->bobot_planning) * (95 / 100); + if ( $actual >= 1 || (int) $sumVolActual->ttl_qty_plan == (int) $sumReportActual) { + $sumPercentageActual += ($actual * $keyActualM->bobot_planning) * (95 / 100); // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; } else { - $sumPercentageActual += ($keyActualM->qty / $sumVolActual->ttl_qty_plan) * $keyActualM->bobot_planning; + $sumPercentageActual += $actual * $keyActualM->bobot_planning; // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; } } From 7f9fe052e53ddcd849c9e99f907296407b3b1591 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 18 Aug 2023 16:10:39 +0700 Subject: [PATCH 32/62] Adding more range for scurve --- app/Helpers/MasterFunctionsHelper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 681e39b..eb70448 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -200,7 +200,8 @@ class MasterFunctionsHelper ->where('a.version_gantt_id', '=', $keyGantt['id']) ->max("a.planned_end"); // plan date overlapped with assign_material_to_activity's, it should be m_activity' $maxDate = max(new \DateTime($plannedMaxDate), new \DateTime($actualMaxDate)); - $end = $maxDate; + $end = new \DateTime($maxDate->format('Y-m-d') . ' Friday'); + $end->modify('next Friday'); $interval = new \DateInterval('P7D'); } $period = new \DatePeriod($begin, $interval, $end); From 65833f14556412ea6b8a8966fe8896ddd27490d9 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 18 Aug 2023 17:12:37 +0700 Subject: [PATCH 33/62] delete report when delete overhead --- app/Models/AssignMaterial.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Models/AssignMaterial.php b/app/Models/AssignMaterial.php index 5cb8bc5..0c282a6 100644 --- a/app/Models/AssignMaterial.php +++ b/app/Models/AssignMaterial.php @@ -5,6 +5,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; use App\Models\RequestMaterial; use App\Models\Activity; +use App\Models\ReportActivityMaterial; class AssignMaterial extends Model { @@ -35,6 +36,7 @@ class AssignMaterial extends Model }); static::deleted(function($data) { + $reportActivities = ReportActivityMaterial::where('assign_material_id', $data->id)->delete(); $activity = Activity::where('id', $data->activity_id)->first(); $activity->rencana_biaya -= floatval($data->budget) * floatval($data->qty_planning); $activity->save(); From 37b3eed4fb2a00cecd1a63e58fe88d8296686ba9 Mon Sep 17 00:00:00 2001 From: ibnu Date: Sun, 20 Aug 2023 14:21:49 +0700 Subject: [PATCH 34/62] update test --- app/Http/Controllers/ProjectController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 1787d88..25ca5a6 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -407,6 +407,8 @@ class ProjectController extends Controller $activity->update([ "planned_start"=>$activity->start_date, "planned_end"=>$activity->end_date, + "early_start"=>$activity->start_date, + "early_end"=>$activity->end_date, ]); } From 584e7ef8594760fa9c4991f1ab78510e4b6c3251 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 21 Aug 2023 10:41:56 +0700 Subject: [PATCH 35/62] Add column --- app/Models/UserToProyek.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/UserToProyek.php b/app/Models/UserToProyek.php index eb80c9b..bffc876 100644 --- a/app/Models/UserToProyek.php +++ b/app/Models/UserToProyek.php @@ -14,6 +14,6 @@ class UserToProyek extends Model protected $fillable = [ 'user_id', 'proyek_id', 'rbs', 'project_role', 'group_r', 'max_used', 'standart_rate', 'uom_standart_rate', 'overtime_rate', 'uom_overtime_rate', 'cost_per_used', 'accrue_at', - 'base_calender', 'created_at', 'created_by', 'updated_at', 'updated_by' + 'base_calender', 'is_customer', 'created_at', 'created_by', 'updated_at', 'updated_by' ]; } From c75350c46681f6592ce8de7178c8df146b002ae7 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 21 Aug 2023 16:10:58 +0700 Subject: [PATCH 36/62] Fix check location for radius --- app/Http/Controllers/PresenceController.php | 36 ++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 722607c..6c40779 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -266,6 +266,20 @@ class PresenceController extends Controller if($valGeom->type == "FeatureCollection"){ $multiArea = $valGeom->features; foreach($multiArea as $area){ + if ($area->geometry->type === "Point") { + $pointCoordinates = $area->geometry->coordinates; + $pointLng = $pointCoordinates[0]; + $pointLat = $pointCoordinates[1]; + + $check = DB::select(DB::raw("SELECT ST_Distance( + ST_GeomFromGeoJSON('" . json_encode($area->geometry) . "'), + ST_GeomFromText('POINT(" . $params->clock_in_out['clock_in_lng'] . " " . $params->clock_in_out['clock_in_lat'] . ")', 4326) + ) <= " . $area->properties->radius . " as within_radius")); + + if ($check[0]->within_radius) { + break; + } + } $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary")); if($check[0]->boundary){ @@ -280,6 +294,20 @@ class PresenceController extends Controller if($valGeom->type == "FeatureCollection"){ $multiArea = $valGeom->features; foreach($multiArea as $area){ + if ($area->geometry->type === "Point") { + $pointCoordinates = $area->geometry->coordinates; + $pointLng = $pointCoordinates[0]; + $pointLat = $pointCoordinates[1]; + + $check = DB::select(DB::raw("SELECT ST_Distance( + ST_GeomFromGeoJSON('" . json_encode($area->geometry) . "'), + ST_GeomFromText('POINT(" . $params->clock_in_out['clock_in_lng'] . " " . $params->clock_in_out['clock_in_lat'] . ")', 4326) + ) <= " . $area->properties->radius . " as within_radius")); + + if ($check[0]->within_radius) { + break; + } + } $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary")); if($check[0]->boundary){ @@ -292,12 +320,18 @@ class PresenceController extends Controller } } if(count($check)>0){ - if($check[0]->boundary){ + if(isset($check[0]->boundary) && $check[0]->boundary){ $temp[]=array( "activity_id" => $dataGeom->id, "boundary" => $check[0]->boundary, "status_assign" => true ); + } else if (isset($check[0]->within_radius) && $check[0]->within_radius) { + $temp[]=array( + "activity_id" => $dataGeom->id, + "boundary" => $check[0]->within_radius, + "status_assign" => true + ); } } } From 73cf600790017bd75ac726cb57f29f271d993957 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 22 Aug 2023 09:46:08 +0700 Subject: [PATCH 37/62] Add wptime on map monitoring --- app/Http/Controllers/MapMonitoringController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/MapMonitoringController.php b/app/Http/Controllers/MapMonitoringController.php index 0dda48a..3fdcef4 100644 --- a/app/Http/Controllers/MapMonitoringController.php +++ b/app/Http/Controllers/MapMonitoringController.php @@ -38,10 +38,14 @@ class MapMonitoringController extends Controller 'tcio.clock_in_loc', 'tcio.clock_out_loc', 'tcio.date_presence', + 'mw.lat', + 'mw.lon', + 'mw.wptime' ) ->join('m_users as mu', 'mu.id', '=', 'tcio.user_id') + ->join('m_waypoint as mw', 'mu.id', '=', 'mw.user_id') ->where('mu.id', $key->user_id) - ->orderBy('tcio.id', 'DESC') + ->orderBy('mw.wptime', 'DESC') ->first(); $project = DB::table('assign_hr_to_proyek as ahtp') ->select('ahtp.proyek_id as id', 'mp.nama as project_name') @@ -53,6 +57,9 @@ class MapMonitoringController extends Controller $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, + 'wp_lat' => $presensi->lat, + 'wp_lon' => $presensi->lon, + 'wp_time' => $presensi->wptime, 'clock_in' => $presensi->clock_in, 'clock_out' => $presensi->clock_out, 'clock_in_lat' => $presensi->clock_in_lat, From fd0fe14ef02cf2fd0bfd4d3d53b65bf5cbfc5630 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 22 Aug 2023 10:26:58 +0700 Subject: [PATCH 38/62] Excluding customer for user assignment --- .../Controllers/HumanResourceController.php | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/HumanResourceController.php b/app/Http/Controllers/HumanResourceController.php index 9e47627..f71cf28 100644 --- a/app/Http/Controllers/HumanResourceController.php +++ b/app/Http/Controllers/HumanResourceController.php @@ -138,11 +138,26 @@ class HumanResourceController extends Controller } } - if($search && !empty($search)){ - $data = UserToProyek::select("m_users.id as id", "m_users.name as name", "assign_hr_to_proyek.project_role as proyek_role")->join('m_users', 'm_users.id', '=', 'assign_hr_to_proyek.user_id') - ->where("assign_hr_to_proyek.proyek_id", $idProyek)->where("m_users.name", 'like', '%'.$search.'%')->whereNotIn("m_users.id", $forbidden)->get(); - }else{ - $data = UserToProyek::select("m_users.id as id", "m_users.name as name", "assign_hr_to_proyek.project_role as proyek_role")->where("assign_hr_to_proyek.proyek_id", $idProyek)->join('m_users', 'm_users.id', '=', 'assign_hr_to_proyek.user_id')->whereNotIn("m_users.id", $forbidden)->get(); + if ($search && !empty($search)) { + $data = UserToProyek::select("m_users.id as id", "m_users.name as name", "assign_hr_to_proyek.project_role as proyek_role") + ->join('m_users', 'm_users.id', '=', 'assign_hr_to_proyek.user_id') + ->where("assign_hr_to_proyek.proyek_id", $idProyek) + ->where(function ($query) { + $query->where("assign_hr_to_proyek.is_customer", "!=", true) + ->orWhereNull("assign_hr_to_proyek.is_customer"); + }) + ->where("m_users.name", 'like', '%' . $search . '%') + ->whereNotIn("m_users.id", $forbidden)->get(); + } else { + $data = UserToProyek::select("m_users.id as id", "m_users.name as name", "assign_hr_to_proyek.project_role as proyek_role") + ->where("assign_hr_to_proyek.proyek_id", $idProyek) + ->where(function ($query) { + $query->where("assign_hr_to_proyek.is_customer", "!=", true) + ->orWhereNull("assign_hr_to_proyek.is_customer"); + }) + ->join('m_users', 'm_users.id', '=', 'assign_hr_to_proyek.user_id') + ->whereNotIn("m_users.id", $forbidden) + ->get(); } return response()->json($data); From 80b186e2243555ecfe5a812ca3af7db97ce79d6d Mon Sep 17 00:00:00 2001 From: ibnu Date: Tue, 22 Aug 2023 20:45:08 +0700 Subject: [PATCH 39/62] update early and actual --- app/Http/Controllers/ActivityController.php | 32 +++++++++++++++++++++ app/Http/Controllers/ProjectController.php | 7 +++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 5158b05..12293ed 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -47,6 +47,10 @@ class ActivityController extends Controller $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->actual_start = isset($dataHeader->actual_start) ? date_format(date_create($dataHeader->actual_start), "Y-m-d") : NULL; + $dataHeader->actual_end = isset($dataHeader->actual_end) ? date_format(date_create($dataHeader->actual_end), "Y-m-d") : NULL; + $dataHeader->type = "header"; $dataHeader->text = $dataHeader->name; $finalData[] = $dataHeader; @@ -72,6 +76,10 @@ class ActivityController extends Controller $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->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; + $objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL; + $objRow->progress = $objRow->persentase_progress / 100; $objRow->type = $type; $finalData[] = $objRow; @@ -115,6 +123,30 @@ class ActivityController extends Controller $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; + + // $linking = Link::where('t_activity_id', $objRow->id)->first(); + // if(isset($linking->s_activity_id)){ + // $activityLink = Activity::where('id', $linking->s_activity_id)->first(); + // $earlyStart=date_create($activityLink->end_date); + // date_add($earlyStart,date_interval_create_from_date_string("1 days")); + // $objRow->early_start = date_format($earlyStart, "Y-m-d"); + // }else{ + // $objRow->early_start = isset($objRow->planned_start) ? date_format(date_create($objRow->planned_start), "Y-m-d") : NULL; + // } + + // if(isset($objRow->planned_end)){ + // $baseStart = strtotime($objRow->planned_start); + // $baseFinish = strtotime($objRow->planned_end); + // $durationStrtotime = $baseFinish - $baseStart; + + // $durasiBaseline = round($durationStrtotime / (60 * 60 * 24)); + // $earlyEnd = date_create($objRow->start_date); + // date_add($earlyEnd,date_interval_create_from_date_string("".$durasiBaseline." days")); + // $objRow->early_end = date_format($earlyEnd, "Y-m-d"); + // } + $objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; + $objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL; + $dataChildren = $this->getChildren($gantt_id, $objRow->id); if ($objRow->type_activity == "milestone") { $objRow->type = $objRow->type_activity; diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 25ca5a6..b8fc761 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -390,9 +390,12 @@ class ProjectController extends Controller } if($reports[$i]['status'] != 'done'){ $reports[$i]['max_date']->modify('-1 day'); + }else if($reports[$i]['status'] == 'done'){ + $activity->actual_end = $reports[$i]['max_date']->setTime(23,59,59); } - $activity->start_date = $reports[$i]['min_date']; - $activity->end_date = $reports[$i]['max_date']->setTime(23,59,59); + $activity->start_date = $reports[$i]['min_date']; //same early + $activity->end_date = $reports[$i]['max_date']->setTime(23,59,59); // same early + $activity->actual_start = $reports[$i]['min_date']; $activity->save(); } From e0785ced109cf49afd1ae23b97f61a6782ebf793 Mon Sep 17 00:00:00 2001 From: ibnu Date: Tue, 22 Aug 2023 20:47:59 +0700 Subject: [PATCH 40/62] update early and actual update logic 22 Aug --- app/Http/Controllers/ActivityController.php | 20 -------------------- app/Models/Activity.php | 2 +- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index ad931e9..c95c3f2 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -124,26 +124,6 @@ class ActivityController extends Controller $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; - // $linking = Link::where('t_activity_id', $objRow->id)->first(); - // if(isset($linking->s_activity_id)){ - // $activityLink = Activity::where('id', $linking->s_activity_id)->first(); - // $earlyStart=date_create($activityLink->end_date); - // date_add($earlyStart,date_interval_create_from_date_string("1 days")); - // $objRow->early_start = date_format($earlyStart, "Y-m-d"); - // }else{ - // $objRow->early_start = isset($objRow->planned_start) ? date_format(date_create($objRow->planned_start), "Y-m-d") : NULL; - // } - - // if(isset($objRow->planned_end)){ - // $baseStart = strtotime($objRow->planned_start); - // $baseFinish = strtotime($objRow->planned_end); - // $durationStrtotime = $baseFinish - $baseStart; - - // $durasiBaseline = round($durationStrtotime / (60 * 60 * 24)); - // $earlyEnd = date_create($objRow->start_date); - // date_add($earlyEnd,date_interval_create_from_date_string("".$durasiBaseline." days")); - // $objRow->early_end = date_format($earlyEnd, "Y-m-d"); - // } $objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; $objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL; diff --git a/app/Models/Activity.php b/app/Models/Activity.php index eefcea4..3d09785 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -25,7 +25,7 @@ class Activity extends Model 'buffer_radius', 'duration', 'color_progress', 'jumlah_pekerjaan', 'satuan', 'description', 'priority', 'bobot_planning', 'type_activity', 'open', 'geom', 'version_gantt_id', 'budget_plan', 'biaya_material_plan', 'biaya_human_plan', 'biaya_tools_plan', - 'planned_start', 'planned_end', 'satuan_id', + 'planned_start', 'planned_end', 'satuan_id', 'actual_start', 'actual_end', 'created_at', 'created_by', 'updated_at', 'updated_by', 'sortorder' ]; From 98174773f2569df998581aa48a9ffd931a435431 Mon Sep 17 00:00:00 2001 From: ibnu Date: Wed, 23 Aug 2023 10:41:42 +0700 Subject: [PATCH 41/62] update logic early recursive activity from start and end --- app/Http/Controllers/ActivityController.php | 51 +++++++++++++++++---- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index c95c3f2..401837e 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -48,9 +48,11 @@ class ActivityController extends Controller $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->actual_start = isset($dataHeader->actual_start) ? date_format(date_create($dataHeader->actual_start), "Y-m-d") : NULL; - $dataHeader->actual_end = isset($dataHeader->actual_end) ? date_format(date_create($dataHeader->actual_end), "Y-m-d") : NULL; - + $actualStart = $this->getActivityFirst($dataHeader->id); + $dataHeader->actual_start = date_format(date_create($actualStart), "Y-m-d"); + $actualEnd = $this->getActivityLast($dataHeader->id); + $dataHeader->actual_end = isset($actualEnd) ? date_format(date_create($actualEnd), "Y-m-d") : NULL; + $dataHeader->type = "header"; $dataHeader->text = $dataHeader->name; $finalData[] = $dataHeader; @@ -76,9 +78,11 @@ class ActivityController extends Controller $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->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; - $objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL; + + $actualStart = $this->getActivityFirst($objRow->id); + $objRow->actual_start = isset($actualStart) ? date_format(date_create($actualStart), "Y-m-d") : NULL; + $actualEnd = $this->getActivityLast($objRow->id); + $objRow->actual_end = isset($actualEnd) ? date_format(date_create($actualEnd), "Y-m-d") : NULL; $objRow->progress = $objRow->persentase_progress / 100; $objRow->type = $type; @@ -123,17 +127,22 @@ class ActivityController extends Controller $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->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; - $objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL; - + $dataChildren = $this->getChildren($gantt_id, $objRow->id); if ($objRow->type_activity == "milestone") { $objRow->type = $objRow->type_activity; + $objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; } elseif (empty($dataChildren)) { $objRow->type = "task"; + $objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; + $objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL; } else { $objRow->type = "project"; + $actualStart = $this->getActivityFirst($objRow->id); + $objRow->actual_start = isset($actualStart) ? date_format(date_create($actualStart), "Y-m-d") : NULL; + + $actualEnd = $this->getActivityLast($objRow->id); + $objRow->actual_end = isset($actualEnd) ? date_format(date_create($actualEnd), "Y-m-d") : NULL; } $finalData[] = $objRow; $finalData = array_merge($finalData, $dataChildren); @@ -141,6 +150,28 @@ class ActivityController extends Controller return $finalData; } + public function getActivityFirst($parentId){ + $activity = Activity::where('parent_id', $parentId)->orderByRaw('start_date ASC')->first(); + if($activity->type_activity == "task"){ + // Log::info("activity ", [$activity]); + return $activity->actual_start; + }else{ + return $this->getActivityFirst($activity->id); + } + + } + + public function getActivityLast($parentId){ + $activity = Activity::where('parent_id', $parentId)->orderByRaw('start_date DESC')->first(); + if($activity->type_activity == "task"){ + // Log::info("activity ", [$activity]); + return $activity->actual_end; + }else{ + return $this->getActivityLast($activity->id); + } + + } + private function cloneTemplate($id, $proyek_id, $hierarchy_ftth_id = null) { $project = Project::find($proyek_id); From 199d34fdd4a31386f10e7f598e862e3302a34f74 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 23 Aug 2023 14:50:26 +0700 Subject: [PATCH 42/62] Fix work area restriction --- app/Http/Controllers/PresenceController.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 6c40779..ad0501c 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\HumanResource; use Log; use Illuminate\Http\Request; use App\Models\Presence; @@ -24,7 +25,10 @@ class PresenceController extends Controller if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){ $statusBoundary = true; } - + $statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first(); + if ($statusRestriction->status_boundary) { + $statusBoundary = true; + } // not assign if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ $data=array( @@ -134,7 +138,10 @@ class PresenceController extends Controller if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){ $statusBoundary = true; } - + $statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first(); + if ($statusRestriction->status_boundary) { + $statusBoundary = true; + } // not assign if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ $data=array( From b1a6ee123116e23ccedefcc2c663ea42e790c61b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 12:19:16 +0700 Subject: [PATCH 43/62] Enable integration --- .../Commands/syncHumanResourceIntegration.php | 6 ++--- .../Controllers/DashboardBoDController.php | 22 +++++++++---------- app/Http/Controllers/ProjectController.php | 10 ++++----- .../Controllers/RequestMaterialController.php | 2 +- .../Controllers/UserToProyekController.php | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/Console/Commands/syncHumanResourceIntegration.php b/app/Console/Commands/syncHumanResourceIntegration.php index 6120999..7b4ef5f 100644 --- a/app/Console/Commands/syncHumanResourceIntegration.php +++ b/app/Console/Commands/syncHumanResourceIntegration.php @@ -39,9 +39,9 @@ class syncHumanResourceIntegration extends Command */ public function handle() { - // $url = config('api.adw').'/employees?page=1'; - // echo "Requesting to " . $url; - $response = null; + $url = config('api.adw').'/employees?page=1'; + echo "Requesting to " . $url; + $response = MasterFunctionsHelper::curlReq($url); if(!$response) return; diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php index 8d437b1..22a53c7 100644 --- a/app/Http/Controllers/DashboardBoDController.php +++ b/app/Http/Controllers/DashboardBoDController.php @@ -41,17 +41,17 @@ class DashboardBoDController extends Controller 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 null; + 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 diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 68f8165..3d22495 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -422,12 +422,12 @@ class ProjectController extends Controller } public function getInvoiceIntegration(Request $request) { - // $search = urlencode($request->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'); + $search = urlencode($request->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'); - $response = null; + $response = MasterFunctionsHelper::curlReq($url); // return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200); return response()->json(['status'=>'success', 'data'=> '', 'code'=>200], 200); diff --git a/app/Http/Controllers/RequestMaterialController.php b/app/Http/Controllers/RequestMaterialController.php index 35cb76d..605cf5f 100644 --- a/app/Http/Controllers/RequestMaterialController.php +++ b/app/Http/Controllers/RequestMaterialController.php @@ -170,7 +170,7 @@ class RequestMaterialController extends Controller } public function getMaterialIntegration(Request $request) { - $search = null; + $search = urlencode($request->name); if(empty($search)) return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); $url = str_replace("SEARCH", $search, config('api.adw').'/stock_master?name=SEARCH'); diff --git a/app/Http/Controllers/UserToProyekController.php b/app/Http/Controllers/UserToProyekController.php index dc944ea..fecdfec 100644 --- a/app/Http/Controllers/UserToProyekController.php +++ b/app/Http/Controllers/UserToProyekController.php @@ -185,7 +185,7 @@ class UserToProyekController extends Controller } public function getEmployeeIntegration(Request $request) { - $search = null; + $search = urlencode($request->name); if(empty($search)) return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); $url = str_replace("SEARCH", $search, config('api.adw').'/employees?emp_name=SEARCH'); From 3051a9c4c30c9a86d27a17e42ee9a34e4144cebe Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 14:11:58 +0700 Subject: [PATCH 44/62] update token integrasi --- config/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/api.php b/config/api.php index 4a6fad5..bb3c62a 100644 --- a/config/api.php +++ b/config/api.php @@ -2,6 +2,6 @@ return [ 'nominatim' => env('API_NOMINATIM', 'https://nominatim.oslogdev.com'), 'adw' => env('API_ADW', 'http://ospro-api.adyawinsa.com:9083/api'), - 'adw_token' => env('API_ADW_TOKEN', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxMjAyIiwiZXhwIjoxNjkxODMwNDkzfQ.DvBQIOZsdFndWsliPCZT65Y6G5Xx4vWBKz8Rhe7rvRA') + 'adw_token' => env('API_ADW_TOKEN', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxMjAyIiwiZXhwIjoxNzI0Mzk1NTExfQ.z9_Q7vjZbcbr8Mook4EmlOuOByNP12_DEDSabf0zanU') ]; ?> From 5e96eabedc6ef000453f826118af83ba41bd9044 Mon Sep 17 00:00:00 2001 From: ardhi Date: Fri, 25 Aug 2023 02:12:12 +0700 Subject: [PATCH 45/62] add broadcast API functionality (firebase) --- app/Http/Controllers/BroadcastController.php | 153 +++++++++++++++++++ app/Models/Broadcast.php | 2 +- app/Services/FCMService.php | 49 ++++++ bootstrap/app.php | 1 + routes/web.php | 23 ++- 5 files changed, 219 insertions(+), 9 deletions(-) create mode 100644 app/Services/FCMService.php diff --git a/app/Http/Controllers/BroadcastController.php b/app/Http/Controllers/BroadcastController.php index 7e0a8ca..5bb223e 100644 --- a/app/Http/Controllers/BroadcastController.php +++ b/app/Http/Controllers/BroadcastController.php @@ -3,7 +3,160 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; +use App\Models\Broadcast; +use App\Models\User; +use App\Services\FCMService; class BroadcastController extends Controller { + public function add(Request $request) + { + + $data = $request->all(); + $data['status_send'] = true; + $data['created_by'] = $this->currentName; + // dd($data); + $result = Broadcast::create($data); + if($result){ + $this->sendNotification($data); + return response()->json(['status'=>'success','message'=>'add broadcast successfully!','code'=>200], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'add broadcast 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); + die(); + } + + $result = Broadcast::find($id); + + if($result){ + return response()->json(['status'=>'success','code'=>200,'data'=>$result], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'failed get data broadcast, please try again later!','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 = Broadcast::find($id); + + if($data){ + $result = $data->update($request->all()); + }else{ + return response()->json(['status'=>'failed','message'=>'data broadcast not found!','code'=>400], 400); + die(); + } + + + if($result){ + return response()->json(['status'=>'success','message'=>'data broadcast successfully updated!','code'=>200], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'data broadcast failed updated!','code'=>400], 400); + } + } + + public function delete($id) + { + $data = Broadcast::find($id); + + if($data){ + $delete = $data->delete(); + }else{ + return response()->json(['status'=>'failed','message'=>'data broadcast not found!','code'=>400], 400); + die(); + } + + + if($delete){ + return response()->json(['status'=>'success','message'=>'data broadcast successfully deleted!','code'=>200], 200); + }else{ + return response()->json(['status'=>'failed','message'=>'data broadcast failed deleted!','code'=>400], 400); + } + } + + public function search(Request $request) + { + $payload = $request->all(); + $dataBuilder = $this->setUpPayload($payload, 'm_broadcast'); + $builder = $dataBuilder['builder']; + $countBuilder = $dataBuilder['count']; + $dataGet = $builder->get(); + $totalRecord = $countBuilder->count(); + return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); + } + + public function list() + { + $data = Broadcast::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 broadcast, please try again later!','code'=>400], 400); + } + } + + public function sendNotification($data) + { + // send_to_type (all, roles, user) + if (isset($data['send_to_type'])) { + switch ($data['send_to_type']) { + case 'all': + $users = User::whereNotNull('fcm_token')->get(); + if (isset($users)) { + foreach ($users as $user) { + FCMService::send( + $user->fcm_token, + [ + 'title' => $data['title_notif'], + 'body' => $data['message_notif'], + ] + ); + } + } + break; + + case 'roles': + $users = User::where("role_id", $data['send_to_id'])->whereNotNull('fcm_token')->get(); + if (isset($users)) { + foreach ($users as $user) { + FCMService::send( + $user->fcm_token, + [ + 'title' => $data['title_notif'], + 'body' => $data['message_notif'], + ] + ); + } + } + break; + + case 'user': + $user = User::where("id", $data['send_to_id'])->whereNotNull('fcm_token')->first(); + if (isset($user)) { + FCMService::send( + $user->fcm_token, + [ + 'title' => $data['title_notif'], + 'body' => $data['message_notif'], + ] + ); + } + break; + + default: + # code... + break; + } + } + } } diff --git a/app/Models/Broadcast.php b/app/Models/Broadcast.php index c2767c9..bacbdcd 100644 --- a/app/Models/Broadcast.php +++ b/app/Models/Broadcast.php @@ -12,6 +12,6 @@ class Broadcast extends Model const UPDATED_AT = 'updated_at'; protected $fillable = [ - 'title_notif', 'message_notif', 'description', 'send_to_type', 'created_at', 'created_by', 'updated_at', 'updated_by' + 'title_notif', 'message_notif', 'description', 'send_to_type', 'send_to_id', 'status_send', 'created_at', 'created_by', 'updated_at', 'updated_by' ]; } diff --git a/app/Services/FCMService.php b/app/Services/FCMService.php new file mode 100644 index 0000000..3fdf971 --- /dev/null +++ b/app/Services/FCMService.php @@ -0,0 +1,49 @@ + [$fcm_token], + "notification" => [ + "title" => $notification['title'], + "body" => $notification['body'], + ] + ]; + $encodedData = json_encode($data); + + $headers = [ + 'Authorization:key=' . $serverKey, + 'Content-Type: application/json', + ]; + + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + // Disabling SSL Certificate support temporarly + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_POSTFIELDS, $encodedData); + + $result = curl_exec($ch); + if ($result === FALSE) { + return array("success"=> false, "message"=> curl_error($ch)); + } + // Close connection + curl_close($ch); + return array("success"=> true, "message"=> $result); + } +} \ No newline at end of file diff --git a/bootstrap/app.php b/bootstrap/app.php index af68fb8..13cdeb8 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -63,6 +63,7 @@ $app->configure('auth'); $app->configure('api'); $app->configure('assets'); $app->configure('app'); +$app->configure('fcm'); /* |-------------------------------------------------------------------------- diff --git a/routes/web.php b/routes/web.php index 26b1365..2b97a41 100644 --- a/routes/web.php +++ b/routes/web.php @@ -447,16 +447,23 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout $router->put('/project-comment/update/{id}', 'ProjectCommentController@update'); $router->post('/project-comment/search', 'ProjectCommentController@search'); - $router->get('/hierarchy-ftths', 'HierarchyFtthController@index'); - $router->post('/hierarchy-ftths', 'HierarchyFtthController@store'); - $router->post('/hierarchy-ftths/search', 'HierarchyFtthController@search'); - $router->get('/hierarchy-ftths/{id}', 'HierarchyFtthController@show'); - $router->put('/hierarchy-ftths/{id}', 'HierarchyFtthController@update'); - $router->delete('/hierarchy-ftths/{id}', 'HierarchyFtthController@destroy'); - $router->get('/hierarchy-ftths/tree/{project_id}', 'HierarchyFtthController@getTreeByProject'); - $router->get('/hierarchy-ftths/tree-gantt/{gantt_id}', 'HierarchyFtthController@getTreeByGantt'); + $router->get('/hierarchy-ftths', 'HierarchyFtthController@index'); + $router->post('/hierarchy-ftths', 'HierarchyFtthController@store'); + $router->post('/hierarchy-ftths/search', 'HierarchyFtthController@search'); + $router->get('/hierarchy-ftths/{id}', 'HierarchyFtthController@show'); + $router->put('/hierarchy-ftths/{id}', 'HierarchyFtthController@update'); + $router->delete('/hierarchy-ftths/{id}', 'HierarchyFtthController@destroy'); + $router->get('/hierarchy-ftths/tree/{project_id}', 'HierarchyFtthController@getTreeByProject'); + $router->get('/hierarchy-ftths/tree-gantt/{gantt_id}', 'HierarchyFtthController@getTreeByGantt'); $router->post('/map-monitoring/search', 'MapMonitoringController@search'); + + $router->post('/broadcast/add', 'BroadcastController@add'); + $router->get('/broadcast/edit/{id}', 'BroadcastController@edit'); + $router->put('/broadcast/update/{id}', 'BroadcastController@update'); + $router->post('/broadcast/search', 'BroadcastController@search'); + $router->delete('/broadcast/delete/{id}', 'BroadcastController@delete'); + $router->get('/broadcast/list', 'BroadcastController@list'); }); }); From 3188eba18dbc017f700a4db1aa7ae0512b049e9f Mon Sep 17 00:00:00 2001 From: ardhi Date: Fri, 25 Aug 2023 02:12:26 +0700 Subject: [PATCH 46/62] add broadcast API functionality (firebase) --- config/fcm.php | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 config/fcm.php diff --git a/config/fcm.php b/config/fcm.php new file mode 100644 index 0000000..5c60ec9 --- /dev/null +++ b/config/fcm.php @@ -0,0 +1,5 @@ + "AAAAin2zZmc:APA91bHFIYDzZGyVyXvt2C8I09wC2k8siWPQIo4b1Db0QjxCzQR5SRQU9KY1iNRIUhTL6OoLUs2x6UAiP1BNv-mwOlSR7C_405msoNL2p33JVBxrtqc7hdMc5TEdTBB4ZGRVH7ltQzSe", +]; \ No newline at end of file From 2aed8364ab732760e4ca13c96b82e6d0ea4b1a12 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 25 Aug 2023 11:19:36 +0700 Subject: [PATCH 47/62] Fix getactivity first and last --- app/Http/Controllers/ActivityController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 401837e..3b8ff84 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -151,7 +151,10 @@ class ActivityController extends Controller } public function getActivityFirst($parentId){ - $activity = Activity::where('parent_id', $parentId)->orderByRaw('start_date ASC')->first(); + $activity = Activity::where('parent_id', $parentId)->orderByRaw('actual_start ASC')->first(); + if (!isset($activity)) { + return null; + } if($activity->type_activity == "task"){ // Log::info("activity ", [$activity]); return $activity->actual_start; @@ -162,7 +165,10 @@ class ActivityController extends Controller } public function getActivityLast($parentId){ - $activity = Activity::where('parent_id', $parentId)->orderByRaw('start_date DESC')->first(); + $activity = Activity::where('parent_id', $parentId)->orderByRaw('actual_end DESC')->first(); + if (!isset($activity)) { + return null; + } if($activity->type_activity == "task"){ // Log::info("activity ", [$activity]); return $activity->actual_end; From ff08801cad71e71924b6d1acb51773bd03a75a04 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 25 Aug 2023 11:23:13 +0700 Subject: [PATCH 48/62] quick fix --- app/Http/Controllers/ActivityController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 3b8ff84..99f3614 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -165,7 +165,7 @@ class ActivityController extends Controller } public function getActivityLast($parentId){ - $activity = Activity::where('parent_id', $parentId)->orderByRaw('actual_end DESC')->first(); + $activity = Activity::where('parent_id', $parentId)->orderByRaw('actual_start DESC')->first(); if (!isset($activity)) { return null; } From fda161cc4c7c698f85b578d619c69db96de5528b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 25 Aug 2023 15:13:40 +0700 Subject: [PATCH 49/62] quick fix --- app/Http/Controllers/ActivityController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 99f3614..3b8ff84 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -165,7 +165,7 @@ class ActivityController extends Controller } public function getActivityLast($parentId){ - $activity = Activity::where('parent_id', $parentId)->orderByRaw('actual_start DESC')->first(); + $activity = Activity::where('parent_id', $parentId)->orderByRaw('actual_end DESC')->first(); if (!isset($activity)) { return null; } From 02d10a4a8bdf2d568527db2999de17e6704cc07a Mon Sep 17 00:00:00 2001 From: ibnu Date: Sun, 27 Aug 2023 15:50:08 +0700 Subject: [PATCH 50/62] update auto_scheduling is false every actual_start is not null --- app/Http/Controllers/ActivityController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 3b8ff84..0cc4563 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -136,6 +136,9 @@ class ActivityController extends Controller $objRow->type = "task"; $objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL; $objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL; + if(isset($objRow->actual_start)){ + $objRow->auto_scheduling = false; + } } else { $objRow->type = "project"; $actualStart = $this->getActivityFirst($objRow->id); From c60fc81b1005848db31411d06d18fd29087e1b0d Mon Sep 17 00:00:00 2001 From: ardhi Date: Mon, 28 Aug 2023 11:16:18 +0700 Subject: [PATCH 51/62] fix clock_in time in map monitoring --- app/Http/Controllers/MapMonitoringController.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/MapMonitoringController.php b/app/Http/Controllers/MapMonitoringController.php index 3fdcef4..cd68d20 100644 --- a/app/Http/Controllers/MapMonitoringController.php +++ b/app/Http/Controllers/MapMonitoringController.php @@ -37,15 +37,11 @@ class MapMonitoringController extends Controller 'tcio.clock_in_lng', 'tcio.clock_in_loc', 'tcio.clock_out_loc', - 'tcio.date_presence', - 'mw.lat', - 'mw.lon', - 'mw.wptime' + 'tcio.date_presence' ) ->join('m_users as mu', 'mu.id', '=', 'tcio.user_id') - ->join('m_waypoint as mw', 'mu.id', '=', 'mw.user_id') ->where('mu.id', $key->user_id) - ->orderBy('mw.wptime', 'DESC') + ->orderBy('tcio.clock_in', 'DESC') ->first(); $project = DB::table('assign_hr_to_proyek as ahtp') ->select('ahtp.proyek_id as id', 'mp.nama as project_name') @@ -55,11 +51,12 @@ class MapMonitoringController extends Controller ->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(); + $waypoint = DB::table('m_waypoint')->select('lat', 'lon', 'wptime')->where('user_id', $presensi->user_id)->orderBy('wptime', 'DESC')->first(); $tmp[] = array( 'user_id' => $presensi->user_id, - 'wp_lat' => $presensi->lat, - 'wp_lon' => $presensi->lon, - 'wp_time' => $presensi->wptime, + 'wp_lat' => isset($waypoint) ? $waypoint->lat : '-', + 'wp_lon' => isset($waypoint) ? $waypoint->lon : '-', + 'wp_time' => isset($waypoint) ? $waypoint->wptime : '-', 'clock_in' => $presensi->clock_in, 'clock_out' => $presensi->clock_out, 'clock_in_lat' => $presensi->clock_in_lat, From 472d63240f0ed054fdfd74e114fef409265c932e Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 28 Aug 2023 11:46:40 +0700 Subject: [PATCH 52/62] display schedule & bcwp fix --- app/Helpers/MasterFunctionsHelper.php | 4 ++++ app/Http/Controllers/ProjectController.php | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index eb70448..6d75174 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -427,6 +427,8 @@ class MasterFunctionsHelper $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN"; } + $lastReal = $tempPercentageReal[count($tempPercentageReal) - 1]; + $totalBCWP = $lastReal * $totalBCWP; $dataResponse = array( "date" => $tempDate, "percentage" => $tempPercentage, @@ -720,6 +722,8 @@ class MasterFunctionsHelper $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN"; } + $lastReal = $tempPercentageReal[count($tempPercentageReal) - 1]; + $totalBCWP = $lastReal * $totalBCWP; $dataResponse = array( "date" => $tempDate, "percentage" => $tempPercentage, diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 3d22495..ffbe3fa 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -445,6 +445,18 @@ class ProjectController extends Controller $gantt = MasterFunctionsHelper::getLatestGantt($id); $result->projectManager = User::where('id', $result->pm_id)->value('name'); $result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->where("version_gantt_id", $gantt['last_gantt_id'])->first(); + // dd($result->header->start_date); + $ganttId = $gantt['last_gantt_id']; + + $startDate = Activity::where('version_gantt_id', $ganttId) + ->orderBy('start_date') + ->value('start_date'); + + $endDate = Activity::where('version_gantt_id', $ganttId) + ->orderByDesc('end_date') + ->value('end_date'); + $result->header->start_date = $startDate; + $result->header->end_date = $endDate; return response()->json(['status'=>'success','code'=> 200,'data'=>$result, 'gantt'=>$gantt], 200); } From 6ce61143e711f672226cb4650aef0847220a18ba Mon Sep 17 00:00:00 2001 From: ibnu Date: Mon, 28 Aug 2023 11:56:34 +0700 Subject: [PATCH 53/62] update set timeout 5 minutes --- Dockerfile | 3 + docker/nginx/conf.d/default.conf | 9 + docker/php/php.ini | 1947 ++++++++++++++++++++++++++++++ 3 files changed, 1959 insertions(+) create mode 100644 docker/php/php.ini diff --git a/Dockerfile b/Dockerfile index 4edd5c1..f9925d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,9 @@ RUN docker-php-ext-install \ pgsql \ tokenizer +# Copy php.ini to the container +COPY /docker/php/php.ini /usr/local/etc/php/ + #Install Extensions RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf index e3e292a..f311b54 100644 --- a/docker/nginx/conf.d/default.conf +++ b/docker/nginx/conf.d/default.conf @@ -15,6 +15,15 @@ server { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; + + client_max_body_size 100M; + client_body_buffer_size 5M; + fastcgi_read_timeout 900; + keepalive_timeout 900; + send_timeout 300; + proxy_read_timeout 900; + proxy_connect_timeout 900; + proxy_send_timeout 900; } location / { diff --git a/docker/php/php.ini b/docker/php/php.ini new file mode 100644 index 0000000..efc483f --- /dev/null +++ b/docker/php/php.ini @@ -0,0 +1,1947 @@ +[PHP] + +;;;;;;;;;;;;;;;;;;; +; About php.ini ; +;;;;;;;;;;;;;;;;;;; +; PHP's initialization file, generally called php.ini, is responsible for +; configuring many of the aspects of PHP's behavior. + +; PHP attempts to find and load this configuration from a number of locations. +; The following is a summary of its search order: +; 1. SAPI module specific location. +; 2. The PHPRC environment variable. (As of PHP 5.2.0) +; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) +; 4. Current working directory (except CLI) +; 5. The web server's directory (for SAPI modules), or directory of PHP +; (otherwise in Windows) +; 6. The directory from the --with-config-file-path compile time option, or the +; Windows directory (usually C:\windows) +; See the PHP docs for more specific information. +; http://php.net/configuration.file + +; The syntax of the file is extremely simple. Whitespace and lines +; beginning with a semicolon are silently ignored (as you probably guessed). +; Section headers (e.g. [Foo]) are also silently ignored, even though +; they might mean something in the future. + +; Directives following the section heading [PATH=/www/mysite] only +; apply to PHP files in the /www/mysite directory. Directives +; following the section heading [HOST=www.example.com] only apply to +; PHP files served from www.example.com. Directives set in these +; special sections cannot be overridden by user-defined INI files or +; at runtime. Currently, [PATH=] and [HOST=] sections only work under +; CGI/FastCGI. +; http://php.net/ini.sections + +; Directives are specified using the following syntax: +; directive = value +; Directive names are *case sensitive* - foo=bar is different from FOO=bar. +; Directives are variables used to configure PHP or PHP extensions. +; There is no name validation. If PHP can't find an expected +; directive because it is not set or is mistyped, a default value will be used. + +; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one +; of the INI constants (On, Off, True, False, Yes, No and None) or an expression +; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a +; previously set variable or directive (e.g. ${foo}) + +; Expressions in the INI file are limited to bitwise operators and parentheses: +; | bitwise OR +; ^ bitwise XOR +; & bitwise AND +; ~ bitwise NOT +; ! boolean NOT + +; Boolean flags can be turned on using the values 1, On, True or Yes. +; They can be turned off using the values 0, Off, False or No. + +; An empty string can be denoted by simply not writing anything after the equal +; sign, or by using the None keyword: + +; foo = ; sets foo to an empty string +; foo = None ; sets foo to an empty string +; foo = "None" ; sets foo to the string 'None' + +; If you use constants in your value, and these constants belong to a +; dynamically loaded extension (either a PHP extension or a Zend extension), +; you may only use these constants *after* the line that loads the extension. + +;;;;;;;;;;;;;;;;;;; +; About this file ; +;;;;;;;;;;;;;;;;;;; +; PHP comes packaged with two INI files. One that is recommended to be used +; in production environments and one that is recommended to be used in +; development environments. + +; php.ini-production contains settings which hold security, performance and +; best practices at its core. But please be aware, these settings may break +; compatibility with older or less security conscience applications. We +; recommending using the production ini in production and testing environments. + +; php.ini-development is very similar to its production variant, except it is +; much more verbose when it comes to errors. We recommend using the +; development version only in development environments, as errors shown to +; application users can inadvertently leak otherwise secure information. + +; This is the php.ini-production INI file. + +;;;;;;;;;;;;;;;;;;; +; Quick Reference ; +;;;;;;;;;;;;;;;;;;; +; The following are all the settings which are different in either the production +; or development versions of the INIs with respect to PHP's default behavior. +; Please see the actual settings later in the document for more details as to why +; we recommend these changes in PHP's behavior. + +; display_errors +; Default Value: On +; Development Value: On +; Production Value: Off + +; display_startup_errors +; Default Value: Off +; Development Value: On +; Production Value: Off + +; error_reporting +; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED +; Development Value: E_ALL +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT + +; log_errors +; Default Value: Off +; Development Value: On +; Production Value: On + +; max_input_time +; Default Value: -1 (Unlimited) +; Development Value: 60 (60 seconds) +; Production Value: 60 (60 seconds) + +; output_buffering +; Default Value: Off +; Development Value: 4096 +; Production Value: 4096 + +; register_argc_argv +; Default Value: On +; Development Value: Off +; Production Value: Off + +; request_order +; Default Value: None +; Development Value: "GP" +; Production Value: "GP" + +; session.gc_divisor +; Default Value: 100 +; Development Value: 1000 +; Production Value: 1000 + +; session.sid_bits_per_character +; Default Value: 4 +; Development Value: 5 +; Production Value: 5 + +; short_open_tag +; Default Value: On +; Development Value: Off +; Production Value: Off + +; variables_order +; Default Value: "EGPCS" +; Development Value: "GPCS" +; Production Value: "GPCS" + +;;;;;;;;;;;;;;;;;;;; +; php.ini Options ; +;;;;;;;;;;;;;;;;;;;; +; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" +;user_ini.filename = ".user.ini" + +; To disable this feature set this option to an empty value +;user_ini.filename = + +; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) +;user_ini.cache_ttl = 300 + +;;;;;;;;;;;;;;;;;;;; +; Language Options ; +;;;;;;;;;;;;;;;;;;;; + +; Enable the PHP scripting language engine under Apache. +; http://php.net/engine +engine = On + +; This directive determines whether or not PHP will recognize code between +; tags as PHP source which should be processed as such. It is +; generally recommended that should be used and that this feature +; should be disabled, as enabling it may result in issues when generating XML +; documents, however this remains supported for backward compatibility reasons. +; Note that this directive does not control the would work. +; http://php.net/syntax-highlighting +;highlight.string = #DD0000 +;highlight.comment = #FF9900 +;highlight.keyword = #007700 +;highlight.default = #0000BB +;highlight.html = #000000 + +; If enabled, the request will be allowed to complete even if the user aborts +; the request. Consider enabling it if executing long requests, which may end up +; being interrupted by the user or a browser timing out. PHP's default behavior +; is to disable this feature. +; http://php.net/ignore-user-abort +;ignore_user_abort = On + +; Determines the size of the realpath cache to be used by PHP. This value should +; be increased on systems where PHP opens many files to reflect the quantity of +; the file operations performed. +; Note: if open_basedir is set, the cache is disabled +; http://php.net/realpath-cache-size +;realpath_cache_size = 4096k + +; Duration of time, in seconds for which to cache realpath information for a given +; file or directory. For systems with rarely changing files, consider increasing this +; value. +; http://php.net/realpath-cache-ttl +;realpath_cache_ttl = 120 + +; Enables or disables the circular reference collector. +; http://php.net/zend.enable-gc +zend.enable_gc = On + +; If enabled, scripts may be written in encodings that are incompatible with +; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such +; encodings. To use this feature, mbstring extension must be enabled. +; Default: Off +;zend.multibyte = Off + +; Allows to set the default encoding for the scripts. This value will be used +; unless "declare(encoding=...)" directive appears at the top of the script. +; Only affects if zend.multibyte is set. +; Default: "" +;zend.script_encoding = + +; Allows to include or exclude arguments from stack traces generated for exceptions. +; In production, it is recommended to turn this setting on to prohibit the output +; of sensitive information in stack traces +; Default: Off +zend.exception_ignore_args = On + +;;;;;;;;;;;;;;;;; +; Miscellaneous ; +;;;;;;;;;;;;;;;;; + +; Decides whether PHP may expose the fact that it is installed on the server +; (e.g. by adding its signature to the Web server header). It is no security +; threat in any way, but it makes it possible to determine whether you use PHP +; on your server or not. +; http://php.net/expose-php +expose_php = On + +;;;;;;;;;;;;;;;;;;; +; Resource Limits ; +;;;;;;;;;;;;;;;;;;; + +; Maximum execution time of each script, in seconds +; http://php.net/max-execution-time +; Note: This directive is hardcoded to 0 for the CLI SAPI +max_execution_time = 300 + +; Maximum amount of time each script may spend parsing request data. It's a good +; idea to limit this time on productions servers in order to eliminate unexpectedly +; long running scripts. +; Note: This directive is hardcoded to -1 for the CLI SAPI +; Default Value: -1 (Unlimited) +; Development Value: 60 (60 seconds) +; Production Value: 60 (60 seconds) +; http://php.net/max-input-time +max_input_time = 300 + +; Maximum input variable nesting level +; http://php.net/max-input-nesting-level +;max_input_nesting_level = 64 + +; How many GET/POST/COOKIE input variables may be accepted +;max_input_vars = 1000 + +; Maximum amount of memory a script may consume +; http://php.net/memory-limit +memory_limit = 128M + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Error handling and logging ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; This directive informs PHP of which errors, warnings and notices you would like +; it to take action for. The recommended way of setting values for this +; directive is through the use of the error level constants and bitwise +; operators. The error level constants are below here for convenience as well as +; some common settings and their meanings. +; By default, PHP is set to take action on all errors, notices and warnings EXCEPT +; those related to E_NOTICE and E_STRICT, which together cover best practices and +; recommended coding standards in PHP. For performance reasons, this is the +; recommend error reporting setting. Your production server shouldn't be wasting +; resources complaining about best practices and coding standards. That's what +; development servers and development settings are for. +; Note: The php.ini-development file has this setting as E_ALL. This +; means it pretty much reports everything which is exactly what you want during +; development and early testing. +; +; Error Level Constants: +; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0) +; E_ERROR - fatal run-time errors +; E_RECOVERABLE_ERROR - almost fatal run-time errors +; E_WARNING - run-time warnings (non-fatal errors) +; E_PARSE - compile-time parse errors +; E_NOTICE - run-time notices (these are warnings which often result +; from a bug in your code, but it's possible that it was +; intentional (e.g., using an uninitialized variable and +; relying on the fact it is automatically initialized to an +; empty string) +; E_STRICT - run-time notices, enable to have PHP suggest changes +; to your code which will ensure the best interoperability +; and forward compatibility of your code +; E_CORE_ERROR - fatal errors that occur during PHP's initial startup +; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's +; initial startup +; E_COMPILE_ERROR - fatal compile-time errors +; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) +; E_USER_ERROR - user-generated error message +; E_USER_WARNING - user-generated warning message +; E_USER_NOTICE - user-generated notice message +; E_DEPRECATED - warn about code that will not work in future versions +; of PHP +; E_USER_DEPRECATED - user-generated deprecation warnings +; +; Common Values: +; E_ALL (Show all errors, warnings and notices including coding standards.) +; E_ALL & ~E_NOTICE (Show all errors, except for notices) +; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) +; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) +; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED +; Development Value: E_ALL +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT +; http://php.net/error-reporting +error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT + +; This directive controls whether or not and where PHP will output errors, +; notices and warnings too. Error output is very useful during development, but +; it could be very dangerous in production environments. Depending on the code +; which is triggering the error, sensitive information could potentially leak +; out of your application such as database usernames and passwords or worse. +; For production environments, we recommend logging errors rather than +; sending them to STDOUT. +; Possible Values: +; Off = Do not display any errors +; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) +; On or stdout = Display errors to STDOUT +; Default Value: On +; Development Value: On +; Production Value: Off +; http://php.net/display-errors +display_errors = Off + +; The display of errors which occur during PHP's startup sequence are handled +; separately from display_errors. PHP's default behavior is to suppress those +; errors from clients. Turning the display of startup errors on can be useful in +; debugging configuration problems. We strongly recommend you +; set this to 'off' for production servers. +; Default Value: Off +; Development Value: On +; Production Value: Off +; http://php.net/display-startup-errors +display_startup_errors = Off + +; Besides displaying errors, PHP can also log errors to locations such as a +; server-specific log, STDERR, or a location specified by the error_log +; directive found below. While errors should not be displayed on productions +; servers they should still be monitored and logging is a great way to do that. +; Default Value: Off +; Development Value: On +; Production Value: On +; http://php.net/log-errors +log_errors = On + +; Set maximum length of log_errors. In error_log information about the source is +; added. The default is 1024 and 0 allows to not apply any maximum length at all. +; http://php.net/log-errors-max-len +log_errors_max_len = 1024 + +; Do not log repeated messages. Repeated errors must occur in same file on same +; line unless ignore_repeated_source is set true. +; http://php.net/ignore-repeated-errors +ignore_repeated_errors = Off + +; Ignore source of message when ignoring repeated messages. When this setting +; is On you will not log errors with repeated messages from different files or +; source lines. +; http://php.net/ignore-repeated-source +ignore_repeated_source = Off + +; If this parameter is set to Off, then memory leaks will not be shown (on +; stdout or in the log). This is only effective in a debug compile, and if +; error reporting includes E_WARNING in the allowed list +; http://php.net/report-memleaks +report_memleaks = On + +; This setting is on by default. +;report_zend_debug = 0 + +; Store the last error/warning message in $php_errormsg (boolean). Setting this value +; to On can assist in debugging and is appropriate for development servers. It should +; however be disabled on production servers. +; This directive is DEPRECATED. +; Default Value: Off +; Development Value: Off +; Production Value: Off +; http://php.net/track-errors +;track_errors = Off + +; Turn off normal error reporting and emit XML-RPC error XML +; http://php.net/xmlrpc-errors +;xmlrpc_errors = 0 + +; An XML-RPC faultCode +;xmlrpc_error_number = 0 + +; When PHP displays or logs an error, it has the capability of formatting the +; error message as HTML for easier reading. This directive controls whether +; the error message is formatted as HTML or not. +; Note: This directive is hardcoded to Off for the CLI SAPI +; http://php.net/html-errors +;html_errors = On + +; If html_errors is set to On *and* docref_root is not empty, then PHP +; produces clickable error messages that direct to a page describing the error +; or function causing the error in detail. +; You can download a copy of the PHP manual from http://php.net/docs +; and change docref_root to the base URL of your local copy including the +; leading '/'. You must also specify the file extension being used including +; the dot. PHP's default behavior is to leave these settings empty, in which +; case no links to documentation are generated. +; Note: Never use this feature for production boxes. +; http://php.net/docref-root +; Examples +;docref_root = "/phpmanual/" + +; http://php.net/docref-ext +;docref_ext = .html + +; String to output before an error message. PHP's default behavior is to leave +; this setting blank. +; http://php.net/error-prepend-string +; Example: +;error_prepend_string = "" + +; String to output after an error message. PHP's default behavior is to leave +; this setting blank. +; http://php.net/error-append-string +; Example: +;error_append_string = "" + +; Log errors to specified file. PHP's default behavior is to leave this value +; empty. +; http://php.net/error-log +; Example: +;error_log = php_errors.log +; Log errors to syslog (Event Log on Windows). +;error_log = syslog + +; The syslog ident is a string which is prepended to every message logged +; to syslog. Only used when error_log is set to syslog. +;syslog.ident = php + +; The syslog facility is used to specify what type of program is logging +; the message. Only used when error_log is set to syslog. +;syslog.facility = user + +; Set this to disable filtering control characters (the default). +; Some loggers only accept NVT-ASCII, others accept anything that's not +; control characters. If your logger accepts everything, then no filtering +; is needed at all. +; Allowed values are: +; ascii (all printable ASCII characters and NL) +; no-ctrl (all characters except control characters) +; all (all characters) +; raw (like "all", but messages are not split at newlines) +; http://php.net/syslog.filter +;syslog.filter = ascii + +;windows.show_crt_warning +; Default value: 0 +; Development value: 0 +; Production value: 0 + +;;;;;;;;;;;;;;;;; +; Data Handling ; +;;;;;;;;;;;;;;;;; + +; The separator used in PHP generated URLs to separate arguments. +; PHP's default setting is "&". +; http://php.net/arg-separator.output +; Example: +;arg_separator.output = "&" + +; List of separator(s) used by PHP to parse input URLs into variables. +; PHP's default setting is "&". +; NOTE: Every character in this directive is considered as separator! +; http://php.net/arg-separator.input +; Example: +;arg_separator.input = ";&" + +; This directive determines which super global arrays are registered when PHP +; starts up. G,P,C,E & S are abbreviations for the following respective super +; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty +; paid for the registration of these arrays and because ENV is not as commonly +; used as the others, ENV is not recommended on productions servers. You +; can still get access to the environment variables through getenv() should you +; need to. +; Default Value: "EGPCS" +; Development Value: "GPCS" +; Production Value: "GPCS"; +; http://php.net/variables-order +variables_order = "GPCS" + +; This directive determines which super global data (G,P & C) should be +; registered into the super global array REQUEST. If so, it also determines +; the order in which that data is registered. The values for this directive +; are specified in the same manner as the variables_order directive, +; EXCEPT one. Leaving this value empty will cause PHP to use the value set +; in the variables_order directive. It does not mean it will leave the super +; globals array REQUEST empty. +; Default Value: None +; Development Value: "GP" +; Production Value: "GP" +; http://php.net/request-order +request_order = "GP" + +; This directive determines whether PHP registers $argv & $argc each time it +; runs. $argv contains an array of all the arguments passed to PHP when a script +; is invoked. $argc contains an integer representing the number of arguments +; that were passed when the script was invoked. These arrays are extremely +; useful when running scripts from the command line. When this directive is +; enabled, registering these variables consumes CPU cycles and memory each time +; a script is executed. For performance reasons, this feature should be disabled +; on production servers. +; Note: This directive is hardcoded to On for the CLI SAPI +; Default Value: On +; Development Value: Off +; Production Value: Off +; http://php.net/register-argc-argv +register_argc_argv = Off + +; When enabled, the ENV, REQUEST and SERVER variables are created when they're +; first used (Just In Time) instead of when the script starts. If these +; variables are not used within a script, having this directive on will result +; in a performance gain. The PHP directive register_argc_argv must be disabled +; for this directive to have any effect. +; http://php.net/auto-globals-jit +auto_globals_jit = On + +; Whether PHP will read the POST data. +; This option is enabled by default. +; Most likely, you won't want to disable this option globally. It causes $_POST +; and $_FILES to always be empty; the only way you will be able to read the +; POST data will be through the php://input stream wrapper. This can be useful +; to proxy requests or to process the POST data in a memory efficient fashion. +; http://php.net/enable-post-data-reading +;enable_post_data_reading = Off + +; Maximum size of POST data that PHP will accept. +; Its value may be 0 to disable the limit. It is ignored if POST data reading +; is disabled through enable_post_data_reading. +; http://php.net/post-max-size +post_max_size = 80M + +; Automatically add files before PHP document. +; http://php.net/auto-prepend-file +auto_prepend_file = + +; Automatically add files after PHP document. +; http://php.net/auto-append-file +auto_append_file = + +; By default, PHP will output a media type using the Content-Type header. To +; disable this, simply set it to be empty. +; +; PHP's built-in default media type is set to text/html. +; http://php.net/default-mimetype +default_mimetype = "text/html" + +; PHP's default character set is set to UTF-8. +; http://php.net/default-charset +default_charset = "UTF-8" + +; PHP internal character encoding is set to empty. +; If empty, default_charset is used. +; http://php.net/internal-encoding +;internal_encoding = + +; PHP input character encoding is set to empty. +; If empty, default_charset is used. +; http://php.net/input-encoding +;input_encoding = + +; PHP output character encoding is set to empty. +; If empty, default_charset is used. +; See also output_buffer. +; http://php.net/output-encoding +;output_encoding = + +;;;;;;;;;;;;;;;;;;;;;;;;; +; Paths and Directories ; +;;;;;;;;;;;;;;;;;;;;;;;;; + +; UNIX: "/path1:/path2" +;include_path = ".:/php/includes" +; +; Windows: "\path1;\path2" +;include_path = ".;c:\php\includes" +; +; PHP's default setting for include_path is ".;/path/to/php/pear" +; http://php.net/include-path + +; The root of the PHP pages, used only if nonempty. +; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root +; if you are running php as a CGI under any web server (other than IIS) +; see documentation for security issues. The alternate is to use the +; cgi.force_redirect configuration below +; http://php.net/doc-root +doc_root = + +; The directory under which PHP opens the script using /~username used only +; if nonempty. +; http://php.net/user-dir +user_dir = + +; Directory in which the loadable extensions (modules) reside. +; http://php.net/extension-dir +;extension_dir = "./" +; On windows: +;extension_dir = "ext" + +; Directory where the temporary files should be placed. +; Defaults to the system default (see sys_get_temp_dir) +;sys_temp_dir = "/tmp" + +; Whether or not to enable the dl() function. The dl() function does NOT work +; properly in multithreaded servers, such as IIS or Zeus, and is automatically +; disabled on them. +; http://php.net/enable-dl +enable_dl = Off + +; cgi.force_redirect is necessary to provide security running PHP as a CGI under +; most web servers. Left undefined, PHP turns this on by default. You can +; turn it off here AT YOUR OWN RISK +; **You CAN safely turn this off for IIS, in fact, you MUST.** +; http://php.net/cgi.force-redirect +;cgi.force_redirect = 1 + +; if cgi.nph is enabled it will force cgi to always sent Status: 200 with +; every request. PHP's default behavior is to disable this feature. +;cgi.nph = 1 + +; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape +; (iPlanet) web servers, you MAY need to set an environment variable name that PHP +; will look for to know it is OK to continue execution. Setting this variable MAY +; cause security issues, KNOW WHAT YOU ARE DOING FIRST. +; http://php.net/cgi.redirect-status-env +;cgi.redirect_status_env = + +; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's +; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok +; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting +; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting +; of zero causes PHP to behave as before. Default is 1. You should fix your scripts +; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. +; http://php.net/cgi.fix-pathinfo +;cgi.fix_pathinfo=1 + +; if cgi.discard_path is enabled, the PHP CGI binary can safely be placed outside +; of the web tree and people will not be able to circumvent .htaccess security. +;cgi.discard_path=1 + +; FastCGI under IIS supports the ability to impersonate +; security tokens of the calling client. This allows IIS to define the +; security context that the request runs under. mod_fastcgi under Apache +; does not currently support this feature (03/17/2002) +; Set to 1 if running under IIS. Default is zero. +; http://php.net/fastcgi.impersonate +;fastcgi.impersonate = 1 + +; Disable logging through FastCGI connection. PHP's default behavior is to enable +; this feature. +;fastcgi.logging = 0 + +; cgi.rfc2616_headers configuration option tells PHP what type of headers to +; use when sending HTTP response code. If set to 0, PHP sends Status: header that +; is supported by Apache. When this option is set to 1, PHP will send +; RFC2616 compliant header. +; Default is zero. +; http://php.net/cgi.rfc2616-headers +;cgi.rfc2616_headers = 0 + +; cgi.check_shebang_line controls whether CGI PHP checks for line starting with #! +; (shebang) at the top of the running script. This line might be needed if the +; script support running both as stand-alone script and via PHP CGI<. PHP in CGI +; mode skips this line and ignores its content if this directive is turned on. +; http://php.net/cgi.check-shebang-line +;cgi.check_shebang_line=1 + +;;;;;;;;;;;;;;;; +; File Uploads ; +;;;;;;;;;;;;;;;; + +; Whether to allow HTTP file uploads. +; http://php.net/file-uploads +file_uploads = On + +; Temporary directory for HTTP uploaded files (will use system default if not +; specified). +; http://php.net/upload-tmp-dir +;upload_tmp_dir = + +; Maximum allowed size for uploaded files. +; http://php.net/upload-max-filesize +upload_max_filesize = 20M + +; Maximum number of files that can be uploaded via a single request +max_file_uploads = 20 + +;;;;;;;;;;;;;;;;;; +; Fopen wrappers ; +;;;;;;;;;;;;;;;;;; + +; Whether to allow the treatment of URLs (like http:// or ftp://) as files. +; http://php.net/allow-url-fopen +allow_url_fopen = On + +; Whether to allow include/require to open URLs (like http:// or ftp://) as files. +; http://php.net/allow-url-include +allow_url_include = Off + +; Define the anonymous ftp password (your email address). PHP's default setting +; for this is empty. +; http://php.net/from +;from="john@doe.com" + +; Define the User-Agent string. PHP's default setting for this is empty. +; http://php.net/user-agent +;user_agent="PHP" + +; Default timeout for socket based streams (seconds) +; http://php.net/default-socket-timeout +default_socket_timeout = 600 + +; If your scripts have to deal with files from Macintosh systems, +; or you are running on a Mac and need to deal with files from +; unix or win32 systems, setting this flag will cause PHP to +; automatically detect the EOL character in those files so that +; fgets() and file() will work regardless of the source of the file. +; http://php.net/auto-detect-line-endings +;auto_detect_line_endings = Off + +;;;;;;;;;;;;;;;;;;;;;; +; Dynamic Extensions ; +;;;;;;;;;;;;;;;;;;;;;; + +; If you wish to have an extension loaded automatically, use the following +; syntax: +; +; extension=modulename +; +; For example: +; +; extension=mysqli +; +; When the extension library to load is not located in the default extension +; directory, You may specify an absolute path to the library file: +; +; extension=/path/to/extension/mysqli.so +; +; Note : The syntax used in previous PHP versions ('extension=.so' and +; 'extension='php_.dll') is supported for legacy reasons and may be +; deprecated in a future PHP major version. So, when it is possible, please +; move to the new ('extension=) syntax. +; +; Notes for Windows environments : +; +; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+) +; extension folders as well as the separate PECL DLL download (PHP 5+). +; Be sure to appropriately set the extension_dir directive. +; +;extension=bz2 +;extension=curl +;extension=ffi +;extension=ftp +;extension=fileinfo +;extension=gd2 +;extension=gettext +;extension=gmp +;extension=intl +;extension=imap +;extension=ldap +;extension=mbstring +;extension=exif ; Must be after mbstring as it depends on it +;extension=mysqli +;extension=oci8_12c ; Use with Oracle Database 12c Instant Client +;extension=odbc +;extension=openssl +;extension=pdo_firebird +;extension=pdo_mysql +;extension=pdo_oci +;extension=pdo_odbc +;extension=pdo_pgsql +;extension=pdo_sqlite +;extension=pgsql +;extension=shmop + +; The MIBS data available in the PHP distribution must be installed. +; See http://www.php.net/manual/en/snmp.installation.php +;extension=snmp + +;extension=soap +;extension=sockets +;extension=sodium +;extension=sqlite3 +;extension=tidy +;extension=xmlrpc +;extension=xsl + +;;;;;;;;;;;;;;;;;;; +; Module Settings ; +;;;;;;;;;;;;;;;;;;; + +[CLI Server] +; Whether the CLI web server uses ANSI color coding in its terminal output. +cli_server.color = On + +[Date] +; Defines the default timezone used by the date functions +; http://php.net/date.timezone +;date.timezone = + +; http://php.net/date.default-latitude +;date.default_latitude = 31.7667 + +; http://php.net/date.default-longitude +;date.default_longitude = 35.2333 + +; http://php.net/date.sunrise-zenith +;date.sunrise_zenith = 90.583333 + +; http://php.net/date.sunset-zenith +;date.sunset_zenith = 90.583333 + +[filter] +; http://php.net/filter.default +;filter.default = unsafe_raw + +; http://php.net/filter.default-flags +;filter.default_flags = + +[iconv] +; Use of this INI entry is deprecated, use global input_encoding instead. +; If empty, default_charset or input_encoding or iconv.input_encoding is used. +; The precedence is: default_charset < input_encoding < iconv.input_encoding +;iconv.input_encoding = + +; Use of this INI entry is deprecated, use global internal_encoding instead. +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding +;iconv.internal_encoding = + +; Use of this INI entry is deprecated, use global output_encoding instead. +; If empty, default_charset or output_encoding or iconv.output_encoding is used. +; The precedence is: default_charset < output_encoding < iconv.output_encoding +; To use an output encoding conversion, iconv's output handler must be set +; otherwise output encoding conversion cannot be performed. +;iconv.output_encoding = + +[imap] +; rsh/ssh logins are disabled by default. Use this INI entry if you want to +; enable them. Note that the IMAP library does not filter mailbox names before +; passing them to rsh/ssh command, thus passing untrusted data to this function +; with rsh/ssh enabled is insecure. +;imap.enable_insecure_rsh=0 + +[intl] +;intl.default_locale = +; This directive allows you to produce PHP errors when some error +; happens within intl functions. The value is the level of the error produced. +; Default is 0, which does not produce any errors. +;intl.error_level = E_WARNING +;intl.use_exceptions = 0 + +[sqlite3] +; Directory pointing to SQLite3 extensions +; http://php.net/sqlite3.extension-dir +;sqlite3.extension_dir = + +; SQLite defensive mode flag (only available from SQLite 3.26+) +; When the defensive flag is enabled, language features that allow ordinary +; SQL to deliberately corrupt the database file are disabled. This forbids +; writing directly to the schema, shadow tables (eg. FTS data tables), or +; the sqlite_dbpage virtual table. +; https://www.sqlite.org/c3ref/c_dbconfig_defensive.html +; (for older SQLite versions, this flag has no use) +;sqlite3.defensive = 1 + +[Pcre] +; PCRE library backtracking limit. +; http://php.net/pcre.backtrack-limit +;pcre.backtrack_limit=100000 + +; PCRE library recursion limit. +; Please note that if you set this value to a high number you may consume all +; the available process stack and eventually crash PHP (due to reaching the +; stack size limit imposed by the Operating System). +; http://php.net/pcre.recursion-limit +;pcre.recursion_limit=100000 + +; Enables or disables JIT compilation of patterns. This requires the PCRE +; library to be compiled with JIT support. +;pcre.jit=1 + +[Pdo] +; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" +; http://php.net/pdo-odbc.connection-pooling +;pdo_odbc.connection_pooling=strict + +;pdo_odbc.db2_instance_name + +[Pdo_mysql] +; Default socket name for local MySQL connects. If empty, uses the built-in +; MySQL defaults. +pdo_mysql.default_socket= + +[Phar] +; http://php.net/phar.readonly +;phar.readonly = On + +; http://php.net/phar.require-hash +;phar.require_hash = On + +;phar.cache_list = + +[mail function] +; For Win32 only. +; http://php.net/smtp +SMTP = localhost +; http://php.net/smtp-port +smtp_port = 25 + +; For Win32 only. +; http://php.net/sendmail-from +;sendmail_from = me@example.com + +; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). +; http://php.net/sendmail-path +;sendmail_path = + +; Force the addition of the specified parameters to be passed as extra parameters +; to the sendmail binary. These parameters will always replace the value of +; the 5th parameter to mail(). +;mail.force_extra_parameters = + +; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename +mail.add_x_header = Off + +; The path to a log file that will log all mail() calls. Log entries include +; the full path of the script, line number, To address and headers. +;mail.log = +; Log mail to syslog (Event Log on Windows). +;mail.log = syslog + +[ODBC] +; http://php.net/odbc.default-db +;odbc.default_db = Not yet implemented + +; http://php.net/odbc.default-user +;odbc.default_user = Not yet implemented + +; http://php.net/odbc.default-pw +;odbc.default_pw = Not yet implemented + +; Controls the ODBC cursor model. +; Default: SQL_CURSOR_STATIC (default). +;odbc.default_cursortype + +; Allow or prevent persistent links. +; http://php.net/odbc.allow-persistent +odbc.allow_persistent = On + +; Check that a connection is still valid before reuse. +; http://php.net/odbc.check-persistent +odbc.check_persistent = On + +; Maximum number of persistent links. -1 means no limit. +; http://php.net/odbc.max-persistent +odbc.max_persistent = -1 + +; Maximum number of links (persistent + non-persistent). -1 means no limit. +; http://php.net/odbc.max-links +odbc.max_links = -1 + +; Handling of LONG fields. Returns number of bytes to variables. 0 means +; passthru. +; http://php.net/odbc.defaultlrl +odbc.defaultlrl = 4096 + +; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. +; See the documentation on odbc_binmode and odbc_longreadlen for an explanation +; of odbc.defaultlrl and odbc.defaultbinmode +; http://php.net/odbc.defaultbinmode +odbc.defaultbinmode = 1 + +[MySQLi] + +; Maximum number of persistent links. -1 means no limit. +; http://php.net/mysqli.max-persistent +mysqli.max_persistent = -1 + +; Allow accessing, from PHP's perspective, local files with LOAD DATA statements +; http://php.net/mysqli.allow_local_infile +;mysqli.allow_local_infile = On + +; Allow or prevent persistent links. +; http://php.net/mysqli.allow-persistent +mysqli.allow_persistent = On + +; Maximum number of links. -1 means no limit. +; http://php.net/mysqli.max-links +mysqli.max_links = -1 + +; Default port number for mysqli_connect(). If unset, mysqli_connect() will use +; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the +; compile-time value defined MYSQL_PORT (in that order). Win32 will only look +; at MYSQL_PORT. +; http://php.net/mysqli.default-port +mysqli.default_port = 3306 + +; Default socket name for local MySQL connects. If empty, uses the built-in +; MySQL defaults. +; http://php.net/mysqli.default-socket +mysqli.default_socket = + +; Default host for mysqli_connect() (doesn't apply in safe mode). +; http://php.net/mysqli.default-host +mysqli.default_host = + +; Default user for mysqli_connect() (doesn't apply in safe mode). +; http://php.net/mysqli.default-user +mysqli.default_user = + +; Default password for mysqli_connect() (doesn't apply in safe mode). +; Note that this is generally a *bad* idea to store passwords in this file. +; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") +; and reveal this password! And of course, any users with read access to this +; file will be able to reveal the password as well. +; http://php.net/mysqli.default-pw +mysqli.default_pw = + +; Allow or prevent reconnect +mysqli.reconnect = Off + +[mysqlnd] +; Enable / Disable collection of general statistics by mysqlnd which can be +; used to tune and monitor MySQL operations. +mysqlnd.collect_statistics = On + +; Enable / Disable collection of memory usage statistics by mysqlnd which can be +; used to tune and monitor MySQL operations. +mysqlnd.collect_memory_statistics = Off + +; Records communication from all extensions using mysqlnd to the specified log +; file. +; http://php.net/mysqlnd.debug +;mysqlnd.debug = + +; Defines which queries will be logged. +;mysqlnd.log_mask = 0 + +; Default size of the mysqlnd memory pool, which is used by result sets. +;mysqlnd.mempool_default_size = 16000 + +; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. +;mysqlnd.net_cmd_buffer_size = 2048 + +; Size of a pre-allocated buffer used for reading data sent by the server in +; bytes. +;mysqlnd.net_read_buffer_size = 32768 + +; Timeout for network requests in seconds. +;mysqlnd.net_read_timeout = 31536000 + +; SHA-256 Authentication Plugin related. File with the MySQL server public RSA +; key. +;mysqlnd.sha256_server_public_key = + +[OCI8] + +; Connection: Enables privileged connections using external +; credentials (OCI_SYSOPER, OCI_SYSDBA) +; http://php.net/oci8.privileged-connect +;oci8.privileged_connect = Off + +; Connection: The maximum number of persistent OCI8 connections per +; process. Using -1 means no limit. +; http://php.net/oci8.max-persistent +;oci8.max_persistent = -1 + +; Connection: The maximum number of seconds a process is allowed to +; maintain an idle persistent connection. Using -1 means idle +; persistent connections will be maintained forever. +; http://php.net/oci8.persistent-timeout +;oci8.persistent_timeout = -1 + +; Connection: The number of seconds that must pass before issuing a +; ping during oci_pconnect() to check the connection validity. When +; set to 0, each oci_pconnect() will cause a ping. Using -1 disables +; pings completely. +; http://php.net/oci8.ping-interval +;oci8.ping_interval = 60 + +; Connection: Set this to a user chosen connection class to be used +; for all pooled server requests with Oracle 11g Database Resident +; Connection Pooling (DRCP). To use DRCP, this value should be set to +; the same string for all web servers running the same application, +; the database pool must be configured, and the connection string must +; specify to use a pooled server. +;oci8.connection_class = + +; High Availability: Using On lets PHP receive Fast Application +; Notification (FAN) events generated when a database node fails. The +; database must also be configured to post FAN events. +;oci8.events = Off + +; Tuning: This option enables statement caching, and specifies how +; many statements to cache. Using 0 disables statement caching. +; http://php.net/oci8.statement-cache-size +;oci8.statement_cache_size = 20 + +; Tuning: Enables statement prefetching and sets the default number of +; rows that will be fetched automatically after statement execution. +; http://php.net/oci8.default-prefetch +;oci8.default_prefetch = 100 + +; Compatibility. Using On means oci_close() will not close +; oci_connect() and oci_new_connect() connections. +; http://php.net/oci8.old-oci-close-semantics +;oci8.old_oci_close_semantics = Off + +[PostgreSQL] +; Allow or prevent persistent links. +; http://php.net/pgsql.allow-persistent +pgsql.allow_persistent = On + +; Detect broken persistent links always with pg_pconnect(). +; Auto reset feature requires a little overheads. +; http://php.net/pgsql.auto-reset-persistent +pgsql.auto_reset_persistent = Off + +; Maximum number of persistent links. -1 means no limit. +; http://php.net/pgsql.max-persistent +pgsql.max_persistent = -1 + +; Maximum number of links (persistent+non persistent). -1 means no limit. +; http://php.net/pgsql.max-links +pgsql.max_links = -1 + +; Ignore PostgreSQL backends Notice message or not. +; Notice message logging require a little overheads. +; http://php.net/pgsql.ignore-notice +pgsql.ignore_notice = 0 + +; Log PostgreSQL backends Notice message or not. +; Unless pgsql.ignore_notice=0, module cannot log notice message. +; http://php.net/pgsql.log-notice +pgsql.log_notice = 0 + +[bcmath] +; Number of decimal digits for all bcmath functions. +; http://php.net/bcmath.scale +bcmath.scale = 0 + +[browscap] +; http://php.net/browscap +;browscap = extra/browscap.ini + +[Session] +; Handler used to store/retrieve data. +; http://php.net/session.save-handler +session.save_handler = files + +; Argument passed to save_handler. In the case of files, this is the path +; where data files are stored. Note: Windows users have to change this +; variable in order to use PHP's session functions. +; +; The path can be defined as: +; +; session.save_path = "N;/path" +; +; where N is an integer. Instead of storing all the session files in +; /path, what this will do is use subdirectories N-levels deep, and +; store the session data in those directories. This is useful if +; your OS has problems with many files in one directory, and is +; a more efficient layout for servers that handle many sessions. +; +; NOTE 1: PHP will not create this directory structure automatically. +; You can use the script in the ext/session dir for that purpose. +; NOTE 2: See the section on garbage collection below if you choose to +; use subdirectories for session storage +; +; The file storage module creates files using mode 600 by default. +; You can change that by using +; +; session.save_path = "N;MODE;/path" +; +; where MODE is the octal representation of the mode. Note that this +; does not overwrite the process's umask. +; http://php.net/session.save-path +;session.save_path = "/tmp" + +; Whether to use strict session mode. +; Strict session mode does not accept an uninitialized session ID, and +; regenerates the session ID if the browser sends an uninitialized session ID. +; Strict mode protects applications from session fixation via a session adoption +; vulnerability. It is disabled by default for maximum compatibility, but +; enabling it is encouraged. +; https://wiki.php.net/rfc/strict_sessions +session.use_strict_mode = 0 + +; Whether to use cookies. +; http://php.net/session.use-cookies +session.use_cookies = 1 + +; http://php.net/session.cookie-secure +;session.cookie_secure = + +; This option forces PHP to fetch and use a cookie for storing and maintaining +; the session id. We encourage this operation as it's very helpful in combating +; session hijacking when not specifying and managing your own session id. It is +; not the be-all and end-all of session hijacking defense, but it's a good start. +; http://php.net/session.use-only-cookies +session.use_only_cookies = 1 + +; Name of the session (used as cookie name). +; http://php.net/session.name +session.name = PHPSESSID + +; Initialize session on request startup. +; http://php.net/session.auto-start +session.auto_start = 0 + +; Lifetime in seconds of cookie or, if 0, until browser is restarted. +; http://php.net/session.cookie-lifetime +session.cookie_lifetime = 0 + +; The path for which the cookie is valid. +; http://php.net/session.cookie-path +session.cookie_path = / + +; The domain for which the cookie is valid. +; http://php.net/session.cookie-domain +session.cookie_domain = + +; Whether or not to add the httpOnly flag to the cookie, which makes it +; inaccessible to browser scripting languages such as JavaScript. +; http://php.net/session.cookie-httponly +session.cookie_httponly = + +; Add SameSite attribute to cookie to help mitigate Cross-Site Request Forgery (CSRF/XSRF) +; Current valid values are "Strict", "Lax" or "None". When using "None", +; make sure to include the quotes, as `none` is interpreted like `false` in ini files. +; https://tools.ietf.org/html/draft-west-first-party-cookies-07 +session.cookie_samesite = + +; Handler used to serialize data. php is the standard serializer of PHP. +; http://php.net/session.serialize-handler +session.serialize_handler = php + +; Defines the probability that the 'garbage collection' process is started on every +; session initialization. The probability is calculated by using gc_probability/gc_divisor, +; e.g. 1/100 means there is a 1% chance that the GC process starts on each request. +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; http://php.net/session.gc-probability +session.gc_probability = 1 + +; Defines the probability that the 'garbage collection' process is started on every +; session initialization. The probability is calculated by using gc_probability/gc_divisor, +; e.g. 1/100 means there is a 1% chance that the GC process starts on each request. +; For high volume production servers, using a value of 1000 is a more efficient approach. +; Default Value: 100 +; Development Value: 1000 +; Production Value: 1000 +; http://php.net/session.gc-divisor +session.gc_divisor = 1000 + +; After this number of seconds, stored data will be seen as 'garbage' and +; cleaned up by the garbage collection process. +; http://php.net/session.gc-maxlifetime +session.gc_maxlifetime = 1440 + +; NOTE: If you are using the subdirectory option for storing session files +; (see session.save_path above), then garbage collection does *not* +; happen automatically. You will need to do your own garbage +; collection through a shell script, cron entry, or some other method. +; For example, the following script is the equivalent of setting +; session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): +; find /path/to/sessions -cmin +24 -type f | xargs rm + +; Check HTTP Referer to invalidate externally stored URLs containing ids. +; HTTP_REFERER has to contain this substring for the session to be +; considered as valid. +; http://php.net/session.referer-check +session.referer_check = + +; Set to {nocache,private,public,} to determine HTTP caching aspects +; or leave this empty to avoid sending anti-caching headers. +; http://php.net/session.cache-limiter +session.cache_limiter = nocache + +; Document expires after n minutes. +; http://php.net/session.cache-expire +session.cache_expire = 180 + +; trans sid support is disabled by default. +; Use of trans sid may risk your users' security. +; Use this option with caution. +; - User may send URL contains active session ID +; to other person via. email/irc/etc. +; - URL that contains active session ID may be stored +; in publicly accessible computer. +; - User may access your site with the same session ID +; always using URL stored in browser's history or bookmarks. +; http://php.net/session.use-trans-sid +session.use_trans_sid = 0 + +; Set session ID character length. This value could be between 22 to 256. +; Shorter length than default is supported only for compatibility reason. +; Users should use 32 or more chars. +; http://php.net/session.sid-length +; Default Value: 32 +; Development Value: 26 +; Production Value: 26 +session.sid_length = 26 + +; The URL rewriter will look for URLs in a defined set of HTML tags. +;
is special; if you include them here, the rewriter will +; add a hidden field with the info which is otherwise appended +; to URLs. tag's action attribute URL will not be modified +; unless it is specified. +; Note that all valid entries require a "=", even if no value follows. +; Default Value: "a=href,area=href,frame=src,form=" +; Development Value: "a=href,area=href,frame=src,form=" +; Production Value: "a=href,area=href,frame=src,form=" +; http://php.net/url-rewriter.tags +session.trans_sid_tags = "a=href,area=href,frame=src,form=" + +; URL rewriter does not rewrite absolute URLs by default. +; To enable rewrites for absolute paths, target hosts must be specified +; at RUNTIME. i.e. use ini_set() +; tags is special. PHP will check action attribute's URL regardless +; of session.trans_sid_tags setting. +; If no host is defined, HTTP_HOST will be used for allowed host. +; Example value: php.net,www.php.net,wiki.php.net +; Use "," for multiple hosts. No spaces are allowed. +; Default Value: "" +; Development Value: "" +; Production Value: "" +;session.trans_sid_hosts="" + +; Define how many bits are stored in each character when converting +; the binary hash data to something readable. +; Possible values: +; 4 (4 bits: 0-9, a-f) +; 5 (5 bits: 0-9, a-v) +; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") +; Default Value: 4 +; Development Value: 5 +; Production Value: 5 +; http://php.net/session.hash-bits-per-character +session.sid_bits_per_character = 5 + +; Enable upload progress tracking in $_SESSION +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.enabled +;session.upload_progress.enabled = On + +; Cleanup the progress information as soon as all POST data has been read +; (i.e. upload completed). +; Default Value: On +; Development Value: On +; Production Value: On +; http://php.net/session.upload-progress.cleanup +;session.upload_progress.cleanup = On + +; A prefix used for the upload progress key in $_SESSION +; Default Value: "upload_progress_" +; Development Value: "upload_progress_" +; Production Value: "upload_progress_" +; http://php.net/session.upload-progress.prefix +;session.upload_progress.prefix = "upload_progress_" + +; The index name (concatenated with the prefix) in $_SESSION +; containing the upload progress information +; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" +; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" +; http://php.net/session.upload-progress.name +;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" + +; How frequently the upload progress should be updated. +; Given either in percentages (per-file), or in bytes +; Default Value: "1%" +; Development Value: "1%" +; Production Value: "1%" +; http://php.net/session.upload-progress.freq +;session.upload_progress.freq = "1%" + +; The minimum delay between updates, in seconds +; Default Value: 1 +; Development Value: 1 +; Production Value: 1 +; http://php.net/session.upload-progress.min-freq +;session.upload_progress.min_freq = "1" + +; Only write session data when session data is changed. Enabled by default. +; http://php.net/session.lazy-write +;session.lazy_write = On + +[Assertion] +; Switch whether to compile assertions at all (to have no overhead at run-time) +; -1: Do not compile at all +; 0: Jump over assertion at run-time +; 1: Execute assertions +; Changing from or to a negative value is only possible in php.ini! (For turning assertions on and off at run-time, see assert.active, when zend.assertions = 1) +; Default Value: 1 +; Development Value: 1 +; Production Value: -1 +; http://php.net/zend.assertions +zend.assertions = -1 + +; Assert(expr); active by default. +; http://php.net/assert.active +;assert.active = On + +; Throw an AssertionError on failed assertions +; http://php.net/assert.exception +;assert.exception = On + +; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active) +; http://php.net/assert.warning +;assert.warning = On + +; Don't bail out by default. +; http://php.net/assert.bail +;assert.bail = Off + +; User-function to be called if an assertion fails. +; http://php.net/assert.callback +;assert.callback = 0 + +; Eval the expression with current error_reporting(). Set to true if you want +; error_reporting(0) around the eval(). +; http://php.net/assert.quiet-eval +;assert.quiet_eval = 0 + +[COM] +; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs +; http://php.net/com.typelib-file +;com.typelib_file = + +; allow Distributed-COM calls +; http://php.net/com.allow-dcom +;com.allow_dcom = true + +; autoregister constants of a component's typlib on com_load() +; http://php.net/com.autoregister-typelib +;com.autoregister_typelib = true + +; register constants casesensitive +; http://php.net/com.autoregister-casesensitive +;com.autoregister_casesensitive = false + +; show warnings on duplicate constant registrations +; http://php.net/com.autoregister-verbose +;com.autoregister_verbose = true + +; The default character set code-page to use when passing strings to and from COM objects. +; Default: system ANSI code page +;com.code_page= + +[mbstring] +; language for internal character representation. +; This affects mb_send_mail() and mbstring.detect_order. +; http://php.net/mbstring.language +;mbstring.language = Japanese + +; Use of this INI entry is deprecated, use global internal_encoding instead. +; internal/script encoding. +; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) +; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. +; The precedence is: default_charset < internal_encoding < iconv.internal_encoding +;mbstring.internal_encoding = + +; Use of this INI entry is deprecated, use global input_encoding instead. +; http input encoding. +; mbstring.encoding_translation = On is needed to use this setting. +; If empty, default_charset or input_encoding or mbstring.input is used. +; The precedence is: default_charset < input_encoding < mbstring.http_input +; http://php.net/mbstring.http-input +;mbstring.http_input = + +; Use of this INI entry is deprecated, use global output_encoding instead. +; http output encoding. +; mb_output_handler must be registered as output buffer to function. +; If empty, default_charset or output_encoding or mbstring.http_output is used. +; The precedence is: default_charset < output_encoding < mbstring.http_output +; To use an output encoding conversion, mbstring's output handler must be set +; otherwise output encoding conversion cannot be performed. +; http://php.net/mbstring.http-output +;mbstring.http_output = + +; enable automatic encoding translation according to +; mbstring.internal_encoding setting. Input chars are +; converted to internal encoding by setting this to On. +; Note: Do _not_ use automatic encoding translation for +; portable libs/applications. +; http://php.net/mbstring.encoding-translation +;mbstring.encoding_translation = Off + +; automatic encoding detection order. +; "auto" detect order is changed according to mbstring.language +; http://php.net/mbstring.detect-order +;mbstring.detect_order = auto + +; substitute_character used when character cannot be converted +; one from another +; http://php.net/mbstring.substitute-character +;mbstring.substitute_character = none + +; overload(replace) single byte functions by mbstring functions. +; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), +; etc. Possible values are 0,1,2,4 or combination of them. +; For example, 7 for overload everything. +; 0: No overload +; 1: Overload mail() function +; 2: Overload str*() functions +; 4: Overload ereg*() functions +; http://php.net/mbstring.func-overload +;mbstring.func_overload = 0 + +; enable strict encoding detection. +; Default: Off +;mbstring.strict_detection = On + +; This directive specifies the regex pattern of content types for which mb_output_handler() +; is activated. +; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml) +;mbstring.http_output_conv_mimetype= + +; This directive specifies maximum stack depth for mbstring regular expressions. It is similar +; to the pcre.recursion_limit for PCRE. +; Default: 100000 +;mbstring.regex_stack_limit=100000 + +; This directive specifies maximum retry count for mbstring regular expressions. It is similar +; to the pcre.backtrack_limit for PCRE. +; Default: 1000000 +;mbstring.regex_retry_limit=1000000 + +[gd] +; Tell the jpeg decode to ignore warnings and try to create +; a gd image. The warning will then be displayed as notices +; disabled by default +; http://php.net/gd.jpeg-ignore-warning +;gd.jpeg_ignore_warning = 1 + +[exif] +; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. +; With mbstring support this will automatically be converted into the encoding +; given by corresponding encode setting. When empty mbstring.internal_encoding +; is used. For the decode settings you can distinguish between motorola and +; intel byte order. A decode setting cannot be empty. +; http://php.net/exif.encode-unicode +;exif.encode_unicode = ISO-8859-15 + +; http://php.net/exif.decode-unicode-motorola +;exif.decode_unicode_motorola = UCS-2BE + +; http://php.net/exif.decode-unicode-intel +;exif.decode_unicode_intel = UCS-2LE + +; http://php.net/exif.encode-jis +;exif.encode_jis = + +; http://php.net/exif.decode-jis-motorola +;exif.decode_jis_motorola = JIS + +; http://php.net/exif.decode-jis-intel +;exif.decode_jis_intel = JIS + +[Tidy] +; The path to a default tidy configuration file to use when using tidy +; http://php.net/tidy.default-config +;tidy.default_config = /usr/local/lib/php/default.tcfg + +; Should tidy clean and repair output automatically? +; WARNING: Do not use this option if you are generating non-html content +; such as dynamic images +; http://php.net/tidy.clean-output +tidy.clean_output = Off + +[soap] +; Enables or disables WSDL caching feature. +; http://php.net/soap.wsdl-cache-enabled +soap.wsdl_cache_enabled=1 + +; Sets the directory name where SOAP extension will put cache files. +; http://php.net/soap.wsdl-cache-dir +soap.wsdl_cache_dir="/tmp" + +; (time to live) Sets the number of second while cached file will be used +; instead of original one. +; http://php.net/soap.wsdl-cache-ttl +soap.wsdl_cache_ttl=86400 + +; Sets the size of the cache limit. (Max. number of WSDL files to cache) +soap.wsdl_cache_limit = 5 + +[sysvshm] +; A default size of the shared memory segment +;sysvshm.init_mem = 10000 + +[ldap] +; Sets the maximum number of open links or -1 for unlimited. +ldap.max_links = -1 + +[dba] +;dba.default_handler= + +[opcache] +; Determines if Zend OPCache is enabled +;opcache.enable=1 + +; Determines if Zend OPCache is enabled for the CLI version of PHP +;opcache.enable_cli=0 + +; The OPcache shared memory storage size. +;opcache.memory_consumption=128 + +; The amount of memory for interned strings in Mbytes. +;opcache.interned_strings_buffer=8 + +; The maximum number of keys (scripts) in the OPcache hash table. +; Only numbers between 200 and 1000000 are allowed. +;opcache.max_accelerated_files=10000 + +; The maximum percentage of "wasted" memory until a restart is scheduled. +;opcache.max_wasted_percentage=5 + +; When this directive is enabled, the OPcache appends the current working +; directory to the script key, thus eliminating possible collisions between +; files with the same name (basename). Disabling the directive improves +; performance, but may break existing applications. +;opcache.use_cwd=1 + +; When disabled, you must reset the OPcache manually or restart the +; webserver for changes to the filesystem to take effect. +;opcache.validate_timestamps=1 + +; How often (in seconds) to check file timestamps for changes to the shared +; memory storage allocation. ("1" means validate once per second, but only +; once per request. "0" means always validate) +;opcache.revalidate_freq=2 + +; Enables or disables file search in include_path optimization +;opcache.revalidate_path=0 + +; If disabled, all PHPDoc comments are dropped from the code to reduce the +; size of the optimized code. +;opcache.save_comments=1 + +; Allow file existence override (file_exists, etc.) performance feature. +;opcache.enable_file_override=0 + +; A bitmask, where each bit enables or disables the appropriate OPcache +; passes +;opcache.optimization_level=0x7FFFBFFF + +;opcache.dups_fix=0 + +; The location of the OPcache blacklist file (wildcards allowed). +; Each OPcache blacklist file is a text file that holds the names of files +; that should not be accelerated. The file format is to add each filename +; to a new line. The filename may be a full path or just a file prefix +; (i.e., /var/www/x blacklists all the files and directories in /var/www +; that start with 'x'). Line starting with a ; are ignored (comments). +;opcache.blacklist_filename= + +; Allows exclusion of large files from being cached. By default all files +; are cached. +;opcache.max_file_size=0 + +; Check the cache checksum each N requests. +; The default value of "0" means that the checks are disabled. +;opcache.consistency_checks=0 + +; How long to wait (in seconds) for a scheduled restart to begin if the cache +; is not being accessed. +;opcache.force_restart_timeout=180 + +; OPcache error_log file name. Empty string assumes "stderr". +;opcache.error_log= + +; All OPcache errors go to the Web server log. +; By default, only fatal errors (level 0) or errors (level 1) are logged. +; You can also enable warnings (level 2), info messages (level 3) or +; debug messages (level 4). +;opcache.log_verbosity_level=1 + +; Preferred Shared Memory back-end. Leave empty and let the system decide. +;opcache.preferred_memory_model= + +; Protect the shared memory from unexpected writing during script execution. +; Useful for internal debugging only. +;opcache.protect_memory=0 + +; Allows calling OPcache API functions only from PHP scripts which path is +; started from specified string. The default "" means no restriction +;opcache.restrict_api= + +; Mapping base of shared memory segments (for Windows only). All the PHP +; processes have to map shared memory into the same address space. This +; directive allows to manually fix the "Unable to reattach to base address" +; errors. +;opcache.mmap_base= + +; Facilitates multiple OPcache instances per user (for Windows only). All PHP +; processes with the same cache ID and user share an OPcache instance. +;opcache.cache_id= + +; Enables and sets the second level cache directory. +; It should improve performance when SHM memory is full, at server restart or +; SHM reset. The default "" disables file based caching. +;opcache.file_cache= + +; Enables or disables opcode caching in shared memory. +;opcache.file_cache_only=0 + +; Enables or disables checksum validation when script loaded from file cache. +;opcache.file_cache_consistency_checks=1 + +; Implies opcache.file_cache_only=1 for a certain process that failed to +; reattach to the shared memory (for Windows only). Explicitly enabled file +; cache is required. +;opcache.file_cache_fallback=1 + +; Enables or disables copying of PHP code (text segment) into HUGE PAGES. +; This should improve performance, but requires appropriate OS configuration. +;opcache.huge_code_pages=1 + +; Validate cached file permissions. +;opcache.validate_permission=0 + +; Prevent name collisions in chroot'ed environment. +;opcache.validate_root=0 + +; If specified, it produces opcode dumps for debugging different stages of +; optimizations. +;opcache.opt_debug_level=0 + +; Specifies a PHP script that is going to be compiled and executed at server +; start-up. +; http://php.net/opcache.preload +;opcache.preload= + +; Preloading code as root is not allowed for security reasons. This directive +; facilitates to let the preloading to be run as another user. +; http://php.net/opcache.preload_user +;opcache.preload_user= + +; Prevents caching files that are less than this number of seconds old. It +; protects from caching of incompletely updated files. In case all file updates +; on your site are atomic, you may increase performance by setting it to "0". +;opcache.file_update_protection=2 + +; Absolute path used to store shared lockfiles (for *nix only). +;opcache.lockfile_path=/tmp + +[curl] +; A default value for the CURLOPT_CAINFO option. This is required to be an +; absolute path. +;curl.cainfo = + +[openssl] +; The location of a Certificate Authority (CA) file on the local filesystem +; to use when verifying the identity of SSL/TLS peers. Most users should +; not specify a value for this directive as PHP will attempt to use the +; OS-managed cert stores in its absence. If specified, this value may still +; be overridden on a per-stream basis via the "cafile" SSL stream context +; option. +;openssl.cafile= + +; If openssl.cafile is not specified or if the CA file is not found, the +; directory pointed to by openssl.capath is searched for a suitable +; certificate. This value must be a correctly hashed certificate directory. +; Most users should not specify a value for this directive as PHP will +; attempt to use the OS-managed cert stores in its absence. If specified, +; this value may still be overridden on a per-stream basis via the "capath" +; SSL stream context option. +;openssl.capath= + +[ffi] +; FFI API restriction. Possible values: +; "preload" - enabled in CLI scripts and preloaded files (default) +; "false" - always disabled +; "true" - always enabled +;ffi.enable=preload + +; List of headers files to preload, wildcard patterns allowed. +;ffi.preload= \ No newline at end of file From cbb10e171c1fd91c6c85594ad362139398043357 Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 28 Aug 2023 13:21:12 +0700 Subject: [PATCH 54/62] getoverdue by gantt and project --- app/Http/Controllers/ProjectController.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index ffbe3fa..944b7ad 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -470,11 +470,20 @@ class ProjectController extends Controller if(!$result) return response()->json(['status'=>'failed','message'=> 'Project not found!','code'=> 404], 404); //TODO possible overdue bug - if(isset($payload['till_date'])) - $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$payload['till_date'])->orderBy('end_date', 'asc')->get(); - else - $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get(); - + if(isset($payload['till_date'])) { + if (isset($payload['scurve'])) { + $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$payload['till_date'])->orderBy('end_date', 'asc')->get(); + } else { + $overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$payload['till_date'])->orderBy('end_date', 'asc')->get(); + } + } + else { + if (isset($payload['scurve'])) { + $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get(); + } else { + $overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get(); + } + } $result->overdueActivities = $overdueActivities; return response()->json(['status'=>'success','code'=> 200,'data'=>$result], 200); From cb3cd6cb1f0c24b7578fe447ea74cde8d1b60489 Mon Sep 17 00:00:00 2001 From: ardhi Date: Mon, 28 Aug 2023 13:55:01 +0700 Subject: [PATCH 55/62] bug fix isset waypoint on map monitoring --- app/Http/Controllers/MapMonitoringController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/MapMonitoringController.php b/app/Http/Controllers/MapMonitoringController.php index cd68d20..486e3be 100644 --- a/app/Http/Controllers/MapMonitoringController.php +++ b/app/Http/Controllers/MapMonitoringController.php @@ -54,8 +54,8 @@ class MapMonitoringController extends Controller $waypoint = DB::table('m_waypoint')->select('lat', 'lon', 'wptime')->where('user_id', $presensi->user_id)->orderBy('wptime', 'DESC')->first(); $tmp[] = array( 'user_id' => $presensi->user_id, - 'wp_lat' => isset($waypoint) ? $waypoint->lat : '-', - 'wp_lon' => isset($waypoint) ? $waypoint->lon : '-', + 'wp_lat' => isset($waypoint) ? $waypoint->lat : null, + 'wp_lon' => isset($waypoint) ? $waypoint->lon : null, 'wp_time' => isset($waypoint) ? $waypoint->wptime : '-', 'clock_in' => $presensi->clock_in, 'clock_out' => $presensi->clock_out, From 39573779091939714c0036530ea1cc9a096af040 Mon Sep 17 00:00:00 2001 From: ardhi Date: Mon, 28 Aug 2023 13:56:00 +0700 Subject: [PATCH 56/62] bug fix isset waypoint on map monitoring --- app/Http/Controllers/MapMonitoringController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/MapMonitoringController.php b/app/Http/Controllers/MapMonitoringController.php index 486e3be..c98f5c2 100644 --- a/app/Http/Controllers/MapMonitoringController.php +++ b/app/Http/Controllers/MapMonitoringController.php @@ -56,7 +56,7 @@ class MapMonitoringController extends Controller 'user_id' => $presensi->user_id, 'wp_lat' => isset($waypoint) ? $waypoint->lat : null, 'wp_lon' => isset($waypoint) ? $waypoint->lon : null, - 'wp_time' => isset($waypoint) ? $waypoint->wptime : '-', + 'wp_time' => isset($waypoint) ? $waypoint->wptime : null, 'clock_in' => $presensi->clock_in, 'clock_out' => $presensi->clock_out, 'clock_in_lat' => $presensi->clock_in_lat, From a9838aa5fc4b9bb58c58882ae9d402fc3e7423cf Mon Sep 17 00:00:00 2001 From: ardhi Date: Mon, 28 Aug 2023 14:08:18 +0700 Subject: [PATCH 57/62] bug fix isset waypoint on map monitoring --- app/Http/Controllers/MapMonitoringController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/MapMonitoringController.php b/app/Http/Controllers/MapMonitoringController.php index c98f5c2..5c17475 100644 --- a/app/Http/Controllers/MapMonitoringController.php +++ b/app/Http/Controllers/MapMonitoringController.php @@ -54,9 +54,9 @@ class MapMonitoringController extends Controller $waypoint = DB::table('m_waypoint')->select('lat', 'lon', 'wptime')->where('user_id', $presensi->user_id)->orderBy('wptime', 'DESC')->first(); $tmp[] = array( 'user_id' => $presensi->user_id, - 'wp_lat' => isset($waypoint) ? $waypoint->lat : null, - 'wp_lon' => isset($waypoint) ? $waypoint->lon : null, - 'wp_time' => isset($waypoint) ? $waypoint->wptime : null, + 'wp_lat' => isset($waypoint) ? $waypoint->lat : $presensi->clock_in_lat, + 'wp_lon' => isset($waypoint) ? $waypoint->lon : $presensi->clock_in_lng, + 'wp_time' => isset($waypoint) ? $waypoint->wptime : $presensi->clock_in, 'clock_in' => $presensi->clock_in, 'clock_out' => $presensi->clock_out, 'clock_in_lat' => $presensi->clock_in_lat, From 0b13e01b4928233bbdaf87609356de3af1bf5374 Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 28 Aug 2023 14:59:51 +0700 Subject: [PATCH 58/62] fix schedule dashboard project --- app/Http/Controllers/ProjectController.php | 26 +++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 944b7ad..0a37a92 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -448,13 +448,27 @@ class ProjectController extends Controller // dd($result->header->start_date); $ganttId = $gantt['last_gantt_id']; - $startDate = Activity::where('version_gantt_id', $ganttId) - ->orderBy('start_date') - ->value('start_date'); + $actualStartExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_start')->exists(); + $actualEndExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_end')->exists(); - $endDate = Activity::where('version_gantt_id', $ganttId) - ->orderByDesc('end_date') - ->value('end_date'); + if ($actualStartExist) { + $startDate = Activity::where('version_gantt_id', $ganttId) + ->orderBy('actual_start') + ->value('start_date'); + } else { + $startDate = Activity::where('version_gantt_id', $ganttId) + ->orderBy('start_date') + ->value('start_date'); + } + if ($actualEndExist) { + $endDate = Activity::where('version_gantt_id', $ganttId) + ->orderByDesc('actual_end') + ->value('end_date'); + } else { + $endDate = Activity::where('version_gantt_id', $ganttId) + ->orderByDesc('end_date') + ->value('end_date'); + } $result->header->start_date = $startDate; $result->header->end_date = $endDate; return response()->json(['status'=>'success','code'=> 200,'data'=>$result, 'gantt'=>$gantt], 200); From f32f16d03851d266eebea74296b26c0850916ab1 Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 28 Aug 2023 16:32:48 +0700 Subject: [PATCH 59/62] fix till date --- app/Http/Controllers/ProjectController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 0a37a92..3a204d7 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -484,11 +484,14 @@ class ProjectController extends Controller if(!$result) return response()->json(['status'=>'failed','message'=> 'Project not found!','code'=> 404], 404); //TODO possible overdue bug + $endDate = Activity::where('proyek_id', $payload['id']) + ->orderByDesc('end_date') + ->value('end_date'); if(isset($payload['till_date'])) { if (isset($payload['scurve'])) { - $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$payload['till_date'])->orderBy('end_date', 'asc')->get(); + $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$endDate)->orderBy('end_date', 'asc')->get(); } else { - $overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$payload['till_date'])->orderBy('end_date', 'asc')->get(); + $overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$endDate)->orderBy('end_date', 'asc')->get(); } } else { From 9fb9744dd5cf564af7c69f3458953995ec5d3e63 Mon Sep 17 00:00:00 2001 From: wahyu Date: Tue, 29 Aug 2023 10:34:43 +0700 Subject: [PATCH 60/62] update bcwp --- app/Helpers/MasterFunctionsHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 6d75174..5c9764f 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -428,7 +428,7 @@ class MasterFunctionsHelper } $lastReal = $tempPercentageReal[count($tempPercentageReal) - 1]; - $totalBCWP = $lastReal * $totalBCWP; + $totalBCWP = $lastReal * $dataProject->rencana_biaya / 100; $dataResponse = array( "date" => $tempDate, "percentage" => $tempPercentage, @@ -723,7 +723,7 @@ class MasterFunctionsHelper } $lastReal = $tempPercentageReal[count($tempPercentageReal) - 1]; - $totalBCWP = $lastReal * $totalBCWP; + $totalBCWP = $lastReal * $dataProject->rencana_biaya / 100; $dataResponse = array( "date" => $tempDate, "percentage" => $tempPercentage, From ff353fbf53707f58dffd1a6f642849c9dcbcd416 Mon Sep 17 00:00:00 2001 From: wahyu Date: Tue, 29 Aug 2023 14:08:50 +0700 Subject: [PATCH 61/62] scurve queue --- app/Http/Controllers/ProjectController.php | 13 +++++-- app/Jobs/ProcessSCurve.php | 36 +++++++++++++++++++ .../2023_08_29_130624_create_jobs_table.php | 36 +++++++++++++++++++ 3 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 app/Jobs/ProcessSCurve.php create mode 100644 database/migrations/2023_08_29_130624_create_jobs_table.php diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 3a204d7..7478494 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -30,6 +30,7 @@ use Illuminate\Support\Facades\DB; use App\Helpers\MasterFunctionsHelper; use App\Models\ReportActivityMaterial; use Illuminate\Support\Facades\Artisan; +use App\Jobs\ProcessSCurve; const API_GEOLOCATION = "https://nominatim.oslogdev.com/search/ADDR?format=json&addressdetails=1&limit=1"; @@ -328,9 +329,15 @@ class ProjectController extends Controller } public function sCurveCommand(Request $request){ - Artisan::call('calculate:scurve', [ - 'project_id' => $request->project_id - ]); + $project = Project::find($request->project_id); + + if ($project) { + dispatch(new ProcessSCurve($project)); + + return response()->json(['message' => 'S Curve calculation queued']); + } + + return response()->json(['message' => 'Project not found'], 404); } public function getLinearSCurve(Request $request){ diff --git a/app/Jobs/ProcessSCurve.php b/app/Jobs/ProcessSCurve.php new file mode 100644 index 0000000..fe07ab9 --- /dev/null +++ b/app/Jobs/ProcessSCurve.php @@ -0,0 +1,36 @@ +project = $project; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + $data = MasterFunctionsHelper::CalculateSCurve($this->project->id); + + $this->project->scurve = json_encode($data); + $this->project->calculation_status = true; + $this->project->save(); + } +} diff --git a/database/migrations/2023_08_29_130624_create_jobs_table.php b/database/migrations/2023_08_29_130624_create_jobs_table.php new file mode 100644 index 0000000..1be9e8a --- /dev/null +++ b/database/migrations/2023_08_29_130624_create_jobs_table.php @@ -0,0 +1,36 @@ +bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('jobs'); + } +} From 427449bb26f4d468c8e119be35b8c7f722f5171c Mon Sep 17 00:00:00 2001 From: wahyu Date: Tue, 29 Aug 2023 14:55:32 +0700 Subject: [PATCH 62/62] disable queue --- app/Http/Controllers/ProjectController.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 7478494..48cb86e 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -329,15 +329,18 @@ class ProjectController extends Controller } public function sCurveCommand(Request $request){ - $project = Project::find($request->project_id); + Artisan::call('calculate:scurve', [ + 'project_id' => $request->project_id + ]); + // $project = Project::find($request->project_id); - if ($project) { - dispatch(new ProcessSCurve($project)); + // if ($project) { + // dispatch(new ProcessSCurve($project)); - return response()->json(['message' => 'S Curve calculation queued']); - } + // return response()->json(['message' => 'S Curve calculation queued']); + // } - return response()->json(['message' => 'Project not found'], 404); + // return response()->json(['message' => 'Project not found'], 404); } public function getLinearSCurve(Request $request){