From 8bc4896daa3d341b93b94cef631d15359ade8f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 22 Mar 2021 13:34:59 +0100 Subject: [PATCH] Hide/show coupon code field if promo code configured in billing tableclear --- app/Http/Livewire/BillingPortalPurchase.php | 2 +- .../billing-portal-purchase.blade.php | 28 ++++++++++--------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/Http/Livewire/BillingPortalPurchase.php b/app/Http/Livewire/BillingPortalPurchase.php index 9e198d4aaa0f..144f721e313a 100644 --- a/app/Http/Livewire/BillingPortalPurchase.php +++ b/app/Http/Livewire/BillingPortalPurchase.php @@ -262,7 +262,7 @@ class BillingPortalPurchase extends Component 'client_contact_id' => $this->contact->hashed_id, ]], 'user_input_promo_code' => $this->coupon, - 'coupon' => $this->coupon, + 'coupon' => empty($this->billing_subscription->promo_code) ? '' : $this->coupon, 'quantity' => $this->quantity, ]; diff --git a/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php b/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php index 9719bcc3376c..c5f92ba13cd6 100644 --- a/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/billing-portal-purchase.blade.php @@ -139,22 +139,24 @@ @endif -
-
-
+ @if(!empty($billing_subscription->promo_code)) +
+
+
+
+ +
+ Have a coupon code? +
-
- Have a coupon code? +
+
-
- -
- -
+ @endif