This commit is contained in:
baodev0
2026-08-14 08:45:52 +07:00
parent 7314313198
commit b03ee9fc2d
23 changed files with 844 additions and 704 deletions
@@ -0,0 +1,15 @@
@if(($attachments ?? collect())->isNotEmpty())
<p style="color: #f16723;"><strong>FILE ĐÍNH KÈM</strong></p>
<table cellpadding="0" cellspacing="0" border="0" style="width: 100%; table-layout: fixed;">
<tbody>
@foreach($attachments as $file)
<tr>
<td style="padding: 4px 0; font-size: 14px;">
<a href="{{ $file->url ?? '#' }}" style="color: #f16723; text-decoration: none;">{{ $file->filename }}</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@endif
@@ -0,0 +1,9 @@
@if(!empty($content))
<p style="text-align: justify;">
@if(strip_tags($content) === $content)
{{ $content }}
@else
{!! $content !!}
@endif
</p>
@endif
@@ -0,0 +1,23 @@
@php
$fieldMap = [
'name' => 'Tên khách hàng',
'email' => 'Email',
'address' => 'Địa chỉ',
];
$rows = collect($fields ?? array_keys($fieldMap))->filter(fn($key) => isset($fieldMap[$key]))->values();
$propertyMap = ['name' => 'fullname', 'email' => 'email', 'address' => 'address'];
@endphp
@if($customer)
<p style="color: #f16723;"><strong>THÔNG TIN KHÁCH HÀNG</strong></p>
<table cellpadding="0" cellspacing="0" border="0" style="width: 100%; table-layout: fixed; border: 1px solid #e8e8e8; border-right: 0;">
<tbody>
@foreach($rows as $i => $key)
<tr @if($i % 2 === 1) bgcolor="#FFF1E6" @endif>
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8; width: 200px;">{{ $fieldMap[$key] }}:</td>
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8;">{{ $customer->{$propertyMap[$key]} ?? '—' }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
@@ -0,0 +1 @@
<p style="text-align: justify;">Xin chào <strong>{{ $name ?? 'Quý khách' }}</strong>,</p>
@@ -0,0 +1,33 @@
@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>
@@ -0,0 +1,30 @@
@php
$cycleMap = [
'monthly' => 'Hàng tháng', 'quarterly' => 'Hàng quý',
'semi_annually' => '6 tháng', 'annually' => 'Hàng năm', 'biennially' => '2 năm',
];
@endphp
@if(($items ?? collect())->isNotEmpty())
<p style="color: #f16723;"><strong>CHI TIẾT SẢN PHẨM</strong></p>
<table cellpadding="0" cellspacing="0" border="0" style="width: 100%; table-layout: fixed; border: 1px solid #e8e8e8; border-right: 0; border-bottom: 0;">
<thead>
<tr bgcolor="#FFF1E6">
<th style="padding: 7px 11px; border-right: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; text-align: left; font-size: 12px; color: #6b7280;">Sản phẩm</th>
<th style="padding: 7px 11px; border-right: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; text-align: left; font-size: 12px; color: #6b7280;">Server</th>
<th style="padding: 7px 11px; border-right: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; text-align: left; font-size: 12px; color: #6b7280;">Chu kỳ</th>
<th style="padding: 7px 11px; border-right: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; text-align: right; font-size: 12px; color: #6b7280;">Giá</th>
</tr>
</thead>
<tbody>
@foreach($items as $item)
<tr>
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;"><strong>{{ $item->product?->name ?? '—' }}</strong></td>
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;">{{ $item->server_name ?? '—' }}</td>
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;">{{ $cycleMap[$item->billing_cycle] ?? ($item->billing_cycle ?? '—') }}</td>
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; text-align: right;"><strong>{{ number_format((float) $item->price) }} VNĐ</strong></td>
</tr>
@endforeach
</tbody>
</table>
@endif
@@ -0,0 +1,32 @@
@php
$fieldMap = [
'product_name' => 'Tên dịch vụ',
'product_billing' => 'Chu kỳ thanh toán',
'product_price' => 'Giá dịch vụ',
'service_due_exp' => 'Ngày hết hạn',
];
$iconMap = [
'product_billing' => 'buy-date.png',
'service_due_exp' => 'due-date.png',
];
$rows = collect($fields ?? array_keys($fieldMap))->filter(fn($key) => isset($fieldMap[$key]))->values();
@endphp
<p style="color: #f16723;"><strong>THÔNG TIN DỊCH VỤ</strong></p>
<table cellpadding="0" cellspacing="0" border="0" style="width: 100%; table-layout: fixed; border: 1px solid #e8e8e8; border-right: 0;">
<tbody>
@foreach($rows as $i => $key)
<tr @if($i % 2 === 1) bgcolor="#FFF1E6" @endif>
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8; width: 200px;">
@if(isset($iconMap[$key]))
<img src="{{ asset('images/emails/' . $iconMap[$key]) }}" alt="" width="16" height="17" style="vertical-align: text-bottom; margin-right: 4px;">
@endif
{{ $fieldMap[$key] }}:
</td>
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8;">
<strong>{{ $key === 'product_price' ? ($data[$key] ?? '0') . ' VNĐ' : ($data[$key] ?? '—') }}</strong>
</td>
</tr>
@endforeach
</tbody>
</table>
@@ -0,0 +1 @@
<p style="text-align: justify;">Trân trọng,<br><strong>{{ $companyName ?? config('app.name', 'Thế Giới Số') }}</strong></p>
@@ -0,0 +1,38 @@
@php
$fieldMap = [
'service_host' => 'Địa chỉ IP',
'service_username' => 'Username',
'service_port' => 'Port',
'service_password' => 'Mật khẩu',
'os_name' => 'Hệ điều hành',
];
$iconMap = [
'service_host' => 'internet.png',
'service_username' => 'admin.png',
'service_password' => 'password.png',
];
$rows = collect($fields ?? array_keys($fieldMap))->filter(fn($key) => isset($fieldMap[$key]))->values();
@endphp
<p style="color: #f16723;"><strong>THÔNG TIN TRUY CẬP VPS</strong></p>
<table cellpadding="0" cellspacing="0" border="0" style="width: 100%; table-layout: fixed; border: 1px solid #e8e8e8; border-right: 0;">
<tbody>
@foreach($rows as $i => $key)
<tr @if($i % 2 === 1) bgcolor="#FFF1E6" @endif>
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8; width: 200px;">
@if(isset($iconMap[$key]))
<img src="{{ asset('images/emails/' . $iconMap[$key]) }}" alt="" width="16" height="17" style="vertical-align: text-bottom; margin-right: 4px;">
@endif
{{ $fieldMap[$key] }}:
</td>
<td style="padding: 7px 11px; border-right: 1px solid #e8e8e8;">
@if($key === 'service_password')
<code style="background: #f5f5f5; padding: 2px 6px; border-radius: 4px; font-size: 13px;">{{ $data[$key] ?? '—' }}</code>
@else
<strong>{{ $data[$key] ?? '—' }}</strong>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>