From bdf416300a0f6c5a8687c1688b122e6fdec872c9 Mon Sep 17 00:00:00 2001 From: Aji Kamaludin Date: Fri, 30 Jun 2023 13:19:17 +0700 Subject: [PATCH] fix template prepare paylater repayment --- .../Controllers/Customer/PaylaterController.php | 8 ++++++++ app/Models/DepositHistory.php | 14 ++++++++------ app/Models/PaylaterHistory.php | 4 ++-- resources/js/Layouts/AuthenticatedLayout.jsx | 10 ++++------ resources/js/Pages/Banner/Index.jsx | 2 +- resources/js/Pages/Customer/Index.jsx | 9 +++++---- resources/js/Pages/Location/SelectionInput.jsx | 2 +- resources/js/Pages/Sale/ModalFilter.jsx | 2 +- resources/views/admin.blade.php | 2 +- 9 files changed, 31 insertions(+), 22 deletions(-) diff --git a/app/Http/Controllers/Customer/PaylaterController.php b/app/Http/Controllers/Customer/PaylaterController.php index abe07f5..9847901 100644 --- a/app/Http/Controllers/Customer/PaylaterController.php +++ b/app/Http/Controllers/Customer/PaylaterController.php @@ -24,4 +24,12 @@ class PaylaterController extends Controller 'paylater' => $paylater, ]); } + + public function create() + { + } + + public function store() + { + } } diff --git a/app/Models/DepositHistory.php b/app/Models/DepositHistory.php index 4252649..bd35247 100644 --- a/app/Models/DepositHistory.php +++ b/app/Models/DepositHistory.php @@ -22,6 +22,8 @@ class DepositHistory extends Model const STATUS_EXPIRED = 6; + const STATUS_HIDDEN = 7; + const TYPE_DEPOSIT = 0; const TYPE_REPAYMENT = 1; @@ -98,10 +100,10 @@ class DepositHistory extends Model { return Attribute::make(get: function () { if ($this->credit == 0) { - return 'Rp '.number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.'); + return 'Rp ' . number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.'); } - return '-Rp '.number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.'); + return '-Rp ' . number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.'); }); } @@ -142,7 +144,7 @@ class DepositHistory extends Model } Notification::create([ 'entity_type' => User::class, - 'description' => $this->customer->fullname.' melakukan deposit transfer manual sebesar : '.$this->amount.$status, + 'description' => $this->customer->fullname . ' melakukan deposit transfer manual sebesar : ' . $this->amount . $status, ]); } @@ -153,14 +155,14 @@ class DepositHistory extends Model } Notification::create([ 'entity_type' => User::class, - 'description' => $this->customer->fullname.' melakukan deposit manual sebesar : '.$this->amount.$status, + 'description' => $this->customer->fullname . ' melakukan deposit manual sebesar : ' . $this->amount . $status, ]); } if ($this->payment_channel == Setting::PAYMENT_MIDTRANS) { Notification::create([ 'entity_type' => User::class, - 'description' => $this->customer->fullname.' melakukan deposit via midtrans sebesar : '.$this->amount, + 'description' => $this->customer->fullname . ' melakukan deposit via midtrans sebesar : ' . $this->amount, ]); } } @@ -169,7 +171,7 @@ class DepositHistory extends Model { Notification::create([ 'entity_id' => $this->customer_id, - 'description' => 'Deposit '.$this->description.' sebesar '.$this->amount.' sudah sukses diterima', + 'description' => 'Deposit ' . $this->description . ' sebesar ' . $this->amount . ' sudah sukses diterima', ]); } } diff --git a/app/Models/PaylaterHistory.php b/app/Models/PaylaterHistory.php index 16335a1..8406840 100644 --- a/app/Models/PaylaterHistory.php +++ b/app/Models/PaylaterHistory.php @@ -74,10 +74,10 @@ class PaylaterHistory extends Model { return Attribute::make(get: function () { if ($this->credit == 0) { - return 'Rp'.number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.'); + return 'Rp' . number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.'); } - return '-Rp'.number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.'); + return '-Rp' . number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.'); }); } } diff --git a/resources/js/Layouts/AuthenticatedLayout.jsx b/resources/js/Layouts/AuthenticatedLayout.jsx index 2427867..1ff25cc 100644 --- a/resources/js/Layouts/AuthenticatedLayout.jsx +++ b/resources/js/Layouts/AuthenticatedLayout.jsx @@ -190,17 +190,15 @@ export default function Authenticated({ -
+
-
+
{page !== '' && (
-
+
{canCreate && ( diff --git a/resources/js/Pages/Customer/Index.jsx b/resources/js/Pages/Customer/Index.jsx index 9404b40..cefd842 100644 --- a/resources/js/Pages/Customer/Index.jsx +++ b/resources/js/Pages/Customer/Index.jsx @@ -92,9 +92,9 @@ export default function Customer(props) { -
-
-
+
+
+
Basic
@@ -122,7 +122,7 @@ export default function Customer(props) {
-
+
{canCreate && ( @@ -384,6 +384,7 @@ export default function Customer(props) {
+ ) diff --git a/resources/js/Pages/Location/SelectionInput.jsx b/resources/js/Pages/Location/SelectionInput.jsx index 8d5b344..f3ab335 100644 --- a/resources/js/Pages/Location/SelectionInput.jsx +++ b/resources/js/Pages/Location/SelectionInput.jsx @@ -48,10 +48,10 @@ export default function SelectionInput(props) { setIsSelected(true) if (type === 'id') { onItemSelected(item.id) + setSelected(item.name) } else { onItemSelected(item) } - setSelected(item.name) setIsOpen(false) } diff --git a/resources/js/Pages/Sale/ModalFilter.jsx b/resources/js/Pages/Sale/ModalFilter.jsx index 0c1e491..242b1b2 100644 --- a/resources/js/Pages/Sale/ModalFilter.jsx +++ b/resources/js/Pages/Sale/ModalFilter.jsx @@ -49,7 +49,7 @@ export default function ModalFilter(props) {
{locations.map((location) => (
{location.name}
diff --git a/resources/views/admin.blade.php b/resources/views/admin.blade.php index a94b7df..742d1d5 100644 --- a/resources/views/admin.blade.php +++ b/resources/views/admin.blade.php @@ -16,7 +16,7 @@ @vite(['resources/js/admin.jsx', "resources/js/Pages/{$page['component']}.jsx"]) @inertiaHead - + @inertia