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>
This commit is contained in:
baodev0
2026-10-30 18:36:41 +07:00
co-authored by Claude Sonnet 5.5
parent 047c23beff
commit 55a834a2f8
53 changed files with 1463 additions and 119 deletions
+33 -5
View File
@@ -25,19 +25,24 @@ class TemplateSeeder extends Seeder
$this->upsert($item);
}
foreach (MarketingTemplates::all() as $item) {
$this->createMarketingIfMissing($item);
}
$this->seedMarketingTemplates();
$this->seedServiceLifecycleTemplates();
$this->createMarketingIfMissing(self::ipRevocationTemplate());
$this->createMarketingIfMissing([...self::ipRevocationTemplate(), 'marketing' => false]);
}
public function seedMarketingTemplates(): void
{
foreach (MarketingTemplates::all() as $item) {
$this->createMarketingIfMissing($item);
}
}
public function seedServiceLifecycleTemplates(): void
{
foreach (ServiceLifecycleTemplates::all() as $item) {
$this->createMarketingIfMissing($item);
$this->createMarketingIfMissing([...$item, 'marketing' => false]);
}
}
@@ -77,10 +82,33 @@ class TemplateSeeder extends Seeder
'message' => $item['message'] ?? EmailTemplateShell::page($item['body']),
'status' => 1,
]);
if (($item['marketing'] ?? true) === false) {
$template->metadata = [...(array) $template->metadata, 'marketing' => false];
}
$template->syncVariables($item['variables']);
$template->save();
}
public function markNonMarketing(): void
{
$items = [
...array_map(fn (array $item) => [...$item, 'marketing' => false], ServiceLifecycleTemplates::all()),
...MarketingTemplates::all(),
[...self::ipRevocationTemplate(), 'marketing' => false],
];
foreach ($items as $item) {
if (($item['marketing'] ?? true) !== false) {
continue;
}
$template = Template::whereNull('key')->whereNull('scenario')->where('name', $item['name'])->first();
if ($template && ! array_key_exists('marketing', (array) $template->metadata)) {
$template->forceFill(['metadata' => [...(array) $template->metadata, 'marketing' => false]])->save();
}
}
}
/**
* @return array<int, array{scenario: string, name: string, subject: string, message: string, types?: array<string, string>}>
*/