Skip to content

Commit

Permalink
finished bericht audit trails
Browse files Browse the repository at this point in the history
  • Loading branch information
RalkeyOfficial committed Oct 23, 2024
1 parent e4b456f commit 503c34f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 2 deletions.
69 changes: 68 additions & 1 deletion src/views/berichten/BerichtDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,52 @@ import { navigationStore, berichtStore } from '../../store/store.js'
<span>{{ berichtStore.berichtItem.volgorde }}</span>
</div>
</div>

<div class="tabContainer">
<BTabs content-class="mt-3" justified>
<BTab title="Audit trail" active>
<div v-if="auditTrails.length">
<NcListItem v-for="(auditTrail, key) in auditTrails"
:key="key"
:name="new Date(auditTrail.created).toLocaleString()"
:bold="false"
:details="auditTrail.action"
:counter-number="Object.keys(auditTrail.changed).length"
:force-display-actions="true">
<template #icon>
<TimelineQuestionOutline disable-menu
:size="44" />
</template>
<template #subname>
{{ auditTrail.userName }}
</template>
<template #actions>
<NcActionButton @click="berichtStore.setAuditTrailItem(auditTrail); navigationStore.setModal('viewBerichtAuditTrail')">
<template #icon>
<Eye :size="20" />
</template>
View details
</NcActionButton>
</template>
</NcListItem>
</div>
<NcEmptyContent v-else icon="icon-history" title="Geen audit trail gevonden">
<template #description>
Er is geen audit trail gevonden voor deze bericht.
</template>
</NcEmptyContent>
</BTab>
</BTabs>
</div>
</div>
</div>
</div>
</template>

<script>
// Components
import { NcActions, NcActionButton } from '@nextcloud/vue'
import { NcActions, NcActionButton, NcListItem, NcEmptyContent } from '@nextcloud/vue'
import { BTabs, BTab } from 'bootstrap-vue'
// Icons
import DotsHorizontal from 'vue-material-design-icons/DotsHorizontal.vue'
Expand All @@ -101,6 +139,35 @@ export default {
DotsHorizontal,
TrashCanOutline,
},
data() {
return {
currentActiveBericht: null,
auditTrails: [],
}
},
mounted() {
if (berichtStore.berichtItem?.id) {
this.currentActiveBericht = berichtStore.berichtItem
this.fetchAuditTrails(berichtStore.berichtItem.id)
}
},
updated() {
if (berichtStore.berichtItem?.id && JSON.stringify(this.currentActiveBericht) !== JSON.stringify(berichtStore.berichtItem)) {
this.currentActiveBericht = berichtStore.berichtItem
this.fetchAuditTrails(berichtStore.berichtItem.id)
}
},
methods: {
fetchAuditTrails(id) {
fetch(`/index.php/apps/zaakafhandelapp/api/berichten/${id}/audit_trail`)
.then(response => response.json())
.then(data => {
if (Array.isArray(data)) {
this.auditTrails = data
}
})
},
},
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/views/taken/TaakDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { navigationStore, taakStore } from '../../store/store.js'
{{ auditTrail.userName }}
</template>
<template #actions>
<NcActionButton @click="objectStore.setAuditTrailItem(auditTrail); navigationStore.setModal('viewTaakAuditTrail')">
<NcActionButton @click="taakStore.setAuditTrailItem(auditTrail); navigationStore.setModal('viewTaakAuditTrail')">
<template #icon>
<Eye :size="20" />
</template>
Expand Down

0 comments on commit 503c34f

Please sign in to comment.