From c1526d3eee71dc5c02e19113111d8a57760ec5b2 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Mon, 25 Sep 2023 14:15:34 +0700 Subject: [PATCH 01/10] add parent select in Divisi Models --- app/Http/Controllers/DashboardBoDController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php index 22a53c7..fe2456b 100644 --- a/app/Http/Controllers/DashboardBoDController.php +++ b/app/Http/Controllers/DashboardBoDController.php @@ -271,7 +271,7 @@ class DashboardBoDController extends Controller { $year = $this->interpolateYear($year); - $divisions = Divisi::select('id', 'name') + $divisions = Divisi::select('id', 'name','parent') ->with('children') ->whereNull('parent') ->get(); @@ -358,4 +358,4 @@ class DashboardBoDController extends Controller 'total_manpowers' => User::count() ], 200); } -} \ No newline at end of file +} From 18c5102722f8e34796efbe330dc593469f6e8cc3 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Mon, 25 Sep 2023 14:16:17 +0700 Subject: [PATCH 02/10] change position eloquent in list method --- app/Http/Controllers/DivisiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/DivisiController.php b/app/Http/Controllers/DivisiController.php index a7d3617..17ad122 100644 --- a/app/Http/Controllers/DivisiController.php +++ b/app/Http/Controllers/DivisiController.php @@ -91,7 +91,7 @@ class DivisiController extends Controller public function list() { - $parentMenus = Divisi::whereNull('parent')->with('children')->get(); + $parentMenus = Divisi::with('children')->whereNull('parent')->get(); $divisions = []; foreach($parentMenus as $menu){ $childs = $this->getAllChildren($menu); From 785e8677fff88eb62ae34d97c9517b66643defd8 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Wed, 27 Sep 2023 14:57:47 +0700 Subject: [PATCH 03/10] change condition Models --- app/Http/Controllers/DivisiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/DivisiController.php b/app/Http/Controllers/DivisiController.php index 7ef14d3..e398682 100644 --- a/app/Http/Controllers/DivisiController.php +++ b/app/Http/Controllers/DivisiController.php @@ -92,7 +92,7 @@ class DivisiController extends Controller public function list() { - $parentMenus = Divisi::with('children')->whereNull('parent')->get(); + $parentMenus = Divisi::whereNull('parent')->with('children')->get(); $divisions = []; foreach($parentMenus as $menu){ $childs = $this->getAllChildren($menu); From f4cd27cdc6cbe65991bdbf2b561d62561b4bfdd5 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Wed, 27 Sep 2023 14:58:08 +0700 Subject: [PATCH 04/10] add select option in models --- 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 aee3fe3..c872505 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -77,7 +77,7 @@ class ProjectController extends Controller $result = Project::query() ->from('m_proyek AS mp') ->where('mp.id', $id) - ->selectRaw('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,currency_symbol,late_consequence,assumtion,currency_code,currency_name,project_objectives,considered_success_when,potential_risk,testing_environment,budget_health,phase_id,calculation_status'); + ->selectRaw('value_proyek,scoupe_of_work,kode_sortname,jumlah_stakeholder,nama,mulai_proyek,akhir_proyek,area_kerja,rencana_biaya,biaya_actual,company,pm_id,type_proyek_id,divisi_id,persentase_progress,keterangan,durasi_proyek,progress_by_worklog,currency_symbol,late_consequence,assumtion,currency_code,currency_name,project_objectives,considered_success_when,potential_risk,testing_environment,budget_health,phase_id,calculation_status'); if (!is_null($result->first()['divisi_id'])) { $result->leftJoin('m_divisi', 'mp.divisi_id', '=', 'm_divisi.id') From b7ffe700b26afe5dd8efc14c8d176c40faac5701 Mon Sep 17 00:00:00 2001 From: ibnu Date: Wed, 27 Sep 2023 18:01:07 +0700 Subject: [PATCH 05/10] update sementara untuk clockin-out work restricted --- app/Http/Controllers/PresenceController.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 0d79917..cff437f 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -26,11 +26,11 @@ class PresenceController extends Controller $statusBoundary = true; } $statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first(); - if ($statusRestriction->status_boundary) { + if (!$statusRestriction->status_boundary) { $statusBoundary = true; } // not assign - if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ + if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false && $statusBoundary == false){ $data=array( 'id' => null, 'boundary' => $statusBoundary @@ -38,7 +38,7 @@ class PresenceController extends Controller return response()->json(['status'=>'failed', 'data'=>$data, 'message'=>'Tidak dapat melakukan presensi. Anda belum di assign ke area kerja.','code'=>200], 200); } // assign and not in boundary - if($checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ + if($checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false && $statusBoundary == false){ $data=array( 'id' => null, 'boundary' => true @@ -65,7 +65,7 @@ class PresenceController extends Controller DB::table('clock_in_out_boundary')->insert([ "clock_in_out_id" => $resultUpdate, "user_id" => $request->user_id, - "activity_id" => $checkLocation[$i]['activity_id'], + "activity_id" => $checkLocation[$i]['activity_id'] ? $checkLocation[$i]['activity_id'] : 0, "type" => $request->type, "created_at" => $date, "created_by" => $this->currentName @@ -86,7 +86,8 @@ class PresenceController extends Controller } $onlyDate = date_format($date,"Y-m-d"); - $clock_in_loc = $this->getLoc($request->clock_in_lat, $request->clock_in_lng)->display_name; + // $clock_in_loc = $this->getLoc($request->clock_in_lat, $request->clock_in_lng)->display_name; + $clock_in_loc = "test"; $dataAdd = array( 'user_id'=> $request->user_id, @@ -139,11 +140,11 @@ class PresenceController extends Controller $statusBoundary = true; } $statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first(); - if ($statusRestriction->status_boundary) { + if (!$statusRestriction->status_boundary) { $statusBoundary = true; } // not assign - if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ + if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false && $statusBoundary == false){ $data=array( 'id' => null, 'boundary' => $statusBoundary @@ -151,7 +152,7 @@ class PresenceController extends Controller return response()->json(['status'=>'failed', 'data'=>$data, 'message'=>'Tidak dapat melakukan presensi. Anda belum di assign ke area kerja.','code'=>200], 200); } // assign and not in boundary - if($checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ + if($checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false && $statusBoundary == false){ $data=array( 'id' => null, 'boundary' => true @@ -178,7 +179,7 @@ class PresenceController extends Controller DB::table('clock_in_out_boundary')->insert([ "clock_in_out_id" => $resultUpdate, "user_id" => $request->user_id, - "activity_id" => $checkLocation[$i]['activity_id'], + "activity_id" => $checkLocation[$i]['activity_id'] ? $checkLocation[$i]['activity_id'] : 0, "type" => $request->clock_in_out['type'], "created_at" => $date, "created_by" => $this->currentName @@ -232,7 +233,7 @@ class PresenceController extends Controller DB::table('clock_in_out_boundary')->insert([ "clock_in_out_id" => $result->id, "user_id" => $request->user_id, - "activity_id" => $checkLocation[$i]['activity_id'], + "activity_id" => $checkLocation[$i]['activity_id'] ? $checkLocation[$i]['activity_id'] : 0, "type" => $request->type, "created_at" => $date, "created_by" => $this->currentName From 387c9149fd9c902fa9b90b35d3e6e9ed173d879e Mon Sep 17 00:00:00 2001 From: wahyuun Date: Tue, 10 Oct 2023 13:30:17 +0700 Subject: [PATCH 06/10] fix bug addMultiple Customer --- app/Http/Controllers/UserToProyekController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/UserToProyekController.php b/app/Http/Controllers/UserToProyekController.php index a7a1cac..f6fca59 100644 --- a/app/Http/Controllers/UserToProyekController.php +++ b/app/Http/Controllers/UserToProyekController.php @@ -33,7 +33,10 @@ class UserToProyekController extends Controller public function addMultiple(Request $request){ $user_IDs = $request->user_id; - $data = UserToProyek::where("proyek_id", $request->proyek_id); + $data = UserToProyek::where([ + ["proyek_id" , $request->proyek_id], + ['is_customer',true] + ]); if($data){ $data->delete(); From 6996f1fff378e55d760022e46b7dbab39719670f Mon Sep 17 00:00:00 2001 From: wahyuun Date: Mon, 16 Oct 2023 10:58:26 +0700 Subject: [PATCH 07/10] add color column in select query --- app/Http/Controllers/DivisiController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/DivisiController.php b/app/Http/Controllers/DivisiController.php index e398682..2d056aa 100644 --- a/app/Http/Controllers/DivisiController.php +++ b/app/Http/Controllers/DivisiController.php @@ -21,7 +21,8 @@ class DivisiController extends Controller $this->validate($request, [ 'name' => 'string|required|unique:m_divisi,name', 'description' => 'nullable|string', - 'parent' => 'nullable|integer' + 'parent' => 'nullable|integer', + 'color'=>'nullable|string|max:10' ]); $data = $request->all(); From 1a5de7253c62540033d54c8fd01185a2ddeb602a Mon Sep 17 00:00:00 2001 From: wahyuun Date: Mon, 16 Oct 2023 10:58:42 +0700 Subject: [PATCH 08/10] add color column --- app/Models/Divisi.php | 83 ++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/app/Models/Divisi.php b/app/Models/Divisi.php index 5a37c85..ac255f4 100644 --- a/app/Models/Divisi.php +++ b/app/Models/Divisi.php @@ -1,41 +1,42 @@ -children()->delete(); - }); - } - - public function parent() - { - return $this->belongsTo('App\Models\Divisi','parent')->where('parent', null)->with('parent'); - } - - public function children() - { - return $this->hasMany('App\Models\Divisi','parent')->with('children'); - } -} +children()->delete(); + }); + } + + public function parent() + { + return $this->belongsTo('App\Models\Divisi','parent')->where('parent', null)->with('parent'); + } + + public function children() + { + return $this->hasMany('App\Models\Divisi','parent')->with('children'); + } +} From b2581a980b46273d3a012bf0d4d9dd206bf9a25f Mon Sep 17 00:00:00 2001 From: wahyuun Date: Mon, 16 Oct 2023 12:14:07 +0700 Subject: [PATCH 09/10] update dashboard --- app/Http/Controllers/DashboardBoDController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php index fe2456b..143af38 100644 --- a/app/Http/Controllers/DashboardBoDController.php +++ b/app/Http/Controllers/DashboardBoDController.php @@ -271,7 +271,7 @@ class DashboardBoDController extends Controller { $year = $this->interpolateYear($year); - $divisions = Divisi::select('id', 'name','parent') + $divisions = Divisi::select('id', 'name','parent','color') ->with('children') ->whereNull('parent') ->get(); From 5b53d9f3a0cab4629db5b018f1ec53627cfb509d Mon Sep 17 00:00:00 2001 From: wahyuun Date: Thu, 19 Oct 2023 12:35:15 +0700 Subject: [PATCH 10/10] add color select --- app/Http/Controllers/DashboardBoDController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php index 143af38..ebdf8a3 100644 --- a/app/Http/Controllers/DashboardBoDController.php +++ b/app/Http/Controllers/DashboardBoDController.php @@ -304,7 +304,7 @@ class DashboardBoDController extends Controller { $year = $this->interpolateYear($year); - $divisions = Divisi::select('id', 'name') + $divisions = Divisi::select('id', 'name', 'color') ->with('children') ->whereNull('parent') ->get();