Added Automatic HistoryItems to Events,Customers,Vendors
This commit is contained in:
@@ -23,6 +23,7 @@ const itemInfo = ref({
|
||||
active: true,
|
||||
isCompany: true
|
||||
})
|
||||
const oldItemInfo = ref({})
|
||||
|
||||
//Functions
|
||||
const setupPage = async () => {
|
||||
@@ -31,6 +32,7 @@ const setupPage = async () => {
|
||||
}
|
||||
|
||||
if(mode.value === "edit") itemInfo.value = currentItem.value
|
||||
if(currentItem.value.id) oldItemInfo.value = JSON.parse(JSON.stringify(currentItem.value))
|
||||
}
|
||||
|
||||
const editItem = async () => {
|
||||
@@ -54,7 +56,7 @@ setupPage()
|
||||
<template #right>
|
||||
<UButton
|
||||
v-if="mode === 'edit'"
|
||||
@click="dataStore.updateItem('customers',itemInfo)"
|
||||
@click="dataStore.updateItem('customers',itemInfo,oldItemInfo)"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
|
||||
@@ -11,9 +11,10 @@ const mode = ref(route.params.mode || "show")
|
||||
const itemInfo = ref({
|
||||
resources: []
|
||||
})
|
||||
const oldItemInfo = ref({})
|
||||
|
||||
const resourceToAdd = ref(dataStore.activeProfile.id)
|
||||
const mapResources = () => {
|
||||
/*const mapResources = () => {
|
||||
console.log(itemInfo.value.resources)
|
||||
itemInfo.value.resources.map(resource => {
|
||||
console.log(resource)
|
||||
@@ -22,7 +23,7 @@ const mapResources = () => {
|
||||
type: resource.type
|
||||
}
|
||||
})
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
const setupPage = () => {
|
||||
@@ -39,6 +40,7 @@ const setupPage = () => {
|
||||
})
|
||||
}
|
||||
if(route.query.project) itemInfo.value.project = route.query.project
|
||||
if(itemInfo.value.id) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value))
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +67,7 @@ setupPage()
|
||||
Erstellen
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="dataStore.updateItem('events',itemInfo)"
|
||||
@click="dataStore.updateItem('events',itemInfo,oldItemInfo)"
|
||||
v-else-if="mode === 'edit' && route.params.id"
|
||||
>
|
||||
Speichern
|
||||
@@ -92,7 +94,11 @@ setupPage()
|
||||
{{itemInfo}}
|
||||
</div>
|
||||
<div v-if="item.label === 'Logbuch'">
|
||||
|
||||
<HistoryDisplay
|
||||
type="event"
|
||||
v-if="itemInfo"
|
||||
:element-id="itemInfo.id"
|
||||
/>
|
||||
</div>
|
||||
</UCard>
|
||||
</template>
|
||||
|
||||
5
pages/vendors/[mode]/[[id]].vue
vendored
5
pages/vendors/[mode]/[[id]].vue
vendored
@@ -19,6 +19,7 @@ const mode = ref(route.params.mode || "show")
|
||||
const itemInfo = ref({
|
||||
infoData: {}
|
||||
})
|
||||
const oldItemInfo = ref({})
|
||||
|
||||
//Functions
|
||||
const setupPage = () => {
|
||||
@@ -27,6 +28,8 @@ const setupPage = () => {
|
||||
}
|
||||
|
||||
if (mode.value === "edit") itemInfo.value = currentItem.value
|
||||
if(currentItem.value.id) oldItemInfo.value = JSON.parse(JSON.stringify(currentItem.value))
|
||||
|
||||
}
|
||||
|
||||
const editItem = async () => {
|
||||
@@ -49,7 +52,7 @@ setupPage()
|
||||
<template #right>
|
||||
<UButton
|
||||
v-if="mode === 'edit'"
|
||||
@click="dataStore.updateItem('vendors',itemInfo)"
|
||||
@click="dataStore.updateItem('vendors',itemInfo,oldItemInfo)"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
|
||||
Reference in New Issue
Block a user