initial: bootstrap from BukidBountyApp base
This commit is contained in:
27
resources/js/db.js
Normal file
27
resources/js/db.js
Normal file
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user