34 lines
1.9 KiB
PHP
34 lines
1.9 KiB
PHP
@php
|
|
$rowFor = function (string $field) use ($invoice) {
|
|
return match ($field) {
|
|
'invoice_number' => ['Số hóa đơn', '#' . ($invoice->invoice_number ?? '—')],
|
|
'created_at' => ['Ngày tạo', $invoice->created_at ? $invoice->created_at->format('d/m/Y') : '—'],
|
|
'due_date' => ['Hạn thanh toán', $invoice->due_date ? date('d/m/Y', strtotime($invoice->due_date)) : '—'],
|
|
'total' => ['Tổng tiền', number_format((float) $invoice->total) . ' VNĐ'],
|
|
'sub_total' => ['Tiền dịch vụ', number_format((float) $invoice->sub_total) . ' VNĐ'],
|
|
'tax' => ['Thuế', number_format((float) $invoice->tax) . ' VNĐ'],
|
|
'status' => ['Trạng thái', match ((int) $invoice->status) {
|
|
2 => '<span style="color:#059669">Đã thanh toán</span>',
|
|
1 => '<span style="color:#dc2626">Chưa thanh toán</span>',
|
|
default => '<span style="color:#9ca3af">Đã hủy</span>',
|
|
}],
|
|
'payment_method' => ['Phương thức TT', $invoice->payment_method ?? '—'],
|
|
default => [$field, '—'],
|
|
};
|
|
};
|
|
$fields = $fields ?? ['invoice_number', 'created_at', 'due_date', 'total', 'status'];
|
|
@endphp
|
|
<p style="color: #f16723;"><strong>THÔNG TIN HÓA ĐƠN</strong></p>
|
|
|
|
<table cellpadding="0" cellspacing="0" border="0" style="width: 100%; table-layout: fixed; border: 1px solid #e8e8e8; border-right: 0;">
|
|
<tbody>
|
|
@foreach($fields as $i => $field)
|
|
@php [$label, $value] = $rowFor($field); @endphp
|
|
<tr @if($i % 2 === 1) bgcolor="#FFF1E6" @endif>
|
|
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8; width: 200px;">{{ $label }}:</td>
|
|
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8;"><strong>{!! $value !!}</strong></td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|