<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}" dir="{{ html_dir() }}">
<head>
<meta charset="utf-8"><title>{{ $invoice->invoice_number }}</title>
<style>
@font-face { font-family: Amiri; src: url("{{ asset('fonts/Amiri-Regular.ttf') }}") format("truetype"); }
body{width:80mm;font-family:Amiri,sans-serif;font-size:12px;margin:0;padding:8px;}
h1,h2,p{margin:4px 0;text-align:center}
table{width:100%;border-collapse:collapse} td{padding:2px 0}
@media print {.no-print{display:none}}
</style>
</head>
<body>
@php
    $hideName = $hideName ?? request()->boolean('hide_name');
    $paidMonths = $invoice->items->map(fn ($item) => $item->billingPeriod?->label())->filter()->unique()->values();
@endphp
<button class="no-print" onclick="window.print()">{{ __('messages.print') }}</button>
@if(company_logo_url())
<p><img src="{{ company_logo_url() }}" alt="{{ setting('company_name') }}" style="max-height:40px;max-width:140px;object-fit:contain"></p>
@endif
<h1>{{ setting('company_name') }}</h1>
<p>{{ $invoice->invoice_number }}</p>
<p>{{ __('messages.line') }}: {{ $invoice->line?->phone_number }}</p>
@if(! $hideName && $invoice->customer?->name)
<p>{{ $invoice->customer->name }}</p>
@endif
@if($paidMonths->isNotEmpty())
<p>{{ __('messages.paid_months') }}: {{ $paidMonths->join('، ') }}</p>
@endif
<table>
@foreach($invoice->items as $item)<tr><td>{{ $item->billingPeriod?->label() ?: $item->description }}</td><td>{{ money($item->total) }}</td></tr>@endforeach
<tr><td><strong>{{ __('messages.total') }}</strong></td><td><strong>{{ money($invoice->total) }}</strong></td></tr>
</table>
</body></html>
