MmenuMmenu Docs
Theo module1. Giới thiệu3. Local Hive domain flags

3. Local Hive domain flags

Map từng flag local Hive với màn hình, locale user thấy và luồng bị ảnh hưởng.

Tài liệu này dùng cho dev, QA và support khi cần biết bật/tắt từng flag local Hive sẽ ảnh hưởng màn hình nào trong Mmenu Admin.

Tất cả domain flag bên dưới chỉ có hiệu lực khi usingHive cũng bật và device được phép chạy Hive (enableHiveForMmenuDevice hoặc non-MMENU device). Nếu flag tắt hoặc flag chưa sync được, app fallback về API/remote path.

Source chính

  • lib/src/masterDataManagement/hive_restaurant_admin_flag/hive_restaurant_admin_flag_service.dart
  • lib/src/localHiveRepository/local_transaction_data_gate/local_transaction_data_gate.dart
  • lib/src/localHiveRepository/local_transaction_data_gate/README.md

Bảng ảnh hưởng

FlagTên tiếng ViệtPage/Widget chínhLocale/user thấyLuồng ảnh hưởngBật thì saoTắt thì sao
usingLocalHiveForOrderĐơn hàng / bàn đang phục vụNewOrderPage, ManagementOrderTableTabViewV4, CurrentOrdersForSingleTableV2, InServingTabViewLocaleKeys.orderManagement = QL Order, LocaleKeys.tableMap = Sơ đồ bàn, LocaleKeys.inServing = Đang phục vụ, LocaleKeys.tableName = Tên bàn, LocaleKeys.orderMore = Thêm sản phẩmĐọc bàn, order session/order detail, đơn đang phục vụ, quick view/payment order data từ local transaction Hive. Realtime order còn cần SSE connected, kitchenTimestamp, full sync order_sessions + order_details, và dữ liệu không stale quá 1 phút.Page order có thể đọc local Hive khi dữ liệu transaction đủ tươi. Local change bus có thể làm Bloc fetch lại và emit state mới.Bỏ qua local transaction Hive, fallback API/remote. Subscription local order sẽ ignore theo domain.
usingLocalHiveForKdsBếp / KDSKitchenBarTabletMasterPage, KitchenBarTabletMasterPageV3, KitchenBarOrderTabletTabBloc, KitchenBarWaitingDishV2BlocLocaleKeys.kitchenBar = Bếp/Bar, LocaleKeys.dishByOrder = Order, LocaleKeys.dishWaitingForCook = Theo mónBếp tablet/KDS đọc order session có món xác nhận, dish order theo bếp, tổng số món, lịch sử đã nấu/trả/đã phục vụ, món đã xong, thông báo bếp, KDS group by product. Mutation KDS sau backend success mirror local Hive.KDS có thể đọc/mirror local Hive theo usingHive && usingLocalHiveForKds. Luồng mutation KDS không chờ readiness transaction để tránh request và local mutation lệch decision.KDS đọc API như cũ. Runtime local mutation bỏ qua, không tự sửa local Hive.
usingLocalHiveForMenuThực đơn / món / danh mục mónManageMenuHomePage, ManageDishBloc, ManageDishCategoryBloc, create/update dish dialogs, menu simple/order-more flowLocaleKeys.menuManagement = QL Thực đơn, LocaleKeys.listOfDishes = Danh mục, LocaleKeys.nameOfDish = Tên sản phẩm, LocaleKeys.dish = MónĐọc menu/dish/dish category từ local Hive. Một số helper linked parent dish vẫn có rule riêng theo dữ liệu Hive và có thể không gate trực tiếp bằng flag này.Màn quản lý menu và các luồng chọn món có thể lấy dữ liệu menu/category từ local Hive.Fallback API/remote cho menu/category. Local menu subscription theo domain bị bỏ qua.
usingLocalHiveForMasterDataDữ liệu nhà hàng / cấu hình chungRestaurant/master data runtime repositories, flag report dialogLocaleKeys.restaurantSettings = Cài đặt nhà hàngĐọc restaurant data và restaurant flag/master data phụ trợ từ local Hive. Đây là nhóm nền cho các cấu hình nhà hàng, không phải một màn hình đơn lẻ.Runtime có thể lấy restaurant/flag data từ local Hive nếu đã sync.Fallback API/remote cho restaurant/master data.
usingLocalHiveForPaymentAndPromotionThanh toán / khuyến mãiPaymentMethodPage, PaymentMethodPageV4, quick view checkout, payment dialogs, ManagePromotionDisplay, promotion detail pagesLocaleKeys.paymentMethod = Hình thức thanh toán, LocaleKeys.paymentMethods = PTTT, LocaleKeys.promotionV2 = Chương trình khuyến mại, LocaleKeys.promotionManagement = Quản lý khuyến mại, LocaleKeys.promotionDetail = Chi tiêt chương trìnhĐọc payment methods và promotion/voucher/discount data từ local Hive. Ảnh hưởng chọn PTTT, áp khuyến mãi trong thanh toán, và màn quản lý khuyến mãi.Payment/promotion repository thử local Hive trước, sau đó mới fallback nếu local chưa sẵn sàng.Thanh toán/khuyến mãi đọc API/remote. Không dùng snapshot local Hive cho domain này.
usingLocalHiveForEmployeePrintServingNhân viên / in ấn / bàn phục vụManageEmployeeMasterPage, employee detail/create/update dialogs, department/schedule tabs, printer dialogs/settings, serving-table local runtimeLocaleKeys.employeeManagement = QL nhân viên, LocaleKeys.manageDepartment = QL Bộ phận, LocaleKeys.schedule = Lịch, LocaleKeys.printInvoice = In hóa đơn, LocaleKeys.choosePrinter = Chọn máy in, LocaleKeys.printerName = Tên máy inĐọc employee/department/position data, printer data và serving-table data từ local Hive khi repository tương ứng có runtime gate.Employee/printer/serving flows có thể dùng snapshot local Hive, giảm phụ thuộc API khi dữ liệu đã sync.Fallback API/remote. In ấn/employee/serving table không lấy dữ liệu local theo domain này.

Ghi chú khi bật/tắt

  • Bật domain flag không có nghĩa mọi page luôn đọc Hive. Runtime vẫn kiểm tra local repository đã đăng ký, dữ liệu đã sync, và gate riêng của từng domain.
  • usingLocalHiveForOrder nghiêm ngặt hơn KDS realtime: cần SSE và freshness transaction. KDS mutation chỉ dùng usingHive && usingLocalHiveForKds.
  • Page list ở trên là entrypoint dễ nhận diện cho user. Full call graph nằm ở runtime repository/gate vì nhiều page đi qua Bloc rồi mới tới repository.
  • Nếu user báo màn hình sai dữ liệu sau khi bật flag, kiểm tra trước: usingHive, domain flag, device allow Hive, metadata full sync, và API fallback có đang được gọi không.

On this page