@php /** * ONE BILLING RECORD FOR THE WHOLE RELATIONSHIP. * * A restaurant owner does not think about which table a charge landed in — they think "what have I * paid this platform". Plan terms and sponsored placements are both money paid to the platform, they * are numbered from one invoice sequence, and they now read as one list. What each row IS stays * visible in its own column, so the two are never confused for one another. * * The campaigns themselves are untouched by this: a placement is still listed, managed and measured * on the sponsored ads page. It is the BILL that lives here. * * @var array $history rows from Invoice::historyForRestaurant() * @var array $pager */ $history = $history ?? []; // One venue needs no column; two or more cannot be read without one. $multiBranch = count(array_unique(array_column($history, 'branch'))) > 1; $cols = $multiBranch ? 7 : 6; @endphp

{{ t_raw('vendor.billing.history_title') }}

@php /* Period is a date range (two values), not one Date.parse-able cell, so that carries no data-sort. */ @endphp @php /* WHICH VENUE THE CHARGE WAS FOR. The record covers every branch this owner runs, and a plan term looks identical from one branch to the next, so without this column the list cannot be read. Rendered only where there is more than one venue: a single-restaurant owner would be told the same name on every line. */ @endphp @if ($multiBranch)@endif @if ($history) @foreach ($history as $row) @if ($multiBranch)@endif @endforeach @else @partial('table-empty', ['colspan' => $cols, 'icon' => 'fa-file-invoice-dollar', 'msg' => t_raw('vendor.billing.history_empty')]) @endif
{{ t_raw('vendor.billing.history_title') }}
{{ t_raw('common.date') }}{{ t_raw('vendor.branches.col_branch') }}{{ t_raw('vendor.billing.col_charged_for') }} {{ t_raw('common.period') }} {{ t_raw('common.amount') }} {{ t_raw('vendor.billing.col_method') }} {{ t_raw('common.actions') }}
{!! fmt_day($row['date']) !!}{{ (string) ($row['branch'] ?? '') }} @php /* What was bought, and which kind of thing it was. A plan keeps its own tag; a placement says so in words, because the two are charged on different terms and a reader must never have to guess. */ @endphp @if ($row['kind'] === 'plan') {!! $row['title'] !== '' ? plan_tag((string) $row['slug'], (string) $row['title']) : dash() !!} @else {{ t_raw('vendor.billing.kind_placement') }} {{ $row['title'] }} @endif @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']) }} @php $m = (string) $row['method']; $ico = $m !== '' ? payment_method_icon($m) : ''; echo $ico !== '' ? $ico : ($m !== '' ? status_label('payment_method', $m) : dash()); @endphp @php /* The invoice is offered where one exists. A term paid before invoice numbering has none, and the charge is still shown — the payment is the record, the document is only its receipt. */ @endphp @partial('row-actions', ['inline' => 1, 'actions' => [ $row['invoice_no'] !== null ? [ 'label' => t_raw('vendor.billing.view_invoice'), 'icon' => 'fa-file-invoice', 'href' => (string) $row['href'], 'primary' => true, ] : null, ]])
@if (!empty($pager)) @partial('table-toolbar', ['pager' => $pager, 'base' => '/vendor/account']) @endif