From 05cbd30bef7186b702e51ad76a9341524049c6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 29 Mar 2021 15:50:36 +0200 Subject: [PATCH] wip --- app/Http/Livewire/BillingPortalPurchase.php | 17 +++++++++++++++++ .../livewire/billing-portal-purchase.blade.php | 15 +++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/Http/Livewire/BillingPortalPurchase.php b/app/Http/Livewire/BillingPortalPurchase.php index 387528942cbb..94d5e007cbcd 100644 --- a/app/Http/Livewire/BillingPortalPurchase.php +++ b/app/Http/Livewire/BillingPortalPurchase.php @@ -139,6 +139,16 @@ class BillingPortalPurchase extends Component */ public $request_data; + /** + * @var string + */ + public $price; + + public function mount() + { + $this->price = $this->subscription->service()->price(); + } + /** * Handle user authentication * @@ -331,6 +341,13 @@ class BillingPortalPurchase extends Component return 0; } + public function handleCoupon() + { + if ($this->coupon == $this->subscription->promo_code) { + $this->price = $this->subscription->promo_price; + } + } + public function render() { if ($this->contact instanceof ClientContact) { 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 01625448208d..d74698642873 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 @@ -37,7 +37,7 @@
{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} -{{-- (1x)--}} + {{-- (1x)--}}
@endforeach @@ -57,7 +57,7 @@
{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} -{{-- (1x)--}} + {{-- (1x)--}}
@endforeach @@ -71,7 +71,7 @@

- {{ ctrans('texts.total') }}: {{ $subscription->service()->price() }} + {{ ctrans('texts.total') }}: {{ $price }}

@@ -184,12 +184,15 @@ -
+
+ @csrf + -
+ + + @endif