Appearance
Report Module
Mục đích
Module báo cáo là lớp read-only tổng hợp cho toàn bộ dữ liệu vận hành của Diva: doanh thu, customer, inventory, KPI, hotline, commission, affiliate, complaint, vi phạm. Đây là nơi "nhìn vào hệ thống" thay vì "ghi dữ liệu vào hệ thống".
Quy mô
- 46 FE pages
- 171 FE components
- 26 GraphQL files / 99 operations
- 1 module navigation, nhiều drill-down routes
Actors & Permissions
| Actor | Cách cấp quyền | Scope |
|---|---|---|
Users có reportRoles | Menu cards được build từ globalStore.reportRoles | Theo report group được cấp |
| FE route config | permissions: [] cho toàn bộ report routes | Không chặn ở FE layer |
| Data access | Chủ yếu qua Hasura roles / backend actions | Branch / role scoped |
Ghi chú: report module có route public trong FE theo nghĩa "không bị route guard block", nhưng dữ liệu thực tế vẫn phụ thuộc role và query scope phía backend.
Feature Groups
| Group lớn | Mô tả | Ví dụ pages | Docs |
|---|---|---|---|
| Sales & Revenue | Theo dõi doanh thu, debt, actual revenue, employee revenue, fund | RevenueReport, DebtReport, ActualRevenueReport, FundReport | Business · Technical |
| Customer & CRM | Customer report, cycle, telesales, hotline, complaint, affiliate | CustomerReport, CustomerCycleReport, HotlineReport, ComplaintReport | Customer Analytics · Call Center Quality |
| Service & Operations | Service group, service detail, appointment, annual leave, task, KPI | ServiceReportTab, AppointmentReport, TaskReport, KPIReport | Business · Technical |
| Product & Inventory | Product, prepaid card, inventory, rank | ProductReport, PrepaidCardReport, InventoryReport, RankReport | Business · Technical |
| Marketing & Referral | Campaign, SMS/marketing, app introduction, customer affiliate | CampaignReport, MarketingReport, AppIntroductionReport, CustomerAffiliateReport | Business · Technical |
Liên kết Modules
- ecommerce — nguồn dữ liệu chính cho sales, order, service, product, campaign, inventory
- wallet — commission, fund, payment-related metrics
- crm — hotline, ticket, complaint, customer cycle
- user — branch, staff, department, customer dimensions
- projects — task, tour income, rating/feedback
- affiliate — affiliate report và customer affiliate drill-down
Backend Services
| Service | Vai trò |
|---|---|
| controller (Hasura) | Query trực tiếp các report_*, dashboard_*, view/tables |
| ecommerce-api | Custom actions cho customer cycle, sales revenue, affiliate, report popup |
| export-api | Scheduler / export file cho một số báo cáo offline |
Databases
| DB | Key tables/views |
|---|---|
| ecommerce | report_customer, report_sales_result, report_service_result, report_order_commission, report_prepaid_card_result, dashboard_* |
| crm | incall_call, incall_call_log, ticket, ticket_history_log |
| wallet | commission / fund / transaction related views |
| project | task feedback và employee revenue phụ trợ |
Đặc điểm kiến trúc
- Trang root
Reports.tsxkhông hard-code danh sách card; nó groupglobalStore.reportRolestheoreport.group_id. - Nhiều báo cáo có 2 lớp route: group -> detail / popup / drill-down customer.
- Report module gần như không có mutation nghiệp vụ; ngoại lệ đáng chú ý là
TourIncomeReportvẫn có inline edit trên project task data. ReportCardcó fallback icon mặc định nếu icon theo group không tồn tại.