Skip to content

Commit

Permalink
No content warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvdlinde committed Oct 23, 2024
1 parent b9f980e commit 553e5dd
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 30 deletions.
3 changes: 0 additions & 3 deletions lib/Controller/BerichtenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ public function update(string $id): JSONResponse
// Get all parameters from the request
$data = $this->request->getParams();

// Remove the 'id' field if it exists, as we're creating a new object
unset($data['id']);

// Save the new catalog object
$object = $this->objectService->saveObject('berichten', $data);

Expand Down
3 changes: 0 additions & 3 deletions lib/Controller/KlantenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ public function update(string $id): JSONResponse
// Get all parameters from the request
$data = $this->request->getParams();

// Remove the 'id' field if it exists, as we're creating a new object
unset($data['id']);

// Save the new catalog object
$object = $this->objectService->saveObject('klanten', $data);

Expand Down
7 changes: 5 additions & 2 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function index(): JSONResponse
{
// Initialize the data array
$data = [];
$data['objectTypes'] = ['berichten', 'besluiten', 'documenten', 'klanten', 'resultaten', 'taken', 'informatieobjecten', 'organisaties', 'personen', 'zaken', 'rollen', 'statusen', 'zaakeigenschappen', 'zaaktypen'];
$data['objectTypes'] = ['berichten', 'besluiten', 'documenten', 'klanten', 'resultaten', 'taken', 'informatieobjecten', 'organisaties', 'personen', 'zaken', 'rollen', 'statusen', 'zaakeigenschappen', 'zaaktypen','contactmomenten'];
$data['openRegisters'] = false;
$data['availableRegisters'] = [];

Expand Down Expand Up @@ -99,7 +99,10 @@ public function index(): JSONResponse
'zaakeigenschappen_register' => '',
'zaaktypen_source' => 'internal',
'zaaktypen_schema' => '',
'zaaktypen_register' => ''
'zaaktypen_register' => '',
'contactmomenten_source' => 'internal',
'contactmomenten_schema' => '',
'contactmomenten_register' => ''
];

// Get the current values for the object types from the configuration
Expand Down
5 changes: 1 addition & 4 deletions lib/Controller/TakenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ public function update(string $id): JSONResponse
{
// Get all parameters from the request
$data = $this->request->getParams();

// Remove the 'id' field if it exists, as we're creating a new object
unset($data['id']);


// Save the new catalog object
$object = $this->objectService->saveObject('taken', $data);

Expand Down
3 changes: 0 additions & 3 deletions lib/Controller/ZakenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ public function update(string $id): JSONResponse
// Get all parameters from the request
$data = $this->request->getParams();

// Remove the 'id' field if it exists, as we're creating a new object
unset($data['id']);

// Save the new catalog object
$object = $this->objectService->saveObject('zaken', $data);

Expand Down
33 changes: 33 additions & 0 deletions lib/Service/ObjectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,4 +453,37 @@ public function extendEntity(mixed $entity, array $extend): array
// Return the extended entity as an array
return $result;
}

