Some Changes

This commit is contained in:
2023-12-21 16:05:13 +01:00
parent e792ed39c9
commit 537896503f
7 changed files with 356 additions and 60 deletions

View File

@@ -32,6 +32,7 @@ export const useDataStore = defineStore('data', {
products: [] as any[],
movements: [] as any[],
forms: [] as any[],
contracts: [] as any[],
jobs: [] as any[],
formSubmits: [] as any[],
contacts: [] as any[],
@@ -52,6 +53,7 @@ export const useDataStore = defineStore('data', {
await this.fetchCustomers()
await this.fetchContracts()
await this.fetchForms()
await this.fetchFormSubmits()
await this.fetchProducts()
@@ -77,6 +79,10 @@ export const useDataStore = defineStore('data', {
// @ts-ignore
this.events = (await supabase.from("events").select()).data
},
async fetchContracts() {
// @ts-ignore
this.contracts = (await supabase.from("contracts").select()).data
},
async fetchCustomers() {
// @ts-ignore
this.customers = (await supabase.from("customers").select().order('customerNumber', {ascending: true})).data
@@ -160,6 +166,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),
getContractById: (state) => (itemId:number) => state.contracts.find(item => item.id === itemId),
getDocumentById: (state) => (itemId:number) => state.documents.find(item => item.id === itemId),
getSpaceById: (state) => (itemId:number) => state.spaces.find(item => item.id === itemId),
getProjectById: (state) => (projectId:number) => {
let project = state.projects.find(project => project.id === projectId)