CASH-2180: Remove QPD parts for insurance orders
This commit is contained in:
parent
63638f6f6d
commit
d47ecb5cc0
1 changed files with 17 additions and 0 deletions
|
|
@ -59,6 +59,7 @@ import store from "@/store";
|
||||||
import { flushSaveSessionQueue } from "@/helpers/heritage-integration/order-helper";
|
import { flushSaveSessionQueue } from "@/helpers/heritage-integration/order-helper";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import { required, regex } from "@/helpers/validation-rules";
|
import { required, regex } from "@/helpers/validation-rules";
|
||||||
|
import { partTypeStrings } from "@/constants/part-type-strings";
|
||||||
|
|
||||||
defineRule("insurance-company-required", required(errorMessages.INSURANCE_COMPANY_REQUIRED));
|
defineRule("insurance-company-required", required(errorMessages.INSURANCE_COMPANY_REQUIRED));
|
||||||
|
|
||||||
|
|
@ -164,6 +165,8 @@ export default {
|
||||||
// await any pending save-sessions. if you don't, we will save the new parent account into vuex and then a pending async save-session response overwrites it
|
// await any pending save-sessions. if you don't, we will save the new parent account into vuex and then a pending async save-session response overwrites it
|
||||||
await flushSaveSessionQueue();
|
await flushSaveSessionQueue();
|
||||||
|
|
||||||
|
this.removeQPDLineItemIfExists();
|
||||||
|
|
||||||
await this.dispatchStoreAction(
|
await this.dispatchStoreAction(
|
||||||
this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER,
|
this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER,
|
||||||
this.parentAccountNumber.toString(),
|
this.parentAccountNumber.toString(),
|
||||||
|
|
@ -193,6 +196,20 @@ export default {
|
||||||
handlePageShow() {
|
handlePageShow() {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
},
|
},
|
||||||
|
removeQPDLineItemIfExists() {
|
||||||
|
const lineItems = deepClone(store.getters.order.lineItems);
|
||||||
|
const removeQPDpartIndex = lineItems?.supportingItems.findIndex(
|
||||||
|
(item) => item.partType == partTypeStrings.QUOTE_PAGE_DISCOUNT
|
||||||
|
);
|
||||||
|
if (removeQPDpartIndex >= 0) {
|
||||||
|
lineItems.supportingItems.splice(removeQPDpartIndex, 1);
|
||||||
|
baseMixin.methods.dispatchStoreAction(
|
||||||
|
storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING,
|
||||||
|
lineItems.supportingItems,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
window.removeEventListener("pageshow", this.handlePageShow);
|
window.removeEventListener("pageshow", this.handlePageShow);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue