From d2315dfe3cdd2eeb63bc33193dd90a673bc7b3be Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 10 Nov 2024 12:03:52 +0800 Subject: [PATCH 01/81] Update block payment sag lelong to 2 days before lelong --- app/Services/PembiayaanService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Services/PembiayaanService.php b/app/Services/PembiayaanService.php index fcd3d58..e6c96e6 100644 --- a/app/Services/PembiayaanService.php +++ b/app/Services/PembiayaanService.php @@ -157,11 +157,11 @@ class PembiayaanService $getPembiayaanAkanDilelong = fn() => (new InformationController())->pembiayaanakandilelong()->getData(); - $isCurrentDateGreaterThanEqual3DaysBeforeLelong = function ($x) { + $isCurrentDateGreaterThanEqual2DaysBeforeLelong = function ($x) { $tarikhLelong = Carbon::parse($x->t_lelong); $currentDate = Carbon::now(); - if ($currentDate->gte($tarikhLelong->subDays(3))) { + if ($currentDate->gte($tarikhLelong->subDays(2))) { return true; } @@ -169,7 +169,7 @@ class PembiayaanService }; - $pembiayaanAkanDilelong = array_filter($getPembiayaanAkanDilelong(), $isCurrentDateGreaterThanEqual3DaysBeforeLelong); + $pembiayaanAkanDilelong = array_filter($getPembiayaanAkanDilelong(), $isCurrentDateGreaterThanEqual2DaysBeforeLelong); $norujukanAkanDilelong = array_map(fn($x) => $x->norujukan, $pembiayaanAkanDilelong); From ee48f51a46ce0baf1fb607887de84f6e2ab8dad5 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Tue, 12 Nov 2024 09:24:31 +0800 Subject: [PATCH 02/81] Fix status set when customer failed to pay the bill from billplz - Changes made because the cronjob searches for the status NOT PAID to update payment status from BillPlz --- app/Http/Controllers/BayaranController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index 6c4557e..4ff0151 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -206,7 +206,7 @@ class BayaranController extends Controller if ($isBillUnpaid) { Http::arrahn()->put('/api/online/transaction', [ 'billplz_id' => $data['id'], - 'status' => 'UNSUCCESSFUL', + 'status' => 'NOT PAID', 'paid_at' => null, ]); From ffdc965e3cd8ecc1d01f2e96b01322d1d894dc00 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Sun, 1 Dec 2024 01:35:07 +0800 Subject: [PATCH 03/81] added first split --- .env.example | 13 ++ config/services.php | 7 +- .../partials/table-pembiayaan.blade.php | 137 +++++++++++++----- 3 files changed, 122 insertions(+), 35 deletions(-) diff --git a/.env.example b/.env.example index a42d7e0..c3461f5 100644 --- a/.env.example +++ b/.env.example @@ -51,3 +51,16 @@ PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" + +BILLPLZ_PRODUCTION_API_KEY="f3e82fe1-a422-4660-97f0-65cc59ff6c47" +BILLPLZ_PRODUCTION_X_SIGNATURE="S-alZUbzmD2_TF3vmrRqgehQ" +BILLPLZ_PRODUCTION_COLLECTION_ID="5aosv2dg" + +BILLPLZ_SANDBOX_API_KEY="abecfd0c-98d8-4635-abc2-2fcba8c60c11" +BILLPLZ_SANDBOX_X_SIGNATURE="S-GWr7z03XjAhqPsFfu_H5nQ" +BILLPLZ_SANDBOX_COLLECTION_ID="z0r4kjhi" + +BILLPLZ_SANDBOX_KOPKB_API_KEY="abecfd0c-98d8-4635-abc2-2fcba8c60c11" +BILLPLZ_SANDBOX_KOPKB_X_SIGNATURE="S-GWr7z03XjAhqPsFfu_H5nQ" +BILLPLZ_SANDBOX_KOPKB_COLLECTION_ID="uae40muk" + diff --git a/config/services.php b/config/services.php index 833feeb..6995833 100644 --- a/config/services.php +++ b/config/services.php @@ -34,13 +34,18 @@ return [ 'production' => [ 'api_key' => env('BILLPLZ_PRODUCTION_API_KEY', 'f3e82fe1-a422-4660-97f0-65cc59ff6c47'), 'x_signature' => env('BILLPLZ_PRODUCTION_X_SIGNATURE', 'S-alZUbzmD2_TF3vmrRqgehQ'), - 'collection_id' => env('BILLPLZ_SANDBOX_COLLECTION_ID', '5aosv2dg'), + 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', '5aosv2dg'), ], 'sandbox' => [ 'api_key' => env('BILLPLZ_SANDBOX_API_KEY', 'abecfd0c-98d8-4635-abc2-2fcba8c60c11'), 'x_signature' => env('BILLPLZ_SANDBOX_X_SIGNATURE', 'S-GWr7z03XjAhqPsFfu_H5nQ'), 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', 'z0r4kjhi'), ], + 'sandbox_kopkb' => [ + 'api_key' => env('BILLPLZ_SANDBOX_KOPKB_API_KEY', 'abecfd0c-98d8-4635-abc2-2fcba8c60c11'), + 'x_signature' => env('BILLPLZ_SANDBOX_KOPKB_X_SIGNATURE', 'S-GWr7z03XjAhqPsFfu_H5nQ'), + 'collection_id' => env('BILLPLZ_PRODUCTION_KOPKB_COLLECTION_ID', 'z0r4kjhi'), + ], ], ]; diff --git a/resources/views/includes/partials/table-pembiayaan.blade.php b/resources/views/includes/partials/table-pembiayaan.blade.php index 42aaaab..2fb48e4 100644 --- a/resources/views/includes/partials/table-pembiayaan.blade.php +++ b/resources/views/includes/partials/table-pembiayaan.blade.php @@ -1,35 +1,104 @@ -
- - - - - - - - - - - - - @foreach ($pembiayaan as $data) - - - - - - - - - @endforeach - -
#No RujukanTempohT AkhirKeuntunganCawangan
- disabled_payment ? 'disabled' : '' }} /> - - - {{ $data->norujukan }} - - {{ $data->tempoh }}{{ $data->tarikh_akhir }}{{ $data->upah_tawarruq_formatted }}{{ $data->cawangan_name }}
- "Swipe" ke kiri +
+ +
+ +
+ +
+ + + + + + + + + + + + + @foreach ($pembiayaan as $data) + + + + + + + + + @endforeach + +
#No RujukanTempohT AkhirKeuntunganCawangan
+ disabled_payment ? 'disabled' : '' }} /> + + + {{ $data->norujukan }} + + {{ $data->tempoh }}{{ $data->tarikh_akhir }}{{ $data->upah_tawarruq_formatted }}{{ $data->cawangan_name }}
+ "Swipe" ke kiri +
+ + +
+ + + + + + + + + + + + + @foreach ($pembiayaan as $data) + + + + + + + + + @endforeach + +
#No RujukanTempohT AkhirKeuntunganCawangan
+ disabled_payment ? 'disabled' : '' }} /> + + + {{ $data->norujukan }} + + {{ $data->tempoh }}{{ $data->tarikh_akhir }}{{ $data->upah_tawarruq_formatted }}{{ $data->cawangan_name }}
+ "Swipe" ke kiri +
From 87da6f7748520bf3efe4779a09371f7962557119 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 3 Dec 2024 23:22:20 +0800 Subject: [PATCH 04/81] design cart --- .../includes/bayaran/pembayaransag.blade.php | 154 +++++++++++++----- .../partials/table-pembiayaan.blade.php | 135 ++++----------- 2 files changed, 150 insertions(+), 139 deletions(-) diff --git a/resources/views/includes/bayaran/pembayaransag.blade.php b/resources/views/includes/bayaran/pembayaransag.blade.php index d01dcbc..8da0f6b 100644 --- a/resources/views/includes/bayaran/pembayaransag.blade.php +++ b/resources/views/includes/bayaran/pembayaransag.blade.php @@ -27,13 +27,14 @@
-
-
+
+
+
-

Pembayaran

+

Pembayaran PKB

@@ -43,20 +44,11 @@
- - - + - - - + @php $counter = 1;$jenisbayaran = 'tawarruq'; $totalupahasal = 1; $errorcount = 0; @endphp @@ -64,9 +56,6 @@ @if($bayar['hargajualan'] != '') - @@ -96,20 +85,6 @@ } @endphp - + + + @php $counter++; @endphp + @endif + @endforeach +
No
Rujukan
No Rujukan Tarikh Akhir BayaranBaki
Pembiayaan
Baki Pembiayaan
{{ $bayar['norujukan'] }} @@ -120,14 +95,105 @@
+
+
- +
+ {{--
+
+ +
+
+ RM1.00 +
+
+
+
+ +
+ +
+ RM{{ number_format($totalupahasal,2) }} +
+
--}} + + *Jangan biarkan kotak bayaran ditinggalkan kosong, Sila masukkan amaun! +
+
+ +
+
+
+
+
+

Pembayaran KOPKB

+ +
+ +
+
+
+
+ + + + + + + + + + @php $counter = 1;$jenisbayaran = 'tawarruq'; $totalupahasal = 1; $errorcount = 0; @endphp + @foreach($arraybayar as $index=>$bayar) + @if($bayar['hargajualan'] != '') + + + + @php + + $t_matang = strtotime($bayar['t_matang']); + $t_akhir = date("d/m/Y", $t_matang); + + if($bayar['lelong_tawarruq'] == 0) + { + $t_matang = strtotime($bayar['t_matang1']); + $t_akhir = date("d/m/Y", $t_matang); + } + @endphp + + @php + $upahtawarruq = $bayar['upah_tawarruq']; + $upahtawarruq = floatval(str_replace(',','',$upahtawarruq)); + + $totalupahasal = $totalupahasal + $upahtawarruq; + + + if(floatval($upahtawarruq) == 0){ + $errorcount++; + } + + @endphp + + + @php $counter++; @endphp @@ -181,6 +247,20 @@ +
+
+
+
+
+
+

Pembayaran KOPKB

