Deploy Ladill POS / deploy (push) Successful in 1m32s
Per-location logo in settings with remove/replace support; receipt template reserves space at the top when a logo is set. Co-authored-by: Cursor <cursoragent@cursor.com>
169 lines
5.3 KiB
PHP
169 lines
5.3 KiB
PHP
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Receipt {{ $sale->reference }}</title>
|
||
@include('partials.favicon')
|
||
@php
|
||
$paper = in_array((int) ($location?->printer_paper_mm ?? 80), [58, 80], true)
|
||
? (int) $location->printer_paper_mm
|
||
: 80;
|
||
$logoUrl = $location?->receiptLogoUrl();
|
||
$hasLogo = filled($logoUrl);
|
||
@endphp
|
||
<style>
|
||
* { box-sizing: border-box; }
|
||
body {
|
||
margin: 0;
|
||
padding: 16px;
|
||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||
font-size: 12px;
|
||
line-height: 1.4;
|
||
color: #111;
|
||
background: #fff;
|
||
}
|
||
.receipt {
|
||
width: {{ $paper }}mm;
|
||
max-width: 100%;
|
||
margin: 0 auto;
|
||
}
|
||
.center { text-align: center; }
|
||
.muted { color: #555; }
|
||
.brand {
|
||
padding-bottom: {{ $hasLogo ? '8px' : '0' }};
|
||
margin-bottom: {{ $hasLogo ? '10px' : '0' }};
|
||
}
|
||
.brand-logo {
|
||
display: block;
|
||
width: auto;
|
||
max-width: {{ $paper === 58 ? '42mm' : '52mm' }};
|
||
max-height: {{ $paper === 58 ? '14mm' : '18mm' }};
|
||
margin: 0 auto 8px;
|
||
object-fit: contain;
|
||
}
|
||
.brand-title {
|
||
margin: 0;
|
||
font-size: {{ $hasLogo ? '13px' : '14px' }};
|
||
font-weight: 700;
|
||
line-height: 1.3;
|
||
}
|
||
.brand-subtitle {
|
||
margin: 4px 0 0;
|
||
font-size: 11px;
|
||
line-height: 1.35;
|
||
}
|
||
.meta {
|
||
margin: 0;
|
||
font-size: 11px;
|
||
line-height: 1.35;
|
||
}
|
||
.divider {
|
||
border: 0;
|
||
border-top: 1px dashed #999;
|
||
margin: 10px 0;
|
||
}
|
||
table { width: 100%; border-collapse: collapse; }
|
||
td { padding: 2px 0; vertical-align: top; }
|
||
.qty { width: 2.5rem; }
|
||
.amt { text-align: right; white-space: nowrap; }
|
||
.total-row td { font-weight: 700; padding-top: 6px; }
|
||
.actions {
|
||
margin: 20px auto 0;
|
||
max-width: {{ $paper }}mm;
|
||
display: flex;
|
||
gap: 8px;
|
||
justify-content: center;
|
||
}
|
||
button, a.btn {
|
||
font: inherit;
|
||
padding: 8px 14px;
|
||
border-radius: 8px;
|
||
border: 1px solid #cbd5e1;
|
||
background: #fff;
|
||
color: #0f172a;
|
||
text-decoration: none;
|
||
cursor: pointer;
|
||
}
|
||
button.primary, a.btn.primary {
|
||
background: #4f46e5;
|
||
border-color: #4f46e5;
|
||
color: #fff;
|
||
}
|
||
@media print {
|
||
body { padding: 0; }
|
||
.actions { display: none !important; }
|
||
@page { margin: 4mm; size: {{ $paper }}mm auto; }
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="receipt">
|
||
<header class="brand center">
|
||
@if ($hasLogo)
|
||
<img src="{{ $logoUrl }}?v={{ $location->updated_at?->timestamp }}" alt="" class="brand-logo">
|
||
@endif
|
||
|
||
@if ($location?->receipt_header)
|
||
<p class="brand-title">{{ $location->receipt_header }}</p>
|
||
@elseif (! $hasLogo)
|
||
<p class="brand-title">{{ $location?->name ?? 'Ladill POS' }}</p>
|
||
@endif
|
||
|
||
@if ($hasLogo || $location?->receipt_header)
|
||
<p class="brand-subtitle muted">{{ $location?->name ?? 'Ladill POS' }}</p>
|
||
@endif
|
||
</header>
|
||
|
||
<p class="center meta muted">{{ $sale->reference }}</p>
|
||
<p class="center meta muted">{{ $sale->created_at->format('M j, Y g:i A') }}</p>
|
||
|
||
<hr class="divider">
|
||
|
||
<table>
|
||
@foreach ($sale->lines as $line)
|
||
<tr>
|
||
<td class="qty">{{ $line->quantity }}×</td>
|
||
<td>{{ $line->name }}</td>
|
||
<td class="amt">{{ pos_money($line->line_total_minor, $sale->currency) }}</td>
|
||
</tr>
|
||
@endforeach
|
||
</table>
|
||
|
||
<hr class="divider">
|
||
|
||
<table>
|
||
<tr class="total-row">
|
||
<td colspan="2">Total</td>
|
||
<td class="amt">{{ pos_money($sale->total_minor, $sale->currency) }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td colspan="2" class="muted">Payment</td>
|
||
<td class="amt muted">{{ ucfirst($sale->payment_method) }}</td>
|
||
</tr>
|
||
</table>
|
||
|
||
@if ($sale->customer_name)
|
||
<p class="center muted" style="margin-top:10px;">Customer: {{ $sale->customer_name }}</p>
|
||
@endif
|
||
|
||
@if ($location?->receipt_footer)
|
||
<hr class="divider">
|
||
<p class="center muted">{{ $location->receipt_footer }}</p>
|
||
@endif
|
||
|
||
<p class="center muted" style="margin-top:12px;">Thank you</p>
|
||
</div>
|
||
|
||
<div class="actions">
|
||
<button type="button" class="primary" onclick="window.print()">Print receipt</button>
|
||
<a class="btn" href="{{ route('pos.sales.show', $sale) }}">Back to sale</a>
|
||
<a class="btn" href="{{ route('pos.register') }}">Register</a>
|
||
</div>
|
||
|
||
@if ($autoprint)
|
||
<script>window.addEventListener('load', () => window.print());</script>
|
||
@endif
|
||
</body>
|
||
</html>
|