Is there a way to prevent this event from triggering once the "dispensed" button is clicked in another module? Here is the code snippet:
stopDrugOrder(e: Event, drugOrder: any, drugName: string) {
const confirmDialog = this.dialog.open(SharedConfirmationComponent, {
width: "25%",
data: {
modalTitle: `Stop Medicaton`,
modalMessage: `You are about to stop ${drugName} for this patient, Click confirm to finish!`,
showRemarksInput: true,
},
disableClose: false,
panelClass: "custom-dialog-container",
});
confirmDialog.afterClosed().subscribe((confirmationObject) => {
if (confirmationObject?.confirmed) {
this.encounterService
.voidEncounterWithReason({
...drugOrder?.encounter,
voidReason: confirmationObject?.remarks || "",
})
.subscribe((response) => {
if (!response?.error) {
this.loadVisit.emit(this.visit);
}
if (response?.error) {
this.errors = [...this.errors, response?.error];
}
});
}
I'm stuck on this issue, any suggestions would be greatly appreciated