{{-- Author By : zulfazdliabuas@gmail.com | Date : 2026 --}} @push('styles') @endpush
@php $viewer = auth()->user(); $canCreateSubscriptions = $viewer?->hasAnyRole(['admin', 'ao', 'spv']) ?? false; $canApproveSubscriptions = $viewer?->hasAnyRole(['admin', 'ao']) ?? false; $canApprovePaid = $viewer?->hasAnyRole(['root', 'admin', 'ao']) ?? false; $statusClasses = [ 'pending' => 'text-bg-warning text-dark', 'approved' => 'text-bg-info', 'active' => 'text-bg-success', 'expired' => 'text-bg-dark', 'cancelled' => 'text-bg-secondary', ]; @endphp

Customer Subscriptions

SPV registers subscription details. AO approves and generates the first invoice.

@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif {{-- Filter card hidden --}} {{--
@unless(config('subs.single_site_mode'))
@endunless
Reset
--}}
@if($canCreateSubscriptions) @endif Export Excel
@forelse($subscriptions as $customerSubscription) @empty @endforelse
No Customer Car Plate Package Commencement Duration End Month Next Invoice Status Actions
{{ $loop->index + 1 }} {{ $customerSubscription->name }}
{{ $customerSubscription->email ?: '-' }} / {{ $customerSubscription->phone ?: '-' }}
@if(!empty($customerSubscription->attention_to))
Attention: {{ $customerSubscription->attention_to }}
@endif @if($customerSubscription->parkingLotUsages->where('status', 'active')->isNotEmpty())
Parking Allocation: {{ $customerSubscription->parkingLotUsages->where('status', 'active')->map(fn ($usage) => trim(implode(' / ', array_filter([ $usage->parkingLot?->line, $usage->parkingLot?->lot_no, $usage->parkingLot?->slot, $usage->parkingLot?->bay_count ? ('Bay ' . $usage->parkingLot->bay_count) : null, ]))))->filter()->implode(', ') }}
@endif
{{ $customerSubscription->car_plate ?: '-' }}
{{ $customerSubscription->seasonPassPackage?->name ?? '-' }}
RM {{ number_format((float) $customerSubscription->monthly_amount, 2) }}
{{ optional($customerSubscription->commencement_month)->format('M Y') }} {{ $customerSubscription->duration_months ?? 1 }} month(s) {{ optional($customerSubscription->end_month)->format('M Y') ?: '-' }} {{ optional($customerSubscription->next_invoice_date)->format('d/m/Y') ?: '-' }} {{ ucfirst($customerSubscription->status) }} @if($customerSubscription->status === 'pending')
Waiting AO approval
@elseif($customerSubscription->status === 'approved')
Waiting generate invoice
@elseif($customerSubscription->status === 'active')
Billing in progress
@elseif($customerSubscription->status === 'expired')
Subscription ended
@endif
@if($canApproveSubscriptions && $customerSubscription->status === 'pending')
@csrf
@endif @php $endMonth = $customerSubscription->end_month ? \Carbon\Carbon::parse($customerSubscription->end_month) : null; if ($customerSubscription->next_invoice_date && $endMonth) { $canGenerateNextInvoice = !\Carbon\Carbon::parse($customerSubscription->next_invoice_date)->greaterThan($endMonth); } elseif ($customerSubscription->next_invoice_date && !$endMonth) { $canGenerateNextInvoice = true; } else { $canGenerateNextInvoice = false; } @endphp @if($canApproveSubscriptions && in_array($customerSubscription->status, ['approved', 'active'], true) && $canGenerateNextInvoice)
@csrf
@elseif($canApprovePaid && in_array($customerSubscription->status, ['active', 'expired'], true) && !$canGenerateNextInvoice) @endif @if($customerSubscription->latestInvoice) View Invoice @endif @if($canApproveSubscriptions) @endif
No subscriptions.
@if($canCreateSubscriptions) @endif @if($canCreateSubscriptions) @endif @if($canApproveSubscriptions) @foreach($subscriptions as $customerSubscription) @endforeach @endif @push('scripts') @endpush