Basic UI rework

This commit is contained in:
mcarquigny
2025-03-20 15:54:16 +01:00
parent 742da61016
commit 12086a4c88
28 changed files with 1259 additions and 24 deletions

49
src/store/core/actions.js Normal file
View File

@ -0,0 +1,49 @@
import { pb } from 'src/boot/pocketbase'
//
// export function loadAppData (store) {
// return Firebase.database().ref().once('value').then((snapshot) => {
// store.commit('setFirebaseState', snapshot.val())
// })
// }
//
export async function loadAppData (store) {
return Promise.all([
pb.collection('stock').getFullList(),
pb.collection('history').getFullList(),
pb.collection('categories').getFullList()
]).then(([stock, history, categories]) => {
return store.commit('setFirebaseState', {
stock,
history,
categories
})
})
}
// export function addToCollection (store, data) {
// return Firebase.database().ref('/' + data.collection).once('value').then((snapshot) => {
// let index = parseInt(Object.keys(snapshot.val()).reverse()[0]) + 1
// return Firebase.database().ref('/' + data.collection + '/' + index).set(data.data)
// })
// }
//
// export function removeFromCollection (store, data) {
// return Firebase.database().ref('/' + data.collection).once('value').then((snapshot) => {
// let index = snapshot.val().findIndex(item =>
// item.timestamp === data.data.timestamp && item.ref === data.data.ref
// )
// return Firebase.database().ref('/' + data.collection + '/' + index).remove()
// })
// }
//
// export function updateItem (store, data) {
// return Firebase.database().ref(`/${data.collection}/${data.itemId}`).set(data.data)
// }
//
// export function deleteItem (store, data) {
// return Firebase.database().ref(`/${data.collection}/${data.itemId}`).set(null)
// }
//
// export function uploadFile (store, file) {
// return Firebase.storage().ref().child(Date.now() + file.name).put(file)
// }