@extends('backend.template.layouts.template-base') @section('title', 'Reports - Subscription Report') @php $badgeFor = fn(?string $s) => match ($s) { 'active' => 'srp-badge-green', 'paused' => 'srp-badge-amber', 'expired', 'cancelled' => 'srp-badge-red', default => 'srp-badge-blue', }; $tiles = [ ['label' => 'Subscription Revenue', 'value' => '₹' . number_format($summary['revenue'], 2), 'sub' => number_format($summary['subscriptions']) . ' subscriptions started', 'accent' => '#0aa437', 'icon' => 'bx-calendar-check', 'highlight' => true], ['label' => 'Active', 'value' => number_format($summary['active']), 'sub' => 'currently running', 'accent' => '#12b76a', 'icon' => 'bx-play-circle'], ['label' => 'Paused', 'value' => number_format($summary['paused']), 'sub' => 'temporarily on hold', 'accent' => '#f79009', 'icon' => 'bx-pause-circle'], ['label' => 'Expired / Cancelled', 'value' => number_format($summary['expired']) . ' / ' . number_format($summary['cancelled']), 'sub' => 'ended', 'accent' => '#ef4444', 'icon' => 'bx-stop-circle'], ['label' => 'Online / COD', 'value' => '₹' . number_format($summary['online'], 0) . ' / ₹' . number_format($summary['cod'], 0), 'sub' => 'wallet used ₹' . number_format($summary['wallet_used'], 0), 'accent' => '#0dcaf0', 'icon' => 'bx-wallet'], ]; @endphp @section('styles') @include('backend.template.reports.partials.styles') @endsection @section('content')
@include('backend.template.reports.partials.header', ['title' => 'Subscription Report', 'subtitle' => 'Vital Kitchen subscriptions by start date']) @include('backend.template.reports.partials.tiles', ['tiles' => $tiles])
@include('backend.template.reports.partials.filter-head')
@include('backend.template.reports.partials.daterange') @include('backend.template.reports.partials.filter-actions', ['resetRoute' => 'backend.template.reports.SubscriptionReport', 'filterKeys' => ['search', 'date_from', 'date_to', 'plan_id', 'status', 'delivery_slot', 'food_preference']])
@include('backend.template.reports.partials.table-head', ['paginator' => $subscriptions, 'title' => 'Subscriptions', 'noun' => 'subscriptions'])
@forelse($subscriptions as $s) @empty @endforelse
Subscriber ID Subscriber Plan Status Period Amount Paid Payment Delivery Slot Food
{{ $s->subscriber_id }}
{{ ucfirst((string) ($s->source ?: '—')) }}
{{ \App\Http\Controllers\ReportsController::subscriberName($s) }} @include('backend.template.reports.partials.phone') {{ \App\Http\Controllers\ReportsController::subscriberMobile($s) }} @if ($s->familyMember && $s->user) Account: {{ $s->user->name }} @endif
{{ $s->plan?->name ?? '—' }} @if($s->plan?->total_days)· {{ $s->plan->total_days }} days@endif {{ $statuses[$s->status] ?? ucfirst((string) $s->status) }} {{ $s->start_date?->format('d/m/Y') ?? '—' }} → {{ $s->end_date?->format('d/m/Y') ?? '—' }}
₹{{ number_format((float)$s->amount_paid, 2) }}
@if ((float)$s->wallet_used > 0)
wallet ₹{{ number_format((float)$s->wallet_used, 2) }}
@endif
{{ $s->payment_method ? strtoupper($s->payment_method) : '—' }} {{ $s->delivery_slot ?: '—' }} {{ ucfirst(str_replace('_', ' ', (string) ($s->food_preference ?: '—'))) }}
No subscriptions started in the selected period / filters.
@include('backend.template.reports.partials.table-foot', ['paginator' => $subscriptions])
@endsection @section('scripts') @include('backend.template.reports.partials.scripts') @endsection