{{-- Body of the invoice page (#2957 slice 6d, card #3020). Included by invoice/show only. Expects: $invoice, $creditInvoice (the credit invoice of a credited invoice, else null), $payments (loaded once by invoice/show). Customer and invoice facts side by side, the invoice lines as a data table (Rad, Beskrivning, Antal, Pris, Totalt, numbers right-aligned) with VAT and total, then the payments. Same fields as the old view. --}} @php $money = fn ($value) => formatNumber($value, 2, ','); $payments = $payments ?? $invoice->payments()->get(); $invoiceRows = \App\Support\TablePagination::rows($invoice->rows()->get(), 'invoiceRowsPage'); $paymentRows = \App\Support\TablePagination::rows($payments, 'paymentPage'); @endphp
{{ __('invoice.show.customerName') }}
{{ $invoice['company_name'] }} ({{ $invoice->company->customer_number ?? 'Borttaget' }})
{{ __('invoice.show.customerStreet') }}
{{ $invoice['company_address'] }}
{{ __('invoice.show.customerZip') }}
{{ $invoice['company_zip'] }}, {{ $invoice['company_city'] }}
{{ __('invoice.show.customerEmail') }}
{{ $invoice['company_email'] ?? '' }}
{{ __('invoice.show.status') }}
@include('invoice.partials.status-pill') @if ($invoice->status != Invoice::_get('statusTypes')['credit'] && $creditInvoice) {{ __('invoice.nh.show.creditInvoice', ['number' => $creditInvoice->number]) }} @elseif ($invoice->isPaid() && $payments->isNotEmpty()) {{ $payments[0]->created_at->format('Y-m-d') }} @endif
{{ __('invoice.show.created') }}
{{ $invoice['created_at']->format('Y-m-d') }}
{{ __('invoice.show.sent') }}
{{ ! is_null($invoice['send_time']) ? $invoice['send_time']->format('Y-m-d') : '' }}
{{ __('invoice.show.due') }}
{{ $invoice['duedate']->format('Y-m-d') }}

{{ __('invoice.show.rowsTitle') }}

@foreach ($invoiceRows as $key => $row) @endforeach
{{ __('invoice.show.row.line') }} {{ __('invoice.nh.show.description') }} {{ __('invoice.show.row.items') }} {{ __('invoice.show.row.itemPrice') }} {{ __('invoice.show.row.total') }}
{{ ($key + 1) * 10 }} {{ $row['row_text'] }} 1 {{ $money($row['price']) }} {{ $money($row['price']) }}
{{ __('invoice.nh.show.vat', ['rate' => formatNumber($invoice['vat_rate'] * 100)]) }}
{{ $money($invoice->vatTotal()) }}
{{ __('invoice.show.row.total') }}
{{ $money($invoice->totalWithVat(true)) }}

{{ __('invoice.show.payments') }}

@if ($payments->isEmpty() && ! $invoice->isCredited())

{{ __('invoice.show.payment.noResult') }}

@else @foreach ($paymentRows as $payment) @endforeach @if ($creditInvoice) {{-- Paid with a credit invoice --}} @endif
{{ __('invoice.show.payment.time') }} {{ __('invoice.show.payment.amount') }}
{{ \App\Support\DisplayDate::timestamp($payment->created_at) }} {{ $money($payment['sum']) }}
{{ \App\Support\DisplayDate::timestamp($invoice->credit_time) }} ({{ __('invoice.credited') }}) {{ $money($creditInvoice->totalWithVat(true)) }}
@endif