@extends('layouts.app') @section('title', 'Billing - ' . setting('system_name')) @section('content') @php $state = $tenant->billingState(); $days = $tenant->daysLeft(); $tone = match ($state) { 'expired', 'suspended', 'grace' => 'danger', 'due_soon' => 'warning', default => 'success' }; $current = $tenant->plan && isset($plans[$tenant->plan]) ? $tenant->plan : null; $price = $tenant->monthlyPrice(); $pending = $submissions->where('status', 'pending'); $brand = [ 'mpamba' => ['#16a34a', '#f0fdf4', 'bi-phone-fill'], 'airtel_money' => ['#dc2626', '#fef2f2', 'bi-phone'], 'national_bank' => ['#1d4ed8', '#eff6ff', 'bi-bank2'], 'standard_bank' => ['#0c4a6e', '#f0f9ff', 'bi-bank'], ]; $smsPct = $usage['sms_limit'] > 0 ? min(100, round($usage['sms_used'] / $usage['sms_limit'] * 100)) : 0; $bar = fn ($pct) => $pct >= 90 ? 'danger' : ($pct >= 70 ? 'warning' : 'primary'); $tabs = ['overview' => ['bi-speedometer2', 'Overview'], 'plans' => ['bi-layers', 'Plans'], 'pay' => ['bi-wallet2', 'Pay'], 'history' => ['bi-clock-history', 'History']]; @endphp

Billing

Your plan, what you are using, and paying for the system.

Pay now
@if(!$tenant->canBeUsed()) @elseif($state === 'grace' || $state === 'due_soon') @endif
Your plan
{{ $tenant->planName() }}
@if($current)
{{ $plans[$current]['tagline'] ?? '' }}
@endif
@if($current && $current !== array_key_last($plans)) Upgrade @endif
@if($price > 0) {{ formatCurrency($price) }} / month @else No price set. Ask your provider. @endif
@if($tenant->isSuspended()) Suspended. {{ $tenant->suspended_reason ?: 'Contact your provider.' }} @elseif($tenant->paid_until === null) No end date: your subscription does not expire. @elseif($state === 'expired') Ended on {{ $tenant->paid_until->format('d M Y') }}. @elseif($state === 'grace') Overdue by {{ abs($days) }} {{ abs($days) === 1 ? 'day' : 'days' }}. Stops after {{ $tenant->blockedAfter()->format('d M Y') }}. @else Next payment due {{ $tenant->paid_until->format('l, d M Y') }} ({{ $days === 0 ? 'today' : $days . ' ' . ($days === 1 ? 'day' : 'days') . ' left' }}). @endif
Usage
SMS this month @if($usage['sms_unlimited']) {{ number_format($usage['sms_used']) }} sent · Unlimited @else {{ number_format($usage['sms_used']) }} of {{ number_format($usage['sms_limit']) }} used @endif
{{ $usage['sms_unlimited'] ? 'Z report SMS to all your numbers, every day.' : number_format(max(0, $usage['sms_limit'] - $usage['sms_used'])) . ' left · resets on ' . $usage['sms_resets']->format('j M') }} @if($usage['sms_credits']) · + {{ number_format($usage['sms_credits']) }} extra SMS@endif @if($usage['sms_blocked']) · {{ $usage['sms_blocked'] }} not sent this month because the SMS ran out. Ask your provider for extra SMS.@endif
@if($usage['period_used'] !== null)
Subscription period {{ $usage['period_start']->format('d M') }} – {{ $usage['period_end']->format('d M Y') }}
{{ $usage['period_used'] }}% used{{ $days !== null && $days >= 0 ? ' · ' . $days . ' ' . ($days === 1 ? 'day' : 'days') . ' left' : '' }}
@endif
@foreach([['Users', $usage['users']], ['Products', $usage['products']], ['Sales this month', $usage['sales_month']]] as [$label, $value])
{{ number_format($value) }}
{{ $label }}
@endforeach
Users and products are unlimited on every plan.
In your plan
@foreach($features as $key => [$label, $description]) @php $has = plan_allows($key); @endphp
{{ $label }} @unless($has)Pro@endunless
{{ $description }}
@endforeach
@foreach($plans as $key => $plan) @php $isCurrent = $key === $current; $top = $key === array_key_last($plans); @endphp
@if($top)Recommended@endif
{{ $plan['name'] }}
{{ $plan['tagline'] ?? '' }}
{{ formatCurrency($plan['price']) }} / month
@if($annualFree)
Pay for a year: {{ formatCurrency(\App\Http\Controllers\BillingController::priceFor($key, 12)) }} ({{ $annualFree }} months free)
@endif
    @if(!$loop->first)
  • Everything in {{ $plans[array_key_first($plans)]['name'] }}, plus:
  • @endif @if($loop->first) @foreach($included as $item)
  • {{ $item }}
  • @endforeach @endif @foreach($plan['features'] as $f)
  • {{ $features[$f][0] }}: {{ $features[$f][1] }}
  • @endforeach
  • {{ $plan['sms'] === null ? 'Unlimited SMS (Z report to your phone every day)' : $plan['sms'] . ' free SMS a month (Z report to your phone)' }}
