d.6
This commit is contained in:
127
plans/task-d.6.1.md
Normal file
127
plans/task-d.6.1.md
Normal file
@@ -0,0 +1,127 @@
|
||||
# Task D.6.1 – Lead Create Form UX & Default Rules
|
||||
|
||||
## Objective
|
||||
|
||||
ปรับหน้า Create Lead ให้เหมาะกับการสร้าง Lead ใหม่จริง โดยซ่อน field ที่ยังไม่ควรใช้ตอนเริ่มต้น และตั้งค่า default ตาม business rule
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
### 1. Hide fields on Create Lead
|
||||
|
||||
ตอนสร้าง Lead ใหม่ ไม่ต้องแสดง field ต่อไปนี้:
|
||||
|
||||
* Lost Reason
|
||||
* Status
|
||||
* Marketing Owner
|
||||
|
||||
Field เหล่านี้อาจแสดงในหน้า Edit/Detail ตาม permission และสถานะภายหลังได้
|
||||
|
||||
---
|
||||
|
||||
### 2. Default Lead Status
|
||||
|
||||
เมื่อสร้าง Lead ใหม่ ให้ระบบตั้งสถานะอัตโนมัติเป็น:
|
||||
|
||||
```text
|
||||
new_job
|
||||
```
|
||||
|
||||
หรือ label:
|
||||
|
||||
```text
|
||||
New Job
|
||||
```
|
||||
|
||||
User ไม่ต้องเลือกเองในหน้า Create
|
||||
|
||||
---
|
||||
|
||||
### 3. Default Marketing Owner
|
||||
|
||||
Marketing Owner ต้อง default เป็นผู้สร้างเอกสาร
|
||||
|
||||
```text
|
||||
marketingOwnerId = currentUser.id
|
||||
```
|
||||
|
||||
ไม่ต้องให้ user เลือกตอน Create
|
||||
|
||||
---
|
||||
|
||||
### 4. Add Lead Source field
|
||||
|
||||
เพิ่ม field:
|
||||
|
||||
```text
|
||||
Lead Source
|
||||
```
|
||||
|
||||
ใช้เก็บที่มาของ Lead เช่น:
|
||||
|
||||
* Website
|
||||
* Facebook
|
||||
* Line OA
|
||||
* Phone Call
|
||||
* Walk-in
|
||||
* Referral
|
||||
* Existing Customer
|
||||
* Exhibition
|
||||
* Sales Visit
|
||||
* Other
|
||||
|
||||
ควรใช้ master option / ms_options ถ้ามี foundation รองรับอยู่แล้ว
|
||||
|
||||
---
|
||||
|
||||
## Create vs Edit Behavior
|
||||
|
||||
### Create Lead
|
||||
|
||||
แสดงเฉพาะ field ที่จำเป็นสำหรับเปิด Lead ใหม่
|
||||
|
||||
ไม่แสดง:
|
||||
|
||||
* Lost Reason
|
||||
* Status
|
||||
* Marketing Owner
|
||||
|
||||
ระบบกำหนดให้อัตโนมัติ
|
||||
|
||||
---
|
||||
|
||||
### Edit Lead / Detail Lead
|
||||
|
||||
สามารถแสดง field เพิ่มเติมตามสถานะและ permission เช่น:
|
||||
|
||||
* Status
|
||||
* Lost Reason เมื่อ status เป็น lost/closed lost
|
||||
* Marketing Owner สำหรับ admin/manager ถ้าต้อง reassign
|
||||
|
||||
---
|
||||
|
||||
## Backend Rules
|
||||
|
||||
ฝั่ง API/service ต้อง enforce ด้วย ไม่พึ่ง UI อย่างเดียว:
|
||||
|
||||
* ถ้า create lead ไม่มี status → set `new_job`
|
||||
* ถ้า create lead ไม่มี marketingOwnerId → set current user
|
||||
* ห้าม user override marketingOwnerId ถ้าไม่มี permission
|
||||
* Lost Reason ต้องไม่ required ตอน create
|
||||
* Lead Source ควรถูก validate จาก master option
|
||||
|
||||
---
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
* Create Lead ไม่แสดง Lost Reason
|
||||
* Create Lead ไม่แสดง Status
|
||||
* Create Lead ไม่แสดง Marketing Owner
|
||||
* Lead ใหม่ถูกสร้างด้วย status `New Job`
|
||||
* Marketing Owner เป็น user ที่สร้าง Lead
|
||||
* มี field Lead Source
|
||||
* Lead Source บันทึกได้ถูกต้อง
|
||||
* Edit/Detail ยังรองรับ status/lost reason ตาม business rule
|
||||
* `npm run typecheck`
|
||||
* `npm run build`
|
||||
Reference in New Issue
Block a user