Skip to content

Commit

Permalink
finished zaak audit trails tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudo-Thijn committed Oct 23, 2024
1 parent d6a413e commit f82e5d4
Showing 1 changed file with 64 additions and 2 deletions.
66 changes: 64 additions & 2 deletions src/views/zaken/ZaakDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,38 @@ import { navigationStore, zaakStore } from '../../store/store.js'
<BTab title="Synchronisaties">
Todo: Koppelings info met DSO
</BTab>
<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="zaakStore.setAuditTrailItem(auditTrail); navigationStore.setModal('viewZaakAuditTrail')">
<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 zaak.
</template>
</NcEmptyContent>
</BTab>
</BTabs>
</div>
</div>
Expand All @@ -147,7 +179,7 @@ import { navigationStore, zaakStore } from '../../store/store.js'
<script>
// Components
import { BTabs, BTab } from 'bootstrap-vue'
import { NcLoadingIcon, NcActions, NcActionButton } from '@nextcloud/vue'
import { NcLoadingIcon, NcActions, NcActionButton, NcListItem, NcEmptyContent } from '@nextcloud/vue'
// Icons
import DotsHorizontal from 'vue-material-design-icons/DotsHorizontal.vue'
Expand All @@ -157,6 +189,8 @@ import CalendarPlus from 'vue-material-design-icons/CalendarPlus.vue'
import MessagePlus from 'vue-material-design-icons/MessagePlus.vue'
import FileDocumentPlusOutline from 'vue-material-design-icons/FileDocumentPlusOutline.vue'
import VectorPolylineEdit from 'vue-material-design-icons/VectorPolylineEdit.vue'
import Eye from 'vue-material-design-icons/Eye.vue'
import TimelineQuestionOutline from 'vue-material-design-icons/TimelineQuestionOutline.vue'
// Views
import ZaakEigenschappen from '../eigenschappen/ZaakEigenschappen.vue'
Expand Down Expand Up @@ -191,7 +225,35 @@ export default {
CalendarPlus,
FileDocumentPlusOutline,
VectorPolylineEdit,
},
data() {
return {
currentActiveZaak: null,
auditTrails: [],
}
},
mounted() {
if (zaakStore.zaakItem?.id) {
this.currentActiveZaak = zaakStore.zaakItem
this.fetchAuditTrails(zaakStore.zaakItem.id)
}
},
updated() {
if (zaakStore.zaakItem?.id && JSON.stringify(this.currentActiveZaak) !== JSON.stringify(zaakStore.zaakItem)) {
this.currentActiveZaak = zaakStore.zaakItem
this.fetchAuditTrails(zaakStore.zaakItem.id)
}
},
methods: {
fetchAuditTrails(id) {
fetch(`/index.php/apps/zaakafhandelapp/api/zaken/${id}/audit_trail`)
.then(response => response.json())
.then(data => {
if (Array.isArray(data)) {
this.auditTrails = data
}
})
},
},
}
</script>
Expand Down

0 comments on commit f82e5d4

Please sign in to comment.