@endforeach

A change of plan starts when your payment for it is approved. Prices in Malawi Kwacha.

1 Send the money

To any of these. Use your shop code {{ $tenant->slug }} as the reference if you can.

@foreach($accounts as $key => $account) @php [$color, $soft, $icon] = $brand[$key] ?? ['#475569', '#f8fafc', $account['icon'] ?? 'bi-cash']; if (!empty($account['color'])) { [$color, $soft, $icon] = [$account['color'], '#f8fafc', $account['icon'] ?? $icon]; } @endphp @endforeach @if($contact['phone'] || $contact['email'])

Questions? @if($contact['phone']){{ $contact['phone'] }}@endif @if($contact['email']) · {{ $contact['email'] }}@endif

@endif
2 Send the proof

A screenshot of the confirmation SMS, or a photo or PDF of the bank slip.

@if($pending->isNotEmpty())
You already sent proof on {{ $pending->first()->created_at->format('d M Y') }}; it is waiting for approval.
@endif
@csrf @php $chosenPlan = old('plan', $payPlan); $chosenMonths = (int) old('months', 1); @endphp
Plan
@foreach($plans as $key => $plan) @endforeach
Paying for
@foreach([1 => '1 month', 3 => '3 months', 6 => '6 months', 12 => '12 months'] as $m => $label) @endforeach
To pay: –
@error('amount')
{{ $message }}
@enderror
@error('account')
{{ $message }}
@enderror
@error('paid_on')
{{ $message }}
@enderror
From the SMS or the slip.
JPG, PNG, WEBP or PDF, up to 5 MB.
@error('proof')
{{ $message }}
@enderror
Proofs you sent
@forelse($submissions as $submission) @php [$cls, $label] = match ($submission->status) { 'approved' => ['bg-success', 'Approved'], 'rejected' => ['bg-danger', 'Not approved'], default => ['bg-warning text-dark', 'Waiting for approval'], }; @endphp
{{ formatCurrency($submission->amount) }} · {{ $submission->months }} {{ $submission->months == 1 ? 'month' : 'months' }} @if($submission->plan) · {{ config("tenancy.plans.{$submission->plan}.name", $submission->plan) }}@endif · {{ $submission->accountLabel() }}
Sent {{ $submission->created_at->format('d M Y H:i') }} by {{ $submission->submitted_by_name }} · view proof
@if($submission->status === 'rejected' && $submission->review_note)
{{ $submission->review_note }}
@endif
{{ $label }}
@empty

None sent yet.

@endforelse
Payments received
@forelse($payments as $payment) @empty @endforelse
Paid onPeriodPlanAmount
{{ $payment->paid_on->format('d M Y') }}
{{ $payment->method ?? '' }}{{ $payment->reference ? ' · ' . $payment->reference : '' }}
{{ $payment->period_from->format('d M Y') }} – {{ $payment->period_to->format('d M Y') }} {{ config("tenancy.plans.{$payment->plan}.name", ucfirst((string) $payment->plan) ?: '—') }} {{ formatCurrency($payment->amount) }}
No payments recorded yet.
@endsection