Many Changes

This commit is contained in:
2025-01-05 18:23:44 +01:00
parent 1c6c6e4a33
commit efbb97967a
16 changed files with 970 additions and 441 deletions

View File

@@ -122,7 +122,7 @@ export const useDataStore = defineStore('data', () => {
numberRangeHolder: "customerNumber",
historyItemHolder: "customer",
supabaseSortColumn: "customerNumber",
supabaseSelectWithInformation: "*, projects(*), plants(*), contracts(*), contacts(*), createddocuments(*), documents(*)",
supabaseSelectWithInformation: "*, projects(*), plants(*), contracts(*), contacts(*), createddocuments(*), files(*)",
filters: [],
templateColumns: [
{
@@ -228,7 +228,7 @@ export const useDataStore = defineStore('data', () => {
component: profiles
},
],
showTabs: [{label: 'Informationen'},{label: 'Dokumente'},{label: 'Ausgangsbelege'},{label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}]
showTabs: [{label: 'Informationen'},{label: 'Dateien'},{label: 'Ausgangsbelege'},{label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}]
},
contacts: {
label: "Kontakte",
@@ -329,23 +329,30 @@ export const useDataStore = defineStore('data', () => {
isStandardEntity: true,
redirect:true,
filters:[],
supabaseSelectWithInformation: "*, customer(*), documents(*)",
inputColumns: [
"Allgemeines",
"Abrechnung"
],
supabaseSelectWithInformation: "*, customer(*), files(*)",
templateColumns: [
{
key: "name",
label: "Name",
title: true,
inputType: "text"
inputType: "text",
inputColumn: "Allgemeines"
},{
key: "active",
label: "Aktiv",
component: active,
inputType: "bool"
inputType: "bool",
inputColumn: "Allgemeines"
},{
key: "recurring",
label: "Wiederkehrend",
component: recurring,
inputType: "bool"
inputType: "bool",
inputColumn: "Allgemeines"
},{
key: 'customer',
label: "Kunde",
@@ -354,6 +361,7 @@ export const useDataStore = defineStore('data', () => {
selectDataType: "customers",
selectOptionAttribute: "name",
selectSearchAttributes: ['name'],
inputColumn: "Allgemeines"
},{
key: 'contact',
label: "Ansprechpartner",
@@ -365,64 +373,91 @@ export const useDataStore = defineStore('data', () => {
},
selectOptionAttribute: "fullName",
selectSearchAttributes: ['fullName'],
inputColumn: "Allgemeines"
},{
key: 'duration',
label: "mindest Vertragslaufzeit",
inputType: "select",
selectManualOptions: ['12 Monate','24 Monate','36 Monate','48 Monate']
selectValueAttribute:"label",
selectManualOptions: [
{label:'12 Monate'},
{label:'24 Monate'},
{label:'36 Monate'},
{label:'48 Monate'},
],
inputColumn: "Allgemeines"
},{
key: 'invoiceDispatch',
label: "Rechnungsversand",
inputType: "select",
selectManualOptions: ['E-Mail','Post']
selectValueAttribute: "label",
selectManualOptions: [
{label:'E-Mail'},
{label:'Post'}
],
inputColumn: "Abrechnung"
},{
key: 'paymentType',
label: "Zahlungsart",
inputType: "select",
selectManualOptions: ['Einzug','Überweisung']
selectValueAttribute: "label",
selectManualOptions: [
{label:'Einzug'},
{label:'Überweisung'}
],
inputColumn: "Abrechnung"
},{
key: 'startDate',
label: "Vertragsstart",
inputType: "date",
inputColumn: "Allgemeines"
},{
key: 'endDate',
label: "Vertragsende",
inputType: "date",
inputColumn: "Allgemeines"
},{
key: 'signDate',
label: "Unterschrieben am",
inputType: "date",
inputColumn: "Allgemeines"
},{
key: 'sepaDate',
label: "SEPA Datum",
inputType: "date",
inputColumn: "Abrechnung"
},{
key: 'sepaRef',
label: "Mandatsreferenz",
inputType: "text",
inputColumn: "Abrechnung"
},{
key: 'bankingIban',
label: "IBAN",
inputType: "text",
inputColumn: "Abrechnung"
},{
key: 'bankingOwner',
label: "Inhaber",
inputType: "text",
inputColumn: "Abrechnung"
},{
key: 'bankingName',
label: "Bank",
inputType: "text",
inputColumn: "Abrechnung"
},{
key: 'bankinBIC',
label: "BIC",
inputType: "text",
inputColumn: "Abrechnung"
},{
key: "notes",
label: "Notizen",
inputType: "textarea"
inputType: "textarea",
}
],
showTabs: [{label: 'Informationen'},{label: 'Dokumente'}]
showTabs: [{label: 'Informationen'},{label: 'Dateien'}]
},
absencerequests: {
label: "Abwesenheitsanträge",
@@ -527,7 +562,7 @@ export const useDataStore = defineStore('data', () => {
},{
label: "Aufgaben"
},{
label: "Dokumente"
label: "Dateien"
}]
},
products: {
@@ -536,6 +571,7 @@ export const useDataStore = defineStore('data', () => {
isStandardEntity: true,
redirect:true,
supabaseSelectWithInformation: "*, unit(name)",
historyItemHolder: "product",
filters: [],
templateColumns: [
{
@@ -568,6 +604,16 @@ export const useDataStore = defineStore('data', () => {
label: "Verkaufpreispreis",
component: sellingPrice,
inputType: "number"
},{
key: "taxPercentage",
label: "Umsatzsteuer",
inputType: "select",
selectOptionAttribute: "label",
selectValueAttribute: 'key',
selectManualOptions: [
{label: "19 %", key: 19},
{label: "7 %", key: 7},
{label: "0 %", key: 0}]
},
/*{
key: "tags",
@@ -601,7 +647,7 @@ export const useDataStore = defineStore('data', () => {
redirect:true,
historyItemHolder: "project",
numberRangeHolder: "projectNumber",
supabaseSelectWithInformation: "*, customer(id,name), plant(id,name), projecttype(name, id), tasks(*), documents(*), createddocuments(*)",
supabaseSelectWithInformation: "*, customer(id,name), plant(id,name), projecttype(name, id), tasks(*), files(*), createddocuments(*)",
supabaseSortColumn: "projectNumber",
filters: [
{
@@ -685,8 +731,8 @@ export const useDataStore = defineStore('data', () => {
key: "tasks",
label: "Aufgaben"
},{
key: "documents",
label: "Dokumente"
key: "files",
label: "Dateien"
},{
label: "Ausgangsbelege"
}/*,{
@@ -706,7 +752,7 @@ export const useDataStore = defineStore('data', () => {
isStandardEntity: true,
redirect:true,
historyItemHolder: "vehicle",
supabaseSelectWithInformation: "*, checks(*), documents(*)",
supabaseSelectWithInformation: "*, checks(*), files(*)",
filters:[],
templateColumns:[
{
@@ -779,7 +825,7 @@ export const useDataStore = defineStore('data', () => {
{
label: 'Informationen',
}, {
label: 'Dokumente',
label: 'Dateien',
}, {
label: 'Überprüfungen',
}
@@ -902,7 +948,7 @@ export const useDataStore = defineStore('data', () => {
{
label: 'Informationen',
}, {
label: 'Dokumente',
label: 'Dateien',
}
]
},
@@ -914,7 +960,7 @@ export const useDataStore = defineStore('data', () => {
label: "Lagerplätze",
labelSingle: "Lagerplatz",
isStandardEntity: true,
supabaseSelectWithInformation: "*, documents(*)",
supabaseSelectWithInformation: "*, files(*)",
supabaseSortColumn: "spaceNumber",
redirect: true,
numberRangeHolder: "spaceNumber",
@@ -943,7 +989,14 @@ export const useDataStore = defineStore('data', () => {
key: "type",
label: "Typ",
inputType: "select",
selectManualOptions: ["Standort","Regalplatz", "Kiste", "Palettenplatz", "Sonstiges"],
selectValueAttribute: "label",
selectManualOptions: [
{label:"Standort"},
{label:"Regalplatz"},
{label:"Kiste"},
{label:"Palettenplatz"},
{label:"Sonstiges"}
],
inputColumn: "Allgemeines"
},
{
@@ -1013,7 +1066,7 @@ export const useDataStore = defineStore('data', () => {
{
label: 'Informationen',
}, {
label: 'Dokumente',
label: 'Dateien',
},{label: 'Inventarartikel'}
]
},
@@ -1034,7 +1087,7 @@ export const useDataStore = defineStore('data', () => {
label: "Inventarartikel",
labelSingle: "Inventarartikel",
isStandardEntity: true,
supabaseSelectWithInformation: "*, documents(*), vendor(id,name), currentSpace(id,name)",
supabaseSelectWithInformation: "*, files(*), vendor(id,name), currentSpace(id,name)",
redirect: true,
numberRangeHolder: "articleNumber",
inputColumns: [
@@ -1151,7 +1204,7 @@ export const useDataStore = defineStore('data', () => {
{
label: 'Informationen',
}, {
label: 'Dokumente',
label: 'Dateien',
}
]
},
@@ -1405,7 +1458,7 @@ export const useDataStore = defineStore('data', () => {
label: "Überprüfungen",
labelSingle: "Überprüfung",
isStandardEntity: true,
supabaseSelectWithInformation: "*, vehicle(id,licensePlate), profile(id, fullName), inventoryitem(name), documents(*)",
supabaseSelectWithInformation: "*, vehicle(id,licensePlate), profile(id, fullName), inventoryitem(name), files(*)",
redirect: true,
historyItemHolder: "check",
filters: [],
@@ -1451,7 +1504,7 @@ export const useDataStore = defineStore('data', () => {
showTabs: [
{
label: 'Informationen',
}, {label: 'Dokumente'}, {label: 'Ausführungen'}]
}, {label: 'Dateien'}, {label: 'Ausführungen'}]
},
roles: {
label: "Rollen",
@@ -2060,44 +2113,60 @@ export const useDataStore = defineStore('data', () => {
}
const uploadFiles = async (formData, files, upsert) => {
//console.log(files)
//console.log(formData)
let documentsToInsert = []
const uploadSingleFile = async (file) => {
const {data, error} = await supabase
.storage
const {data:createdFileData,error:createdFileError} = await supabase
.from("files")
.upload(`${profileStore.currentTenant}/${file.name}`, file, {upsert: upsert})
.insert({
tenant: profileStore.currentTenant,
})
.select()
.single()
if (error) {
console.log(error)
console.log(error.statusCode)
if(createdFileError){
console.log(createdFileError)
toast.add({title: "Hochladen fehlgeschlagen", icon: "i-heroicons-x-circle", color: "rose", timeout: 10000})
} else if(createdFileData) {
console.log(createdFileData)
const {data:uploadData, error: uploadError} = await supabase
.storage
.from("filesdev")
.upload(`${profileStore.currentTenant}/filesbyid/${createdFileData.id}/${file.name}`, file, {upsert: upsert})
if(error.statusCode === '400') {
console.log("is 400")
toast.add({title: "Hochladen fehlgeschlagen", description: "Die Datei enthält ungültige Zeichen", icon: "i-heroicons-x-circle", color: "rose", timeout: 10000})
} else if(error.statusCode === '409') {
console.log("is 409")
toast.add({title: "Hochladen fehlgeschlagen", description: "Es existiert bereits eine Datei mit diesem Namen", icon: "i-heroicons-x-circle", color: "rose", timeout: 10000})
} else {
toast.add({title: "Hochladen fehlgeschlagen", icon: "i-heroicons-x-circle", color: "rose", timeout: 10000})
if(uploadError) {
console.log(uploadError)
console.log(uploadError.statusCode)
if(uploadError.statusCode === '400') {
console.log("is 400")
toast.add({title: "Hochladen fehlgeschlagen", description: "Die Datei enthält ungültige Zeichen", icon: "i-heroicons-x-circle", color: "rose", timeout: 10000})
} else if(uploadError.statusCode === '409') {
console.log("is 409")
toast.add({title: "Hochladen fehlgeschlagen", description: "Es existiert bereits eine Datei mit diesem Namen", icon: "i-heroicons-x-circle", color: "rose", timeout: 10000})
} else {
toast.add({title: "Hochladen fehlgeschlagen", icon: "i-heroicons-x-circle", color: "rose", timeout: 10000})
}
} else if(uploadData) {
const {data:updateFileData, error:updateFileError} = await supabase
.from("files")
.update({
...formData,
path: uploadData.path,
})
.eq("id", createdFileData.id)
if(updateFileError) {
console.log(updateFileError)
toast.add({title: "Hochladen fehlgeschlagen", icon: "i-heroicons-x-circle", color: "rose", timeout: 10000})
} else {
toast.add({title: "Hochladen erfolgreich"})
}
}
} else if (data) {
const returnPath = data.path
documentsToInsert.push({...formData, path: returnPath, tenant: profileStore.currentTenant})
}
//console.log(data)
}
//uploadInProgress.value = true
if(files.length === 1) {
await uploadSingleFile(files[0])
} else if( files.length > 1) {
@@ -2107,25 +2176,6 @@ export const useDataStore = defineStore('data', () => {
}
}
//console.log(documentsToInsert)
const {data, error} = await supabase
.from("documents")
.insert(documentsToInsert)
.select()
if(error) console.log(error)
else {
//console.log(data)
await fetchDocuments()
//documents.value.push(...data)
}
//uploadModalOpen.value = false;
//uploadInProgress.value = false;
}
async function fetchBankAccounts () {
@@ -2177,7 +2227,7 @@ export const useDataStore = defineStore('data', () => {
vehicles.value = (await supabase.from("vehicles").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchTimes () {
times.value = (await supabase.from("times").select().eq('tenant', profileStore.currentTenant).order("start", {ascending:false})).data
times.value = (await supabase.from("times").select().eq('tenant', profileStore.currentTenant).order("startDate", {ascending:false})).data
}
async function fetchHistoryItems () {