nang cap san sang import
This commit is contained in:
66
PROGRESS.md
66
PROGRESS.md
@@ -1,9 +1,10 @@
|
||||
# AfterSales CRM - Tiến độ
|
||||
|
||||
## Trạng thái: Hoàn thành SOP — 8 giai đoạn + bug fix + polish
|
||||
## Trạng thái: Hoàn thành SOP + 6/7 AI Instructions (85%)
|
||||
|
||||
Đã test: Tất cả routes HTTP 200, Pest 8/8 tests (21 assertions) pass ✓
|
||||
Tham chiếu: `SOP_des.md` — Bản đặc tả hệ thống After-Sale CRM
|
||||
**Data import:** `php artisan app:import-cskh ai_instructions/CSKH.xlsx` — 3658 rows imported successfully
|
||||
|
||||
## Công nghệ
|
||||
- Laravel 13.6.0 + Filament 5.6.1 + SQLite
|
||||
@@ -80,9 +81,54 @@ Tham chiếu: `SOP_des.md` — Bản đặc tả hệ thống After-Sale CRM
|
||||
- [x] Docker sẵn sàng production: Dockerfile, docker-compose, entrypoint
|
||||
- [x] Migration `notifications` table
|
||||
|
||||
### AI Instructions — Phase A: Module Hợp đồng (Contract)
|
||||
- [x] Migration `contracts`: product_id, customer_id, type (sale/lease/bcc), dates, status, signed_status
|
||||
- [x] Enum `ContractType` (SALE/LEASE/BCC) + `ContractStatus` (ACTIVE/EXPIRED/LIQUIDATED)
|
||||
- [x] Model `Contract`: relationships product(), customer(), feedbacks()
|
||||
- [x] Filament Resource `Contracts` (CRUD) + `ContractPolicy`
|
||||
- [x] RelationManager `ContractsRelationManager` trên ProductResource
|
||||
- [x] Model `Product` thêm `contracts()` HasMany
|
||||
- [x] Seeder: 5 contracts mẫu
|
||||
|
||||
### AI Instructions — Phase B: Snapshot Hợp đồng
|
||||
- [x] Migration thêm `contract_id` FK nullable vào `feedback`
|
||||
- [x] Model `Feedback`: thêm `contract_id` fillable + `contract()` BelongsTo
|
||||
- [x] FeedbackForm: auto-select active contract khi chọn sản phẩm, cho phép chọn lại thủ công
|
||||
- [x] FeedbackTable: cột "Contract" hiển thị loại HĐ dạng badge
|
||||
- [x] Seeder: gán contract_id cho 5 feedback mẫu
|
||||
|
||||
### AI Instructions — Phase C: Module Bàn giao (Handover)
|
||||
- [x] Migration `handovers`: product_id, customer_id, handover_date, status, remark
|
||||
- [x] Enum `HandoverStatus` (NOT_READY/READY/SCHEDULED/HANDED_OVER)
|
||||
- [x] Model `Handover`: relationships product(), customer()
|
||||
- [x] RelationManager `HandoversRelationManager` trên ProductResource
|
||||
- [x] Model `Product` thêm `handovers()` HasMany
|
||||
- [x] Seeder: 5 handovers mẫu
|
||||
|
||||
### AI Instructions — Phase D: Module Dịch vụ (ProductService)
|
||||
- [x] Migration `product_services`: product_id, service_type, status, actual_collection_date, remark
|
||||
- [x] Enum `ServiceType` (MANAGEMENT_FEE/GRATITUDE/SELF_BUSINESS)
|
||||
- [x] Model `ProductService`: relationship product()
|
||||
- [x] RelationManager `ProductServicesRelationManager` trên ProductResource
|
||||
- [x] Model `Product` thêm `productServices()` HasMany
|
||||
- [x] Seeder: 5 services mẫu
|
||||
|
||||
### AI Instructions — Phase E: Enhancement ProductResource
|
||||
- [x] ProductResource có 3 tabs: Contracts + Handovers + Services
|
||||
|
||||
### AI Instructions — Phase G: Data Import Pipeline
|
||||
- [x] Cài `spatie/simple-excel` (Lazy Collection, chống OOM)
|
||||
- [x] Command `app:import-cskh {file_path} --dry-run` với ProgressBar
|
||||
- [x] Pipeline: Product/Customer firstOrCreate → customer_product pivot → Contract → Handover → Service → Feedback + Interactions
|
||||
- [x] Xử lý DateTimeImmutable object từ Excel, skip meta rows
|
||||
- [x] Đã test thành công với CSKH.xlsx: 3658 rows → 3299 products, 2089 customers, 2637 contracts, 2077 handovers, 159 services, 71 feedbacks, 226 interactions
|
||||
|
||||
### Còn lại (Optional)
|
||||
- [ ] Auto-suggest chuyển phòng ban dựa trên loại hợp đồng (Ticket BCC → gợi ý Pháp lý)
|
||||
|
||||
---
|
||||
|
||||
## Database Schema (final)
|
||||
## Database Schema (final — 23 migrations)
|
||||
```
|
||||
products customers customer_product (pivot)
|
||||
feedback_channels feedback feedback_interactions
|
||||
@@ -90,14 +136,16 @@ feedback_attachments feedback_tags feedback_feedback_tag (pivot)
|
||||
users departments ticket_transfer_logs
|
||||
permissions roles model_has_roles (spatie)
|
||||
notifications sessions cache
|
||||
contracts handovers product_services
|
||||
```
|
||||
|
||||
## Docker Deployment
|
||||
## Data Import
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# Edit .env: set APP_URL, optional: switch to MySQL
|
||||
docker compose up -d --build
|
||||
# Open http://localhost:8080/admin
|
||||
# Dry-run (phân tích trước, an toàn)
|
||||
php artisan app:import-cskh ai_instructions/CSKH.xlsx --dry-run
|
||||
|
||||
# Import thật
|
||||
php artisan app:import-cskh ai_instructions/CSKH.xlsx
|
||||
```
|
||||
|
||||
## Local Dev
|
||||
@@ -110,4 +158,6 @@ php artisan test # 8 tests (21 assertions)
|
||||
```
|
||||
|
||||
## Hướng dẫn cho AI Agent khác
|
||||
Xem `AGENTS.md` - chứa đầy đủ cấu trúc thư mục, schema, namespace patterns, workflow, RBAC.
|
||||
- `CODEBASE_SNAPSHOT.md` — Toàn bộ cấu trúc codebase (đọc thay vì scan code)
|
||||
- `TASKS_ROADMAP.md` — Roadmap: đã làm, đang làm, sẽ làm
|
||||
- `AGENTS.md` — Hướng dẫn chạy, workflow, RBAC, gotchas
|
||||
|
||||
Reference in New Issue
Block a user