This commit is contained in:
2024-02-19 22:25:58 +01:00
parent d5c3034758
commit 6e2e419a1c
7 changed files with 121 additions and 27 deletions

View File

@@ -84,7 +84,7 @@ export const useDataStore = defineStore('data', () => {
label: "Dokumente",
labelSingle: "Dokument"
},
incomingInvoices: {
incominginvoices: {
label: "Eingangsrechnungen",
labelSingle: "Eingangsrechnung"
},
@@ -146,7 +146,7 @@ export const useDataStore = defineStore('data', () => {
const contacts = ref([])
const vehicles = ref([])
const vendors = ref([])
const incomingInvoices = ref([])
const incominginvoices = ref([])
const bankAccounts = ref([])
const bankStatements = ref([])
const historyItems = ref([])
@@ -303,7 +303,7 @@ export const useDataStore = defineStore('data', () => {
contacts.value= []
vehicles.value= []
vendors.value= []
incomingInvoices.value= []
incominginvoices.value= []
bankAccounts.value= []
bankStatements.value= []
historyItems.value = []
@@ -421,6 +421,7 @@ export const useDataStore = defineStore('data', () => {
const uploadFiles = async (formData, files, upsert) => {
console.log(files)
console.log(formData)
let documentsToInsert = []
const uploadSingleFile = async (file) => {
@@ -428,7 +429,7 @@ export const useDataStore = defineStore('data', () => {
const {data, error} = await supabase
.storage
.from("files")
.upload(`${currentTenant.value}/${file.name}`, file, {upsert})
.upload(`${currentTenant.value}/${file.name}`, file, {upsert: upsert})
if (error) {
console.log(error)
@@ -450,6 +451,8 @@ export const useDataStore = defineStore('data', () => {
documentsToInsert.push({...formData, path: returnPath})
}
console.log(data)
}
//uploadInProgress.value = true
@@ -548,7 +551,7 @@ export const useDataStore = defineStore('data', () => {
vendors.value = (await supabase.from("vendors").select().eq('tenant', currentTenant.value).order("vendorNumber", {ascending:true})).data
}
async function fetchIncomingInvoices () {
incomingInvoices.value = (await supabase.from("incominginvoices").select().eq('tenant', currentTenant.value)).data
incominginvoices.value = (await supabase.from("incominginvoices").select().eq('tenant', currentTenant.value)).data
}
async function fetchNumberRanges () {
numberRanges.value = (await supabase.from("numberranges").select().eq('tenant', currentTenant.value)).data
@@ -728,7 +731,7 @@ export const useDataStore = defineStore('data', () => {
})
const getIncomingInvoicesByVehicleId = computed(() => (vehicleId) => {
return incomingInvoices.value.filter(i => i.accounts.find(a => a.costCentre === vehicleId))
return incominginvoices.value.filter(i => i.accounts.find(a => a.costCentre === vehicleId))
})
const getMovementsBySpaceId = computed(() => (spaceId) => {
@@ -917,7 +920,7 @@ export const useDataStore = defineStore('data', () => {
})
const getIncomingInvoiceById = computed(() => (itemId) => {
return incomingInvoices.value.find(item => item.id === itemId)
return incominginvoices.value.find(item => item.id === itemId)
})
const getContractById = computed(() => (itemId) => {
@@ -1020,7 +1023,7 @@ export const useDataStore = defineStore('data', () => {
contacts,
vehicles,
vendors,
incomingInvoices,
incominginvoices,
bankAccounts,
bankStatements,
historyItems,