@extends('website_builder.agency_template.admin.layout') @section('title', 'Subscription & Packages | Website Builder') @section('content') @php $renewActionUrl = url('agency-admin/subscription/renew'); try { if (\Illuminate\Support\Facades\Route::has('website-builder.agency-admin.subscription.renew')) { $renewActionUrl = route('website-builder.agency-admin.subscription.renew'); } elseif (\Illuminate\Support\Facades\Route::has('wb-subdomain.agency-admin.subscription.renew')) { $renewActionUrl = route('wb-subdomain.agency-admin.subscription.renew'); } } catch (\Throwable $e) {} $activeDemoTmpl = session('demo_template', 'digital_agency'); $isFiveTheme = session('wb_demo_admin') ? true : false; if ($isFiveTheme) { $isExpired = false; $currExpireFormatted = __('Unlimited (Never Expires)'); } else { $currExpireFormatted = !empty($customer->expire_date) ? \Carbon\Carbon::parse($customer->expire_date)->format('M d, Y h:i A') : __('Unlimited'); } $currExpireIso = !empty($customer->expire_date) ? \Carbon\Carbon::parse($customer->expire_date)->toIso8601String() : ''; @endphp

{{ __('Subscription & Packages') }}

{{ __('Manage your website subscription, renew your plan, or switch between Monthly and Yearly packages.') }}

@if (!empty($currentPackage) && empty($isFiveTheme)) @endif
{{-- Top Status Banner --}} @if (!empty($isFiveTheme))
{{ __('Unlimited Template Package Active') }}

{{ __('Current Plan:') }} {{ $currentPackage->name ?? 'Unlimited Template Package' }} — {{ __('Status:') }} {{ __('Never Expires (Unlimited Access)') }}.

{{ __('Unlimited Access') }}
@elseif ($isExpired)
{{ __('Your Subscription Has Expired') }}

{{ __('Your plan expired on') }} {{ $currExpireFormatted }}. {{ __('Renew your plan now to immediately keep your live website online.') }}

@if (!empty($currentPackage))
@endif
@else
{{ __('Your Subscription is Active') }}

{{ __('Current Plan:') }} {{ $currentPackage->name ?? 'Website Plan' }} — {{ __('Valid until') }} {{ $currExpireFormatted }}.

{{ __('Plan Active') }} @if (!empty($currentPackage)) @endif
@endif {{-- Monthly / Yearly Billing Cycle Switcher --}}
@php // Determine current active or expired package $activePkgId = !empty($customer->package_id) ? (int)$customer->package_id : null; $currPkg = null; if ($activePkgId) { $currPkg = $packages->firstWhere('id', $activePkgId); } if (!$currPkg && !empty($currentPackage)) { $currPkg = $currentPackage; } if (!$currPkg) { $currPkg = $packages->first(); } $currPrice = $currPkg ? (float)($currPkg->monthly_price ?? 0) : 0; $renewPlan = $currPkg; // Closure to dynamically extract all features configured in Super Admin for any package $renderPackageFeatures = function($p) { if (!$p) return []; $items = []; $items[] = [ 'label' => __('Portfolio Item Limit'), 'value' => (int)($p->portfolio_limit ?? 100) . ' ' . __('Items'), 'enabled' => true, 'is_boolean' => false, ]; $items[] = [ 'label' => __('Services Limit'), 'value' => (int)($p->services_limit ?? 100) . ' ' . __('Services'), 'enabled' => true, 'is_boolean' => false, ]; $blogCount = (int)($p->blog_limit ?? 0); $blogAllowed = (bool)($p->blog_allowed ?? true); $blogEnabled = $blogCount > 0 && $blogAllowed; $items[] = [ 'label' => __('Blog Articles Limit'), 'value' => $blogCount . ' ' . __('Posts'), 'enabled' => $blogEnabled, 'is_boolean' => false, ]; $items[] = [ 'label' => __('Custom Domain'), 'value' => ($p->custom_domain_allowed ?? true) ? __('Enabled') : __('Disabled'), 'enabled' => (bool)($p->custom_domain_allowed ?? true), 'is_boolean' => true, ]; $items[] = [ 'label' => __('Contact Form'), 'value' => ($p->contact_form_allowed ?? true) ? __('Enabled') : __('Disabled'), 'enabled' => (bool)($p->contact_form_allowed ?? true), 'is_boolean' => true, ]; $items[] = [ 'label' => __('Map Section'), 'value' => ($p->map_section_allowed ?? true) ? __('Enabled') : __('Disabled'), 'enabled' => (bool)($p->map_section_allowed ?? true), 'is_boolean' => true, ]; $items[] = [ 'label' => __('Call & WhatsApp Buttons'), 'value' => ($p->call_whatsapp_allowed ?? true) ? __('Enabled') : __('Disabled'), 'enabled' => (bool)($p->call_whatsapp_allowed ?? true), 'is_boolean' => true, ]; $items[] = [ 'label' => __('Blog Section'), 'value' => ($p->blog_allowed ?? true) ? __('Enabled') : __('Disabled'), 'enabled' => (bool)($p->blog_allowed ?? true), 'is_boolean' => true, ]; return $items; }; // Dynamic Upgrade Plans directly from Super Admin (wb_packages table) // Strictly filter out any enterprise package $upgradePlans = $packages->filter(function($p) use ($currPkg) { if (!$p) return false; $name = strtolower($p->name ?? ''); $slug = strtolower($p->slug ?? ''); if (str_contains($name, 'enterprise') || str_contains($slug, 'enterprise')) { return false; } if ($currPkg && $p->id == $currPkg->id) { return false; } return true; })->values(); // If packages in current collection only had 1 item, load all other active packages from database directly if ($upgradePlans->isEmpty() && class_exists(\App\Models\WebsiteBuilder\WbPackage::class)) { try { $currId = $currPkg ? $currPkg->id : 0; $dbOther = \App\Models\WebsiteBuilder\WbPackage::where('id', '!=', $currId) ->whereRaw('LOWER(name) NOT LIKE ?', ['%enterprise%']) ->whereRaw('LOWER(slug) NOT LIKE ?', ['%enterprise%']) ->orderBy('id', 'asc') ->get(); if ($dbOther->isNotEmpty()) { $upgradePlans = $dbOther; } } catch (\Throwable $e) {} } @endphp @if (!empty($isFiveTheme)) {{-- SECTION 1: ACTIVE UNLIMITED PLAN (HORIZONTAL RECTANGLE CARD) --}}

