dev update

This commit is contained in:
baodev0
2026-09-10 16:32:48 +07:00
parent 2365ef72e9
commit cd38c5d6d0
15 changed files with 483 additions and 191 deletions
Vendored
BIN
View File
Binary file not shown.
@@ -16,6 +16,8 @@ use Illuminate\Validation\Rule;
class EmailTemplateController extends Controller
{
private ?array $scenarioLabelOverridesCache = null;
public function index(Request $request): JsonResponse
{
$query = Template::with('invoiceTemplate:id,name,scenario')
@@ -37,25 +39,68 @@ class EmailTemplateController extends Controller
return response()->json(['error' => false, 'data' => $this->format($template)]);
}
/** Danh sách scenario hợp lệ (key + label) để render dropdown động ở frontend. */
/**
* Danh sách scenario để render dropdown động ở frontend — gồm cả scenario
* đã khai báo sẵn (Template::SCENARIOS) lẫn scenario tự tạo (đã dùng
* trong bảng template nhưng chưa có label cứng trong code).
*/
public function scenarios(): JsonResponse
{
$used = Template::whereNotNull('scenario')->pluck('scenario')->all();
$used = Template::whereNotNull('scenario')->distinct()->pluck('scenario')->all();
$labels = $this->scenarioLabelOverrides();
$data = collect(Template::SCENARIOS)->map(fn ($label, $key) => [
'key' => $key,
'label' => $label,
$known = collect(Template::SCENARIOS)->map(fn ($label, $key) => [
'key' => $key,
'label' => $labels[$key] ?? $label,
'has_template' => in_array($key, $used, true),
])->values();
]);
return response()->json(['error' => false, 'data' => $data]);
$custom = collect($used)
->reject(fn ($key) => array_key_exists($key, Template::SCENARIOS))
->map(fn ($key) => ['key' => $key, 'label' => $labels[$key] ?? $key, 'has_template' => true]);
return response()->json(['error' => false, 'data' => $known->concat($custom)->values()]);
}
/**
* Đặt/đổi tên hiển thị (label) cho một scenario — cho cả scenario tự tạo
* lẫn scenario khai báo sẵn trong Template::SCENARIOS. Lưu trong Setting
* (key=scenario_labels) vì scenario là khái niệm chung, không thuộc riêng
* một Template row nào.
*/
public function updateScenarioLabel(Request $request, string $key): JsonResponse
{
$data = $request->validate([
'label' => 'required|string|max:255',
]);
$setting = Setting::firstOrNew(['key' => 'scenario_labels']);
$labels = $setting->value ? json_decode($setting->value, true) : [];
$labels[$key] = trim($data['label']);
$setting->value = json_encode($labels, JSON_UNESCAPED_UNICODE);
$setting->save();
return response()->json(['error' => false, 'message' => 'Đã đổi tên tình huống.', 'data' => ['key' => $key, 'label' => $labels[$key]]]);
}
private function scenarioLabelOverrides(): array
{
if ($this->scenarioLabelOverridesCache !== null) {
return $this->scenarioLabelOverridesCache;
}
$setting = Setting::where('key', 'scenario_labels')->first();
return $this->scenarioLabelOverridesCache = $setting && $setting->value
? (json_decode($setting->value, true) ?: [])
: [];
}
public function store(Request $request): JsonResponse
{
$data = $request->validate([
'name' => 'nullable|string|max:255',
'scenario' => ['nullable', 'string', Rule::in(array_keys(Template::SCENARIOS))],
'scenario' => ['nullable', 'string', 'max:100', 'regex:/^[a-z][a-z0-9_]*$/'],
'key' => ['nullable', 'string', 'max:100', 'regex:/^[a-z][a-z0-9_]*$/', 'unique:template,key'],
'format' => 'nullable|in:html,json',
'invoice_template_id' => 'nullable|integer|exists:template,id',
'subject' => 'nullable|string|max:255',
@@ -76,6 +121,7 @@ class EmailTemplateController extends Controller
'type_id' => 0,
'name' => $data['name'] ?? null,
'scenario' => $data['scenario'] ?? null,
'key' => $data['key'] ?? null,
'format' => $data['format'] ?? 'html',
'invoice_template_id' => $data['invoice_template_id'] ?? null,
'subject' => $data['subject'] ?? null,
@@ -96,7 +142,8 @@ class EmailTemplateController extends Controller
$data = $request->validate([
'name' => 'sometimes|nullable|string|max:255',
'scenario' => ['sometimes', 'nullable', 'string', Rule::in(array_keys(Template::SCENARIOS))],
'scenario' => ['sometimes', 'nullable', 'string', 'max:100', 'regex:/^[a-z][a-z0-9_]*$/'],
'key' => ['sometimes', 'nullable', 'string', 'max:100', 'regex:/^[a-z][a-z0-9_]*$/', Rule::unique('template', 'key')->ignore($template->id)],
'format' => 'sometimes|nullable|in:html,json',
'invoice_template_id' => 'sometimes|nullable|integer|exists:template,id',
'subject' => 'sometimes|nullable|string|max:255',
@@ -293,7 +340,10 @@ class EmailTemplateController extends Controller
'type_id' => $t->type_id,
'name' => $t->name,
'scenario' => $t->scenario,
'scenario_label' => Template::SCENARIOS[$t->scenario] ?? null,
'key' => $t->key,
'scenario_label' => $t->scenario
? ($this->scenarioLabelOverrides()[$t->scenario] ?? Template::SCENARIOS[$t->scenario] ?? $t->scenario)
: null,
'format' => $t->format ?? 'html',
'invoice_template_id' => $t->invoice_template_id,
'invoice_template_name' => $t->invoiceTemplate?->name,
@@ -106,10 +106,7 @@ final class MailCampaignController extends Controller
private function renderPreview(string $subject, string $message): string
{
return view('emails.customer.template-camp', [
'content' => $message,
'emailSubject' => $subject,
])->render();
return Template::renderWithLayout($subject, $message);
}
public function store(Request $request): JsonResponse
+2 -2
View File
@@ -2,6 +2,7 @@
namespace App\Mail\Customer;
use App\Models\Template;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
@@ -26,8 +27,7 @@ class ManualCustomerEmail extends Mailable implements ShouldQueue
public function content(): Content
{
return new Content(
view: 'emails.customer.template-camp',
with: ['content' => $this->htmlContent, 'emailSubject' => $this->emailSubject],
html: Template::renderWithLayout($this->emailSubject, $this->htmlContent),
);
}
+29
View File
@@ -17,6 +17,7 @@ class Template extends Model
protected $fillable = [
'type_id',
'scenario',
'key',
'format',
'invoice_template_id',
'name',
@@ -44,6 +45,9 @@ class Template extends Model
if ($this->scenario) {
Cache::forget(self::CACHE_PREFIX . $this->scenario);
}
if ($this->key) {
Cache::forget(self::CACHE_PREFIX . $this->key);
}
}
/** Danh sách variable hợp lệ khai báo trong metadata.variables, key theo variable key. */
@@ -59,6 +63,7 @@ class Template extends Model
}
public const SCENARIOS = [
'layout' => 'Bố cục Header/Footer (mặc định)',
'vm_credentials' => 'Khởi tạo dịch vụ',
'renewal_reminder' => 'Nhắc gia hạn',
'news_notification' => 'Thông báo tin tức',
@@ -102,6 +107,30 @@ class Template extends Model
return $this->belongsTo(self::class, 'invoice_template_id');
}
/**
* Wrap $contentHtml with the admin-editable "layout" template (scenario=layout),
* replacing its {{$content}} placeholder. Falls back to the static blade
* template-camp wrapper when no active layout template is configured.
*/
public static function renderWithLayout(?string $subject, string $contentHtml): string
{
$layout = self::where('scenario', 'layout')->where('status', 1)->first();
if (!$layout || !$layout->message) {
return view('emails.customer.template-camp', [
'content' => $contentHtml,
'emailSubject' => $subject,
])->render();
}
$body = str_replace('{{$content}}', $contentHtml, $layout->message);
return view('emails.customer.template-envelope', [
'body' => $body,
'emailSubject' => $subject,
])->render();
}
public function type()
{
return $this->belongsTo(\App\Models\Type::class);
+9 -3
View File
@@ -34,12 +34,18 @@ class EmailTemplateService
return $this->renderer->render($this->loadTemplate($scenario), $data);
}
public function loadTemplate(string $scenario): Template
/**
* Tìm template theo `key` (định danh riêng, ưu tiên) hoặc `scenario`
* (tương thích ngược với các lời gọi cũ truyền scenario làm định danh).
*/
public function loadTemplate(string $key): Template
{
return Cache::remember(
Template::CACHE_PREFIX . $scenario,
Template::CACHE_PREFIX . $key,
3600,
fn () => Template::where('scenario', $scenario)->where('status', 1)->firstOrFail(),
fn () => Template::where('status', 1)
->where(fn ($q) => $q->where('key', $key)->orWhere('scenario', $key))
->firstOrFail(),
);
}
}
@@ -0,0 +1,141 @@
<?php
use App\Models\Template;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Seed the default "layout" template (scenario=layout) used by
* Template::renderWithLayout() to wrap mail-campaign / manual emails with
* the fixed TGS header + footer. Editable afterwards from
* Settings > Email Template like any other template.
*/
public function up(): void
{
if (Template::where('scenario', 'layout')->exists()) {
return;
}
Template::create([
'type_id' => 0,
'name' => 'Bố cục Header/Footer mặc định',
'scenario' => 'layout',
'format' => 'html',
'subject' => null,
'status' => 1,
'message' => $this->layoutHtml(),
]);
}
public function down(): void
{
Template::where('scenario', 'layout')->delete();
}
private function layoutHtml(): string
{
return <<<'HTML'
<table style="border-collapse: collapse; width: 100%; background-color: #efefef;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding: 20px;" align="center" valign="top">
<table style="padding-top: 20px; padding-bottom: 20px; border-collapse: collapse; background-color: #ffffff; width: 700px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr class="Header">
<td style="width: 700px;" valign="top">
<table align="center" width="700" bgcolor="#ffffff" style="border-collapse: collapse; width: 700px; max-width: 100%; text-align: center; background-color: #ffffff; border-top: 5px solid #f16723;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding: 0;">
<a href="https://tgs.com.vn" style="display: block;" target="_blank" rel="noopener">
<img src="https://res.cloudinary.com/izpast9i/image/upload/v1786499308/email_header.png" alt="Thư gửi từ Công Ty Cổ Phần Giải Pháp Công Nghệ Thế Giới Số" style="width: 100%; display: block; border: none;" width="700">
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="NoiDungKM">
<td style="width: 700px; padding: 25px; background-color: #ffffff;" valign="top">
{{$content}}
</td>
</tr>
<tr class="Footer">
<td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="700" align="center" background="https://res.cloudinary.com/izpast9i/image/upload/v1786500298/email_footer.png" bgcolor="#F16723" style="border-collapse: collapse; width: 700px; background-image: url(&quot;https://res.cloudinary.com/izpast9i/image/upload/v1786500298/email_footer.png&quot;); background-size: cover; background-position: center; background-repeat: no-repeat;">
<tbody>
<tr>
<td style="padding: 40px 30px 20px 30px; text-align: center;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: separate; border-spacing: 8px 0; width: 100%;">
<tbody>
<tr>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/premium-hosting/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Premium Hosting</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/cloud-server/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Cloud Server</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://cloudemail.vn/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Email doanh nghiệp</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/thiet-ke-website/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Thiết kế website</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<strong style="font-size: 14px; line-height: 22px; color: #ffffff;">CÔNG TY CỔ PHẦN GIẢI PHÁP CÔNG NGHỆ THẾ GIỚI SỐ</strong>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Địa chỉ: 128/38 Tân Hương, Phường Phú Thọ Hòa, Thành Phố Hồ Chí Minh</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Tel: (028) 7309.7379 &nbsp;-&nbsp; MST: 0318443116</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Email: <a href="mailto:support@tgs.com.vn" style="color: #ffffff; text-decoration: none;">support@tgs.com.vn</a></span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">
<a href="https://www.tgs.com.vn" style="color: #ffffff; text-decoration: underline;">www.TGS.com.vn</a>
&nbsp;&amp;&nbsp;
<a href="https://www.thegioiso.cloud" style="color: #ffffff; text-decoration: underline;">www.thegioiso.CLOUD</a>
&nbsp;&amp;&nbsp;
<a href="https://www.thegioiserver.com" style="color: #ffffff; text-decoration: underline;">www.thegioiSERVER.com</a>
&nbsp;&amp;&nbsp;
<a href="https://www.cloudemail.vn" style="color: #ffffff; text-decoration: underline;">www.CloudEmail.vn</a>
</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 16px 30px; text-align: center;">
<span style="font-size: 12px; line-height: 20px; color: #ffffff; font-weight: bold;">Thế Giới Số- Premium HOSTING • CLOUD • SERVER &amp; WEBSITE | 15+ năm Phụng Sự</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
HTML;
}
};
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('template', function (Blueprint $table) {
// key: định danh duy nhất để hệ thống tra cứu + gửi email theo key này,
// độc lập với scenario (scenario chỉ để phân loại/hiển thị).
$table->string('key', 100)->nullable()->unique()->after('scenario')
->comment('Định danh duy nhất dùng để tra template khi gửi mail (EmailTemplateService::loadTemplate)');
});
// Backfill: mặc định key = scenario cho các template đã có scenario,
// để mọi lời gọi gửi email theo scenario hiện tại tiếp tục hoạt động.
DB::table('template')
->whereNotNull('scenario')
->orderBy('id')
->get(['id', 'scenario'])
->each(fn ($row) => DB::table('template')->where('id', $row->id)->update(['key' => $row->scenario]));
}
public function down(): void
{
Schema::table('template', function (Blueprint $table) {
$table->dropColumn('key');
});
}
};
@@ -12,94 +12,13 @@
<td style="padding: 20px;" align="center" valign="top">
<table style="padding-top: 20px; padding-bottom: 20px; border-collapse: collapse; background-color: #ffffff; width: 700px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr class="Header">
<td style="width: 700px;" valign="top">
<table align="center" width="700" bgcolor="#ffffff" style="border-collapse: collapse; width: 700px; max-width: 100%; text-align: center; background-color: #ffffff; border-top: 5px solid #f16723;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding: 0;">
<a href="https://tgs.com.vn" style="display: block;" target="_blank" rel="noopener">
<img src="https://res.cloudinary.com/izpast9i/image/upload/v1786499308/email_header.png" alt="Thư gửi từ Công Ty Cổ Phần Giải Pháp Công Nghệ Thế Giới Số" style="width: 100%; display: block; border: none;" width="700">
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
@include('emails.partials.email-header')
<tr class="NoiDungKM">
<td style="width: 700px; padding: 25px; background-color: #ffffff;" valign="top">
{!! $content !!}
</td>
</tr>
<tr class="Footer">
<td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="700" align="center" background="https://res.cloudinary.com/izpast9i/image/upload/v1786500298/email_footer.png" bgcolor="#F16723" style="border-collapse: collapse; width: 700px; background-image: url(&quot;https://res.cloudinary.com/izpast9i/image/upload/v1786500298/email_footer.png&quot;); background-size: cover; background-position: center; background-repeat: no-repeat;">
<tbody>
<tr>
<td style="padding: 40px 30px 20px 30px; text-align: center;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: separate; border-spacing: 8px 0; width: 100%;">
<tbody>
<tr>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/premium-hosting/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Premium Hosting</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/cloud-server/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Cloud Server</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://cloudemail.vn/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Email doanh nghiệp</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/thiet-ke-website/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Thiết kế website</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<strong style="font-size: 14px; line-height: 22px; color: #ffffff;">CÔNG TY CỔ PHẦN GIẢI PHÁP CÔNG NGHỆ THẾ GIỚI SỐ</strong>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Địa chỉ: 128/38 Tân Hương, Phường Phú Thọ Hòa, Thành Phố Hồ Chí Minh</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Tel: (028) 7309. 7379 &nbsp;-&nbsp; MST: 0318443116</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Email: <a href="mailto:info@tgs.com.vn" style="color: #ffffff; text-decoration: none;">info@tgs.com.vn</a></span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">
<a href="https://www.tgs.com.vn" style="color: #ffffff; text-decoration: underline;">www.TGS.com.vn</a>
&nbsp;&amp;&nbsp;
<a href="https://www.thegioiso.cloud" style="color: #ffffff; text-decoration: underline;">www.thegioiso.CLOUD</a>
&nbsp;&amp;&nbsp;
<a href="https://www.thegioiserver.com" style="color: #ffffff; text-decoration: underline;">www.thegioiSERVER.com</a>
&nbsp;&amp;&nbsp;
<a href="https://www.cloudemail.vn" style="color: #ffffff; text-decoration: underline;">www.CloudEmail.vn</a>
</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 16px 30px; text-align: center;">
<span style="font-size: 12px; line-height: 20px; color: #ffffff; font-weight: bold;">Thế Giới Số- Premium HOSTING • CLOUD • SERVER &amp; WEBSITE | 15+ năm Phụng Sự</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
@include('emails.partials.email-footer')
</tbody>
</table>
</td>
@@ -0,0 +1,178 @@
@php
$companyName = $companyName ?? (setting('setting.company') ?: 'Công Ty Cổ Phần Giải Pháp Công Nghệ Thế Giới Số');
$headerBannerUrl = $headerBannerUrl ?? (setting('setting.email_header_banner') ?: 'https://res.cloudinary.com/izpast9i/image/upload/v1786499308/email_header.png');
@endphp
<table style="border-collapse: collapse; width: 100%; background-color: #efefef;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding: 20px;" align="center" valign="top">
<table style="padding-top: 20px; padding-bottom: 20px; border-collapse: collapse; background-color: #ffffff; width: 700px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<!-- Content -->
<tr class="Header">
<td style="width: 700px;" valign="top">
<table align="center" width="700" bgcolor="#ffffff" style="border-collapse: collapse; width: 700px; max-width: 100%; text-align: center; background-color: #ffffff; border-top: 5px solid #f16723;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding: 0;">
<a href="https://tgs.com.vn" style="display: block;" target="_blank" rel="noopener">
<img src="{{ $headerBannerUrl }}" alt="Thư gửi từ {{ $companyName }}" style="width: 100%; display: block; border: none;" width="700">
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- Body -->
<tr>
<td>
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="width:100%;background-color:#ffffff;">
<tr>
<td style="padding:36px 40px 8px 40px;font-family:Montserrat,-apple-system,sans-serif;">
<!-- Badge -->
<table cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td style="background-color:#fff3ea;border-radius:20px;padding:6px 16px;">
<span style="font-size:12px;font-weight:700;letter-spacing:.04em;color:#f16723;text-transform:uppercase;">Đơn hàng mới</span>
</td>
</tr>
</table>
<p style="margin:18px 0 6px 0;font-size:22px;font-weight:700;color:#2b2b2b;">Có đơn đăng ký tên miền mới 🎉</p>
<p style="margin:0 0 28px 0;font-size:15px;line-height:24px;color:#767676;">
Một khách hàng vừa đăng ký tên miền tại <strong style="color:#2b2b2b;">{{company_name}}</strong>. Chi tiết đơn hàng bên dưới.
</p>
<!-- Order info card -->
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="width:100%;background-color:#f9f9f9;border:1px solid #eeeeee;border-radius:10px;">
<tr>
<td style="padding:22px 24px;">
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="width:100%;font-size:14px;line-height:22px;color:#4a4a4a;">
<tr>
<td style="padding:6px 0;width:38%;color:#9a9a9a;">Tên miền</td>
<td style="padding:6px 0;font-weight:700;color:#f16723;font-size:16px;">{{domain_name}}</td>
</tr>
<tr>
<td style="padding:6px 0;border-top:1px solid #ececec;color:#9a9a9a;">Mã đơn hàng</td>
<td style="padding:6px 0;border-top:1px solid #ececec;font-weight:600;">{{order_num}}</td>
</tr>
<tr>
<td style="padding:6px 0;border-top:1px solid #ececec;color:#9a9a9a;">Tổng tiền</td>
<td style="padding:6px 0;border-top:1px solid #ececec;font-weight:700;color:#2b2b2b;">{{order_total}}</td>
</tr>
<tr>
<td style="padding:6px 0;border-top:1px solid #ececec;color:#9a9a9a;">Khách hàng</td>
<td style="padding:6px 0;border-top:1px solid #ececec;font-weight:600;">{{customer_name}}</td>
</tr>
<tr>
<td style="padding:6px 0;border-top:1px solid #ececec;color:#9a9a9a;">Email</td>
<td style="padding:6px 0;border-top:1px solid #ececec;font-weight:600;">{{customer_email}}</td>
</tr>
<tr>
<td style="padding:6px 0;border-top:1px solid #ececec;color:#9a9a9a;">Thời gian</td>
<td style="padding:6px 0;border-top:1px solid #ececec;font-weight:600;">{{created_at}}</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- CTA button -->
<table cellpadding="0" cellspacing="0" role="presentation" style="margin:30px auto 8px auto;">
<tr>
<td style="border-radius:6px;background-color:#f16723;text-align:center;">
<a href="{{admin_url}}" style="display:block;font-family:Montserrat,-apple-system,sans-serif;font-size:15px;font-weight:700;letter-spacing:.02em;line-height:100%;color:#ffffff;text-decoration:none;padding:15px 40px;">XEM ĐƠN HÀNG →</a>
</td>
</tr>
</table>
<p style="margin:24px 0 0 0;font-size:12px;line-height:18px;color:#a8a8a8;border-top:1px solid #f0f0f0;padding-top:16px;">
💡 Đây là tin nhắn tự động, vui lòng không trả lời email này.
</p>
</td>
</tr>
<tr><td style="padding:0 40px;"><div style="height:24px;line-height:24px;font-size:1px;">&nbsp;</div></td></tr>
</table>
</td>
</tr>
<!-- End Body -->
<tr class="Footer">
<td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="700" align="center" background="https://res.cloudinary.com/izpast9i/image/upload/v1786500298/email_footer.png" bgcolor="#F16723" style="border-collapse: collapse; width: 700px; background-image: url(&quot;https://res.cloudinary.com/izpast9i/image/upload/v1786500298/email_footer.png&quot;); background-size: cover; background-position: center; background-repeat: no-repeat;">
<tbody>
<tr>
<td style="padding: 40px 30px 20px 30px; text-align: center;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: separate; border-spacing: 8px 0; width: 100%;">
<tbody>
<tr>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/premium-hosting/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Premium Hosting</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/cloud-server/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Cloud Server</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://cloudemail.vn/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Email doanh nghiệp</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/thiet-ke-website/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Thiết kế website</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<strong style="font-size: 14px; line-height: 22px; color: #ffffff;">{{ $companyName }}</strong>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Địa chỉ: {{ $companyAddress }}</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Tel: {{ $supportPhone }} &nbsp;-&nbsp; MST: {{ $companyTax }}</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Email: <a href="mailto:{{ $supportEmail }}" style="color: #ffffff; text-decoration: none;">{{ $supportEmail }}</a></span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">
<a href="https://www.tgs.com.vn" style="color: #ffffff; text-decoration: underline;">www.TGS.com.vn</a>
&nbsp;&amp;&nbsp;
<a href="https://www.thegioiso.cloud" style="color: #ffffff; text-decoration: underline;">www.thegioiso.CLOUD</a>
&nbsp;&amp;&nbsp;
<a href="https://www.thegioiserver.com" style="color: #ffffff; text-decoration: underline;">www.thegioiSERVER.com</a>
&nbsp;&amp;&nbsp;
<a href="https://www.cloudemail.vn" style="color: #ffffff; text-decoration: underline;">www.CloudEmail.vn</a>
</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 16px 30px; text-align: center;">
<span style="font-size: 12px; line-height: 20px; color: #ffffff; font-weight: bold;">Thế Giới Số- Premium HOSTING • CLOUD • SERVER &amp; WEBSITE | 15+ năm Phụng Sự</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!-- End conent -->
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $emailSubject ?? '' }}</title>
</head>
<body>
{!! $body !!}
</body>
</html>
@@ -9,21 +9,7 @@
<td style="padding: 20px;" align="center" valign="top">
<table style="padding-top: 20px; padding-bottom: 20px; border-collapse: collapse; background-color: #ffffff; width: 700px;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr class="Header">
<td style="width: 700px;" valign="top">
<table align="center" width="700" bgcolor="#ffffff" style="border-collapse: collapse; width: 700px; max-width: 100%; text-align: center; background-color: #ffffff; border-top: 5px solid #f16723;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding: 0;">
<a href="https://tgs.com.vn" style="display: block;" target="_blank" rel="noopener">
<img src="https://res.cloudinary.com/izpast9i/image/upload/v1786499308/email_header.png" alt="Thư gửi từ {{ $companyName }}" style="width: 100%; display: block; border: none;" width="700">
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
@include('emails.partials.email-header', ['companyName' => $companyName])
<tr class="NoiDungKM">
<td style="width: 700px; padding: 25px; background-color: #ffffff;" valign="top">
@if($bannerUrl)
@@ -41,74 +27,7 @@
{!! $body !!}
</td>
</tr>
<tr class="Footer">
<td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="700" align="center" background="https://res.cloudinary.com/izpast9i/image/upload/v1786500298/email_footer.png" bgcolor="#F16723" style="border-collapse: collapse; width: 700px; background-image: url(&quot;https://res.cloudinary.com/izpast9i/image/upload/v1786500298/email_footer.png&quot;); background-size: cover; background-position: center; background-repeat: no-repeat;">
<tbody>
<tr>
<td style="padding: 40px 30px 20px 30px; text-align: center;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: separate; border-spacing: 8px 0; width: 100%;">
<tbody>
<tr>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/premium-hosting/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Premium Hosting</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/cloud-server/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Cloud Server</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://cloudemail.vn/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Email doanh nghiệp</a>
</td>
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
<a href="https://tgs.com.vn/thiet-ke-website/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Thiết kế website</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<strong style="font-size: 14px; line-height: 22px; color: #ffffff;">{{ $companyName }}</strong>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Địa chỉ: 128/38 Tân Hương, Phường Phú Thọ Hòa, Thành Phố Hồ Chí Minh</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Tel: (028) 7309.7379 &nbsp;-&nbsp; MST: 0318443116</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Email: <a href="mailto:support@tgs.com.vn" style="color: #ffffff; text-decoration: none;">support@tgs.com.vn</a></span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">
<a href="https://www.tgs.com.vn" style="color: #ffffff; text-decoration: underline;">www.TGS.com.vn</a>
&nbsp;&amp;&nbsp;
<a href="https://www.thegioiso.cloud" style="color: #ffffff; text-decoration: underline;">www.thegioiso.CLOUD</a>
&nbsp;&amp;&nbsp;
<a href="https://www.thegioiserver.com" style="color: #ffffff; text-decoration: underline;">www.thegioiSERVER.com</a>
&nbsp;&amp;&nbsp;
<a href="https://www.cloudemail.vn" style="color: #ffffff; text-decoration: underline;">www.CloudEmail.vn</a>
</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 16px 30px; text-align: center;">
<span style="font-size: 12px; line-height: 20px; color: #ffffff; font-weight: bold;">Thế Giới Số- Premium HOSTING • CLOUD • SERVER &amp; WEBSITE | 15+ năm Phụng Sự</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
@include('emails.partials.email-footer', ['companyName' => $companyName])
</tbody>
</table>
</td>
@@ -1,6 +1,9 @@
@php
$supportEmail = $supportEmail ?? 'support@tgs.com.vn';
$supportPhone = $supportPhone ?? '(028) 7309. 7379';
$supportEmail = $supportEmail ?? (setting('setting.support') ?: 'support@tgs.com.vn');
$supportPhone = $supportPhone ?? (setting('setting.hotline') ?: '(028) 7309. 7379');
$companyName = $companyName ?? (setting('setting.company') ?: 'CÔNG TY CỔ PHẦN GIẢI PHÁP CÔNG NGHỆ THẾ GIỚI SỐ');
$companyAddress = $companyAddress ?? (setting('setting.address') ?: '128/38 Tân Hương, Phường Phú Thọ Hòa, Thành Phố Hồ Chí Minh');
$companyTax = $companyTax ?? (setting('setting.tax') ?: '0318443116');
@endphp
<tr class="Footer">
<td align="center" valign="top">
@@ -30,17 +33,17 @@
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<strong style="font-size: 14px; line-height: 22px; color: #ffffff;">CÔNG TY CỔ PHẦN GIẢI PHÁP CÔNG NGHỆ THẾ GIỚI SỐ</strong>
<strong style="font-size: 14px; line-height: 22px; color: #ffffff;">{{ $companyName }}</strong>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Địa chỉ: 128/38 Tân Hương, Phường Phú Thọ Hòa, Thành Phố Hồ Chí Minh</span>
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Địa chỉ: {{ $companyAddress }}</span>
</td>
</tr>
<tr>
<td style="padding: 6px 30px 0 30px; text-align: center;">
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Tel: {{ $supportPhone }} &nbsp;-&nbsp; MST: 0318443116</span>
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Tel: {{ $supportPhone }} &nbsp;-&nbsp; MST: {{ $companyTax }}</span>
</td>
</tr>
<tr>
@@ -1,3 +1,7 @@
@php
$companyName = $companyName ?? (setting('setting.company') ?: 'Công Ty Cổ Phần Giải Pháp Công Nghệ Thế Giới Số');
$headerBannerUrl = $headerBannerUrl ?? (setting('setting.email_header_banner') ?: 'https://res.cloudinary.com/izpast9i/image/upload/v1786499308/email_header.png');
@endphp
<tr class="Header">
<td style="width: 700px;" valign="top">
<table align="center" width="700" bgcolor="#ffffff" style="border-collapse: collapse; width: 700px; max-width: 100%; text-align: center; background-color: #ffffff; border-top: 5px solid #f16723;" border="0" cellspacing="0" cellpadding="0">
@@ -5,7 +9,7 @@
<tr>
<td style="padding: 0;">
<a href="https://tgs.com.vn" style="display: block;" target="_blank" rel="noopener">
<img src="https://res.cloudinary.com/izpast9i/image/upload/v1786499308/email_header.png" alt="Thư gửi từ Công Ty Cổ Phần Giải Pháp Công Nghệ Thế Giới Số" style="width: 100%; display: block; border: none;" width="700">
<img src="{{ $headerBannerUrl }}" alt="Thư gửi từ {{ $companyName }}" style="width: 100%; display: block; border: none;" width="700">
</a>
</td>
</tr>
+1
View File
@@ -618,6 +618,7 @@ Route::prefix('v1')
Route::get('/', 'index');
Route::post('/', 'store');
Route::get('scenarios', 'scenarios');
Route::put('scenarios/{key}/label', 'updateScenarioLabel');
Route::get('email-settings', 'getEmailSettings');
Route::put('email-settings', 'updateEmailSettings');
Route::get('{id}', 'show');