{{-- Author By : zulfazdliabuas@gmail.com | Date : 2026 --}} @push('styles') @endpush

Subscription #{{ $subscription->id }}

{{ $subscription->name }} — {{ $subscription->site?->name ?? '-' }}

Back to List
@if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif @php $viewer = auth()->user(); $canGenerateInvoice = $viewer?->hasAnyRole(['root', 'admin', 'ao', 'spv']) ?? false; $canMarkPaid = $viewer?->hasAnyRole(['root', 'admin', 'ao', 'spv']) ?? false; $canApprovePaid = $viewer?->hasAnyRole(['root', 'admin', 'ao']) ?? false; $canSubmitLhdn = $viewer?->hasAnyRole(['root', 'admin', 'ao']) ?? false; @endphp @php $customer = $subscription->customer; $stateOptions = [ 'Johor', 'Kedah', 'Kelantan', 'Melaka', 'Negeri Sembilan', 'Pahang', 'Pulau Pinang', 'Perak', 'Perlis', 'Selangor', 'Terengganu', 'Sabah', 'Sarawak', 'Kuala Lumpur', 'Labuan', 'Putrajaya', 'Not Applicable', ]; $editableFields = [ ['key' => 'customer_type', 'label' => 'Customer Type', 'type' => 'select', 'options' => ['individual' => 'Individual', 'company' => 'Company']], ['key' => 'name', 'label' => 'Name', 'type' => 'text'], ['key' => 'email', 'label' => 'Email', 'type' => 'email'], ['key' => 'phone', 'label' => 'Phone', 'type' => 'text'], ['key' => 'ic_passport', 'label' => $customer?->customer_type === 'company' ? 'BRN' : 'IC / Passport', 'type' => 'text'], ['key' => 'tin_no', 'label' => 'TIN', 'type' => 'text'], ['key' => 'address_line1', 'label' => 'Address Line 1', 'type' => 'text'], ['key' => 'address_line2', 'label' => 'Address Line 2', 'type' => 'text'], ['key' => 'city', 'label' => 'City', 'type' => 'text'], ['key' => 'state', 'label' => 'State', 'type' => 'select', 'options' => array_combine($stateOptions, $stateOptions)], ['key' => 'postcode', 'label' => 'Postcode', 'type' => 'text'], ['key' => 'country', 'label' => 'Country', 'type' => 'text'], ]; @endphp
Subscription Details
Customer
{{ $subscription->name }}
{{ $subscription->email ?: '-' }}
{{ $subscription->phone ?: '-' }}
Site
{{ $subscription->site?->name ?? '-' }}
Package
{{ $subscription->seasonPassPackage?->name ?? '-' }}
Monthly Amount
RM {{ number_format((float) $subscription->monthly_amount, 2) }}
Status
@php $subStatusClasses = [ 'pending' => 'text-bg-warning text-dark', 'approved' => 'text-bg-info', 'active' => 'text-bg-success', 'expired' => 'text-bg-dark', 'cancelled' => 'text-bg-secondary', ]; @endphp {{ ucfirst($subscription->status) }}
Car Plate
{{ $subscription->car_plate ?: '-' }}
Commencement
{{ $subscription->commencement_month ? \Carbon\Carbon::parse($subscription->commencement_month)->format('M Y') : '-' }}
Duration
{{ $subscription->duration_months ?? 1 }} month(s)
End Month
{{ $subscription->end_month ? \Carbon\Carbon::parse($subscription->end_month)->format('M Y') : '-' }}
Next Invoice
{{ $subscription->next_invoice_date ? \Carbon\Carbon::parse($subscription->next_invoice_date)->format('d/m/Y') : '-' }}
Parking Allocation
@php $activeUsages = $subscription->parkingLotUsages->where('status', 'active'); @endphp @if($activeUsages->isNotEmpty()) @foreach($activeUsages as $usage) @php $lot = $usage->parkingLot; $parts = array_filter([ $lot?->line, $lot?->lot_no, $lot?->slot, $lot?->bay_count ? ('Bay ' . $lot->bay_count) : null, ]); @endphp
{{ implode(' / ', $parts) ?: '-' }}
@endforeach @else
No active parking allocation.
@endif @if($subscription->notes)
Notes
{{ $subscription->notes }}
@endif
Customer Details (LHDN)
@foreach($editableFields as $field) @php $value = $customer?->{$field['key']}; $displayValue = $value ?: '-'; if ($field['key'] === 'customer_type') { $displayValue = ucfirst($displayValue); } @endphp
{{ $field['label'] }}
{{ $displayValue }}
@if($canApprovePaid) @endif
@endforeach
@php $endMonth = $subscription->end_month ? \Carbon\Carbon::parse($subscription->end_month) : null; if ($subscription->next_invoice_date && $endMonth) { $canGenerateNextInvoice = !\Carbon\Carbon::parse($subscription->next_invoice_date)->greaterThan($endMonth); } elseif ($subscription->next_invoice_date && !$endMonth) { $canGenerateNextInvoice = true; } else { $canGenerateNextInvoice = false; } @endphp
Invoices ({{ $subscription->invoices->count() }})
@if(in_array($subscription->status, ['approved', 'active'], true) && $canGenerateInvoice && $canGenerateNextInvoice)
@csrf
@elseif(in_array($subscription->status, ['active', 'expired'], true) && !$canGenerateNextInvoice && $canApprovePaid) @endif
@php $paymentStatusClasses = [ 'unpaid' => 'text-bg-warning text-dark', 'paid' => 'text-bg-success', 'cancelled' => 'text-bg-secondary', ]; $submissionStatusClasses = [ 'pending' => 'text-bg-secondary', 'new_request' => 'text-bg-info', 'approved' => 'text-bg-info', 'waiting_validation' => 'text-bg-warning text-dark', 'validated' => 'text-bg-success', 'failed' => 'text-bg-danger', 'einvoice_sent_to_customer' => 'text-bg-success', 'cancelled' => 'text-bg-secondary', ]; $canMarkPaid = $viewer?->hasAnyRole(['root', 'admin', 'ao', 'spv']) ?? false; $canApprovePaid = $viewer?->hasAnyRole(['root', 'admin', 'ao']) ?? false; @endphp
@forelse($subscription->invoices->sortByDesc('invoice_cycle_month') as $invoice) @empty @endforelse
No Invoice No Cycle Month Amount Payment Emailed E-Invoice Due Date Actions
{{ $loop->index + 1 }}
{{ $invoice->invoice_no ?: '-' }}
{{ $invoice->invoice_cycle_month ? \Carbon\Carbon::parse($invoice->invoice_cycle_month)->format('M Y') : '-' }} RM {{ number_format((float) $invoice->amount, 2) }} @php $payStatus = $invoice->invoice_status ?? 'unpaid'; @endphp {{ ucfirst($payStatus) }} @if($invoice->emailed_at) Yes @else @endif @php $einStatus = $invoice->status; @endphp @if($einStatus) @php $einLabel = str_replace('_', ' ', ucfirst($einStatus)); $einLabelLines = implode('
', explode(' ', $einLabel)); @endphp @if($einStatus === 'failed' && ($invoice->lhdn_error || $invoice->lhdn_error_details)) @php $errorTooltip = $invoice->lhdn_error ?: ''; if (!empty($invoice->lhdn_error_details) && is_array($invoice->lhdn_error_details)) { $detailMessages = collect($invoice->lhdn_error_details) ->map(fn($d) => is_string($d) ? $d : ($d['message'] ?? null)) ->filter() ->unique() ->implode(' | '); if ($detailMessages) { $errorTooltip .= ($errorTooltip ? ' | ' : '') . $detailMessages; } } $errorTooltip = trim($errorTooltip) ?: 'Submission failed'; @endphp {!! $einLabelLines !!} @else {!! $einLabelLines !!} @endif @endif
{{ $invoice->due_date ? \Carbon\Carbon::parse($invoice->due_date)->format('d/m/Y') : '-' }} @php $payStatus = $invoice->invoice_status ?? 'unpaid'; $einStatus = $invoice->status; @endphp
@if($canMarkPaid && $payStatus === 'unpaid' && $einStatus !== 'cancelled') @if($invoice->emailed_at) @else Send First @endif @endif @if($canApprovePaid && $payStatus === 'paid' && !$invoice->payment_approved_at)
@csrf
@endif @if($canSubmitLhdn && $payStatus === 'paid' && $invoice->payment_approved_at && $invoice->customer_requested_at && in_array($einStatus, ['new_request', 'failed']))
@csrf
@endif @if($canSubmitLhdn && $invoice->lhdn_uuid && in_array($einStatus, ['waiting_validation', 'submitted']))
@csrf
@endif @if($payStatus === 'paid') Preview @endif
No invoices yet.
@if(in_array($subscription->status, ['active', 'expired']) && $canApprovePaid) @endif @foreach($subscription->invoices as $invoice) @endforeach @push('scripts') @endpush