FakturaFlow
Säker fakturavisning
@php $bannerClass = match($invoice->status) { 'paid' => 'sb-paid', 'overdue' => 'sb-overdue', 'sent','viewed' => 'sb-sent', default => 'sb-draft', }; $bannerColor = match($invoice->status) { 'paid' => '#065F46', 'overdue' => '#991B1B', 'sent','viewed' => '#1D4ED8', default => '#6B7280', }; $bannerText = match($invoice->status) { 'paid' => '✓ Denna faktura är betald', 'overdue' => '⚠ Denna faktura är förfallen — ' . $invoice->due_date->diffForHumans(), 'sent' => 'Faktura skickad ' . $invoice->sent_at?->format('d.m.Y'), 'viewed' => 'Du öppnade fakturan ' . $invoice->viewed_at?->format('d.m.Y'), default => 'Faktura', }; @endphp
{{ $bannerText }} @if($invoice->status !== 'paid' && $invoice->status !== 'cancelled') Att betala: {{ number_format($invoice->total_remaining, 2, ',', ' ') }} {{ $invoice->currency }} @endif
@if($tenant->logo_url) {{ $tenant->name }}
{{ $tenant->name }}
@else
{{ $tenant->name }}
@endif
{{ $invoice->type === 'credit' ? 'Kreditnota' : 'Faktura' }}nummer
{{ $invoice->invoice_number }}
@php $sc = match($invoice->status){'paid'=>'background:#D1FAE5;color:#065F46','overdue'=>'background:#FEE2E2;color:#991B1B','sent','viewed'=>'background:#DBEAFE;color:#1D4ED8',default=>'background:rgba(255,255,255,.1);color:rgba(255,255,255,.7)'}; @endphp
{{ $invoice->status_label }}
Fakturadatum
{{ $invoice->invoice_date->format('d.m.Y') }}
Förfallodatum
{{ $invoice->due_date->format('d.m.Y') }}
@if($invoice->ocr_number)
OCR-nummer
{{ $invoice->ocr_number }}
@endif @if($invoice->your_reference)
Er referens
{{ $invoice->your_reference }}
@endif
Från
{{ $tenant->name }}
{{ $tenant->address }}
{{ $tenant->postal_code }} {{ $tenant->city }}
{{ $tenant->email }}@if($tenant->org_number)
Org: {{ $tenant->org_number }}@endif
Faktureras till
{{ $customer->name }}
{{ $customer->billing_address }}
{{ $customer->billing_postal_code }} {{ $customer->billing_city }}
{{ $customer->email }}@if($customer->org_number)
Org: {{ $customer->org_number }}@endif
@foreach($invoice->rows as $row) @if($row->type === 'heading') @elseif($row->type === 'text') @else @endif @endforeach
Beskrivning Antal Enhet À-pris Rabatt Moms Summa
{{ $row->description }}
{{ $row->description }}
{{ $row->description }} {{ rtrim(rtrim(number_format($row->quantity, 3), '0'), '.') }} {{ $row->unit }} {{ number_format($row->unit_price, 2, ',', ' ') }} {{ $invoice->currency }} {{ $row->discount > 0 ? $row->discount.'%' : '—' }} {{ intval($row->vat_rate) }}% {{ number_format($row->gross_amount, 2, ',', ' ') }} {{ $invoice->currency }}
Summa exkl. moms{{ number_format($invoice->subtotal, 2, ',', ' ') }} {{ $invoice->currency }}
Moms{{ number_format($invoice->vat_amount, 2, ',', ' ') }} {{ $invoice->currency }}
@if($invoice->total_paid > 0)
Betalt-{{ number_format($invoice->total_paid, 2, ',', ' ') }} {{ $invoice->currency }}
@endif
{{ $invoice->total_paid > 0 ? 'Kvar att betala' : 'Att betala' }}{{ number_format(max($invoice->total_remaining, $invoice->total), 2, ',', ' ') }} {{ $invoice->currency }}
@if(!in_array($invoice->status, ['paid','cancelled','draft']))
Betalningsinformation
@if($invoice->bankgiro_number ?? $tenant->getSetting('bankgiro_number'))
Bankgiro
{{ $invoice->bankgiro_number ?? $tenant->getSetting('bankgiro_number') }}
@endif @if($invoice->ocr_number)
OCR / Meddelande
{{ $invoice->ocr_number }}
@endif
Förfallodatum
{{ $invoice->due_date->format('d.m.Y') }}
@if(in_array($invoice->payment_method, ['card','both'])) Betala med kort — {{ number_format($invoice->total_remaining, 2, ',', ' ') }} {{ $invoice->currency }}
💳 Visa💳 Mastercard💳 Amex | Säkrad av Stripe
@endif
@endif @if($invoice->notes)
Kommentar
{{ $invoice->notes }}
@endif
@php // Mark as viewed if($invoice->status === 'sent') { $invoice->markAsViewed(); } @endphp