From 199d34fdd4a31386f10e7f598e862e3302a34f74 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Wed, 23 Aug 2023 14:50:26 +0700 Subject: [PATCH 1/3] Fix work area restriction --- app/Http/Controllers/PresenceController.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/PresenceController.php b/app/Http/Controllers/PresenceController.php index 6c40779..ad0501c 100644 --- a/app/Http/Controllers/PresenceController.php +++ b/app/Http/Controllers/PresenceController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\HumanResource; use Log; use Illuminate\Http\Request; use App\Models\Presence; @@ -24,7 +25,10 @@ class PresenceController extends Controller if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){ $statusBoundary = true; } - + $statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first(); + if ($statusRestriction->status_boundary) { + $statusBoundary = true; + } // not assign if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ $data=array( @@ -134,7 +138,10 @@ class PresenceController extends Controller if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){ $statusBoundary = true; } - + $statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first(); + if ($statusRestriction->status_boundary) { + $statusBoundary = true; + } // not assign if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ $data=array( From b1a6ee123116e23ccedefcc2c663ea42e790c61b Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 12:19:16 +0700 Subject: [PATCH 2/3] Enable integration --- .../Commands/syncHumanResourceIntegration.php | 6 ++--- .../Controllers/DashboardBoDController.php | 22 +++++++++---------- app/Http/Controllers/ProjectController.php | 10 ++++----- .../Controllers/RequestMaterialController.php | 2 +- .../Controllers/UserToProyekController.php | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/Console/Commands/syncHumanResourceIntegration.php b/app/Console/Commands/syncHumanResourceIntegration.php index 6120999..7b4ef5f 100644 --- a/app/Console/Commands/syncHumanResourceIntegration.php +++ b/app/Console/Commands/syncHumanResourceIntegration.php @@ -39,9 +39,9 @@ class syncHumanResourceIntegration extends Command */ public function handle() { - // $url = config('api.adw').'/employees?page=1'; - // echo "Requesting to " . $url; - $response = null; + $url = config('api.adw').'/employees?page=1'; + echo "Requesting to " . $url; + $response = MasterFunctionsHelper::curlReq($url); if(!$response) return; diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php index 8d437b1..22a53c7 100644 --- a/app/Http/Controllers/DashboardBoDController.php +++ b/app/Http/Controllers/DashboardBoDController.php @@ -41,17 +41,17 @@ class DashboardBoDController extends Controller private function getInvoiceIntegration($search) { - // if(empty($search)) - // return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); - // - // $url = str_replace("SEARCH", $search, config('api.adw').'/project_cost?project_no=SEARCH'); - // $token = config('api.adw_token'); - // $response = $this->curlReq($url, $token); - // - // if(@$response->data->project_no == "") - // return null; - // - return null; + if(empty($search)) + return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); + + $url = str_replace("SEARCH", $search, config('api.adw').'/project_cost?project_no=SEARCH'); + $token = config('api.adw_token'); + $response = $this->curlReq($url, $token); + + if(@$response->data->project_no == "") + return null; + + return $response; } // to do diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 68f8165..3d22495 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -422,12 +422,12 @@ class ProjectController extends Controller } public function getInvoiceIntegration(Request $request) { - // $search = urlencode($request->search); - // if(empty($search)) - // return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); - // $url = str_replace("SEARCH", $search, config('api.adw').'/project_cost?project_no=SEARCH'); + $search = urlencode($request->search); + if(empty($search)) + return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); + $url = str_replace("SEARCH", $search, config('api.adw').'/project_cost?project_no=SEARCH'); - $response = null; + $response = MasterFunctionsHelper::curlReq($url); // return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200); return response()->json(['status'=>'success', 'data'=> '', 'code'=>200], 200); diff --git a/app/Http/Controllers/RequestMaterialController.php b/app/Http/Controllers/RequestMaterialController.php index 35cb76d..605cf5f 100644 --- a/app/Http/Controllers/RequestMaterialController.php +++ b/app/Http/Controllers/RequestMaterialController.php @@ -170,7 +170,7 @@ class RequestMaterialController extends Controller } public function getMaterialIntegration(Request $request) { - $search = null; + $search = urlencode($request->name); if(empty($search)) return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); $url = str_replace("SEARCH", $search, config('api.adw').'/stock_master?name=SEARCH'); diff --git a/app/Http/Controllers/UserToProyekController.php b/app/Http/Controllers/UserToProyekController.php index dc944ea..fecdfec 100644 --- a/app/Http/Controllers/UserToProyekController.php +++ b/app/Http/Controllers/UserToProyekController.php @@ -185,7 +185,7 @@ class UserToProyekController extends Controller } public function getEmployeeIntegration(Request $request) { - $search = null; + $search = urlencode($request->name); if(empty($search)) return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); $url = str_replace("SEARCH", $search, config('api.adw').'/employees?emp_name=SEARCH'); From 3051a9c4c30c9a86d27a17e42ee9a34e4144cebe Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Thu, 24 Aug 2023 14:11:58 +0700 Subject: [PATCH 3/3] update token integrasi --- config/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/api.php b/config/api.php index 4a6fad5..bb3c62a 100644 --- a/config/api.php +++ b/config/api.php @@ -2,6 +2,6 @@ return [ 'nominatim' => env('API_NOMINATIM', 'https://nominatim.oslogdev.com'), 'adw' => env('API_ADW', 'http://ospro-api.adyawinsa.com:9083/api'), - 'adw_token' => env('API_ADW_TOKEN', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxMjAyIiwiZXhwIjoxNjkxODMwNDkzfQ.DvBQIOZsdFndWsliPCZT65Y6G5Xx4vWBKz8Rhe7rvRA') + 'adw_token' => env('API_ADW_TOKEN', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxMjAyIiwiZXhwIjoxNzI0Mzk1NTExfQ.z9_Q7vjZbcbr8Mook4EmlOuOByNP12_DEDSabf0zanU') ]; ?>