From 73874d99b41785c9338dfd41679ddaf9b5eb412a Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Mon, 9 Dec 2024 16:40:26 +0800 Subject: [PATCH] untuk lelong masuk tag_syarikat --- .../Controllers/InformationController.php | 58 +++++++++++++++---- .../partials/table-pembiayaan.blade.php | 1 + 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/InformationController.php b/app/Http/Controllers/InformationController.php index 4647564..75ac42d 100644 --- a/app/Http/Controllers/InformationController.php +++ b/app/Http/Controllers/InformationController.php @@ -53,6 +53,7 @@ class InformationController extends Controller if(isset($customer_pkb['lelong'])){ if(sizeof($customer_pkb['lelong']) > 0){ foreach($customer_pkb['lelong'] as $index=>$lelong){ + $customer_pkb['lelong'][$index]['tag_syarikat'] = CompanyStatus::COM_KOOPPKB; $array_lelong = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api-lelong.url') . '/api/portalApi',['norujukan' => $lelong['norujukan']])->json(); if($array_lelong === null){ @@ -71,6 +72,7 @@ class InformationController extends Controller if(isset($customer_koop['lelong'])){ if(sizeof($customer_koop['lelong']) > 0){ foreach($customer_koop['lelong'] as $index=>$lelong){ + $customer_koop['lelong'][$index]['tag_syarikat'] = CompanyStatus::COM_KOOPPKB; $array_lelong = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api-lelong.url_koop') . '/api/portalApi',['norujukan' => $lelong['norujukan']])->json(); if($array_lelong === null){ @@ -94,14 +96,16 @@ class InformationController extends Controller { $auth_user = Auth::User(); - $CustomerInfo = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/portal/customer/info',['ic' => $auth_user['icno']])->json(); + $customer_pkb = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/portal/customer/info',['ic' => $auth_user['icno']])->json(); + $customer_koop = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/portal/customer/info',['ic' => $auth_user['icno']])->json(); $melebihi6bulan = []; - if(isset($CustomerInfo['gadai'])) + if(isset($customer_pkb['gadai'])) { - foreach($CustomerInfo['gadai'] as $index=>$gadai) + foreach($customer_pkb['gadai'] as $index=>$gadai) { + $gadai['tag_syarikat'] = CompanyStatus::COM_PKB; if($gadai['tempoh'] >= 6) { array_push($melebihi6bulan,$gadai); @@ -109,6 +113,21 @@ class InformationController extends Controller } } + if(isset($customer_koop['gadai'])) + { + foreach($customer_koop['gadai'] as $index=>$gadai) + { + $gadai['tag_syarikat'] = CompanyStatus::COM_KOOPPKB; + + if($gadai['tempoh'] >= 6) + { + array_push($melebihi6bulan,$gadai); + } + } + } + + + return response()->json($melebihi6bulan,200); // return view('includes.information.melebihi6bulan',compact('melebihi6bulan')); } @@ -117,12 +136,13 @@ class InformationController extends Controller { $auth_user = Auth::User(); - $CustomerInfo = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/portal/customer/info',['ic' => $auth_user['icno']])->json(); + $customer_pkb = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/portal/customer/info',['ic' => $auth_user['icno']])->json(); + $customer_koop = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/portal/customer/info',['ic' => $auth_user['icno']])->json(); $lelong = []; - if(isset($CustomerInfo['lelong'])){ - if(sizeof($CustomerInfo['lelong']) > 0){ - foreach($CustomerInfo['lelong'] as $index=>$lel){ + if(isset($customer_pkb['lelong'])){ + if(sizeof($customer_pkb['lelong']) > 0){ + foreach($customer_pkb['lelong'] as $index=>$lel){ $array_lelong = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api-lelong.url') . '/api/portalApi',['norujukan' => $lel['norujukan']])->json(); if($array_lelong === null){ @@ -130,11 +150,29 @@ class InformationController extends Controller } if($array_lelong['lelong'] !== null){ - $CustomerInfo['lelong'][$index] = collect($lel)->merge($array_lelong['lelong'])->toArray(); + $customer_pkb['lelong'][$index] = collect($lel)->merge($array_lelong['lelong'])->toArray(); } } - $lelong = collect($lelong)->merge($CustomerInfo['lelong']); - $lelong = $lelong->toArray(); + $lelong = collect($lelong)->merge($customer_pkb['lelong']); + $lelong = $lelong->toArray(); + } + } + + if(isset($customer_koop['lelong'])){ + if(sizeof($customer_koop['lelong']) > 0){ + foreach($customer_koop['lelong'] as $index=>$lel){ + $array_lelong = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api-lelong.url') . '/api/portalApi',['norujukan' => $lel['norujukan']])->json(); + + if($array_lelong === null){ + continue; + } + + if($array_lelong['lelong'] !== null){ + $customer_koop['lelong'][$index] = collect($lel)->merge($array_lelong['lelong'])->toArray(); + } + } + $lelong = collect($lelong)->merge($customer_koop['lelong']); + $lelong = $lelong->toArray(); } } diff --git a/resources/views/includes/partials/table-pembiayaan.blade.php b/resources/views/includes/partials/table-pembiayaan.blade.php index f82c398..b7343e6 100644 --- a/resources/views/includes/partials/table-pembiayaan.blade.php +++ b/resources/views/includes/partials/table-pembiayaan.blade.php @@ -11,6 +11,7 @@ + {{-- {{ dd($pembiayaan) }} --}} @foreach ($pembiayaan as $data)