Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/order results renderer delete button #40

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
.length > 0
"
>
<tr *ngIf="!labTest?.voided">
<tr *ngIf="order.uuid !== labOrder.uuid">
<td
[attr.rowspan]="
showParameters[labTest?.uuid]
Expand Down Expand Up @@ -100,13 +100,13 @@
/>
<span>More details</span>
</button>
<!-- <button
<button
mat-menu-item
(click)="onDeleteTest($event, labTest)"
>
<mat-icon>delete</mat-icon>
<span>Delete</span>
</button> -->
</button>
</mat-menu>
</td>
</tr>
Expand Down Expand Up @@ -226,13 +226,13 @@
/>
<span>More details</span>
</button>
<!-- <button
<button
mat-menu-item
(click)="onDeleteTest($event, labTest)"
>
<mat-icon>delete</mat-icon>
<span>Delete</span>
</button> -->
</button>
</mat-menu>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ export class OrderResultsRendererComponent implements OnInit {
},
];
this.voidingLabOrderState$ = this.store.select(getLabOrderVoidingState);

this.labOrdersResultsInformation = this.labOrdersResultsInformation.filter(
labTest => !labTest.voided
);
}

toggleParametes(event: Event, labTest: any): void {
Expand Down Expand Up @@ -181,38 +185,46 @@ export class OrderResultsRendererComponent implements OnInit {
this.updateConsultationOrder.emit();
}

onDeleteTest(e: Event, labOrder): void {
e.stopPropagation();
// this.store.dispatch(deleteLabOrder({ uuid: labOrder?.uuid }));
const confirmDialog = this.dialog.open(SharedConfirmationComponent, {
minWidth: "25%",
data: {
modalTitle: `Delete ${labOrder?.concept?.display}`,
modalMessage: `You are about to delete ${labOrder?.concept?.display} for this patient, Click confirm to delete!`,
showRemarksInput: true,
},
disableClose: false,
panelClass: "custom-dialog-container",
});
confirmDialog.afterClosed().subscribe((confirmationObject) => {
if (confirmationObject?.confirmed) {
this.ordersService
.voidOrderWithReason({
...labOrder,
voidReason: confirmationObject?.remarks || "",
})
.subscribe((response) => {
if (!response?.error) {
this.reloadOrderComponent.emit();
}
if (response?.error) {
this.errors = [...this.errors, response?.error];
}
});
}
});
}
onDeleteTest(e: Event, labOrder: any): void {
e.stopPropagation();
this.store.dispatch(deleteLabOrder({ uuid: labOrder?.uuid }));
const confirmDialog = this.dialog.open(SharedConfirmationComponent, {
minWidth: "25%",
data: {
modalTitle: `Delete ${labOrder?.concept?.display}`,
modalMessage: `You are about to delete ${labOrder?.concept?.display} for this patient, Click confirm to delete!`,
showRemarksInput: true,
},
disableClose: false,
panelClass: "custom-dialog-container",
});
confirmDialog.afterClosed().subscribe((confirmationObject) => {
if (confirmationObject?.confirmed) {
this.ordersService
.voidOrderWithReason({
...labOrder,
voidReason: confirmationObject?.remarks || "",
})
.subscribe((response) => {
if (!response?.error) {
this.labOrdersResultsInformation = this.labOrdersResultsInformation.filter(
(order) => order.uuid !== labOrder.uuid
);
this.reloadOrderComponent.emit();
}
if (response?.error) {
this.errors = [...this.errors, response?.error];
}
});
}
});
}

// refreshLabTests(): void {
// const departments = this.investigationAndProceduresFormsDetails?.setMembers;
// this.labOrdersResultsInformation = this.getLabTests(departments);
// }

getLabTests(departments): any {
const labDepartment = ((departments || [])?.filter(
(department) => department?.name?.toLowerCase().indexOf("lab") === 0
Expand Down