pos changes

This commit is contained in:
2026-08-06 19:26:53 +05:30
parent cb065a0f69
commit eebd10da6d
42 changed files with 3451 additions and 2531 deletions

View File

@@ -9,6 +9,7 @@ import '../local/staff_dao.dart';
import '../local/sync_config_store.dart';
import '../local/sync_log_dao.dart';
import '../local/terminal_identity.dart';
import '../local/void_pin_store.dart';
/// Terminal-side storage facade.
///
@@ -28,6 +29,7 @@ class LocalStore {
late PromoDao promos;
late SyncConfigStore syncConfig;
late TerminalIdentityStore identityStore;
late VoidPinStore voidPin;
/// Who this till is. Minted on first run, then stable forever.
late TerminalIdentity terminal;
@@ -60,6 +62,7 @@ class LocalStore {
promos = PromoDao(AppDatabase.instance.db);
syncConfig = SyncConfigStore(catalogue);
identityStore = TerminalIdentityStore(catalogue);
voidPin = VoidPinStore(catalogue, staff);
// A terminal with no staff cannot be signed into at all, so this runs
// before anything else can ask who is on shift.
@@ -148,9 +151,13 @@ class LocalStore {
/// Drops the imported catalogue from disk and from the in-memory cache.
///
/// Called at sign-out so the next shift never bills against a copy left
/// over from this one — [hasCatalogue] goes back to false, and the only way
/// to sell again is a fresh pull from the back office.
/// Called when a *cashier* signs out, so the next shift never bills against
/// a copy left over from this one — [hasCatalogue] goes back to false, and
/// the only way to sell again is a fresh pull from the back office.
///
/// Not called on an admin sign-out. An admin's whole job at this terminal is
/// to pull the catalogue and hand the till over, so wiping it on the way out
/// would undo the thing they just did.
Future<void> clearCatalogue() async {
await catalogue.clearCatalogue();
_products.clear();