Browse Source

Fix map monitoring

pull/3/head
Wahyu Ramadhan 1 year ago
parent
commit
89992a4bcb
  1. 14
      app/Http/Controllers/MapMonitoringController.php

14
app/Http/Controllers/MapMonitoringController.php

@ -22,24 +22,24 @@ class MapMonitoringController extends Controller
->select('user_id') ->select('user_id')
->whereIn('proyek_id', $request->project_id) ->whereIn('proyek_id', $request->project_id)
->distinct() ->distinct()
->pluck('user_id'); ->get();
// get position hr in presensi // get position hr in presensi
$presences = DB::table('t_clock_in_out as tcio') $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', ->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_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') 'tcio.clock_out_boundary', 'mu.username', 'tcio.date_presence', 'tcio.created_at')
->join('m_users as mu', 'mu.id', '=', 'tcio.user_id') ->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') ->orderBy('tcio.id', 'DESC')
->first(); ->first();
$project = DB::table('assign_hr_to_proyek as ahtp') $project = DB::table('assign_hr_to_proyek as ahtp')
->select('ahtp.proyek_id as id', 'mp.nama as project_name') ->select('ahtp.proyek_id as id', 'mp.nama as project_name')
->join('m_proyek as mp', 'mp.id', '=', 'ahtp.proyek_id') ->join('m_proyek as mp', 'mp.id', '=', 'ahtp.proyek_id')
->whereIn('ahtp.proyek_id', $request->project_id) ->whereIn('ahtp.proyek_id', $request->project_id)
->whereIn('ahtp.user_id', $hr_assign_project) ->where('ahtp.user_id', $key->user_id)
->get(); ->get();
$tmp = [];
foreach($presences as $presensi){
if($presensi && isset($presensi->user_id)){ 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(); $image = DB::table('m_image')->select('image')->where('category', 'presensi')->where('ref_id', $presensi->clock_in_out_id)->first();
$tmp[] = array( $tmp[] = array(
@ -60,7 +60,7 @@ class MapMonitoringController extends Controller
'image_selfie' => isset($image->image) ? $image->image : '-', 'image_selfie' => isset($image->image) ? $image->image : '-',
'created_at' => $presensi->created_at, 'created_at' => $presensi->created_at,
'presence_status' => $presensi->date_presence == $dateNow ? true : false,//true, //status date_presence, 'presence_status' => $presensi->date_presence == $dateNow ? true : false,//true, //status date_presence,
'projects' => $project 'projects' => $project
); );
} }
} }

Loading…
Cancel
Save