Added DayJS

Restructured Products
Some Changes in Documents
Some Changes with Logo
This commit is contained in:
2023-12-14 20:58:52 +01:00
parent 2dd31690e5
commit cd36514e1c
10 changed files with 426 additions and 248 deletions

View File

@@ -38,20 +38,23 @@ export const useDataStore = defineStore('data', {
await this.fetchOwnTenant()
await this.fetchProfiles()
await this.fetchEvents()
await this.fetchCustomers()
await this.fetchTasks()
await this.fetchProjects()
await this.fetchTimes()
await this.fetchJobs()
this.loaded = true
await this.fetchCustomers()
await this.fetchForms()
await this.fetchFormSubmits()
await this.fetchProducts()
await this.fetchUnits()
await this.fetchProjects()
await this.fetchDocuments()
//await this.fetchDocuments()
await this.fetchMovements()
await this.fetchTimes()
await this.fetchJobs()
await this.fetchSpaces()
await this.fetchVehicles()
this.loaded = true
},
async fetchOwnTenant() {
//TODO: Tenant ID Dynamisch machen
@@ -84,7 +87,7 @@ export const useDataStore = defineStore('data', {
},
async fetchProducts() {
// @ts-ignore
this.products = (await supabase.from("products").select()).data
this.products = (await supabase.from("products").select().order('id',{ascending: true})).data
},
async fetchUnits() {
// @ts-ignore
@@ -128,6 +131,16 @@ export const useDataStore = defineStore('data', {
getProfileById: (state) => (userUid:string) => state.profiles.find(profile => profile.id === userUid),
getOpenTasksCount: (state) => state.tasks.filter(task => task.categorie != "Erledigt").length,
movementsBySpace: (state) => (spaceId:number) => state.movements.filter(move => move.spaceId === spaceId),
getStockByProductId: (state) => (productId:number) => {
let movements = state.movements.filter((movement:any) => movement.productId === productId)
let count = 0
movements.forEach(movement => count += movement.quantity)
return count
},
getProductById: (state) => (productId:number) => state.products.find(product => product.id === productId),
getProjectById: (state) => (projectId:number) => {
let project = state.projects.find(project => project.id === projectId)