Files
kulakpos_web/public/restaurant/resources/views/emails/orders/invoice.blade.php

384 lines
12 KiB
PHP
Raw Normal View History

2026-03-15 17:08:23 +07:00
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Invoice - Order #{{ $order->order_number }}</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
/* Reset */
html,
body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
color: #333
}
a {
color: inherit;
text-decoration: none
}
.container {
max-width: 900px;
margin: 24px auto;
padding: 20px;
border: 1px solid #e6e6e6;
border-radius: 8px;
background: #fff
}
header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px
}
.brand {
display: flex;
align-items: center;
gap: 12px
}
.brand img {
height: 60px;
width: auto;
border-radius: 6px;
object-fit: contain
}
.brand h2 {
margin: 0;
font-size: 20px;
color: #111
}
.meta {
text-align: right;
font-size: 13px;
color: #666
}
.meta .title {
font-weight: 600;
color: #222
}
.section {
display: flex;
gap: 20px;
margin-bottom: 18px;
flex-wrap: wrap
}
.card {
flex: 1;
min-width: 220px;
padding: 14px;
border: 1px dashed #eee;
border-radius: 6px;
background: #fafafa
}
.card h4 {
margin: 0 0 8px 0;
font-size: 14px
}
.small {
font-size: 13px;
color: #555
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 12px
}
th,
td {
padding: 10px 8px;
text-align: left;
border-bottom: 1px solid #f0f0f0;
font-size: 14px
}
th {
background: #fafafa;
font-weight: 600;
color: #333
}
td.right {
text-align: right
}
.muted {
color: #777;
font-size: 13px
}
.totals {
margin-top: 12px;
max-width: 360px;
margin-left: auto
}
.totals table {
border: none
}
.totals td {
border: none;
padding: 8px 6px
}
.grand {
font-weight: 700;
font-size: 18px
}
.status {
display: inline-block;
padding: 6px 10px;
border-radius: 20px;
font-size: 13px
}
.status.paid {
background: #e6ffef;
color: #046a2f;
border: 1px solid #c9f5d4
}
.status.unpaid {
background: #fff4e6;
color: #a65d00;
border: 1px solid #ffe7c7
}
.notes {
margin-top: 18px;
padding: 12px;
border-left: 4px solid #eee;
background: #fafafa;
border-radius: 4px;
color: #555
}
footer {
margin-top: 24px;
padding-top: 12px;
border-top: 1px solid #f0f0f0;
color: #777;
font-size: 13px;
text-align: center
}
.print-btn {
display: inline-block;
padding: 10px 14px;
border-radius: 6px;
background: #0b5ed7;
color: #fff;
font-weight: 600;
border: none;
cursor: pointer
}
/* Responsive */
@media (max-width:600px) {
header {
flex-direction: column;
align-items: flex-start
}
.meta {
text-align: left
}
.totals {
width: 100%;
margin: 12px 0 0 0
}
}
/* Print */
@media print {
body {
background: #fff
}
.container {
border: none;
box-shadow: none;
margin: 0;
padding: 0
}
.print-btn {
display: none
}
}
</style>
</head>
<body>
<div class="container">
<header>
<div class="brand">
@if (!empty($order->restaurant->logo))
<img src="{{ $order->restaurant->logo }}" alt="{{ $order->restaurant->name }}">
@endif
<div>
<h2>{{ $order->restaurant->name ?? 'Restaurant Name' }}</h2>
<div class="muted" style="margin-top:4px">{{ $order->restaurant->address ?? '' }}</div>
<div class="muted" style="margin-top:2px">Phone: {{ $order->restaurant->phone ?? 'N/A' }}</div>
</div>
</div>
<div class="meta">
<div class="title">Invoice</div>
<div style="margin-top:6px">Order #: <strong>{{ $order->order_number }}</strong></div>
<div style="margin-top:4px">Date:
<strong>{{ \Carbon\Carbon::parse($order->created_at)->format('d M, Y H:i') }}</strong>
</div>
<div style="margin-top:4px">
Status:
@if ($order->payment_status || ($order->payment_status === true || $order->payment_status == 1))
<span class="status paid">Paid</span>
@else
<span class="status unpaid">Unpaid</span>
@endif
</div>
</div>
</header>
<div class="section">
<div class="card">
<h4>Bill To</h4>
<div class="small"><strong>{{ $order->customer->name ?? 'Customer' }}</strong></div>
<div class="muted" style="margin-top:6px">
{{ $order->customer->email ?? '' }}<br>
{{ $order->customer->phone ?? '' }}<br>
{{ $order->shipping_address ?? '' }}
</div>
</div>
<div class="card">
<h4>Order Details</h4>
<div class="small"><strong>Type:</strong>
{{ ucfirst(str_replace('_', ' ', $order->order_type ?? 'N/A')) }}</div>
<div class="small" style="margin-top:6px"><strong>Waiter:</strong> {{ $order->waiter?->name ?? '-' }}
</div>
<div class="small" style="margin-top:6px"><strong>Table:</strong> {{ $order->table?->name ?? '-' }}
</div>
<div class="small" style="margin-top:6px"><strong>Payment:</strong>
{{ $order->payment_method?->name ?? ($order->payment_method_id ? 'Method' : 'N/A') }}</div>
</div>
</div>
<section>
<table>
<thead>
<tr>
<th style="width:48%">Item</th>
<th style="width:12%">Qty</th>
<th style="width:15%">Price</th>
<th style="width:25%" class="right">Total</th>
</tr>
</thead>
<tbody>
@foreach ($order->items as $item)
<tr>
<td>
<div style="font-weight:600">{{ $item->foodItem?->name ?? 'Item' }}</div>
@if (!empty($item->foodVariant))
<div class="muted" style="margin-top:4px;font-size:13px">Variant:
{{ $item->foodVariant->name }}</div>
@endif
@if (!empty($item->addons))
@php
$addons = is_string($item->addons)
? json_decode($item->addons, true)
: $item->addons;
@endphp
@if (!empty($addons) && is_array($addons))
<div class="muted" style="margin-top:6px;font-size:13px">
Addons:
@foreach ($addons as $a)
<span
style="display:inline-block;margin-right:6px">{{ $a['name'] ?? $a }}</span>
@endforeach
</div>
@endif
@endif
</td>
<td>{{ $item->quantity }}</td>
<td>{{ number_format($item->price, 2) }}</td>
<td class="right">{{ number_format($item->total, 2) }}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="totals">
<table>
<tr>
<td class="muted">Subtotal</td>
<td class="right">{{ number_format($order->subtotal ?? 0, 2) }}</td>
</tr>
<tr>
<td class="muted">Discount</td>
<td class="right">- {{ number_format($order->discount ?? 0, 2) }}</td>
</tr>
<tr>
<td class="muted">Tax</td>
<td class="right">{{ number_format($order->tax ?? 0, 2) }}</td>
</tr>
@if (!empty($order->delivery_fee))
<tr>
<td class="muted">Delivery Fee</td>
<td class="right">{{ number_format($order->delivery_fee, 2) }}</td>
</tr>
@endif
<tr class="grand">
<td style="padding-top:8px">Grand Total</td>
<td class="right grand">
{{ number_format($order->grand_total ?? $order->subtotal - ($order->discount ?? 0) + ($order->tax ?? 0), 2) }}
</td>
</tr>
</table>
</div>
@if (!empty($order->note))
<div class="notes">
<strong>Note:</strong>
<div style="margin-top:6px">{{ $order->note }}</div>
</div>
@endif
<div
style="margin-top:18px;display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap">
<div class="muted" style="font-size:13px">This is a computer generated invoice and does not require a
signature.</div>
<div style="text-align:right">
<button class="print-btn" onclick="window.print()">Print Invoice</button>
</div>
</div>
</section>
<footer>
{{ $order->restaurant->name ?? 'Restaurant Name' }} {{ $order->restaurant->website ?? '' }}
{{ $order->restaurant->email ?? '' }}
</footer>
</div>
</body>
</html>