Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added audit trails tabs #40

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 70 additions & 1 deletion src/views/berichten/BerichtDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,59 @@ 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'
import Pencil from 'vue-material-design-icons/Pencil.vue'
import TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'
import Eye from 'vue-material-design-icons/Eye.vue'
import TimelineQuestionOutline from 'vue-material-design-icons/TimelineQuestionOutline.vue'

export default {
name: 'BerichtDetails',
Expand All @@ -101,6 +141,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/klanten/KlantDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ import { navigationStore, klantStore, taakStore, berichtStore, zaakStore } from
{{ auditTrail.userName }}
</template>
<template #actions>
<NcActionButton @click="objectStore.setAuditTrailItem(auditTrail); navigationStore.setModal('viewObjectAuditTrail')">
<NcActionButton @click="klantStore.setAuditTrailItem(auditTrail); navigationStore.setModal('viewObjectAuditTrail')">
<template #icon>
<Eye :size="20" />
</template>
Expand Down
71 changes: 70 additions & 1 deletion src/views/taken/TaakDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,59 @@ import { navigationStore, taakStore } from '../../store/store.js'
<span>{{ taakStore.taakItem.onderwerp }}</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="taakStore.setAuditTrailItem(auditTrail); navigationStore.setModal('viewTaakAuditTrail')">
<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 taak.
</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'
import Pencil from 'vue-material-design-icons/Pencil.vue'
import TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'
import Eye from 'vue-material-design-icons/Eye.vue'
import TimelineQuestionOutline from 'vue-material-design-icons/TimelineQuestionOutline.vue'

export default {
name: 'TaakDetails',
Expand All @@ -57,6 +97,35 @@ export default {
DotsHorizontal,
TrashCanOutline,
},
data() {
return {
currentActiveTaak: null,
auditTrails: [],
}
},
mounted() {
if (taakStore.taakItem?.id) {
this.currentActiveTaak = taakStore.taakItem
this.fetchAuditTrails(taakStore.taakItem.id)
}
},
updated() {
if (taakStore.taakItem?.id && JSON.stringify(this.currentActiveTaak) !== JSON.stringify(taakStore.taakItem)) {
this.currentActiveTaak = taakStore.taakItem
this.fetchAuditTrails(taakStore.taakItem.id)
}
},
methods: {
fetchAuditTrails(id) {
fetch(`/index.php/apps/zaakafhandelapp/api/taken/${id}/audit_trail`)
.then(response => response.json())
.then(data => {
if (Array.isArray(data)) {
this.auditTrails = data
}
})
},
},
}
</script>

Expand Down
4 changes: 2 additions & 2 deletions src/views/taken/TakenList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ import { navigationStore, taakStore } from '../../store/store.js'
</NcActions>
</div>
<div v-if="taakStore.takenList">
<NcListItem v-for="(taak, i) in taakStore.takenList.results"
<NcListItem v-for="(taak, i) in taakStore.takenList"
:key="`${taak}${i}`"
:name="taak?.title"
:force-display-actions="true"
:active="taakStore.taakItem?.id === taak?.id"
:details="'1h'"
:counter-number="44"
@click="navigationStore.setTaakItem(taak)">
@click="taakStore.setTaakItem(taak)">
<template #icon>
<CalendarMonthOutline :class="taakStore.taakItem?.id === taak.id && 'selectedZaakIcon'"
disable-menu
Expand Down
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
Loading