+ +
+
+
+
+
+
diff --git a/resources/views/includes/partials/table-pembiayaan.blade.php b/resources/views/includes/partials/table-pembiayaan.blade.php index 2fb48e4..c1af081 100644 --- a/resources/views/includes/partials/table-pembiayaan.blade.php +++ b/resources/views/includes/partials/table-pembiayaan.blade.php @@ -1,104 +1,35 @@ -
- -
- -
- -
-
No
Rujukan
Tarikh AkhirBayaranBaki
Pembiayaan
+ {{ $bayar['norujukan'] }} + + {{ $t_akhir }} + + + + + + + +
- +
+
+ + + + + + + + + + + + @foreach ($pembiayaan as $data) - - - - - - + + + + + + - - - @foreach ($pembiayaan as $data) - - - - - - - - - @endforeach - -
#No RujukanTempohT AkhirKeuntunganCawangan
#No RujukanTempohT AkhirKeuntunganCawangan + disabled_payment ? 'disabled' : '' }} /> + + + {{ $data->norujukan }} + + {{ $data->tempoh }}{{ $data->tarikh_akhir }}{{ $data->upah_tawarruq_formatted }}{{ $data->cawangan_name }}
- disabled_payment ? 'disabled' : '' }} /> - - - {{ $data->norujukan }} - - {{ $data->tempoh }}{{ $data->tarikh_akhir }}{{ $data->upah_tawarruq_formatted }}{{ $data->cawangan_name }}
- "Swipe" ke kiri -
- - -
- - - - - - - - - - - - - @foreach ($pembiayaan as $data) - - - - - - - - - @endforeach - -
#No RujukanTempohT AkhirKeuntunganCawangan
- disabled_payment ? 'disabled' : '' }} /> - - - {{ $data->norujukan }} - - {{ $data->tempoh }}{{ $data->tarikh_akhir }}{{ $data->upah_tawarruq_formatted }}{{ $data->cawangan_name }}
- "Swipe" ke kiri -
-
+ @endforeach + + + "Swipe" ke kiri +
\ No newline at end of file From 2ab2980b106e332cbce0842efc4bbe69276bd779 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Wed, 4 Dec 2024 01:15:27 +0800 Subject: [PATCH 05/81] fix font awesome add cart.js to make cart function --- public/js/miscellaneous/cart.js | 22 ++++ .../includes/bayaran/pembayaransag.blade.php | 102 +++++++++--------- resources/views/includes/main/head.blade.php | 5 +- 3 files changed, 77 insertions(+), 52 deletions(-) create mode 100644 public/js/miscellaneous/cart.js diff --git a/public/js/miscellaneous/cart.js b/public/js/miscellaneous/cart.js new file mode 100644 index 0000000..3d0a293 --- /dev/null +++ b/public/js/miscellaneous/cart.js @@ -0,0 +1,22 @@ +const test = () =>{ + let btn_payment = document.getElementById('bayarsbmt'); + + console.log(btn_payment,rad_payment); +} + +let checked_rad = () =>{ + let rad_payment = document.getElementById('radpembayaran'); + + if(rad_payment.checked){ + console.log('checked'); + btn_payment.disabled = false; + }else{ + console.log('not-checked'); + btn_payment.disabled = true; + } +} + +document.addEventListener('DOMContentLoaded', function () { + console.log('Document is fully loaded and parsed.'); + // Perform your actions here +}); \ No newline at end of file diff --git a/resources/views/includes/bayaran/pembayaransag.blade.php b/resources/views/includes/bayaran/pembayaransag.blade.php index 8da0f6b..33f452a 100644 --- a/resources/views/includes/bayaran/pembayaransag.blade.php +++ b/resources/views/includes/bayaran/pembayaransag.blade.php @@ -13,7 +13,7 @@ Bayar SAG | Portal Pelanggan -
+
@csrf @@ -28,16 +28,15 @@
-
-
+
+
-

Pembayaran PKB

- +

PKB

+
-
@@ -128,13 +127,13 @@
-
+
-

Pembayaran KOPKB

- +

KOPKB

+
@@ -204,66 +203,67 @@
-
-
- -
- -
- RM1.00 -
-
-
-
- -
- -
- RM{{ number_format($totalupahasal,2) }} -
-
*Jangan biarkan kotak bayaran ditinggalkan kosong, Sila masukkan amaun!
- - -
-
-
-
-
- - -
- Batal  - - @if($totalupahasal == 1.00 || $errorcount > 0) - - @else - - @endif -
-
-
-
+
+
-

Pembayaran KOPKB

- +

Pembayaran

+
+
+
+
+ +
+ +
+ RM1.00 +
+
+
+
+ +
+ +
+ RM{{ number_format($totalupahasal,2) }} +
+
+
+
+ +
+
+
+
+
+ + +
+ Batal  + + @if($totalupahasal == 1.00 || $errorcount > 0) + + @else + + @endif +
- + +{{-- --}} + + + From de143de7ec5a1a865670bdfa11ca2b0e6564706c Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 4 Dec 2024 22:11:31 +0800 Subject: [PATCH 06/81] design pembayaransag and omit google maps --- public/js/miscellaneous/cart.js | 55 +++++++++++++++---- .../auth/pertama-kali/firsttime.blade.php | 2 +- .../includes/bayaran/pembayaransag.blade.php | 24 +++++--- .../includes/main/footercontent.blade.php | 2 +- .../views/includes/main/navigation.blade.php | 6 ++ resources/views/layouts/indexfifth.blade.php | 2 +- resources/views/pages/maps.blade.php | 2 +- 7 files changed, 69 insertions(+), 24 deletions(-) diff --git a/public/js/miscellaneous/cart.js b/public/js/miscellaneous/cart.js index 3d0a293..03f28c6 100644 --- a/public/js/miscellaneous/cart.js +++ b/public/js/miscellaneous/cart.js @@ -1,22 +1,53 @@ -const test = () =>{ - let btn_payment = document.getElementById('bayarsbmt'); +// const test = () =>{ +// let btn_payment = document.getElementById('bayarsbmt'); - console.log(btn_payment,rad_payment); -} +// console.log(btn_payment,rad_payment); +// } let checked_rad = () =>{ - let rad_payment = document.getElementById('radpembayaran'); + const radios = document.querySelectorAll('input[name="radpembayaran"]'); + // let rad_payment = document.getElementById('radpembayaran'); + let btn_payment = document.getElementById('bayarsbmt'); - if(rad_payment.checked){ - console.log('checked'); + if(radios.checked){ btn_payment.disabled = false; }else{ - console.log('not-checked'); btn_payment.disabled = true; } } -document.addEventListener('DOMContentLoaded', function () { - console.log('Document is fully loaded and parsed.'); - // Perform your actions here -}); \ No newline at end of file +const radios = document.querySelectorAll('input[name="radpembayaran"]'); + +radios.forEach((radio) => { + radio.addEventListener('change', function () { + let btn_payment = document.getElementById('bayarsbmt'); + let content1 = document.getElementById('divpkb'); + let content2 = document.getElementById('divkopkb'); + + if (this.checked) { + if(this.value == 'kopkb'){ + content1.classList.add('blurred'); + content2.classList.remove('blurred'); + btn_payment.disabled = false; + }else{ + content2.classList.add('blurred'); + content1.classList.remove('blurred'); + btn_payment.disabled = false; + } + } + + }); + // document.getElementById('radpembayaran').addEventListener('change', function () { + // const toggle = this.value; + // console.log(toggle); + // const content = document.getElementById(toggle); + + // console.log(dataToggleValue); + // if (this.checked) { + // content.classList.add('blurred'); + // } else { + // content.classList.remove('blurred'); + // } + // }); +}); + diff --git a/resources/views/auth/pertama-kali/firsttime.blade.php b/resources/views/auth/pertama-kali/firsttime.blade.php index bb6df13..51f88eb 100644 --- a/resources/views/auth/pertama-kali/firsttime.blade.php +++ b/resources/views/auth/pertama-kali/firsttime.blade.php @@ -181,7 +181,7 @@ - + {{-- --}} +{{-- --}} +{{-- --}} - + {{-- --}} From 0a1e8dc52389631eccd2e1b65ae1a6a5ddb51c1f Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Fri, 6 Dec 2024 21:22:23 +0800 Subject: [PATCH 07/81] addded companystatus --- app/Http/Controllers/BayaranController.php | 3 +- .../Controllers/InformationController.php | 51 +++++++++++++++---- app/Http/Requests/PaymentRequest.php | 9 ++++ app/Models/CompanyStatus.php | 11 ++++ app/Providers/AppServiceProvider.php | 10 ++++ config/api-lelong.php | 3 +- config/api.php | 3 +- public/js/miscellaneous/cart.js | 18 ------- resources/views/includes/home.blade.php | 4 +- 9 files changed, 79 insertions(+), 33 deletions(-) create mode 100644 app/Models/CompanyStatus.php diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index 6c4557e..613a2f4 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -19,7 +19,8 @@ class BayaranController extends Controller public function PembayaranAction(PaymentRequest $request) { $request->validated(); - + dd($request->all()); + dd($request->getPembiayaanFromNorujukan()); $arraybayar = $this->setUpahTawarruq($request->getPembiayaanFromNorujukan()); return view('includes.bayaran.pembayaransag', compact('arraybayar')); diff --git a/app/Http/Controllers/InformationController.php b/app/Http/Controllers/InformationController.php index ba8b16a..4647564 100644 --- a/app/Http/Controllers/InformationController.php +++ b/app/Http/Controllers/InformationController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\CompanyStatus; use App\Models\LelongBid; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -30,17 +31,28 @@ 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(); $pembiayaansemasa = []; - if(isset($CustomerInfo['gadai'])) - { - $pembiayaansemasa = $CustomerInfo['gadai']; + if(isset($customer_pkb['gadai'])){ + $pembiayaansemasa = array_map(function ($pkb) { + $pkb['tag_syarikat'] = CompanyStatus::COM_PKB; + return $pkb; + }, $customer_pkb['gadai']); } - if(isset($CustomerInfo['lelong'])){ - if(sizeof($CustomerInfo['lelong']) > 0){ - foreach($CustomerInfo['lelong'] as $index=>$lelong){ + if(isset($customer_koop['gadai'])){ + $array_koop = array_map(function ($koop) { + $koop['tag_syarikat'] = CompanyStatus::COM_KOOPPKB; + return $koop; + }, $customer_pkb['gadai']); + $pembiayaansemasa = array_merge($pembiayaansemasa,$array_koop); + } + + if(isset($customer_pkb['lelong'])){ + if(sizeof($customer_pkb['lelong']) > 0){ + foreach($customer_pkb['lelong'] as $index=>$lelong){ $array_lelong = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api-lelong.url') . '/api/portalApi',['norujukan' => $lelong['norujukan']])->json(); if($array_lelong === null){ @@ -48,13 +60,32 @@ class InformationController extends Controller } if($array_lelong['lelong'] !== null){ - $CustomerInfo['lelong'][$index] = collect($lelong)->merge($array_lelong['lelong'])->toArray(); + $customer_pkb['lelong'][$index] = collect($lelong)->merge($array_lelong['lelong'])->toArray(); } } - $pembiayaansemasa = collect($pembiayaansemasa)->merge($CustomerInfo['lelong']); - $pembiayaansemasa = $pembiayaansemasa->toArray(); + $pembiayaansemasa = collect($pembiayaansemasa)->merge($customer_pkb['lelong']); + $pembiayaansemasa = $pembiayaansemasa->toArray(); } } + + if(isset($customer_koop['lelong'])){ + if(sizeof($customer_koop['lelong']) > 0){ + foreach($customer_koop['lelong'] as $index=>$lelong){ + $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){ + continue; + } + + if($array_lelong['lelong'] !== null){ + $customer_koop['lelong'][$index] = collect($lelong)->merge($array_lelong['lelong'])->toArray(); + } + } + $pembiayaansemasa = collect($pembiayaansemasa)->merge($customer_koop['lelong']); + $pembiayaansemasa = $pembiayaansemasa->toArray(); + } + } + return response()->json($pembiayaansemasa,200); // return view('includes.information.pembiayaanaktif',compact('pembiayaansemasa')); } diff --git a/app/Http/Requests/PaymentRequest.php b/app/Http/Requests/PaymentRequest.php index ff4fed0..9638f70 100644 --- a/app/Http/Requests/PaymentRequest.php +++ b/app/Http/Requests/PaymentRequest.php @@ -54,6 +54,15 @@ class PaymentRequest extends FormRequest public function getPembiayaanFromNorujukan() { $norujukanList = json_decode($this->totalSagInCartInput); + + dd($norujukanList,$this->test); + + + // $list_pkb = array_filter($fn($x) => ); + // $list_koop = array_filter($fn($x) => ); + + $pkb = array_map(fn($x) => Http::arrahn()->get('/api/gadai/norujukan/' . $x)->json()[0][0],$norujukanList); + $koop = array_map(fn($x) => Http::arrahn()->get('/api/gadai/norujukan/' . $x)->json()[0][0],$norujukanList); return array_map(fn($x) => Http::arrahn()->get('/api/gadai/norujukan/' . $x)->json()[0][0], $norujukanList); } diff --git a/app/Models/CompanyStatus.php b/app/Models/CompanyStatus.php new file mode 100644 index 0000000..ad1d728 --- /dev/null +++ b/app/Models/CompanyStatus.php @@ -0,0 +1,11 @@ + config('app.api_verify')])->baseUrl(config('api.url')); }); + + Http::macro('arrahn_koop', function () { + return Http::withOptions(['verify' => config('app.api_verify')])->baseUrl(config('api.url_koop')); + }); PendingRequest::macro('arrahn', function () { $this->options['verify'] = config('app.api_verify'); $this->baseUrl(config('api.url')); return $this; }); + + PendingRequest::macro('arrahn_koop', function () { + $this->options['verify'] = config('app.api_verify'); + $this->baseUrl(config('api.url_koop')); + return $this; + }); } } diff --git a/config/api-lelong.php b/config/api-lelong.php index 6114358..6ee436d 100644 --- a/config/api-lelong.php +++ b/config/api-lelong.php @@ -1,4 +1,5 @@ env('API_LELONG_URL', 'https://niklah.arrahn.com.my') + 'url' => env('API_LELONG_URL', 'https://niklah.arrahn.com.my'), + 'url_koop' => env('API_LELONG_URL_KOOP', 'https://niklah.arrahn.com.my') ]; diff --git a/config/api.php b/config/api.php index e8ea7a3..39b8ad4 100644 --- a/config/api.php +++ b/config/api.php @@ -1,4 +1,5 @@ env('API_URL') + 'url' => env('API_URL','http://localhost:8000'), + 'url_koop' => env('API_URL_KOOP','http://localhost:8000') ]; \ No newline at end of file diff --git a/public/js/miscellaneous/cart.js b/public/js/miscellaneous/cart.js index 03f28c6..d17232e 100644 --- a/public/js/miscellaneous/cart.js +++ b/public/js/miscellaneous/cart.js @@ -1,9 +1,3 @@ -// const test = () =>{ -// let btn_payment = document.getElementById('bayarsbmt'); - -// console.log(btn_payment,rad_payment); -// } - let checked_rad = () =>{ const radios = document.querySelectorAll('input[name="radpembayaran"]'); // let rad_payment = document.getElementById('radpembayaran'); @@ -37,17 +31,5 @@ radios.forEach((radio) => { } }); - // document.getElementById('radpembayaran').addEventListener('change', function () { - // const toggle = this.value; - // console.log(toggle); - // const content = document.getElementById(toggle); - - // console.log(dataToggleValue); - // if (this.checked) { - // content.classList.add('blurred'); - // } else { - // content.classList.remove('blurred'); - // } - // }); }); diff --git a/resources/views/includes/home.blade.php b/resources/views/includes/home.blade.php index e03f792..68eb105 100644 --- a/resources/views/includes/home.blade.php +++ b/resources/views/includes/home.blade.php @@ -137,13 +137,13 @@ }); let totalSagInCart = []; - + let totaltagSyarikat = []; let updateSagInCart = function(norujukan){ let isNorujukanIsAlreadyInCart = totalSagInCart.includes(norujukan); if(isNorujukanIsAlreadyInCart){ - totalSagInCart = totalSagInCart.filter(x => x != norujukan); + totalSagInCart = totalSagInCart.filter(x => x != norujukan); } if(! isNorujukanIsAlreadyInCart){ From 4501449bb1af85cbed8ce4c0ccbebdb1c433b182 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Sun, 8 Dec 2024 00:44:38 +0800 Subject: [PATCH 08/81] added personal_carts and put dynamic client --- app/Http/Controllers/BayaranController.php | 73 +++++++++++++++++-- app/Http/Requests/PaymentRequest.php | 28 +++++-- app/Models/PersonalCarts.php | 35 +++++++++ app/Services/BillplzService.php | 52 +++++++++---- config/services.php | 10 ++- .../2024_12_07_012607_create_carts_table.php | 40 ++++++++++ public/js/miscellaneous/cart.js | 22 +++++- .../includes/bayaran/pembayaransag.blade.php | 31 +++----- resources/views/includes/home.blade.php | 60 +++++++++++++-- .../partials/table-pembiayaan.blade.php | 2 +- routes/web.php | 2 + 11 files changed, 296 insertions(+), 59 deletions(-) create mode 100644 app/Models/PersonalCarts.php create mode 100644 database/migrations/2024_12_07_012607_create_carts_table.php diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index 613a2f4..d951121 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -3,6 +3,8 @@ namespace App\Http\Controllers; use App\Http\Requests\PaymentRequest; +use App\Models\CompanyStatus; +use App\Models\PersonalCarts; use App\Models\TransactionOnlineStatus; use App\Services\BillplzService; use Carbon\Carbon; @@ -18,21 +20,57 @@ class BayaranController extends Controller { public function PembayaranAction(PaymentRequest $request) { + + $exist_carts = $this->checkCarts(); + $exist_carts = optional($exist_carts)->toArray(); + + if($exist_carts){ + /* Do Have Carts. */ + $list_pkb = json_decode($exist_carts['list_pkb'],true); + $list_koop = json_decode($exist_carts['list_koop'],true); + + if($exist_carts['status_pkb'] == 'PENDING') $list_pkb = ($list_pkb) ? $this->setUpahTawarruq($list_pkb) : []; else $list_pkb = []; + if($exist_carts['status_koop'] == 'PENDING') $list_koop = ($list_koop) ? $this->setUpahTawarruq($list_koop) : []; else $list_koop = []; + + }else{ + /* Doesn't Have Carts. First Timer */ + $request->validated(); $request->validated(); dd($request->all()); dd($request->getPembiayaanFromNorujukan()); - $arraybayar = $this->setUpahTawarruq($request->getPembiayaanFromNorujukan()); + $request->validated(); + dd($request->all()); + dd($request->getPembiayaanFromNorujukan()); + $arraybayar = $this->setUpahTawarruq($request->getPembiayaanFromNorujukan()); - return view('includes.bayaran.pembayaransag', compact('arraybayar')); + $list_pkb = array_filter(array_map(function ($x){ + return ($x['tag_syarikat'] == CompanyStatus::COM_PKB) ? $x : null; + },$arraybayar)); + + $list_koop = array_filter(array_map(function ($x){ + return ($x['tag_syarikat'] == CompanyStatus::COM_KOOPPKB) ? $x : null; + },$arraybayar)); + + $personal_carts = new PersonalCarts(); + $personal_carts->ic_no = Auth::user()->icno; + $personal_carts->list_koop = json_encode($list_koop); + $personal_carts->list_pkb = json_encode($list_pkb); + $personal_carts->status_pkb = ($list_pkb) ? 'PENDING' : 'NONE'; + $personal_carts->status_koop = ($list_koop) ? 'PENDING' : 'NONE'; + $personal_carts->user_id = Auth::user()->id; + $personal_carts->save(); + } + + return view('includes.bayaran.pembayaransag', compact('list_pkb','list_koop')); } public function PembayaranEngine(Request $request, BillplzService $billplzService) { ['email' => $customerEmail, 'notel' => $customerPhoneNumber, 'name' => $customerName, 'icno' => $customerIcno] = auth()->user()->toArray(); - + // dd($request->all()); $bayaranArrahn = array_filter($request->txtjenisbayaran, fn($x) => $x == 'arrahn'); $bayaranOthers = array_filter($request->txtjenisbayaran, fn($x) => $x != 'arrahn'); - + // dd('test'); $bayaranArrahnArray = array_map(function ($x) use ($customerName, $customerIcno, $request) { return [ 'customer_name' => $customerName, @@ -63,7 +101,8 @@ class BayaranController extends Controller return Money::MYR($sum())->add($billPlzTransactionFee); }; - $bill = $billplzService->createBill([$customerEmail, $customerPhoneNumber, $customerName, $getPaymentSum()]); + $company = strtoupper($request->txtcompany); + $bill = $billplzService->createBill([$customerEmail, $customerPhoneNumber, $customerName, $getPaymentSum()],$company); $isRecordTransactionSuccess = $this->recordTransaction($paymentArray, $bill); @@ -320,4 +359,28 @@ class BayaranController extends Controller return array_map($getUpahTawarruqPerPembiayaan, $pembiayaan); } + + public function checkCarts(){ + $exist_carts = PersonalCarts::where('ic_no', Auth::user()->icno) + ->where('user_id', Auth::user()->id) + ->where(function ($query) { + $query->where('status_pkb', 'PENDING') + ->orWhere('status_koop', 'PENDING'); + }) + ->first(); + + return $exist_carts; + } + + public function removeCarts(){ + $exist_carts = PersonalCarts::where('ic_no', Auth::user()->icno) + ->where('user_id', Auth::user()->id) + ->first(); + + if ($exist_carts) { + $exist_carts->delete(); + } + + return $exist_carts; + } } diff --git a/app/Http/Requests/PaymentRequest.php b/app/Http/Requests/PaymentRequest.php index 9638f70..76c830b 100644 --- a/app/Http/Requests/PaymentRequest.php +++ b/app/Http/Requests/PaymentRequest.php @@ -3,6 +3,7 @@ namespace App\Http\Requests; use App\Http\Controllers\InformationController; +use App\Models\CompanyStatus; use App\Rules\PaymentRules\CawanganPermitUjrahPayment; use App\Rules\PaymentRules\NorujukanBukanFasa2; use App\Rules\PaymentRules\NorujukanContractNotExceed12Month; @@ -54,17 +55,28 @@ class PaymentRequest extends FormRequest public function getPembiayaanFromNorujukan() { $norujukanList = json_decode($this->totalSagInCartInput); - - dd($norujukanList,$this->test); + $syarikatList = json_decode($this->listSyarikatinCartInput); + $filterByStatus = function ($status) use ($norujukanList, $syarikatList) { + return array_filter( + array_map(function ($sag, $index) use ($syarikatList, $status) { + if (isset($syarikatList[$index]) && $syarikatList[$index] == $status) { + $HttpRequest = $status == CompanyStatus::COM_PKB ? Http::arrahn() : Http::arrahn_koop(); + $array_temp = $HttpRequest->get('/api/gadai/norujukan/' . $sag)->json()[0][0] ?? null; + $array_temp['tag_syarikat'] = $status; + return $array_temp; + } + return null; + }, $norujukanList, array_keys($norujukanList)) + ); + }; - // $list_pkb = array_filter($fn($x) => ); - // $list_koop = array_filter($fn($x) => ); + $list_pkb = $filterByStatus(CompanyStatus::COM_PKB); + $list_koop = $filterByStatus(CompanyStatus::COM_KOOPPKB); - $pkb = array_map(fn($x) => Http::arrahn()->get('/api/gadai/norujukan/' . $x)->json()[0][0],$norujukanList); - $koop = array_map(fn($x) => Http::arrahn()->get('/api/gadai/norujukan/' . $x)->json()[0][0],$norujukanList); - - return array_map(fn($x) => Http::arrahn()->get('/api/gadai/norujukan/' . $x)->json()[0][0], $norujukanList); + $array_merged_list = array_merge($list_pkb,$list_koop); + return $array_merged_list; + // return array_map(fn($x) => Http::arrahn()->get('/api/gadai/norujukan/' . $x)->json()[0][0], $norujukanList); } public function getPembiayaanAkanDilelong() diff --git a/app/Models/PersonalCarts.php b/app/Models/PersonalCarts.php new file mode 100644 index 0000000..5059d78 --- /dev/null +++ b/app/Models/PersonalCarts.php @@ -0,0 +1,35 @@ + 'array', + 'list_koop' => 'array', + ]; + + protected $guarded = [ + 'id', + 'ic_no', + 'list_pkb', + 'list_koop', + 'status_pkb', + 'status_koop', + 'user_id', + 'created_at', + 'updated_at' + ]; + + public $timestamps = true; +} diff --git a/app/Services/BillplzService.php b/app/Services/BillplzService.php index ae853f9..3aca74b 100644 --- a/app/Services/BillplzService.php +++ b/app/Services/BillplzService.php @@ -17,21 +17,9 @@ class BillplzService public function __construct() { - $appEnvironment = config('app.env'); - $billplzConfig = $appEnvironment == 'production' ? config('services.billplz.production') : config('services.billplz.sandbox'); - - $client = Client::make($billplzConfig['api_key'], $billplzConfig['x_signature']); - $client->useVersion('v4'); - - if ($appEnvironment != 'production') { - $client->useSandbox(); - } - - $this->callbackUrl = route('pay.callback'); - $this->redirectUrl = ['redirect_url' => route('pay.paymentStatus')]; - $this->paymentTitle = "Pembayaran Ansuran"; - $this->config = $billplzConfig; - $this->client = $client; + $this->setupBillplzClient(); + $this->setupUrls(); + $this->paymentTitle = config('services.billplz.paymentTitle'); } public function getCollections() @@ -39,8 +27,10 @@ class BillplzService return $this->client->collection()->all()->toArray(); } - public function createBill(array $data) + public function createBill(array $data,string $company = 'PKB') { + $this->setupBillplzClient($company); + $composed_data = [ $this->config['collection_id'], ...$data, @@ -252,4 +242,34 @@ class BillplzService { return array_map(fn($x) => $this->client->bill()->get($x)->toArray(), $billIds); } + + protected function setupBillplzClient($company = 'PKB') + { + $appEnvironment = config('app.env'); + + $billplzEnvironments = [ + 'PKB' => ($appEnvironment === 'production') ? config('services.billplz.production') : config('services.billplz.sandbox'), + 'KOPKB' => ($appEnvironment === 'production') ? config('services.billplz.production_kopkb') : config('services.billplz.sandbox_kopkb'), + ]; + + $billplzConfig = $appEnvironment === 'production' + ? ($billplzEnvironments[$company] ?? config('services.billplz.production')) + : ($billplzEnvironments[$company] ?? config('services.billplz.sandbox')); + + $client = Client::make($billplzConfig['api_key'], $billplzConfig['x_signature']); + $client->useVersion('v4'); + + if ($appEnvironment !== 'production') { + $client->useSandbox(); + } + + $this->config = $billplzConfig; + $this->client = $client; + } + + protected function setupUrls() + { + $this->callbackUrl = route('pay.callback'); + $this->redirectUrl = ['redirect_url' => route('pay.paymentStatus')]; + } } diff --git a/config/services.php b/config/services.php index 6995833..4af2e26 100644 --- a/config/services.php +++ b/config/services.php @@ -31,20 +31,26 @@ return [ ], 'billplz' => [ + 'paymentTitle' => 'Pembayaran Ansuran', 'production' => [ 'api_key' => env('BILLPLZ_PRODUCTION_API_KEY', 'f3e82fe1-a422-4660-97f0-65cc59ff6c47'), 'x_signature' => env('BILLPLZ_PRODUCTION_X_SIGNATURE', 'S-alZUbzmD2_TF3vmrRqgehQ'), 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', '5aosv2dg'), ], + 'production_kopkb' => [ + 'api_key' => env('BILLPLZ_PRODUCTION_API_KEY', 'f3e82fe1-a422-4660-97f0-65cc59ff6c47'), + 'x_signature' => env('BILLPLZ_PRODUCTION_X_SIGNATURE', 'S-alZUbzmD2_TF3vmrRqgehQ'), + 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', '5aosv2dg'), + ], 'sandbox' => [ 'api_key' => env('BILLPLZ_SANDBOX_API_KEY', 'abecfd0c-98d8-4635-abc2-2fcba8c60c11'), 'x_signature' => env('BILLPLZ_SANDBOX_X_SIGNATURE', 'S-GWr7z03XjAhqPsFfu_H5nQ'), - 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', 'z0r4kjhi'), + 'collection_id' => env('BILLPLZ_SANDBOX_COLLECTION_ID', 'z0r4kjhi'), ], 'sandbox_kopkb' => [ 'api_key' => env('BILLPLZ_SANDBOX_KOPKB_API_KEY', 'abecfd0c-98d8-4635-abc2-2fcba8c60c11'), 'x_signature' => env('BILLPLZ_SANDBOX_KOPKB_X_SIGNATURE', 'S-GWr7z03XjAhqPsFfu_H5nQ'), - 'collection_id' => env('BILLPLZ_PRODUCTION_KOPKB_COLLECTION_ID', 'z0r4kjhi'), + 'collection_id' => env('BILLPLZ_SANDBOX_KOPKB_COLLECTION_ID', 'z0r4kjhi'), ], ], diff --git a/database/migrations/2024_12_07_012607_create_carts_table.php b/database/migrations/2024_12_07_012607_create_carts_table.php new file mode 100644 index 0000000..3ee51e4 --- /dev/null +++ b/database/migrations/2024_12_07_012607_create_carts_table.php @@ -0,0 +1,40 @@ +id(); + $table->string('ic_no'); + $table->json('list_pkb'); + $table->json('list_koop'); + $table->enum('status_pkb', ['PENDING', 'PAID','NONE']); + $table->enum('status_koop', ['PENDING', 'PAID','NONE']); + $table->softDeletes(); + $table->unsignedBigInteger('user_id'); + $table->timestamps(); + + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('personal_carts'); + } +} diff --git a/public/js/miscellaneous/cart.js b/public/js/miscellaneous/cart.js index d17232e..c4bd78e 100644 --- a/public/js/miscellaneous/cart.js +++ b/public/js/miscellaneous/cart.js @@ -17,16 +17,36 @@ radios.forEach((radio) => { let btn_payment = document.getElementById('bayarsbmt'); let content1 = document.getElementById('divpkb'); let content2 = document.getElementById('divkopkb'); - + let whole_total = document.getElementById('spanjumlah'); + let inputs = document.querySelectorAll(`#div${this.value} input[type="number"]`); + let values = Array.from(inputs).map(input => parseFloat(input.value) || 0).reduce((sum,value) => sum + value, 0); + if (this.checked) { if(this.value == 'kopkb'){ + let inputsdisabled = document.querySelectorAll(`#divpkb input:not([type="radio"])`); + inputsdisabled.forEach(input => { + input.disabled = true; + }); + inputs.forEach(input =>{ + input.disabled = false; + }); content1.classList.add('blurred'); content2.classList.remove('blurred'); btn_payment.disabled = false; + whole_total.innerHTML = values + 1; + }else{ + let inputsdisabled = document.querySelectorAll(`#divkopkb input:not([type="radio"])`); + inputsdisabled.forEach(input => { + input.disabled = true; + }); + inputs.forEach(input =>{ + input.disabled = false; + }); content2.classList.add('blurred'); content1.classList.remove('blurred'); btn_payment.disabled = false; + whole_total.innerHTML = values + 1; } } diff --git a/resources/views/includes/bayaran/pembayaransag.blade.php b/resources/views/includes/bayaran/pembayaransag.blade.php index 42b858e..aabab50 100644 --- a/resources/views/includes/bayaran/pembayaransag.blade.php +++ b/resources/views/includes/bayaran/pembayaransag.blade.php @@ -34,6 +34,7 @@
+ @if($list_pkb)
@@ -56,7 +57,7 @@ @php $counter = 1;$jenisbayaran = 'tawarruq'; $totalupahasal = 1; $errorcount = 0; @endphp - @foreach($arraybayar as $index=>$bayar) + @foreach($list_pkb as $index=>$bayar) @if($bayar['hargajualan'] != '') @@ -94,6 +95,7 @@ + @@ -109,29 +111,13 @@
- {{--
-
- -
- -
- RM1.00 -
-
-
-
- -
- -
- RM{{ number_format($totalupahasal,2) }} -
-
--}} *Jangan biarkan kotak bayaran ditinggalkan kosong, Sila masukkan amaun!
+ @endif + @if($list_koop)
@@ -155,7 +141,7 @@ @php $counter = 1;$jenisbayaran = 'tawarruq'; $totalupahasal = 1; $errorcount = 0; @endphp - @foreach($arraybayar as $index=>$bayar) + @foreach($list_koop as $index=>$bayar) @if($bayar['hargajualan'] != '') @@ -193,6 +179,8 @@ + + @@ -212,6 +200,7 @@ *Jangan biarkan kotak bayaran ditinggalkan kosong, Sila masukkan amaun!
+ @endif
@@ -241,7 +230,7 @@
- RM{{ number_format($totalupahasal,2) }} + RM1.00
diff --git a/resources/views/includes/home.blade.php b/resources/views/includes/home.blade.php index 68eb105..36aeaa0 100644 --- a/resources/views/includes/home.blade.php +++ b/resources/views/includes/home.blade.php @@ -138,26 +138,32 @@ let totalSagInCart = []; let totaltagSyarikat = []; - let updateSagInCart = function(norujukan){ - + let updateSagInCart = function(norujukan,syarikat){ + console.log(norujukan,syarikat); let isNorujukanIsAlreadyInCart = totalSagInCart.includes(norujukan); if(isNorujukanIsAlreadyInCart){ + let index = totalSagInCart.indexOf(norujukan); totalSagInCart = totalSagInCart.filter(x => x != norujukan); - } + totaltagSyarikat.splice(index, 1); + } if(! isNorujukanIsAlreadyInCart){ totalSagInCart.push(norujukan); + totaltagSyarikat.push(syarikat); } + console.log("total:" + totalSagInCart); + console.log("totalsyarikat:" + totaltagSyarikat); }; // Add event listener to checkboxes to update total count customer wants to pay $('#main-table').on('input', 'input[type="checkbox"][name="chkboxsag[]"]', function(el) { let norujukan = el.target.dataset.norujukan; + let tagsyarikat = el.target.dataset.syarikat; let isNorujukanIsChecked = el.target.checked; - updateSagInCart(norujukan); + updateSagInCart(norujukan,tagsyarikat); document.getElementById('totalsag').innerHTML = totalSagInCart.length; }); @@ -172,7 +178,51 @@ totalSagInCartInput.value = JSON.stringify(totalSagInCart); event.target.appendChild(totalSagInCartInput); - event.target.submit(); + let listSyarikatinCartInput = document.createElement('input'); + listSyarikatinCartInput.type = 'hidden'; + listSyarikatinCartInput.name = 'listSyarikatinCartInput'; + listSyarikatinCartInput.value = JSON.stringify(totaltagSyarikat); + event.target.appendChild(listSyarikatinCartInput); + + let check_carts = fetch('/showcarts-available') + .then(response => { + console.log(response); + if (!response.ok) { + throw new Error('HTTP error ' + response.status); + } + return response.json(); + }) + .then(data => console.log(data)) + .catch(error => console.error(error)); + + if(check_carts){ + Swal.fire({ + title: "Troli Anda Masih Ada Lagi?", + showDenyButton: true, + showCancelButton: false, + confirmButtonText: "Pergi Ke Troli", + denyButtonText: `Buang Troli` + }).then((result) => { + /* Read more about isConfirmed, isDenied below */ + if (result.isDenied) { + let remove_carts = fetch('/deletecarts') + .then(response => { + console.log(response); + if (!response.ok) { + throw new Error('HTTP error ' + response.status); + } + return response.json(); + }) + .then(data => console.log(data)) + .catch(error => console.error(error)); + + } + event.target.submit(); + }); + console.log(check_carts); + }else{ + event.target.submit(); + } }); diff --git a/resources/views/includes/partials/table-pembiayaan.blade.php b/resources/views/includes/partials/table-pembiayaan.blade.php index c1af081..f82c398 100644 --- a/resources/views/includes/partials/table-pembiayaan.blade.php +++ b/resources/views/includes/partials/table-pembiayaan.blade.php @@ -16,7 +16,7 @@ disabled_payment ? 'disabled' : '' }} /> + data-syarikat="{{ $data->tag_syarikat }}" {{ $data->disabled_payment ? 'disabled' : '' }} /> diff --git a/routes/web.php b/routes/web.php index 3529cc4..29bd693 100644 --- a/routes/web.php +++ b/routes/web.php @@ -125,6 +125,8 @@ Route::get('/requesticfe', 'App\Http\Controllers\TacController@requestKadPengena Route::get('/requesttac', 'App\Http\Controllers\TacController@TACrequest')->name('requesttac'); Route::get('/requesttacfe', 'App\Http\Controllers\TacController@TACrequestfe')->name('requesttacfe'); +Route::get('/showcarts-available','App\Http\Controllers\BayaranController@checkCarts')->name('checkcarts'); +Route::get('/deletecarts','App\Http\Controllers\BayaranController@removeCarts')->name('removecarts'); Route::get('download/manualpengguna',['as'=>'miscellaneous.manualpengguna', function(){ if (Storage::disk('miscellaneous')->exists('Manual_Pengguna.pdf')) { From 09e0afbd845c2db59b0efc9cec766aea67374855 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 8 Dec 2024 22:00:52 +0800 Subject: [PATCH 09/81] added split of payment --- app/Http/Controllers/BayaranController.php | 67 +++++++++++++--------- app/Services/BillplzService.php | 36 ++++++++++-- config/services.php | 6 +- public/js/miscellaneous/cart.js | 7 ++- 4 files changed, 78 insertions(+), 38 deletions(-) diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index d951121..684a50d 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -15,9 +15,12 @@ use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; use Money\Money; use App\Services\OnlineTransactionLoggerService; +use Illuminate\Support\Facades\Session; class BayaranController extends Controller { + public $CallableHttp; + public function PembayaranAction(PaymentRequest $request) { @@ -34,13 +37,8 @@ class BayaranController extends Controller }else{ /* Doesn't Have Carts. First Timer */ - $request->validated(); - $request->validated(); - dd($request->all()); - dd($request->getPembiayaanFromNorujukan()); $request->validated(); - dd($request->all()); - dd($request->getPembiayaanFromNorujukan()); + $arraybayar = $this->setUpahTawarruq($request->getPembiayaanFromNorujukan()); $list_pkb = array_filter(array_map(function ($x){ @@ -67,10 +65,10 @@ class BayaranController extends Controller public function PembayaranEngine(Request $request, BillplzService $billplzService) { ['email' => $customerEmail, 'notel' => $customerPhoneNumber, 'name' => $customerName, 'icno' => $customerIcno] = auth()->user()->toArray(); - // dd($request->all()); + $bayaranArrahn = array_filter($request->txtjenisbayaran, fn($x) => $x == 'arrahn'); $bayaranOthers = array_filter($request->txtjenisbayaran, fn($x) => $x != 'arrahn'); - // dd('test'); + $bayaranArrahnArray = array_map(function ($x) use ($customerName, $customerIcno, $request) { return [ 'customer_name' => $customerName, @@ -103,8 +101,11 @@ class BayaranController extends Controller $company = strtoupper($request->txtcompany); $bill = $billplzService->createBill([$customerEmail, $customerPhoneNumber, $customerName, $getPaymentSum()],$company); + + Session::put('company', $company); + $this->serviceCallHttp($company); - $isRecordTransactionSuccess = $this->recordTransaction($paymentArray, $bill); + $isRecordTransactionSuccess = $this->recordTransaction($paymentArray, $bill,$company); if ($isRecordTransactionSuccess) { session([ @@ -116,12 +117,12 @@ class BayaranController extends Controller } } - public function recordTransaction($paymentArray, $bill) + public function recordTransaction($paymentArray, $bill,$company = 'PKB') { ['name' => $customerName, 'icno' => $customerIcno] = auth()->user()->toArray(); $getlatestNoSiri = function () { - $previous_siri = Http::arrahn()->get('/api/online/transaction')->json(); + $previous_siri = $this->CallableHttp->get('/api/online/transaction')->json(); if ($previous_siri) { return $previous_siri['nosiri'] + 1; } else { @@ -135,10 +136,13 @@ class BayaranController extends Controller return 'APKB' . $day . $month . $year . sprintf('%08d', $getlatestNoSiri()); }; + $serviceCallable = $company == 'PKB' + ? fn(Pool $pool) => $pool->arrahn() + : fn(Pool $pool) => $pool->arrahn_koop(); try { Http::pool( fn(Pool $pool) => collect($paymentArray)->map( - fn($payment) => $pool->arrahn()->post('/api/online/transaction', [ + fn($payment) => $serviceCallable($pool)->post('/api/online/transaction', [ 'nokp' => $customerIcno, 'reference_no' => $generateTransactionReferenceNumber(), 'nosiri' => $getlatestNoSiri(), @@ -162,7 +166,7 @@ class BayaranController extends Controller } try { - $response = Http::arrahn() + $response = $this->CallableHttp ->put('/api/transaction/online/tagportal', [ 'billplz_id' => $bill['id'], ]) @@ -182,11 +186,12 @@ class BayaranController extends Controller public function ResitBayaran(Request $request) { + $this->serviceCallHttp(Session::get('company')); $payment_details = $request->payment; $kpbaru = Auth::User()->icno; - $customer = Http::arrahn() + $customer = $this->CallableHttp ->get('/api/customers/' . $kpbaru) ->json(); $customer_details = $customer; @@ -195,16 +200,16 @@ class BayaranController extends Controller $current = new Carbon(); $date = $current->toDateTimeString(); - $cawangan_info = Http::arrahn() + $cawangan_info = $this->CallableHttp ->get('/api/cawangan/' . $payment_details['kodcaw']) ->json(); - $cawangan = Http::arrahn() + $cawangan = $this->CallableHttp ->get('/api/cawangan/detail/' . $payment_details['kodcaw']) ->json(); $cawangan_detail = $cawangan[0]; $nama_cawangan = $cawangan_info['details_caw']; - $gadai_details = Http::arrahn() + $gadai_details = $this->CallableHttp ->get('/api/gadai/norujukan/' . $payment_details['norujukan']) ->json(); $gadai = $gadai_details[0][0]; @@ -219,7 +224,7 @@ class BayaranController extends Controller $isBillUnpaid = $data['paid'] !== true; if ($isBillUnpaid) { - Http::arrahn()->put('/api/online/transaction', [ + $this->CallableHttp->put('/api/online/transaction', [ 'billplz_id' => $data['id'], 'status' => 'UNSUCCESSFUL', 'paid_at' => null, @@ -228,7 +233,7 @@ class BayaranController extends Controller return response(200); } - Http::arrahn()->put('/api/online/transaction', [ + $this->CallableHttp->put('/api/online/transaction', [ 'billplz_id' => $data['id'], 'status' => 'PAID', 'paid_at' => $data['paid_at']->format('Y-m-d H:i:s'), @@ -240,17 +245,17 @@ class BayaranController extends Controller public function response(Request $request, BillplzService $billplzService) { $data = $billplzService->redirect($request->toArray()); - + $this->serviceCallHttp($billplzService->company); $isBillUnpaid = $data['paid'] !== true; if ($isBillUnpaid) { - Http::arrahn()->put('/api/online/transaction', [ + $this->CallableHttp->put('/api/online/transaction', [ 'billplz_id' => $data['id'], 'status' => 'UNSUCCESSFUL', 'paid_at' => null, ]); - $transactionOnline = Http::arrahn() + $transactionOnline = $this->CallableHttp ->get('/api/transaction/online/login', [ 'billplz_id' => $data['id'], ]) @@ -259,13 +264,13 @@ class BayaranController extends Controller return redirect()->route('pay.failed'); } - Http::arrahn()->put('/api/online/transaction', [ + $this->CallableHttp->put('/api/online/transaction', [ 'billplz_id' => $data['id'], 'status' => 'PAID', 'paid_at' => $data['paid_at']->format('Y-m-d H:i:s'), ]); - $transactionOnline = Http::arrahn() + $transactionOnline = $this->CallableHttp ->get('/api/transaction/online/login', [ 'billplz_id' => $data['id'], ]) @@ -278,17 +283,18 @@ class BayaranController extends Controller public function successPayment(Request $request) { + $this->serviceCallHttp(Session::get('company')); $transactionOnline = $request->transactionOnline; $arraygadai = array_map( - fn($x) => Http::arrahn() + fn($x) => $this->CallableHttp ->get('/api/gadai/norujukan/' . $x['norujukan']) ->json()[0][0], $transactionOnline, ); $arraycawangan = array_map( - fn($x) => Http::arrahn() + fn($x) => $this->CallableHttp ->get('/api/cawangan/detail/' . $x['kodcaw']) ->json()[0], $transactionOnline, @@ -310,7 +316,7 @@ class BayaranController extends Controller $auth_user = Auth::user(); - $belum_tebus = Http::arrahn() + $belum_tebus = $this->CallableHttp ->get('/api/customers/' . $auth_user['icno'] . '/gadai/' . 'belum_tebus') ->json(); @@ -383,4 +389,11 @@ class BayaranController extends Controller return $exist_carts; } + + public function serviceCallHttp($company){ + $this->CallableHttp = $company == 'PKB' + ? Http::arrahn() + : Http::arrahn_koop(); + + } } diff --git a/app/Services/BillplzService.php b/app/Services/BillplzService.php index 3aca74b..5010902 100644 --- a/app/Services/BillplzService.php +++ b/app/Services/BillplzService.php @@ -6,6 +6,8 @@ use App\Models\TransactionOnlineStatus; use Billplz\Client; use Carbon\Carbon; use Illuminate\Support\Facades\Http; +use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Session; class BillplzService { @@ -14,10 +16,12 @@ class BillplzService public $callbackUrl; public $paymentTitle; public $redirectUrl; + public $company; - public function __construct() + public function __construct(string $company) { - $this->setupBillplzClient(); + $this->company = $company; + $this->setupBillplzClient($company); $this->setupUrls(); $this->paymentTitle = config('services.billplz.paymentTitle'); } @@ -27,9 +31,12 @@ class BillplzService return $this->client->collection()->all()->toArray(); } - public function createBill(array $data,string $company = 'PKB') + public function createBill(array $data,string $company) { + Session::put('company',$company); + $this->setCompany($company); $this->setupBillplzClient($company); + // dd($company,$this->config); $composed_data = [ $this->config['collection_id'], @@ -67,6 +74,8 @@ class BillplzService public function redirect($request) { + $this->setCompany(Session::get('company')); + $this->setupBillplzClient($this->company); try{ $response = $this->client->bill()->redirect($request); @@ -84,6 +93,8 @@ class BillplzService public function webhook($request) { + $this->setCompany(Session::get('company')); + $this->setupBillplzClient($this->company); try { $response = $this->client->webhook($request); @@ -243,7 +254,7 @@ class BillplzService return array_map(fn($x) => $this->client->bill()->get($x)->toArray(), $billIds); } - protected function setupBillplzClient($company = 'PKB') + protected function setupBillplzClient($company) { $appEnvironment = config('app.env'); @@ -255,8 +266,10 @@ class BillplzService $billplzConfig = $appEnvironment === 'production' ? ($billplzEnvironments[$company] ?? config('services.billplz.production')) : ($billplzEnvironments[$company] ?? config('services.billplz.sandbox')); - - $client = Client::make($billplzConfig['api_key'], $billplzConfig['x_signature']); + + Log::info($company); + Log::info($this->isBase64($billplzConfig['x_signature'])); + $client = Client::make($billplzConfig['api_key'], ($this->isBase64($billplzConfig['x_signature'])) ? $billplzConfig['x_signature'] : base64_encode($billplzConfig['x_signature'])); $client->useVersion('v4'); if ($appEnvironment !== 'production') { @@ -272,4 +285,15 @@ class BillplzService $this->callbackUrl = route('pay.callback'); $this->redirectUrl = ['redirect_url' => route('pay.paymentStatus')]; } + + protected function setCompany($company = 'PKB'){ + $this->company = $company; + } + + protected function isBase64($string) { + if (preg_match('/^[A-Za-z0-9+\/=]+$/', $string)) { + return base64_encode(base64_decode($string, true)) === $string; + } + return false; + } } diff --git a/config/services.php b/config/services.php index 4af2e26..95874ea 100644 --- a/config/services.php +++ b/config/services.php @@ -48,9 +48,9 @@ return [ 'collection_id' => env('BILLPLZ_SANDBOX_COLLECTION_ID', 'z0r4kjhi'), ], 'sandbox_kopkb' => [ - 'api_key' => env('BILLPLZ_SANDBOX_KOPKB_API_KEY', 'abecfd0c-98d8-4635-abc2-2fcba8c60c11'), - 'x_signature' => env('BILLPLZ_SANDBOX_KOPKB_X_SIGNATURE', 'S-GWr7z03XjAhqPsFfu_H5nQ'), - 'collection_id' => env('BILLPLZ_SANDBOX_KOPKB_COLLECTION_ID', 'z0r4kjhi'), + 'api_key' => env('BILLPLZ_SANDBOX_KOPKB_API_KEY', '4b9218fd-04fb-4338-a067-982e6730d160'), + 'x_signature' => env('BILLPLZ_SANDBOX_KOPKB_X_SIGNATURE', '0ac6e5438cf729754bb819860ed7de6d87d79b0d183212bf10581fca39a4c2d992697b605a706118032af37d31a85fed6637ff1233c56e6d2421bc22cca9d710'), + 'collection_id' => env('BILLPLZ_SANDBOX_KOPKB_COLLECTION_ID', 'uae40muk'), ], ], diff --git a/public/js/miscellaneous/cart.js b/public/js/miscellaneous/cart.js index c4bd78e..3aef8e0 100644 --- a/public/js/miscellaneous/cart.js +++ b/public/js/miscellaneous/cart.js @@ -24,10 +24,11 @@ radios.forEach((radio) => { if (this.checked) { if(this.value == 'kopkb'){ let inputsdisabled = document.querySelectorAll(`#divpkb input:not([type="radio"])`); + let inputenabled = document.querySelectorAll(`#divkopkb input`); inputsdisabled.forEach(input => { input.disabled = true; }); - inputs.forEach(input =>{ + inputenabled.forEach(input =>{ input.disabled = false; }); content1.classList.add('blurred'); @@ -37,10 +38,12 @@ radios.forEach((radio) => { }else{ let inputsdisabled = document.querySelectorAll(`#divkopkb input:not([type="radio"])`); + let inputenabled = document.querySelectorAll(`#divpkb input`); + inputsdisabled.forEach(input => { input.disabled = true; }); - inputs.forEach(input =>{ + inputenabled.forEach(input =>{ input.disabled = false; }); content2.classList.add('blurred'); From 6919f75abf5beeff188cd492f2369c7dbad99431 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Mon, 9 Dec 2024 00:21:04 +0800 Subject: [PATCH 10/81] added cursor pointer into trolley at homepage that redirect to trolley page --- app/Http/Controllers/BayaranController.php | 47 +++++++++++++++++-- app/Http/Requests/PaymentRequest.php | 4 ++ app/Services/BillplzService.php | 16 +------ .../views/includes/main/navigation.blade.php | 24 +++++++++- .../pembayaran/result/berjayaportal.blade.php | 38 ++++++++++++++- 5 files changed, 109 insertions(+), 20 deletions(-) diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index 684a50d..69e0fcd 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -62,7 +62,7 @@ class BayaranController extends Controller return view('includes.bayaran.pembayaransag', compact('list_pkb','list_koop')); } - public function PembayaranEngine(Request $request, BillplzService $billplzService) + public function PembayaranEngine(Request $request) { ['email' => $customerEmail, 'notel' => $customerPhoneNumber, 'name' => $customerName, 'icno' => $customerIcno] = auth()->user()->toArray(); @@ -100,6 +100,7 @@ class BayaranController extends Controller }; $company = strtoupper($request->txtcompany); + $billplzService = new BillplzService($company); $bill = $billplzService->createBill([$customerEmail, $customerPhoneNumber, $customerName, $getPaymentSum()],$company); Session::put('company', $company); @@ -217,8 +218,9 @@ class BayaranController extends Controller return view('pembayaran.resit.resitportal', compact('customer_details', 'payment_details', 'cawangan_detail', 'nama_cawangan', 'gadai')); } - public function callback(Request $request, BillplzService $billplzService) + public function callback(Request $request) { + $billplzService = new BillplzService(Session::get('company')); $data = $billplzService->webhook($request->toArray()); $isBillUnpaid = $data['paid'] !== true; @@ -239,11 +241,25 @@ class BayaranController extends Controller 'paid_at' => $data['paid_at']->format('Y-m-d H:i:s'), ]); + $column_updated = (Session::get('company') == 'PKB') ? 'status_pkb' : 'status_koop'; + $value_paid = 'PAID'; + + $exist_carts = PersonalCarts::where('ic_no', Auth::user()->icno) + ->where('user_id', Auth::user()->id) + ->where(function ($query) { + $query->where('status_pkb', 'PENDING') + ->orWhere('status_koop', 'PENDING'); + }) + ->update([ + $column_updated => $value_paid, + ]); + return response(200); } - public function response(Request $request, BillplzService $billplzService) + public function response(Request $request) { + $billplzService = new BillplzService(Session::get('company')); $data = $billplzService->redirect($request->toArray()); $this->serviceCallHttp($billplzService->company); $isBillUnpaid = $data['paid'] !== true; @@ -270,6 +286,19 @@ class BayaranController extends Controller 'paid_at' => $data['paid_at']->format('Y-m-d H:i:s'), ]); + $column_updated = (Session::get('company') == 'PKB') ? 'status_pkb' : 'status_koop'; + $value_paid = 'PAID'; + + $exist_carts = PersonalCarts::where('ic_no', Auth::user()->icno) + ->where('user_id', Auth::user()->id) + ->where(function ($query) { + $query->where('status_pkb', 'PENDING') + ->orWhere('status_koop', 'PENDING'); + }) + ->update([ + $column_updated => $value_paid, + ]); + $transactionOnline = $this->CallableHttp ->get('/api/transaction/online/login', [ 'billplz_id' => $data['id'], @@ -300,7 +329,17 @@ class BayaranController extends Controller $transactionOnline, ); - return view('pembayaran.result.berjayaportal', compact('transactionOnline', 'arraycawangan', 'arraygadai')); + $exist_carts = PersonalCarts::where('ic_no', Auth::user()->icno) + ->where('user_id', Auth::user()->id) + ->where(function ($query) { + $query->where('status_pkb', 'PENDING') + ->orWhere('status_koop', 'PENDING'); + }) + ->first(); + + $exist_carts = optional($exist_carts)->toArray(); + + return view('pembayaran.result.berjayaportal', compact('transactionOnline', 'arraycawangan', 'arraygadai','exist_carts')); } public function failedPayment() diff --git a/app/Http/Requests/PaymentRequest.php b/app/Http/Requests/PaymentRequest.php index 76c830b..a0cf18a 100644 --- a/app/Http/Requests/PaymentRequest.php +++ b/app/Http/Requests/PaymentRequest.php @@ -54,6 +54,10 @@ class PaymentRequest extends FormRequest public function getPembiayaanFromNorujukan() { + if(null !== $this->input('redirect_trolley') && $this->input('redirect_trolley') == 'trolley'){ + return []; + } + $norujukanList = json_decode($this->totalSagInCartInput); $syarikatList = json_decode($this->listSyarikatinCartInput); diff --git a/app/Services/BillplzService.php b/app/Services/BillplzService.php index 5010902..ebd64d0 100644 --- a/app/Services/BillplzService.php +++ b/app/Services/BillplzService.php @@ -33,10 +33,6 @@ class BillplzService public function createBill(array $data,string $company) { - Session::put('company',$company); - $this->setCompany($company); - $this->setupBillplzClient($company); - // dd($company,$this->config); $composed_data = [ $this->config['collection_id'], @@ -74,8 +70,6 @@ class BillplzService public function redirect($request) { - $this->setCompany(Session::get('company')); - $this->setupBillplzClient($this->company); try{ $response = $this->client->bill()->redirect($request); @@ -93,8 +87,8 @@ class BillplzService public function webhook($request) { - $this->setCompany(Session::get('company')); - $this->setupBillplzClient($this->company); + // $this->setCompany(Session::get('company')); + // $this->setupBillplzClient($this->company); try { $response = $this->client->webhook($request); @@ -267,8 +261,6 @@ class BillplzService ? ($billplzEnvironments[$company] ?? config('services.billplz.production')) : ($billplzEnvironments[$company] ?? config('services.billplz.sandbox')); - Log::info($company); - Log::info($this->isBase64($billplzConfig['x_signature'])); $client = Client::make($billplzConfig['api_key'], ($this->isBase64($billplzConfig['x_signature'])) ? $billplzConfig['x_signature'] : base64_encode($billplzConfig['x_signature'])); $client->useVersion('v4'); @@ -285,10 +277,6 @@ class BillplzService $this->callbackUrl = route('pay.callback'); $this->redirectUrl = ['redirect_url' => route('pay.paymentStatus')]; } - - protected function setCompany($company = 'PKB'){ - $this->company = $company; - } protected function isBase64($string) { if (preg_match('/^[A-Za-z0-9+\/=]+$/', $string)) { diff --git a/resources/views/includes/main/navigation.blade.php b/resources/views/includes/main/navigation.blade.php index 3ebd3c2..c6609d3 100644 --- a/resources/views/includes/main/navigation.blade.php +++ b/resources/views/includes/main/navigation.blade.php @@ -109,10 +109,32 @@
--> + + +
@@ -111,30 +114,8 @@
-
-
+
+
@if($list_pkb)
@@ -203,7 +223,7 @@ @endif
-
@@ -507,6 +561,7 @@ $("#spanbayaranarrahn").text(sumarrahn.toFixed(2)); $("#spanbayarantawarruq").text(sumtawarruq.toFixed(2)); $('#spanjumlah').text(formatter.format(sum + 1)); + $('#spanjumlah-phone').text(formatter.format(sum + 1)); } if (document.addEventListener) { From 4e4c9ecaddaa67a136fd74c82751b3126719c2c0 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Wed, 11 Dec 2024 07:31:47 +0800 Subject: [PATCH 14/81] buat pembayaran untuk phone boleh letak --- app/Http/Controllers/BayaranController.php | 14 ++- public/js/miscellaneous/cart.js | 21 +++++ public/js/miscellaneous/navigation-trolley.js | 19 ++-- .../includes/bayaran/pembayaransag.blade.php | 93 ++++++++----------- resources/views/includes/home.blade.php | 40 ++++---- .../views/includes/main/navigation.blade.php | 2 +- routes/web.php | 2 +- 7 files changed, 109 insertions(+), 82 deletions(-) diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index 69e0fcd..9b15fe2 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -417,6 +417,18 @@ class BayaranController extends Controller return $exist_carts; } + public function UserCheckCarts(){ + $exist_carts = PersonalCarts::where('ic_no', Auth::user()->icno) + ->where('user_id', Auth::user()->id) + ->where(function ($query) { + $query->where('status_pkb', 'PENDING') + ->orWhere('status_koop', 'PENDING'); + }) + ->first(); + + return response()->json($exist_carts); + } + public function removeCarts(){ $exist_carts = PersonalCarts::where('ic_no', Auth::user()->icno) ->where('user_id', Auth::user()->id) @@ -426,7 +438,7 @@ class BayaranController extends Controller $exist_carts->delete(); } - return $exist_carts; + return response()->json($exist_carts); } public function serviceCallHttp($company){ diff --git a/public/js/miscellaneous/cart.js b/public/js/miscellaneous/cart.js index 6123a7b..ee6df57 100644 --- a/public/js/miscellaneous/cart.js +++ b/public/js/miscellaneous/cart.js @@ -66,3 +66,24 @@ radios.forEach((radio) => { }); }); +let deleteCarts = () => { + fetch('/deletecarts') + .then(response => { + if (!response.ok) { + throw new Error('HTTP error ' + response.status); + } + return response.json(); + }) + .then(data => { + console.log(data); + if (data) { + redirect_home(); + } + }) + .catch(error => console.error(error)); +} + +let redirect_home = () => { + window.location.href = redirect_home_var; +} + diff --git a/public/js/miscellaneous/navigation-trolley.js b/public/js/miscellaneous/navigation-trolley.js index c4914e7..6d951eb 100644 --- a/public/js/miscellaneous/navigation-trolley.js +++ b/public/js/miscellaneous/navigation-trolley.js @@ -1,6 +1,5 @@ async function fetchCartCount() { try { - // Replace with your API endpoint const response = await fetch('/showcarts-available'); if (!response.ok) { @@ -8,35 +7,39 @@ async function fetchCartCount() { } const data = await response.json(); - console.log(data.status_koop); let totalcount = 0; totalcount += (data.status_koop === 'PENDING') ? 1 : 0; totalcount += (data.status_pkb === 'PENDING') ? 1 : 0; - // Assuming the API returns a JSON object with a `count` property const cartCount = totalcount || 0; updateCartCount(cartCount); } catch (error) { console.error('Error fetching cart count:', error); - // Optionally, handle error (e.g., show default value or retry) updateCartCount(0); } } function updateCartCount(itemCount) { const cartCountElement = document.getElementById('cart-count'); + const ahrefRedirect = document.getElementById('a-redirect'); if (itemCount > 0) { - cartCountElement.textContent = itemCount; // Show the number of items - cartCountElement.classList.remove('d-none'); // Ensure it is visible + cartCountElement.textContent = itemCount; + cartCountElement.classList.remove('d-none'); } else { - cartCountElement.textContent = ''; // Clear the content - cartCountElement.classList.add('d-none'); // Hide the element if the cart is empty + cartCountElement.textContent = ''; + cartCountElement.classList.add('d-none'); + } } function redirectTrolley() { + const cartCountElement = document.getElementById('cart-count'); + if(cartCountElement.textContent == 0){ + return false; + } + let form = document.createElement('form'); form.method = 'POST'; form.action = routetrolley; diff --git a/resources/views/includes/bayaran/pembayaransag.blade.php b/resources/views/includes/bayaran/pembayaransag.blade.php index cd9e50f..046b600 100644 --- a/resources/views/includes/bayaran/pembayaransag.blade.php +++ b/resources/views/includes/bayaran/pembayaransag.blade.php @@ -36,6 +36,7 @@ } } + Bayar SAG | Portal Pelanggan
@@ -151,7 +152,7 @@
- +
@@ -264,7 +265,7 @@
- Batal  + Batal  @if($totalupahasal == 1.00 || $errorcount > 0) @@ -276,7 +277,7 @@
- + *sila klik bayar untuk transaksi bayaran berikutnya. diff --git a/resources/views/pembayaran/senaraibayaran.blade.php b/resources/views/pembayaran/senaraibayaran.blade.php index 52a41aa..5339445 100644 --- a/resources/views/pembayaran/senaraibayaran.blade.php +++ b/resources/views/pembayaran/senaraibayaran.blade.php @@ -190,7 +190,7 @@ } } - $koskeuntungan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/upahtawarruq/' . $bt['kodcaw'] . '/' . $bt['norujukan'])->json(); + $koskeuntungan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/upahtawarruq/' . $bt['kodcaw'] . '/' . $bt['norujukan'],['jeniskeuntungan' => ($bt['tagbaru'] == 1) ? 'onepercent' : 'asal'])->json(); $keuntungan_1bln = $bt['pinjaman'] * ($bt['kadarupah'] / 100); $ten_percent = floatval($bt['nilaimarhun']) * 0.1; $baki_pinjaman = floatval($bt['bakipjm']); From a982cb8c4d7ce52f845759c3b8d76d99a185550f Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Mon, 6 Jan 2025 21:44:25 +0800 Subject: [PATCH 19/81] added production code --- config/services.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/services.php b/config/services.php index 95874ea..3d1972a 100644 --- a/config/services.php +++ b/config/services.php @@ -38,9 +38,9 @@ return [ 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', '5aosv2dg'), ], 'production_kopkb' => [ - 'api_key' => env('BILLPLZ_PRODUCTION_API_KEY', 'f3e82fe1-a422-4660-97f0-65cc59ff6c47'), - 'x_signature' => env('BILLPLZ_PRODUCTION_X_SIGNATURE', 'S-alZUbzmD2_TF3vmrRqgehQ'), - 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', '5aosv2dg'), + 'api_key' => env('BILLPLZ_PRODUCTION_API_KEY', 'f4e099e5-88ca-4712-a01e-b7e1daf78ce2'), + 'x_signature' => env('BILLPLZ_PRODUCTION_X_SIGNATURE', 'S-OApBh3DIwelPcWPzlMLMeg'), + 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', 'do6x2mhg'), ], 'sandbox' => [ 'api_key' => env('BILLPLZ_SANDBOX_API_KEY', 'abecfd0c-98d8-4635-abc2-2fcba8c60c11'), From ebba3846ef643a54781adec008c57c8a92d4da2c Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Mon, 6 Jan 2025 21:59:10 +0800 Subject: [PATCH 20/81] misspelling production_kopkb --- config/services.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/services.php b/config/services.php index 3d1972a..69082c7 100644 --- a/config/services.php +++ b/config/services.php @@ -38,9 +38,9 @@ return [ 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', '5aosv2dg'), ], 'production_kopkb' => [ - 'api_key' => env('BILLPLZ_PRODUCTION_API_KEY', 'f4e099e5-88ca-4712-a01e-b7e1daf78ce2'), - 'x_signature' => env('BILLPLZ_PRODUCTION_X_SIGNATURE', 'S-OApBh3DIwelPcWPzlMLMeg'), - 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', 'do6x2mhg'), + 'api_key' => env('BILLPLZ_PRODUCTION_KOPKB_API_KEY', 'f4e099e5-88ca-4712-a01e-b7e1daf78ce2'), + 'x_signature' => env('BILLPLZ_PRODUCTION_KOPKB_X_SIGNATURE', 'S-OApBh3DIwelPcWPzlMLMeg'), + 'collection_id' => env('BILLPLZ_PRODUCTION_KOPKB_COLLECTION_ID', 'do6x2mhg'), ], 'sandbox' => [ 'api_key' => env('BILLPLZ_SANDBOX_API_KEY', 'abecfd0c-98d8-4635-abc2-2fcba8c60c11'), From 5d176e6b1601b4c2e9ed9a46f0ce83d4b4cbf025 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 7 Jan 2025 15:32:58 +0800 Subject: [PATCH 21/81] fix collection id --- config/services.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/services.php b/config/services.php index 69082c7..54b286b 100644 --- a/config/services.php +++ b/config/services.php @@ -40,7 +40,7 @@ return [ 'production_kopkb' => [ 'api_key' => env('BILLPLZ_PRODUCTION_KOPKB_API_KEY', 'f4e099e5-88ca-4712-a01e-b7e1daf78ce2'), 'x_signature' => env('BILLPLZ_PRODUCTION_KOPKB_X_SIGNATURE', 'S-OApBh3DIwelPcWPzlMLMeg'), - 'collection_id' => env('BILLPLZ_PRODUCTION_KOPKB_COLLECTION_ID', 'do6x2mhg'), + 'collection_id' => env('BILLPLZ_PRODUCTION_KOPKB_COLLECTION_ID', 'bwrfvftz'), ], 'sandbox' => [ 'api_key' => env('BILLPLZ_SANDBOX_API_KEY', 'abecfd0c-98d8-4635-abc2-2fcba8c60c11'), From 46010cfc221f6d4a81dc98d1b7c7941dc1bb71d6 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 7 Jan 2025 15:42:06 +0800 Subject: [PATCH 22/81] fix production config services --- config/services.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/services.php b/config/services.php index 54b286b..9b31e32 100644 --- a/config/services.php +++ b/config/services.php @@ -38,9 +38,9 @@ return [ 'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', '5aosv2dg'), ], 'production_kopkb' => [ - 'api_key' => env('BILLPLZ_PRODUCTION_KOPKB_API_KEY', 'f4e099e5-88ca-4712-a01e-b7e1daf78ce2'), - 'x_signature' => env('BILLPLZ_PRODUCTION_KOPKB_X_SIGNATURE', 'S-OApBh3DIwelPcWPzlMLMeg'), - 'collection_id' => env('BILLPLZ_PRODUCTION_KOPKB_COLLECTION_ID', 'bwrfvftz'), + 'api_key' => env('BILLPLZ_PRODUCTION_KOPKB_API_KEY', 'fb81e895-f307-4c9c-b43d-0b55033ee479'), + 'x_signature' => env('BILLPLZ_PRODUCTION_KOPKB_X_SIGNATURE', 'afdb4035f1fe7f53cfdf3668765235f2714ee2ad6211c287a6ee52d170cb52b9b9e87d795213a9b4ede2de14076cdf2ced351343692194a28b0c23adfe3087bb'), + 'collection_id' => env('BILLPLZ_PRODUCTION_KOPKB_COLLECTION_ID', '93mzsttm'), ], 'sandbox' => [ 'api_key' => env('BILLPLZ_SANDBOX_API_KEY', 'abecfd0c-98d8-4635-abc2-2fcba8c60c11'), From 9255a8633facbf9d1fb1293ad8bcfc0f4474b461 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 7 Jan 2025 16:11:05 +0800 Subject: [PATCH 23/81] added cron --- .../Commands/UpdateTransactionMaster.php | 11 ++++++-- app/Console/Commands/updateUnsuccess.php | 25 ++++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/UpdateTransactionMaster.php b/app/Console/Commands/UpdateTransactionMaster.php index 37866db..1d84f4d 100644 --- a/app/Console/Commands/UpdateTransactionMaster.php +++ b/app/Console/Commands/UpdateTransactionMaster.php @@ -40,11 +40,18 @@ class UpdateTransactionMaster extends Command public function handle() { $updateOnline = Http::arrahn()->get('/api/transaction/online/update')->json(); - + $updateOnline_Koop = Http::arrahn_koop()->get('/api/transaction/online/update')->json(); + if($updateOnline == 'success'){ return 0; }else{ - Log::error('Update transaction master failed'); + Log::error('PKB::Update transaction master failed'); + } + + if($updateOnline_Koop == 'success'){ + return 0; + }else{ + Log::error('KOOP::Update transaction master failed'); } } } diff --git a/app/Console/Commands/updateUnsuccess.php b/app/Console/Commands/updateUnsuccess.php index e2dd207..3479973 100644 --- a/app/Console/Commands/updateUnsuccess.php +++ b/app/Console/Commands/updateUnsuccess.php @@ -2,9 +2,11 @@ namespace App\Console\Commands; +use App\Models\CompanyStatus; use App\Models\TransactionOnlineStatus; use App\Services\BillplzService; use App\Services\OnlineTransactionLoggerService; +use Billplz\Base\Bill; use Illuminate\Support\Facades\Http; use Illuminate\Console\Command; @@ -29,12 +31,21 @@ class UpdateUnsuccess extends Command * * @return int */ - public function handle(BillplzService $billplzService) + public function handle() { - $getFailedOnlineTransaction = fn() => Http::arrahn()->get('/api/transaction/online/unsuccessful')->json(); - + $getFailedOnlineTransaction_Koop = fn() => Http::arrahn_koop()->get('/api/transaction/online/unsuccessful')->json(); + $FailedBillplzID = array_map(fn($x) => $x['billplz_id'], $getFailedOnlineTransaction()); + $FailedBillplzID_Koop = array_map(fn($x) => $x['billplz_id'], $getFailedOnlineTransaction_Koop()); + + $this->resolve_payment($FailedBillplzID,CompanyStatus::COM_PKB); + $this->resolve_payment($FailedBillplzID_Koop,CompanyStatus::COM_KOOPPKB); + + } + public function resolve_payment($FailedBillplzID,$company) + { + $billplzService = new BillplzService($company); if(sizeof($FailedBillplzID) < 0){ return; @@ -59,7 +70,13 @@ class UpdateUnsuccess extends Command ]; try { - $response = Http::arrahn()->put('/api/transaction/online/unsuccesfull/update', $transactionData); + + $CallableHttp = $company == CompanyStatus::COM_PKB + ? Http::arrahn() + : Http::arrahn_koop(); + + $response = $CallableHttp->put('/api/transaction/online/unsuccesfull/update', $transactionData); + OnlineTransactionLoggerService::logs($transaction['bill_id'], $transactionData, $response, TransactionOnlineStatus::UPDATE_UNSUCCESSFUL_TRANSACTION ); } catch (\Exception $e) { From 6c7de03c4e487350615145df43c2d5fe764104b3 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 7 Jan 2025 16:50:35 +0800 Subject: [PATCH 24/81] admin review controller --- app/Services/BillplzService.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Services/BillplzService.php b/app/Services/BillplzService.php index 1eb6a40..782d57f 100644 --- a/app/Services/BillplzService.php +++ b/app/Services/BillplzService.php @@ -140,13 +140,21 @@ class BillplzService public function getArrahnTransactions($queryData) { + $query_all = []; + if(isset($queryData['date'])){ - return Http::arrahn()->get('/api/transaction/online/query', ['date' => $queryData['date']])->json(); + $pkb_query = Http::arrahn()->get('/api/transaction/online/query', ['date' => $queryData['date']])->json(); + $koop_query = Http::arrahn_koop()->get('/api/transaction/online/query', ['date' => $queryData['date']])->json(); + $query_all = array_merge($pkb_query,$koop_query); } if(isset($queryData['billId'])){ - return Http::arrahn()->get('/api/transaction/online/query', ['billId' => $queryData['billId']])->json(); + $pkb_query = Http::arrahn()->get('/api/transaction/online/query', ['billId' => $queryData['billId']])->json(); + $koop_query = Http::arrahn_koop()->get('/api/transaction/online/query', ['billId' => $queryData['billId']])->json(); + $query_all = array_merge($pkb_query,$koop_query); } + + return $query_all; } public function getBillplzTransactionReview($date) From b0272a8fa87dd65ccca99c89a2c122d1ed2331ba Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Sat, 11 Jan 2025 14:01:40 +0800 Subject: [PATCH 25/81] added handled for page expired 419 --- app/Http/Middleware/VerifyCsrfToken.php | 15 ++++++++++++++- .../views/includes/login/loginportal.blade.php | 6 ++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index b98b02e..af67ef1 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -3,6 +3,7 @@ namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; +use Illuminate\Session\TokenMismatchException; class VerifyCsrfToken extends Middleware { @@ -11,7 +12,19 @@ class VerifyCsrfToken extends Middleware * * @var array */ - protected $except = [ + + protected $except = [ '/pembayaran/backend' ]; + + public function handle($request, \Closure $next) + { + try { + return parent::handle($request, $next); + } catch (TokenMismatchException $e) { + // Redirect to login page if CSRF token is invalid + return redirect()->route('login')->with('logsemula', 'Sesi anda telah tamat. Sila log masuk semula.'); + } + } + } diff --git a/resources/views/includes/login/loginportal.blade.php b/resources/views/includes/login/loginportal.blade.php index 0a37d65..fa4d3f1 100644 --- a/resources/views/includes/login/loginportal.blade.php +++ b/resources/views/includes/login/loginportal.blade.php @@ -13,6 +13,12 @@
Log Masuk
+@if(session('logsemula')) +
+ {{ session('logsemula') }} +
+@endif + @csrf
From 7b7a47b13eb7773b5c687923ec85321665d9dc4f Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 12 Jan 2025 16:42:48 +0800 Subject: [PATCH 26/81] added loader and fix marhun call --- app/Services/PembiayaanService.php | 12 +- public/argon/js/main.js | 2 + public/js/miscellaneous/cart.js | 2 + public/js/miscellaneous/navigation-trolley.js | 5 + .../includes/bayaran/pembayaransag.blade.php | 17 ++- resources/views/includes/home.blade.php | 11 ++ resources/views/includes/main/head.blade.php | 36 +++++ .../views/includes/main/navigation.blade.php | 126 +++++++----------- .../partials/table-pembiayaan.blade.php | 1 + resources/views/modal/marhun.blade.php | 20 ++- routes/api.php | 2 +- 11 files changed, 143 insertions(+), 91 deletions(-) diff --git a/app/Services/PembiayaanService.php b/app/Services/PembiayaanService.php index 7e51e3f..b4ccc9c 100644 --- a/app/Services/PembiayaanService.php +++ b/app/Services/PembiayaanService.php @@ -112,13 +112,17 @@ class PembiayaanService return $formatted; } - public function getMarhunModalData($norujukan) + public function getMarhunModalData($norujukan,$tagsyarikat) { - $gadaianDetails = Http::arrahn()->get('/api/gadai/norujukan/' . $norujukan)->json()[0][0]; + $CallableHttp = $tagsyarikat == CompanyStatus::COM_PKB + ? Http::arrahn() + : Http::arrahn_koop(); + + $gadaianDetails = $CallableHttp->get('/api/gadai/norujukan/' . $norujukan)->json()[0][0]; - $attachCawanganName = function ($x) use ($gadaianDetails) { - $x['cawangan_name'] = Http::arrahn()->get('/api/cawangan/detail/' . $gadaianDetails['kodcaw'])->json()[0]['cawangan']; + $attachCawanganName = function ($x) use ($gadaianDetails,$CallableHttp) { + $x['cawangan_name'] = $CallableHttp->get('/api/cawangan/detail/' . $gadaianDetails['kodcaw'])->json()[0]['cawangan']; return $x; }; diff --git a/public/argon/js/main.js b/public/argon/js/main.js index 17f7d79..2b94b44 100644 --- a/public/argon/js/main.js +++ b/public/argon/js/main.js @@ -1,4 +1,6 @@ function loadingbtn(){ + const loader = document.getElementById('load-arrahn'); + loader.classList.remove('d-none'); $.notifyClose(); // $(this).unbind("click"); $('#background').css('display', 'block'); diff --git a/public/js/miscellaneous/cart.js b/public/js/miscellaneous/cart.js index ee6df57..85fd1a7 100644 --- a/public/js/miscellaneous/cart.js +++ b/public/js/miscellaneous/cart.js @@ -67,6 +67,8 @@ radios.forEach((radio) => { }); let deleteCarts = () => { + const loader = document.getElementById('load-arrahn'); + loader.classList.remove('d-none'); fetch('/deletecarts') .then(response => { if (!response.ok) { diff --git a/public/js/miscellaneous/navigation-trolley.js b/public/js/miscellaneous/navigation-trolley.js index 6d951eb..6dd10b4 100644 --- a/public/js/miscellaneous/navigation-trolley.js +++ b/public/js/miscellaneous/navigation-trolley.js @@ -56,6 +56,11 @@ function redirectTrolley() { redirectInput.value = 'trolley'; form.appendChild(redirectInput); document.body.appendChild(form); + + + const loader = document.getElementById('load-arrahn'); + loader.classList.remove('d-none'); + form.submit(); } diff --git a/resources/views/includes/bayaran/pembayaransag.blade.php b/resources/views/includes/bayaran/pembayaransag.blade.php index 046b600..fa5636b 100644 --- a/resources/views/includes/bayaran/pembayaransag.blade.php +++ b/resources/views/includes/bayaran/pembayaransag.blade.php @@ -41,6 +41,13 @@ Bayar SAG | Portal Pelanggan
+
+
+
+ +
+
+ @csrf
@@ -62,7 +69,10 @@

PKB

- +
+ *sila tick di sini untuk memilih bayaran. + +
@@ -145,7 +155,10 @@

KOPKB

- +
+ *sila tick di sini untuk memilih bayaran. + +
diff --git a/resources/views/includes/home.blade.php b/resources/views/includes/home.blade.php index ee36cbf..85dfeaf 100644 --- a/resources/views/includes/home.blade.php +++ b/resources/views/includes/home.blade.php @@ -2,6 +2,13 @@ @section('content') Home | Portal Pelanggan +
+
+
+ +
+
+
{ + const loader = document.getElementById('load-arrahn'); + loader.classList.remove('d-none'); if (result.isDenied) { let remove_carts = fetch('/deletecarts') .then(response => { diff --git a/resources/views/includes/main/head.blade.php b/resources/views/includes/main/head.blade.php index 4bace97..829096e 100644 --- a/resources/views/includes/main/head.blade.php +++ b/resources/views/includes/main/head.blade.php @@ -64,6 +64,42 @@ opacity: 0.8; display: flex; } + + .loader-arrahn { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + z-index: 9999; + } + + .loader-arrahn img { + width: 100px; /* Image size */ + } + + .loader-arrahn:before { + content: ''; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 120px; + height: 120px; + background-color: rgba(0, 0, 0, 0.8); + border-radius: 50%; + z-index: -1; + } + + .overlay-arrahn { + position: fixed; + z-index: 9998; + width: 100%; + height: 100%; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.5); + overflow: hidden; + } diff --git a/resources/views/includes/main/navigation.blade.php b/resources/views/includes/main/navigation.blade.php index 55ed837..acfc1b5 100644 --- a/resources/views/includes/main/navigation.blade.php +++ b/resources/views/includes/main/navigation.blade.php @@ -1,69 +1,51 @@ - + + +
+
+
+ +
+
+
diff --git a/resources/views/modal/marhun.blade.php b/resources/views/modal/marhun.blade.php index e2c6acf..682763c 100644 --- a/resources/views/modal/marhun.blade.php +++ b/resources/views/modal/marhun.blade.php @@ -169,13 +169,23 @@ @push('additional_js_scripts') + Bayar SAG | Portal Pelanggan
@@ -65,12 +112,12 @@ @if($list_pkb)
-
+

PKB

- *sila tick di sini untuk memilih bayaran. + *sila tick di sini untuk memilih bayaran.
@@ -121,7 +168,7 @@ } @endphp -
No
Rujukan
@php - $upahtawarruq = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/upahtawarruq/'. $bayar['kodcaw'] . '/' . $bayar['norujukan'])->json(); + $upahtawarruq = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/upahtawarruq/'. $bayar['kodcaw'] . '/' . $bayar['norujukan'],['jeniskeuntungan' => ($bayar['tagbaru'] == 1) ? 'onepercent' : 'asal'])->json(); @endphp {{ $upahtawarruq }} {{ $data->norujukan }} + {{ $data->tempoh }} + @@ -151,13 +198,13 @@ @if($list_koop)
-
+

KOPKB

- *sila tick di sini untuk memilih bayaran. - + *sila tick di sini untuk memilih bayaran. +
@@ -377,6 +424,23 @@ "pagingType": "simple", "paging": false + }); + + var selepastawarruq_kooptable = $('#selepas_tawarruq_koop').DataTable({ + "bLengthChange": false, + "bFilter": false, + "bInfo": false, + language: { + 'paginate': { + 'previous': '', + 'next': '' + } + }, + "scrollX": true, + "pageLength": 10, + "pagingType": "simple", + "paging": false + }); // var selepastawarruqtable = $('#ringkasan_bayaran').DataTable({ // "bLengthChange": false, diff --git a/resources/views/includes/bayaran/senaraibayaransag.blade.php b/resources/views/includes/bayaran/senaraibayaransag.blade.php index c8c7b70..eff7d57 100644 --- a/resources/views/includes/bayaran/senaraibayaransag.blade.php +++ b/resources/views/includes/bayaran/senaraibayaransag.blade.php @@ -194,7 +194,6 @@ let berat = $(e).data('berat'); let nm = $(e).data('nm'); - console.log(pinjaman,upah12,bakipjm,berat,nm); $('#pembiayaan').text('RM ' + pinjaman); $('#bpembiayaan').text('RM ' + bakipjm); diff --git a/resources/views/includes/home-backup.blade.php b/resources/views/includes/home-backup.blade.php index 5367ee5..0aafc7d 100644 --- a/resources/views/includes/home-backup.blade.php +++ b/resources/views/includes/home-backup.blade.php @@ -693,7 +693,6 @@ var hargaemastable = $('#harga_emas').DataTable({ dataType: "json", success: function(data) { namacawangan = data[0].namacaw; - console.log(namacawangan); namacawangan = namacawangan.toLowerCase().substring(8).replace(/\b[a-z]/g, function(value) { return value.toUpperCase(); }); @@ -835,7 +834,6 @@ var hargaemastable = $('#harga_emas').DataTable({ async: false, dataType: "json", success: function(data) { - console.log(data); for(i in data){ datalelong.push(data[i]); } diff --git a/resources/views/includes/home.blade.php b/resources/views/includes/home.blade.php index 85dfeaf..cd77d5e 100644 --- a/resources/views/includes/home.blade.php +++ b/resources/views/includes/home.blade.php @@ -146,7 +146,6 @@ let totalSagInCart = []; let totaltagSyarikat = []; let updateSagInCart = function(norujukan,syarikat){ - console.log(norujukan,syarikat); let isNorujukanIsAlreadyInCart = totalSagInCart.includes(norujukan); if(isNorujukanIsAlreadyInCart){ @@ -159,9 +158,6 @@ totalSagInCart.push(norujukan); totaltagSyarikat.push(syarikat); } - console.log("total:" + totalSagInCart); - console.log("totalsyarikat:" + totaltagSyarikat); - }; // Add event listener to checkboxes to update total count customer wants to pay @@ -213,13 +209,11 @@ if (result.isDenied) { let remove_carts = fetch('/deletecarts') .then(response => { - console.log(response.data); if (!response.ok) { throw new Error('HTTP error ' + response.status); } return response.json(); }) - .then(data => console.log(data)) .catch(error => console.error(error)); } @@ -244,5 +238,12 @@ return null; } }; + + window.addEventListener('pageshow', (event) => { + const loader = document.getElementById('load-arrahn'); + if (loader) { + loader.classList.add('d-none'); + } + }); @endsection diff --git a/resources/views/includes/rekod/rekodsag.blade.php b/resources/views/includes/rekod/rekodsag.blade.php index 1d796b0..7952075 100644 --- a/resources/views/includes/rekod/rekodsag.blade.php +++ b/resources/views/includes/rekod/rekodsag.blade.php @@ -234,7 +234,6 @@ let berat = $(e).data('berat'); let nm = $(e).data('nm'); - console.log(pinjaman,upah12,bakipjm,berat,nm); $('#pembiayaan').text('RM ' + pinjaman); $('#bpemb').text('RM ' + bakipjm); From 4accfb30213a6b77f7b9923baeb4b13de90471c3 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Mon, 20 Jan 2025 15:21:01 +0800 Subject: [PATCH 30/81] added api url and remove spare button --- config/api.php | 4 ++-- resources/views/includes/login/loginportal.blade.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/api.php b/config/api.php index 39b8ad4..eff8a13 100644 --- a/config/api.php +++ b/config/api.php @@ -1,5 +1,5 @@ env('API_URL','http://localhost:8000'), - 'url_koop' => env('API_URL_KOOP','http://localhost:8000') + 'url' => 'https://api2.arrahn.com.my', + 'url_koop' => 'https://api3.arrahn.com.my' ]; \ No newline at end of file diff --git a/resources/views/includes/login/loginportal.blade.php b/resources/views/includes/login/loginportal.blade.php index fa4d3f1..d4a6f6c 100644 --- a/resources/views/includes/login/loginportal.blade.php +++ b/resources/views/includes/login/loginportal.blade.php @@ -47,7 +47,7 @@

From aee216430cdb817200de690364eb911dab6424bf Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Mon, 20 Jan 2025 16:09:49 +0800 Subject: [PATCH 31/81] fix catch error --- resources/views/modal/marhun.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/modal/marhun.blade.php b/resources/views/modal/marhun.blade.php index 21b6903..4502123 100644 --- a/resources/views/modal/marhun.blade.php +++ b/resources/views/modal/marhun.blade.php @@ -214,7 +214,7 @@ document.getElementById('marhunLoader').style.display = 'flex'; const norujukan = event.target.innerHTML; - + try { const data = await fetch('/api/pembiayaan-modal-data/' + norujukan + "/" + tagsyarikat) .then(x => x.json()) .catch(error => { From 8df8551f83e98b112558d19d4110a87b024a563e Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Tue, 21 Jan 2025 00:06:55 +0800 Subject: [PATCH 32/81] fix disabled after payment --- app/Services/PembiayaanService.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Services/PembiayaanService.php b/app/Services/PembiayaanService.php index 495efe7..9bd6a6a 100644 --- a/app/Services/PembiayaanService.php +++ b/app/Services/PembiayaanService.php @@ -144,8 +144,8 @@ class PembiayaanService { $getRecentlyAttemptPayment = function () use ($norujukanList) { return Http::pool(function (Pool $pool) use ($norujukanList) { - foreach ($norujukanList as $norujukan) { - $pool->get(config('api.url') . '/portal/searchsagonline/', ['norujukan' => $norujukan]); + foreach ($norujukanList as $list) { + $pool->get(($list['tag_syarikat'] == CompanyStatus::COM_PKB ? config('api.url') : config('api.url_koop')) . '/portal/searchsagonline/', ['norujukan' => $list['norujukan']]); } }); }; @@ -166,8 +166,11 @@ class PembiayaanService } private function checkPembiayaanPaymentDisabled($pembiayaan) - { - $norujukanList = array_map(fn($x) => $x->norujukan, $pembiayaan); + { + $norujukanList = array_map(fn($x) => [ + 'tag_syarikat' => $x->tag_syarikat, + 'norujukan' => $x->norujukan, + ], $pembiayaan); $norujukanRecentlyAttemptPayment = $this->getNorujukanRecentlyAttemptPayment($norujukanList); @@ -205,6 +208,7 @@ class PembiayaanService $kodCawanganBranchesNotPermitPaymentUjrah = array_map(fn($x) => $x['kodcaw'], $branchesNotPermitPaymentUjrah); $isNorujukanPaymentRecentlyAttempted = function ($x) use ($norujukanRecentlyAttemptPayment) { + $norujukanRecentlyAttemptPayment = array_column($norujukanRecentlyAttemptPayment, 'norujukan'); return in_array($x->norujukan, $norujukanRecentlyAttemptPayment); }; From b489855d1169b50f70296142016dcc548d58a27c Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Tue, 21 Jan 2025 00:07:48 +0800 Subject: [PATCH 33/81] added pdf and fix surat wakil no pdf and added pdf for resit --- app/Http/Controllers/BayaranController.php | 45 ++++++++- composer.json | 1 + .../views/pembayaran/resit/resitpdf.blade.php | 93 +++++++++++++++++++ .../pembayaran/resit/resitportal.blade.php | 27 +++--- routes/web.php | 1 + 5 files changed, 154 insertions(+), 13 deletions(-) create mode 100644 resources/views/pembayaran/resit/resitpdf.blade.php diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index 4e39014..3874901 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Log; use Money\Money; use App\Services\OnlineTransactionLoggerService; use Illuminate\Support\Facades\Session; +use PDF; class BayaranController extends Controller { @@ -215,7 +216,49 @@ class BayaranController extends Controller ->json(); $gadai = $gadai_details[0][0]; - return view('pembayaran.resit.resitportal', compact('customer_details', 'payment_details', 'cawangan_detail', 'nama_cawangan', 'gadai')); + $company = Session::get('company'); + + return view('pembayaran.resit.resitportal', compact('customer_details', 'payment_details', 'cawangan_detail', 'nama_cawangan', 'gadai','company')); + } + + public function generateResit(Request $request) + { + $this->serviceCallHttp($request->company); + + $kpbaru = Auth::User()->icno; + + $customer = $this->CallableHttp + ->get('/api/customers/' . $kpbaru) + ->json(); + $customer_details = $customer; + + $current = Carbon::now(); + $current = new Carbon(); + $date = $current->toDateTimeString(); + + $payment_details = $this->CallableHttp + ->get('/api/transaction/online/express', ['billplz_id' => $request->billplzid]) + ->json(); + + $cawangan_info = $this->CallableHttp + ->get('/api/cawangan/' . $payment_details['kodcaw']) + ->json(); + $cawangan = $this->CallableHttp + ->get('/api/cawangan/detail/' . $payment_details['kodcaw']) + ->json(); + $cawangan_detail = $cawangan[0]; + $nama_cawangan = $cawangan_info['details_caw']; + + $gadai_details = $this->CallableHttp + ->get('/api/gadai/norujukan/' . $payment_details['norujukan']) + ->json(); + $gadai = $gadai_details[0][0]; + + // Load a view and pass data to it + $pdf = PDF::loadView('pembayaran.resit.resitpdf', compact('customer_details', 'payment_details', 'cawangan_detail', 'nama_cawangan', 'gadai')); + + // Return the generated PDF (inline display in browser) + return $pdf->stream('resit_pembayaran.pdf'); } public function callback(Request $request) diff --git a/composer.json b/composer.json index 531e898..6c677f0 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "license": "MIT", "require": { "php": "^7.3|^8.0", + "barryvdh/laravel-dompdf": "^2.2", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", diff --git a/resources/views/pembayaran/resit/resitpdf.blade.php b/resources/views/pembayaran/resit/resitpdf.blade.php new file mode 100644 index 0000000..c8482cd --- /dev/null +++ b/resources/views/pembayaran/resit/resitpdf.blade.php @@ -0,0 +1,93 @@ + + + + + + {{ config('app.name') }} | Pembayaran Berjaya + + + + + + + + + + + +

+
+ Logo Ar Rahn + Logo Ar Rahn +
+
+ Pelanggan yang dihargai, +
+
+ Terima kasih kerana menggunakan perkhidmatan kami. +
+
+
+
Status Bayaran
+
Berjaya
+
+
+
+
ID Transaksi
+
{{ $payment_details['reference_no'] }}
+
+
+
+
No. Surat Akuan Gadai
+
{{ $payment_details['norujukan'] }}
+
+
+
+
Nama Pelanggan
+
{{ $payment_details['customer_name'] }}
+
+
+
+
Tarikh Transaksi
+ @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $payment_details['tarikh'] ); + $formattedweddingdate = $myDateTime->format('d/m/Y'); + @endphp +
{{ $formattedweddingdate . ' ' . $payment_details['masa'] }}
+
+
+
+
Jumlah Bayaran
+
RM {{ number_format($payment_details['total_payment'], 2) }}
+
+ @if($gadai['hargajualan'] == 0) +
+
+
Tarikh Lanjutan
+
31/12/2021
+
+ @endif +
+
+ Sebarang pembayaran akan dikemaskini selepas 1 Jam sebaik pembayaran dilakukan +
+
+ Nota: Resit ini adalah cetakan komputer dan tandatangan tidak diperlukan. +
+
+ {{ $cawangan_detail['namacaw'] }}
+ {{ $cawangan_detail['alamat1'] . ' ' . $cawangan_detail['alamat2'] }} +
+
+ + + diff --git a/resources/views/pembayaran/resit/resitportal.blade.php b/resources/views/pembayaran/resit/resitportal.blade.php index 7470f0c..5c0ea26 100644 --- a/resources/views/pembayaran/resit/resitportal.blade.php +++ b/resources/views/pembayaran/resit/resitportal.blade.php @@ -126,12 +126,17 @@
-
-
- Kembali Muka Hadapan - + +
+
+ @csrf + + + Kembali Muka Hadapan + +
-
+
@@ -139,13 +144,11 @@ diff --git a/routes/web.php b/routes/web.php index fab2450..99def21 100644 --- a/routes/web.php +++ b/routes/web.php @@ -119,6 +119,7 @@ Route::group(['middleware' => 'auth','verified'], function () { Route::put('profile', ['as' => 'profile.update', 'uses' => 'App\Http\Controllers\ProfileController@update']); Route::get('/cust/print.suratwakil/{kodcaw}/{norujukan}',['as'=>'cust.print.suratwakil','uses'=>'App\Http\Controllers\ProfileController@printSuratWakil']); + Route::post('/generate-resit', 'App\Http\Controllers\BayaranController@generateResit')->name('resit.pdf'); }); Route::get('/requestic', 'App\Http\Controllers\TacController@requestKadPengenalan')->name('requestic'); From 0cc78c5043e36fbf989e30d6f433d4a087499d70 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Tue, 21 Jan 2025 00:57:35 +0800 Subject: [PATCH 34/81] added tagsyarikat in bayaranhistory and marhundetails --- app/Services/BayaranHistoryService.php | 9 +++++++-- app/Services/MarhunService.php | 15 ++++++++++----- app/Services/PembiayaanService.php | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/Services/BayaranHistoryService.php b/app/Services/BayaranHistoryService.php index 7dddd15..e39af37 100644 --- a/app/Services/BayaranHistoryService.php +++ b/app/Services/BayaranHistoryService.php @@ -2,6 +2,7 @@ namespace App\Services; +use App\Models\CompanyStatus; use Illuminate\Http\Client\Pool; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Http; @@ -14,9 +15,13 @@ class BayaranHistoryService $this->norujukan = $norujukan; } - public function getBayaranHistory() + public function getBayaranHistory($tagsyarikat) { - $bayaranHistory = Http::arrahn()->get('/api/transaction/'. $this->norujukan)->json(); + $CallableHttp = $tagsyarikat == CompanyStatus::COM_PKB + ? Http::arrahn() + : Http::arrahn_koop(); + + $bayaranHistory = $CallableHttp->get('/api/transaction/'. $this->norujukan)->json(); $formatBayaranHistoryData = function ($x) { if (sizeof($x) === 0) { diff --git a/app/Services/MarhunService.php b/app/Services/MarhunService.php index 6a7d99c..f154ab1 100644 --- a/app/Services/MarhunService.php +++ b/app/Services/MarhunService.php @@ -2,6 +2,7 @@ namespace App\Services; +use App\Models\CompanyStatus; use Illuminate\Support\Facades\Http; class MarhunService @@ -12,14 +13,18 @@ class MarhunService $this->norujukan = $norujukan; } - public function getMarhunDetails() + public function getMarhunDetails($tagsyarikat) { - $getMarhunDetails = function ($x) { - return Http::arrahn()->get('/api/marhun/' . $x)->json(); + $CallableHttp = $tagsyarikat == CompanyStatus::COM_PKB + ? Http::arrahn() + : Http::arrahn_koop(); + + $getMarhunDetails = function ($x) use($CallableHttp) { + return $CallableHttp->get('/api/marhun/' . $x)->json(); }; - $getMarhunTypeFullName = function ($code) { - return Http::arrahn()->get('/api/jemas/nama_marhun', ['marhun' => $code['marhun']])->json()['descpt']; + $getMarhunTypeFullName = function ($code) use($CallableHttp) { + return $CallableHttp->get('/api/jemas/nama_marhun', ['marhun' => $code['marhun']])->json()['descpt']; }; $formatMarhunDetailData = function ($x) use($getMarhunTypeFullName) { diff --git a/app/Services/PembiayaanService.php b/app/Services/PembiayaanService.php index 9bd6a6a..35e3c4f 100644 --- a/app/Services/PembiayaanService.php +++ b/app/Services/PembiayaanService.php @@ -128,9 +128,9 @@ class PembiayaanService $gadaianDetails = $attachCawanganName($gadaianDetails); - $marhunDetails = MarhunService::from($norujukan)->getMarhunDetails(); + $marhunDetails = MarhunService::from($norujukan)->getMarhunDetails($tagsyarikat); - $bayaranHistoryDetails = BayaranHistoryService::from($norujukan)->getBayaranHistory(); + $bayaranHistoryDetails = BayaranHistoryService::from($norujukan)->getBayaranHistory($tagsyarikat); return [ From a370adc2d09eabc9f0c2ce624a4b53100b051d5d Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Tue, 21 Jan 2025 01:42:32 +0800 Subject: [PATCH 35/81] added no escape button and remove loadermarhun --- resources/views/includes/home.blade.php | 4 +++- resources/views/modal/marhun.blade.php | 16 +++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/resources/views/includes/home.blade.php b/resources/views/includes/home.blade.php index cd77d5e..52fe03a 100644 --- a/resources/views/includes/home.blade.php +++ b/resources/views/includes/home.blade.php @@ -202,7 +202,9 @@ showDenyButton: true, showCancelButton: false, confirmButtonText: "Pergi Ke Troli", - denyButtonText: `Buang Troli` + denyButtonText: `Buang Troli`, + allowOutsideClick: false, + allowEscapeKey: false, }).then((result) => { const loader = document.getElementById('load-arrahn'); loader.classList.remove('d-none'); diff --git a/resources/views/modal/marhun.blade.php b/resources/views/modal/marhun.blade.php index 4502123..3b5fa42 100644 --- a/resources/views/modal/marhun.blade.php +++ b/resources/views/modal/marhun.blade.php @@ -1,6 +1,6 @@ - +{{-- --}} -
+
@csrf + Kembali Muka Hadapan
From cbd8cc15e16bc525c6af7d9d9fdf910fe12d355e Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 23 Jan 2025 12:12:05 +0800 Subject: [PATCH 41/81] added lelong feature tagsyarikat --- app/Http/Controllers/InformationController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/InformationController.php b/app/Http/Controllers/InformationController.php index 65676e6..08e3f6d 100644 --- a/app/Http/Controllers/InformationController.php +++ b/app/Http/Controllers/InformationController.php @@ -61,6 +61,7 @@ class InformationController extends Controller } if($array_lelong['lelong'] !== null){ + $array_lelong['lelong']['tag_syarikat'] = CompanyStatus::COM_PKB; $customer_pkb['lelong'][$index] = collect($lelong)->merge($array_lelong['lelong'])->toArray(); } } @@ -80,6 +81,7 @@ class InformationController extends Controller } if($array_lelong['lelong'] !== null){ + $array_lelong['lelong']['tag_syarikat'] = CompanyStatus::COM_KOOPPKB; $customer_koop['lelong'][$index] = collect($lelong)->merge($array_lelong['lelong'])->toArray(); } } @@ -150,6 +152,7 @@ class InformationController extends Controller } if($array_lelong['lelong'] !== null){ + $array_lelong['lelong']['tag_syarikat'] = CompanyStatus::COM_PKB; $customer_pkb['lelong'][$index] = collect($lel)->merge($array_lelong['lelong'])->toArray(); } } @@ -168,6 +171,7 @@ class InformationController extends Controller } if($array_lelong['lelong'] !== null){ + $array_lelong['lelong']['tag_syarikat'] = CompanyStatus::COM_KOOPPKB; $customer_koop['lelong'][$index] = collect($lel)->merge($array_lelong['lelong'])->toArray(); } } From 1bfc38167c679cc9c6bf694c8938734dbbbc97b7 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 23 Jan 2025 16:43:35 +0800 Subject: [PATCH 42/81] fix console update status --- app/Console/Commands/updateUnsuccess.php | 2 +- app/Services/BillplzService.php | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/updateUnsuccess.php b/app/Console/Commands/updateUnsuccess.php index 3479973..10c769d 100644 --- a/app/Console/Commands/updateUnsuccess.php +++ b/app/Console/Commands/updateUnsuccess.php @@ -51,7 +51,7 @@ class UpdateUnsuccess extends Command return; } - $billplzUpdatedTransactionStatus = array_map(fn($x) => $billplzService->getTransactionByBillId($x), $FailedBillplzID); + $billplzUpdatedTransactionStatus = array_map(fn($x) => $billplzService->getTransactionByBillId($x,$company), $FailedBillplzID); $getCompletedBillplzTransaction = function() use($billplzUpdatedTransactionStatus){ diff --git a/app/Services/BillplzService.php b/app/Services/BillplzService.php index 782d57f..6c05cdf 100644 --- a/app/Services/BillplzService.php +++ b/app/Services/BillplzService.php @@ -240,8 +240,22 @@ class BillplzService return $summarizedBillplzTransactions; } - public function getTransactionByBillId($billId) + public function getTransactionByBillId($billId,$company) { + $appEnvironment = config('app.env'); + + $billplzEnvironments = [ + 'PKB' => ($appEnvironment === 'production') ? config('services.billplz.production') : config('services.billplz.sandbox'), + 'KOPKB' => ($appEnvironment === 'production') ? config('services.billplz.production_kopkb') : config('services.billplz.sandbox_kopkb'), + ]; + + $billplzConfig = $appEnvironment === 'production' + ? ($billplzEnvironments[$company] ?? config('services.billplz.production')) + : ($billplzEnvironments[$company] ?? config('services.billplz.sandbox')); + + $client = Client::make($billplzConfig['api_key'], ($this->isBase64($billplzConfig['x_signature'])) ? $billplzConfig['x_signature'] : base64_encode($billplzConfig['x_signature'])); + $client->useVersion('v4'); + try { return $this->client->bill()->transaction($billId)->toArray(); } catch (\Throwable $th) { From d8b984856df460045dd313c4434e49ad7db2da0d Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 23 Jan 2025 16:45:23 +0800 Subject: [PATCH 43/81] client added --- app/Services/BillplzService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/BillplzService.php b/app/Services/BillplzService.php index 6c05cdf..512766d 100644 --- a/app/Services/BillplzService.php +++ b/app/Services/BillplzService.php @@ -257,7 +257,7 @@ class BillplzService $client->useVersion('v4'); try { - return $this->client->bill()->transaction($billId)->toArray(); + return $client->bill()->transaction($billId)->toArray(); } catch (\Throwable $th) { logger()->error('Error when querying billplz id : ' . $billId); logger()->error($th->getMessage()); From 2bcf74e8dc3699f055d514f127f90711f2e5244b Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 26 Jan 2025 10:40:10 +0800 Subject: [PATCH 44/81] check first before check in trolley and added cron for deletecarts hourly and added updateunsuccess split 2 parts and logging change to daily --- app/Console/Commands/DeleteCartsHourly.php | 55 ++++++++++++++++++++++ app/Console/Commands/updateUnsuccess.php | 28 +++++++---- app/Http/Controllers/BayaranController.php | 55 ++++++++++++++++++++++ config/logging.php | 2 +- 4 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 app/Console/Commands/DeleteCartsHourly.php diff --git a/app/Console/Commands/DeleteCartsHourly.php b/app/Console/Commands/DeleteCartsHourly.php new file mode 100644 index 0000000..44c4dc5 --- /dev/null +++ b/app/Console/Commands/DeleteCartsHourly.php @@ -0,0 +1,55 @@ +subHour(); + $deleted = PersonalCarts::where('created_at', '<', $oneHourAgo)->delete(); + Log::info('carts hourly have been deleted.'); + $this->info('carts have been deleted.'); + }catch(\Exception $e){ + Log::error('Error deleting hourly carts: ' . $e->getMessage()); + $this->error('Error deleting hourly carts: ' . $e->getMessage()); + return 1; + } + + } +} diff --git a/app/Console/Commands/updateUnsuccess.php b/app/Console/Commands/updateUnsuccess.php index 10c769d..33ef2f0 100644 --- a/app/Console/Commands/updateUnsuccess.php +++ b/app/Console/Commands/updateUnsuccess.php @@ -17,8 +17,7 @@ class UpdateUnsuccess extends Command * * @var string */ - protected $signature = 'update:unsuccess'; - + protected $signature = 'update:unsuccess {--type=1}'; /** * The console command description. * @@ -33,14 +32,17 @@ class UpdateUnsuccess extends Command */ public function handle() { - $getFailedOnlineTransaction = fn() => Http::arrahn()->get('/api/transaction/online/unsuccessful')->json(); - $getFailedOnlineTransaction_Koop = fn() => Http::arrahn_koop()->get('/api/transaction/online/unsuccessful')->json(); + $type = $this->option('type'); - $FailedBillplzID = array_map(fn($x) => $x['billplz_id'], $getFailedOnlineTransaction()); - $FailedBillplzID_Koop = array_map(fn($x) => $x['billplz_id'], $getFailedOnlineTransaction_Koop()); - - $this->resolve_payment($FailedBillplzID,CompanyStatus::COM_PKB); - $this->resolve_payment($FailedBillplzID_Koop,CompanyStatus::COM_KOOPPKB); + if($type == '1'){ + $getFailedOnlineTransaction = fn() => Http::arrahn()->get('/api/transaction/online/unsuccessful')->json(); + $FailedBillplzID = array_map(fn($x) => $x['billplz_id'], $getFailedOnlineTransaction()); + $this->resolve_payment($FailedBillplzID,CompanyStatus::COM_PKB); + }else{ + $getFailedOnlineTransaction_Koop = fn() => Http::arrahn_koop()->get('/api/transaction/online/unsuccessful')->json(); + $FailedBillplzID_Koop = array_map(fn($x) => $x['billplz_id'], $getFailedOnlineTransaction_Koop()); + $this->resolve_payment($FailedBillplzID_Koop,CompanyStatus::COM_KOOPPKB); + } } public function resolve_payment($FailedBillplzID,$company) @@ -50,8 +52,14 @@ class UpdateUnsuccess extends Command if(sizeof($FailedBillplzID) < 0){ return; } + + if($company == CompanyStatus::COM_PKB){ + $companyID = 'PKB'; + }else{ + $companyID = 'KOPKB'; + } - $billplzUpdatedTransactionStatus = array_map(fn($x) => $billplzService->getTransactionByBillId($x,$company), $FailedBillplzID); + $billplzUpdatedTransactionStatus = array_map(fn($x) => $billplzService->getTransactionByBillId($x,$companyID), $FailedBillplzID); $getCompletedBillplzTransaction = function() use($billplzUpdatedTransactionStatus){ diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index 0d4fee9..e589969 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -33,6 +33,16 @@ class BayaranController extends Controller $list_pkb = json_decode($exist_carts['list_pkb'],true); $list_koop = json_decode($exist_carts['list_koop'],true); + if($this->checkSAG($list_pkb, 'PKB')){ + $this->removeCartsInternal(); + return redirect()->route('buffer'); + } + + if($this->checkSAG($list_koop, 'KOPKB')){ + $this->removeCartsInternal(); + return redirect()->route('buffer'); + } + if($exist_carts['status_pkb'] == 'PENDING') $list_pkb = ($list_pkb) ? $this->setUpahTawarruq($list_pkb) : []; else $list_pkb = []; if($exist_carts['status_koop'] == 'PENDING') $list_koop = ($list_koop) ? $this->setUpahTawarruq($list_koop) : []; else $list_koop = []; @@ -551,4 +561,49 @@ class BayaranController extends Controller : Http::arrahn_koop(); } + + private function checkSAG($list_sag, $company) + { + $CallableHttp = $company == 'PKB' + ? Http::arrahn() + : Http::arrahn_koop(); + + foreach ($list_sag as $x) { + $array_lelong = Http::withOptions(['verify' => config('app.api_verify')]) + ->get(config('api-lelong.url') . '/api/portalApi', ['norujukan' => $x['norujukan']]) + ->json(); + + $array_gadai = $CallableHttp->get('/api/gadai/norujukan/' . $x['norujukan'])->json(); + $isdisabled = $CallableHttp->get('/portal/searchsagonline/', ['norujukan' => $x['norujukan']])->json(); + + if ($array_lelong['lelong'] != null) { + return true; + } + + if ($isdisabled) { + return true; + } + + if (sizeof($array_gadai) != 0) { + $array_gadai = $array_gadai[0][0]; + if ($array_gadai['sttebus'] == 'T' || $array_gadai['sttebus'] == 'L') { + return true; + } + } + } + + return false; + } + + private function removeCartsInternal(){ + $exist_carts = PersonalCarts::where('ic_no', Auth::user()->icno) + ->where('user_id', Auth::user()->id) + ->first(); + + if ($exist_carts) { + $exist_carts->delete(); + } + + return $exist_carts; + } } diff --git a/config/logging.php b/config/logging.php index 1aa06aa..e09aae6 100644 --- a/config/logging.php +++ b/config/logging.php @@ -17,7 +17,7 @@ return [ | */ - 'default' => env('LOG_CHANNEL', 'stack'), + 'default' => env('LOG_CHANNEL', 'daily'), /* |-------------------------------------------------------------------------- From 64b19769060f346258bb267e430f6bea546d38b8 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 26 Jan 2025 11:14:09 +0800 Subject: [PATCH 45/81] check redirect trolley but existcarts null so need to charge it back to home --- app/Http/Controllers/BayaranController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index e589969..bc54905 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -50,6 +50,10 @@ class BayaranController extends Controller /* Doesn't Have Carts. First Timer */ $request->validated(); + if(isset($request->redirect_trolley)){ + return redirect()->route('buffer'); + } + $arraybayar = $this->setUpahTawarruq($request->getPembiayaanFromNorujukan()); $list_pkb = array_filter(array_map(function ($x){ From 3787b6cb51f7e5ddbdd64c8b70b28c40a995ee4b Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 26 Jan 2025 14:38:05 +0800 Subject: [PATCH 46/81] added if all list pkb and koop are empty redirect to home and also add deleteCarts for mobile view --- app/Http/Controllers/BayaranController.php | 5 +++++ resources/views/includes/bayaran/pembayaransag.blade.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index bc54905..16f6803 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -46,6 +46,11 @@ class BayaranController extends Controller if($exist_carts['status_pkb'] == 'PENDING') $list_pkb = ($list_pkb) ? $this->setUpahTawarruq($list_pkb) : []; else $list_pkb = []; if($exist_carts['status_koop'] == 'PENDING') $list_koop = ($list_koop) ? $this->setUpahTawarruq($list_koop) : []; else $list_koop = []; + if (empty($list_pkb) && empty($list_koop)) { + $this->removeCartsInternal(); + return redirect()->route('buffer'); + } + }else{ /* Doesn't Have Carts. First Timer */ $request->validated(); diff --git a/resources/views/includes/bayaran/pembayaransag.blade.php b/resources/views/includes/bayaran/pembayaransag.blade.php index 5e711ce..a57ecd6 100644 --- a/resources/views/includes/bayaran/pembayaransag.blade.php +++ b/resources/views/includes/bayaran/pembayaransag.blade.php @@ -362,7 +362,7 @@
- Batal + Batal  @if($totalupahasal == 1.00 || $errorcount > 0) @else From 6d479e64167a32a751f3ee7cee6747e93c4adc81 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 26 Jan 2025 14:55:11 +0800 Subject: [PATCH 47/81] Fix Billplz controller not fetching bills from Billplz api --- .env.example | 2 +- app/Http/Controllers/BillplzController.php | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index c3461f5..4b8cd08 100644 --- a/.env.example +++ b/.env.example @@ -4,6 +4,7 @@ APP_KEY= APP_DEBUG=true APP_URL=http://localhost API_URL=http://api_arrahn.test +API_URL_KOOP=http://api_arrahn_v3.test API_LELONG_URL=https://niklah.arrahn.com.my LOG_CHANNEL=stack @@ -63,4 +64,3 @@ BILLPLZ_SANDBOX_COLLECTION_ID="z0r4kjhi" BILLPLZ_SANDBOX_KOPKB_API_KEY="abecfd0c-98d8-4635-abc2-2fcba8c60c11" BILLPLZ_SANDBOX_KOPKB_X_SIGNATURE="S-GWr7z03XjAhqPsFfu_H5nQ" BILLPLZ_SANDBOX_KOPKB_COLLECTION_ID="uae40muk" - diff --git a/app/Http/Controllers/BillplzController.php b/app/Http/Controllers/BillplzController.php index 0949e85..2a53d44 100644 --- a/app/Http/Controllers/BillplzController.php +++ b/app/Http/Controllers/BillplzController.php @@ -2,15 +2,28 @@ namespace App\Http\Controllers; +use App\Models\CompanyStatus; use App\Services\BillplzService; use Carbon\Carbon; use Illuminate\Http\Request; class BillplzController extends Controller { - public function __invoke(Request $request, BillplzService $billplzService) + public function __invoke(Request $request) { - $billIdArray = json_decode($request->bill_ids); - return $billplzService->getBills($billIdArray); + $companyMapping = [ + CompanyStatus::COM_PKB, + // CompanyStatus::COM_KOOPPKB, + ]; + + $bills = array_map(function($company_code, $request){ + $billplzService = new BillplzService($company_code); + $billIdArray = json_decode($request->bill_ids); + return $billplzService->getBills($billIdArray); + }, $companyMapping); + + return $bills; + + } } From aaff4c37bca0b49a1965e02807df7f94b0f819f3 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 26 Jan 2025 15:06:39 +0800 Subject: [PATCH 48/81] transfer from non-authenticate to authenticate --- routes/web.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/web.php b/routes/web.php index 99def21..b0c33ff 100644 --- a/routes/web.php +++ b/routes/web.php @@ -120,6 +120,8 @@ Route::group(['middleware' => 'auth','verified'], function () { Route::get('/cust/print.suratwakil/{kodcaw}/{norujukan}',['as'=>'cust.print.suratwakil','uses'=>'App\Http\Controllers\ProfileController@printSuratWakil']); Route::post('/generate-resit', 'App\Http\Controllers\BayaranController@generateResit')->name('resit.pdf'); + Route::get('/showcarts-available','App\Http\Controllers\BayaranController@UserCheckCarts')->name('checkcarts'); + Route::get('/deletecarts','App\Http\Controllers\BayaranController@removeCarts')->name('removecarts'); }); Route::get('/requestic', 'App\Http\Controllers\TacController@requestKadPengenalan')->name('requestic'); @@ -127,8 +129,6 @@ Route::get('/requesticfe', 'App\Http\Controllers\TacController@requestKadPengena Route::get('/requesttac', 'App\Http\Controllers\TacController@TACrequest')->name('requesttac'); Route::get('/requesttacfe', 'App\Http\Controllers\TacController@TACrequestfe')->name('requesttacfe'); -Route::get('/showcarts-available','App\Http\Controllers\BayaranController@UserCheckCarts')->name('checkcarts'); -Route::get('/deletecarts','App\Http\Controllers\BayaranController@removeCarts')->name('removecarts'); Route::get('download/manualpengguna',['as'=>'miscellaneous.manualpengguna', function(){ if (Storage::disk('miscellaneous')->exists('Manual_Pengguna.pdf')) { From 4187f3c400d1547fd343dde1bf9a2e6bd47875dd Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 26 Jan 2025 15:26:11 +0800 Subject: [PATCH 49/81] Fix bugs --- app/Http/Controllers/BillplzController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/BillplzController.php b/app/Http/Controllers/BillplzController.php index 2a53d44..cd37c5c 100644 --- a/app/Http/Controllers/BillplzController.php +++ b/app/Http/Controllers/BillplzController.php @@ -16,7 +16,7 @@ class BillplzController extends Controller // CompanyStatus::COM_KOOPPKB, ]; - $bills = array_map(function($company_code, $request){ + $bills = array_map(function($company_code) use($request){ $billplzService = new BillplzService($company_code); $billIdArray = json_decode($request->bill_ids); return $billplzService->getBills($billIdArray); From 6f264f0847ffefa38400449b729d01b7e6613837 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 26 Jan 2025 15:43:56 +0800 Subject: [PATCH 50/81] Fix bugs contd --- app/Http/Controllers/BillplzController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/BillplzController.php b/app/Http/Controllers/BillplzController.php index cd37c5c..898746c 100644 --- a/app/Http/Controllers/BillplzController.php +++ b/app/Http/Controllers/BillplzController.php @@ -22,7 +22,7 @@ class BillplzController extends Controller return $billplzService->getBills($billIdArray); }, $companyMapping); - return $bills; + return array_merge(...$bills); } From 90a018a06b6e5624e43c0e76d376043da9fa214c Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 26 Jan 2025 16:08:51 +0800 Subject: [PATCH 51/81] Fix bug on split payment in BillplzTransactionReviewController --- .../BillplzTransactionReviewController.php | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/BillplzTransactionReviewController.php b/app/Http/Controllers/BillplzTransactionReviewController.php index 2817731..a0e866f 100644 --- a/app/Http/Controllers/BillplzTransactionReviewController.php +++ b/app/Http/Controllers/BillplzTransactionReviewController.php @@ -2,26 +2,41 @@ namespace App\Http\Controllers; +use App\Models\CompanyStatus; use App\Services\BillplzService; use Carbon\Carbon; use Illuminate\Http\Request; class BillplzTransactionReviewController extends Controller { - public function index(Request $request, BillplzService $billplzService) + public function index(Request $request) { $date = $request->date ?? Carbon::now()->toDateString(); - $billplzTransactionReview = $billplzService->getBillplzTransactionReview($date); + $companyMapping = [ + CompanyStatus::COM_PKB, + // CompanyStatus::COM_KOOPPKB, + ]; - return response()->json($billplzTransactionReview, 200); + $billplzTransactionReview = array_map(function($company_code) use($date){ + $billplzService = new BillplzService($company_code); + return $billplzService->getBillplzTransactionReview($date); + }, $companyMapping); + + return response()->json(array_merge(...$billplzTransactionReview), 200); } - public function show(Request $request, BillplzService $billplzService) + public function show(Request $request) { - $date = $request->date ?? Carbon::now()->toDateString(); - - $billplzTransactionReview = $billplzService->getBillplzTransactionReviewByBillId($request->bill_id); + $companyMapping = [ + CompanyStatus::COM_PKB, + // CompanyStatus::COM_KOOPPKB, + ]; + + $billplzTransactionReview = array_map(function($company_code) use($request){ + $billplzService = new BillplzService($company_code); + return $billplzService->getBillplzTransactionReviewByBillId($request->bill_id); + }, $companyMapping); return response()->json($billplzTransactionReview, 200); } From 3052644909a76b7b0b8ba2214cf3403d8dd3bc75 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 26 Jan 2025 16:29:46 +0800 Subject: [PATCH 52/81] added resit for v3 and make it not allowed if it open other norujukan from other nokp --- app/Http/Controllers/SemakController.php | 17 +++++-- app/Services/BayaranHistoryService.php | 4 +- resources/views/modal/marhun.blade.php | 59 ++++++++---------------- routes/web.php | 2 +- 4 files changed, 36 insertions(+), 46 deletions(-) diff --git a/app/Http/Controllers/SemakController.php b/app/Http/Controllers/SemakController.php index e08c346..eeeda6f 100644 --- a/app/Http/Controllers/SemakController.php +++ b/app/Http/Controllers/SemakController.php @@ -154,22 +154,31 @@ class SemakController extends Controller return view('resit.resittebus',compact('transaction','gadai','cawangan_info','customers_info','penebusan','wakil','totaltransaction','totalBayaranAnsuran')); } - public function resit($id) + public function resit($id,$company) { + $setapi = $company == 1 + ? config('api.url') + : config('api.url_koop'); + $totaltransaction = 0; - $transaction = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/transaction/id/'. $id)->json(); + $transaction = Http::withOptions(['verify' => config('app.api_verify')])->get($setapi . '/api/transaction/id/'. $id)->json(); if(sizeof($transaction) != 0) $transaction = $transaction[0]; - $gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/'. $transaction['norujukan'])->json(); + if($transaction['nokp'] != Auth::user()->icno) + { + return response('not allowed', 403); + } + + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->get($setapi . '/api/gadai/norujukan/'. $transaction['norujukan'])->json(); if(sizeof($gadai) != 0) $gadai = $gadai[0][0]; - $customers_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. $gadai['nokp'])->json(); + $customers_info = Http::withOptions(['verify' => config('app.api_verify')])->get($setapi . '/api/customers/'. $gadai['nokp'])->json(); // if(sizeof($customers_info) != 0) // $customers_info = $customers_info[0]; diff --git a/app/Services/BayaranHistoryService.php b/app/Services/BayaranHistoryService.php index e39af37..b1c86ff 100644 --- a/app/Services/BayaranHistoryService.php +++ b/app/Services/BayaranHistoryService.php @@ -23,13 +23,13 @@ class BayaranHistoryService $bayaranHistory = $CallableHttp->get('/api/transaction/'. $this->norujukan)->json(); - $formatBayaranHistoryData = function ($x) { + $formatBayaranHistoryData = function ($x) use($tagsyarikat) { if (sizeof($x) === 0) { return $x; } $formatDate = fn($x) => Carbon::parse($x)->format('d/m/Y'); - $setResitAnsuranLink = fn($x) => route("resit.ansuran", $x); + $setResitAnsuranLink = fn($x) => route("resit.ansuran", ['id' => $x, 'company' => $tagsyarikat]); return array_map(function ($y) use ($formatDate, $setResitAnsuranLink) { $y['created_at'] = $formatDate($y['created_at']); diff --git a/resources/views/modal/marhun.blade.php b/resources/views/modal/marhun.blade.php index 3b5fa42..61cd5e0 100644 --- a/resources/views/modal/marhun.blade.php +++ b/resources/views/modal/marhun.blade.php @@ -208,28 +208,18 @@ @push('additional_js_scripts') -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/auth/pertama-kali/firsttime2.blade.php b/resources/views/auth/pertama-kali/firsttime2.blade.php index 77c3bd9..87ffbc5 100644 --- a/resources/views/auth/pertama-kali/firsttime2.blade.php +++ b/resources/views/auth/pertama-kali/firsttime2.blade.php @@ -155,7 +155,7 @@

Log Masuk From 778f3b1e2f76e2ac5de4cb3a74775f1704dd8766 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 27 Mar 2025 14:53:18 +0800 Subject: [PATCH 65/81] Fix transaction summary not showing --- app/Http/Controllers/BillplzController.php | 39 +++++++++++++--------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/BillplzController.php b/app/Http/Controllers/BillplzController.php index 443b6d8..8a154cf 100644 --- a/app/Http/Controllers/BillplzController.php +++ b/app/Http/Controllers/BillplzController.php @@ -11,23 +11,30 @@ class BillplzController extends Controller { public function __invoke(Request $request) { - $companyMapping = [ - 'PKB', - 'KOPKB', - ]; - $bills = array_reduce($companyMapping, function($carry, $company_code) use($request){ + $billplz_ids = json_decode($request->bill_ids, true); + + $account_own_by_PKB = array_filter($billplz_ids, fn($x) => $x['account_own_by'] == 'PKB'); + $account_own_by_KOPKB = array_filter($billplz_ids, fn($x) => $x['account_own_by'] == 'KOOP'); + + $bill_ids_PKB = array_map(fn($x) => $x['bill_id'], $account_own_by_PKB); + $bill_ids_PKB = array_values($bill_ids_PKB); + + $bill_ids_KOPKB = array_map(fn($x) => $x['bill_id'], $account_own_by_KOPKB); + $bill_ids_KOPKB = array_values($bill_ids_KOPKB); + + $getBillDetailFromBillplz = function($company_code, $bill_ids) { $billplzService = new BillplzService($company_code); - $billIdArray = json_decode($request->bill_ids); - $billIdArray = $billplzService->getBills($billIdArray); - $carry[$company_code] = array_filter($billIdArray, function($bill) { - return $bill !== []; - }); - return $carry; - }, []); - - return $bills; - - + return $billplzService->getBills($bill_ids); + }; + + $billDetailsKOPKB = $getBillDetailFromBillplz('KOPKB', $bill_ids_KOPKB); + $billDetailsPKB = $getBillDetailFromBillplz('PKB', $bill_ids_PKB); + + return [ + 'KOPKB' => $billDetailsKOPKB, + 'PKB' => $billDetailsPKB, + ]; + } } From 6bdfb7e488670aa20e488b292cfe034e303579a5 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Sat, 5 Apr 2025 18:02:27 +0800 Subject: [PATCH 66/81] added function to split for registration of customer --- app/Http/Controllers/TacController.php | 41 ++++++++++++++++++++------ 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/TacController.php b/app/Http/Controllers/TacController.php index 7555861..a5d4b52 100644 --- a/app/Http/Controllers/TacController.php +++ b/app/Http/Controllers/TacController.php @@ -16,12 +16,8 @@ class TacController extends Controller $tac = tacportal::where([['icno',$request->icno],['tac_no',$request->tac]])->get()->toArray(); if($tac){ - $CustomerInfo = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/customers/' . $request->icno)->json(); - $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/poskod/' . $CustomerInfo['poskod'])->json(); - $daerah = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/daerah/' . $poskod['koddaerah'])->json(); - $negeri =Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/negeri/' . $poskod['kodnegeri'])->json(); - - return response(['status' => 1, 'customerinfo' => $CustomerInfo,'namadaerah' => $daerah['namadaerah'],'namanegeri' => $negeri['negeri']]); + $DetailsCustomer = $this->getCustomerData($request->icno, true); + return response(['status' => 1, 'customerinfo' => $DetailsCustomer['customerinfo'],'namadaerah' => $DetailsCustomer['daerah']['namadaerah'],'namanegeri' => $DetailsCustomer['negeri']['negeri']]); }else{ return response(['status' => 0]); } @@ -64,8 +60,8 @@ class TacController extends Controller return response(['message' => true]); } - $CustomerInfo = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/customers/' . $request->icno)->json(); - + $CustomerInfo = $this->getCustomerData($request->icno, false); + if($CustomerInfo) { $generatestatus = $this->generateTAC($CustomerInfo); @@ -98,7 +94,7 @@ class TacController extends Controller } - $CustomerInfo = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/customers/' . $request->icno)->json(); + $CustomerInfo = $this->getCustomerData($request->icno, false); if($CustomerInfo) { @@ -174,6 +170,33 @@ class TacController extends Controller return implode('',$num); } + + private function getCustomerData($icno,$details = false){ + $CustomerInfo_PKB = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/customers/' . $icno)->json(); + $CustomerInfo_KOOPKB = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/customers/' . $icno)->json(); + + if($CustomerInfo_PKB){ + if($details == true){ + $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/poskod/' . $CustomerInfo_PKB['poskod'])->json(); + $daerah = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/daerah/' . $poskod['koddaerah'])->json(); + $negeri =Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/negeri/' . $poskod['kodnegeri'])->json(); + return ['customerinfo' => $CustomerInfo_PKB,'poskod' => $poskod,'daerah' => $daerah,'negeri' => $negeri]; + } + $CustomerInfo = $CustomerInfo_PKB; + }else if($CustomerInfo_KOOPKB){ + if($details == true){ + $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') . '/api/poskod/' . $CustomerInfo_KOOPKB['poskod'])->json(); + $daerah = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/daerah/' . $poskod['koddaerah'])->json(); + $negeri =Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/negeri/' . $poskod['kodnegeri'])->json(); + return ['customerinfo' => $CustomerInfo_KOOPKB,'poskod' => $poskod,'daerah' => $daerah,'negeri' => $negeri]; + } + $CustomerInfo = $CustomerInfo_KOOPKB; + }else{ + $CustomerInfo = null; + } + + return $CustomerInfo; + } } From 365f4010c8d0e3d115575c054349265914141083 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 6 Apr 2025 13:32:49 +0800 Subject: [PATCH 67/81] change koop first instead of pkb first --- app/Http/Controllers/TacController.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/TacController.php b/app/Http/Controllers/TacController.php index a5d4b52..7bf8dbb 100644 --- a/app/Http/Controllers/TacController.php +++ b/app/Http/Controllers/TacController.php @@ -175,22 +175,22 @@ class TacController extends Controller $CustomerInfo_PKB = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/customers/' . $icno)->json(); $CustomerInfo_KOOPKB = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/customers/' . $icno)->json(); - if($CustomerInfo_PKB){ + if($CustomerInfo_KOOPKB){ if($details == true){ - $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/poskod/' . $CustomerInfo_PKB['poskod'])->json(); + $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/poskod/' . $CustomerInfo_KOOPKB['poskod'])->json(); $daerah = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/daerah/' . $poskod['koddaerah'])->json(); $negeri =Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/negeri/' . $poskod['kodnegeri'])->json(); - return ['customerinfo' => $CustomerInfo_PKB,'poskod' => $poskod,'daerah' => $daerah,'negeri' => $negeri]; - } - $CustomerInfo = $CustomerInfo_PKB; - }else if($CustomerInfo_KOOPKB){ - if($details == true){ - $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') . '/api/poskod/' . $CustomerInfo_KOOPKB['poskod'])->json(); - $daerah = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/daerah/' . $poskod['koddaerah'])->json(); - $negeri =Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/negeri/' . $poskod['kodnegeri'])->json(); return ['customerinfo' => $CustomerInfo_KOOPKB,'poskod' => $poskod,'daerah' => $daerah,'negeri' => $negeri]; } $CustomerInfo = $CustomerInfo_KOOPKB; + }else if($CustomerInfo_PKB){ + if($details == true){ + $poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') . '/api/poskod/' . $CustomerInfo_PKB['poskod'])->json(); + $daerah = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/daerah/' . $poskod['koddaerah'])->json(); + $negeri =Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url_koop') .'/api/negeri/' . $poskod['kodnegeri'])->json(); + return ['customerinfo' => $CustomerInfo_PKB,'poskod' => $poskod,'daerah' => $daerah,'negeri' => $negeri]; + } + $CustomerInfo = $CustomerInfo_PKB; }else{ $CustomerInfo = null; } From db8c38f916e62ad2ca493b83f806bcebdde9f691 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Wed, 14 May 2025 16:08:15 +0800 Subject: [PATCH 68/81] Update composer.json --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6c677f0..7832b11 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": "MIT", "require": { "php": "^7.3|^8.0", - "barryvdh/laravel-dompdf": "^2.2", + "barryvdh/laravel-dompdf": "*", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", @@ -16,6 +16,7 @@ "laravel/framework": "^8.40", "laravel/tinker": "^2.5", "laravel/ui": "^3.3", + "milon/barcode": "^12.0", "php-http/discovery": "^1.19", "php-http/guzzle7-adapter": "^1.0", "php-http/message": "^1.16", From a8dc39a5a78f32121a3dfa2013d0772f447c4a75 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Wed, 14 May 2025 16:20:09 +0800 Subject: [PATCH 69/81] Update .env.docker.example --- .env.docker.example | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.env.docker.example b/.env.docker.example index 3468ee4..55bcc67 100644 --- a/.env.docker.example +++ b/.env.docker.example @@ -1,10 +1,11 @@ APP_NAME=Laravel APP_ENV=local -APP_KEY=base64:Her7qzZ/iDiuEBFfMZVnN8fMDOJvOZ8mmg2quO+L2ck= +APP_KEY= APP_DEBUG=true -APP_URL=http://localhost -API_URL=http://host.docker.internal:8874 -API_LELONG_URL=http://host.docker.internal:8096 +APP_URL=http://pay.localhost +API_URL=http://host.docker.internal:5002 +API_URL_KOOP==http://host.docker.internal:5000 +API_LELONG_URL=https://niklah.arrahn.com.my LOG_CHANNEL=stack LOG_LEVEL=debug @@ -51,3 +52,15 @@ PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" + +BILLPLZ_PRODUCTION_API_KEY="f3e82fe1-a422-4660-97f0-65cc59ff6c47" +BILLPLZ_PRODUCTION_X_SIGNATURE="S-alZUbzmD2_TF3vmrRqgehQ" +BILLPLZ_PRODUCTION_COLLECTION_ID="5aosv2dg" + +BILLPLZ_SANDBOX_API_KEY="abecfd0c-98d8-4635-abc2-2fcba8c60c11" +BILLPLZ_SANDBOX_X_SIGNATURE="S-GWr7z03XjAhqPsFfu_H5nQ" +BILLPLZ_SANDBOX_COLLECTION_ID="z0r4kjhi" + +BILLPLZ_SANDBOX_KOPKB_API_KEY="abecfd0c-98d8-4635-abc2-2fcba8c60c11" +BILLPLZ_SANDBOX_KOPKB_X_SIGNATURE="S-GWr7z03XjAhqPsFfu_H5nQ" +BILLPLZ_SANDBOX_KOPKB_COLLECTION_ID="uae40muk" From 1fbe5fa57c1714ddb6a82a71cb4d871e477d4312 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 15 May 2025 10:34:59 +0800 Subject: [PATCH 70/81] Update api config to refer to env first and if not present use the defaults --- config/api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/api.php b/config/api.php index 7672d1e..4004da8 100644 --- a/config/api.php +++ b/config/api.php @@ -1,5 +1,5 @@ 'https://api2.arrahn.com.my', - 'url_koop' => 'https://api3.arrahn.com.my' + 'url' => env('API_URL', 'https://api2.arrahn.com.my'), + 'url_koop' => env('API_URL_KOOP', 'https://api3.arrahn.com.my'), ]; From 3d4b1687ad6a2c29ed30c3baffde2c681c98df5e Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 15 May 2025 10:37:35 +0800 Subject: [PATCH 71/81] Update .env.docker.example to reflect with current changes of docker-composes --- .env.docker.example | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.env.docker.example b/.env.docker.example index 55bcc67..da260dc 100644 --- a/.env.docker.example +++ b/.env.docker.example @@ -1,11 +1,12 @@ APP_NAME=Laravel APP_ENV=local -APP_KEY= +APP_KEY=base64:42429JS6yzOce6gW3d+c59GBL9cJw6D5vqhWv9h7nx8= APP_DEBUG=true APP_URL=http://pay.localhost API_URL=http://host.docker.internal:5002 -API_URL_KOOP==http://host.docker.internal:5000 -API_LELONG_URL=https://niklah.arrahn.com.my +API_URL_KOOP=http://host.docker.internal:5000 +API_LELONG_URL=http://host.docker.internal:5003 +API_VERIFY=false LOG_CHANNEL=stack LOG_LEVEL=debug From 3c648b3fd16142d1a3dd246aa553a3aca2b160a0 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 15 May 2025 21:13:53 +0800 Subject: [PATCH 72/81] Use docker container network alias as host instead of localhost and hard ports --- .env.docker.example | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.docker.example b/.env.docker.example index da260dc..d0aa137 100644 --- a/.env.docker.example +++ b/.env.docker.example @@ -3,9 +3,9 @@ APP_ENV=local APP_KEY=base64:42429JS6yzOce6gW3d+c59GBL9cJw6D5vqhWv9h7nx8= APP_DEBUG=true APP_URL=http://pay.localhost -API_URL=http://host.docker.internal:5002 -API_URL_KOOP=http://host.docker.internal:5000 -API_LELONG_URL=http://host.docker.internal:5003 +API_URL=http://apiv2.localhost +API_URL_KOOP=http://apiv3.localhost +API_LELONG_URL=http://lelong.localhost API_VERIFY=false LOG_CHANNEL=stack From dd8d4d700c5c839d7f5502fe3e61de12a4e1775a Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Sun, 25 May 2025 23:01:13 +0800 Subject: [PATCH 73/81] backend validation for arrahnpay --- app/Http/Controllers/BayaranController.php | 84 ++++++++++++++++++++++ resources/views/includes/buffer.blade.php | 10 +++ resources/views/includes/home.blade.php | 11 +++ 3 files changed, 105 insertions(+) diff --git a/app/Http/Controllers/BayaranController.php b/app/Http/Controllers/BayaranController.php index 16f6803..0cb5e2a 100644 --- a/app/Http/Controllers/BayaranController.php +++ b/app/Http/Controllers/BayaranController.php @@ -86,6 +86,12 @@ class BayaranController extends Controller { ['email' => $customerEmail, 'notel' => $customerPhoneNumber, 'name' => $customerName, 'icno' => $customerIcno] = auth()->user()->toArray(); + #Validate the request + $error = $this->validateRequest($request); + if ($error) { + return redirect()->route('buffer')->with(['errorvalidate' => $error]); + } + $bayaranArrahn = array_filter($request->txtjenisbayaran, fn($x) => $x == 'arrahn'); $bayaranOthers = array_filter($request->txtjenisbayaran, fn($x) => $x != 'arrahn'); @@ -615,4 +621,82 @@ class BayaranController extends Controller return $exist_carts; } + + private function validateRequest($request) + { + $CallableHttp = $request->txtcompany == 'pkb' + ? Http::arrahn() + : Http::arrahn_koop(); + + if ( + !is_array($request->txtnorujukanhidden) || + !is_array($request->txtbayaranhidden) || + !is_array($request->txtkodcawhidden) || + count($request->txtnorujukanhidden) !== count($request->txtbayaranhidden) || + count($request->txtnorujukanhidden) !== count($request->txtkodcawhidden) + ) { + Log::error('Jumlah bayaran, norujukan dan kod cawangan tidak sepadan.', [ + 'txtnorujukanhidden' => $request->txtnorujukanhidden, + 'txtbayaranhidden' => $request->txtbayaranhidden, + 'txtkodcawhidden' => $request->txtkodcawhidden, + ]); + return 'Sila Pilih Sekali Lagi.'; + } + + foreach ($request->txtnorujukanhidden as $index => $x) { + $array_gadai = $CallableHttp->get('/api/gadai/norujukan/' . $request->txtkodcawhidden[$index] . '/' . $x)->json(); + + if (empty($array_gadai)) { + Log::error('norujukan tidak dijumpai.', [ + 'norujukan' => $x, + 'kodcaw' => $request->txtkodcawhidden[$index], + ]); + + return 'Sila Pilih Sekali lagi. Dan pastikan salah satu sahaja dipilih untuk ruangan PKB dan KOPKB.'; + } + + $array_gadai = $array_gadai[0]; + if (in_array($array_gadai['sttebus'], ['T', 'L'])) { + Log::error('Norujukan sudah ditebus.', [ + 'norujukan' => $x, + 'kodcaw' => $request->txtkodcawhidden[$index], + ]); + return 'Norujukan' . $x . ' sudah ditebus.'; + }else{ + $payment = (float) $request->txtbayaranhidden[$index]; + $remain_loan = (float) $array_gadai['bakipjm']; + $nm = (float) $array_gadai['nilaimarhun']; + $profit = 0; + + $jenisKeuntungan = $array_gadai['tagbaru'] == '1' ? 'onepercent' : 'asal'; + + $upahTawarruq = $CallableHttp + ->get('/api/upahtawarruq/' . $array_gadai['kodcaw'] . '/' . $array_gadai['norujukan'], ['jeniskeuntungan' => $jenisKeuntungan]) + ->json(); + + if ($jenisKeuntungan == 'onepercent') { + $profit = $upahTawarruq['keuntungan'] + $upahTawarruq['ujrah']; + } + + if ($jenisKeuntungan == 'asal') { + $profit = $upahTawarruq; + } + + $item = ($remain_loan - ($nm * 0.1) + $profit); + + if ($payment > $item) { + return 'Baki Pembiayaan tidak boleh kurang 10% daripada Nilai Marhun!'; + } else if ($payment < $profit && $profit !== 0.00) { + return 'Bayaran tidak boleh kurang daripada keuntungan semasa!'; + } + else if ($payment == 0.00 && $profit == 0.00) { + return 'Bayaran tidak boleh dalam nilai 0.00'; + } + + } + } + + return null; + } + } diff --git a/resources/views/includes/buffer.blade.php b/resources/views/includes/buffer.blade.php index fe6b34c..352f8ea 100644 --- a/resources/views/includes/buffer.blade.php +++ b/resources/views/includes/buffer.blade.php @@ -151,6 +151,16 @@ @enderror + @if (session('errorvalidate')) + + @endif + @if (\Session::has('error')) @enderror + @if (session('errorvalidate')) + + @endif + + @if (\Session::has('error'))

