@extends('layouts.app', ['title' => __tr('Subscription')]) @section('content') @include('users.partials.header', [ 'title' => __tr('Subscription'), 'description' => '', 'class' => 'col-lg-7' ]) @if(isset($message))
{{ $message }}
@else @php $subscriptionPlans = getAppSettings('subscription_plans'); $hasPlansForPurchase = false; foreach ($planStructure as $planKey => $plan) { $plan = $planDetails[$planKey]; if (!$plan['enabled']) { continue; } $hasPlansForPurchase = true; break; } @endphp
@if(getAppSettings('enable_stripe') and !$isValidStripeKeys)
{{ __tr('Stripe is not correctly configured, Invalid Keys. Please contact administrator') }}
@endif
@if (request('success') == true and request('message'))
{{ request('message') }}
@elseif(request('message'))
{{ request('message') }}
@endif @if ($currentPlan and $subscriber->subscribed($currentPlan['id'])) @if ($subscriber->subscription($currentPlan['id'])->onTrial())
{{ __tr('You are on trial until __trialEndsAt__', [ '__trialEndsAt__' => formatDateTime($subscriber->trialEndsAt($currentPlan['id'])) ]) }}
@endif @if ($subscriber->subscription($currentPlan['id'])->onGracePeriod())
{{ __tr('Subscription has been cancelled and you are on the grace period till __endsAt__', [ '__endsAt__' => formatDateTime($subscriber->subscription($currentPlan['id'])->ends_at) ]) }}
@endif
{{ __tr('Current Plan') }}

{{ $planDetails[$currentPlan['id']]['title'] }}

@foreach ($planStructure[$currentPlan['id']]['features'] as $featureKey => $featureValue) @php $featureValue = $planDetails[$currentPlan['id']]['features'][$featureKey]; @endphp
@if (isset($featureValue['limit']) and $featureValue['limit'] < 0) {{ __tr('Unlimited') }} @elseif(isset($featureValue['limit'])) {{ $featureValue['limit'] }} @endif {{ Str::title($featureValue['description']) }} @if(isset($featureValue['limit_duration_title'])) {{ Str::title($featureValue['limit_duration_title']) }} @endif
@endforeach @foreach ($planDetails[$currentPlan['id']]['charges'] as $itemKey => $itemValue) @if ($planSelectorId === $currentPlan['id'] . '___' . $itemKey) @endif @endforeach
@if (!$subscriber->subscription($currentPlan['id'])->canceled()) {{ __tr('Cancel Subscription') }} @endif @else @if ($freePlanDetails['enabled'])
{{ __tr('Current Plan') }}

{{ $freePlanDetails['title'] }}

@foreach ($freePlanStructure['features'] as $featureKey => $featureValue) @php $featureValue = $freePlanDetails['features'][$featureKey]; @endphp
@if (isset($featureValue['limit']) and $featureValue['limit'] < 0) {{ __tr('Unlimited') }} @elseif(isset($featureValue['limit'])) {{ $featureValue['limit'] }} @endif {{ Str::title($featureValue['description']) }} @if(isset($featureValue['limit_duration_title'])) {{ Str::title($featureValue['limit_duration_title']) }} @endif
@endforeach
@else
{{ __tr('There are no active plan') }}
@endif @endif @if(getAppSettings('enable_stripe') and $isValidStripeKeys) {{ __tr('Go to Billing Portal') }} @if ($currentPlan and $subscriber->subscription($currentPlan['id']) and $subscriber->subscription($currentPlan['id'])->canceled() and $subscriber->subscription($currentPlan['id'])->onGracePeriod()) {{ __tr('Resume Subscription') }}
{{ __tr('You will be able to resume subscription while on grace period') }}
@endif @if ($currentPlan and $subscriber->hasIncompletePayment($currentPlan['id'])) @endif @endif
@if(getAppSettings('enable_stripe') and $isValidStripeKeys) @if ($currentPlan and $hasPlansForPurchase)
{{ __tr('Change Plan') }}
@csrf @foreach ($planStructure as $planKey => $plan) @php $planId = $plan['id']; $features = $plan['features']; $plan = $planDetails[$planKey]; if (!$plan['enabled']) { continue; } @endphp
{{ $plan['title'] }} @foreach ($features as $featureKey => $featureValue) @php $featureValue = $planDetails[$planKey]['features'][$featureKey]; @endphp
@if (isset($featureValue['limit']) and $featureValue['limit'] < 0) {{ __tr('Unlimited') }} @elseif(isset($featureValue['limit'])) {{ $featureValue['limit'] }} @if(isset($featureValue['limit_duration'])) {{ Str::title($featureValue['limit_duration']) }} @endif @endif {{ Str::title($featureValue['description']) }}
@endforeach
@foreach ($plan['charges'] as $itemKey => $itemValue) @php if(!$itemValue['enabled']) { continue; } @endphp @if ($planSelectorId !== $planId . '___' . $itemKey)
@endif @endforeach
@endforeach
@endif @if (!$currentPlan)
@csrf
@foreach ($planStructure as $planKey => $plan) @php $planId = $plan['id']; $features = $plan['features']; $charges = $planDetails[$planKey]['charges']; if (!$planDetails[$planKey]['enabled']) { continue; } @endphp
{{ $plan['title'] }} @foreach ($features as $featureKey => $featureValue) @php $featureValue = $planDetails[$planKey]['features'][$featureKey]; @endphp
@if (isset($featureValue['limit']) and $featureValue['limit'] < 0) {{ __tr('Unlimited') }} @elseif(isset($featureValue['limit'])) {{ $featureValue['limit'] }} @if(isset($featureValue['limit_duration'])) {{ Str::title($featureValue['limit_duration']) }} @endif @endif {{ Str::title($featureValue['description']) }}
@endforeach
@foreach ($charges as $itemKey => $itemValue) @php if(!$itemValue['enabled']) { continue; } @endphp @if ($planSelectorId !== $planId . '___' . $itemKey)
@endif @endforeach
@endforeach
@if($hasPlansForPurchase)
{{ __tr('Credit or debit card') }}
@else
{{ __tr('No plans to subscribe') }}
@endif
@endif @endif
{{ __tr('Invoices') }}
@foreach ($invoices as $invoice) @endforeach
{{ __tr('Number') }} {{ __tr('Date') }} {{ __tr('Total') }} {{ __tr('Invoice Download') }}
{{ $invoice->number }} {{ $invoice->date()->toDayDateTimeString() }} {{ $invoice->total() }} {{ __tr('Download') }}
@endif @endsection @if(!isset($message)) @push('appScripts') @if(getAppSettings('enable_stripe') and $isValidStripeKeys) @if(!$currentPlan and $hasPlansForPurchase) @endif @endif @endpush @endif