nang cap san sang import

This commit is contained in:
2026-05-01 04:33:00 +00:00
parent 6c74c17b48
commit 6ef2e9fe4e
93 changed files with 6542 additions and 12 deletions

View File

@@ -94,14 +94,139 @@ class AfterSalesSeeder extends Seeder
$customers[3]->products()->attach($products[1]->id, ['purchase_date' => '2025-01-05']);
$customers[3]->products()->attach($products[2]->id, ['purchase_date' => '2025-02-15']);
$contract1 = \App\Models\Contract::create([
'product_id' => $products[0]->id,
'customer_id' => $customers[0]->id,
'type' => \App\Enums\ContractType::SALE->value,
'start_date' => '2024-01-15',
'status' => \App\Enums\ContractStatus::ACTIVE->value,
'signed_status' => 'Đã ký',
]);
$contract2 = \App\Models\Contract::create([
'product_id' => $products[1]->id,
'customer_id' => $customers[0]->id,
'type' => \App\Enums\ContractType::LEASE->value,
'start_date' => '2024-06-01',
'end_date' => '2026-06-01',
'status' => \App\Enums\ContractStatus::ACTIVE->value,
'signed_status' => 'Đã ký',
]);
$contract3 = \App\Models\Contract::create([
'product_id' => $products[0]->id,
'customer_id' => $customers[1]->id,
'type' => \App\Enums\ContractType::SALE->value,
'start_date' => '2024-03-20',
'status' => \App\Enums\ContractStatus::ACTIVE->value,
'signed_status' => 'Đã ký',
]);
$contract4 = \App\Models\Contract::create([
'product_id' => $products[2]->id,
'customer_id' => $customers[2]->id,
'type' => \App\Enums\ContractType::BCC->value,
'start_date' => '2024-09-10',
'end_date' => '2029-09-10',
'status' => \App\Enums\ContractStatus::ACTIVE->value,
'signed_status' => 'Đang chờ ký',
]);
$contract5 = \App\Models\Contract::create([
'product_id' => $products[1]->id,
'customer_id' => $customers[3]->id,
'type' => \App\Enums\ContractType::LEASE->value,
'start_date' => '2025-01-05',
'end_date' => '2026-01-05',
'status' => \App\Enums\ContractStatus::EXPIRED->value,
'signed_status' => 'Đã ký',
]);
$customerProduct1 = \App\Models\CustomerProduct::where('customer_id', $customers[0]->id)->where('product_id', $products[0]->id)->first();
$customerProduct2 = \App\Models\CustomerProduct::where('customer_id', $customers[0]->id)->where('product_id', $products[1]->id)->first();
$customerProduct3 = \App\Models\CustomerProduct::where('customer_id', $customers[1]->id)->where('product_id', $products[0]->id)->first();
\App\Models\Handover::create([
'product_id' => $products[0]->id,
'customer_id' => $customers[0]->id,
'handover_date' => '2024-02-15',
'status' => \App\Enums\HandoverStatus::HANDED_OVER->value,
'remark' => 'Đã bàn giao đầy đủ chìa khóa và thẻ căn hộ.',
]);
\App\Models\Handover::create([
'product_id' => $products[0]->id,
'customer_id' => $customers[1]->id,
'handover_date' => '2024-04-20',
'status' => \App\Enums\HandoverStatus::HANDED_OVER->value,
'remark' => 'Đã bàn giao, còn thiếu sổ bảo hành nội thất.',
]);
\App\Models\Handover::create([
'product_id' => $products[1]->id,
'customer_id' => $customers[0]->id,
'status' => \App\Enums\HandoverStatus::READY->value,
'remark' => 'Căn hộ đã hoàn thiện, chờ khách xác nhận lịch bàn giao.',
]);
\App\Models\Handover::create([
'product_id' => $products[2]->id,
'customer_id' => $customers[2]->id,
'handover_date' => '2024-10-01',
'status' => \App\Enums\HandoverStatus::SCHEDULED->value,
'remark' => 'Đã hẹn lịch 10h sáng ngày 01/10/2024.',
]);
\App\Models\Handover::create([
'product_id' => $products[1]->id,
'customer_id' => $customers[3]->id,
'status' => \App\Enums\HandoverStatus::NOT_READY->value,
'remark' => 'Đang hoàn thiện nội thất, dự kiến đủ điều kiện sau 2 tuần.',
]);
\App\Models\ProductService::create([
'product_id' => $products[0]->id,
'service_type' => \App\Enums\ServiceType::MANAGEMENT_FEE->value,
'status' => 'active',
'actual_collection_date' => '2024-03-01',
'remark' => 'Phí quản lý hàng tháng 5.000.000 VND.',
]);
\App\Models\ProductService::create([
'product_id' => $products[0]->id,
'service_type' => \App\Enums\ServiceType::GRATITUDE->value,
'status' => 'completed',
'actual_collection_date' => '2024-06-15',
'remark' => 'Quà tri ân khách hàng dịp sinh nhật BQL.',
]);
\App\Models\ProductService::create([
'product_id' => $products[1]->id,
'service_type' => \App\Enums\ServiceType::MANAGEMENT_FEE->value,
'status' => 'pending',
'remark' => 'Chưa thu phí quản lý quý 1/2025.',
]);
\App\Models\ProductService::create([
'product_id' => $products[2]->id,
'service_type' => \App\Enums\ServiceType::SELF_BUSINESS->value,
'status' => 'active',
'actual_collection_date' => '2024-10-01',
'remark' => 'Dịch vụ cho thuê hồ bơi và BBQ khu Villa.',
]);
\App\Models\ProductService::create([
'product_id' => $products[1]->id,
'service_type' => \App\Enums\ServiceType::GRATITUDE->value,
'status' => 'cancelled',
'remark' => 'KH từ chối nhận quà, chuyển sang đợt sau.',
]);
$feedbacks = [
[
'customer_id' => $customers[0]->id,
'customer_product_id' => $customerProduct1->id,
'contract_id' => $contract1->id,
'feedback_channel_id' => $channels->firstWhere('slug', 'email')->id,
'title' => 'Leaking ceiling in living room',
'content' => 'I noticed water stains on the ceiling of the living room after heavy rain. Please send someone to inspect and fix.',
@@ -112,6 +237,7 @@ class AfterSalesSeeder extends Seeder
[
'customer_id' => $customers[0]->id,
'customer_product_id' => $customerProduct2->id,
'contract_id' => $contract2->id,
'feedback_channel_id' => $channels->firstWhere('slug', 'phone')->id,
'title' => 'Request for parking slot upgrade',
'content' => 'I would like to upgrade from one parking slot to two. Please advise on availability and pricing.',
@@ -122,6 +248,7 @@ class AfterSalesSeeder extends Seeder
[
'customer_id' => $customers[1]->id,
'customer_product_id' => $customerProduct3->id,
'contract_id' => $contract3->id,
'feedback_channel_id' => $channels->firstWhere('slug', 'zalo')->id,
'title' => 'AC not cooling properly',
'content' => 'The air conditioner in the master bedroom is making loud noises and not cooling effectively.',
@@ -132,6 +259,7 @@ class AfterSalesSeeder extends Seeder
[
'customer_id' => $customers[2]->id,
'customer_product_id' => null,
'contract_id' => null,
'feedback_channel_id' => $channels->firstWhere('slug', 'document')->id,
'title' => 'General feedback on community services',
'content' => 'I suggest improving the garbage collection schedule to twice a day instead of once. Also, the security guard shift changes could be more organized.',
@@ -142,6 +270,7 @@ class AfterSalesSeeder extends Seeder
[
'customer_id' => $customers[3]->id,
'customer_product_id' => \App\Models\CustomerProduct::where('customer_id', $customers[3]->id)->where('product_id', $products[1]->id)->first()->id,
'contract_id' => $contract5->id,
'feedback_channel_id' => $channels->firstWhere('slug', 'email')->id,
'title' => 'Kitchen cabinet hinge broken',
'content' => 'One of the kitchen cabinet hinges is broken. It is still under warranty, please arrange replacement.',