@extends('layouts.dashboard') @section('content') @php /** * Vendor subscription billing. * * The restaurant's whole billing record in one place: the plan it is on and how long the term * has left, what the plan allows against what is being used, every payment it has made with a * printable invoice for each, the pay/renew panel, and the path to a different plan. * * @var array|null $plan current plan row (or null) * @var array|null $subscription latest subscription row (or null) * @var array $history this page of the restaurant's subscription payments, newest first * @var array $pager pagination metadata for $history * @var array $term ['state','ends_at','days_left','lifetime'] — how the current term stands * @var array $allowance menu-item allowance and usage for the current plan * @var array $planOptions active plans other than the current one * @var bool $canPayByGateway true when Stripe or PayPal is enabled and keyed * @var float $price plan price * @var bool $isFree true when price <= 0 * @var string $currency ISO currency code * @var array $methods ['offline'=>bool,'stripe'=>bool,'paypal'=>bool] * @var string $offlineInstructions admin-configured offline payment text */ $cycleLabel = [ 'monthly' => t_raw('vendor.billing.cycle_monthly_suffix'), 'yearly' => t_raw('vendor.billing.cycle_yearly_suffix'), 'lifetime' => t_raw('vendor.billing.cycle_lifetime_suffix'), ]; $statusPill = [ 'active' => 'qm-pill-green', 'pending' => 'qm-pill-amber', 'expired' => 'qm-pill-grey', 'cancelled' => 'qm-pill-grey', ]; $subStatus = $subscription['status'] ?? ''; $canPay = !$isFree && ($methods['offline'] || $methods['stripe'] || $methods['paypal']); $daysLeft = (int) $term['days_left']; @endphp
{!! t('vendor.billing.lapsed_text', [':date' => fmt_day($term['ends_at'], true), ':days' => number_format(abs($daysLeft))]) !!}
{!! t('vendor.billing.ended_text') !!}
{!! t('vendor.billing.expiring_text', [':date' => fmt_day($term['ends_at'], true)]) !!}
{!! t('vendor.billing.no_plan_text') !!}
@endif{!! t('vendor.billing.free_plan_text', [':site' => setting('site_name', 'QuickMunch')]) !!}
{!! t('vendor.billing.pay_renew_sub', [':plan' => (string) $plan['name'], ':price' => money($price), ':currency' => $currency]) !!}
{!! t('vendor.billing.no_method_text') !!}
{!! t('vendor.billing.offline_payment_note') !!}
@if (trim($offlineInstructions) !== ''){!! t('vendor.billing.how_to_pay_label') !!}
{!! nl2br(e(trim($offlineInstructions))) !!}
{!! t('vendor.billing.stripe_note') !!}
{!! t('vendor.billing.paypal_note') !!}
{!! t('vendor.billing.change_plan_sub') !!}
{!! $optionFree ? t('common.free') : money($optionPrice) !!} @if (!$optionFree){{ $cycleLabel[$option['billing_cycle']] ?? '' }}@endif
{!! t('vendor.billing.change_plan_terms', [ ':commission' => (string) (float) $option['commission_percent'], ':items' => (int) $option['max_menu_items'] > 0 ? number_format((int) $option['max_menu_items']) : t_raw('admin.plans.unlimited'), ]) !!}
@if ($term['lifetime'] || $term['ends_at'] === null || $daysLeft <= 0) {!! t('vendor.billing.change_plan_no_term_left') !!} @else {!! t('vendor.billing.change_plan_forfeit', [':days' => number_format($daysLeft), ':plan' => (string) $plan['name']]) !!} @endif
@if ($selectable) @else{!! t('vendor.billing.change_plan_contact_admin') !!}
@endif{!! t('vendor.billing.history_sub') !!}
| {!! t('common.date') !!} | {!! t('admin.subscriptions.col_plan') !!} | {!! t('common.period') !!} | {!! t('common.amount') !!} | {!! t('vendor.billing.col_method') !!} | {!! t('common.status') !!} | {!! t('common.actions') !!} |
|---|---|---|---|---|---|---|
| {!! fmt_day($row['created_at']) !!} | {!! $row['plan_name'] !== '' ? plan_tag((string) $row['plan_slug'], (string) $row['plan_name']) : dash() !!} | @if (!empty($row['starts_at'])) {!! fmt_day($row['starts_at']) !!} – {!! !empty($row['ends_at']) ? fmt_day($row['ends_at']) : t('vendor.billing.never_lifetime') !!} @else {!! dash() !!} @endif | {!! money($row['amount_paid']) !!} | {!! !empty($row['payment_method']) ? status_label('payment_method', (string) $row['payment_method']) : dash() !!} | {!! status_label('subscription', $rowStatus) !!} | @php /* A checkout that was started but never captured has no money behind it, so there is nothing to invoice. */ @endphp @include('partials.row-actions', ['inline' => 1, 'actions' => [ $rowStatus !== 'pending' ? [ 'label' => t_raw('vendor.billing.view_invoice'), 'icon' => 'fa-file-invoice', 'href' => '/vendor/billing/invoice/' . (int) $row['id'], 'primary' => true, ] : null, ]]) |