diff --git a/src/app/openmrs-api/encounter-resource.service.ts b/src/app/openmrs-api/encounter-resource.service.ts index a9f6f8181..f01e1a60c 100644 --- a/src/app/openmrs-api/encounter-resource.service.ts +++ b/src/app/openmrs-api/encounter-resource.service.ts @@ -101,11 +101,11 @@ export class EncounterResourceService { return this.http.post(url, JSON.stringify(payload), { headers }); } - public voidEncounter(uuid: string) { + public voidEncounter(uuid: string, voidReason: string) { if (!uuid) { return null; } - const url = this.getUrl() + 'encounter/' + uuid + '?!purge'; + const url = `${this.getUrl()}encounter/${uuid}?reason=${voidReason}`; const headers = new HttpHeaders({ 'Content-Type': 'application/json' }); return this.http.delete(url, { headers }); } diff --git a/src/app/openmrs-api/visit-resource.service.ts b/src/app/openmrs-api/visit-resource.service.ts index 1c88eec32..03cd1a9b5 100644 --- a/src/app/openmrs-api/visit-resource.service.ts +++ b/src/app/openmrs-api/visit-resource.service.ts @@ -66,6 +66,16 @@ export class VisitResourceService { .pipe(map(this.parseVisitResponse), catchError(this.handleError)); } + public voidVisit(uuid, voidReason) { + if (!voidReason || !uuid) { + return null; + } + const headers = new HttpHeaders({ 'Content-Type': 'application/json' }); + return this.http + .delete(`${this.getUrl()}/${uuid}?reason=${voidReason}`, { headers }) + .pipe(map(this.parseVisitResponse), catchError(this.handleError)); + } + public updateVisit(uuid, payload) { if (!payload || !uuid) { return null; diff --git a/src/app/patient-dashboard/common/visit/visit-details/visit-details.component.html b/src/app/patient-dashboard/common/visit/visit-details/visit-details.component.html index 43a699018..516e58246 100644 --- a/src/app/patient-dashboard/common/visit/visit-details/visit-details.component.html +++ b/src/app/patient-dashboard/common/visit/visit-details/visit-details.component.html @@ -127,7 +127,7 @@