Merged in feature/add-password-eyes (pull request #39)
Feature/add password eyes
This commit is contained in:
@@ -42,6 +42,8 @@ class HomeController extends Controller
|
||||
$customer_pkb = $responses[0]->json();
|
||||
$customer_koop = $responses[1]->json();
|
||||
|
||||
$customerLelong = $this->getCustomerInfoLelong($authUser['icno']);
|
||||
|
||||
// ['gadai' => $customer_gadai, 'lelong' => $customer_lelong] = $customerInfo;
|
||||
$customer_gadai = array_merge(
|
||||
$customer_pkb['gadai'] ?? [],
|
||||
@@ -52,7 +54,7 @@ class HomeController extends Controller
|
||||
$customer_pkb['lelong'] ?? [],
|
||||
$customer_koop['lelong'] ?? []
|
||||
);
|
||||
|
||||
|
||||
// only get lelong that is harga jualan that is not null or 0
|
||||
$customer_lelong = array_filter($customer_lelong, fn($x) => $x['hargajualan'] != null && $x['hargajualan'] != 0);
|
||||
|
||||
@@ -66,7 +68,7 @@ class HomeController extends Controller
|
||||
|
||||
$bilangan = sizeof($customer_gadai) + sizeOf($customer_lelong);
|
||||
|
||||
return view('includes.buffer', compact('bilangan', 'sixMonths', 'total', 'bilanganLelong', 'homeUrl'));
|
||||
return view('includes.buffer', compact('bilangan', 'sixMonths', 'total', 'bilanganLelong', 'homeUrl','customerLelong'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,6 +94,7 @@ class HomeController extends Controller
|
||||
$customer_koop = $responses[1]->json();
|
||||
|
||||
|
||||
$customerLelong = $this->getCustomerInfoLelong($authUser['icno']);
|
||||
// ['gadai' => $customer_gadai, 'lelong' => $customer_lelong] = $customerInfo;
|
||||
|
||||
$customer_gadai = array_merge(
|
||||
@@ -117,6 +120,33 @@ class HomeController extends Controller
|
||||
|
||||
$bilangan = sizeof($customer_gadai) + sizeOf($customer_lelong);
|
||||
|
||||
return view('includes.home', compact('bilangan', 'sixMonths', 'total', 'bilanganLelong', 'pembiayaan'));
|
||||
return view('includes.home', compact('bilangan', 'sixMonths', 'total', 'bilanganLelong', 'pembiayaan','customerLelong'));
|
||||
}
|
||||
|
||||
private function getCustomerInfoLelong($icno){
|
||||
$customerLelong = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get(config('api.url') . '/portal/customer/info/lelong', ['ic' => $icno])
|
||||
->json();
|
||||
|
||||
$customerLelongKoop = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get(config('api.url_koop') . '/portal/customer/info/lelong', ['ic' => $icno])
|
||||
->json();
|
||||
|
||||
// Extract data with null safety
|
||||
$bakiLelong = isset($customerLelong['success']) && $customerLelong['success']
|
||||
? ($customerLelong['data']['bakilelong'] ?? 0) : 0;
|
||||
$rugiLelong = isset($customerLelong['success']) && $customerLelong['success']
|
||||
? ($customerLelong['data']['rugilelong'] ?? 0) : 0;
|
||||
|
||||
$bakiKoop = isset($customerLelongKoop['success']) && $customerLelongKoop['success']
|
||||
? ($customerLelongKoop['data']['bakilelong'] ?? 0) : 0;
|
||||
$rugiKoop = isset($customerLelongKoop['success']) && $customerLelongKoop['success']
|
||||
? ($customerLelongKoop['data']['rugilelong'] ?? 0) : 0;
|
||||
|
||||
// Calculate totals
|
||||
$totalBakiLelong = $bakiLelong + $bakiKoop;
|
||||
$totalRugiLelong = $rugiLelong + $rugiKoop;
|
||||
|
||||
return ['rugilelong' => $totalRugiLelong, 'bakilelong' => $totalBakiLelong];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user