/**
* Gets the audit trail for a specific object.
*
* @param string $objectType The type of object.
* @param string $id The id of the object.
*
* @return array The audit trail for the object.
* @throws ContainerExceptionInterface|NotFoundExceptionInterface|Exception If the OpenRegister service is not available or if register/schema is not configured.
*/
public function getAuditTrail(string $objectType, string $id): array
{
$objectTypeLower = strtolower($objectType);

// Get the register and schema from the configuration
$register = $this->config->getValueString($this->appName, $objectTypeLower . '_register', '');
if (empty($register)) {
throw new Exception("Register not configured for $objectType");
}
$schema = $this->config->getValueString($this->appName, $objectTypeLower . '_schema', '');
if (empty($schema)) {
throw new Exception("Schema not configured for $objectType");
}

// Get the OpenRegister service
$openRegister = $this->getOpenRegisters();
if ($openRegister === null) {
throw new Exception("OpenRegister service not available");
}

// Call the OpenRegister service to get the audit trail
return $openRegister->getAuditTrail($register, $schema, $id);
}
}
158 changes: 144 additions & 14 deletions src/views/klanten/KlantDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,144 @@ import { navigationStore, klantStore, taakStore, berichtStore, zaakStore } from
<div class="tabContainer">
<BTabs content-class="mt-3" justified>
<BTab title="Zaken">
asdads
<div v-if="zaken.length">
<NcListItem v-for="(zaak, key) in zaken"
:key="key"
:name="zaak.title"
:bold="false"
:details="zaak.description"
:force-display-actions="true">
<template #icon>
<BriefcaseAccountOutline :size="44" />
</template>
<template #actions>
<NcActionButton @click="zaakStore.setZaakItem(zaak); navigationStore.setModal('viewZaak')">
<template #icon>
<Eye :size="20" />
</template>
View details
</NcActionButton>
</template>
</NcListItem>
</div>
<NcEmptyContent v-else icon="icon-folder" title="Geen zaken gevonden">
<template #description>
Er zijn geen zaken gevonden voor deze klant.
</template>
</NcEmptyContent>
</BTab>
<BTab title="Taken">
asda
<div v-if="taken.length">
<NcListItem v-for="(taak, key) in taken"
:key="key"
:name="taak.title"
:bold="false"
:details="taak.description"
:force-display-actions="true">
<template #icon>
<CalendarMonthOutline :size="44" />
</template>
<template #actions>
<NcActionButton @click="taakStore.setTaakItem(taak); navigationStore.setModal('viewTaak')">
<template #icon>
<Eye :size="20" />
</template>
View details
</NcActionButton>
</template>
</NcListItem>
</div>
<NcEmptyContent v-else icon="icon-tasks" title="Geen taken gevonden">
<template #description>
Er zijn geen taken gevonden voor deze klant.
</template>
</NcEmptyContent>
</BTab>
<BTab title="Berichten">
asdsa
<div v-if="berichten.length">
<NcListItem v-for="(bericht, key) in berichten"
:key="key"
:name="bericht.title"
:bold="false"
:details="bericht.description"
:force-display-actions="true">
<template #icon>
<ChatOutline :size="44" />
</template>
<template #actions>
<NcActionButton @click="berichtStore.setBerichtItem(bericht); navigationStore.setModal('viewBericht')">
<template #icon>
<Eye :size="20" />
</template>
View details
</NcActionButton>
</template>
</NcListItem>
</div>
<NcEmptyContent v-else icon="icon-mail" title="Geen berichten gevonden">
<template #description>
Er zijn geen berichten gevonden voor deze klant.
</template>
</NcEmptyContent>
</BTab>
<BTab title="Contact Momeenten">
asdsa
<BTab title="Contact Momenten">
<div v-if="contactMomenten.length">
<NcListItem v-for="(contactMoment, key) in contactMomenten"
:key="key"
:name="contactMoment.title"
:bold="false"
:details="contactMoment.description"
:force-display-actions="true">
<template #icon>
<AccountOutline :size="44" />
</template>
<template #actions>
<NcActionButton @click="contactMomentStore.setContactMomentItem(contactMoment); navigationStore.setModal('viewContactMoment')">
<template #icon>
<Eye :size="20" />
</template>
View details
</NcActionButton>
</template>
</NcListItem>
</div>
<NcEmptyContent v-else icon="icon-contacts" title="Geen contactmomenten gevonden">
<template #description>
Er zijn geen contactmomenten gevonden voor deze klant.
</template>
</NcEmptyContent>
</BTab>
<BTab title="Audit trail">
asdsa
<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="objectStore.setAuditTrailItem(auditTrail); navigationStore.setModal('viewObjectAuditTrail')">
<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 klant.
</template>
</NcEmptyContent>
</BTab>
</BTabs>
</div>
Expand All @@ -132,7 +257,7 @@ import { navigationStore, klantStore, taakStore, berichtStore, zaakStore } from
<script>
// Components
import { BTabs, BTab } from 'bootstrap-vue'
import { NcActions, NcActionButton } from '@nextcloud/vue'
import { NcActions, NcActionButton, NcEmptyContent } from '@nextcloud/vue'
// Icons
import DotsHorizontal from 'vue-material-design-icons/DotsHorizontal.vue'
Expand All @@ -141,12 +266,15 @@ import ChatOutline from 'vue-material-design-icons/ChatOutline.vue'
import CalendarMonthOutline from 'vue-material-design-icons/CalendarMonthOutline.vue'
import BriefcaseAccountOutline from 'vue-material-design-icons/BriefcaseAccountOutline.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: 'KlantDetails',
components: {
NcActions,
NcActionButton,
NcEmptyContent,
BTabs,
BTab,
// Icons
Expand All @@ -156,14 +284,16 @@ export default {
CalendarMonthOutline,
BriefcaseAccountOutline,
TrashCanOutline,
Eye,
TimelineQuestionOutline,
},
data() {
return {
zaken: [],
taken: [],
berichten: [],
contactMomenten: [],
auditTrail: [],
auditTrails: [],
}
},
mounted() {
Expand All @@ -172,18 +302,18 @@ export default {
methods: {
async fetchKlantData(id) {
try {
const [zaken, taken, berichten, contactMomenten, auditTrail] = await Promise.all([
const [zaken, taken, berichten, contactMomenten, auditTrails] = await Promise.all([
fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/zaken`).then(res => res.json()),
fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/taken`).then(res => res.json()),
fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/berichten`).then(res => res.json()),
fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/contactmomenten`).then(res => res.json()),
fetch(`/index.php/apps/zaakafhandelapp/api/klanten/${id}/audit_trail`).then(res => res.json()),
])
this.zaken = zaken
this.taken = taken
this.berichten = berichten
this.contactMomenten = contactMomenten
this.auditTrail = auditTrail
this.zaken = zaken.results
this.taken = taken.results
this.berichten = berichten.results
this.contactMomenten = contactMomenten.results
this.auditTrails = auditTrails
} catch (error) {
console.error('Error fetching klant data:', error)
}
Expand Down
Loading

0 comments on commit 553e5dd

Please sign in to comment.