feat: Add IT Support catalog and related migrations, seeders, and email templates
- Created migration to add 'group_label' to 'product_type_fields' table. - Implemented ItSupportCatalogSeeder to populate IT Support features and tiers. - Added ProductCategorySeeder for initial product categories. - Developed ProductMockupSeeder for mockup products in various categories. - Introduced ProductTypeFieldSeeder to define fields for different product types. - Created email templates for VPS service information and service renewal reminders.
This commit is contained in:
@@ -23,6 +23,10 @@ class DatabaseSeeder extends Seeder
|
||||
$user->assignRole('Full Administrator');
|
||||
$this->call(TemplateSeeder::class);
|
||||
$this->call(Setting::class);
|
||||
$this->call(ProductCategorySeeder::class);
|
||||
$this->call(ProductTypeFieldSeeder::class);
|
||||
$this->call(ProductMockupSeeder::class);
|
||||
$this->call(ItSupportCatalogSeeder::class);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductCategories;
|
||||
use App\Models\ProductPricings;
|
||||
use App\Models\ProductTypeField;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ItSupportCatalogSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Real IT Support comparison matrix (4 tiers x N feature rows), replaces
|
||||
* the earlier generic "packages" mockup field with the actual per-tier
|
||||
* feature grid the business sells.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Fields no longer used by the real matrix (superseded by the rows below).
|
||||
ProductTypeField::where('product_type', 'it_support')
|
||||
->whereIn('key', ['packages', 'response_time_hours', 'coverage'])
|
||||
->delete();
|
||||
|
||||
$groups = [
|
||||
'Nhóm dịch vụ phần mềm & thiết bị' => [
|
||||
['device_check_frequency', 'Kiểm tra thiết bị định kỳ', 'text'],
|
||||
['device_cleaning_frequency', 'Vệ sinh thiết bị định kỳ', 'text'],
|
||||
['software_install_on_request', 'Cài đặt phần mềm theo yêu cầu', 'text'],
|
||||
['virus_scan_frequency', 'Kiểm tra và quét virus định kỳ', 'text'],
|
||||
['hw_sw_troubleshooting', 'Xử lý các lỗi phần cứng, phần mềm', 'text'],
|
||||
['loaner_device', 'Cho mượn thiết bị thay thế khi cần', 'text'],
|
||||
],
|
||||
'Nhóm hạ tầng & hỗ trợ kỹ thuật' => [
|
||||
['operations_staff', 'Nhân sự vận hành hệ thống', 'text'],
|
||||
['response_time', 'Thời gian tiếp nhận và hỗ trợ', 'text'],
|
||||
['support_channels', 'Kênh hỗ trợ', 'text'],
|
||||
['monitoring_24_7', 'Hệ thống giám sát hạ tầng 24/7', 'text'],
|
||||
['infra_report_frequency', 'Báo cáo hệ thống hạ tầng', 'text'],
|
||||
['backup_restore', 'Hệ thống Backup - Restore Data', 'text'],
|
||||
],
|
||||
'Camera/IP Phone & thiết bị ngoại vi' => [
|
||||
['camera_ip_phone_support', 'Hỗ trợ kiểm tra thiết bị (Camera/IP Phone)', 'text'],
|
||||
],
|
||||
'Tư vấn & bảo mật' => [
|
||||
['upgrade_consulting', 'Tư vấn & báo giá nâng cấp thiết bị văn phòng', 'text'],
|
||||
['security_alert_notice', 'Thông báo lỗ hổng bảo mật đến người dùng', 'text'],
|
||||
['issue_consulting', 'Tư vấn lỗi thường gặp và đề xuất hướng xử lý', 'text'],
|
||||
],
|
||||
'Tường lửa & bảo vệ truy cập' => [
|
||||
['firewall_support_level', 'Hỗ trợ và xử lý yêu cầu tường lửa', 'text'],
|
||||
['website_download_block', 'Chặn truy cập website, tải xuống theo yêu cầu', 'text'],
|
||||
['network_security_incident', 'Xử lý sự cố kết nối mạng & bảo mật', 'text'],
|
||||
['remote_access_setup', 'Thiết lập truy xuất dữ liệu từ xa', 'text'],
|
||||
],
|
||||
];
|
||||
|
||||
$sortOrder = 0;
|
||||
foreach ($groups as $groupLabel => $rows) {
|
||||
foreach ($rows as [$key, $label, $fieldType]) {
|
||||
$sortOrder++;
|
||||
ProductTypeField::updateOrCreate(
|
||||
['product_type' => 'it_support', 'key' => $key],
|
||||
[
|
||||
'group_label' => $groupLabel,
|
||||
'label' => $label,
|
||||
'field_type' => $fieldType,
|
||||
'sort_order' => $sortOrder,
|
||||
'is_required' => false,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ── 4 tiers (Star / Silver / Gold / Diamond) ──────────────────────
|
||||
$category = ProductCategories::where('slug', 'it-support')->first();
|
||||
if (!$category) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tiers = [
|
||||
[
|
||||
'name' => 'IT Helpdesk Star',
|
||||
'short_description' => 'Dưới 10 PC — 200.000đ / máy / tháng',
|
||||
'price_monthly' => 200000,
|
||||
'values' => [
|
||||
'device_check_frequency' => '2 tháng/lần',
|
||||
'device_cleaning_frequency' => '2 tháng/lần',
|
||||
'software_install_on_request' => 'Có',
|
||||
'virus_scan_frequency' => '3 tháng/lần',
|
||||
'hw_sw_troubleshooting' => 'Có',
|
||||
'loaner_device' => 'Có',
|
||||
'operations_staff' => '1 IT Manager · 5 IT Hỗ trợ',
|
||||
'response_time' => "Online 15' · Onsite 120'",
|
||||
'support_channels' => 'Phone, Chat, Webform, Email',
|
||||
'monitoring_24_7' => 'Có',
|
||||
'infra_report_frequency' => 'Hàng tháng',
|
||||
'backup_restore' => 'Có',
|
||||
'camera_ip_phone_support' => 'Có',
|
||||
'upgrade_consulting' => 'Có',
|
||||
'security_alert_notice' => 'Có',
|
||||
'issue_consulting' => 'Có',
|
||||
'firewall_support_level' => 'Cơ bản',
|
||||
'website_download_block' => 'Có',
|
||||
'network_security_incident' => 'Có',
|
||||
'remote_access_setup' => 'Có',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'IT Helpdesk Silver',
|
||||
'short_description' => '10 - 30 PC — 180.000đ / máy / tháng',
|
||||
'price_monthly' => 180000,
|
||||
'values' => [
|
||||
'device_check_frequency' => '1 tháng/lần',
|
||||
'device_cleaning_frequency' => '2 tháng/lần',
|
||||
'software_install_on_request' => 'Có',
|
||||
'virus_scan_frequency' => '2 tháng/lần',
|
||||
'hw_sw_troubleshooting' => 'Có',
|
||||
'loaner_device' => 'Có',
|
||||
'operations_staff' => '1 IT Manager · 5 IT Hỗ trợ',
|
||||
'response_time' => "Online 10' · Onsite 90'",
|
||||
'support_channels' => 'Phone, Chat, Webform, Email',
|
||||
'monitoring_24_7' => 'Có',
|
||||
'infra_report_frequency' => 'Hàng tuần, tháng',
|
||||
'backup_restore' => 'Có',
|
||||
'camera_ip_phone_support' => 'Có',
|
||||
'upgrade_consulting' => 'Có',
|
||||
'security_alert_notice' => 'Có',
|
||||
'issue_consulting' => 'Có',
|
||||
'firewall_support_level' => 'Tiêu chuẩn',
|
||||
'website_download_block' => 'Có',
|
||||
'network_security_incident' => 'Có',
|
||||
'remote_access_setup' => 'Có',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'IT Helpdesk Gold',
|
||||
'short_description' => '31 - 49 PC — 150.000đ / máy / tháng',
|
||||
'price_monthly' => 150000,
|
||||
'values' => [
|
||||
'device_check_frequency' => '1 tháng/lần',
|
||||
'device_cleaning_frequency' => '1 tháng/lần',
|
||||
'software_install_on_request' => 'Có',
|
||||
'virus_scan_frequency' => '1 tháng/lần',
|
||||
'hw_sw_troubleshooting' => 'Có',
|
||||
'loaner_device' => 'Có',
|
||||
'operations_staff' => '1 IT Manager · 5 IT Hỗ trợ',
|
||||
'response_time' => "Online 10' · Onsite 60'",
|
||||
'support_channels' => 'Phone, Chat, Webform, Email',
|
||||
'monitoring_24_7' => 'Có',
|
||||
'infra_report_frequency' => 'Hàng tuần, tháng',
|
||||
'backup_restore' => 'Có',
|
||||
'camera_ip_phone_support' => 'Có',
|
||||
'upgrade_consulting' => 'Có',
|
||||
'security_alert_notice' => 'Có',
|
||||
'issue_consulting' => 'Có',
|
||||
'firewall_support_level' => 'Nâng cao',
|
||||
'website_download_block' => 'Có',
|
||||
'network_security_incident' => 'Có',
|
||||
'remote_access_setup' => 'Có',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'IT Helpdesk Diamond',
|
||||
'short_description' => 'Kinh doanh đặc biệt — Liên hệ báo giá',
|
||||
'price_monthly' => null,
|
||||
'values' => [
|
||||
'device_check_frequency' => '1 tháng/lần',
|
||||
'device_cleaning_frequency' => '1 tháng/lần',
|
||||
'software_install_on_request' => 'Có',
|
||||
'virus_scan_frequency' => '1 tháng/lần',
|
||||
'hw_sw_troubleshooting' => 'Có',
|
||||
'loaner_device' => 'Có',
|
||||
'operations_staff' => '1 IT Manager · 5 IT Hỗ trợ',
|
||||
'response_time' => "Online 10' · Onsite 60'",
|
||||
'support_channels' => 'Phone, Chat, Webform, Email',
|
||||
'monitoring_24_7' => 'Có',
|
||||
'infra_report_frequency' => 'Hàng tuần, tháng',
|
||||
'backup_restore' => 'Có',
|
||||
'camera_ip_phone_support' => 'Có',
|
||||
'upgrade_consulting' => 'Có',
|
||||
'security_alert_notice' => 'Có',
|
||||
'issue_consulting' => 'Có',
|
||||
'firewall_support_level' => 'Cao cấp',
|
||||
'website_download_block' => 'Có',
|
||||
'network_security_incident' => 'Có',
|
||||
'remote_access_setup' => 'Có',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Remove the earlier single generic mockup — superseded by the 4 real tiers.
|
||||
Product::withTrashed()->where('slug', 'it-support-goi-doanh-nghiep')->first()?->forceDelete();
|
||||
|
||||
foreach ($tiers as $tier) {
|
||||
$slug = Str::slug($tier['name']);
|
||||
$product = Product::withTrashed()->where('slug', $slug)->first();
|
||||
|
||||
if (!$product) {
|
||||
$product = Product::create([
|
||||
'name' => $tier['name'],
|
||||
'slug' => $slug,
|
||||
'short_description' => $tier['short_description'],
|
||||
'product_categories_id' => $category->id,
|
||||
'setup_fee' => 0,
|
||||
'features' => $tier['values'],
|
||||
'is_active' => true,
|
||||
'is_unlimited' => true,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
} else {
|
||||
$product->update([
|
||||
'short_description' => $tier['short_description'],
|
||||
'features' => $tier['values'],
|
||||
]);
|
||||
}
|
||||
|
||||
if ($tier['price_monthly'] !== null) {
|
||||
ProductPricings::updateOrCreate(
|
||||
['product_id' => $product->id, 'billing_cycle' => 'monthly'],
|
||||
['price' => $tier['price_monthly'], 'currency' => 'VND', 'is_active' => true]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\ProductCategories;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProductCategorySeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$categories = [
|
||||
['name' => 'Thiết kế website', 'slug' => 'thiet-ke-website', 'type' => 'web_design', 'sort_order' => 10],
|
||||
['name' => 'Email', 'slug' => 'email', 'type' => 'email', 'sort_order' => 20],
|
||||
['name' => 'Hardware', 'slug' => 'hardware', 'type' => 'hardware', 'sort_order' => 30],
|
||||
['name' => 'IT Support', 'slug' => 'it-support', 'type' => 'it_support', 'sort_order' => 40],
|
||||
['name' => 'Thuê máy chủ', 'slug' => 'thue-may-chu', 'type' => 'server_rental', 'sort_order' => 50],
|
||||
];
|
||||
|
||||
foreach ($categories as $category) {
|
||||
ProductCategories::firstOrCreate(
|
||||
['slug' => $category['slug']],
|
||||
$category + ['is_active' => true]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductCategories;
|
||||
use App\Models\ProductPricings;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ProductMockupSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$mockups = [
|
||||
'thiet-ke-website' => [
|
||||
'name' => 'Website Landing Page - Cơ bản',
|
||||
'short_description' => 'Thiết kế landing page 1 trang, chuẩn responsive, tối ưu SEO cơ bản.',
|
||||
'setup_fee' => 500000,
|
||||
'features' => null,
|
||||
'price_monthly' => 0,
|
||||
'price_onetime' => 3500000,
|
||||
],
|
||||
'email' => [
|
||||
'name' => 'Email Doanh Nghiệp - Gói 10 tài khoản',
|
||||
'short_description' => 'Email theo tên miền riêng, chống spam, đồng bộ đa thiết bị.',
|
||||
'setup_fee' => 0,
|
||||
'features' => [
|
||||
'mailbox_quota' => 10,
|
||||
'account_count' => 10,
|
||||
'domain' => 'yourcompany.vn',
|
||||
],
|
||||
'price_monthly' => 250000,
|
||||
],
|
||||
'hardware' => [
|
||||
'name' => 'Switch Cisco Catalyst 24-port',
|
||||
'short_description' => 'Switch mạng 24 cổng Gigabit, hàng chính hãng, bảo hành nhà phân phối.',
|
||||
'setup_fee' => 200000,
|
||||
'features' => [
|
||||
'device_type' => 'Switch mạng',
|
||||
'model' => 'Catalyst 2960-24TT-L',
|
||||
'serial_number' => 'SN-CISCO-2960-000123',
|
||||
'warranty_months' => 24,
|
||||
],
|
||||
'price_onetime' => 12500000,
|
||||
],
|
||||
'it-support' => [
|
||||
'name' => 'IT Support - Gói Doanh Nghiệp',
|
||||
'short_description' => 'Hỗ trợ kỹ thuật trọn gói cho văn phòng, ưu tiên xử lý sự cố 24/7.',
|
||||
'setup_fee' => 0,
|
||||
'features' => [
|
||||
'packages' => [
|
||||
['label' => 'Gói Cơ bản', 'value' => '2.000.000đ/tháng - Hỗ trợ giờ hành chính'],
|
||||
['label' => 'Gói Nâng cao', 'value' => '4.500.000đ/tháng - Hỗ trợ 24/7'],
|
||||
['label' => 'Gói Doanh nghiệp', 'value' => '8.000.000đ/tháng - Có kỹ thuật viên thường trực'],
|
||||
],
|
||||
'response_time_hours' => 2,
|
||||
'coverage' => 'Xử lý sự cố phần cứng, phần mềm, mạng nội bộ, sao lưu dữ liệu định kỳ.',
|
||||
],
|
||||
'price_monthly' => 4500000,
|
||||
],
|
||||
'thue-may-chu' => [
|
||||
'name' => 'Thuê Máy Chủ Vật Lý - Dell R740',
|
||||
'short_description' => 'Thuê nguyên máy chủ vật lý đặt tại data center Tier III, băng thông riêng.',
|
||||
'setup_fee' => 1000000,
|
||||
'features' => [
|
||||
'location' => 'Data Center FPT Telecom, Q.9, TP.HCM',
|
||||
'specs' => 'Dell PowerEdge R740, 2x Xeon Silver 4210, 64GB RAM, 2x 960GB SSD RAID1',
|
||||
'rental_months' => 12,
|
||||
],
|
||||
'price_monthly' => 6500000,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($mockups as $categorySlug => $data) {
|
||||
$category = ProductCategories::where('slug', $categorySlug)->first();
|
||||
if (!$category) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$slug = Str::slug($data['name']);
|
||||
if (Product::withTrashed()->where('slug', $slug)->exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$product = Product::create([
|
||||
'name' => $data['name'],
|
||||
'slug' => $slug,
|
||||
'short_description' => $data['short_description'],
|
||||
'product_categories_id' => $category->id,
|
||||
'setup_fee' => $data['setup_fee'],
|
||||
'features' => $data['features'],
|
||||
'is_active' => true,
|
||||
'is_unlimited' => true,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
if (!empty($data['price_monthly'])) {
|
||||
ProductPricings::create([
|
||||
'product_id' => $product->id,
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => $data['price_monthly'],
|
||||
'currency' => 'VND',
|
||||
'is_active' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
if (!empty($data['price_onetime'])) {
|
||||
ProductPricings::create([
|
||||
'product_id' => $product->id,
|
||||
'billing_cycle' => 'onetime',
|
||||
'price' => $data['price_onetime'],
|
||||
'currency' => 'VND',
|
||||
'is_active' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\ProductTypeField;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProductTypeFieldSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$fields = [
|
||||
// VPS / Cloud
|
||||
['product_type' => 'vps', 'key' => 'cpu', 'label' => 'CPU (vCPU)', 'field_type' => 'number', 'sort_order' => 1],
|
||||
['product_type' => 'vps', 'key' => 'ram', 'label' => 'RAM (GB)', 'field_type' => 'number', 'sort_order' => 2],
|
||||
['product_type' => 'vps', 'key' => 'disk', 'label' => 'Disk (GB)', 'field_type' => 'number', 'sort_order' => 3],
|
||||
['product_type' => 'vps', 'key' => 'bandwidth', 'label' => 'Băng thông (GB)', 'field_type' => 'number', 'sort_order' => 4],
|
||||
|
||||
// Hosting
|
||||
['product_type' => 'hosting', 'key' => 'cpu', 'label' => 'CPU (vCPU)', 'field_type' => 'number', 'sort_order' => 1],
|
||||
['product_type' => 'hosting', 'key' => 'ram', 'label' => 'RAM (GB)', 'field_type' => 'number', 'sort_order' => 2],
|
||||
['product_type' => 'hosting', 'key' => 'disk', 'label' => 'Disk (GB)', 'field_type' => 'number', 'sort_order' => 3],
|
||||
['product_type' => 'hosting', 'key' => 'domain_count', 'label' => 'Số lượng domain', 'field_type' => 'number', 'sort_order' => 4],
|
||||
|
||||
// Email
|
||||
['product_type' => 'email', 'key' => 'mailbox_quota', 'label' => 'Dung lượng hộp thư (GB)', 'field_type' => 'number', 'sort_order' => 1],
|
||||
['product_type' => 'email', 'key' => 'account_count', 'label' => 'Số lượng tài khoản email', 'field_type' => 'number', 'sort_order' => 2],
|
||||
['product_type' => 'email', 'key' => 'domain', 'label' => 'Tên miền sử dụng', 'field_type' => 'text', 'sort_order' => 3],
|
||||
|
||||
// Hardware
|
||||
['product_type' => 'hardware', 'key' => 'device_type', 'label' => 'Loại thiết bị', 'field_type' => 'text', 'sort_order' => 1],
|
||||
['product_type' => 'hardware', 'key' => 'model', 'label' => 'Model / Model number', 'field_type' => 'text', 'sort_order' => 2],
|
||||
['product_type' => 'hardware', 'key' => 'serial_number', 'label' => 'Số serial (Serial Number)', 'field_type' => 'text', 'sort_order' => 3],
|
||||
['product_type' => 'hardware', 'key' => 'warranty_months', 'label' => 'Thời gian bảo hành (tháng)', 'field_type' => 'number', 'sort_order' => 4],
|
||||
|
||||
// IT Support
|
||||
['product_type' => 'it_support', 'key' => 'packages', 'label' => 'Các gói hỗ trợ', 'field_type' => 'repeater', 'sort_order' => 1],
|
||||
['product_type' => 'it_support', 'key' => 'response_time_hours', 'label' => 'Thời gian phản hồi (giờ)', 'field_type' => 'number', 'sort_order' => 2],
|
||||
['product_type' => 'it_support', 'key' => 'coverage', 'label' => 'Phạm vi hỗ trợ', 'field_type' => 'textarea', 'sort_order' => 3],
|
||||
|
||||
// Server rental (thuê máy chủ)
|
||||
['product_type' => 'server_rental', 'key' => 'location', 'label' => 'Vị trí đặt máy chủ', 'field_type' => 'text', 'sort_order' => 1],
|
||||
['product_type' => 'server_rental', 'key' => 'specs', 'label' => 'Cấu hình máy chủ', 'field_type' => 'textarea', 'sort_order' => 2],
|
||||
['product_type' => 'server_rental', 'key' => 'rental_months', 'label' => 'Thời hạn thuê (tháng)', 'field_type' => 'number', 'sort_order' => 3],
|
||||
];
|
||||
|
||||
foreach ($fields as $field) {
|
||||
ProductTypeField::firstOrCreate(
|
||||
['product_type' => $field['product_type'], 'key' => $field['key']],
|
||||
$field
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user