Update orders.component.ts

This commit is contained in:
Nguyen Ha Khue
2023-04-20 14:10:31 +07:00
parent c8ab6b0d50
commit 2649368c8e
@@ -160,23 +160,44 @@ export class OrdersComponent implements OnInit {
} }
confirmBoxChangeStatus(successChangeStatus: TemplateRef<any>) { confirmBoxChangeStatus(successChangeStatus: TemplateRef<any>) {
if (!this.isHaveShipper) { if (this.shipper) {
if (this.shipper == undefined) { this.isHaveShipper = true;
}
} // console.log(this.isHaveShipper)
else { if (this.isHaveShipper) {
this.orderService.updateOrderShipper(this.userId, this.orderId, this.shipper.id).subscribe(() => { this.orderService.updateOrderShipper(this.userId, this.orderId, this.shipper.id).subscribe(() => {
this.orderService.updateOrderStatus(this.userId, this.orderId, this.selectedStatus).subscribe((res) => { }); this.orderService.updateOrderStatus(this.userId, this.orderId, this.selectedStatus).subscribe((res) => { });
this.layer1.hide(); this.layer1.hide();
this.layer1 = this.modalService.show(successChangeStatus, { class: "modal-sm" }); this.layer1 = this.modalService.show(successChangeStatus, { class: "modal-sm" });
}); })
}
} }
else { else {
this.orderService.updateOrderStatus(this.userId, this.orderId, this.selectedStatus).subscribe((res) => { }); this.orderService.updateOrderStatus(this.userId, this.orderId, this.selectedStatus).subscribe((res) => { });
this.layer1.hide(); this.layer1.hide();
this.layer1 = this.modalService.show(successChangeStatus, { class: "modal-sm" }); this.layer1 = this.modalService.show(successChangeStatus, { class: "modal-sm" });
} }
// if (!this.isHaveShipper) {
// if (this.shipper != undefined) {
// this.orderService.updateOrderStatus(this.userId, this.orderId, this.selectedStatus).subscribe((res) => { });
// this.layer1.hide();
// this.layer1 = this.modalService.show(successChangeStatus, { class: "modal-sm" });
// }
// else {
// this.orderService.updateOrderShipper(this.userId, this.orderId, this.shipper.id).subscribe(() => {
// this.orderService.updateOrderStatus(this.userId, this.orderId, this.selectedStatus).subscribe((res) => { });
// this.layer1.hide();
// this.layer1 = this.modalService.show(successChangeStatus, { class: "modal-sm" });
// });
// }
// }
// else {
// this.orderService.updateOrderStatus(this.userId, this.orderId, this.selectedStatus).subscribe((res) => { });
// this.layer1.hide();
// this.layer1 = this.modalService.show(successChangeStatus, { class: "modal-sm" });
// }
} }
decline() { decline() {