Many Changes

This commit is contained in:
2023-12-15 20:48:47 +01:00
parent 0590fa0875
commit b9772def05
13 changed files with 530 additions and 93 deletions

View File

@@ -32,6 +32,8 @@ export const useDataStore = defineStore('data', {
formSubmits: [] as any[],
contacts: [] as any[],
vehicles: [] as any[],
vendors: [] as any[],
vendorInvoices: [] as any[]
}),
actions: {
async fetchData() {
@@ -54,6 +56,8 @@ export const useDataStore = defineStore('data', {
await this.fetchMovements()
await this.fetchSpaces()
await this.fetchVehicles()
await this.fetchVendors()
await this.fetchVendorInvoices()
},
async fetchOwnTenant() {
@@ -117,6 +121,14 @@ export const useDataStore = defineStore('data', {
// @ts-ignore
this.jobs = (await supabase.from("jobs").select()).data
},
async fetchVendors() {
// @ts-ignore
this.vendors = (await supabase.from("vendors").select()).data
},
async fetchVendorInvoices() {
// @ts-ignore
this.vendorInvoices = (await supabase.from("vendorinvoices").select()).data
},
async fetchDocuments() {
// @ts-ignore
this.documents = (await supabase.from("documents").select()).data
@@ -142,6 +154,8 @@ export const useDataStore = defineStore('data', {
},
getProductById: (state) => (productId:number) => state.products.find(product => product.id === productId),
getVendorById: (state) => (itemId:number) => state.vendors.find(item => item.id === itemId),
getVendorInvoiceById: (state) => (itemId:number) => state.vendorInvoices.find(item => item.id === itemId),
getProjectById: (state) => (projectId:number) => {
let project = state.projects.find(project => project.id === projectId)