@extends('layouts/layoutMaster') @section('title', __('locale.Subscription Profile')) @section('vendor-style') @vite(['resources/assets/vendor/libs/select2/select2.scss', 'resources/assets/vendor/libs/flatpickr/flatpickr.scss', 'resources/assets/vendor/libs/sweetalert2/sweetalert2.scss', 'resources/assets/vendor/scss/pages/page-pricing.scss']) @endsection @section('vendor-script') @vite(['resources/assets/vendor/libs/select2/select2.js', 'resources/assets/vendor/libs/flatpickr/flatpickr.js', 'resources/assets/vendor/libs/sweetalert2/sweetalert2.js', 'resources/assets/js/pages-pricing.js']) @endsection @section('content') @php $currency=Helper::setting('currency_symbol','currency'); @endphp
@include('_partials/flashMessage')
@if ($subscription && $customerDeleted == false)

{{ __('locale.Current Subscription') }}

@if (Auth::user()->user_type == 'Store') @endif

{{ __('locale.Package') }}: {{ $subscription['package']?->name }}

{{ __('locale.ID') }}: {{ $subscription->stripe_subscription_id }}

{{ __('locale.Status') }}: {{ ucfirst($subscription->status) }}

{{ __('locale.Next Billing Date') }}: {{ \Carbon\Carbon::parse($subscription->next_billing_date)->format('F j, Y') }}

{{ __('locale.Total Amount') }}: {{ $currency }}{{ number_format($subscription->amount, 2) }}

@if ($subscription?->status === 'canceled')
@foreach (\App\Models\Package::with('duration')->where('status', 1)->get() as $pkg) @include('store.subscriptions.index')
@csrf @if ($subscription['package']?->id == $pkg->id) @else @endif
@endforeach
@else @endif {{-- 🟠 DUE / UNPAID SUBSCRIPTION --}} @if ($subscription->status === 'due' || $subscription->status === 'unpaid')
{{ __('locale.Payment Pending') }}

{{ __('locale.Your subscription payment is pending. Please complete payment to continue.') }}

@csrf
@endif
@else

{{ __('locale.Subscription Plans') }}

@foreach (\App\Models\Package::with('duration')->where('status', 1)->get() as $pkg) @include('store.subscriptions.index')
@csrf
@endforeach
@endif @php use Carbon\Carbon; $today = Carbon::today(); $start = isset($user->start_date) ? Carbon::parse($user->start_date) : Carbon::parse($user->created_at); $end = Carbon::parse($user->end_date); $default_days = 15; $totalDays = $start && $end ? $start->diffInDays($end) : $default_days; // total days between start and end $daysUsed = $start->diffInDays($today); $daysRemaining = $end->diffInDays($today, true); // false to get negative value if expired $progress = $totalDays > 0 ? min(100, intval(($daysUsed / $totalDays) * 100)) : 0; @endphp @if ($subscription && Auth::user()->user_type == 'Store')
@if (empty($user['subscriptionRecord']) && $user->end_date >= $today->toDateString())
{{ __('locale.Days') }}
{{ $daysUsed }} of {{ $totalDays }} {{ __('locale.Days') }}

{{ $daysRemaining }} day{{ $daysRemaining == 1 ? '' : 's' }} {{ __('locale.remaining until your plan requires update') }}

@elseif (empty($user['subscriptionRecord']) && $user->end_date < $today->toDateString()) @elseif (!empty($user['subscriptionRecord']) && $user->end_date < $today->toDateString()) @else @endif

💳 {{ __('locale.Payment Methods') }}

{{-- Saved Cards --}}
@if ($paymentMethod)
{{-- Channel --}}
Method: {{ ucfirst(str_replace('_', ' ', $paymentMethod['channel'])) }}
{{-- Reusable methods (card / bank) --}} @if ($paymentMethod['reusable'])
@if (!empty($paymentMethod['brand'])) {{ strtoupper($paymentMethod['brand']) }} @endif @if (!empty($paymentMethod['last4'])) •••• {{ $paymentMethod['last4'] }} @endif
@if (!empty($paymentMethod['expiry'])) Expires {{ $paymentMethod['expiry'] }} @endif @if (!empty($paymentMethod['bank'])) {{ $paymentMethod['bank'] }} @endif @else {{-- One-time methods --}}
This payment method cannot be reused automatically. Future payments may require confirmation.
@endif
@else
No payment method on file.
Add Payment Method @endif
@endif @if ($transactions->count())

{{ __('locale.Billing History') }}

@foreach ($transactions as $index => $txn) @php $data = json_decode($txn->package_details, true); @endphp @endforeach
# {{ __('locale.Amount') }} {{ __('locale.Package') }} {{ __('locale.Status') }} {{ __('locale.Txn ID') }} {{ __('locale.Date') }}
{{ $index + 1 }} {{ $currency }}{{ number_format($txn->amount, 2) }}{{ @$data['name'] ?? 'N/A' }} {{ ucfirst($txn->status) }}

{{ \Illuminate\Support\Str::limit($txn->txn_id, 35) }}

Txn Date: {{ \Carbon\Carbon::parse($txn->created_at)->format('F j, Y') }}
Start: {{ \Carbon\Carbon::parse($txn->start_date)->format('F j, Y') }}
@endif @endsection @section('page-script') @endsection