From 2eeb504119c54d91c03194209fa7f75b27ac666b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 14 Aug 2023 10:32:46 +0700 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 4/5] 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 5/5] 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){