import Dexie from 'dexie'; export const db = new Dexie('BukidBountyPOS'); db.version(1).stores({ // products: hashkey(primary), name, category, barcode, price, available products: 'hashkey, name, category, barcode, price', // customers: hashkey(primary), name, phone customers: 'hashkey, name, phone', // pending_transactions: id(auto increment), store_hash, customer_name, items(JSON), total, received, change, timestamp, status pending_transactions: '++id, store_hash, customer_name, timestamp, status', // settings: key(primary), value settings: 'key' }); // Helper to save basic settings export async function setOfflineSetting(key, value) { return await db.settings.put({ key, value }); } export async function getOfflineSetting(key) { const result = await db.settings.get(key); return result ? result.value : null; }