Files
portal-api/database/seeders/EmailTemplates/RenewalReminderTemplates.php
baodev0andClaude Sonnet 5.5 55a834a2f8 feat: nhắc gia hạn QR theo dịch vụ, failover server hosting, CCCD admin, log cấp phát dịch vụ
- Mail campaign: mẫu nhắc gia hạn thanh toán QR, chọn dịch vụ + chu kỳ từng dòng (renewal_services)
- Hosting: nhiều server Plesk cho một gói (service_plan_servers), chuyển server khi server chết
- Admin xem/sửa giấy tờ định danh khách, tuỳ chọn gia hạn cho khách, nhật ký cấp phát dịch vụ
- Đánh dấu mẫu email dịch vụ là non-marketing

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 18:36:41 +07:00

72 lines
6.4 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Database\Seeders\EmailTemplates;
use App\Support\EmailTemplateShell as T;
final class RenewalReminderTemplates
{
/**
* @return array<int, array{name: string, subject: string, body: string, variables: array<int, array{key: string, label: string, example: string}>}>
*/
public static function all(): array
{
return [
[
'name' => 'Nhắc gia hạn dịch vụ - Thanh toán QR',
'marketing' => false,
'subject' => 'V/v: Thế Giới Số nhắc gia hạn dịch vụ - {{service_name}} | {{customer_name}}',
'body' => self::body(),
'variables' => [
['key' => 'service_name', 'label' => 'Tên dịch vụ', 'example' => 'Gia hạn tên miền - thangtuong.com'],
['key' => 'billing_cycle', 'label' => 'Chu kỳ', 'example' => '01 năm'],
['key' => 'period_start', 'label' => 'Kỳ gia hạn từ ngày', 'example' => '18/11/2026'],
['key' => 'period_end', 'label' => 'Kỳ gia hạn đến ngày', 'example' => '17/11/2027'],
['key' => 'expires_date', 'label' => 'Ngày đến hạn', 'example' => '18/11/2026'],
['key' => 'total_amount', 'label' => 'Số tiền thanh toán (đã VAT, VNĐ)', 'example' => '374.000'],
['key' => 'vat_amount', 'label' => 'Tiền thuế VAT (VNĐ)', 'example' => '34.000'],
['key' => 'vat_rate', 'label' => 'Thuế suất VAT (%)', 'example' => '10'],
['key' => 'payment_content', 'label' => 'Nội dung chuyển khoản', 'example' => 'GIA HAN thangtuong.com'],
['key' => 'bank_account_name', 'label' => 'Ngân hàng nhận thanh toán', 'example' => 'CÔNG TY CỔ PHẦN GIẢI PHÁP CÔNG NGHỆ THẾ GIỚI SỐ'],
['key' => 'bank_account_no', 'label' => 'Số tài khoản', 'example' => '7379868'],
['key' => 'bank_name', 'label' => 'Tên ngân hàng', 'example' => 'ACB – Chi nhánh TP. Hồ Chí Minh'],
['key' => 'bank_qr_url', 'label' => 'Link ảnh VietQR', 'example' => 'https://img.vietqr.io/image/ACB-7379868-compact2.png?amount=374000'],
],
],
];
}
private static function body(): string
{
$th = 'padding:8px 6px;color:#c2410c;font-size:10px;font-weight:bold;text-transform:uppercase;background:#fff5ee;text-align:center;white-space:nowrap;';
$td = 'padding:14px 6px;font-size:13px;color:#1f2937;text-align:center;vertical-align:middle;';
return '<p style="margin:0 0 12px 0;font-size:15px;color:#1f2937">Kính gửi Quý Khách hàng <strong style="background:#fef08a">{{customer_name}}</strong>,</p>'
. T::paragraph('Thế Giới Số xin chân thành cảm ơn Quý khách hàng đã tin tưởng và sử dụng dịch vụ trong suốt thời gian qua.')
. '<p style="margin:0 0 12px 0;font-weight:bold;color:#1f2937">Thế Giới Số xin gửi Quý khách chi tiết các dịch vụ đã đến hạn thanh toán như sau:</p>'
. '<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="' . T::TABLE_STYLE . ' margin:0 0 16px 0"><tbody>'
. '<tr><td width="36%" style="' . $th . 'text-align:left;padding-left:14px">Dịch vụ</td><td width="22%" style="' . $th . '">Chu kỳ</td><td width="24%" style="' . $th . '">Thành tiền (đã VAT)</td><td width="18%" style="' . $th . '">Đến hạn</td></tr>'
. '<tr><td style="' . $td . 'text-align:left;padding-left:14px">{{service_name}}</td>'
. '<td style="' . $td . '"><strong>{{billing_cycle}}</strong><br><span style="font-size:11px;color:#6b7280;white-space:nowrap">{{period_start}}</span><br><span style="font-size:11px;color:#6b7280;white-space:nowrap">đến {{period_end}}</span></td>'
. '<td style="' . $td . '"><strong>{{total_amount}} đ</strong><br><span style="font-size:11px;color:#6b7280">Gồm thuế VAT {{vat_rate}}%:<br>{{vat_amount}} đ</span></td>'
. '<td style="' . $td . 'color:#c2410c;font-weight:bold">{{expires_date}}</td></tr>'
. '</tbody></table>'
. '<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="margin:0 0 20px 0"><tbody><tr><td align="center" style="background:#fff1e6;border:1px solid ' . T::TABLE_BORDER . ';border-radius:10px;padding:18px">'
. '<p style="margin:0 0 4px 0;font-size:12px;font-weight:bold;letter-spacing:.5px;color:#c2410c">TỔNG CỘNG CẦN THANH TOÁN</p>'
. '<p style="margin:0;font-size:26px;font-weight:bold;color:#c2410c">{{total_amount}} đ</p></td></tr></tbody></table>'
. '<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="margin:0 0 16px 0;background:#eaf6ff;border:1px solid #bfe0f5;border-radius:10px"><tbody><tr>'
. '<td style="padding:20px;vertical-align:middle;font-size:13px;line-height:22px;color:#1f2937">'
. '<p style="margin:0 0 10px 0;font-weight:bold;color:#1e6091">THÔNG TIN THANH TOÁN</p>'
. '<p style="margin:0">Chủ tài khoản: <strong>{{bank_account_name}}</strong></p>'
. '<p style="margin:0">Số tài khoản: <strong>{{bank_account_no}}</strong></p>'
. '<p style="margin:0">Ngân hàng: {{bank_name}}</p>'
. '<p style="margin:0">Nội dung: <strong>{{payment_content}}</strong></p></td>'
. '<td width="210" align="center" style="padding:16px;vertical-align:middle"><img src="{{bank_qr_url}}" alt="VietQR" width="180" style="display:block;width:180px;height:auto;background:#fff;border-radius:8px;border:0">'
. '<p style="margin:8px 0 0 0;font-size:12px;font-weight:bold;color:#1e6091">Quét mã để thanh toán nhanh</p></td>'
. '</tr></tbody></table>'
. '<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="margin:0 0 20px 0;background:#effaf1;border:1px solid #b7e4c0;border-radius:10px"><tbody><tr><td style="padding:14px 18px;font-size:13px;line-height:20px;color:#166534">'
. 'Nếu Quý Khách đã hoàn tất thanh toán, kính mong Quý Khách bỏ qua email này. Trường hợp thuận tiện, rất mong Quý khách phản hồi kèm Ủy nhiệm chi hoặc Chứng từ chuyển khoản để Thế Giới Số kiểm tra và xác nhận giúp Quý khách.'
. '</td></tr></tbody></table>';
}
}