This commit is contained in:
2024-02-21 16:38:48 +01:00
parent 6e2e419a1c
commit ddb3b90788
13 changed files with 409 additions and 34 deletions

View File

@@ -164,6 +164,7 @@ export const useDataStore = defineStore('data', () => {
const phasesTemplates = ref([])
const emailAccounts = ref([])
const texttemplates =ref([])
const services =ref([])
const rights = ref({
@@ -279,6 +280,7 @@ export const useDataStore = defineStore('data', () => {
await fetchPhasesTemplates()
await fetchEmailAccounts()
await fetchTextTemplates()
await fetchServices()
loaded.value = true
}
@@ -321,6 +323,7 @@ export const useDataStore = defineStore('data', () => {
phasesTemplates.value = []
emailAccounts.value = []
texttemplates.value = []
services.value = []
}
function hasRight (right) {
@@ -600,6 +603,10 @@ export const useDataStore = defineStore('data', () => {
texttemplates.value = (await supabase.from("textTemplates").select().eq('tenant', currentTenant.value)).data
}
async function fetchServices() {
services.value = (await supabase.from("services").select().eq('tenant', currentTenant.value)).data
}
async function fetchDocuments () {
let tempDocuments = (await supabase.from("documents").select().eq('tenant', currentTenant.value)).data
@@ -915,6 +922,10 @@ export const useDataStore = defineStore('data', () => {
return products.value.find(item => item.id === itemId)
})
const getServiceById = computed(() => (itemId) => {
return services.value.find(item => item.id === itemId)
})
const getVendorById = computed(() => (itemId) => {
return vendors.value.find(item => item.id === itemId)
})
@@ -1041,6 +1052,7 @@ export const useDataStore = defineStore('data', () => {
phasesTemplates,
emailAccounts,
texttemplates,
services,
documentTypesForCreation,
//Functions
@@ -1112,6 +1124,7 @@ export const useDataStore = defineStore('data', () => {
getEventsByResource,
getCostCentresComposed,
getProductById,
getServiceById,
getVendorById,
getIncomingInvoiceById,
getContractById,