{{ __('Active Unlimited Plan Details') }}

{{ __('Active Plan') }}

{{ $currentPackage->name ?? 'Unlimited Template Package' }}

{{ __('Never Expires') }}

{{ __('Your package for this theme includes lifetime unlimited access with unrestricted resources and will never expire.') }}

{{ __('Portfolio Projects') }}: {{ __('Unlimited') }}
{{ __('Services Listed') }}: {{ __('Unlimited') }}
{{ __('Blog Articles') }}: {{ __('Unlimited') }}
{{ __('Custom Domain') }}: {{ __('Instant Connection') }}
{{ __('Contact Form Leads') }}: {{ __('Instant Storage & SMTP') }}
{{ __('WhatsApp Chatbot') }}: {{ __('Integrated') }}
{{ __('Unlimited / Lifetime') }}

{{ __('Validity:') }} {{ __('Never Expires') }}

@else {{-- SECTION 1: ACTIVE PLAN OR EXPIRED RENEWAL CARD --}}
@if(!empty($isExpired)) {{-- EXPIRED PLAN: RED WARNING CARD --}}

{{ __('Please renew your current plan to use the website') }}

@if($renewPlan) @php $rMonthly = round($renewPlan->monthly_price ?? 29); $rYearly = round($renewPlan->yearly_price ?? ($rMonthly * 10)); @endphp
{{ __('Current Plan') }}

{{ $renewPlan->name }}

{{ __('Features Included') }}

{{ __('Your subscription for this workspace has expired. Renew your plan now to immediately keep your live website online.') }}

@foreach($renderPackageFeatures($renewPlan) as $feat)
@if($feat['enabled']) {{ $feat['label'] }}: @if($feat['is_boolean']) {{ __('Enabled') }} @else {{ $feat['value'] }} @endif @else {{ $feat['label'] }}: @if($feat['is_boolean']) {{ __('Disabled') }} @else {{ $feat['value'] }} @endif @endif
@endforeach
₹{{ $rMonthly }} /{{ __('month') }} 20% OFF
{{ __('Automatic immediate reactivation upon payment') }}
@endif @else {{-- ACTIVE PLAN: GREEN STATUS CARD --}}

{{ __('Active Plan Details') }}

@if($currPkg) @php $rMonthly = round($currPkg->monthly_price ?? 29); $rYearly = round($currPkg->yearly_price ?? ($rMonthly * 10)); $expDateFormatted = (!empty($customer) && !empty($customer->expire_date)) ? \Carbon\Carbon::parse($customer->expire_date)->format('M d, Y') : __('Active'); $pkgFeatures = is_string($currPkg->features ?? null) ? json_decode($currPkg->features, true) : ($currPkg->features ?? []); @endphp
{{ __('Active Plan') }}

{{ $currPkg->name }}

{{ __('Expires:') }} {{ $expDateFormatted }}

{{ __('Your current subscription is active with full access to all your workspace features and expanded limits.') }}

@foreach($renderPackageFeatures($currPkg) as $feat)
@if($feat['enabled']) {{ $feat['label'] }}: @if($feat['is_boolean']) {{ __('Enabled') }} @else {{ $feat['value'] }} @endif @else {{ $feat['label'] }}: @if($feat['is_boolean']) {{ __('Disabled') }} @else {{ $feat['value'] }} @endif @endif
@endforeach
₹{{ $rMonthly }} /{{ __('month') }} 20% OFF
{{ __('Expires:') }} {{ $expDateFormatted }}
@endif @endif
@endif {{-- SECTION 2: UPGRADE PLAN TO EXPLORE NEW FEATURES (HIGHER TIERS ONLY) --}} @if(count($upgradePlans) > 0)

{{ __('Upgrade your plan to explore new features') }}

@foreach ($upgradePlans as $upPkg) @php $upMonthly = round($upPkg->monthly_price ?? 39); $upYearly = round($upPkg->yearly_price ?? ($upMonthly * 10)); $upFeatures = is_string($upPkg->features ?? null) ? json_decode($upPkg->features, true) : ($upPkg->features ?? []); @endphp
{{ __('Upgrade Option') }}

{{ $upPkg->name }}

{{ __('Upgrade to this tier to unlock higher capacity, expanded capabilities, and priority multi-theme suite features.') }}

@foreach($renderPackageFeatures($upPkg) as $feat)
@if($feat['enabled']) {{ $feat['label'] }}: @if($feat['is_boolean']) {{ __('Enabled') }} @else {{ $feat['value'] }} @endif @else {{ $feat['label'] }}: @if($feat['is_boolean']) {{ __('Disabled') }} @else {{ $feat['value'] }} @endif @endif
@endforeach
₹{{ $upMonthly }} /{{ __('month') }} 20% OFF
{{ __('Switch plan instantly with seamless feature upgrade') }}
@endforeach
@endif {{-- ON-PAGE RENEWAL & PAYMENT GATEWAY MODAL (LAUNCHSHOP RENEW FLOW MATCH) --}} {{-- Razorpay Checkout Client Script --}} @endsection