เมนูเปิด/ปิดสถานะลูกค้าเป็น flow สิทธิ์แคบสำหรับอนุมัติ/ปฏิเสธคำขอลูกค้า และเปิดหรือปิดการใช้งานลูกค้าที่มีอยู่แล้ว สถานะนี้มีผลกับการเลือกลูกค้าใน flow ขาย
ทางเข้าในแอป
| App | Target |
|---|
| Mobile | customer activation flow ภายใต้หน้าลูกค้า/customer management |
| POS Terminal | customerActivation -> CustomerActivationDetailForm |
Workflow สถานะลูกค้า
Data และ API Rules
| Operation | Service |
|---|
| Request list | getCustomerActivationSplitList -> getCustomerSapList({ isRequest: true }) |
| Detail | getCustomerSapById(customerId) |
| Approve request | approveCustomerRequest(customerCode) |
| Reject request | rejectCustomerRequest(customerCode) |
| Toggle active state | updateCustomerStatus(customerCode, { status }) |
ปุ่มและเงื่อนไขการตัดสินใจ
| ปุ่ม | เงื่อนไข/ผลลัพธ์ |
|---|
| อนุมัติ/ปฏิเสธ | ต้องมีสิทธิ์และ customer code; การปฏิเสธไม่ใช่การลบ customer master |
| เปิด/ปิดสถานะ | เป็น endpoint แยกจากการอนุมัติคำขอ และมีผลต่อการเลือกลูกค้าในงานขาย |
| Refresh | ต้องทำทุกครั้ง เพราะ request และ active state เป็นข้อมูลจาก Server |
กฎธุรกิจ
| กฎ | รายละเอียด |
|---|
| สิทธิ์แคบ | เมนูนี้ใช้ deptCode แคบกว่า Customer Management |
| อนุมัติคำขอ | approve/reject request endpoint แยกจาก generic status update |
| ผลกับงานขาย | ลูกค้า inactive ควรถูก block จากการเปิดใบสั่งขาย/ใบจองใหม่ |
| ต้อง refresh | หลังเปลี่ยนสถานะต้อง refresh เพราะ downstream flow ใช้สถานะปัจจุบัน |
| Audit | approve/reject ควรเก็บ actor/time จาก server ไม่ควร fake status เฉพาะ local โดยไม่ refresh |
สิทธิ์และ guard
| เรื่อง | รายละเอียด |
|---|
| Terminal menu key | customerActivation |
| deptCode ที่เห็นเมนู | 2, 4, 7, 16, 29 |
| เงื่อนไขสาขา | จำกัดด้วย dept code และ customer list context ของ selected branch |
| Action user | เฉพาะผู้ใช้ที่เห็นเมนูนี้ควรเห็น queue/action เปิดปิดสถานะ |
Mobile vs POS Terminal
| เรื่อง | Mobile | POS Terminal |
|---|
| Navigation | entry ภายใต้ customer/customer-management flows | split-pane detail form |
| List | customer request/customer list | getCustomerActivationSplitList พร้อม isRequest=1 |
| Detail actions | approve/reject/status change ตามที่ expose | action ใน CustomerActivationDetailForm |
| หลัง action | refresh list/detail | refresh split list/detail |
Developer Handoff Map
| Area | Code |
|---|
| Terminal detail | apps/pos-terminal/src/screens/HomeScreen/CustomerActivationDetailForm.tsx |
| Customer service | apps/*/src/services/customers.ts |
| Terminal split data | apps/pos-terminal/src/services/splitMenuData.ts -> getCustomerActivationSplitList |
| Menu config | apps/pos-terminal/src/screens/HomeScreen/config.ts และ mobile menu config |
| Sales dependency | customer selection blocking ใน sales/booking flows |
เอกสารที่เกี่ยวข้อง