Cahnges
This commit is contained in:
@@ -11,7 +11,7 @@ export const useSupabaseSelect = async (relation,select = '*', sortColumn = null
|
||||
.from(relation)
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)
|
||||
.order(sortColumn, {ascending: true})).data
|
||||
.order(sortColumn, {ascending: ascending})).data
|
||||
} else {
|
||||
data = (await supabase
|
||||
.from(relation)
|
||||
@@ -22,7 +22,7 @@ export const useSupabaseSelect = async (relation,select = '*', sortColumn = null
|
||||
return data
|
||||
}
|
||||
|
||||
export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null) => {
|
||||
export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null, folderPath = "_") => {
|
||||
const supabase = useSupabaseClient()
|
||||
const dataStore = useDataStore()
|
||||
let data = null
|
||||
@@ -33,12 +33,15 @@ export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null
|
||||
.from("documents")
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)
|
||||
.eq("folderPath", folderPath)
|
||||
.order(sortColumn, {ascending: true})).data
|
||||
} else {
|
||||
data = (await supabase
|
||||
.from("documents")
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)).data
|
||||
.eq("tenant", dataStore.currentTenant)
|
||||
.eq("folderPath",folderPath)).data
|
||||
|
||||
}
|
||||
|
||||
if(data.length > 0){
|
||||
@@ -60,7 +63,7 @@ export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null
|
||||
|
||||
}
|
||||
|
||||
console.log(data)
|
||||
//console.log(data)
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
@@ -140,6 +140,24 @@ const saveSignature = async () => {
|
||||
contentSaved.value = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const addToNewsletter = async () => {
|
||||
const {data,error} = await axios({
|
||||
url: "https://newsletter.fedeo.io/api/public/subscription",
|
||||
method: "post",
|
||||
data: {
|
||||
email: dataStore.activeProfile.email,
|
||||
name: dataStore.activeProfile.name,
|
||||
list_uuids: ["b97453fd-14b2-4b25-8f9b-b83847317ea3"],
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -268,6 +286,16 @@ const saveSignature = async () => {
|
||||
@updateContent="contentChanged"
|
||||
:preloadedContent="emailSignature"
|
||||
/>
|
||||
|
||||
<UDivider>Newsletter</UDivider>
|
||||
|
||||
<UButton
|
||||
@click="addToNewsletter"
|
||||
variant="outline"
|
||||
>
|
||||
In Newsletter eintragen
|
||||
</UButton>
|
||||
|
||||
</div>
|
||||
<div v-if="item.label === 'Logbuch'">
|
||||
<HistoryDisplay
|
||||
|
||||
@@ -143,6 +143,11 @@ export const useDataStore = defineStore('data', () => {
|
||||
labelSingle: "Artikelkategorie",
|
||||
redirect: true
|
||||
},
|
||||
servicecategories: {
|
||||
label: "Leistungskategorie",
|
||||
labelSingle: "Leistungskategorien",
|
||||
redirect: true
|
||||
},
|
||||
trackingtrips: {
|
||||
label: "Fahrten",
|
||||
labelSingle: "Fahrt",
|
||||
@@ -157,6 +162,10 @@ export const useDataStore = defineStore('data', () => {
|
||||
labelSingle: "Rechnung",
|
||||
|
||||
},
|
||||
serialInvoices: {
|
||||
label: "Serienrechnungen",
|
||||
labelSingle: "Serienrechnung",
|
||||
},
|
||||
advanceInvoices: {
|
||||
label: "Abschlagsrechnungen",
|
||||
labelSingle: "Abschlagsrechnung"
|
||||
@@ -234,7 +243,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
const emailAccounts = ref([])
|
||||
const texttemplates =ref([])
|
||||
const services =ref([])
|
||||
const serviceCategories =ref([])
|
||||
const servicecategories =ref([])
|
||||
const resources =ref([])
|
||||
|
||||
|
||||
@@ -442,7 +451,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
emailAccounts.value = []
|
||||
texttemplates.value = []
|
||||
services.value = []
|
||||
serviceCategories.value = []
|
||||
servicecategories.value = []
|
||||
resources.value = []
|
||||
}
|
||||
|
||||
@@ -646,11 +655,11 @@ export const useDataStore = defineStore('data', () => {
|
||||
} else if(key === "customer") {
|
||||
name = "Kunde"
|
||||
if(prop.data.o) oldVal = customers.value.find(i => i.id === prop.data.o).name
|
||||
if(prop.data.o) newVal = customers.value.find(i => i.id === prop.data.n).name
|
||||
if(prop.data.n) newVal = customers.value.find(i => i.id === prop.data.n).name
|
||||
} else if(key === "vendor") {
|
||||
name = "Lieferant"
|
||||
if(prop.data.o) oldVal = vendors.value.find(i => i.id === prop.data.o).name
|
||||
if(prop.data.o) newVal = vendors.value.find(i => i.id === prop.data.n).name
|
||||
if(prop.data.n) newVal = vendors.value.find(i => i.id === prop.data.n).name
|
||||
|
||||
} else if(key === "description") {
|
||||
name = "Beschreibung"
|
||||
@@ -659,11 +668,11 @@ export const useDataStore = defineStore('data', () => {
|
||||
} else if(key === "profile") {
|
||||
name = "Mitarbeiter"
|
||||
if(prop.data.o) oldVal = profiles.value.find(i => i.id === prop.data.o).fullName
|
||||
if(prop.data.o) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
|
||||
if(prop.data.n) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
|
||||
} else if(key === "plant") {
|
||||
name = "Objekt"
|
||||
if(prop.data.o) oldVal = plants.value.find(i => i.id === prop.data.o).name
|
||||
if(prop.data.o) newVal = plants.value.find(i => i.id === prop.data.n).name
|
||||
if(prop.data.n) newVal = plants.value.find(i => i.id === prop.data.n).name
|
||||
} else if(key === "annualPaidLeaveDays") {
|
||||
name = "Urlaubstage"
|
||||
} else if(key === "employeeNumber") {
|
||||
@@ -677,7 +686,16 @@ export const useDataStore = defineStore('data', () => {
|
||||
} else if(key === "driver") {
|
||||
name = "Fahrer"
|
||||
if(prop.data.o) oldVal = profiles.value.find(i => i.id === prop.data.o).fullName
|
||||
if(prop.data.o) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
|
||||
if(prop.data.n) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
|
||||
} else if(key === "fixed") {
|
||||
name = "Festgeschrieben"
|
||||
if(newVal === true){
|
||||
oldVal = "Nein"
|
||||
newVal = "Ja"
|
||||
} else if(newVal === false) {
|
||||
oldVal = "Ja"
|
||||
newVal = "Nein"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -798,7 +816,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
}
|
||||
|
||||
|
||||
} else if(dataType === "createddocuments") {
|
||||
} else if(dataType === "createddocuments" && data.type !== "serialInvoices") {
|
||||
console.log(data.type)
|
||||
|
||||
let type = ""
|
||||
@@ -1074,7 +1092,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
}
|
||||
|
||||
async function fetchServiceCategories() {
|
||||
serviceCategories.value = (await supabase.from("serviceCategories").select().eq('tenant', currentTenant.value)).data
|
||||
servicecategories.value = (await supabase.from("servicecategories").select().eq('tenant', currentTenant.value)).data
|
||||
}
|
||||
|
||||
async function fetchResources() {
|
||||
@@ -1224,7 +1242,18 @@ export const useDataStore = defineStore('data', () => {
|
||||
})
|
||||
|
||||
const getTextTemplatesByDocumentType = computed(() => (documentType) => {
|
||||
return texttemplates.value.filter(i => i.documentType === documentType)
|
||||
console.log(documentType)
|
||||
|
||||
let type = ""
|
||||
if(documentType === "serialInvoices") {
|
||||
type = "invoices"
|
||||
} else {
|
||||
type = documentType
|
||||
}
|
||||
|
||||
console.log(type)
|
||||
|
||||
return texttemplates.value.filter(i => i.documentType === type)
|
||||
})
|
||||
|
||||
const getCreatedDocumentsByProject = computed(() => (project) => {
|
||||
@@ -1652,7 +1681,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
emailAccounts,
|
||||
texttemplates,
|
||||
services,
|
||||
serviceCategories,
|
||||
servicecategories,
|
||||
documentTypesForCreation,
|
||||
|
||||
//Functions
|
||||
|
||||
Reference in New Issue
Block a user