From 89992a4bcbb016e3637c45b9dd253a79c6d4aaa1 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Mon, 7 Aug 2023 10:14:52 +0700 Subject: [PATCH] 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 ); } }