@if ($errors->has('password')) From 2a8f3a165546d47441fb9dfa1c2e3156beb54f32 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Sun, 31 Aug 2025 21:56:32 +0800 Subject: [PATCH 77/81] added baki lelong and rugi lelong --- app/Http/Controllers/HomeController.php | 36 +++++++++++++++++-- .../components/dashboard-card-small.blade.php | 29 +++++++++++++++ resources/views/includes/home.blade.php | 15 ++++++++ 3 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 resources/views/components/dashboard-card-small.blade.php diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 838ba17..b4319bb 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -38,6 +38,8 @@ class HomeController extends Controller ->get(config('api.url_koop') . '/portal/customer/info', ['ic' => $authUser['icno']]) ->json(); + $customerLelong = $this->getCustomerInfoLelong($authUser['icno']); + // ['gadai' => $customer_gadai, 'lelong' => $customer_lelong] = $customerInfo; $customer_gadai = array_merge( $customer_pkb['gadai'] ?? [], @@ -48,7 +50,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); @@ -62,7 +64,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')); } /** @@ -83,6 +85,7 @@ class HomeController extends Controller ->get(config('api.url_koop') . '/portal/customer/info', ['ic' => $authUser['icno']]) ->json(); + $customerLelong = $this->getCustomerInfoLelong($authUser['icno']); // ['gadai' => $customer_gadai, 'lelong' => $customer_lelong] = $customerInfo; $customer_gadai = array_merge( @@ -108,6 +111,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]; } } diff --git a/resources/views/components/dashboard-card-small.blade.php b/resources/views/components/dashboard-card-small.blade.php new file mode 100644 index 0000000..39efd5d --- /dev/null +++ b/resources/views/components/dashboard-card-small.blade.php @@ -0,0 +1,29 @@ +@props([ + 'title' => '', + 'subtitle' => '', + 'icon' => '', + 'iconState' => 'info', + 'cardBackgroundState' => 'white', + 'link' => '#', +]) + +
+
+
+
+
+
{{ $title }}
+ {{ $subtitle }} +
+
+ +
+ +
+
+
+
+
+
+
+
diff --git a/resources/views/includes/home.blade.php b/resources/views/includes/home.blade.php index cd77d5e..c6bf5e1 100644 --- a/resources/views/includes/home.blade.php +++ b/resources/views/includes/home.blade.php @@ -90,6 +90,21 @@ @endif
+
+ + +
+ @if (request()->get('filter') == 'pembiayaan-akan-dilelong') From 3cf8efda00f4e10b4032c3144011017544779f24 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Sat, 4 Oct 2025 21:51:32 +0800 Subject: [PATCH 78/81] added all changes for password box that can see eyes --- resources/views/auth/login.blade.php | 26 ++++++++- resources/views/auth/loginbackup.blade.php | 30 +++++++++- .../views/auth/passwords/confirm.blade.php | 28 +++++++++- .../views/auth/passwords/reset.blade.php | 43 ++++++++++++-- resources/views/auth/register.blade.php | 42 +++++++++++++- resources/views/auth/registerportal.blade.php | 42 +++++++++++++- resources/views/includes/profile.blade.php | 56 ++++++++++++++++++- resources/views/profile/edit.blade.php | 56 ++++++++++++++++++- 8 files changed, 303 insertions(+), 20 deletions(-) diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index d24e5a1..935cb2f 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -24,8 +24,20 @@ @endif
-
+
+ + + + + +
@if ($errors->has('password')) @@ -109,5 +121,17 @@ slides[slideIndex - 1].style.display = "block"; setTimeout(showSlides, 10000); // Change image every 2 seconds } + + function togglePasswordVisibility(inputId, iconId) { + const passwordInput = document.getElementById(inputId); + const eyeIcon = document.getElementById(iconId); + if (passwordInput.type === 'password') { + passwordInput.type = 'text'; + eyeIcon.setAttribute('fill', '#12B652'); + } else { + passwordInput.type = 'password'; + eyeIcon.setAttribute('fill', '#6c757d'); + } + } @endsection \ No newline at end of file diff --git a/resources/views/auth/loginbackup.blade.php b/resources/views/auth/loginbackup.blade.php index f0a0741..d9eaca5 100644 --- a/resources/views/auth/loginbackup.blade.php +++ b/resources/views/auth/loginbackup.blade.php @@ -45,11 +45,23 @@ @endif
-
+
- + + + + + + +
@if ($errors->has('password')) @@ -86,4 +98,18 @@
+ + @endsection diff --git a/resources/views/auth/passwords/confirm.blade.php b/resources/views/auth/passwords/confirm.blade.php index ca78fc1..5bfdb45 100644 --- a/resources/views/auth/passwords/confirm.blade.php +++ b/resources/views/auth/passwords/confirm.blade.php @@ -16,8 +16,20 @@
-
+
+ + + + + + @error('password') @@ -46,4 +58,18 @@
+ + @endsection diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/auth/passwords/reset.blade.php index cbcd2d2..f698af2 100644 --- a/resources/views/auth/passwords/reset.blade.php +++ b/resources/views/auth/passwords/reset.blade.php @@ -19,8 +19,20 @@
@endif -
+
+ + + + + +
@if ($errors->has('password')) @@ -31,11 +43,22 @@ {{ __('password strength') }}: none
-
+
- - +
+ + + + + +
@@ -68,6 +91,18 @@ } } } + + function togglePasswordVisibility(inputId, iconId) { + const passwordInput = document.getElementById(inputId); + const eyeIcon = document.getElementById(iconId); + if (passwordInput.type === 'password') { + passwordInput.type = 'text'; + eyeIcon.setAttribute('fill', '#12B652'); + } else { + passwordInput.type = 'password'; + eyeIcon.setAttribute('fill', '#6c757d'); + } + } @endsection \ No newline at end of file diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 46aabf6..eca32ae 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -45,11 +45,23 @@
-
+
+ + + + + +
@if ($errors->has('password')) @@ -58,11 +70,23 @@ @endif
-
+
- + + + + + + +
@@ -212,6 +236,18 @@ setTimeout(showSlides, 10000); // Change image every 2 seconds } + function togglePasswordVisibility(inputId, iconId) { + const passwordInput = document.getElementById(inputId); + const eyeIcon = document.getElementById(iconId); + if (passwordInput.type === 'password') { + passwordInput.type = 'text'; + eyeIcon.setAttribute('fill', '#12B652'); + } else { + passwordInput.type = 'password'; + eyeIcon.setAttribute('fill', '#6c757d'); + } + } + -
+
+ + + + + +
@if ($errors->has('password')) @@ -44,8 +56,20 @@
-
- +
+ + + + + + +
@@ -178,5 +202,17 @@ // slides[slideIndex - 1].style.display = "block"; // setTimeout(showSlides, 10000); // Change image every 2 seconds // } + + function togglePasswordVisibility(inputId, iconId) { + const passwordInput = document.getElementById(inputId); + const eyeIcon = document.getElementById(iconId); + if (passwordInput.type === 'password') { + passwordInput.type = 'text'; + eyeIcon.setAttribute('fill', '#12B652'); + } else { + passwordInput.type = 'password'; + eyeIcon.setAttribute('fill', '#6c757d'); + } + } @endsection \ No newline at end of file diff --git a/resources/views/includes/profile.blade.php b/resources/views/includes/profile.blade.php index a69a4cc..7cc4b68 100644 --- a/resources/views/includes/profile.blade.php +++ b/resources/views/includes/profile.blade.php @@ -117,9 +117,21 @@
-
+
+ + + + + + @if ($errors->has('old_password')) @@ -130,9 +142,21 @@
-
+
+ + + + + + @if ($errors->has('password')) @@ -140,9 +164,21 @@ @endif
-
+
+ + + + + +
@@ -171,4 +207,18 @@
+ + @endsection \ No newline at end of file diff --git a/resources/views/profile/edit.blade.php b/resources/views/profile/edit.blade.php index aa79c5c..5acb3af 100644 --- a/resources/views/profile/edit.blade.php +++ b/resources/views/profile/edit.blade.php @@ -98,9 +98,21 @@ @endif
-
+
+ + + + + + @if ($errors->has('old_password')) @@ -108,9 +120,21 @@ @endif
-
+
+ + + + + + @if ($errors->has('password')) @@ -118,9 +142,21 @@ @endif
-
+
+ + + + + +
@@ -137,4 +173,18 @@ {{-- @include('layouts.footers.auth') --}}
+ + @endsection \ No newline at end of file From 880e8b3928614d5def58dbb2e3443bb7113852ea Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sat, 15 Nov 2025 23:26:11 +0800 Subject: [PATCH 79/81] disabled cawangan v2 --- app/Services/PembiayaanService.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Services/PembiayaanService.php b/app/Services/PembiayaanService.php index c7a141c..d434697 100644 --- a/app/Services/PembiayaanService.php +++ b/app/Services/PembiayaanService.php @@ -272,7 +272,15 @@ class PembiayaanService return in_array($x->norujukan, $norujukanExcludeList); }; - return array_map(function ($x) use ($isNorujukanPaymentRecentlyAttempted, $isNorujukanAkanDilelong, $isNorujukanIsInFasa2, $isCawanganNotPermitUjrahPayment, $checkExcludePaymentList) { + $isCawanganVersion2 = function ($x){ + + if($x->tag_syarikat == 1 && $x->kodcaw != 'KB1'){ + return true; + } + return false; + }; + + return array_map(function ($x) use ($isNorujukanPaymentRecentlyAttempted, $isNorujukanAkanDilelong, $isNorujukanIsInFasa2, $isCawanganNotPermitUjrahPayment, $checkExcludePaymentList,$isCawanganVersion2) { $x->disabled_payment = false; @@ -282,6 +290,7 @@ class PembiayaanService || $isNorujukanPaymentRecentlyAttempted($x) || $isCawanganNotPermitUjrahPayment($x) || $checkExcludePaymentList($x) + || $isCawanganVersion2($x) ) { $x->disabled_payment = true; } From 27c6cb854770a78cf6fba7621b7077a047f202eb Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sat, 22 Nov 2025 22:37:40 +0800 Subject: [PATCH 80/81] added disabled cawangan for marquee text that have precaution text --- resources/views/includes/home.blade.php | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/resources/views/includes/home.blade.php b/resources/views/includes/home.blade.php index 0fdedd9..582bdd1 100644 --- a/resources/views/includes/home.blade.php +++ b/resources/views/includes/home.blade.php @@ -2,6 +2,50 @@ @section('content') Home | Portal Pelanggan + + +
+
+
+ ⚠️ Tuan/Puan diminta hadir ke cawangan Ar-Rahn bagi urusan pembayaran keuntungan kerana transaksi bagi sag terpilih tidak dapat dilakukan melalui sistem ketika ini susulan kerja-kerja penaiktarafan yang sedang dijalankan ⚠️ +
+
+
+
From d14aaabba4ef4ffc006a4c65b05db88606adcc66 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 23 Nov 2025 13:31:25 +0800 Subject: [PATCH 81/81] changed a bit of notice in marque text --- resources/views/includes/home.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/includes/home.blade.php b/resources/views/includes/home.blade.php index 582bdd1..18c69c9 100644 --- a/resources/views/includes/home.blade.php +++ b/resources/views/includes/home.blade.php @@ -41,7 +41,7 @@
- ⚠️ Tuan/Puan diminta hadir ke cawangan Ar-Rahn bagi urusan pembayaran keuntungan kerana transaksi bagi sag terpilih tidak dapat dilakukan melalui sistem ketika ini susulan kerja-kerja penaiktarafan yang sedang dijalankan ⚠️ + ⚠️ Tuan/Puan diminta hadir ke cawangan Ar-Rahn bagi pembayaran keuntungan SAG terpilih kerana transaksi tidak dapat dilakukan melalui ArRahnPay buat sementara waktu susulan kerja penaiktarafan sistem ⚠️