Browse Source

update sementara untuk clockin-out work restricted

pull/3/head
ibnu 1 year ago
parent
commit
b7ffe700b2
  1. 21
      app/Http/Controllers/PresenceController.php

21
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

Loading…
Cancel
Save