Skip to content

Commit

Permalink
Getting the details for klanten
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvdlinde committed Oct 22, 2024
1 parent aee627c commit b9f980e
Show file tree
Hide file tree
Showing 16 changed files with 248 additions and 217 deletions.
13 changes: 13 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,21 @@
'taken' => ['url' => 'api/taken'],
'klanten' => ['url' => 'api/klanten'],
'berichten' => ['url' => 'api/berichten'],

],
'routes' => [
// Audit trail routes
['name' => 'zaken#getAuditTrail', 'url' => '/api/zaken/{id}/audit_trail', 'verb' => 'GET'],
['name' => 'klanten#getAuditTrail', 'url' => '/api/klanten/{id}/audit_trail', 'verb' => 'GET'],
['name' => 'berichten#getAuditTrail', 'url' => '/api/berichten/{id}/audit_trail', 'verb' => 'GET'],
['name' => 'taken#getAuditTrail', 'url' => '/api/taken/{id}/audit_trail', 'verb' => 'GET'],

// Overige klant routes
['name' => 'klanten#getContactmomenten', 'url' => '/api/klanten/{id}/contactmomenten', 'verb' => 'GET'],
['name' => 'klanten#getTaken', 'url' => '/api/klanten/{id}/taken', 'verb' => 'GET'],
['name' => 'klanten#getBerichten', 'url' => '/api/klanten/{id}/berichten', 'verb' => 'GET'],
['name' => 'klanten#getZaken', 'url' => '/api/klanten/{id}/zaken', 'verb' => 'GET'],

// Page routes
['name' => 'dashboard#page', 'url' => '/', 'verb' => 'GET'],
['name' => 'configuration#index', 'url' => '/api/configuration', 'verb' => 'GET'],
Expand Down
14 changes: 14 additions & 0 deletions lib/Controller/BerichtenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,18 @@ public function destroy(string $id): JSONResponse
// Return the result as a JSON response
return new JSONResponse(['success' => $result], $result === true ? '200' : '404');
}

