diff --git a/projects/valtimo/config/assets/core/de.json b/projects/valtimo/config/assets/core/de.json index 71d1e6233..98487cb2b 100644 --- a/projects/valtimo/config/assets/core/de.json +++ b/projects/valtimo/config/assets/core/de.json @@ -164,6 +164,11 @@ "cancel": "Absagen", "delete": "Löschen" }, + "delete": { + "delete": "Case löschen", + "description": "Möchten Sie diesen Case und alle zugehörigen Informationen wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.", + "confirm": "Löschen" + }, "formio": { "noFormSpecified": "Für diese Registerkarte wurde keine Formulardefinition angegeben.", "formNotFound": "Die Formulardefinition '{{formDefinitionName}}' konnte nicht gefunden werden." diff --git a/projects/valtimo/config/assets/core/en.json b/projects/valtimo/config/assets/core/en.json index d56d58411..68515bbe6 100644 --- a/projects/valtimo/config/assets/core/en.json +++ b/projects/valtimo/config/assets/core/en.json @@ -164,6 +164,11 @@ "cancel": "Cancel", "delete": "Delete" }, + "delete": { + "delete": "Delete case", + "description": "Are you sure you want to delete this case and all related information? This action cannot be undone.", + "confirm": "Delete" + }, "formio": { "noFormSpecified": "No form definition has been specified for this tab.", "formNotFound": "The form definition '{{formDefinitionName}}' could not be found." diff --git a/projects/valtimo/config/assets/core/nl.json b/projects/valtimo/config/assets/core/nl.json index 73ac2a480..635f75dd0 100644 --- a/projects/valtimo/config/assets/core/nl.json +++ b/projects/valtimo/config/assets/core/nl.json @@ -164,6 +164,11 @@ "cancel": "Annuleren", "delete": "Verwijderen" }, + "delete": { + "delete": "Dossier verwijderen", + "description": "Weet u zeker dat u dit dossier en alle gerelateerde informatie wilt verwijderen? Deze actie kan niet ongedaan worden gemaakt.", + "confirm": "Verwijderen" + }, "formio": { "noFormSpecified": "Voor dit tabblad is geen formulierdefinitie opgegeven.", "formNotFound": "De formulierdefinitie '{{formDefinitionName}}' kan niet worden gevonden." diff --git a/projects/valtimo/document/src/lib/services/document.service.ts b/projects/valtimo/document/src/lib/services/document.service.ts index bd7b4db8f..31dc9eb46 100644 --- a/projects/valtimo/document/src/lib/services/document.service.ts +++ b/projects/valtimo/document/src/lib/services/document.service.ts @@ -274,6 +274,10 @@ export class DocumentService { return this.http.put(`${this.valtimoEndpointUri}v1/document`, document); } + public deleteDocument(documentId: string): Observable { + return this.http.delete(`${this.valtimoEndpointUri}v1/document/${documentId}`); + } + // ProcessDocument-calls public getProcessDocumentDefinitions(): Observable { return this.http.get( diff --git a/projects/valtimo/dossier/src/lib/components/dossier-detail/dossier-detail.component.html b/projects/valtimo/dossier/src/lib/components/dossier-detail/dossier-detail.component.html index db0540c13..f99bef33d 100644 --- a/projects/valtimo/dossier/src/lib/components/dossier-detail/dossier-detail.component.html +++ b/projects/valtimo/dossier/src/lib/components/dossier-detail/dossier-detail.component.html @@ -187,7 +187,28 @@ [disabled]="(isAssigning$ | async) || (isAssignedToCurrentUser$ | async)" (click)="claimAssignee()" > - {{ 'dossier.claimAssigneeCase' | translate }} + {{ 'dossier.claimAssigneeCase' | translate }} + + + + + + {{ 'assignDocument.remove' | translate }} + + + + + + {{ 'dossier.delete.delete' | translate }} @@ -204,6 +225,15 @@ + +
- - {{ 'assignDocument.remove' | translate }} - + + + + !!key) ); + public readonly showDeleteModal$: BehaviorSubject = new BehaviorSubject(false); + public readonly canView$: Observable = this.route.paramMap.pipe( switchMap((params: ParamMap) => this.permissionService.requestPermission(CAN_VIEW_CASE_PERMISSION, { @@ -238,6 +241,16 @@ export class DossierDetailComponent ) ); + public readonly isDeleting$ = new BehaviorSubject(false); + public readonly canDelete$: Observable = this.route.paramMap.pipe( + switchMap((params: ParamMap) => + this.permissionService.requestPermission(CAN_DELETE_CASE_PERMISSION, { + resource: DOSSIER_DETAIL_PERMISSION_RESOURCE.jsonSchemaDocument, + identifier: params.get('documentId') ?? '', + }) + ) + ); + public readonly loadingTabs$ = new BehaviorSubject(true); public readonly noTabsConfigured$ = new BehaviorSubject(false); public readonly showNoAccess$ = new BehaviorSubject(false); @@ -388,6 +401,25 @@ export class DossierDetailComponent }); } + public deleteDocument(): void { + this.showDeleteModal$.next(true); + } + + public onConfirmDelete(): void { + this.isDeleting$.next(true); + this.documentService.deleteDocument(this.documentId).subscribe({ + next: (): void => { + this.isDeleting$.next(false); + this.showDeleteModal$.next(false); + this.router.navigate([`/dossiers/${this.documentDefinitionName}`]); + }, + error: (): void => { + this.isDeleting$.next(false); + this.logger.debug('Something went wrong while deleting the case'); + }, + }); + } + public onTaskClickEvent(taskProcessLinkResult: TaskWithProcessLink): void { if (!taskProcessLinkResult.processLinkActivityResult) { this.isAdmin$.pipe(take(1)).subscribe(isAdmin => { diff --git a/projects/valtimo/dossier/src/lib/permissions/dossier-detail.permissions.ts b/projects/valtimo/dossier/src/lib/permissions/dossier-detail.permissions.ts index dab87f99e..9d4a5bbbd 100644 --- a/projects/valtimo/dossier/src/lib/permissions/dossier-detail.permissions.ts +++ b/projects/valtimo/dossier/src/lib/permissions/dossier-detail.permissions.ts @@ -66,6 +66,11 @@ const CAN_CREATE_CASE_PERMISSION: PermissionRequest = { resource: DOSSIER_DETAIL_PERMISSION_RESOURCE.jsonSchemaDocument, }; +const CAN_DELETE_CASE_PERMISSION: PermissionRequest = { + action: PERMISSION_ACTION.delete, + resource: DOSSIER_DETAIL_PERMISSION_RESOURCE.jsonSchemaDocument, +}; + export { CAN_ADD_NOTE_PERMISSION, CAN_ASSIGN_CASE_PERMISSION, @@ -75,4 +80,5 @@ export { DOSSIER_DETAIL_PERMISSION_RESOURCE, CAN_VIEW_CASE_PERMISSION, CAN_CREATE_CASE_PERMISSION, + CAN_DELETE_CASE_PERMISSION, }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 8b6afca40..b1eb43d79 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -248,7 +248,7 @@ export const environment: ValtimoConfig = { experimentalDmnEditing: true, largeLogoMargin: true, sortFilesByDate: true, - disableCaseCount: false, + disableCaseCount: true, returnToLastUrlAfterTokenExpiration: true, useStartEventNameAsStartFormTitle: true, allowUserThemeSwitching: true,