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 }} + +
- {{ ctrans('texts.recurring_purchases') }} -
-{!! nl2br($product->notes) !!}
+ @endif +{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} / {{ App\Models\RecurringInvoice::frequencyForKey($subscription->frequency_id) }}
+- {{ ctrans('texts.one_time_purchases') }} -
-{!! nl2br($product->notes) !!}
-{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}
+{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}
+{{ ctrans('texts.qty') }}
+ +{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }}
+{{ ctrans('texts.qty') }}
+ +