|
|
|
@ -263,20 +263,22 @@ 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)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary")); |
|
|
|
|
$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)."'), ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary")); |
|
|
|
|
$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")); |
|
|
|
|
} |
|
|
|
|
foreach ($check as $key) { |
|
|
|
|
// assign and in boundary |
|
|
|
|
if($key->boundary){ |
|
|
|
|
$temp[]=array( |
|
|
|
|
"activity_id" => $dataGeom->id, |
|
|
|
|
"boundary" => $key->boundary, |
|
|
|
|
"status_assign" => true |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
if(count($check)>0){ |
|
|
|
|
if($check[0]->boundary){ |
|
|
|
|
$temp[]=array( |
|
|
|
|
"activity_id" => $dataGeom->id, |
|
|
|
|
"boundary" => $check[0]->boundary, |
|
|
|
|
"status_assign" => true |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// assign and not in boundary |
|
|
|
|
if(count($temp) < 1){ |
|
|
|
|
$temp[]=array( |
|
|
|
@ -288,7 +290,7 @@ class PresenceController extends Controller
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
else{ |
|
|
|
|
// not assign |
|
|
|
|
$temp[]=array( |
|
|
|
|
"activity_id" => null, |
|
|
|
|