@extends('layouts.app', ['title' => __tr('My Subscription')]) @section('content') @include('users.partials.header', [ 'title' => __tr('My Subscription'), 'description' => '', 'class' => 'col-lg-7' ]) @if(isset($message))
{{ $message }}
@else @php $subscriptionPlans = getAppSettings('subscription_plans'); $isManualSubscription = $currentSubscription?->plan_id ? true : false; $isCashierSubscription = $currentSubscription?->stripe_status ? true : false; $hasPlansForPurchase = false; foreach ($planStructure as $planKey => $plan) { $plan = $planDetails[$planKey]; if (!$plan['enabled']) { continue; } $hasPlansForPurchase = true; break; } @endphp
@if ($errors->any())
@foreach ($errors->all() as $error) {{ $error }} @endforeach
@endif @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 ($isManualSubscription or $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 $structureFeatureValue = $featureValue; $featureValue = $planDetails[$currentPlan['id']]['features'][$featureKey]; @endphp
@if (isset($featureValue['type']) and ($featureValue['type'] == 'switch')) @if (isset($featureValue['limit']) and $featureValue['limit']) @else @endif {{ ($structureFeatureValue['description']) }} @else @if (isset($featureValue['limit']) and $featureValue['limit'] < 0) {{ __tr('Unlimited') }} @elseif(isset($featureValue['limit'])) {{ $featureValue['limit'] }} @endif {{ ($structureFeatureValue['description']) }} @if(isset($featureValue['limit_duration_title'])) {{ ($featureValue['limit_duration_title']) }} @endif @endif
@endforeach @if($currentSubscription->charges) @else @foreach ($planDetails[$currentPlan['id']]['charges'] as $itemKey => $itemValue) @if ($planSelectorId === $currentPlan['id'] . '___' . $itemKey) @endif @endforeach @endif
@if ($currentSubscription->ends_at ?? null)

{{ __tr('Expiry Date: __expiryDate__', [ '__expiryDate__' => formatDate($currentSubscription->ends_at) ]) }}

@endif @if ($isCashierSubscription and !$subscriber->subscription($currentPlan['id'])?->canceled()) {{ __tr('Cancel Subscription') }} @endif @stack('autoCancelSubscriptionStack') @else @if ($freePlanDetails['enabled'])
{{ __tr('Current Plan') }}

{{ $freePlanDetails['title'] }}

@foreach ($freePlanStructure['features'] as $featureKey => $featureValue) @php $structureFeatureValue = $featureValue; $featureValue = $freePlanDetails['features'][$featureKey]; @endphp
@if (isset($featureValue['type']) and ($featureValue['type'] == 'switch')) @if (isset($featureValue['limit']) and $featureValue['limit']) @else @endif {{ ($structureFeatureValue['description']) }} @else @if (isset($featureValue['limit']) and $featureValue['limit'] < 0) {{ __tr('Unlimited') }} @elseif(isset($featureValue['limit'])) {{ $featureValue['limit'] }} @endif {{ ($structureFeatureValue['description']) }} @if(isset($featureValue['limit_duration_title'])) {{ ($featureValue['limit_duration_title']) }} @endif @endif
@endforeach
@else
{{ __tr('There are no active plan') }}
@endif @endif @if(getAppSettings('enable_stripe') and $isValidStripeKeys and $isCashierSubscription) {{ __tr('Go to Billing Portal') }} @if ($currentPlan and $isCashierSubscription 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 $isCashierSubscription and $subscriber->hasIncompletePayment($currentPlan['id'])) @endif @endif
@if ($currentPlan and $hasPlansForPurchase)
{{ __tr('Change/Renew Plan') }}
@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 $structureFeatureValue = $featureValue; $featureValue = $planDetails[$planKey]['features'][$featureKey]; @endphp
@if (isset($featureValue['type']) and ($featureValue['type'] == 'switch')) @if (isset($featureValue['limit']) and $featureValue['limit']) @else @endif {{ ($structureFeatureValue['description']) }} @else @if (isset($featureValue['limit']) and $featureValue['limit'] < 0) {{ __tr('Unlimited') }} @elseif(isset($featureValue['limit'])) {{ $featureValue['limit'] }} @if(isset($featureValue['limit_duration'])) {{ ($featureValue['limit_duration']) }} @endif @endif {{ ($structureFeatureValue['description']) }} @endif
@endforeach
@foreach ($plan['charges'] as $itemKey => $itemValue) @php if(!$itemValue['enabled']) { continue; } @endphp {{-- @if ($planSelectorId !== $planId . '___' . $itemKey) --}}
{{-- @endif --}} @endforeach
@endforeach
@if ($isCashierSubscription && getAppSettings('enable_stripe') and $isValidStripeKeys)
@csrf
@else @if (getAppSettings('enable_upi_payment') or getAppSettings('enable_bank_transfer'))
{{ __tr('Manual/Prepaid Subscription') }} @if ($existingManualSubscriptionPendingRequest)
{{ __tr('Your already have pending request for manual subscription change, please wait once it get confirmed') }}
@else
@csrf {{-- managed value using alpine --}} {{-- paypal payment button --}} @if (getAppSettings('enable_paypal')) @endif {{-- /paypal payment button --}} {{-- razorpay payment button --}} @if (getAppSettings('enable_razorpay')) @endif {{-- /razorpay payment button --}} {{-- UPI payment button --}} @if (getAppSettings('enable_upi_payment')) @endif {{-- /UPI payment button --}} {{-- bank transfer payment button --}} @if (getAppSettings('enable_bank_transfer')) @endif {{-- /bank transfer payment button --}} {{-- paystack payment button --}} @if (getAppSettings('enable_paystack')) @endif {{-- yoomoney payment button --}} @if (getAppSettings('enable_yoomoney')) @endif {{-- /yoomoney payment button --}}

@endif
@endif @endif
@endif @if (!$currentPlan)
{{ __tr('Subscribe Paid Plans') }}
@foreach ($planStructure as $planKey => $plan) @php $planId = $plan['id']; $features = $plan['features']; $charges = $planDetails[$planKey]['charges']; if (!$planDetails[$planKey]['enabled']) { continue; } @endphp
{{ $planDetails[$planKey]['title'] }} @foreach ($features as $featureKey => $featureValue) @php $featureValue = $planDetails[$planKey]['features'][$featureKey]; @endphp
@if (isset($featureValue['type']) and ($featureValue['type'] == 'switch')) @if (isset($featureValue['limit']) and $featureValue['limit']) @else @endif {{ ($featureValue['description']) }} @else @if (isset($featureValue['limit']) and $featureValue['limit'] < 0) {{ __tr('Unlimited') }} @elseif(isset($featureValue['limit'])) {{ $featureValue['limit'] }} @if(isset($featureValue['limit_duration'])) {{ ($featureValue['limit_duration']) }} @endif @endif {{ ($featureValue['description']) }}
@endif @endforeach
@foreach ($charges as $itemKey => $itemValue) @php if(!$itemValue['enabled']) { continue; } @endphp @if ($planSelectorId !== $planId . '___' . $itemKey)
@endif @endforeach
@endforeach
@if($hasPlansForPurchase) @if ($existingManualSubscriptionPendingRequest)
{{ __tr('Your already have pending request for manual subscription, please wait once it get confirmed') }}
@else @if (getAppSettings('enable_stripe') and $isValidStripeKeys)
{{ __tr('Auto Subscription - Credit or Debit card') }}
@csrf {{-- managed value using alpine --}}
@endif
{{ __tr('Manual/Prepaid Subscription') }} @if($isExtendedLicence)
@csrf {{-- managed value using alpine --}} {{-- paypal payment button --}} @if (getAppSettings('enable_paypal')) @endif {{-- /paypal payment button --}} {{-- razorpay payment button --}} @if (getAppSettings('enable_razorpay')) @endif {{-- /razorpay payment button --}} {{-- UPI payment button --}} @if (getAppSettings('enable_upi_payment')) @endif {{-- /UPI payment button --}} {{-- bank transfer payment button --}} @if (getAppSettings('enable_bank_transfer')) @endif {{-- /bank transfer payment button --}} {{-- bank transfer payment button --}} @if (getAppSettings('enable_paystack')) @endif {{-- /bank transfer payment button --}} {{-- yoomoney payment button --}} @if (getAppSettings('enable_yoomoney')) @endif {{-- /yoomoney payment button --}}

@else
{{ __tr('Not available, please contact administrator') }}
@endif
@endif @else
{{ __tr('No plans to subscribe') }}
@endif
@endif @if (getAppSettings('enable_stripe') and getAppSettings('stripe_enable_invoice_list') and $isValidStripeKeys)
{{ __tr('Stripe 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
@endif @endsection @if(!isset($message)) @push('appScripts') @if(getAppSettings('enable_stripe') and $isValidStripeKeys and !$existingManualSubscriptionPendingRequest) @if(!$currentPlan and $hasPlansForPurchase) @endif @endif @endpush @endif