This commit is contained in:
2024-04-08 21:33:10 +02:00
parent 0f7555907b
commit 9fa1059301
3 changed files with 27 additions and 23 deletions

View File

@@ -174,7 +174,7 @@ const renderText = (text) => {
+ Eintrag + Eintrag
</UButton> </UButton>
</div> </div>
<UDivider class="mt-3"/> <UDivider class="my-3"/>
</div> </div>

View File

@@ -52,7 +52,25 @@ setupPage()
</script> </script>
<template> <template>
<UDashboardNavbar :title="currentItem ? `Kunde: ${currentItem.name}` : (mode === 'create' ? 'Kunde erstellen' : 'Kunde bearbeiten')"> <UDashboardNavbar
:title="currentItem ? `Kunde: ${currentItem.name}` : (mode === 'create' ? 'Kunde erstellen' : 'Kunde bearbeiten')"
:ui="{center: 'flex items-stretch gap-1.5 min-w-0'}"
>
<template #left>
<UButton
icon="i-heroicons-chevron-left"
variant="outline"
@click="router.push(`/customers`)"
>
Kunden
</UButton>
</template>
<template #center>
<h1
v-if="currentItem"
:class="['text-xl','font-medium', ... currentItem.active ? ['text-primary'] : ['text-rose-500']]"
>{{currentItem ? `Kunde: ${currentItem.name}` : (mode === 'create' ? 'Kunde erstellen' : 'Kunde bearbeiten')}}</h1>
</template>
<template #right> <template #right>
<UButton <UButton
v-if="mode === 'edit'" v-if="mode === 'edit'"

View File

@@ -507,8 +507,8 @@ export const useDataStore = defineStore('data', () => {
const createHistoryItem = (key,prop) => { const createHistoryItem = (key,prop) => {
console.log("OLD: " + prop.data.o) //console.log("OLD: " + prop.data.o)
console.log("NEW: " + prop.data.n) //console.log("NEW: " + prop.data.n)
let name = "" || key let name = "" || key
let oldVal = prop.data.o || "-" let oldVal = prop.data.o || "-"
@@ -659,11 +659,11 @@ export const useDataStore = defineStore('data', () => {
const checkIfNaN = (x) => { const checkIfNaN = (x) => {
return typeof x === "number" && x !== x; return typeof x === "number" && x !== x;
} }
console.log(key) //console.log(key)
console.log(checkIfNaN(key)) //console.log(checkIfNaN(key))
if(key !== "fullName" && key !== "phases") { if(key !== "fullName" && key !== "phases") {
console.log(historyItem) //console.log(historyItem)
itemsToCreate.push(historyItem) itemsToCreate.push(historyItem)
} }
@@ -672,28 +672,15 @@ export const useDataStore = defineStore('data', () => {
if(oldData) { if(oldData) {
let result = deepDiffMapper.map(oldData,newData) let result = deepDiffMapper.map(oldData,newData)
console.log(result) //console.log(result)
for (let prop in result) { for (let prop in result) {
//console.log(prop) //console.log(prop)
checkPropState(prop,result[prop]) checkPropState(prop,result[prop])
//console.log(prop)
//console.log(result[prop])
} }
} else { } else {
let historyItem = { let historyItem = {
text: `${dataTypes[dataType].labelSingle} erstellt`, text: `${dataTypes[dataType].labelSingle} erstellt`,
createdBy: activeProfile.value.id, createdBy: activeProfile.value.id,
@@ -702,7 +689,7 @@ export const useDataStore = defineStore('data', () => {
historyItem[dataTypes[dataType].historyItemHolder] = newData.id historyItem[dataTypes[dataType].historyItemHolder] = newData.id
console.log(historyItem) //console.log(historyItem)
itemsToCreate.push(historyItem) itemsToCreate.push(historyItem)
} }
@@ -803,7 +790,6 @@ export const useDataStore = defineStore('data', () => {
const {tenants, ...newData} = data const {tenants, ...newData} = data
console.log(newData)
await generateHistoryItems(dataType,data,oldData) await generateHistoryItems(dataType,data,oldData)