|
- {{row.product ? dataStore.getProductById(row.product).name : "Kein Produkt ausgewählt" }}
+ {{row.product ? products.find(i => i.id === row.product).name : "Kein Produkt ausgewählt" }}
{
- row.product = i.id
- row.unit = dataStore.getProductById(row.product).unit,
- row.price = (dataStore.getProductById(row.product).sellingPrice || 0),
- row.description = dataStore.getProductById(row.product).description
- showProductSelectionModal = false}"
+ :rows="selectedProductcategorie !== 'not set' ? products.filter(i => i.productcategories.includes(selectedProductcategorie)) : products.filter(i => i.productcategories.length === 0)"
+ :columns="[
+ {key: 'name',label:'Name'},
+ {key: 'manufacturer',label:'Hersteller'},
+ {key: 'articleNumber',label:'Artikelnummer'},
+ ]"
+ :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Artikel anzuzeigen' }"
+ @select=" (i) => {
+ row.product = i.id
+ row.unit = products.find(i => i.id === row.product).unit,
+ row.price = (products.find(i => i.id === row.product).sellingPrice || 0),
+ row.description = products.find(i => i.id === row.product).description
+ showProductSelectionModal = false}"
>
@@ -1456,9 +1622,6 @@ setupPage()
-
|
- {{dataStore.getServiceById(row.service) ? dataStore.getServiceById(row.service).name : "Keine Leistung ausgewählt" }}
+ {{services.find(i => i.id === row.service) ? services.find(i => i.id === row.service).name : "Keine Leistung ausgewählt" }}
{
- row.service = i.id
- row.unit = dataStore.getServiceById(row.service).unit,
- row.price = dataStore.getServiceById(row.service).sellingPrice || 0,
- row.description = dataStore.getServiceById(row.service).description
- showServiceSelectionModal = false}"
+ row.service = i.id
+ setRowData(row)
+ showServiceSelectionModal = false}"
>
@@ -1558,7 +1717,7 @@ setupPage()
EUR
@@ -1603,14 +1762,14 @@ setupPage()
v-if="!['pagebreak','title','text'].includes(row.mode)"
>
@@ -1625,7 +1784,7 @@ setupPage()
Speichern
@@ -1640,10 +1799,10 @@ setupPage()
Dieselverbrauch bearbeiten
L
@@ -1651,12 +1810,12 @@ setupPage()
€/L
@@ -1665,8 +1824,8 @@ setupPage()
Speichern
@@ -1715,18 +1874,21 @@ setupPage()
+ Leistung
+ Artikel
+ Freie Position
@@ -1750,19 +1912,63 @@ setupPage()
+
+ Noch nicht abgerechnete Abschlagsrechnungen
+
+
+
+ {{advanceInvoice.documentNumber}}
+ Summe: {{renderCurrency(advanceInvoice.rows[0].price * (1 + advanceInvoice.rows[0].taxPercent/100))}}
+
+
+ Verwenden
+
+ i !== advanceInvoice.id)"
+ :disabled="!itemInfo.usedAdvanceInvoices.includes(advanceInvoice.id)"
+ color="rose"
+ variant="outline"
+ >
+ X
+
+
+
+
+
+
+
| Netto: |
- {{documentTotal.totalNet}} |
+ {{renderCurrency(documentTotal.totalNet)}} |
| zzgl. 19 % USt: |
- {{documentTotal.total19}} |
+ {{renderCurrency(documentTotal.total19)}} |
| Brutto: |
- {{documentTotal.totalGross}} |
+ {{renderCurrency(documentTotal.totalGross)}} |
+
+
+ | Bereits bezahlt: |
+ {{renderCurrency(documentTotal.totalGrossAlreadyPaid)}} |
+
+
+ | Offene Summe: |
+ {{renderCurrency(documentTotal.totalSumToPay)}} |
@@ -1775,7 +1981,7 @@ setupPage()
label="Vorlage auswählen"
>
+
diff --git a/pages/createDocument/index.vue b/pages/createDocument/index.vue
index de8ed43..4374a34 100644
--- a/pages/createDocument/index.vue
+++ b/pages/createDocument/index.vue
@@ -111,7 +111,7 @@
- {{displayCurrency(calculateDocSum(row))}}
+ {{displayCurrency(calculateDocSum(row))}}
@@ -162,7 +162,7 @@ const items = ref([])
const selectedItem = ref(0)
const setupPage = async () => {
- items.value = await useSupabaseSelect("createddocuments","*, customer(id,name), statementallocations(id,amount)","documentDate")
+ items.value = (await useSupabaseSelect("createddocuments","*, customer(id,name), statementallocations(id,amount)","documentNumber")).filter(i => !i.archived)
}
setupPage()
@@ -215,6 +215,9 @@ const templateTypes = [
{
key: "invoices",
label: "Rechnungen"
+ },{
+ key: "cancellationInvoices",
+ label: "Stornorechnungen"
},{
key: "advanceInvoices",
label: "Abschlagsrechnungen"
@@ -269,7 +272,7 @@ const calculateDocSum = (row) => {
row.rows.forEach(row => {
if(row.mode === "normal" || row.mode === "service" || row.mode === "free") {
- sum += row.quantity * row.price * (1 - row.discountPercent / 100) * (1 + row.taxPercent / 100)
+ sum += row.quantity * row.price * (1 - row.discountPercent / 100) * (1 + (row.taxPercent || 0) / 100)
}
})
@@ -280,10 +283,6 @@ const isPaid = (item) => {
let amountPaid = 0
item.statementallocations.forEach(allocation => amountPaid += allocation.amount)
- console.log(item.documentNumber)
- console.log(amountPaid)
- console.log(calculateDocSum(item))
-
return Number(amountPaid.toFixed(2)) === Number(calculateDocSum(item))
}
diff --git a/pages/createDocument/show/[id].vue b/pages/createDocument/show/[id].vue
index eae1a75..4b21b4f 100644
--- a/pages/createDocument/show/[id].vue
+++ b/pages/createDocument/show/[id].vue
@@ -12,6 +12,7 @@ defineShortcuts({
const supabase = useSupabaseClient()
const dataStore = useDataStore()
+const profileStore = useProfileStore()
const route = useRoute()
const router = useRouter()
@@ -20,13 +21,20 @@ const linkedDocument =ref({})
const currentTenant = ref({})
const setupPage = async () => {
if(route.params) {
- if(route.params.id) itemInfo.value = await useSupabaseSelectSingle("createddocuments",route.params.id,"*")
- const {data,error} = await supabase.from("documents").select("id").eq("createdDocument", route.params.id).order("id",{ascending:true})
- linkedDocument.value = data[data.length -1]
+ if(route.params.id) itemInfo.value = await useSupabaseSelectSingle("createddocuments",route.params.id,"*, files(*)")
+
+ console.log(itemInfo.value)
+
+ linkedDocument.value = await useFiles().selectDocument(itemInfo.value.files[0].id)
+
+
+
+ //const {data,error} = await supabase.from("files").select("id").eq("createddocument", route.params.id).order("id",{ascending:true})
+ //linkedDocument.value = data[data.length -1]
}
- currentTenant.value = (await supabase.from("tenants").select().eq("id",dataStore.currentTenant).single()).data
+ currentTenant.value = (await supabase.from("tenants").select().eq("id",profileStore.currentTenant).single()).data
console.log(currentTenant.value)
}
@@ -35,9 +43,9 @@ setupPage()
const openEmail = () => {
if(["invoices","advanceInvoices"].includes(itemInfo.value.type)){
- router.push(`/email/new?loadDocuments=[${linkedDocument.value.id}]&bcc=${encodeURIComponent(currentTenant.value.standardEmailForInvoices)}`)
+ router.push(`/email/new?loadDocuments=["${linkedDocument.value.id}"]&bcc=${encodeURIComponent(currentTenant.value.standardEmailForInvoices)}`)
} else {
- router.push(`/email/new?loadDocuments=[${linkedDocument.value.id}]`)
+ router.push(`/email/new?loadDocuments=["${linkedDocument.value.id}"]`)
}
}
@@ -56,10 +64,10 @@ const openEmail = () => {
>
Bearbeiten
- In neuen Tab anzeigen
+ >In neuen Tab anzeigen-->
@@ -71,13 +79,32 @@ const openEmail = () => {
>
E-Mail
+
+ Stornieren
+
+
+ Projekt
+
+
+
+
+
+
-
diff --git a/pages/customers/[mode]/[[id]].vue b/pages/customers/[mode]/[[id]].vue
deleted file mode 100644
index d646946..0000000
--- a/pages/customers/[mode]/[[id]].vue
+++ /dev/null
@@ -1,369 +0,0 @@
-
-
-
-
-
-
- Kunden
-
-
-
- {{itemInfo ? `Kunde: ${itemInfo.name}` : (mode === 'create' ? 'Kunde erstellen' : 'Kunde bearbeiten')}}
-
-
-
- Speichern
-
-
- Erstellen
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
- Aktiv
-
-
- Gesperrt
-
-
-
-
-
-
-
-
-
-
-
- Kundennummer: {{itemInfo.customerNumber}}
- Typ: {{itemInfo.isCompany ? 'Firma' : 'Privatperson'}}
- Straße + Hausnummer: {{itemInfo.infoData.street}}
- PLZ + Ort: {{itemInfo.infoData.zip}} {{itemInfo.infoData.city}}
- Telefon: {{itemInfo.infoData.tel}}
- E-Mail: {{itemInfo.infoData.email}}
- Web: {{itemInfo.infoData.web}}
- USt-Id: {{itemInfo.infoData.ustid}}
- Notizen: {{itemInfo.notes}}
-
-
-
-
-
-
- + Ansprechpartner
-
-
- router.push(`/contacts/show/${row.id}`)"
- :columns="[{label: 'Anrede', key: 'salutation'},{label: 'Name', key: 'fullName'},{label: 'Rolle', key: 'role'}]"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Ansprechpartner' }"
-
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- + Projekt
-
-
- router.push(`/projects/show/${row.id}`)"
- :columns="[{label: 'Name', key: 'name'},{label: 'Phase', key: 'phase'}]"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Projekte' }"
-
- >
-
- {{row.phases ? row.phases.find(i => i.active).label : ""}}
-
-
-
-
-
-
- + Objekt
-
-
- router.push(`/plants/show/${row.id}`)"
- :columns="[{label: 'Name', key: 'name'}]"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Objekte' }"
-
- >
-
-
-
-
-
-
- + Vertrag
-
-
- router.push(`/contracts/show/${row.id}`)"
- :columns="[{label: 'Name', key: 'name'},{label: 'Aktiv', key: 'active'}]"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Verträge' }"
-
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/customers/index.vue b/pages/customers/index.vue
deleted file mode 100644
index f7e3011..0000000
--- a/pages/customers/index.vue
+++ /dev/null
@@ -1,168 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Kunde
-
-
-
-
-
-
-
-
- Spalten
-
-
-
-
-
- router.push(`/customers/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Kunden anzuzeigen' }"
- >
-
- {{row.name}}
- {{row.name}}
-
-
- Firmenkunden
- Privatkunde
-
-
- Aktiv
- Gesperrt
-
-
- {{row.infoData.street ? `${row.infoData.street}, ` : ''}}{{row.infoData.special ? `${row.infoData.special},` : ''}} {{row.infoData.zip ? row.infoData.zip : ""}} {{row.infoData.city ? `${row.infoData.city}, ` : ''}} {{row.infoData.country}}
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/deprecated/email.vue b/pages/deprecated/email.vue
deleted file mode 100644
index 53038bb..0000000
--- a/pages/deprecated/email.vue
+++ /dev/null
@@ -1,580 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/documents.vue b/pages/documents.vue
deleted file mode 100644
index fbdf9fb..0000000
--- a/pages/documents.vue
+++ /dev/null
@@ -1,369 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- Hochladen
-
-
-
-
-
-
-
-
-
-
-
- Datei Hochladen
-
-
-
-
-
-
-
-
-
-
-
-
-
- Hochladen
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/editortest.vue b/pages/editortest.vue
deleted file mode 100644
index 56d14d7..0000000
--- a/pages/editortest.vue
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/email/index.vue b/pages/email/index.vue
index 13ce4f0..f0f4e30 100644
--- a/pages/email/index.vue
+++ b/pages/email/index.vue
@@ -2,6 +2,7 @@
const supabase = useSupabaseClient()
const dataStore = useDataStore()
+const profileStore = useProfileStore()
const selectedTab = ref(0)
@@ -12,7 +13,7 @@ const accountData = ref(null)
const availableAccounts = ref(null)
const selectedAccount = ref(null)
const setupPage = async () => {
- availableAccounts.value = (await supabase.from("emailAccounts").select("*").contains("profiles",[dataStore.activeProfile.id])).data
+ availableAccounts.value = (await supabase.from("emailAccounts").select("*").contains("profiles",[profileStore.activeProfile.id])).data
console.log(availableAccounts.value)
if(availableAccounts.value.length > 0) {
diff --git a/pages/email/new.vue b/pages/email/new.vue
index cfce0cd..87fb5f5 100644
--- a/pages/email/new.vue
+++ b/pages/email/new.vue
@@ -2,6 +2,7 @@
const supabase = useSupabaseClient()
const dataStore = useDataStore()
+const profileStore = useProfileStore()
const route = useRoute()
const router = useRouter()
const toast = useToast()
@@ -29,7 +30,7 @@ const setupPage = async () => {
} else {
emailData.value.account = emailAccounts.value[0].id
- preloadedContent.value = `${dataStore.activeProfile.emailSignature}`
+ preloadedContent.value = `${profileStore.activeProfile.emailSignature || ""}`
//Check Query
if(route.query.to) emailData.value.to = route.query.to
@@ -39,18 +40,28 @@ const setupPage = async () => {
if(route.query.loadDocuments) {
- //console.log(JSON.parse(route.query.loadDocuments))
- const {data,error} = await supabase.from("documents").select('*, createdDocument(id,documentNumber,title,contact(email))').in('id',JSON.parse(route.query.loadDocuments))
+ console.log(JSON.parse(route.query.loadDocuments))
+ const data = await useFiles().selectSomeDocuments(JSON.parse(route.query.loadDocuments))
+ console.log(data)
+
+
- if(error) console.log(error)
if(data) loadedDocuments.value = data
//console.log(loadedDocuments.value)
if(loadedDocuments.value.length > 0) {
- emailData.value.subject = loadedDocuments.value[0].createdDocument.title
- emailData.value.to = loadedDocuments.value[0].createdDocument.contact ? loadedDocuments.value[0].createdDocument.contact.email : ""
+ console.log(loadedDocuments.value[0])
+ emailData.value.subject = loadedDocuments.value[0].createddocument.title
+ if(loadedDocuments.value[0].createddocument.contact && loadedDocuments.value[0].createddocument.contact.email) {
+ console.log("Contact")
+ emailData.value.to = loadedDocuments.value[0].createddocument.contact.email
+ } else if(loadedDocuments.value[0].createddocument.customer && loadedDocuments.value[0].createddocument.customer.infoData.email) {
+
+
+ emailData.value.to = loadedDocuments.value[0].createddocument.customer.infoData.email
+ }
}
}
@@ -121,7 +132,7 @@ const sendEmail = async () => {
for await (const doc of loadedDocuments.value) {
- const {data,error} = await supabase.storage.from("files").download(doc.path)
+ const {data,error} = await supabase.storage.from("filesdev").download(doc.path)
body.attachments.push({
filename: doc.path.split("/")[doc.path.split("/").length -1],
@@ -191,30 +202,39 @@ const sendEmail = async () => {
/>
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -227,7 +247,7 @@ const sendEmail = async () => {
class="mx-auto w-10 h-10"
/>
Anhänge hochladen-->
- {
class="list-disc"
v-for="doc in loadedDocuments"
>
- Dokument - {{doc.createdDocument.documentNumber}}
+ Dokument - {{doc.createddocument.documentNumber}}
diff --git a/pages/employees/timetracking.vue b/pages/employees/timetracking.vue
index 257356d..3bbd807 100644
--- a/pages/employees/timetracking.vue
+++ b/pages/employees/timetracking.vue
@@ -9,6 +9,7 @@ definePageMeta({
})
const dataStore = useDataStore()
+const profileStore = useProfileStore()
const supabase = useSupabaseClient()
const user = useSupabaseUser()
const toast = useToast()
@@ -16,22 +17,29 @@ const toast = useToast()
const timeTypes = dataStore.getTimeTypes
const timeInfo = ref({
- user: "",
- start: "",
- end: null,
+ profile: "",
+ startDate: "",
+ endDate: null,
notes: null,
- projectId: null,
+ project: null,
type: null
})
-const filterUser = ref(user.value.id || "")
+const filterUser = ref(profileStore.activeProfile.id || "")
+const times = ref([])
+
+const setup = async () => {
+ times.value = await useSupabaseSelect("times","*, profile(*)")
+}
+
+setup()
const filteredRows = computed(() => {
- let times = dataStore.times
+ //let times = times.value
- if(dataStore.hasRight('viewTimes')) {
+ /*if(dataStore.hasRight('viewTimes')) {
if(filterUser.value !== "") {
times = times.filter(i => i.user === filterUser.value)
}
@@ -39,9 +47,9 @@ const filteredRows = computed(() => {
times = times.filter(i => i.user === user.value.id)
} else {
times = []
- }
+ }*/
- return times
+ return times.value
})
@@ -62,42 +70,34 @@ const columns = [
{
key:"state",
label: "Status",
- sortable:true
},
{
key: "user",
label: "Benutzer",
- sortable:true
},
{
- key:"start",
+ key:"startDate",
label:"Start",
- sortable:true
+ },
+ {
+ key: "endDate",
+ label: "Ende",
},
{
key:"type",
label:"Typ",
- sortable:true
- },
- {
- key: "end",
- label: "Ende",
- sortable:true
},
{
key: "duration",
label: "Dauer",
- sortable:true
},
{
- key: "projectId",
+ key: "project",
label: "Projekt",
- sortable:true
},
{
key: "notes",
label: "Notizen",
- sortable:true
}
]
@@ -109,9 +109,9 @@ const configTimeMode = ref("create")
const startTime = async () => {
console.log("started")
- timeInfo.value.user = user.value.id
+ timeInfo.value.profile = profileStore.activeProfile.id
timeInfo.value.start = new Date().toISOString()
- timeInfo.value.tenant = dataStore.currentTenant
+ timeInfo.value.tenant = profileStore.currentTenant
const {data,error} = await supabase
.from("times")
@@ -123,7 +123,7 @@ const startTime = async () => {
} else if(data) {
//timeInfo.value = data[0]
await dataStore.fetchTimes()
- runningTimeInfo.value = dataStore.times.find(time => time.user === user.value.id && !time.end)
+ runningTimeInfo.value = dataStore.times.find(time => time.profile === profileStore.activeProfile.id && !time.end)
}
}
@@ -154,15 +154,15 @@ const stopStartedTime = async () => {
}
}
-if(dataStore.times.find(time => time.user == user.value.id && !time.end)) {
- runningTimeInfo.value = dataStore.times.find(time => time.user == user.value.id && !time.end)
+if(times.value.find(time => time.profile == profileStore.activeProfile.id && !time.end)) {
+ runningTimeInfo.value = times.value.find(time => time.profile == profileStore.activeProfile.id && !time.end)
}
const createTime = async () => {
const {data,error} = await supabase
.from("times")
- .insert({...itemInfo.value, tenant: dataStore.currentTenant})
+ .insert({...itemInfo.value, tenant: profileStore.currentTenant})
.select()
if(error) {
@@ -240,14 +240,13 @@ const setState = async (newState) => {
Erstellen
- {{dataStore.getProfileById(filterUser) ? dataStore.getProfileById(filterUser).fullName : "Kein Benutzer ausgewählt"}}
+ {{profileStore.getProfileById(filterUser) ? profileStore.getProfileById(filterUser).fullName : "Kein Benutzer ausgewählt"}}
@@ -339,14 +338,14 @@ const setState = async (newState) => {
label="Benutzer:"
>
- {{dataStore.profiles.find(profile => profile.id === itemInfo.user) ? dataStore.profiles.find(profile => profile.id === itemInfo.user).fullName : "Benutzer auswählen"}}
+ {{profileStore.profiles.find(profile => profile.id === itemInfo.user) ? profileStore.profiles.find(profile => profile.id === itemInfo.user).fullName : "Benutzer auswählen"}}
@@ -444,7 +443,7 @@ const setState = async (newState) => {
>{{row.state}}
- {{dataStore.profiles.find(profile => profile.id === row.user) ? dataStore.profiles.find(profile => profile.id === row.user).fullName : row.user }}
+ {{profileStore.profiles.find(profile => profile.id === row.user) ? profileStore.profiles.find(profile => profile.id === row.user).fullName : row.user }}
diff --git a/pages/events/[mode]/[[id]].vue b/pages/events/[mode]/[[id]].vue
deleted file mode 100644
index b10130f..0000000
--- a/pages/events/[mode]/[[id]].vue
+++ /dev/null
@@ -1,259 +0,0 @@
-
-
-
-
-
-
- Abbrechen
-
-
-
- Erstellen
-
-
- Speichern
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
- Titel: {{itemInfo.title ? itemInfo.title : ''}}
- Typ: {{itemInfo.type? itemInfo.type : ''}}
- Start: {{dayjs(itemInfo.start).format("DD.MM.YY HH:mm")}}
- Ende: {{dayjs(itemInfo.end).format("DD.MM.YY HH:mm")}}
- Projekt: {{itemInfo.project ? itemInfo.project.name : ''}}
- Link: {{itemInfo.link }}
- Resources: {{itemInfo.resources.map((x) => `${x.type} - ${x.title}`).join(",")}}
- Notizen: {{itemInfo.notes ? itemInfo.notes : ''}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- i.id === resourceToAdd))"
- :disabled="itemInfo.resources.find(i => i.id === resourceToAdd)"
- >
- + Hinzufügen
-
-
-
-
-
- i.id !== row.id)"
- >
- Entfernen
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/events/index.vue b/pages/events/index.vue
deleted file mode 100644
index 28ddb68..0000000
--- a/pages/events/index.vue
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Termin
-
-
-
-
-
-
-
- Spalten
-
-
-
-
-
- router.push(`/events/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Termine anzuzeigen' }"
- >
-
- {{dayjs(row.start).format("DD.MM.YY HH:mm")}}
-
-
- {{dayjs(row.end).format("DD.MM.YY HH:mm")}}
-
-
- {{row.project ? dataStore.getProjectById(row.project).name: ""}}
-
-
- {{row.resources ? row.resources.map(i => i.title).join(", ") : ""}}
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/files/index.vue b/pages/files/index.vue
new file mode 100644
index 0000000..01e6afe
--- /dev/null
+++ b/pages/files/index.vue
@@ -0,0 +1,550 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + Hochladen
+ + Ordner
+
+
+
+ Ordner Erstellen
+
+
+
+
+
+
+
+
+
+
+ Erstellen
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Datei Hochladen
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hochladen
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/historyitems/index.vue b/pages/historyitems/index.vue
new file mode 100644
index 0000000..b44d9dd
--- /dev/null
+++ b/pages/historyitems/index.vue
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Zentrales Logbuch
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/incomingInvoices/[mode]/[[id]].vue b/pages/incomingInvoices/[mode]/[[id]].vue
index 71b6ee9..eb45123 100644
--- a/pages/incomingInvoices/[mode]/[[id]].vue
+++ b/pages/incomingInvoices/[mode]/[[id]].vue
@@ -8,21 +8,22 @@ definePageMeta({
})
const dataStore = useDataStore()
+const profileStore = useProfileStore()
const supabase = useSupabaseClient()
const route = useRoute()
const router = useRouter()
const toast = useToast()
-const {vendors} = storeToRefs(useDataStore())
-const {fetchVendorInvoices} = useDataStore()
+const availableDocuments = ref([])
+const setup = async () => {
+ let filetype = (await supabase.from("filetags").select().eq("tenant",profileStore.currentTenant).eq("incomingDocumentType","invoices").single()).data.id
+ console.log(filetype)
+ let ids = (await supabase.from("files").select("id").eq("tenant",profileStore.currentTenant).eq("type", filetype)).data.map(i => i.id)
+ availableDocuments.value = await useFiles().selectSomeDocuments(ids)
-const availableDocuments = computed(() => {
+}
- //console.log(dataStore.documents.filter(i => i.tags.includes('Eingangsrechnung') && !dataStore.incominginvoices.find(x => x.document === i.id)))
- //console.log(dataStore.documents.filter(i => i.tags.includes('Eingangsrechnung')).length)
-
- return dataStore.documents.filter(i => i.tags.includes('Eingangsrechnung') && !i.tags.includes("Archiviert") && !dataStore.incominginvoices.find(x => x.document === i.id))
-})
+setup()
//let currentDocument = ref(null)
@@ -56,7 +57,7 @@ const itemInfo = ref({
//Functions
const setupPage = async () => {
if((mode.value === "show" || mode.value === "edit" ) && route.params.id){
- itemInfo.value = await dataStore.getIncomingInvoiceById(Number(route.params.id))
+ itemInfo.value = await useSupabaseSelectSingle("incominginvoices",route.params.id)
//currentDocument.value = await dataStore.getDocumentById(currentVendorInvoice.value.document)
}
console.log(itemInfo.value)
diff --git a/pages/incomingInvoices/create.vue b/pages/incomingInvoices/create.vue
new file mode 100644
index 0000000..3e936ee
--- /dev/null
+++ b/pages/incomingInvoices/create.vue
@@ -0,0 +1,479 @@
+
+
+
+
+
+
+ Speichern
+
+
+
+
+
+ loadFile(documentId)"
+ />
+
+
+
+
+
+
+
+
+ Status: {{itemInfo.state}}
+ Datum: {{dayjs(itemInfo.date).format('DD.MM.YYYY')}}
+ Fälligkeitsdatum: {{dayjs(itemInfo.dueDate).format('DD.MM.YYYY')}}
+ Lieferant: {{dataStore.getVendorById(itemInfo.vendor).name}}
+ Bezahlt: {{itemInfo.paid}}
+ Beschreibung: {{itemInfo.description}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/incomingInvoices/index.vue b/pages/incomingInvoices/index.vue
index a5a424c..b648811 100644
--- a/pages/incomingInvoices/index.vue
+++ b/pages/incomingInvoices/index.vue
@@ -133,7 +133,7 @@ const isPaid = (item) => {
- + Beleg
+ + Beleg
diff --git a/pages/index.vue b/pages/index.vue
index b9e1bd3..cd4d044 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -15,48 +15,28 @@
- {{dataStore.getProfileById(time.profile).fullName}}
+
-
+
+
+
+
@@ -64,11 +44,14 @@
-
-
-
-
-
- Inventar
-
-
-
- {{itemInfo.id ? `Inventarartikel: ${itemInfo.name}` : (mode === 'create' ? 'Inventarartikel erstellen' : 'Inventarartikel bearbeiten')}}
-
-
-
-
- Archivieren
-
-
- Archivieren bestätigen
-
- Möchten Sie den Inventarartikel {{itemInfo.name}} wirklich archivieren?
-
-
- Speichern
-
-
- Erstellen
-
-
- Erstellen + Neu
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
-
-
- | Name: |
- {{itemInfo.name}} |
-
-
- | Lagerplatz: |
- {{dataStore.getSpaceById(itemInfo.currentSpace).spaceNumber}} - {{dataStore.getSpaceById(itemInfo.currentSpace).description}} |
-
-
- | Seriennummer: |
- {{itemInfo.serialNumber}} |
-
-
- | Menge: |
- {{itemInfo.quantity > 0 ? itemInfo.quantity : 'Einzelarktikel'}} |
-
-
- | Artikelnummer: |
- {{itemInfo.articleNumber}} |
-
-
- | Hersteller: |
- {{itemInfo.manufacturer}} |
-
-
- | Herstellernummer: |
- {{itemInfo.manufacturerNumber}} |
-
-
- | Lieferant: |
- {{itemInfo.vendor ? itemInfo.vendor.name : ''}} |
-
-
- | Kaufdatum: |
- {{itemInfo.purchaseDate ? dayjs(itemInfo.purchaseDate).format("DD.MM.YYYY") : ''}} |
-
-
- | Wert bei Kauf: |
- {{itemInfo.purchasePrice ? itemInfo.purchasePrice.toFixed(2).replace(".",",") + " €" : ''}} |
-
-
- | Aktueller Wert: |
- {{itemInfo.currentValue ? itemInfo.currentValue.toFixed(2).replace(".",",") + " €" : ''}} |
-
-
- | Beschreibung: |
- {{itemInfo.description}} |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- router.push(`/checks/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Überprüfungen anzuzeigen' }"
- >
-
- {{row.distance}}
- Tage
- Jahre
-
-
-
-
-
-
-
-
-
-
- Allgemeines
-
-
-
-
-
-
-
-
-
-
-
- {{option.spaceNumber}} - {{option.description}}
-
-
- {{dataStore.getSpaceById(itemInfo.currentSpace).spaceNumber }} - {{dataStore.getSpaceById(itemInfo.currentSpace).description}}
- Kein Lagerplatz ausgewählt
-
-
-
-
-
-
-
-
-
-
-
-
- Anschaffung
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- EUR
-
-
-
-
-
-
- EUR
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/inventoryitems/index.vue b/pages/inventoryitems/index.vue
deleted file mode 100644
index d100bae..0000000
--- a/pages/inventoryitems/index.vue
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Inventarartikel
-
-
-
-
-
-
-
- Spalten
-
-
-
-
-
- router.push(`/inventoryitems/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Inventarartikel anzuzeigen' }"
- >
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/login.vue b/pages/login.vue
index 9d642f0..05c6225 100644
--- a/pages/login.vue
+++ b/pages/login.vue
@@ -1,5 +1,7 @@
-
-
-
-
-
- Objekte
-
-
-
- {{itemInfo ? `Objekt: ${itemInfo.name}` : (mode === 'create' ? 'Objekt erstellen' : 'Objekt bearbeiten')}}
-
-
-
-
- Archivieren
-
-
- Archivieren bestätigen
-
- Möchten Sie das Objekt {{itemInfo.name}} wirklich archivieren?
-
-
- Speichern
-
-
- Erstellen
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
-
-
- | Kunde: |
- {{itemInfo.customer.name}} |
-
-
-
-
-
-
-
-
-
-
-
-
- + Projekt
-
-
-
- router.push(`/projects/show/${row.id}`)"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Projekte' }"
- >
-
-
-
-
-
-
-
- + Aufgabe
-
-
- router.push(`/tasks/show/${row.id}`)"
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{dataStore.customers.find(customer => customer.id === itemInfo.customer) ? dataStore.customers.find(customer => customer.id === itemInfo.customer).name : "Kunde auswählen"}}
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/plants/index.vue b/pages/plants/index.vue
deleted file mode 100644
index ab21068..0000000
--- a/pages/plants/index.vue
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Objekt
-
-
-
-
-
-
-
-
-
-
-
-
-
- Spalten
-
-
-
-
-
- router.push(`/plants/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Objekte anzuzeigen' }"
- >
-
- {{row.customer ? row.customer.name : ""}}
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/productcategories/[mode]/[[id]].vue b/pages/productcategories/[mode]/[[id]].vue
deleted file mode 100644
index b56c291..0000000
--- a/pages/productcategories/[mode]/[[id]].vue
+++ /dev/null
@@ -1,179 +0,0 @@
-
-
-
-
-
-
- Artikelkategorien
-
-
-
- {{itemInfo.name ? `Artikelkategorie: ${itemInfo.name}` : (mode === 'create' ? 'Artikelkategorie erstellen' : 'Artikelkategorie bearbeiten')}}
-
-
-
- Speichern
-
-
- Erstellen
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
-
- | Name: |
- {{itemInfo.name}} |
-
-
- | Beschreibung: |
- {{itemInfo.description}} |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/productcategories/index.vue b/pages/productcategories/index.vue
deleted file mode 100644
index fa50efc..0000000
--- a/pages/productcategories/index.vue
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Artikelkategorie
-
-
-
-
-
-
-
- Spalten
-
-
-
-
- router.push(`/productcategories/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Artikelkategorien anzuzeigen' }"
- >
-
- {{row.name}}
-
- {{row.name}}
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/products/[mode]/[[id]].vue b/pages/products/[mode]/[[id]].vue
deleted file mode 100644
index faeb1c4..0000000
--- a/pages/products/[mode]/[[id]].vue
+++ /dev/null
@@ -1,353 +0,0 @@
-
-
-
-
-
-
- Artikel
-
-
-
- {{itemInfo.name ? `Artikel: ${itemInfo.name}` : (mode === 'create' ? 'Artikel erstellen' : 'Artikel bearbeiten')}}
-
-
-
- Speichern
-
-
- Erstellen
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
- {{tag}}
-
-
-
-
-
-
-
- | Name: |
- {{itemInfo.name}} |
-
-
- | Hersteller: |
- {{itemInfo.manufacturer}} |
-
-
- | Herstellernummer: |
- {{itemInfo.manufacturerNumber}} |
-
-
- | Einheit: |
- {{units.find(i => i.id === itemInfo.unit) ? units.find(i => i.id === itemInfo.unit).name : ""}} |
-
-
- | Tags: |
- {{itemInfo.tags.join(", ")}} |
-
-
- | Artikelkategorien: |
- {{itemInfo.productcategories.map(i => productcategories.find(x => x.id === i).name).join(", ")}} |
-
-
- | EAN: |
- {{itemInfo.ean}} |
-
-
- | Verkaufspreis: |
- {{itemInfo.sellingPrice}} |
-
-
- | Beschreibung: |
- {{itemInfo.description}} |
-
-
-
-
-
-
-
-
-
-
-
-
- Bestand: {{dataStore.getStockByProductId(itemInfo.id)}} {{dataStore.units.find(unit => unit.id === itemInfo.unit) ? dataStore.units.find(unit => unit.id === itemInfo.unit).name : ""}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{dataStore.units.find(unit => unit.id === itemInfo.unit) ? dataStore.units.find(unit => unit.id === itemInfo.unit).name : itemInfo.unit }}
-
-
-
-
-
-
- {{itemInfo.tags.length > 0 ? itemInfo.tags.join(", ") : "Keine Tags ausgewählt"}}
-
-
-
-
-
-
- {{itemInfo.productcategories.length > 0 ? itemInfo.productcategories.map(i => productcategories.find(x => x.id === i).name).join(", ") : "Keine Kategorien ausgewählt"}}
-
-
-
-
-
-
-
-
-
-
- EUR
-
-
-
-
-
-
- EUR
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/products/index.vue b/pages/products/index.vue
deleted file mode 100644
index a36a8c8..0000000
--- a/pages/products/index.vue
+++ /dev/null
@@ -1,220 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Artikel
-
-
-
-
-
-
-
- Tags
-
-
-
-
-
-
- Spalten
-
-
-
-
- router.push(`/products/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Artikel anzuzeigen' }"
- >
-
- {{row.name}}
-
- {{row.name}}
-
-
-
-
- {{`${dataStore.getStockByProductId(row.id)} ${(dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : "")}`}}
-
-
- {{row.sellingPrice ? (Number(row.sellingPrice).toFixed(2) + " €").replace(".",",") : ""}}
-
-
-
- {{tag}}
-
- -
-
-
- {{dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : row.unit}}
-
-
- {{row.productcategories.map(i => productcategories.find(x => x.id === i).name).join(", ")}}
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/profiles/index.vue b/pages/profiles/index.vue
index 0f9bf3a..129399e 100644
--- a/pages/profiles/index.vue
+++ b/pages/profiles/index.vue
@@ -1,21 +1,19 @@
@@ -143,7 +151,7 @@ const isLight = computed({
Speichern
@@ -200,6 +208,39 @@ const isLight = computed({
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
Helligkeitseinstellung
Speichern
+
+
+
+
+
+
+
+
+
+
+
-import dayjs from "dayjs";
-
-
-definePageMeta({
- middleware: "auth"
-})
-
-defineShortcuts({
- 'backspace': () => {
- router.push("/projects")
- },
- 'arrowleft': () => {
- if(openTab.value > 0){
- openTab.value -= 1
- }
- },
- 'arrowright': () => {
- if(openTab.value < 3) {
- openTab.value += 1
- }
- },
-})
-
-const dataStore = useDataStore()
-const supabase = useSupabaseClient()
-const user = useSupabaseUser()
-const route = useRoute()
-const router = useRouter()
-const toast = useToast()
-const id = ref(route.params.id ? route.params.id : null )
-
-const openTab = ref(0)
-
-const tabItems = [
- {
- key: "information",
- label: "Informationen"
- },
- {
- key: "phases",
- label: "Phasen"
- },{
- key: "tasks",
- label: "Aufgaben"
- },/*{
- key: "forms",
- label: "Formulare"
- },*/{
- key: "documents",
- label: "Dokumente"
- },{
- key: "timetracking",
- label: "Zeiterfassung"
- },{
- key: "events",
- label: "Termine"
- },{
- key: "material",
- label: "Material"
- }
-]
-
-const timeTableRows = [
- {
- key:"user",
- label: "Benutzer"
- },{
- key:"start",
- label: "Start"
- },{
- key:"end",
- label:"Ende"
- },{
- key:"duration",
- label: "Dauer"
- },{
- key: "type",
- label: "Typ"
- },{
- key:"notes",
- label: "Notizen"
- },
-]
-
-
-
-//Working
-const mode = ref(route.params.mode || "show")
-const itemInfo = ref({
- name: "",
- customer: 0,
- users: [dataStore.activeProfile.id]
-})
-const oldItemInfo = ref({})
-const tags = dataStore.getDocumentTags
-const phasesTemplates = ref([])
-
-const plants = ref([])
-const contracts = ref([])
-const projecttypes = ref([])
-const disableCustomerSelection =ref(false)
-
-
-//Functions
-const setupPage = async() => {
- plants.value = await useSupabaseSelect("plants")
- contracts.value = await useSupabaseSelect("contracts")
- projecttypes.value = await useSupabaseSelect("projecttypes", "*", "id")
-
- if(mode.value === "show" ){
- itemInfo.value = await useSupabaseSelectSingle("projects",route.params.id,"*, customer(*), plant(*), createddocuments(*)")
- } else if (mode.value === "edit") {
- itemInfo.value = await useSupabaseSelectSingle("projects",route.params.id,"*")
- }
-
- if(mode.value === "create") {
- let query = route.query
-
- if(query.customer) itemInfo.value.customer = Number(query.customer)
-
- if(query.plant) {
- itemInfo.value.plant = Number(query.plant)
- itemInfo.value.customer = dataStore.getPlantById(itemInfo.value.plant).customer
- }
- }
- if(itemInfo.value) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
-
- if(!oldItemInfo.value.projecttype) {
- itemInfo.value.projecttype = projecttypes.value[0].id
- }
-
-}
-
-setupPage()
-
-const cancelEditorCreate = () => {
- if(itemInfo.value) {
- router.push(`/projects/show/${itemInfo.value.id}`)
- } else {
- router.push(`/projects/`)
- }
-}
-
-const projectHours = () => {
- let hours = 0
- dataStore.getTimesByProjectId(itemInfo.value.id).forEach(item => {
- hours += Number(dayjs(item.end).diff(item.start,'hour',true).toFixed(2))
- })
-
- return hours.toFixed(2)
-}
-
-const updateProject = async () => {
- let initialPhases = projecttypes.value.find(i => i.id === itemInfo.value.projecttype).initialPhases
-
- if(oldItemInfo.value.phases.length === 0) {
- itemInfo.value.phases = initialPhases
- }
-
- await dataStore.updateItem('projects',itemInfo.value,oldItemInfo.value)
-
-}
-
-const createProject = async () => {
- let initialPhases = projecttypes.value.find(i => i.id === itemInfo.value.projecttype).initialPhases
- await dataStore.createNewItem('projects',{...itemInfo.value, phases: initialPhases })
-}
-
-const changeActivePhase = async (key) => {
- let item = await useSupabaseSelectSingle("projects",itemInfo.value.id,'*')
-
- console.log(key)
-
- let phaseLabel = ""
-
- item.phases = item.phases.map(p => {
- if(p.active) p.active = false
-
- if(p.key === key) {
- p.active = true
- p.activated_at = dayjs().format()
- p.activated_by = dataStore.activeProfile.id
- phaseLabel = p.label
- }
-
- return p
- })
-
- console.log(item.phases)
-
- await supabase.from("projects").update({phases: item.phases}).eq("id",item.id)
- const {error} = await supabase.from("historyitems").insert({
- createdBy: dataStore.activeProfile.id,
- tenant: dataStore.currentTenant,
- text: `Aktive Phase zu "${phaseLabel}" gewechselt`,
- project: item.id
- })
- console.log(error)
-
- setupPage()
-}
-
-
-const renderedPhases = computed(() => {
-
- if(itemInfo.value.phases) {
- return itemInfo.value.phases.map((phase,index,array) => {
-
- let isAvailable = false
-
- if(phase.active) {
- isAvailable = true
- } else if(index > 0 && array[index-1].active ){
- isAvailable = true
- } else if(index > 1 && array[index-1].optional && array[index-2].active){
- isAvailable = true
- } else if(array.findIndex(i => i.active) > index) {
- isAvailable = true
- }
-
-
- return {
- ...phase,
- label: phase.optional ? `${phase.label}(optional)`: phase.label,
- disabled: !isAvailable,
- defaultOpen: phase.active ? true : false
- }
- })
- } else {
- return []
- }
-})
-
-const invoiceDeliveryNotes = () => {
- router.push(`/createDocument/edit?type=invoices&linkedDocuments=[${itemInfo.value.createddocuments.filter(i => i.type === "deliveryNotes").map(i => i.id)}]`)
-}
-
-
-
-
-
-
-
- Projekte
-
-
-
- {{itemInfo.name ? `Projekt: ${itemInfo.name}` : (mode === 'create' ? 'Projekt erstellen' : 'Projekt bearbeiten')}}
-
-
-
- Speichern
-
-
- Erstellen
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
-
- Kunde: {{itemInfo.customer.name}}
- Objekt: {{itemInfo.plant ? itemInfo.plant.name : ""}}-
- Notizen: {{itemInfo.notes}}
-
-
-
- Beteiligte Benutzer:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{item.label}}
-
-
-
-
-
-
-
-
-
-
- {{item.label}}
-
-
-
- Phase aktivieren
-
-
- {{button.label}}
-
-
-
-
- Aktiviert am: {{dayjs(item.activated_at).format("DD.MM.YY HH:mm")}} Uhr
- Aktiviert durch: {{dataStore.getProfileById(item.activated_by).fullName}}
- Beschreibung: {{item.description}}
-
-
-
-
-
-
-
-
-
-
-
-
- + Aufgabe
-
-
-
- router.push(`/tasks/show/${row.id}`)"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Aufgaben' }"
-
- >
-
- {{dataStore.profiles.find(i => i.id === row.user) ? dataStore.profiles.find(i => i.id === row.user).fullName : ""}}
-
-
-
-
-
-
-
-
-
-
-
-
- + Dokument
-
-
- Lieferscheine abrechnen
-
-
-
-
- row.state === 'Entwurf' ? router.push(`/createDocument/edit/${row.id}`) : router.push(`/createDocument/show/${row.id}`)"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen erstellten Dokumente' }"
-
- >
-
- Rechnung
- Angebot
- Lieferschein
-
-
- {{dataStore.getProfileById(row.createdBy).fullName}}
-
-
-
-
-
-
-
-
-
-
-
-
- Projekt Zeit: {{String(projectHours()).replace(".",",")}} Stunden
-
-
- {{dataStore.profiles.find(profile => profile.id === row.user) ? dataStore.profiles.find(profile => profile.id === row.user).fullName : row.user }}
-
-
- {{(row.start && row.end) ? `${String(dayjs(row.end).diff(row.start,'hour',true).toFixed(2)).replace(".",",")} h` : ""}}
-
-
- {{dayjs(row.start).format("DD.MM.YY HH:mm")}}
-
-
- {{dayjs(row.end).format("DD.MM.YY HH:mm")}}
-
-
-
-
-
-
-
-
-
-
-
- + Termin
-
-
- router.push(`/events/show/${i.id}`)"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Termine anzuzeigen' }"
- :columns="[{key:'title',label:'Titel'},{key:'start',label:'Start'},{key:'end',label:'Ende'},{key:'type',label:'Typ'},{key:'resources',label:'Resourcen'}]"
- >
-
- {{dayjs(row.start).format("DD.MM.YY HH:mm")}}
-
-
- {{dayjs(row.end).format("DD.MM.YY HH:mm")}}
-
-
- {{row.resources.map(i => i.title).join(", ")}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- i.id === itemInfo.plant).customer,
- disableCustomerSelection = true"
- >
-
- {{plants.find(i => i.id === itemInfo.plant) ? plants.find(i => i.id === itemInfo.plant).name : "Objekt auswählen"}}
-
-
-
-
- i.id === itemInfo.contract).customer,
- disableCustomerSelection = true"
- >
-
- {{contracts.find(i => i.id === itemInfo.contract) ? contracts.find(i => i.id === itemInfo.contract).name : "Vertrag auswählen"}}
-
-
-
-
-
-
-
- {{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kunde auswählen"}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{itemInfo.profiles.length > 0 ? itemInfo.profiles.map(i => dataStore.getProfileById(i).fullName).join(", ") : "Kein Benutzer ausgewählt"}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/projects/index.vue b/pages/projects/index.vue
deleted file mode 100644
index 09f3284..0000000
--- a/pages/projects/index.vue
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/servicecategories/[mode]/[[id]].vue b/pages/roles/[mode]/[[id]].vue
similarity index 63%
rename from pages/servicecategories/[mode]/[[id]].vue
rename to pages/roles/[mode]/[[id]].vue
index 3698744..73f836d 100644
--- a/pages/servicecategories/[mode]/[[id]].vue
+++ b/pages/roles/[mode]/[[id]].vue
@@ -3,7 +3,6 @@ import HistoryDisplay from "~/components/HistoryDisplay.vue";
import DocumentList from "~/components/DocumentList.vue";
import DocumentUpload from "~/components/DocumentUpload.vue";
import {useSupabaseSelect} from "~/composables/useSupabase.js";
-import dayjs from "dayjs";
definePageMeta({
middleware: "auth"
@@ -11,7 +10,7 @@ definePageMeta({
defineShortcuts({
'backspace': () => {
- router.push("/servicecategories")
+ router.push("/roles")
},
'arrowleft': () => {
if(openTab.value > 0){
@@ -26,35 +25,49 @@ defineShortcuts({
})
const dataStore = useDataStore()
+const supabase = useSupabaseClient()
const route = useRoute()
const router = useRouter()
const toast = useToast()
const id = ref(route.params.id ? route.params.id : null )
+const role = useRole()
+
//Working
const mode = ref(route.params.mode || "show")
-const itemInfo = ref({})
+const itemInfo = ref({
+ rights: []
+})
const openTab = ref(0)
//Functions
const setupPage = async () => {
if(mode.value === "show" || mode.value === "edit"){
- itemInfo.value = await useSupabaseSelectSingle("servicecategories",route.params.id,"*")
- }
-
-
-}
-
-const cancelEditorCreate = () => {
- if(itemInfo.value) {
- router.push(`/servicecategories/show/${itemInfo.value.id}`)
- } else {
- router.push(`/servicecategories/`)
+ itemInfo.value = await useSupabaseSelectSingle("roles",route.params.id,"*")
}
}
+const rightOptions = computed(() => {
+ console.log(Object.keys(useRole().generalAvailableRights.value))
+ return Object.keys(useRole().generalAvailableRights.value).map(i => {
+ return {
+ key: i,
+ label: role.generalAvailableRights.value[i].label
+ }
+ })
+})
+const rightList = computed(() => {
+ console.log(rightOptions.value)
+ return itemInfo.value.rights.map(i => {
+ if(rightOptions.value.find(x => x.key === i)) {
+ return rightOptions.value.find(x => x.key === i).label
+ } else {
+ return i
+ }
+ }).join(", ")
+})
setupPage()
@@ -67,32 +80,32 @@ setupPage()
- Leistungskategorien
+ Artikel
{{itemInfo.name ? `Leistungskategorie: ${itemInfo.name}` : (mode === 'create' ? 'Leistungskategorie erstellen' : 'Leistungskategorie bearbeiten')}}
+ >{{itemInfo.name ? `Rolle: ${itemInfo.name}` : (mode === 'create' ? 'Rolle erstellen' : 'Rolle bearbeiten')}}
Speichern
Erstellen
Bearbeiten
@@ -114,14 +127,18 @@ setupPage()
v-model="openTab"
>
-
+
- | Name: |
+ Name: |
{{itemInfo.name}} |
+
+ | Rechte: |
+ {{rightList}} |
+
| Beschreibung: |
{{itemInfo.description}} |
@@ -132,19 +149,14 @@ setupPage()
-
-
-
-
-
+
+
+
+
diff --git a/pages/roles/index.vue b/pages/roles/index.vue
new file mode 100644
index 0000000..36a1d43
--- /dev/null
+++ b/pages/roles/index.vue
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/servicecategories/index.vue b/pages/servicecategories/index.vue
deleted file mode 100644
index 6ab2eac..0000000
--- a/pages/servicecategories/index.vue
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Leistungskategorie
-
-
-
-
-
-
-
- Spalten
-
-
-
-
- router.push(`/servicecategories/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Leistungskategorien anzuzeigen' }"
- >
-
- {{row.name}}
-
- {{row.name}}
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/services/[mode]/[[id]].vue b/pages/services/[mode]/[[id]].vue
deleted file mode 100644
index e23d849..0000000
--- a/pages/services/[mode]/[[id]].vue
+++ /dev/null
@@ -1,265 +0,0 @@
-
-
-
-
-
-
- Leistungen
-
-
-
- {{itemInfo.name ? `Leistung: ${itemInfo.name}` : (mode === 'create' ? 'Leistung erstellen' : 'Leistung bearbeiten')}}
-
-
-
- Speichern
-
-
- Erstellen
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
-
- | Name: |
- {{itemInfo.name}} |
-
-
- | Leistungsnummer: |
- {{itemInfo.serviceNumber}} |
-
-
- | Verkaufpreis: |
- {{itemInfo.sellingPrice && itemInfo.sellingPrice.toFixed(2).replace(".", ",") + " €"}} |
-
-
- | Einheit: |
- {{units.find(i => i.id === itemInfo.unit) ? units.find(i => i.id === itemInfo.unit).name : itemInfo.unit}} |
-
-
- | Tags: |
- {{itemInfo.tags.join(", ")}} |
-
-
- | Leistungskategorien: |
- {{itemInfo.servicecategories ? itemInfo.servicecategories.map(i => servicecategories.find(x => x.id === i).name).join(", ") : ""}} |
-
-
- | Beschreibung: |
- {{itemInfo.description}} |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{dataStore.units.find(unit => unit.id === itemInfo.unit) ? dataStore.units.find(unit => unit.id === itemInfo.unit).name : itemInfo.unit }}
-
-
-
-
-
-
-
-
-
-
- {{itemInfo.servicecategories && itemInfo.servicecategories.length > 0 ? itemInfo.servicecategories.map(i => servicecategories.find(x => x.id === i).name).join(", ") : "Keine Kategorien ausgewählt"}}
-
-
-
-
-
-
-
- EUR
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/services/index.vue b/pages/services/index.vue
deleted file mode 100644
index 6942c6b..0000000
--- a/pages/services/index.vue
+++ /dev/null
@@ -1,153 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Leistung
-
-
-
-
-
-
-
- Spalten
-
-
-
-
-
-
- router.push(`/services/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Leistungen anzuzeigen' }"
- >
-
- {{row.name}}
-
- {{row.name}}
-
-
-
-
- {{row.sellingPrice ? Number(row.sellingPrice).toFixed(2) + " €" : ""}}
-
-
- {{dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : row.unit}}
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/settings/banking/index.vue b/pages/settings/banking/index.vue
index 346a7e2..4877adf 100644
--- a/pages/settings/banking/index.vue
+++ b/pages/settings/banking/index.vue
@@ -1,5 +1,6 @@
-
-
-
-
-
- Lagerplätze
-
-
-
- {{itemInfo ? `Lagerplatz: ${itemInfo.spaceNumber} - ${itemInfo.description}` : (mode === 'create' ? 'Lagerplatz erstellen' : 'Lagerplatz bearbeiten')}}
-
-
-
- Speichern
-
-
- Erstellen
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
-
-
-
- | Typ: |
- {{itemInfo.type}} |
-
-
- | Übergeordneter Lagerplatz: |
- {{itemInfo.parentSpace.spaceNumber}} - {{itemInfo.parentSpace.description}} |
-
-
- | Adresse: |
- {{`${itemInfo.address.streetNumber}, ${itemInfo.address.zip} ${itemInfo.address.city}`}} |
-
-
- | Beschreibung: |
- {{itemInfo.description}} |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | Artikel in diesem Lagerplatz |
- Anzahl |
- Einheit |
-
-
- | {{product.name}} |
- {{getSpaceProductCount(product.id)}} |
- {{dataStore.units.find(unit => unit.id === product.unit).name}} |
-
-
-
-
- Es befinden sich keine Artikel in diesem Lagerplatz
-
-
-
-
-
- router.push(`/inventoryitems/show/${row.id}`)"
- >
-
-
-
-
-
-
-
-
-
- Allgemeines
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Ort
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/spaces/index.vue b/pages/spaces/index.vue
deleted file mode 100644
index 159b087..0000000
--- a/pages/spaces/index.vue
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Lagerplatz
-
-
-
-
-
-
-
- Spalten
-
-
-
-
- router.push(`/spaces/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Lagerplätze anzuzeigen' }"
- >
-
- {{row.spaceNumber}}
- {{row.spaceNumber}}
-
-
- {{row.address.streetNumber ? `${row.address.streetNumber}, ${row.address.zip}${row.address.city}` : ''}}
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/standardEntity/[type]/[[mode]]/[[id]].vue b/pages/standardEntity/[type]/[[mode]]/[[id]].vue
new file mode 100644
index 0000000..2f3a565
--- /dev/null
+++ b/pages/standardEntity/[type]/[[mode]]/[[id]].vue
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/tasks/[mode]/[[id]].vue b/pages/tasks/[mode]/[[id]].vue
deleted file mode 100644
index 7b7fc3c..0000000
--- a/pages/tasks/[mode]/[[id]].vue
+++ /dev/null
@@ -1,210 +0,0 @@
-
-
-
-
-
-
- Aufgaben
-
-
-
- {{itemInfo ? `Aufgabe: ${itemInfo.name}` : (mode === 'create' ? 'Aufgabe erstellen' : 'Aufgabe bearbeiten')}}
-
-
-
-
- Speichern
-
-
- Erstellen
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
-
- Kategorie: {{itemInfo.categorie}}
- Projekt: {{dataStore.getProjectById(itemInfo.project).name}}
- Beschreibung:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{dataStore.getProfileById(itemInfo.profile) ? dataStore.getProfileById(itemInfo.profile).fullName : "Kein Benutzer ausgewählt"}}
-
-
-
-
-
-
- {{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
-
-
-
-
-
-
- {{dataStore.getPlantById(itemInfo.plant) ? dataStore.getPlantById(itemInfo.plant).name : "Kein Objekt ausgewählt"}}
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/tasks/index.vue b/pages/tasks/index.vue
deleted file mode 100644
index d0fcd03..0000000
--- a/pages/tasks/index.vue
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Aufgabe
-
-
-
-
-
-
-
-
-
-
-
-
-
- Spalten
-
-
-
-
-
- router.push(`/tasks/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Aufgaben anzuzeigen' }"
- >
-
-
-
-
- {{row.created_at ? dayjs(row.created_at).format("DD.MM.YY HH:mm") : ''}}
-
-
- {{dataStore.profiles.find(i => i.id === row.user) ? dataStore.profiles.find(i => i.id === row.user).fullName : ""}}
-
-
- {{dataStore.projects.find(i => i.id === row.project) ? dataStore.projects.find(i => i.id === row.project).name : ""}}
-
-
- {{dataStore.customers.find(customer => customer.id === row.customer) ? dataStore.customers.find(customer => customer.id === row.customer).name : "" }}
-
-
- {{dataStore.getPlantById(row.plant) ? dataStore.getPlantById(row.plant).name : "" }}
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/users/[mode]/[[id]].vue b/pages/users/[mode]/[[id]].vue
deleted file mode 100644
index a4d2b19..0000000
--- a/pages/users/[mode]/[[id]].vue
+++ /dev/null
@@ -1,452 +0,0 @@
-
-
-
-
-
-
- {{currentItem.fullName}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Speichern
-
-
-
-
-
-
- Heute
-
-
- Diese Woche
-
-
- Dieser Monat
-
-
- Dieses Jahr
-
-
- Letztes Jahr
-
-
-
- Zur Zeiterfassung
-
-
-
-
- Summe: {{getSelectionSum.sum}}
- Summe Entwurf: {{getSelectionSum.sumEntwurf}}
- Summe Eingereicht: {{getSelectionSum.sumEingereicht}}
- Summe Bestätigt: {{getSelectionSum.sumBestaetigt}}
-
-
-
-
-
- {{row.state}}
- {{row.state}}
- {{row.state}}
-
-
- {{dayjs(row.start).format("DD.MM.YY HH:mm")}}
-
-
- {{dayjs(row.end).format("HH:mm")}}
-
-
- {{dataStore.getProfileById(row.user) ? dataStore.getProfileById(row.user).fullName : ""}}
-
-
- {{ getDuration(row).composed}} Std
-
-
- {{dataStore.getProjectById(row.projectId) ? dataStore.getProjectById(row.projectId).name : ""}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
- {{itemInfo.title}}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{dataStore.customers.find(customer => customer.id === itemInfo.customer) ? dataStore.customers.find(customer => customer.id === itemInfo.customer).name : "Kunde auswählen"}}
-
-
-
-
-
-
-
-
-
-
-
-
- Speichern
-
-
-
- Abbrechen
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/users/index.vue b/pages/users/index.vue
deleted file mode 100644
index 57272df..0000000
--- a/pages/users/index.vue
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
- router.push(`/users/show/${item.id}`)"
- >
-
-
-
-
- {{dataStore.profiles}}
-
-
-
-
\ No newline at end of file
diff --git a/pages/vehicles/[mode]/[[id]].vue b/pages/vehicles/[mode]/[[id]].vue
deleted file mode 100644
index 508a917..0000000
--- a/pages/vehicles/[mode]/[[id]].vue
+++ /dev/null
@@ -1,405 +0,0 @@
-
-
-
-
-
-
- Fahrzeuge
-
-
-
- {{itemInfo ? `Fahrzeug: ${itemInfo.licensePlate}` : (mode === 'create' ? 'Fahrzeug erstellen' : 'Fahrzeug bearbeiten')}}
-
-
-
-
- Archivieren
-
-
- Archivieren bestätigen
-
- Möchten Sie das Fahrzeug {{itemInfo.name}} wirklich archivieren?
-
-
- Speichern
-
-
- Erstellen
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
-
-
- | Kennzeichen: |
- {{itemInfo.licensePlate}} |
-
-
- | Typ: |
- {{itemInfo.type}} |
-
-
- | Fahrgestellnummer: |
- {{itemInfo.vin}} |
-
-
- | Fahrer: |
- {{dataStore.profiles.find(profile => profile.id === itemInfo.driver) ? dataStore.profiles.find(profile => profile.id === itemInfo.driver).fullName : 'Kein Fahrer gewählt'}} |
-
-
- | Tankvolumen: |
- {{itemInfo.tankSize !== 0 ? `${itemInfo.tankSize} L` : "Kein Tank verbaut"}} |
-
-
- | Baujahr: |
- {{itemInfo.buildYear}} |
-
-
- | Anhänglast: |
- {{itemInfo.towingCapacity}} |
-
-
- | Farbe: |
- {{itemInfo.color}} |
-
-
- | Leistung: |
- {{itemInfo.powerInKW && itemInfo.powerInKW + " kW"}} |
-
-
-
-
-
-
-
-
-
-
- router.push('/receipts/show/' + row.id)"
- >
-
- {{dataStore.getVendorById(row.vendor) ? dataStore.getVendorById(row.vendor).name : ""}}
-
-
- {{dayjs(row.date).format("DD.MM.YYYY")}}
-
-
- {{getRowAmount(row) ? String(getRowAmount(row).toFixed(2)).replace('.',',') + " €" : ""}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- router.push(`/checks/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Überprüfungen anzuzeigen' }"
- >
-
- {{row.distance}}
- Tage
- Jahre
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{dataStore.profiles.find(profile => profile.id === itemInfo.driver) ? dataStore.profiles.find(profile => profile.id === itemInfo.driver).fullName : 'Kein Fahrer ausgewählt'}}
-
-
-
-
-
-
- L
-
-
-
-
-
-
-
-
- kg
-
-
-
-
-
-
-
- kW
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/vehicles/index.vue b/pages/vehicles/index.vue
deleted file mode 100644
index 5e06860..0000000
--- a/pages/vehicles/index.vue
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Fahrzeug
-
-
-
-
-
-
-
- Spalten
-
-
-
-
- router.push(`/vehicles/show/${i.id}`) "
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Fahrzeuge anzuzeigen' }"
- >
-
-
-
-
-
- {{row.licensePlate}}
- {{row.licensePlate}}
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/vendors/[mode]/[[id]].vue b/pages/vendors/[mode]/[[id]].vue
deleted file mode 100644
index 6e7f64a..0000000
--- a/pages/vendors/[mode]/[[id]].vue
+++ /dev/null
@@ -1,266 +0,0 @@
-
-
-
-
-
-
- Lieferanten
-
-
-
- {{currentItem ? `Lieferant: ${currentItem.name}` : (mode === 'create' ? 'Lieferant erstellen' : 'Lieferant bearbeiten')}}
-
-
-
- Speichern
-
-
- Erstellen
-
-
- Abbrechen
-
-
- Bearbeiten
-
-
-
-
-
-
-
-
-
- Straße + Hausnummer: {{currentItem.infoData.street ? currentItem.infoData.street : ""}}
- PLZ + Ort: {{currentItem.infoData.zip}} {{currentItem.infoData.city}}
- Telefon: {{currentItem.infoData.tel}}
- E-Mail: {{currentItem.infoData.email}}
- Web: {{currentItem.infoData.web}}
- USt-Id: {{currentItem.infoData.ustid}}
- Notizen: {{currentItem.notes}}
-
-
-
-
-
- + Ansprechpartner
-
-
- router.push(`/contacts/show/${row.id}`)"
- :columns="[{label: 'Anrede', key: 'salutation'},{label: 'Name', key: 'fullName'},{label: 'Rolle', key: 'role'}]"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine zugehörigen Ansprechpartner' }"
-
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/vendors/index.vue b/pages/vendors/index.vue
deleted file mode 100644
index 613ca0e..0000000
--- a/pages/vendors/index.vue
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
-
-
-
-
-
- + Lieferant
-
-
-
-
-
-
-
-
- Spalten
-
-
-
-
-
- router.push(`/vendors/show/${i.id}`)"
- :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Lieferanten anzuzeigen' }"
- >
-
- {{row.name}}
- {{row.name}}
-
-
- {{row.infoData.street ? `${row.infoData.street}, ` : ''}}{{row.infoData.special ? `${row.infoData.special},` : ''}} {{(row.infoData.zip || row.infoData.city) ? `${row.infoData.zip} ${row.infoData.city}, ` : ''}} {{row.infoData.country}}
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/workingtimes/[mode]/[[id]].vue b/pages/workingtimes/[mode]/[[id]].vue
index b7b7842..4cde3f6 100644
--- a/pages/workingtimes/[mode]/[[id]].vue
+++ b/pages/workingtimes/[mode]/[[id]].vue
@@ -3,6 +3,7 @@ import dayjs from "dayjs";
const dataStore = useDataStore()
+const profileStore = useProfileStore()
const route = useRoute()
const router = useRouter()
const toast = useToast()
@@ -12,7 +13,7 @@ const mode = ref(route.params.mode || "show")
const itemInfo = ref({
startDate: new Date(),
endDate: new Date(),
- profile: dataStore.activeProfile.id
+ profile: profileStore.activeProfile.id
})
const oldItemInfo = ref({})
@@ -88,7 +89,7 @@ setupPage()
label="Mitarbeiter:"
>
{
- if(route.params.id) itemInfo.value = dataStore.getProfileById(route.params.id)
- if(itemInfo.value.id) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
- workingtimes.value = (await supabase.from("workingtimes").select().eq("profile",itemInfo.value.id).order("startDate",{ascending:false})).data
- absencerequests.value = (await supabase.from("absencerequests").select().eq("user",itemInfo.value.id).order("start",{ascending: false})).data
-}
-
+const workingTimeInfo = ref(null)
const selectedPresetRange = ref("Dieser Monat")
const selectedStartDay = ref("")
const selectedEndDay = ref("")
+const setupPage = async () => {
+ if(route.params.id) itemInfo.value = profileStore.getProfileById(route.params.id)
+ if(itemInfo.value.id) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
+ workingtimes.value = (await supabase.from("workingtimes").select().eq("profile",itemInfo.value.id).order("startDate",{ascending:false})).data
+ absencerequests.value = (await supabase.from("absencerequests").select().eq("profile",itemInfo.value.id).order("startDate",{ascending: false})).data
+
+ await loadWorkingTimeInfo()
+
+}
+
+const loadWorkingTimeInfo = async () => {
+ workingTimeInfo.value = await useFunctions().getWorkingTimesEvaluationData(route.params.id,selectedStartDay.value,selectedEndDay.value)
+ openTab.value = 0
+}
+
+
const changeRange = () => {
let selector = "M"
let subtract = 0
@@ -67,9 +78,10 @@ const changeRange = () => {
selectedEndDay.value = dayjs().subtract(subtract,selector === "isoWeek" ? "week" : selector).endOf(selector).format("YYYY-MM-DD")
openTab.value = 0
+ loadWorkingTimeInfo()
}
-const workingTimeInfo = computed(() => {
+/*const workingTimeInfo = computed(() => {
let times = workingtimes.value
@@ -102,13 +114,13 @@ const workingTimeInfo = computed(() => {
//console.log(times.filter(i => i.approved).length)
//console.log(sumWorkingMinutesApproved)
- let recreationDays = ["2024-01-01","2024-05-01","2024-10-03","2024-10-31","2024-12-25","2024-12-26"]
+ let recreationDays = ["2025-01-01","2025-04-18","2025-04-21","2025-05-01","2025-05-29","2025-06-09","2024-10-03","2024-10-31","2024-12-25","2024-12-26"]
//Feiertagsausgleich
let sumWorkingMinutesRecreationDays = 0
let sumRecreationDays = 0
recreationDays.filter(i => dayjs(i).isSameOrAfter(selectedStartDay.value) && dayjs(i).isSameOrBefore(selectedEndDay.value)).forEach(day => {
- let compensationTime = itemInfo.value.weeklyRegularWorkingHours[dayjs(day).day()]
+ let compensationTime = itemInfo.value.weeklyRegularWorkingHours[dayjs(day).day()] || 0
sumWorkingMinutesRecreationDays += compensationTime * 60
sumRecreationDays++
})
@@ -122,18 +134,24 @@ const workingTimeInfo = computed(() => {
return dayjs(date).isSameOrAfter(start) && dayjs(date).isSameOrBefore(end)
}
- absencerequests.value.filter(i => (dayjs(i.start).isBetween(dayjs(selectedStartDay.value),dayjs(selectedEndDay.value)) || dayjs(i.end).isBetween(dayjs(selectedStartDay.value),dayjs(selectedEndDay.value)) ) && i.reason === "Urlaub" && i.approved === "Genehmigt").forEach(absenceRequest => {
+ absencerequests.value.filter(i => (dayjs(i.startDate).isBetween(dayjs(selectedStartDay.value),dayjs(selectedEndDay.value)) || dayjs(i.endDate).isBetween(dayjs(selectedStartDay.value),dayjs(selectedEndDay.value)) ) && (i.reason === "Urlaub" || i.reason === "Berufsschule") && i.approved === "Genehmigt").forEach(absenceRequest => {
let durationInDays = 0
- if(isBetween(absenceRequest.start,selectedStartDay.value,selectedEndDay.value) && isBetween(absenceRequest.end,selectedStartDay.value,selectedEndDay.value)) {
+ console.log(absenceRequest)
+
+ if(isBetween(absenceRequest.startDate,selectedStartDay.value,selectedEndDay.value) && isBetween(absenceRequest.endDate,selectedStartDay.value,selectedEndDay.value)) {
//Full in Range
- durationInDays = dayjs(absenceRequest.end).diff(absenceRequest.start, "days") + 1
- } else if(isBetween(absenceRequest.start,selectedStartDay.value,selectedEndDay.value) && !isBetween(absenceRequest.end,selectedStartDay.value,selectedEndDay.value)) {
+ console.log("Full in Range")
+ durationInDays = dayjs(absenceRequest.endDate).diff(absenceRequest.startDate, "days") + 1
+ console.log(durationInDays)
+ } else if(isBetween(absenceRequest.startDate,selectedStartDay.value,selectedEndDay.value) && !isBetween(absenceRequest.endDate,selectedStartDay.value,selectedEndDay.value)) {
//Start in Range
- durationInDays = dayjs(selectedEndDay.value).diff(absenceRequest.start, "days") + 1
- } else if(!isBetween(absenceRequest.start,selectedStartDay.value,selectedEndDay.value) && isBetween(absenceRequest.end,selectedStartDay.value,selectedEndDay.value)) {
+ console.log("Start in Range")
+ durationInDays = dayjs(selectedEndDay.value).diff(absenceRequest.startDate, "days") + 1
+ } else if(!isBetween(absenceRequest.startDate,selectedStartDay.value,selectedEndDay.value) && isBetween(absenceRequest.endDate,selectedStartDay.value,selectedEndDay.value)) {
//End in Range
- durationInDays = dayjs(absenceRequest.end).diff(selectedStartDay.value, "days") + 1
+ console.log("End in Range")
+ durationInDays = dayjs(absenceRequest.endDate).diff(selectedStartDay.value, "days") + 1
}
sumVacationDays += durationInDays
@@ -146,7 +164,7 @@ const workingTimeInfo = computed(() => {
//Saldo
let saldo = (sumWorkingMinutesApproved + sumWorkingMinutesRecreationDays +sumWorkingMinutesVacationDays - workingMinutesTarget).toFixed(2)
- let saldoInOfficial = (sumWorkingMinutesApproved + sumWorkingMinutesEingereicht + sumWorkingMinutesRecreationDays + sumWorkingMinutesVacationDays - workingMinutesTarget).toFixed(2)
+ let saldoInOfficial = (sumWorkingMinutesEingereicht + sumWorkingMinutesRecreationDays + sumWorkingMinutesVacationDays - workingMinutesTarget).toFixed(2)
return {
monthlyWorkingMinutes,
@@ -161,7 +179,7 @@ const workingTimeInfo = computed(() => {
saldoInOfficial,
times,
}
-})
+})*/
const getDuration = (time) => {
const minutes = Math.floor(dayjs(time.endDate).diff(dayjs(time.startDate),'minutes',true))
@@ -177,13 +195,13 @@ const getDuration = (time) => {
const showDocument = ref(false)
const uri = ref("")
const generateDocument = async () => {
- const ownTenant = dataStore.ownTenant
+ const ownTenant = profileStore.ownTenant
const path = ownTenant.letterheadConfig["workingTimesEvaluation"]
const {data,error} = await supabase.storage.from("files").download(path)
uri.value = await useCreateWorkingTimesPdf({
- profile: dataStore.getProfileById(route.params.id).fullName,
+ profile: profileStore.getProfileById(route.params.id).fullName,
...workingTimeInfo.value}, await data.arrayBuffer())
//alert(uri.value)
showDocument.value = true
@@ -274,7 +292,7 @@ changeRange()
/>
-
+
@@ -286,43 +304,44 @@ changeRange()
/>
-
+
-
-
-
-
-
- Zusammenfassung
-
- Eingreicht: {{Math.floor(workingTimeInfo.sumWorkingMinutesEingereicht/60)}}:{{String(workingTimeInfo.sumWorkingMinutesEingereicht % 60).padStart(2,"0")}} h
- Genehmigt: {{Math.floor(workingTimeInfo.sumWorkingMinutesApproved/60)}}:{{String(workingTimeInfo.sumWorkingMinutesApproved % 60).padStart(2,"0")}} h
- Feiertagsausgleich: {{Math.floor(workingTimeInfo.sumWorkingMinutesRecreationDays/60)}}:{{String(workingTimeInfo.sumWorkingMinutesRecreationDays % 60).padStart(2,"0")}} h / {{workingTimeInfo.sumRecreationDays}} Tage
- Urlaubsausgleich: {{Math.floor(workingTimeInfo.sumWorkingMinutesVacationDays/60)}}:{{String(workingTimeInfo.sumWorkingMinutesVacationDays % 60).padStart(2,"0")}} h / {{workingTimeInfo.sumVacationDays}} Tage
- Soll Stunden: {{Math.floor(workingTimeInfo.workingMinutesTarget/60)}}:{{String(workingTimeInfo.workingMinutesTarget % 60 ).padStart(2,"0")}} h
+
+
+
+
+
+
+ Zusammenfassung
+
+ Eingreicht: {{Math.floor(workingTimeInfo.sumWorkingMinutesEingereicht/60)}}:{{String(workingTimeInfo.sumWorkingMinutesEingereicht % 60).padStart(2,"0")}} h
+ Genehmigt: {{Math.floor(workingTimeInfo.sumWorkingMinutesApproved/60)}}:{{String(workingTimeInfo.sumWorkingMinutesApproved % 60).padStart(2,"0")}} h
+ Feiertagsausgleich: {{Math.floor(workingTimeInfo.sumWorkingMinutesRecreationDays/60)}}:{{String(workingTimeInfo.sumWorkingMinutesRecreationDays % 60).padStart(2,"0")}} h / {{workingTimeInfo.sumRecreationDays}} Tage
+ Urlaubs-/Berufsschulausgleich: {{Math.floor(workingTimeInfo.sumWorkingMinutesVacationDays/60)}}:{{String(workingTimeInfo.sumWorkingMinutesVacationDays % 60).padStart(2,"0")}} h / {{workingTimeInfo.sumVacationDays}} Tage
+ Soll Stunden: {{Math.floor(workingTimeInfo.workingMinutesTarget/60)}}:{{String(workingTimeInfo.workingMinutesTarget % 60 ).padStart(2,"0")}} h
-
- Inoffizielles Saldo: {{Math.sign(workingTimeInfo.saldoInOfficial) === 1 ? "" : "-"}}{{Math.floor(Math.abs(workingTimeInfo.saldoInOfficial/60))}}:{{String(Math.abs(workingTimeInfo.saldoInOfficial) % 60).padStart(2,"0")}} h
- Saldo: {{Math.sign(workingTimeInfo.saldo) === 1 ? "" : "-"}}{{Math.floor(Math.abs(workingTimeInfo.saldo/60))}}:{{String(Math.abs(workingTimeInfo.saldo) % 60).padStart(2,"0")}} h
-
+ Ausgleich:
+ -->
+ Inoffizielles Saldo(eingereichte Stunden): {{Math.sign(workingTimeInfo.saldoInOfficial) === 1 ? "" : "-"}}{{Math.floor(Math.abs(workingTimeInfo.saldoInOfficial/60))}}:{{String(Math.abs(workingTimeInfo.saldoInOfficial) % 60).padStart(2,"0")}} h
+ Saldo(genehmigte Stunden): {{Math.sign(workingTimeInfo.saldo) === 1 ? "" : "-"}}{{Math.floor(Math.abs(workingTimeInfo.saldo/60))}}:{{String(Math.abs(workingTimeInfo.saldo) % 60).padStart(2,"0")}} h
+
-
- router.push(`/workingtimes/edit/${row.id}`)"
- :columns="[
+
+ router.push(`/workingtimes/edit/${row.id}`)"
+ :columns="[
{
key: 'state',
label: 'Status'
@@ -343,45 +362,40 @@ changeRange()
label: 'Notizen'
}
]"
- >
-
- {{dataStore.profiles.find(profile => profile.id === row.profile) ? dataStore.profiles.find(profile => profile.id === row.profile).fullName : row.profile }}
-
-
- Ja
- Nein
-
+ >
+
+ {{profileStore.profiles.find(profile => profile.id === row.profile) ? profileStore.profiles.find(profile => profile.id === row.profile).fullName : row.profile }}
+
+
+ Ja
+ Nein
+
+
+
+ {{dayjs(row.startDate).format("HH:mm DD.MM.YY")}} Uhr
+
+
+ {{dayjs(row.endDate).format("HH:mm DD.MM.YY")}} Uhr
+
+
+ {{getDuration(row).composed}}
+
+
+
+
-
- {{dayjs(row.startDate).format("HH:mm DD.MM.YY")}} Uhr
-
-
- {{dayjs(row.endDate).format("HH:mm DD.MM.YY")}} Uhr
-
-
- {{getDuration(row).composed}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/pages/workingtimes/index.vue b/pages/workingtimes/index.vue
index 9256000..ff0870e 100644
--- a/pages/workingtimes/index.vue
+++ b/pages/workingtimes/index.vue
@@ -9,20 +9,14 @@ definePageMeta({
})
const dataStore = useDataStore()
+const profileStore = useProfileStore()
const supabase = useSupabaseClient()
-const user = useSupabaseUser()
-const toast = useToast()
const router = useRouter()
-const timeInfo = ref({
- profile: "",
- start: "",
- end: null,
- notes: null,
-})
-const filterUser = ref(dataStore.activeProfile.id || "")
+
+const filterUser = ref(profileStore.activeProfile.id || "")
const workingtimes = ref([])
@@ -43,15 +37,6 @@ const filteredRows = computed(() => {
times = times.filter(i => i.profile === filterUser.value)
- /*if(dataStore.hasRight('viewTimes')) {
- if(filterUser.value !== "") {
- times = times.filter(i => i.profile === filterUser.value)
- }
- } else if(dataStore.hasRight('viewOwnTimes')) {
- times = times.filter(i => i.profile === dataStore.getOwnProfile.id)
- } else {
- times = []
- }*/
return times/*.map(i => {
return {
@@ -115,55 +100,9 @@ const columns = [
}
]
-console.log(dataStore.workingtimes)
-const runningTimeInfo = ref({})
-const startTime = async () => {
- console.log("started")
- timeInfo.value = {
- profile: dataStore.activeProfile.id,
- startDate: dayjs(),
- tenant: dataStore.currentTenant,
- state: "Im Web gestartet"
- }
- const {data,error} = await supabase
- .from("workingtimes")
- .insert([timeInfo.value])
- .select()
- if(error) {
- console.log(error)
- } else if(data) {
- //timeInfo.value = data[0]
- await dataStore.fetchWorkingTimes()
- runningTimeInfo.value = timeInfo.value//dataStore.times.find(time => time.profile === dataStore.activeProfile.id && !time.endDate)
- }
-}
-
-const stopStartedTime = async () => {
- runningTimeInfo.value.endDate = dayjs()
- runningTimeInfo.value.state = "Im Web gestoppt"
-
- const {data,error} = await supabase
- .from("workingtimes")
- .update(runningTimeInfo.value)
- .eq('id',runningTimeInfo.value.id)
- .select()
- console.log(data)
-
- if(error) {
- console.log(error)
- } else {
- toast.add({title: "Zeit erfolgreich gestoppt"})
- runningTimeInfo.value = {}
- dataStore.fetchWorkingTimes()
- }
-}
-
-if(dataStore.workingtimes.find(time => time.profile === dataStore.activeProfile.id && !time.endDate)) {
- runningTimeInfo.value = dataStore.workingtimes.find(time => time.profile === dataStore.activeProfile.id && !time.end)
-}
const getDuration = (time) => {
const minutes = Math.floor(dayjs(time.endDate).diff(dayjs(time.startDate),'minutes',true))
@@ -194,17 +133,19 @@ const expand = ref({
row: {}
})
+const setEndDate = (row) => {
+ row.startDate = dayjs(row.startDate).toISOString()
+
+ row.endDate = dayjs(row.endDate).set("year", dayjs(row.startDate).get("year")).set("month", dayjs(row.startDate).get("month")).set("date", dayjs(row.startDate).get("date"))
+
+ row.endDate = dayjs(row.endDate).toISOString()
+}
+
-
- Start
-
@@ -216,14 +157,14 @@ const expand = ref({
- {{dataStore.getProfileById(filterUser) ? dataStore.getProfileById(filterUser).fullName : "Kein Benutzer ausgewählt"}}
+ {{profileStore.getProfileById(filterUser) ? profileStore.getProfileById(filterUser).fullName : "Kein Benutzer ausgewählt"}}
-
-
-
- Start: {{dayjs(runningTimeInfo.startDate).format("HH:mm")}}
- Dauer: {{dayjs().diff(dayjs(runningTimeInfo.startDate),'minutes') > 59 ? `${Math.floor(dayjs().diff(dayjs(runningTimeInfo.startDate),'minutes') / 60)}:${dayjs().diff(dayjs(runningTimeInfo.startDate),'minutes') % 60} h` : dayjs().diff(dayjs(runningTimeInfo.startDate),'minutes') + ' min' }}
-
-
-
-
-
- Stop
-
-
-
-
-
-
-
+
@@ -337,7 +248,7 @@ const expand = ref({
- Mitarbeitende/r: {{dataStore.getProfileById(row.profile).fullName}}
+ Mitarbeitende/r: {{profileStore.getProfileById(row.profile).fullName}}
Start: {{dayjs(row.startDate).format("DD.MM.YYYY HH:mm")}}
Ende: {{dayjs(row.endDate).format("DD.MM.YYYY HH:mm")}}
Genehmigt: {{row.approved ? "Ja" : "Nein"}}
@@ -345,7 +256,7 @@ const expand = ref({
- {{dataStore.profiles.find(profile => profile.id === row.profile) ? dataStore.profiles.find(profile => profile.id === row.profile).fullName : row.profile }}
+ {{profileStore.profiles.find(profile => profile.id === row.profile) ? profileStore.profiles.find(profile => profile.id === row.profile).fullName : row.profile }}
Ja
diff --git a/stores/data.js b/stores/data.js
index bcbbeb0..92b93c2 100644
--- a/stores/data.js
+++ b/stores/data.js
@@ -7,13 +7,40 @@ import {useNumberRange} from "~/composables/useNumberRange.js";
import projecttype from "~/components/columnRenderings/projecttype.vue"
import customer from "~/components/columnRenderings/customer.vue"
+import contact from "~/components/columnRenderings/contact.vue"
import plant from "~/components/columnRenderings/plant.vue"
+import vendor from "~/components/columnRenderings/vendor.vue"
+import active from "~/components/columnRenderings/active.vue"
+import sellingPrice from "~/components/columnRenderings/sellingPrice.vue";
+import unit from "~/components/columnRenderings/unit.vue";
+import isCompany from "~/components/columnRenderings/isCompany.vue"
+import address from "~/components/columnRenderings/address.vue"
+import sepa from "~/components/columnRenderings/sepa.vue"
+import recurring from "~/components/columnRenderings/recurring.vue"
+import description from "~/components/columnRenderings/description.vue"
+import purchasePrice from "~/components/columnRenderings/purchasePrice.vue";
+import project from "~/components/columnRenderings/project.vue";
+import created_at from "~/components/columnRenderings/created_at.vue";
+import profile from "~/components/columnRenderings/profile.vue";
+import profiles from "~/components/columnRenderings/profiles.vue";
+import vehicle from "~/components/columnRenderings/vehicle.vue"
+import usePlanning from "~/components/columnRenderings/usePlanning.vue"
+import sellingPriceComposedMaterial from "~/components/columnRenderings/sellingPriceComposedMaterial.vue"
+import sellingPriceComposedWorker from "~/components/columnRenderings/sellingPriceComposedWorker.vue"
+import sellingPriceComposedTotal from "~/components/columnRenderings/sellingPriceComposedTotal.vue"
+import startDate from "~/components/columnRenderings/startDate.vue"
+import endDate from "~/components/columnRenderings/endDate.vue"
+import serviceCategories from "~/components/columnRenderings/serviceCategories.vue"
+
+import quantity from "~/components/helpRenderings/quantity.vue"
+import {useZipCheck} from "~/composables/useZipCheck.js";
+import {useFunctions} from "~/composables/useFunctions.js";
// @ts-ignore
export const useDataStore = defineStore('data', () => {
const supabase = useSupabaseClient()
- const user = useSupabaseUser()
+ const profileStore = useProfileStore()
const toast = useToast()
const router = useRouter()
@@ -21,52 +48,689 @@ export const useDataStore = defineStore('data', () => {
tasks: {
label: "Aufgaben",
labelSingle: "Aufgabe",
+ isStandardEntity: true,
redirect: true,
- historyItemHolder: "task"
+ historyItemHolder: "task",
+ supabaseSelectWithInformation: "*, plant(*), project(*), customer(*)",
+ filters: [
+ {
+ name: "Nur Offene Aufgaben",
+ default: true,
+ "filterFunction": function (row) {
+ if(row.categorie !== "Erledigt") {
+ return true
+ } else {
+ return false
+ }
+ }
+ },{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }
+ ],
+ templateColumns: [
+ {
+ key: "created_at",
+ label: "Erstellt am",
+ component: created_at,
+ },{
+ key: "name",
+ label: "Name",
+ title: true,
+ inputType: "text"
+ },{
+ key: "categorie",
+ label: "Kategorie"
+ },{
+ key: "profile",
+ label: "Mitarbeiter",
+ component: profile,
+ inputType: "select",
+ selectDataType: "profiles",
+ selectOptionAttribute: "fullName",
+ selectSearchAttributes: ['fullName'],
+ },{
+ key: "project",
+ label: "Projekt",
+ component: project,
+ inputType: "select",
+ selectDataType: "projects",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },{
+ key: "customer",
+ label: "Kunde",
+ component: customer,
+ inputType: "select",
+ selectDataType: "customers",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },{
+ key: "plant",
+ label: "Objekt",
+ component: plant,
+ inputType: "select",
+ selectDataType: "plants",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },{
+ key: "description",
+ label: "Beschreibung"
+ },
+ ],
+ showTabs: [{label: 'Informationen'}]
},
customers: {
label: "Kunden",
labelSingle: "Kunde",
+ isStandardEntity: true,
redirect:true,
numberRangeHolder: "customerNumber",
- historyItemHolder: "customer"
+ historyItemHolder: "customer",
+ supabaseSortColumn: "customerNumber",
+ supabaseSelectWithInformation: "*, projects(*), plants(*), contracts(*), contacts(*), createddocuments(*), files(*)",
+ filters: [{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: 'customerNumber',
+ label: "Kundennummer",
+ inputIsNumberRange: true,
+ inputType: "text"
+ }, {
+ key: "name",
+ label: "Name",
+ title: true,
+ inputType: "text"
+ }, {
+ key: "isCompany",
+ label: "Firmenkunde",
+ component: isCompany,
+ inputType: "bool"
+ },{
+ key: "active",
+ label: "Aktiv",
+ component: active,
+ inputType: "bool"
+ }, {
+ key: "customPaymentDays",
+ label: "Zahlungsziel in Tagen",
+ inputType: "number"
+ }, {
+ key: "infoData.street",
+ label: "Straße + Hausnummer",
+ inputType: "text",
+ disabledInTable: true
+ },
+ {
+ key: "infoData.special",
+ label: "Adresszusatz",
+ inputType: "text",
+ disabledInTable: true
+ },
+ {
+ key: "infoData.zip",
+ label: "Postleitzahl",
+ inputType: "number",
+ inputChangeFunction: async function (row) {
+ if(row.infoData.zip) {
+ row.infoData.city = (await useZipCheck(row.infoData.zip))
+ }
+ },
+ disabledInTable: true
+ },
+ {
+ key: "infoData.city",
+ label: "Stadt",
+ inputType: "text",
+ disabledInTable: true
+ },
+ {
+ key: "infoData.country",
+ label: "Land",
+ inputType: "select",
+ selectDataType: "countrys",
+ selectOptionAttribute: "name",
+ selectValueAttribute: "name",
+ disabledInTable: true
+ },
+ {
+ key: "address",
+ label: "Adresse",
+ component: address
+ },
+ {
+ key: "infoData.tel",
+ label: "Telefon",
+ inputType: "text"
+ },
+ {
+ key: "infoData.email",
+ label: "E-Mail",
+ inputType: "text"
+ },
+ {
+ key: "infoData.web",
+ label: "Web",
+ inputType: "text"
+ },
+ {
+ key: "infoData.ustid",
+ label: "USt-Id",
+ inputType: "text"
+ },
+ {
+ key: "notes",
+ label: "Notizen",
+ inputType: "textarea"
+ },
+ {
+ key: "profiles",
+ label: "Berechtigte Benutzer",
+ inputType: "select",
+ selectDataType: "profiles",
+ selectOptionAttribute: "fullName",
+ selectSearchAttributes: ['fullName'],
+ selectMultiple: true,
+ component: profiles
+ },
+ ],
+ showTabs: [{label: 'Informationen'},{label: 'Ansprechpartner'},{label: 'Dateien'},{label: 'Ausgangsbelege'},{label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}]
},
contacts: {
label: "Kontakte",
labelSingle: "Kontakt",
+ isStandardEntity: true,
redirect:true,
- historyItemHolder: "contact"
+ historyItemHolder: "contact",
+ supabaseSelectWithInformation: "*, customer(*), vendor(*)",
+ filters: [{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: "fullName",
+ label: "Name",
+ title: true,
+ },{
+ key: "salutation",
+ label: "Anrede",
+ inputType: "text",
+ },{
+ key: "firstName",
+ label: "Vorname",
+ inputType: "text",
+ inputChangeFunction: function (row) {
+ row.fullName = `${row.firstName} ${row.lastName}`
+ }
+ },{
+ key: "lastName",
+ label: "Nachname",
+ inputType: "text",
+ inputChangeFunction: function (row) {
+ row.fullName = `${row.firstName} ${row.lastName}`
+ }
+ },
+ {
+ key: "active",
+ label: "Aktiv",
+ component: active,
+ inputType: "bool"
+ },
+ {
+ key: "customer",
+ label: "Kunde",
+ component: customer,
+ inputType: "select",
+ selectDataType: "customers",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },
+ {
+ key: "vendor",
+ label: "Lieferant",
+ component: vendor,
+ inputType: "select",
+ selectDataType: "vendors",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },
+ {
+ key: "role",
+ label: "Rolle",
+ inputType: "text"
+ },
+ {
+ key: "email",
+ label: "E-Mail",
+ inputType: "text",
+ },
+ {
+ key: "phoneMobile",
+ label: "Mobil",
+ inputType: "text",
+ },
+ {
+ key: "phoneHome",
+ label: "Festnetz",
+ inputType: "text",
+ },
+ {
+ key: "birthday",
+ label: "Geburtstag",
+ inputType: "date",
+ },
+ {
+ key: "notes",
+ label: "Notizen",
+ inputType: "textarea",
+ },
+ ],
+ showTabs:[
+ {
+ label: 'Informationen',
+ }
+ ]
},
contracts: {
label: "Verträge",
labelSingle: "Vertrag",
- redirect:true
+ isStandardEntity: true,
+ redirect:true,
+ filters:[{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ inputColumns: [
+ "Allgemeines",
+ "Abrechnung"
+ ],
+ supabaseSelectWithInformation: "*, customer(*), files(*)",
+ templateColumns: [
+ {
+ key: "name",
+ label: "Name",
+ title: true,
+ inputType: "text",
+ inputColumn: "Allgemeines"
+ },{
+ key: "active",
+ label: "Aktiv",
+ component: active,
+ inputType: "bool",
+ inputColumn: "Allgemeines"
+ },{
+ key: "recurring",
+ label: "Wiederkehrend",
+ component: recurring,
+ inputType: "bool",
+ inputColumn: "Allgemeines"
+ },{
+ key: 'customer',
+ label: "Kunde",
+ component: customer,
+ inputType: "select",
+ selectDataType: "customers",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ inputColumn: "Allgemeines"
+ },{
+ key: 'contact',
+ label: "Ansprechpartner",
+ component: contact,
+ inputType: "select",
+ selectDataType: "contacts",
+ selectDataTypeFilter: function (i,item) {
+ return i.customer === item.customer
+ },
+ selectOptionAttribute: "fullName",
+ selectSearchAttributes: ['fullName'],
+ inputColumn: "Allgemeines"
+ },{
+ key: 'duration',
+ label: "mindest Vertragslaufzeit",
+ inputType: "select",
+ selectValueAttribute:"label",
+ selectManualOptions: [
+ {label:'12 Monate'},
+ {label:'24 Monate'},
+ {label:'36 Monate'},
+ {label:'48 Monate'},
+ ],
+ inputColumn: "Allgemeines"
+ },{
+ key: 'invoiceDispatch',
+ label: "Rechnungsversand",
+ inputType: "select",
+ selectValueAttribute: "label",
+ selectManualOptions: [
+ {label:'E-Mail'},
+ {label:'Post'}
+ ],
+ inputColumn: "Abrechnung"
+ },{
+ key: 'paymentType',
+ label: "Zahlungsart",
+ inputType: "select",
+ 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",
+ }
+ ],
+ showTabs: [{label: 'Informationen'},{label: 'Dateien'}]
},
absencerequests: {
label: "Abwesenheitsanträge",
labelSingle: "Abwesenheitsantrag",
- redirect:true
+ isStandardEntity: true,
+ supabaseSelectWithInformation: "*",
+ historyItemHolder: "absencerequest",
+ redirect:true,
+ filters:[{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns:[
+ {
+ key: "approved",
+ label: "Genehmigt",
+ inputType: "select",
+ selectValueAttribute: "label",
+ selectManualOptions: [
+ {label:"Offen"},
+ {label:"Genehmigt"},
+ {label:"Abgelehnt"}
+ ]
+ },{
+ key: "name",
+ label: "Name",
+ inputType: "text",
+ title: true
+ },
+ {
+ key: "profile",
+ label: "Mitarbeiter",
+ inputType: "select",
+ selectDataType: "profiles",
+ selectOptionAttribute: "fullName",
+ selectSearchAttributes: ['fullName'],
+ component: profile
+ },{
+ key: "reason",
+ label: "Grund",
+ inputType: "select",
+ selectValueAttribute: "label",
+ selectManualOptions: [
+ {label:"Urlaub"},
+ {label:"Berufsschule"},
+ {label:"unbezahlter Urlaub"},
+ {label:"Überstundenausgleich"},
+ {label:"Sonderurlaub(bezahlt)"},
+ {label:"Mutterschutz"},
+ {label:"Krankheit ab 2. Tag (mit Attest)"},
+ {label:"Krankheit 1 Tag (mit Attest)"},
+ {label:"Krankheit"},
+ {label:"Kind krank - Kinderbetreuung"},
+ {label:"Elternzeit"},
+ ]
+ },{
+ key: "startDate",
+ label: "Start",
+ inputType: "date",
+ component: startDate
+ },{
+ key: "endDate",
+ label: "Ende",
+ inputType: "date",
+ component: endDate
+ },{
+ key: "note",
+ label: "Notizen",
+ inputType: "textarea"
+ }
+ ],
+ showTabs: [{label: 'Informationen'}]
},
plants: {
label: "Objekte",
labelSingle: "Objekt",
+ isStandardEntity: true,
redirect:true,
- historyItemHolder: "plant"
+ historyItemHolder: "plant",
+ supabaseSelectWithInformation: "*, customer(id,name)",
+ filters: [{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: "name",
+ label: "Name",
+ inputType: "text",
+ title: true
+ },
+ {
+ key: "customer",
+ label: "Kunde",
+ component: customer,
+ inputType: "select",
+ selectDataType: "customers",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },{
+ key: "description",
+ label: "Beschreibung",
+ inputType:"editor",
+ component: description
+ },
+ ],
+ showTabs: [
+ {
+ label: "Informationen"
+ },{
+ label: "Projekte"
+ },{
+ label: "Aufgaben"
+ },{
+ label: "Dateien"
+ }]
},
products: {
label: "Artikel",
labelSingle: "Artikel",
- redirect:true
+ isStandardEntity: true,
+ redirect:true,
+ supabaseSelectWithInformation: "*, unit(name)",
+ historyItemHolder: "product",
+ filters: [{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: "name",
+ label:"Name",
+ title: true,
+ inputType: "text"
+ },
+ {
+ key: "manufacturer",
+ label: "Hersteller",
+ inputType: "text"
+ },
+ {
+ key: "unit",
+ label: "Einheit",
+ component: unit,
+ inputType: "select",
+ selectDataType: "units",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },
+ {
+ key: "purchasePrice",
+ label: "Einkaufspreis",
+ component: purchasePrice,
+ inputType: "number",
+ inputTrailing: "EUR"
+ },{
+ key: "sellingPrice",
+ label: "Verkaufpreispreis",
+ component: sellingPrice,
+ inputType: "number",
+ inputTrailing: "EUR"
+ },{
+ 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",
+ label: "Tags"
+ },*/
+ {
+ key: "productcategories",
+ label: "Artikelkategorien",
+ inputType: "select",
+ selectDataType: "productcategories",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ selectMultiple: true
+ },
+ {
+ key: "description",
+ label: "Beschreibung",
+ inputType:"textarea"
+ },
+ ],
+ showTabs: [
+ {
+ label: "Informationen"
+ }
+ ]
},
projects: {
label: "Projekte",
labelSingle: "Projekt",
+ isStandardEntity: true,
redirect:true,
historyItemHolder: "project",
numberRangeHolder: "projectNumber",
+ supabaseSelectWithInformation: "*, customer(id,name), plant(id,name), projecttype(name, id), tasks(*), files(*), createddocuments(*)",
+ supabaseSortColumn: "projectNumber",
filters: [
{
- name: "Abgeschlossen",
+ name: "Nur Offene Projekte",
default: true,
"filterFunction": function (row) {
if(row.phases && row.phases.length > 0) {
@@ -76,6 +740,16 @@ export const useDataStore = defineStore('data', () => {
}
}
+ }, {
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
}
],
templateColumns: [
@@ -86,45 +760,312 @@ export const useDataStore = defineStore('data', () => {
{
key: "projecttype",
label: "Typ",
- component: projecttype
+ component: projecttype,
+ inputType: "select",
+ selectDataType: "projecttypes",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ inputChangeFunction: function (item,loadedOptions = {}) {
+ item.phases = loadedOptions.projecttypes.find(i => i.id === item.projecttype).initialPhases
+ }
},{
key: "phase",
label: "Phase"
},{
key: "name",
- label: "Name"
+ label: "Name",
+ title: true,
+ inputType: "text"
},
{
key: "customer",
label: "Kunde",
- component: customer
- },
- {
- key: "notes",
- label: "Notizen",
- },
- {
+ component: customer,
+ inputType: "select",
+ selectDataType: "customers",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },{
key: "plant",
label: "Objekt",
- component: plant
+ component: plant,
+ inputType: "select",
+ selectDataType: "plants",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },{
+ key: "customerRef",
+ label: "Referenz des Kunden",
+ inputType: "text"
+ },{
+ key: "notes",
+ label: "Notizen",
+ inputType: "textarea"
},
{
key: "profiles",
- label: "Benutzer"
- }]
+ label: "Berechtigte Benutzer",
+ inputType: "select",
+ selectDataType: "profiles",
+ selectOptionAttribute: "fullName",
+ selectSearchAttributes: ['fullName'],
+ selectMultiple: true,
+ component: profiles
+ },],
+ showTabs: [
+ {
+ key: "information",
+ label: "Informationen"
+ },
+ {
+ key: "phases",
+ label: "Phasen"
+ },{
+ key: "tasks",
+ label: "Aufgaben"
+ },{
+ key: "files",
+ label: "Dateien"
+ },{
+ label: "Ausgangsbelege"
+ }/*,{
+ key: "timetracking",
+ label: "Zeiterfassung"
+ },{
+ key: "events",
+ label: "Termine"
+ },{
+ key: "material",
+ label: "Material"
+ }*/]
},
vehicles: {
label: "Fahrzeuge",
labelSingle: "Fahrzeug",
+ isStandardEntity: true,
redirect:true,
- historyItemHolder: "vehicle"
+ historyItemHolder: "vehicle",
+ supabaseSelectWithInformation: "*, checks(*), files(*)",
+ filters:[{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns:[
+ {
+ key: 'active',
+ label: "Aktiv",
+ component: active,
+ inputType: "bool"
+ },{
+ key: 'licensePlate',
+ label: "Kennzeichen",
+ inputType: "text",
+ title: true
+ },{
+ key: 'vin',
+ label: "Identifikationnummer",
+ inputType: "text"
+ },
+ {
+ key: "type",
+ label: "Typ",
+ inputType: "text"
+ },
+ {
+ key: "driver",
+ label: "Fahrer",
+ inputType: "select",
+ selectDataType: "profiles",
+ selectOptionAttribute: "fullName"
+ },
+ {
+ key: "tankSize",
+ label: "Tankvolumen",
+ unit: "L",
+ inputType: "number"
+ },
+ {
+ key: "buildYear",
+ label: "Baujahr",
+ inputType: "number"
+ },
+ {
+ key: "towingCapacity",
+ label: "Anhängelast",
+ unit: "Kg",
+ inputType: "number"
+ },
+ {
+ key: "color",
+ label: "Farbe",
+ inputType: "text"
+ },
+ {
+ key: "powerInKW",
+ label: "Leistung",
+ unit: "kW",
+ inputType: "number"
+ },
+ {
+ key: "profiles",
+ label: "Berechtigte Benutzer",
+ inputType: "select",
+ selectDataType: "profiles",
+ selectOptionAttribute: "fullName",
+ selectSearchAttributes: ['fullName'],
+ selectMultiple: true,
+ component: profiles
+ },
+ ],
+ showTabs: [
+ {
+ label: 'Informationen',
+ }, {
+ label: 'Dateien',
+ }, {
+ label: 'Überprüfungen',
+ }
+ ]
},
vendors: {
label: "Lieferanten",
labelSingle: "Lieferant",
+ isStandardEntity: true,
redirect:true,
numberRangeHolder: "vendorNumber",
- historyItemHolder: "vendor"
+ historyItemHolder: "vendor",
+ supabaseSortColumn: "vendorNumber",
+ supabaseSelectWithInformation: "*, contacts(*)",
+ filters: [{
+ name: "SEPA nicht erteilt",
+ "filterFunction": function (row) {
+ return !row.hasSEPA
+ },
+ },{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: 'vendorNumber',
+ label: "Lieferantennummer",
+ inputType: "text",
+ inputIsNumberRange: true
+ },
+ {
+ key: "name",
+ label: "Name",
+ title: true,
+ inputType: "text"
+ },
+ {
+ key: "infoData.streetNumber",
+ label: "Straße + Hausnummer",
+ inputType: "text",
+ disabledInTable: true
+ },
+ {
+ key: "infoData.special",
+ label: "Adresszusatz",
+ inputType: "text",
+ disabledInTable: true
+ },
+ {
+ key: "infoData.zip",
+ label: "Postleitzahl",
+ inputType: "number",
+ disabledInTable: true,
+ inputChangeFunction: async function (row) {
+ if(row.infoData.zip) {
+ row.infoData.city = (await useZipCheck(row.infoData.zip))
+ }
+ },
+ },
+ {
+ key: "infoData.city",
+ label: "Stadt",
+ inputType: "text",
+ disabledInTable: true
+ },
+ {
+ key: "infoData.country",
+ label: "Land",
+ inputType: "select",
+ selectDataType: "countrys",
+ selectOptionAttribute: "name",
+ selectValueAttribute: "name",
+ disabledInTable: true
+ },
+ {
+ key: "address",
+ label: "Adresse",
+ component: address
+ },
+ {
+ key: "infoData.tel",
+ label: "Telefon",
+ inputType: "text"
+ },
+ {
+ key: "infoData.email",
+ label: "E-Mail",
+ inputType: "text"
+ },
+ {
+ key: "infoData.web",
+ label: "Web",
+ inputType: "text"
+ },
+ {
+ key: "infoData.ustid",
+ label: "USt-Id",
+ inputType: "text"
+ },
+ {
+ key: "hasSEPA",
+ label: "SEPA Mandat erteilt",
+ inputType: "bool",
+ component: sepa
+ },
+ {
+ key: "notes",
+ label: "Notizen",
+ inputType: "textarea"
+ },
+ {
+ key: "profiles",
+ label: "Berechtigte Benutzer",
+ inputType: "select",
+ selectDataType: "profiles",
+ selectOptionAttribute: "fullName",
+ selectSearchAttributes: ['fullName'],
+ selectMultiple: true,
+ component: profiles
+ },
+ ],
+ showTabs: [
+ {
+ label: 'Informationen',
+ },{
+ label: 'Ansprechpartner',
+ }, {
+ label: 'Dateien',
+ }
+ ]
},
messages: {
label: "Nachrichten",
@@ -133,9 +1074,126 @@ export const useDataStore = defineStore('data', () => {
spaces: {
label: "Lagerplätze",
labelSingle: "Lagerplatz",
+ isStandardEntity: true,
+ supabaseSelectWithInformation: "*, files(*)",
+ supabaseSortColumn: "spaceNumber",
redirect: true,
numberRangeHolder: "spaceNumber",
- historyItemHolder: "space"
+ historyItemHolder: "space",
+ filters:[{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ inputColumns: [
+ "Allgemeines",
+ "Ort"
+ ],
+ templateColumns: [
+ {
+ key: "name",
+ label: "Name",
+ inputType: "text",
+ title: true,
+ inputColumn: "Allgemeines"
+ },
+ {
+ key: 'spaceNumber',
+ label: "Lagerplatznr.",
+ inputType: "text",
+ inputIsNumberRange: true,
+ inputColumn: "Allgemeines"
+ },
+ {
+ key: "type",
+ label: "Typ",
+ inputType: "select",
+ selectValueAttribute: "label",
+ selectManualOptions: [
+ {label:"Standort"},
+ {label:"Regalplatz"},
+ {label:"Kiste"},
+ {label:"Palettenplatz"},
+ {label:"Sonstiges"}
+ ],
+ inputColumn: "Allgemeines"
+ },
+ {
+ key: "parentSpace",
+ label: "Übergeordneter Lagerplatz",
+ inputType: "select",
+ selectDataType: "spaces",
+ selectOptionAttribute: "spaceNumber",
+ selectValueAttribute: "id",
+ inputColumn: "Allgemeines"
+ },
+ {
+ key: "infoData.streetNumber",
+ label: "Straße + Hausnummer",
+ inputType: "text",
+ disabledInTable: true,
+ inputColumn: "Ort"
+ },
+ {
+ key: "infoData.special",
+ label: "Adresszusatz",
+ inputType: "text",
+ disabledInTable: true,
+ inputColumn: "Ort"
+ },
+ {
+ key: "infoData.zip",
+ label: "Postleitzahl",
+ inputType: "number",
+ disabledInTable: true,
+ inputColumn: "Ort",
+ inputChangeFunction: async function (row) {
+ if(row.infoData.zip) {
+ row.infoData.city = (await useZipCheck(row.infoData.zip))
+ }
+ },
+ },
+ {
+ key: "infoData.city",
+ label: "Stadt",
+ inputType: "text",
+ disabledInTable: true,
+ inputColumn: "Ort"
+ },
+ {
+ key: "infoData.country",
+ label: "Land",
+ inputType: "select",
+ selectDataType: "countrys",
+ selectOptionAttribute: "name",
+ selectValueAttribute: "name",
+ disabledInTable: true,
+ inputColumn: "Ort"
+ },
+ {
+ key: "address",
+ label: "Adresse",
+ component: address
+ },
+ {
+ key: "description",
+ label: "Beschreibung",
+ inputType: "textarea",
+ }
+ ],
+ showTabs: [
+ {
+ label: 'Informationen',
+ }, {
+ label: 'Dateien',
+ },{label: 'Inventarartikel'}
+ ]
},
users: {
label: "Benutzer",
@@ -153,19 +1211,320 @@ export const useDataStore = defineStore('data', () => {
inventoryitems: {
label: "Inventarartikel",
labelSingle: "Inventarartikel",
+ isStandardEntity: true,
+ supabaseSelectWithInformation: "*, files(*), vendor(id,name), currentSpace(id,name)",
redirect: true,
- numberRangeHolder: "articleNumber"
+ numberRangeHolder: "articleNumber",
+ inputColumns: [
+ "Allgemeines",
+ "Anschaffung"
+ ],
+ filters:[{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: "name",
+ label: "Name",
+ title: true,
+ inputType: "text",
+ inputColumn: "Allgemeines"
+ },
+ {
+ key: "usePlanning",
+ label: "In Plantafel anzeigen",
+ inputType: "bool",
+ inputColumn: "Allgemeines",
+ component: usePlanning
+ },
+ {
+ key: "description",
+ label: "Beschreibung",
+ inputType: "textarea",
+ },
+ {
+ key: "currentSpace",
+ label: "Aktueller Lagerplatz",
+ inputType: "select",
+ selectDataType: "spaces",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ inputColumn: "Allgemeines"
+ },
+ {
+ key: "articleNumber",
+ label: "Artikelnummer",
+ inputType: "text",
+ inputIsNumberRange: true,
+ inputColumn: "Allgemeines"
+ },
+ {
+ key: "serialNumber",
+ label: "Seriennummer",
+ inputType: "text",
+ inputColumn: "Allgemeines"
+ },
+ {
+ key: "purchaseDate",
+ label: "Kaufdatum",
+ inputType: "date",
+ inputColumn: "Anschaffung"
+ },
+ {
+ key: "vendor",
+ label: "Lieferant",
+ inputType: "select",
+ selectDataType: "vendors",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ inputColumn: "Anschaffung"
+ },
+ {
+ key: "quantity",
+ label: "Menge",
+ inputType: "number",
+ inputColumn: "Allgemeines",
+ disabledFunction: function (item) {
+ return item.serialNumber
+ },
+ helpComponent: quantity
+ },
+ {
+ key: "purchasePrice",
+ label: "Kaufpreis",
+ inputType: "number",
+ inputStepSize: "0.01",
+ inputColumn: "Anschaffung"
+ },
+ {
+ key: "manufacturer",
+ label: "Hersteller",
+ inputType: "text",
+ inputColumn: "Anschaffung"
+ },
+ {
+ key: "manufacturerNumber",
+ label: "Herstellernummer",
+ inputType: "text",
+ inputColumn: "Anschaffung"
+ },
+ {
+ key: "profiles",
+ label: "Berechtigte Benutzer",
+ inputType: "select",
+ selectDataType: "profiles",
+ selectOptionAttribute: "fullName",
+ selectSearchAttributes: ['fullName'],
+ selectMultiple: true,
+ component: profiles
+ },
+ {
+ key: "currentValue",
+ label: "Aktueller Wert",
+ inputType: "number",
+ inputStepSize: "0.01",
+ inputColumn: "Anschaffung"
+ },
+
+ ],
+ showTabs: [
+ {
+ label: 'Informationen',
+ }, {
+ label: 'Dateien',
+ }
+ ]
},
services: {
label: "Leistungen",
labelSingle: "Leistung",
- redirect: true
+ isStandardEntity: true,
+ redirect: true,
+ supabaseSelectWithInformation: "*, unit(*)",
+ historyItemHolder: "service",
+ filters: [{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: "name",
+ label: "Name",
+ title: true,
+ inputType: "text"
+ },
+ {
+ key: "unit",
+ label: "Einheit",
+ component: unit,
+ inputType: "select",
+ selectDataType: "units",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },
+ {
+ key: "sellingPrice",
+ label: "Verkaufspreis",
+ component: sellingPrice,
+ },
+ {
+ key: "servicecategories",
+ label: "Leistungskategorien",
+ inputType: "select",
+ selectDataType: "servicecategories",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ selectMultiple: true,
+ component: serviceCategories
+ },
+ {
+ key: "sellingPriceComposed.worker",
+ label: "Verkaufspreis Personal pro Einheit",
+ inputType: "number",
+ inputTrailing: "EUR",
+ inputChangeFunction: function (row) {
+ if(row.sellingPriceComposed.worker) {
+ row.sellingPriceComposed.total = row.sellingPriceComposed.worker + (row.sellingPriceComposed.material || 0)
+ row.sellingPrice = row.sellingPriceComposed.total
+ }
+ },
+ component: sellingPriceComposedWorker
+ },
+ {
+ key: "sellingPriceComposed.material",
+ label: "Verkaufspreis Material pro Einheit",
+ inputType: "number",
+ inputTrailing: "EUR",
+ inputChangeFunction: function (row) {
+ if(row.sellingPriceComposed.material) {
+ row.sellingPriceComposed.total = (row.sellingPriceComposed.worker || 0) + row.sellingPriceComposed.material
+ row.sellingPrice = row.sellingPriceComposed.total
+ }
+ },
+ component: sellingPriceComposedMaterial
+ },
+ {
+ key: "materialComposing",
+ label: "Zusammensetzung Materialpreis pro Einheit",
+ inputType: "materialComposing",
+ },
+ {
+ key: "sellingPriceComposed.total",
+ label: "Verkaufspreis Gesamt pro Einheit",
+ inputType: "number",
+ inputTrailing: "EUR",
+ /*disabledFunction: function (item) {
+ return item.sellingPriceComposed.worker || item.sellingPriceComposed.material
+ },*/
+ inputChangeFunction: function (row) {
+ if(row.sellingPriceComposed.worker) {
+ row.sellingPriceComposed.material = row.sellingPriceComposed.total - row.sellingPriceComposed.worker
+ } else if(row.sellingPriceComposed.material) {
+ row.sellingPriceComposed.worker = row.sellingPriceComposed.total - row.sellingPriceComposed.material
+ }
+ },
+ component: sellingPriceComposedTotal
+ },
+
+
+ {
+ key: "description",
+ label: "Beschreibung",
+ inputType:"textarea"
+ },
+ ],
+ showTabs: [
+ {
+ label: 'Informationen',
+ }
+ ]
},
events: {
label: "Termine",
labelSingle: "Termin",
+ isStandardEntity: true,
historyItemHolder: "event",
- redirect: true
+ supabaseSelectWithInformation: "*, project(id,name), vehicles(*), inventoryitems(*)",
+ redirect: true,
+ filters:[{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: 'name',
+ label: "Name",
+ title: true,
+ inputType: "text"
+ },
+ {
+ key: "startDate",
+ label: "Start",
+ inputType: "datetime",
+ },
+ {
+ key: "endDate",
+ label: "Ende",
+ inputType: "datetime",
+ },/*{
+ key: "eventtype",
+ label: "Typ",
+ inputType: "select",
+ selectManualOptions: ["Umsetzung","Vor Ort Termin", "Büro", "Sonstiges"],
+ },*/{
+ key: "link",
+ label: "Link",
+ inputType: "text"
+ },{
+ key: "notes",
+ label: "Notizen",
+ inputType: "textarea"
+ },
+ {
+ key: "project",
+ label: "Projekt",
+ component: project,
+ inputType: "select",
+ selectDataType: "projects",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },{
+ key: "profiles",
+ label: "Beteiligte Benutzer",
+ inputType: "select",
+ selectDataType: "profiles",
+ selectOptionAttribute: "fullName",
+ selectSearchAttributes: ['fullName'],
+ selectMultiple: true,
+ component: profiles
+ },
+ ],
+ showTabs: [
+ {
+ label: 'Informationen',}
+ ]
},
profiles: {
label: "Mitarbeiter",
@@ -195,12 +1554,74 @@ export const useDataStore = defineStore('data', () => {
productcategories: {
label: "Artikelkategorien",
labelSingle: "Artikelkategorie",
- redirect: true
+ isStandardEntity: true,
+ redirect: true,
+ supabaseSelectWithInformation: "*",
+ filters: [{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: "name",
+ label: "Name",
+ title: true,
+ inputType: "text"
+ },
+ {
+ key: "description",
+ label: "Beschreibung",
+ inputType: "textarea"
+ }
+ ],
+ showTabs: [
+ {
+ label: 'Informationen',
+ }
+ ]
},
servicecategories: {
- label: "Leistungskategorie",
- labelSingle: "Leistungskategorien",
- redirect: true
+ label: "Leistungskategorien",
+ labelSingle: "Leistungskategorie",
+ isStandardEntity: true,
+ redirect: true,
+ supabaseSelectWithInformation: "*",
+ filters: [{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: "name",
+ label: "Name",
+ title: true,
+ inputType: "text"
+ },
+ {
+ key: "description",
+ label: "Beschreibung",
+ inputType: "textarea"
+ }
+ ],
+ showTabs: [
+ {
+ label: 'Informationen',
+ }
+ ]
},
trackingtrips: {
label: "Fahrten",
@@ -217,9 +1638,81 @@ export const useDataStore = defineStore('data', () => {
checks: {
label: "Überprüfungen",
labelSingle: "Überprüfung",
+ isStandardEntity: true,
+ supabaseSelectWithInformation: "*, vehicle(id,licensePlate), profile(id, fullName), inventoryitem(name), files(*)",
redirect: true,
- historyItemHolder: "check"
- }
+ historyItemHolder: "check",
+ filters: [{
+ name: "Archivierte ausblenden",
+ default: true,
+ "filterFunction": function (row) {
+ if(!row.archived) {
+ return true
+ } else {
+ return false
+ }
+ }
+ }],
+ templateColumns: [
+ {
+ key: "name",
+ label: "Name",
+ title: true,
+ inputType: "text"
+ },
+ {
+ key: "vehicle",
+ label: "Fahrzeug",
+ component: vehicle,
+ inputType: "select",
+ selectDataType: "vehicles",
+ selectOptionAttribute: "licensePlate",
+ selectSearchAttributes: ['licensePlate'],
+ },
+ {
+ key: "profile",
+ label: "Person",
+ component: profile,
+ inputType: "select",
+ selectDataType: "profiles",
+ selectOptionAttribute: "fullName",
+ selectSearchAttributes: ['fullName'],
+ },
+ {
+ key: "inventoryitem",
+ label: "Inventarartikel",
+ inputType: "select",
+ selectDataType: "inventoryitems",
+ selectOptionAttribute: "name",
+ selectSearchAttributes: ['name'],
+ },
+ {
+ key: "description",
+ label: "Beschreibung",
+ inputType: "textarea"
+ }
+ ],
+ showTabs: [
+ {
+ label: 'Informationen',
+ }, {label: 'Dateien'}, {label: 'Ausführungen'}]
+ },
+ roles: {
+ label: "Rollen",
+ labelSingle: "Rolle",
+ redirect:true,
+ historyItemHolder: "role",
+ filters: [],
+ templateColumns: [
+ {
+ key: "name",
+ label: "Name"
+ }, {
+ key: "description",
+ label: "Beschreibung"
+ }
+ ]
+ },
}
const documentTypesForCreation = ref({
@@ -236,6 +1729,10 @@ export const useDataStore = defineStore('data', () => {
label: "Abschlagsrechnungen",
labelSingle: "Abschlagsrechnung"
},
+ cancellationInvoices: {
+ label: "Stornorechnungen",
+ labelSingle: "Stornorechnung"
+ },
quotes: {
label: "Angebote",
labelSingle: "Angebot"
@@ -251,28 +1748,6 @@ export const useDataStore = defineStore('data', () => {
})
- const loaded = ref(false)
- const showProfileSelection = ref(false)
- const ownTenant = ref({
- calendarConfig: {
- eventTypes: []
- },
- timeConfig: {
- timeTypes: []
- },
- tags: {
- documents: [] ,
- products: []
- },
- measures: []
- })
-
-
- const profiles = ref([])
- const ownProfiles = ref([])
- const activeProfile = ref([])
- const tenants = ref([])
- const currentTenant = ref(null)
const events = ref([])
const customers = ref([])
const tasks = ref([])
@@ -294,13 +1769,10 @@ export const useDataStore = defineStore('data', () => {
const bankstatements = ref([])
const bankrequisitions = ref([])
const historyItems = ref([])
- const numberRanges = ref([])
const notifications = ref([])
- const absencerequests = ref([])
const accounts = ref([])
const taxTypes = ref([])
const plants = ref([])
- const inventoryitems = ref([])
const chats = ref([])
const messages = ref([])
const createddocuments = ref([])
@@ -308,130 +1780,10 @@ export const useDataStore = defineStore('data', () => {
const phasesTemplates = ref([])
const emailAccounts = ref([])
const texttemplates =ref([])
- const services =ref([])
- const servicecategories =ref([])
const resources =ref([])
-
- const rights = ref({
- createUser: {label: "Benutzer erstellen"},
- modifyUser: {label: "Benutzer bearbeiten"},
- deactivateUser: {label: "Benutzer sperren"},
- createProject: {label: "Projekt erstellen"},
- viewOwnProjects: {label: "Eigene Projekte sehen"},
- viewAllProjects: {label: "Alle Projekte sehen"},
- createTask: {label: "Aufgabe erstellen"},
- viewOwnTasks: {label:"Eigene Aufgaben sehen"},
- viewAllTasks: {label: "Alle Aufgaben sehen"},
- trackOwnTime: {label:"Eigene Zeite erfassen"},
- createOwnTime: {label:"Eigene Zeiten erstellen"},
- createTime: {label:"Zeiten erstellen"},
- viewOwnTimes: {label:"Eigene Zeiten anzeigen"},
- viewTimes: {label:"Zeiten anzeigen"},
- })
-
- const roles = ref([
- {
- key: "tenantAdmin",
- label: "Firmenadministrator",
- rights: [
- ...Object.keys(rights.value)
- ]
- },
- {
- key:"worker",
- label: "Monteur",
- rights: [
- "viewOwnProjects",
- "createTasks",
- "viewOwnTasks",
- "viewOwnTimes",
- "createOwnTime"
- ]
- },
- {
- key:"manager",
- label: "Vorarbeiter",
- rights: [
- "createProjects",
- "viewOwnProjects",
- "createTasks",
- "viewOwnTasks",
- ]
- },
- {
- key:"booker",
- label: "Buchhalter",
- rights: [
- "createTasks",
- "viewOwnTasks",
- "createTime",
- "viewAllTimes"
- ]
- }
- ])
-
- async function initializeData (userId) {
-
- let profileconnections = (await supabase.from("profileconnections").select()).data
- let profiles = (await supabase.from("profiles").select()).data
- let activeProfileConnection = profileconnections.find(i => i.active)
- if(activeProfileConnection) {
- activeProfile.value = profiles.find(i => i.id === activeProfileConnection.profile_id)
- currentTenant.value = activeProfile.value.tenant
-
- await fetchData()
-
- //loaded.value = true
-
- } else {
- await fetchOwnProfiles()
- await fetchTenants()
- showProfileSelection.value = true
- }
-
-
- }
-
- async function changeProfile(newActiveProfileId) {
- loaded.value = false
-
- let profileconnections = (await supabase.from("profileconnections").select()).data
-
- let oldActiveProfileConnection = profileconnections.find(i => i.active)
-
- const {error} = await supabase.from("profileconnections").update({active: true}).eq("profile_id", newActiveProfileId)
-
- if(error) {
- console.log(error)
- } else {
- if(oldActiveProfileConnection){
- const {error} = await supabase.from("profileconnections").update({active: false}).eq("profile_id", oldActiveProfileConnection.profile_id)
- }
-
- reloadNuxtApp({
- path:"/",
- ttl: 10000
- })
-
- /*await clearStore()
- await fetchData()
- router.push("/")
- loaded.value = true*/
-
-
- }
- }
-
async function fetchData () {
- await fetchOwnProfiles()
- await fetchProfiles()
-
- await fetchTenants()
- await fetchOwnTenant()
-
- //loaded.value = true
- await fetchDocuments()
+ await fetchDocuments()
await fetchEvents()
await fetchTasks()
await fetchProjects()
@@ -452,13 +1804,10 @@ export const useDataStore = defineStore('data', () => {
await fetchBankStatements()
await fetchBankRequisitions()
await fetchHistoryItems()
- await fetchNumberRanges()
await fetchNotifications()
- await fetchAbsenceRequests()
await fetchAccounts()
await fetchTaxTypes()
await fetchPlants()
- await fetchInventoryItems()
await fetchChats()
await fetchMessages()
await fetchCreatedDocuments()
@@ -466,21 +1815,10 @@ export const useDataStore = defineStore('data', () => {
await fetchPhasesTemplates()
await fetchEmailAccounts()
await fetchTextTemplates()
- await fetchServices()
- await fetchServiceCategories()
await fetchResources()
- loaded.value = true
-
-
}
function clearStore () {
- console.log("Clear")
- loaded.value = false
- ownTenant.value = {}
- profiles.value = []
- ownProfiles.value = []
- tenants.value = []
events.value= []
customers.value= []
tasks.value= []
@@ -502,13 +1840,10 @@ export const useDataStore = defineStore('data', () => {
bankstatements.value= []
bankrequisitions.value= []
historyItems.value = []
- numberRanges.value = []
notifications.value = []
- absencerequests.value = []
accounts.value = []
taxTypes.value = []
plants.value = []
- inventoryitems.value = []
chats.value = []
messages.value = []
createddocuments.value = []
@@ -516,21 +1851,9 @@ export const useDataStore = defineStore('data', () => {
phasesTemplates.value = []
emailAccounts.value = []
texttemplates.value = []
- services.value = []
- servicecategories.value = []
resources.value = []
}
- function hasRight (right) {
- const role = profiles.value.find(i => i.id === activeProfile.value.id).role
- const grantedRights = roles.value.find(i => i.key === role).rights
-
- if(grantedRights.includes(right)){
- return true
- } else return false
-
- }
-
var deepDiffMapper = function () {
return {
VALUE_CREATED: 'created',
@@ -605,8 +1928,6 @@ export const useDataStore = defineStore('data', () => {
}
}();
-
-
const generateHistoryItems = async (dataType,newData, oldData=null) => {
//console.log(oldData)
//console.log(newData)
@@ -720,6 +2041,8 @@ export const useDataStore = defineStore('data', () => {
name = "Nachname"
} else if(key === "name") {
name = "Name"
+ } else if(key === "approved") {
+ name = "Genehmigt"
} else if(key === "customer") {
name = "Kunde"
if(prop.data.o) oldVal = customers.value.find(i => i.id === prop.data.o).name
@@ -735,8 +2058,8 @@ export const useDataStore = defineStore('data', () => {
name = "Kategorie"
} else if(key === "profile") {
name = "Mitarbeiter"
- if(prop.data.o) oldVal = profiles.value.find(i => i.id === prop.data.o).fullName
- if(prop.data.n) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
+ if(prop.data.o) oldVal = profileStore.profiles.find(i => i.id === prop.data.o).fullName
+ if(prop.data.n) newVal = profileStore.profiles.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
@@ -749,18 +2072,24 @@ export const useDataStore = defineStore('data', () => {
name = "Wöchentliche Arbeitstage"
} else if(key === "weeklyWorkingHours") {
name = "Wöchentliche Arbeitszeit"
+ } else if(key === "customerRef") {
+ name = "Referenz des Kunden"
} else if(key === "licensePlate") {
name = "Kennzeichen"
+ }else if(key === "tankSize") {
+ name = "Tankvolumen"
}else if(key === "towingCapacity") {
name = "Anhängelast"
}else if(key === "color") {
name = "Farbe"
+ }else if(key === "customPaymentDays") {
+ name = "Zahlungsziel in Tagen"
}else if(key === "powerInKW") {
name = "Leistung"
} else if(key === "driver") {
name = "Fahrer"
- if(prop.data.o) oldVal = profiles.value.find(i => i.id === prop.data.o).fullName
- if(prop.data.n) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
+ if(prop.data.o) oldVal = profileStore.profiles.find(i => i.id === prop.data.o).fullName
+ if(prop.data.n) newVal = profileStore.profiles.find(i => i.id === prop.data.n).fullName
} else if(key === "projecttype") {
name = "Projekttyp"
@@ -793,10 +2122,10 @@ export const useDataStore = defineStore('data', () => {
let historyItem = {
text: text,
- createdBy: activeProfile.value.id,
+ createdBy: profileStore.activeProfile.id,
oldVal: prop.data.o,
newVal: prop.data.n,
- tenant: currentTenant.value
+ tenant: profileStore.currentTenant
}
historyItem[dataTypes[dataType].historyItemHolder] = newData.id
@@ -829,8 +2158,8 @@ export const useDataStore = defineStore('data', () => {
} else {
let historyItem = {
text: `${dataTypes[dataType].labelSingle} erstellt`,
- createdBy: activeProfile.value.id,
- tenant: currentTenant.value
+ createdBy: profileStore.activeProfile.id,
+ tenant: profileStore.currentTenant
}
historyItem[dataTypes[dataType].historyItemHolder] = newData.id
@@ -849,50 +2178,23 @@ export const useDataStore = defineStore('data', () => {
}
}
-
- //Realtime Update
- /*const channelA = supabase
- .channel('schema-db-changes')
- .on(
- 'postgres_changes',
- {
- event: '*',
- schema: 'public',
- },
- (payload) => {
- //console.log(payload)
-
- /!*if(payload.eventType === 'INSERT') {
- const c = payload.table + '.value.push(' + JSON.stringify(payload.new) + ')'
- eval(c)
- } else if(payload.eventType === 'UPDATE'){
- const c = payload.table + '.value[' + payload.table + '.value.findIndex(i => i.id === ' + JSON.stringify(payload.old.id) + ')] = ' + JSON.stringify(payload.new)
- eval(c)
- }*!/
- }
- )
- .subscribe()*/
-
async function createNewItem (dataType,data){
if(typeOf(data) === 'object') {
- data = {...data, tenant: currentTenant.value}
+ data = {...data, tenant: profileStore.currentTenant}
} else if(typeOf(data) === 'array') {
data.map(i => {
return {
...i,
- tenant: currentTenant.value
+ tenant: profileStore.currentTenant
}
})
}
-
-
console.log(dataType)
if(dataTypes[dataType].numberRangeHolder) {
- const numberRange = useNumberRange(dataType)
if(!data[dataTypes[dataType].numberRangeHolder]) {
- data[dataTypes[dataType].numberRangeHolder] = await numberRange.useNextNumber()
+ data[dataTypes[dataType].numberRangeHolder] = await useFunctions().useNextNumber(dataType)
}
@@ -923,16 +2225,26 @@ export const useDataStore = defineStore('data', () => {
console.log(supabaseError)
toast.add({title: "Es ist ein Fehler bei der Erstellung aufgetreten", color: "rose"})
} else if (supabaseData) {
- //console.log(supabaseData)
+ console.log(supabaseData)
+
+ let returnData = supabaseData[0]
+
await generateHistoryItems(dataType, supabaseData[0])
- if(!["statementallocations", "productcategories", "projecttypes", "checks"].includes(dataType) ){
+ if(!["statementallocations","absencerequests", "productcategories", "servicecategories", "projecttypes", "checks", "profiles","services", "inventoryitems", "incominginvoices"].includes(dataType) ){
await eval( dataType + '.value.push(' + JSON.stringify(...supabaseData) + ')')
}
toast.add({title: `${dataTypes[dataType].labelSingle} hinzugefügt`})
- if(dataTypes[dataType].redirect) await router.push(`/${dataType}/show/${supabaseData[0].id}`)
+ if(dataTypes[dataType].redirect) {
+ if(dataTypes[dataType].isStandardEntity) {
+ await router.push(dataTypes[dataType].redirectToList ? `/standardEntity/${dataType}` : `/standardEntity/${dataType}/show/${returnData.id}`)
+ } else {
+ await router.push(dataTypes[dataType].redirectToList ? `/${dataType}` : `/${dataType}/show/${returnData.id}`)
+ }
+ }
+
return supabaseData
}
}
@@ -983,52 +2295,74 @@ export const useDataStore = defineStore('data', () => {
toast.add({title: `Fehler beim Speichern`, color: 'rose'})
} else if(supabaseData) {
//await eval(dataType + '.value[' + dataType + '.value.findIndex(i => i.id === ' + JSON.stringify(data.id) + ')] = ' + JSON.stringify(supabaseData[0]))
- if(dataType === 'profiles') await fetchProfiles()
+ //if(dataType === 'profiles') await fetchProfiles()
toast.add({title: `${dataTypes[dataType].labelSingle} gespeichert`})
- if(dataTypes[dataType].redirect) await router.push(dataTypes[dataType].redirectToList ? `/${dataType}` : `/${dataType}/show/${data.id}`)
+ if(dataTypes[dataType].redirect) {
+ if(dataTypes[dataType].isStandardEntity) {
+ await router.push(dataTypes[dataType].redirectToList ? `/standardEntity/${dataType}` : `/standardEntity/${dataType}/show/${data.id}`)
+ } else {
+ await router.push(dataTypes[dataType].redirectToList ? `/${dataType}` : `/${dataType}/show/${data.id}`)
+ }
+ }
return supabaseData
}
}
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(`${currentTenant.value}/${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: currentTenant.value})
}
-
- //console.log(data)
}
- //uploadInProgress.value = true
-
-
if(files.length === 1) {
await uploadSingleFile(files[0])
} else if( files.length > 1) {
@@ -1038,116 +2372,71 @@ 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 fetchOwnTenant () {
- ownTenant.value = (await supabase.from("tenants").select().eq('id', currentTenant.value).single()).data
- }
-
- async function fetchProfiles () {
- profiles.value = (await supabase.from("profiles").select().eq("tenant",currentTenant.value).order("lastName")).data
- }
-
- async function fetchOwnProfiles () {
- let profiles = (await supabase.from("profiles").select().order("fullName")).data
- let conns = (await supabase.from("profileconnections").select()).data.map(i => i.profile_id)
- //console.log(conns)
- //console.log(profiles.filter(i => conns.includes(i.id)))
- ownProfiles.value = profiles.filter(i => conns.includes(i.id))
- }
-
- async function fetchTenants () {
- tenants.value = (await supabase.from("tenants").select()).data
}
async function fetchBankAccounts () {
- bankAccounts.value = (await supabase.from("bankaccounts").select().eq('tenant', currentTenant.value)).data
+ bankAccounts.value = (await supabase.from("bankaccounts").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchBankStatements () {
- bankstatements.value = (await supabase.from("bankstatements").select().eq('tenant', currentTenant.value).order("date", {ascending:false})).data
+ bankstatements.value = (await supabase.from("bankstatements").select().eq('tenant', profileStore.currentTenant).order("date", {ascending:false})).data
}
async function fetchBankRequisitions () {
bankrequisitions.value = (await supabase.from("bankrequisitions").select().eq('status', "LN")).data
}
async function fetchEvents () {
- events.value = (await supabase.from("events").select().eq('tenant', currentTenant.value)).data
+ events.value = (await supabase.from("events").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchContracts () {
- contracts.value = (await supabase.from("contracts").select().eq('tenant', currentTenant.value)).data
+ contracts.value = (await supabase.from("contracts").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchContacts () {
- contacts.value = (await supabase.from("contacts").select().eq('tenant', currentTenant.value)).data
+ contacts.value = (await supabase.from("contacts").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchCustomers () {
- customers.value = (await supabase.from("customers").select().eq('tenant', currentTenant.value).order("customerNumber", {ascending:true})).data
+ customers.value = (await supabase.from("customers").select().eq('tenant', profileStore.currentTenant).order("customerNumber", {ascending:true})).data
}
async function fetchTasks () {
- tasks.value = (await supabase.from("tasks").select().eq('tenant', currentTenant.value)).data
+ tasks.value = (await supabase.from("tasks").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchForms () {
- forms.value = (await supabase.from("forms").select().eq('tenant', currentTenant.value)).data
+ forms.value = (await supabase.from("forms").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchFormSubmits () {
- formSubmits.value = (await supabase.from("formSubmits").select().eq('tenant', currentTenant.value)).data
+ formSubmits.value = (await supabase.from("formSubmits").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchProducts () {
- products.value = (await supabase.from("products").select().eq('tenant', currentTenant.value)).data
+ products.value = (await supabase.from("products").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchUnits () {
units.value = (await supabase.from("units").select()).data
}
async function fetchProjects () {
- projects.value = (await supabase.from("projects").select().eq("tenant",currentTenant.value)).data
+ projects.value = (await supabase.from("projects").select().eq("tenant",profileStore.currentTenant)).data
}
async function fetchSpaces () {
- spaces.value = (await supabase.from("spaces").select().eq('tenant', currentTenant.value).order("spaceNumber", {ascending:true})).data
+ spaces.value = (await supabase.from("spaces").select().eq('tenant', profileStore.currentTenant).order("spaceNumber", {ascending:true})).data
}
async function fetchMovements () {
- movements.value = (await supabase.from("movements").select().eq('tenant', currentTenant.value)).data
+ movements.value = (await supabase.from("movements").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchVehicles () {
- vehicles.value = (await supabase.from("vehicles").select().eq('tenant', currentTenant.value)).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', currentTenant.value).order("start", {ascending:false})).data
+ times.value = (await supabase.from("times").select().eq('tenant', profileStore.currentTenant).order("startDate", {ascending:false})).data
}
async function fetchHistoryItems () {
- historyItems.value = (await supabase.from("historyitems").select().eq('tenant', currentTenant.value)).data
+ historyItems.value = (await supabase.from("historyitems").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchVendors () {
- vendors.value = (await supabase.from("vendors").select().eq('tenant', currentTenant.value).order("vendorNumber", {ascending:true})).data
+ vendors.value = (await supabase.from("vendors").select().eq('tenant', profileStore.currentTenant).order("vendorNumber", {ascending:true})).data
}
async function fetchIncomingInvoices () {
- 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
+ incominginvoices.value = (await supabase.from("incominginvoices").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchNotifications () {
- notifications.value = (await supabase.from("notifications").select().eq('tenant', currentTenant.value).order("created_at", {ascending: false})).data
- }
- async function fetchAbsenceRequests () {
- absencerequests.value = (await supabase.from("absencerequests").select().eq('tenant', currentTenant.value)).data
+ notifications.value = (await supabase.from("notifications").select().eq('tenant', profileStore.currentTenant).order("created_at", {ascending: false})).data
}
async function fetchAccounts () {
accounts.value = (await supabase.from("accounts").select()).data
@@ -1156,51 +2445,40 @@ export const useDataStore = defineStore('data', () => {
taxTypes.value = (await supabase.from("taxtypes").select()).data
}
async function fetchPlants () {
- plants.value = (await supabase.from("plants").select().eq('tenant', currentTenant.value)).data
- }
- async function fetchInventoryItems () {
- inventoryitems.value = (await supabase.from("inventoryitems").select().eq('tenant', currentTenant.value)).data
+ plants.value = (await supabase.from("plants").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchChats() {
chats.value = (await supabase.from("chats").select()).data
}
async function fetchMessages() {
- messages.value = (await supabase.from("messages").select().eq('tenant', currentTenant.value).order('created_at', {ascending:true})).data
+ messages.value = (await supabase.from("messages").select().eq('tenant', profileStore.currentTenant).order('created_at', {ascending:true})).data
}
async function fetchCreatedDocuments() {
- createddocuments.value = (await supabase.from("createddocuments").select().eq('tenant', currentTenant.value).order('created_at', {ascending:true})).data
+ createddocuments.value = (await supabase.from("createddocuments").select().eq('tenant', profileStore.currentTenant).order('created_at', {ascending:true})).data
}
async function fetchWorkingTimes() {
- workingtimes.value = (await supabase.from("workingtimes").select().eq('tenant', currentTenant.value).order('created_at', {ascending:true})).data
+ workingtimes.value = (await supabase.from("workingtimes").select().eq('tenant', profileStore.currentTenant).order('created_at', {ascending:true})).data
}
async function fetchPhasesTemplates() {
- phasesTemplates.value = (await supabase.from("phasesTemplates").select().eq('tenant', currentTenant.value).order('created_at', {ascending:true})).data
+ phasesTemplates.value = (await supabase.from("phasesTemplates").select().eq('tenant', profileStore.currentTenant).order('created_at', {ascending:true})).data
}
async function fetchEmailAccounts() {
- emailAccounts.value = (await supabase.from("emailAccounts").select().eq('tenant', currentTenant.value)).data
+ emailAccounts.value = (await supabase.from("emailAccounts").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchTextTemplates() {
- 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 fetchServiceCategories() {
- servicecategories.value = (await supabase.from("servicecategories").select().eq('tenant', currentTenant.value)).data
+ texttemplates.value = (await supabase.from("texttemplates").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchResources() {
- resources.value = (await supabase.from("resources").select().eq('tenant', currentTenant.value)).data
+ resources.value = (await supabase.from("resources").select().eq('tenant', profileStore.currentTenant)).data
}
async function fetchDocuments () {
- let tempDocuments = (await supabase.from("documents").select().eq('tenant', currentTenant.value)).data
+ let tempDocuments = (await supabase.from("documents").select().eq('tenant', profileStore.currentTenant)).data
if(tempDocuments.length > 0){
let paths = []
@@ -1252,103 +2530,10 @@ export const useDataStore = defineStore('data', () => {
//Getters
- const getOpenTasksCount = computed(() => {
- return tasks.value.filter(task => task.categorie != "Erledigt").length
- })
-
- const getOwnProfile = computed(() => {
- return profiles.value.find(i => i.id === user.value.id)
-
- })
-
- const getMovementsBySpace = computed(() => (spaceId) => {
- return movements.value.filter(movement => movement.spaceId === spaceId)
- })
-
- const getContactsByCustomerId = computed(() => (customerId) => {
- return contacts.value.filter(item => item.customer === customerId)
- })
-
- const getProjectsByCustomerId = computed(() => (customerId) => {
- return projects.value.filter(item => item.customer === customerId)
- })
-
- const getPlantsByCustomerId = computed(() => (customerId) => {
- return plants.value.filter(item => item.customer === customerId)
- })
-
- const getContractsByCustomerId = computed(() => (customerId) => {
- return contracts.value.filter(item => item.customer === customerId)
- })
-
- const getContactsByVendorId = computed(() => (vendorId) => {
- return contacts.value.filter(item => item.vendor === vendorId)
- })
-
- const getDocumentsByProjectId = computed(() => (projectId) => {
- return documents.value.filter(item => item.project === projectId && !item.tags.includes("Archiviert"))
- })
-
const getDocumentsByProfileId = computed(() => (profileId) => {
return documents.value.filter(item => item.profile === profileId && !item.tags.includes("Archiviert"))
})
- const getDocumentsByInventoryItemId = computed(() => (itemId) => {
- return documents.value.filter(item => item.inventoryitem === itemId && !item.tags.includes("Archiviert"))
- })
-
- const getDocumentsByPlantId = computed(() => (itemId) => {
- return documents.value.filter(item => item.plant === itemId && !item.tags.includes("Archiviert"))
- })
-
- const getDocumentsByContractId = computed(() => (itemId) => {
- return documents.value.filter(item => item.contract === itemId && !item.tags.includes("Archiviert"))
- })
-
- const getDocumentsByCheckId = computed(() => (itemId) => {
- return documents.value.filter(item => item.check === itemId && !item.tags.includes("Archiviert"))
- })
-
- const getDocumentsByVehicleId = computed(() => (itemId) => {
- return documents.value.filter(item => item.vehicle === itemId && !item.tags.includes("Archiviert"))
- })
-
- const getDocumentsByProductId = computed(() => (itemId) => {
- return documents.value.filter(item => item.product === itemId && !item.tags.includes("Archiviert"))
- })
-
- const getDocumentsByVendorId = computed(() => (itemId) => {
- return documents.value.filter(item => item.vendor === itemId && !item.tags.includes("Archiviert"))
- })
-
- const getEventsByProjectId = computed(() => (projectId) => {
- return events.value.filter(item => item.project === projectId)
- })
-
- const getTimesByProjectId = computed(() => (projectId) => {
- return times.value.filter(time => time.projectId === projectId)
- })
-
- const getTasksByProjectId = computed(() => (projectId) => {
- return tasks.value.filter(item => item.project === projectId)
- })
-
- const getTasksByPlantId = computed(() => (plantId) => {
- return tasks.value.filter(item => item.plant === plantId)
- })
-
- const getProjectsByPlantId = computed(() => (plantId) => {
- return projects.value.filter(item => item.plant === plantId)
- })
-
- const getIncomingInvoicesByVehicleId = computed(() => (vehicleId) => {
- return incominginvoices.value.filter(i => i.accounts.find(a => a.costCentre === vehicleId))
- })
-
- const getMovementsBySpaceId = computed(() => (spaceId) => {
- return movements.value.filter(movement => movement.spaceId === spaceId)
- })
-
const getMessagesByChatId = computed(() => (chatId) => {
return messages.value.filter(i => i.destination === chatId)
})
@@ -1368,18 +2553,6 @@ export const useDataStore = defineStore('data', () => {
return texttemplates.value.filter(i => i.documentType === type)
})
- const getCreatedDocumentsByProject = computed(() => (project) => {
- return createddocuments.value.filter(i => i.project === project)
- })
-
- const getCreatedDocumentsByType = computed(() => (type) => {
- return createddocuments.value.filter(i => i.type === type)
- })
-
- const getWorkingTimesByProfileId = computed(() => (profileId) => {
- return workingtimes.value.filter(i => i.profile === profileId)
- })
-
const getStartedWorkingTimes = computed(() => () => {
return workingtimes.value.filter(i => !i.endDate)
})
@@ -1396,58 +2569,21 @@ export const useDataStore = defineStore('data', () => {
return count
})
- const getStocksByProjectId = computed(() => (projectId) => {
- let projectMovements = movements.value.filter(movement => movement.projectId === projectId)
-
- let projectProducts = [... new Set(projectMovements.map(i => i.productId))]
-
- console.log(projectProducts)
-
- let productStocks = []
-
- projectProducts.forEach(product => {
- let count = 0
- let productMovements = movements.value.filter(i => i.productId === product && i.projectId && projectId)
-
- productMovements.forEach(movement => {
- count += movement.quantity
- })
-
- productStocks.push({
- productId: product,
- stock: count
- })
-
- })
-
- /*let count = 0
-
- projectMovements.forEach(movement => {
- count += movement.quantity
- })*/
-
- return productStocks
- })
-
const getEventTypes = computed(() => {
- return ownTenant.value.calendarConfig.eventTypes
+ return profileStore.ownTenant.calendarConfig.eventTypes
})
const getTimeTypes = computed(() => {
- return ownTenant.value.timeConfig.timeTypes
+ return profileStore.ownTenant.timeConfig.timeTypes
})
const getDocumentTags = computed(() => {
- return ownTenant.value.tags.documents
- })
-
- const getMeasures = computed(() => {
- return ownTenant.value.measures
+ return profileStore.ownTenant.tags.documents
})
const getResources = computed(() => {
return [
- ...profiles.value.filter(i => i.tenant === currentTenant.value).map(profile => {
+ ...profiles.value.filter(i => i.tenant === profileStore.currentTenant).map(profile => {
return {
type: 'Mitarbeiter',
title: profile.fullName,
@@ -1471,36 +2607,10 @@ export const useDataStore = defineStore('data', () => {
]
})
- const getResourcesList = computed(() => {
- return [
- ...profiles.value.filter(i => i.tenant === currentTenant.value).map(profile => {
- return {
- type: 'Mitarbeiter',
- title: profile.fullName,
- id: profile.id
- }
- }),
- ...vehicles.value.map(vehicle => {
- return {
- type: 'Fahrzeug',
- title: vehicle.licensePlate,
- id: vehicle.id
- }
- }),
- ...inventoryitems.value.filter(i=> i.usePlanning).map(item => {
- return {
- type: 'Inventar',
- title: item.name,
- id: item.id
- }
- })
- ]
- })
-
const getEvents = computed(() => {
return [
...events.value.map(event => {
- let eventColor = ownTenant.value.calendarConfig.eventTypes.find(type => type.label === event.type).color
+ let eventColor = profileStore.ownTenant.calendarConfig.eventTypes.find(type => type.label === event.type).color
let title = ""
if(event.title) {
@@ -1537,7 +2647,7 @@ export const useDataStore = defineStore('data', () => {
console.log(event)
event.resources.forEach(resource => {
console.log(resource)
- let eventColor = ownTenant.value.calendarConfig.eventTypes.find(type => type.label === event.type).color
+ let eventColor = profileStore.ownTenant.calendarConfig.eventTypes.find(type => type.label === event.type).color
let title = ""
if(event.title) {
@@ -1569,7 +2679,7 @@ export const useDataStore = defineStore('data', () => {
/*...events.value.map(event => {
- let eventColor = ownTenant.value.calendarConfig.eventTypes.find(type => type.label === event.type).color
+ let eventColor = profileStore.ownTenant.calendarConfig.eventTypes.find(type => type.label === event.type).color
return {
...event,
@@ -1610,12 +2720,6 @@ export const useDataStore = defineStore('data', () => {
]
})
-
- //Get Item By Id
- const getProductById = computed(() => (itemId) => {
- return products.value.find(item => item.id === itemId)
- })
-
const getServiceById = computed(() => (itemId) => {
return services.value.find(item => item.id === itemId)
})
@@ -1628,98 +2732,34 @@ export const useDataStore = defineStore('data', () => {
return incominginvoices.value.find(item => item.id === itemId)
})
- const getContractById = computed(() => (itemId) => {
- return contracts.value.find(item => item.id === itemId)
- })
-
const getContactById = computed(() => (itemId) => {
return contacts.value.find(item => item.id === itemId)
})
- const getVehicleById = computed(() => (itemId) => {
- return vehicles.value.find(item => item.id === itemId)
- })
-
const getDocumentById = computed(() => (itemId) => {
return documents.value.find(item => item.id === itemId)
})
- const getSpaceById = computed(() => (itemId) => {
- return spaces.value.find(item => item.id === itemId)
- })
-
const getCustomerById = computed(() => (itemId) => {
return customers.value.find(item => item.id === itemId)
})
- const getTaskById = computed(() => (itemId) => {
- return tasks.value.find(item => item.id === itemId)
- })
-
- const getAbsenceRequestById = computed(() => (itemId) => {
- return absencerequests.value.find(item => item.id === itemId)
- })
-
- const getProfileById = computed(() => (itemId) => {
- return profiles.value.find(item => item.id === itemId)
- })
-
const getAccountById = computed(() => (accountId) => {
return accounts.value.find(item => item.id === accountId)
})
- const getPlantById = computed(() => (plantId) => {
- return plants.value.find(item => item.id === plantId)
- })
-
const getCreatedDocumentById = computed(() => (documentId) => {
return createddocuments.value.find(item => item.id === documentId)
})
- const getInventoryItemById = computed(() => (itemId) => {
- return inventoryitems.value.find(item => item.id === itemId)
- })
-
const getBankAccountById = computed(() => (itemId) => {
return bankAccounts.value.find(item => item.id === itemId)
})
- const getEventById = computed(() => (itemId) => {
- return events.value.find(item => item.id === itemId)
- })
-
const getWorkingTimeById = computed(() => (itemId) => {
return workingtimes.value.find(item => item.id === itemId)
})
- /*const getOpenDocuments = computed(() => (itemId) => {
-
- let items = createddocuments.value.filter(i => i.type === "invoices" || i.type === "advanceInvoices")
- items = items.filter(i => bankstatements.value.filter(x => x.assignments.find(y => y.type === 'createdDocument' && y.id === i.id)).length === 0)
-
- /!*let finalItems = []
- items.forEach(item => {
- if(bankstatements.value.filter(i => i.assignments.find(x => x.id === item.id))){
- finalItems.push(item)
- }
-
- })
-
- return finalItems*!/
-
- return items
-
- //return createddocuments.value.filter(i => (i.type === "invoices" || i.type === "advanceInvoices") && !bankstatements.value.some(x => x.amount -))
-
- })*/
- const getOpenIncomingInvoices = computed(() => (itemId) => {
-
- return incominginvoices.value.filter(i => bankstatements.value.filter(x => x.assignments.find(y => y.type === 'incomingInvoice' && y.id === i.id)).length === 0)
-
- //return incominginvoices.value.filter(i => !i.paid)
-
- })
-
const getProjectById = computed(() => (itemId) => {
if(projects.value.find(i => i.id === itemId)) {
let project = projects.value.find(project => project.id === itemId)
@@ -1741,24 +2781,11 @@ export const useDataStore = defineStore('data', () => {
})
return {
- //General
- currentTenant,
- loaded,
- showProfileSelection,
- ownTenant,
- initializeData,
- changeProfile,
uploadFiles,
- hasRight,
generateHistoryItems,
dataTypes,
//Data
- profiles,
- ownProfiles,
- activeProfile,
- tenants,
- events,
customers,
tasks,
projects,
@@ -1779,13 +2806,10 @@ export const useDataStore = defineStore('data', () => {
bankstatements,
bankrequisitions,
historyItems,
- numberRanges,
notifications,
- absencerequests,
accounts,
taxTypes,
plants,
- inventoryitems,
chats,
messages,
createddocuments,
@@ -1793,8 +2817,6 @@ export const useDataStore = defineStore('data', () => {
phasesTemplates,
emailAccounts,
texttemplates,
- services,
- servicecategories,
documentTypesForCreation,
//Functions
@@ -1802,105 +2824,33 @@ export const useDataStore = defineStore('data', () => {
updateItem,
fetchData,
clearStore,
- fetchOwnTenant,
- fetchProfiles,
- fetchOwnProfiles,
- fetchBankAccounts,
- fetchBankStatements,
- fetchBankRequisitions,
- fetchEvents,
- fetchContracts,
- fetchContacts,
- fetchCustomers,
- fetchTasks,
- fetchForms,
- fetchFormSubmits,
- fetchProducts,
- fetchUnits,
- fetchProjects,
- fetchSpaces,
- fetchMovements,
- fetchVehicles,
fetchTimes,
- fetchHistoryItems,
- fetchVendors,
fetchIncomingInvoices,
- fetchNumberRanges,
- fetchNotifications,
fetchDocuments,
- fetchAbsenceRequests,
- fetchPlants,
- fetchInventoryItems,
- fetchChats,
- fetchMessages,
fetchWorkingTimes,
- addHistoryItem,
//Getters
- getOpenTasksCount,
- getOwnProfile,
- getMovementsBySpace,
- getContactsByCustomerId,
- getProjectsByCustomerId,
- getPlantsByCustomerId,
- getContractsByCustomerId,
- getContactsByVendorId,
- getDocumentsByProjectId,
getDocumentsByProfileId,
- getDocumentsByInventoryItemId,
- getDocumentsByPlantId,
- getDocumentsByContractId,
- getDocumentsByCheckId,
- getDocumentsByVehicleId,
- getDocumentsByProductId,
- getDocumentsByVendorId,
- getEventsByProjectId,
- getTimesByProjectId,
- getTasksByProjectId,
- getTasksByPlantId,
- getProjectsByPlantId,
- getMovementsBySpaceId,
getMessagesByChatId,
getTextTemplatesByDocumentType,
- getCreatedDocumentsByProject,
- getCreatedDocumentsByType,
- getWorkingTimesByProfileId,
getStartedWorkingTimes,
getStockByProductId,
- getStocksByProjectId,
- getIncomingInvoicesByVehicleId,
getEventTypes,
getTimeTypes,
getDocumentTags,
- getMeasures,
getResources,
- getResourcesList,
getEvents,
getEventsByResource,
getCostCentresComposed,
- getProductById,
getServiceById,
getVendorById,
getIncomingInvoiceById,
- getContractById,
getContactById,
- getVehicleById,
getDocumentById,
- getSpaceById,
getCustomerById,
- getTaskById,
- getAbsenceRequestById,
getProjectById,
- getProfileById,
getAccountById,
- getPlantById,
getCreatedDocumentById,
- getInventoryItemById,
getBankAccountById,
- getEventById,
getWorkingTimeById,
- //getOpenDocuments,
- getOpenIncomingInvoices
}
-
-
})
\ No newline at end of file
diff --git a/stores/profile.js b/stores/profile.js
new file mode 100644
index 0000000..e9ac524
--- /dev/null
+++ b/stores/profile.js
@@ -0,0 +1,150 @@
+import {defineStore} from 'pinia'
+
+// @ts-ignore
+export const useProfileStore = defineStore('profile', () => {
+
+ const supabase = useSupabaseClient()
+ const dataStore = useDataStore()
+ const user = useSupabaseUser()
+ const toast = useToast()
+ const router = useRouter()
+
+ const loaded = ref(false)
+ const showProfileSelection = ref(false)
+ const ownTenant = ref({
+ calendarConfig: {
+ eventTypes: []
+ },
+ timeConfig: {
+ timeTypes: []
+ },
+ tags: {
+ documents: [] ,
+ products: []
+ },
+ measures: []
+ })
+
+
+ const profiles = ref([])
+ const ownProfiles = ref([])
+ const activeProfile = ref([])
+ const tenants = ref([])
+ const currentTenant = ref(null)
+
+
+ async function initializeData (userId) {
+
+ let profileconnections = (await supabase.from("profileconnections").select()).data
+ let profiles = (await supabase.from("profiles").select("*, role(*)")).data
+ let activeProfileConnection = profileconnections.find(i => i.active)
+ if(activeProfileConnection) {
+ toast.add({title: 'Aktives Profil ausgewählt'})
+ console.log("Active Profile selected")
+ activeProfile.value = profiles.find(i => i.id === activeProfileConnection.profile_id)
+ currentTenant.value = activeProfile.value.tenant
+
+ await fetchData()
+ await dataStore.fetchData()
+ } else {
+ toast.add({title: 'Kein aktives Profil', color: 'orange'})
+ await fetchOwnProfiles()
+ await fetchTenants()
+ showProfileSelection.value = true
+ }
+
+
+ }
+
+ async function changeProfile(newActiveProfileId) {
+ loaded.value = false
+
+ let profileconnections = (await supabase.from("profileconnections").select()).data
+
+ let oldActiveProfileConnection = profileconnections.find(i => i.active)
+
+ const {error} = await supabase.from("profileconnections").update({active: true}).eq("profile_id", newActiveProfileId)
+
+ if(error) {
+ console.log(error)
+ } else {
+ if(oldActiveProfileConnection){
+ const {error} = await supabase.from("profileconnections").update({active: false}).eq("profile_id", oldActiveProfileConnection.profile_id)
+ }
+
+ reloadNuxtApp({
+ path:"/",
+ ttl: 10000
+ })
+ }
+ }
+
+ async function fetchData () {
+ await fetchOwnProfiles()
+ await fetchProfiles()
+
+ await fetchTenants()
+ await fetchOwnTenant()
+
+ loaded.value = true
+ console.log("Finished Loading")
+ }
+
+ function clearStore () {
+ loaded.value = false
+ ownTenant.value = {}
+ profiles.value = []
+ ownProfiles.value = []
+ tenants.value = []
+ }
+
+ async function fetchOwnTenant () {
+ ownTenant.value = (await supabase.from("tenants").select().eq('id', currentTenant.value).single()).data
+ }
+
+ async function fetchProfiles () {
+ profiles.value = (await supabase.from("profiles").select().eq("tenant",currentTenant.value).order("lastName")).data
+ }
+
+ async function fetchOwnProfiles () {
+ let profiles = (await supabase.from("profiles").select().order("fullName")).data
+ let conns = (await supabase.from("profileconnections").select()).data.map(i => i.profile_id)
+ ownProfiles.value = profiles.filter(i => conns.includes(i.id))
+ }
+
+ async function fetchTenants () {
+ tenants.value = (await supabase.from("tenants").select()).data
+ }
+
+ const getOwnProfile = computed(() => {
+ return profiles.value.find(i => i.id === user.value.id)
+
+ })
+
+ const getProfileById = computed(() => (itemId) => {
+ return profiles.value.find(item => item.id === itemId)
+ })
+
+ return {
+ //General
+ currentTenant,
+ loaded,
+ showProfileSelection,
+ ownTenant,
+ initializeData,
+ changeProfile,
+
+ //Data
+ profiles,
+ ownProfiles,
+ activeProfile,
+ tenants,
+ fetchData,
+ clearStore,
+ fetchOwnTenant,
+ getOwnProfile,
+ getProfileById
+ }
+
+
+})
\ No newline at end of file
|