diff --git a/TODO.md b/TODO.md index d7d4084..705f392 100644 --- a/TODO.md +++ b/TODO.md @@ -3,7 +3,7 @@ ## Note [x] Kerjakan dulu semua yang terkait penjualan normal, deposit normal dan bonus poin transaksi dan downline -[ ] setelah itu baru penukaran voucher -> sedang ngerjain ini +[x] setelah itu baru penukaran voucher -> sedang ngerjain ini [ ] baru setelah itu yang berhubungan dengan mitrawbb dan hutang ## Front @@ -11,7 +11,8 @@ - [x] transaksi pembelian - [x] transaksi pembelian + dapat poin downline - [x] [BUG] pembelian voucher lebih dari 1 mendapat kode yang sama -- [ ] penuakaran voucher +- [x] penuakaran voucher +- [x] akun dibekukan tidak dapat melakukan transaksi - [x] tambah metode topup deposit dengan setor tunai kantor wbb - [x] mengubah metode pembayaran deposit dengan daftar bank seperti deposit dan tampil logo bank - [x] tampilan keranjang jadi lebih seperti tokped dengan metode pembayaran deposit atau hutang jika tersedia diff --git a/app/Http/Controllers/Customer/CartController.php b/app/Http/Controllers/Customer/CartController.php index 70efa68..95f6afc 100644 --- a/app/Http/Controllers/Customer/CartController.php +++ b/app/Http/Controllers/Customer/CartController.php @@ -54,6 +54,12 @@ class CartController extends Controller $operator = $request->param ?? 'add'; //delete, sub, add $customer = $request->user('customer'); + if (!$customer->allow_transaction) { + $customer->carts()->delete(); + return redirect()->back() + ->with('message', ['type' => 'error', 'message' => 'akun anda dibekukan tidak dapat melakukan transaksi',]); + } + $item = $customer->carts()->where(['entity_id' => $profile->id])->first(); if ($item !== null) { if ($operator == 'delete') { diff --git a/app/Http/Controllers/Customer/DepositController.php b/app/Http/Controllers/Customer/DepositController.php index b161764..d51af5f 100644 --- a/app/Http/Controllers/Customer/DepositController.php +++ b/app/Http/Controllers/Customer/DepositController.php @@ -41,8 +41,14 @@ class DepositController extends Controller ]); } - public function create() + public function create(Request $request) { + $customer = $request->user('customer'); + if (!$customer->allow_transaction) { + return redirect()->back() + ->with('message', ['type' => 'error', 'message' => 'akun anda dibekukan tidak dapat melakukan transaksi',]); + } + return inertia('Deposit/Topup', [ 'payments' => GeneralService::getEnablePayment(), ]); diff --git a/app/Http/Controllers/Customer/PoinExchangeController.php b/app/Http/Controllers/Customer/PoinExchangeController.php index 4d9693f..1ca0c5b 100644 --- a/app/Http/Controllers/Customer/PoinExchangeController.php +++ b/app/Http/Controllers/Customer/PoinExchangeController.php @@ -62,8 +62,14 @@ class PoinExchangeController extends Controller ]); } - public function exchange(LocationProfile $profile) + public function exchange(Request $request, LocationProfile $profile) { + $customer = $request->user('customer'); + if (!$customer->allow_transaction) { + return redirect()->back() + ->with('message', ['type' => 'error', 'message' => 'akun anda dibekukan tidak dapat melakukan transaksi',]); + } + $batchCount = $profile->count_unsold(); if ($batchCount < 1) { return redirect()->route('customer.poin.exchange') diff --git a/app/Models/Customer.php b/app/Models/Customer.php index ff1528c..173c2db 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -221,6 +221,16 @@ class Customer extends Authenticatable }); } + public function allowTransaction(): Attribute + { + return Attribute::make(get: function () { + if ($this->status == self::STATUS_SUSPEND) { + return false; + } + return true; + }); + } + public function level() { return $this->belongsTo(CustomerLevel::class, 'customer_level_id'); diff --git a/resources/js/Customer/Profile/Index.jsx b/resources/js/Customer/Profile/Index.jsx index 89b1033..e740bb3 100644 --- a/resources/js/Customer/Profile/Index.jsx +++ b/resources/js/Customer/Profile/Index.jsx @@ -12,6 +12,7 @@ import { useModalState } from '@/hooks' import CustomerLayout from '@/Layouts/CustomerLayout' import ModalConfirm from '@/Components/ModalConfirm' import BalanceBanner from '../Index/Partials/BalanceBanner' +import { STATUS_SUSPEND } from '@/constant' export default function Index({ auth: { user }, @@ -84,21 +85,37 @@ export default function Index({ {/* saldo */} -
-
- handleReferalCopyToClipboard(user.referral_code) - } - > -
Referral Code:
-
{user.referral_code}
-
- + {user.status === STATUS_SUSPEND ? ( +
+
+
+ Akun sedang dibekukan / suspend tidak dapat + melakukan transaksi +
-
+ ) : ( +
+
+ handleReferalCopyToClipboard(user.referral_code) + } + > +
Referral Code:
+
+ {user.referral_code} +
+
+ +
+
+
+ )}
{user.is_allow_paylater && (