This commit is contained in:
2024-10-08 13:57:23 +02:00
parent 06badd590c
commit 7fb9744847
3 changed files with 75 additions and 15 deletions

View File

@@ -11,7 +11,7 @@ export const useSupabaseSelect = async (relation,select = '*', sortColumn = null
.from(relation) .from(relation)
.select(select) .select(select)
.eq("tenant", dataStore.currentTenant) .eq("tenant", dataStore.currentTenant)
.order(sortColumn, {ascending: true})).data .order(sortColumn, {ascending: ascending})).data
} else { } else {
data = (await supabase data = (await supabase
.from(relation) .from(relation)
@@ -22,7 +22,7 @@ export const useSupabaseSelect = async (relation,select = '*', sortColumn = null
return data return data
} }
export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null) => { export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null, folderPath = "_") => {
const supabase = useSupabaseClient() const supabase = useSupabaseClient()
const dataStore = useDataStore() const dataStore = useDataStore()
let data = null let data = null
@@ -33,12 +33,15 @@ export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null
.from("documents") .from("documents")
.select(select) .select(select)
.eq("tenant", dataStore.currentTenant) .eq("tenant", dataStore.currentTenant)
.eq("folderPath", folderPath)
.order(sortColumn, {ascending: true})).data .order(sortColumn, {ascending: true})).data
} else { } else {
data = (await supabase data = (await supabase
.from("documents") .from("documents")
.select(select) .select(select)
.eq("tenant", dataStore.currentTenant)).data .eq("tenant", dataStore.currentTenant)
.eq("folderPath",folderPath)).data
} }
if(data.length > 0){ if(data.length > 0){
@@ -60,7 +63,7 @@ export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null
} }
console.log(data) //console.log(data)
return data return data
} }

View File

@@ -140,6 +140,24 @@ const saveSignature = async () => {
contentSaved.value = true 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> </script>
<template> <template>
@@ -268,6 +286,16 @@ const saveSignature = async () => {
@updateContent="contentChanged" @updateContent="contentChanged"
:preloadedContent="emailSignature" :preloadedContent="emailSignature"
/> />
<UDivider>Newsletter</UDivider>
<UButton
@click="addToNewsletter"
variant="outline"
>
In Newsletter eintragen
</UButton>
</div> </div>
<div v-if="item.label === 'Logbuch'"> <div v-if="item.label === 'Logbuch'">
<HistoryDisplay <HistoryDisplay

View File

@@ -143,6 +143,11 @@ export const useDataStore = defineStore('data', () => {
labelSingle: "Artikelkategorie", labelSingle: "Artikelkategorie",
redirect: true redirect: true
}, },
servicecategories: {
label: "Leistungskategorie",
labelSingle: "Leistungskategorien",
redirect: true
},
trackingtrips: { trackingtrips: {
label: "Fahrten", label: "Fahrten",
labelSingle: "Fahrt", labelSingle: "Fahrt",
@@ -157,6 +162,10 @@ export const useDataStore = defineStore('data', () => {
labelSingle: "Rechnung", labelSingle: "Rechnung",
}, },
serialInvoices: {
label: "Serienrechnungen",
labelSingle: "Serienrechnung",
},
advanceInvoices: { advanceInvoices: {
label: "Abschlagsrechnungen", label: "Abschlagsrechnungen",
labelSingle: "Abschlagsrechnung" labelSingle: "Abschlagsrechnung"
@@ -234,7 +243,7 @@ export const useDataStore = defineStore('data', () => {
const emailAccounts = ref([]) const emailAccounts = ref([])
const texttemplates =ref([]) const texttemplates =ref([])
const services =ref([]) const services =ref([])
const serviceCategories =ref([]) const servicecategories =ref([])
const resources =ref([]) const resources =ref([])
@@ -442,7 +451,7 @@ export const useDataStore = defineStore('data', () => {
emailAccounts.value = [] emailAccounts.value = []
texttemplates.value = [] texttemplates.value = []
services.value = [] services.value = []
serviceCategories.value = [] servicecategories.value = []
resources.value = [] resources.value = []
} }
@@ -646,11 +655,11 @@ export const useDataStore = defineStore('data', () => {
} else if(key === "customer") { } else if(key === "customer") {
name = "Kunde" name = "Kunde"
if(prop.data.o) oldVal = customers.value.find(i => i.id === prop.data.o).name 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") { } else if(key === "vendor") {
name = "Lieferant" name = "Lieferant"
if(prop.data.o) oldVal = vendors.value.find(i => i.id === prop.data.o).name 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") { } else if(key === "description") {
name = "Beschreibung" name = "Beschreibung"
@@ -659,11 +668,11 @@ export const useDataStore = defineStore('data', () => {
} else if(key === "profile") { } else if(key === "profile") {
name = "Mitarbeiter" name = "Mitarbeiter"
if(prop.data.o) oldVal = profiles.value.find(i => i.id === prop.data.o).fullName 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") { } else if(key === "plant") {
name = "Objekt" name = "Objekt"
if(prop.data.o) oldVal = plants.value.find(i => i.id === prop.data.o).name 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") { } else if(key === "annualPaidLeaveDays") {
name = "Urlaubstage" name = "Urlaubstage"
} else if(key === "employeeNumber") { } else if(key === "employeeNumber") {
@@ -677,7 +686,16 @@ export const useDataStore = defineStore('data', () => {
} else if(key === "driver") { } else if(key === "driver") {
name = "Fahrer" name = "Fahrer"
if(prop.data.o) oldVal = profiles.value.find(i => i.id === prop.data.o).fullName 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) console.log(data.type)
let type = "" let type = ""
@@ -1074,7 +1092,7 @@ export const useDataStore = defineStore('data', () => {
} }
async function fetchServiceCategories() { 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() { async function fetchResources() {
@@ -1224,7 +1242,18 @@ export const useDataStore = defineStore('data', () => {
}) })
const getTextTemplatesByDocumentType = computed(() => (documentType) => { 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) => { const getCreatedDocumentsByProject = computed(() => (project) => {
@@ -1652,7 +1681,7 @@ export const useDataStore = defineStore('data', () => {
emailAccounts, emailAccounts,
texttemplates, texttemplates,
services, services,
serviceCategories, servicecategories,
documentTypesForCreation, documentTypesForCreation,
//Functions //Functions