From c47fc8792eae3c6ffd37d06a7c1448e1ad72ce9f Mon Sep 17 00:00:00 2001 From: fsociety Date: Mon, 30 Sep 2024 15:32:43 +0200 Subject: [PATCH] feat: update payment status handling in profile view Removed the 'paid' state and replaced its usage with 'currentYearIsPaid' state in profile view. This change improves the accuracy of payment status tracking. Also, added a line to refresh the 'currentPleb' object after creating a PaymentEvent and set 'qrCode' to null when the current year is paid. --- resources/views/pages/association/profile.blade.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/resources/views/pages/association/profile.blade.php b/resources/views/pages/association/profile.blade.php index e645008..3e25b7f 100644 --- a/resources/views/pages/association/profile.blade.php +++ b/resources/views/pages/association/profile.blade.php @@ -29,7 +29,6 @@ state(['events' => []]); state(['payments' => []]); state(['invoice' => null]); state(['qrCode' => null]); -state(['paid' => false]); state(['amountToPay' => 1]); state(['currentYearIsPaid' => false]); state(['currentPubkey' => null]); @@ -63,6 +62,7 @@ on([ } if ($this->currentPleb->paymentEvents->count() < 1) { $this->createPaymentEvent(); + $this->currentPleb->refresh(); } $this->loadEvents(); $this->searchPaymentEvent(); @@ -70,7 +70,7 @@ on([ ]); $listenForPayment = function () { - if (!$this->paid) { + if (!$this->currentYearIsPaid) { $this->searchPaymentEvent(); } }; @@ -127,10 +127,9 @@ $searchPaymentEvent = function () { ); if ($this->currentYearIsPaid) { + $this->qrCode = null; $this->currentPleb->paymentEvents->first()->update(['paid' => true]); } - - $this->paid = true; } };