Skip to content

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

ActorCách cấp quyềnScope
Users có reportRolesMenu cards được build từ globalStore.reportRolesTheo report group được cấp
FE route configpermissions: [] cho toàn bộ report routesKhông chặn ở FE layer
Data accessChủ yếu qua Hasura roles / backend actionsBranch / 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ớnMô tảVí dụ pagesDocs
Sales & RevenueTheo dõi doanh thu, debt, actual revenue, employee revenue, fundRevenueReport, DebtReport, ActualRevenueReport, FundReportBusiness · Technical
Customer & CRMCustomer report, cycle, telesales, hotline, complaint, affiliateCustomerReport, CustomerCycleReport, HotlineReport, ComplaintReportCustomer Analytics · Call Center Quality
Service & OperationsService group, service detail, appointment, annual leave, task, KPIServiceReportTab, AppointmentReport, TaskReport, KPIReportBusiness · Technical
Product & InventoryProduct, prepaid card, inventory, rankProductReport, PrepaidCardReport, InventoryReport, RankReportBusiness · Technical
Marketing & ReferralCampaign, SMS/marketing, app introduction, customer affiliateCampaignReport, MarketingReport, AppIntroductionReport, CustomerAffiliateReportBusiness · 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

ServiceVai trò
controller (Hasura)Query trực tiếp các report_*, dashboard_*, view/tables
ecommerce-apiCustom actions cho customer cycle, sales revenue, affiliate, report popup
export-apiScheduler / export file cho một số báo cáo offline

Databases

DBKey tables/views
ecommercereport_customer, report_sales_result, report_service_result, report_order_commission, report_prepaid_card_result, dashboard_*
crmincall_call, incall_call_log, ticket, ticket_history_log
walletcommission / fund / transaction related views
projecttask feedback và employee revenue phụ trợ

Đặc điểm kiến trúc

  • Trang root Reports.tsx không hard-code danh sách card; nó group globalStore.reportRoles theo report.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à TourIncomeReport vẫn có inline edit trên project task data.
  • ReportCard có fallback icon mặc định nếu icon theo group không tồn tại.

Domain Docs