Browse Source

fix clock_in time in map monitoring

pull/3/head
ardhi 1 year ago
parent
commit
c60fc81b10
  1. 15
      app/Http/Controllers/MapMonitoringController.php

15
app/Http/Controllers/MapMonitoringController.php

@ -37,15 +37,11 @@ class MapMonitoringController extends Controller
'tcio.clock_in_lng', 'tcio.clock_in_lng',
'tcio.clock_in_loc', 'tcio.clock_in_loc',
'tcio.clock_out_loc', 'tcio.clock_out_loc',
'tcio.date_presence', 'tcio.date_presence'
'mw.lat',
'mw.lon',
'mw.wptime'
) )
->join('m_users as mu', 'mu.id', '=', 'tcio.user_id') ->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) ->where('mu.id', $key->user_id)
->orderBy('mw.wptime', 'DESC') ->orderBy('tcio.clock_in', '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')
@ -55,11 +51,12 @@ class MapMonitoringController extends Controller
->get(); ->get();
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();
$waypoint = DB::table('m_waypoint')->select('lat', 'lon', 'wptime')->where('user_id', $presensi->user_id)->orderBy('wptime', 'DESC')->first();
$tmp[] = array( $tmp[] = array(
'user_id' => $presensi->user_id, 'user_id' => $presensi->user_id,
'wp_lat' => $presensi->lat, 'wp_lat' => isset($waypoint) ? $waypoint->lat : '-',
'wp_lon' => $presensi->lon, 'wp_lon' => isset($waypoint) ? $waypoint->lon : '-',
'wp_time' => $presensi->wptime, 'wp_time' => isset($waypoint) ? $waypoint->wptime : '-',
'clock_in' => $presensi->clock_in, 'clock_in' => $presensi->clock_in,
'clock_out' => $presensi->clock_out, 'clock_out' => $presensi->clock_out,
'clock_in_lat' => $presensi->clock_in_lat, 'clock_in_lat' => $presensi->clock_in_lat,

Loading…
Cancel
Save