Skip to content

Commit

Permalink
Add RDE validation on encounters filled before initial
Browse files Browse the repository at this point in the history
  • Loading branch information
kantush committed Sep 29, 2023
1 parent ae733c4 commit e7f0e4a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ <h3 *ngIf="confirmingCancelVisit || confirmingEndVisit">
>To access clinical forms kindly fill Covid 19 Assessment Form</strong
>
</div>
<div
class="alert alert-danger"
*ngIf="isAdultReturnVisitBeforeInitialVisit"
style="margin-top: 10px"
>
<strong>Oops! You cannot schedule an Adult return visit for a date that comes before the initial visit</strong>
</div>
</div>
</div>
<span style="padding: 10px"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class VisitDetailsComponent implements OnInit {
'3bb41949-6596-4ff9-a54f-d3d7883a69ed';
public qualifiesForCovidScreening = false;
public isRetrospectiveVisit = false;
public isAdultReturnVisitBeforeInitialVisit = false;

public get visitEncounters(): any[] {
const mappedEncounters: Encounter[] = new Array<Encounter>();
Expand Down Expand Up @@ -226,9 +227,20 @@ export class VisitDetailsComponent implements OnInit {
Array.isArray(visitType.encounterTypes.disallowedEncounters)
) {
visitType.encounterTypes.disallowedEncounters.forEach((e) => {
if (e.errors && e.errors.covidError != null) {
if (
e.errors &&
e.errors.covidError != null &&
!this.isRetrospectiveVisit
) {
this.qualifiesForCovidScreening = true;
}
if (
e.errors &&
e.errors.isAdultReturnVisitBeforeInitialVisit != null &&
this.isRetrospectiveVisit
) {
this.isAdultReturnVisitBeforeInitialVisit = true;
}
});
}

Expand Down

0 comments on commit e7f0e4a

Please sign in to comment.