From 043178fbdb67447007cad3f628d669bdf30042f9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 1 Dec 2022 17:05:27 +1100 Subject: [PATCH] changes for layout of Subscriptions --- .../Subscription/SubscriptionService.php | 47 +++++ .../billing-portal-purchasev2.blade.php | 193 ++++++++++-------- 2 files changed, 160 insertions(+), 80 deletions(-) diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index ac044bc2350d..f4256b6399aa 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -879,6 +879,53 @@ class SubscriptionService } + /* OPTIONAL PRODUCTS*/ + /** + * Get the single charge products for the + * subscription + * + */ + public function optional_products() + { + if(!$this->subscription->optional_product_ids) + return collect(); + + $keys = $this->transformKeys(explode(",", $this->subscription->optional_product_ids)); + + if(is_array($keys)) + return Product::whereIn('id', $keys)->get(); + else + return Product::where('id', $keys)->get(); + } + + /** + * Get the recurring products for the + * subscription + * + */ + public function optional_recurring_products() + { + if(!$this->subscription->optional_recurring_product_ids) + return collect(); + + $keys = $this->transformKeys(explode(",", $this->subscription->optional_recurring_product_ids)); + + if(is_array($keys)){ + return Product::whereIn('id', $keys)->get(); + } + else{ + return Product::where('id', $keys)->get(); + } + + } + + + + + + + + /** * Get available upgrades & downgrades for the plan. * diff --git a/resources/views/portal/ninja2020/components/livewire/billing-portal-purchasev2.blade.php b/resources/views/portal/ninja2020/components/livewire/billing-portal-purchasev2.blade.php index 5a5bd3bb707f..08db6b38075b 100644 --- a/resources/views/portal/ninja2020/components/livewire/billing-portal-purchasev2.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/billing-portal-purchasev2.blade.php @@ -11,105 +11,138 @@ {{ $subscription->name }} + + + + +
+

Optional products

+
+ +
+ + +
-
+

{{ ctrans('texts.order') }}