diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 35a472f..ca3e5a2 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -20,6 +20,37 @@ class HomeController extends Controller $this->pembiayaanService = $pembiayaanService; $this->middleware(['auth', 'verified']); } + + /** + * Show the application buffer page. + * + * @return \Illuminate\View\View + */ + public function buffer(Request $request) + { + $homeUrl = route('home'); + $authUser = Auth::user(); + $customerInfo = Http::withOptions(['verify' => config('app.api_verify')]) + ->get(config('api.url') . '/portal/customer/info', ['ic' => $authUser['icno']]) + ->json(); + + ['gadai' => $customer_gadai, 'lelong' => $customer_lelong] = $customerInfo; + + // 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); + + $formatMoney = fn($x) => number_format($x, 2); + $getTotal = fn($x) => array_reduce($x, fn($accumulator, $current_item) => $accumulator + $current_item['bakipjm'], 0); + $total = $formatMoney($getTotal($customer_gadai)); + + $sixMonths = sizeOf(array_filter($customer_gadai, fn($x) => $x['tempoh'] >= 6)); + + $bilanganLelong = sizeOf($customer_lelong); + + $bilangan = sizeof($customer_gadai) + sizeOf($customer_lelong); + + return view('includes.buffer', compact('bilangan', 'sixMonths', 'total', 'bilanganLelong', 'homeUrl')); + } /** * Show the application dashboard. @@ -49,7 +80,7 @@ class HomeController extends Controller $bilanganLelong = sizeOf($customer_lelong); $bilangan = sizeof($customer_gadai) + sizeOf($customer_lelong); - + return view('includes.home', compact('bilangan', 'sixMonths', 'total', 'bilanganLelong', 'pembiayaan')); } } diff --git a/resources/views/includes/buffer.blade.php b/resources/views/includes/buffer.blade.php new file mode 100644 index 0000000..fe6b34c --- /dev/null +++ b/resources/views/includes/buffer.blade.php @@ -0,0 +1,215 @@ +@extends ('layouts.indexfirst') + +@push('additional_styles') + +@endpush + +@section('content') + Home | Portal Pelanggan + +
+ + + + + + + +
+ +
+ @csrf + + @error('totalSagInCartInput') + + @enderror + + @if (\Session::has('error')) + + @endif + + @if (\Session::has('errorsagonline')) + + @endif +
+ + @if (request()->get('filter') == 'pembiayaan-akan-dilelong') + + + + + + @else + + + + + @endif + + +
+
+
+
+

Data sedang dimuat...

+
+
+
+
+ +
+
+ + +@endsection diff --git a/resources/views/includes/main/head.blade.php b/resources/views/includes/main/head.blade.php index edf5aec..051457c 100644 --- a/resources/views/includes/main/head.blade.php +++ b/resources/views/includes/main/head.blade.php @@ -29,6 +29,8 @@ +@stack('additional_styles') +