/**
* Get audit trail for a specific klant
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function getAuditTrail(string $id): JSONResponse
{
$auditTrail = $this->objectService->getAuditTrail('berichten', $id);
return new JSONResponse($auditTrail);
}
}
74 changes: 74 additions & 0 deletions lib/Controller/KlantenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,78 @@ public function destroy(string $id): JSONResponse
// Return the result as a JSON response
return new JSONResponse(['success' => $result], $result === true ? '200' : '404');
}

/**
* Get zaken for a specific klant
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function getZaken(string $id): JSONResponse
{
$requestParams = ['klant' => $id];
$zaken = $this->objectService->getResultArrayForRequest('zaken', $requestParams);
return new JSONResponse($zaken);
}

/**
* Get taken for a specific klant
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function getTaken(string $id): JSONResponse
{
$requestParams = ['klant' => $id];
$taken = $this->objectService->getResultArrayForRequest('taken', $requestParams);
return new JSONResponse($taken);
}

/**
* Get berichten for a specific klant
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function getBerichten(string $id): JSONResponse
{
$requestParams = ['gebruikerID' => $id];
$berichten = $this->objectService->getResultArrayForRequest('klanten', $requestParams);
return new JSONResponse($berichten);
}

/**
* Get contactmomenten for a specific klant
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function getContactmomenten(string $id): JSONResponse
{
$requestParams = ['klant' => $id];
$contactmomenten = $this->objectService->getResultArrayForRequest('contactmomenten', $requestParams);
return new JSONResponse($contactmomenten);
}

/**
* Get audit trail for a specific klant
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function getAuditTrail(string $id): JSONResponse
{
$auditTrail = $this->objectService->getAuditTrail('klanten', $id);
return new JSONResponse($auditTrail);
}
}
16 changes: 15 additions & 1 deletion lib/Controller/TakenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,19 @@ public function destroy(string $id): JSONResponse

// Return the result as a JSON response
return new JSONResponse(['success' => $result], $result === true ? '200' : '404');
}
}

/**
* Get audit trail for a specific klant
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function getAuditTrail(string $id): JSONResponse
{
$auditTrail = $this->objectService->getAuditTrail('taken', $id);
return new JSONResponse($auditTrail);
}
}
13 changes: 13 additions & 0 deletions lib/Controller/ZakenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,17 @@ public function destroy(string $id): JSONResponse
return new JSONResponse(['success' => $result], $result === true ? '200' : '404');
}

/**
* Get audit trail for a specific klant
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function getAuditTrail(string $id): JSONResponse
{
$auditTrail = $this->objectService->getAuditTrail('zaken', $id);
return new JSONResponse($auditTrail);
}
}
1 change: 1 addition & 0 deletions src/entities/taak/taak.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const mockTaakData = (): TTaak[] => [
onderwerp: 'Uitvoering van een interne audit om de naleving van kwaliteitsnormen te controleren.',
toelichting: 'Deze taak omvat het uitvoeren van een gedetailleerde interne audit van de bedrijfsprocessen om te controleren of alle afdelingen voldoen aan de vastgestelde kwaliteitsnormen. De bevindingen worden gedocumenteerd en er worden aanbevelingen gedaan voor verbeteringen.',
actie: 'Voorbereiden van auditchecklist, uitvoeren van audits, rapporteren van bevindingen, aanbevelen van verbeteringen.',
klant: 'urn:uuid:6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b',
},
]

Expand Down
3 changes: 3 additions & 0 deletions src/entities/taak/taak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class Taak implements TTaak {
public onderwerp: string
public toelichting: string
public actie: string
public klant: string

constructor(source: TTaak) {
this.id = source.id || ''
Expand All @@ -21,6 +22,7 @@ export class Taak implements TTaak {
this.onderwerp = source.onderwerp || ''
this.toelichting = source.toelichting || ''
this.actie = source.actie || ''
this.klant = source.klant || ''
}

public validate(): SafeParseReturnType<TTaak, unknown> {
Expand All @@ -33,6 +35,7 @@ export class Taak implements TTaak {
onderwerp: z.string().min(1),
toelichting: z.string(),
actie: z.string(),
klant: z.string(),
})

return schema.safeParse(this)
Expand Down
1 change: 1 addition & 0 deletions src/entities/taak/taak.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export type TTaak = {
onderwerp: string;
toelichting: string;
actie: string;
klant: string;
}
14 changes: 9 additions & 5 deletions src/modals/berichten/EditBericht.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { berichtStore, navigationStore } from '../../store/store.js'
import { berichtStore, navigationStore, klantStore } from '../../store/store.js'
</script>

<template>
Expand Down Expand Up @@ -76,8 +76,8 @@ import { berichtStore, navigationStore } from '../../store/store.js'
label="Batch ID" />

<NcTextField
:disabled="loading"
:value.sync="berichtItem.gebruikerID"
:disabled="true"
:value="klantStore.klantItem?.id || berichtItem.gebruikerID"
label="Gebruiker ID" />

<NcTextField
Expand Down Expand Up @@ -115,7 +115,7 @@ import { berichtStore, navigationStore } from '../../store/store.js'
</template>

<script>
import { NcButton, NcLoadingIcon, NcDialog, NcTextField, NcTextArea } from '@nextcloud/vue'
import { NcButton, NcLoadingIcon, NcDialog, NcTextField, NcTextArea, NcNoteCard } from '@nextcloud/vue'
import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'
import Cancel from 'vue-material-design-icons/Cancel.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
Expand All @@ -129,6 +129,7 @@ export default {
NcTextArea,
NcButton,
NcLoadingIcon,
NcNoteCard,
// Icons
ContentSaveOutline,
Cancel,
Expand Down Expand Up @@ -176,9 +177,11 @@ export default {
referentie: berichtStore.berichtItem.referentie || '',
berichtID: berichtStore.berichtItem.berichtID || '',
batchID: berichtStore.berichtItem.batchID || '',
gebruikerID: berichtStore.berichtItem.gebruikerID || '',
gebruikerID: klantStore.klantItem?.id || berichtStore.berichtItem.gebruikerID || '',
volgorde: berichtStore.berichtItem.volgorde || '',
}
} else if (klantStore.klantItem?.id) {
this.berichtItem.gebruikerID = klantStore.klantItem.id
}
this.hasUpdated = true
}
Expand Down Expand Up @@ -212,6 +215,7 @@ export default {
try {
await berichtStore.saveBericht({
...this.berichtItem,
gebruikerID: klantStore.klantItem?.id || this.berichtItem.gebruikerID,
})
this.success = true
this.loading = false
Expand Down
2 changes: 2 additions & 0 deletions src/modals/klanten/EditKlant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ import {
NcDialog,
NcTextField,
NcLoadingIcon,
NcNoteCard,
} from '@nextcloud/vue'
import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'
import Cancel from 'vue-material-design-icons/Cancel.vue'
Expand All @@ -138,6 +139,7 @@ export default {
NcTextField,
NcButton,
NcLoadingIcon,
NcNoteCard,
// Icons
ContentSaveOutline,
Cancel,
Expand Down
14 changes: 13 additions & 1 deletion src/modals/taken/EditTaak.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { taakStore, navigationStore } from '../../store/store.js'
import { taakStore, navigationStore, klantStore } from '../../store/store.js'
</script>

<template>
Expand Down Expand Up @@ -44,6 +44,11 @@ import { taakStore, navigationStore } from '../../store/store.js'
:disabled="loading"
:value.sync="taakItem.toelichting"
label="Toelichting" />

<NcTextField
:disabled="true"
:value="taakItem.klant"
label="Klant" />
</div>

<template #actions>
Expand Down Expand Up @@ -82,6 +87,7 @@ import {
NcTextArea,
NcSelect,
NcLoadingIcon,
NcNoteCard,
} from '@nextcloud/vue'
import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'
import Cancel from 'vue-material-design-icons/Cancel.vue'
Expand All @@ -97,6 +103,7 @@ export default {
NcButton,
NcSelect,
NcLoadingIcon,
NcNoteCard,
// Icons
ContentSaveOutline,
Cancel,
Expand All @@ -115,6 +122,7 @@ export default {
status: '',
onderwerp: '',
toelichting: '',
klant: '',
},
}
},
Expand All @@ -128,7 +136,10 @@ export default {
status: taakStore.taakItem.status || '',
onderwerp: taakStore.taakItem.onderwerp || '',
toelichting: taakStore.taakItem.toelichting || '',
klant: klantStore.klantItem?.id || '',
}
} else {
this.taakItem.klant = klantStore.klantItem?.id || ''
}
this.hasUpdated = true
}
Expand All @@ -146,6 +157,7 @@ export default {
status: '',
onderwerp: '',
toelichting: '',
klant: '',
}
},
async editTaak() {
Expand Down
Loading

0 comments on commit b9f980e

Please sign in to comment.