CSR-1393
This commit is contained in:
parent
33d2db26d7
commit
ae505070c2
2 changed files with 10 additions and 7 deletions
|
|
@ -16,7 +16,7 @@ export const addableVapsPromoPartNumbers = [
|
|||
promoPartNumberStrings.WIPER_DISCOUNT_PART_NUMBER,
|
||||
];
|
||||
|
||||
const promoErrorCodes = {
|
||||
export const promoErrorCodes = {
|
||||
UNKNOWN: "Unknown",
|
||||
PROMO_NOT_YET_IN_USE: "PromoNotYetInUse",
|
||||
PROMO_USAGE_COUNT_EXCEEDED: "PromoUsageCountExceeded",
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
<modal
|
||||
:ref="modalName"
|
||||
:headerText="modalHeaderText"
|
||||
:onModalClosedCallback="onModalClosed"
|
||||
:footerButtonText="modalFooterText"
|
||||
@footer-button-event="addPromoCode">
|
||||
<promoQuestion
|
||||
|
|
@ -50,7 +51,10 @@ import promoQuestion from "@/layouts/payment-method/promo-modal-question/promo-q
|
|||
import modal from "@/digital-components/modal/modal";
|
||||
import alert from "@/ux-components/alert/alert";
|
||||
import { storeActions } from "@/constants/store-actions.js";
|
||||
import { getVapsThatNeedToBeAddedToSatisfyPromos } from "@/helpers/promotions-helper";
|
||||
import {
|
||||
getVapsThatNeedToBeAddedToSatisfyPromos,
|
||||
promoErrorCodes,
|
||||
} from "@/helpers/promotions-helper";
|
||||
import { deepClone } from "@/helpers/object-helper";
|
||||
import baseMixin from "@/mixins/base-mixin.js";
|
||||
import { cartItemCategories } from "@/constants/cart-item-categories";
|
||||
|
|
@ -125,6 +129,9 @@ export default {
|
|||
closeModal() {
|
||||
this.modal.closeModal();
|
||||
},
|
||||
onModalClosed() {
|
||||
this.$emit("update:modelValue", this.lineItems);
|
||||
},
|
||||
focusOnPromoInput() {
|
||||
const input = document.getElementById(this.promoTextInputId);
|
||||
input?.focus();
|
||||
|
|
@ -160,12 +167,9 @@ export default {
|
|||
};
|
||||
},
|
||||
removeItem(promo) {
|
||||
//let lineItems = this.modelValue;
|
||||
this.lineItems[cartItemCategories.PROMOS] = this.lineItems[
|
||||
cartItemCategories.PROMOS
|
||||
].filter((lineItemsToKeep) => lineItemsToKeep.promoCode != promo);
|
||||
|
||||
this.$emit("update:modelValue", this.lineItems);
|
||||
},
|
||||
async addPromoCode() {
|
||||
if (this.promoCode) {
|
||||
|
|
@ -212,10 +216,9 @@ export default {
|
|||
this.lineItems?.promos.push(...promoCodeData.promoCode);
|
||||
this.lineItems.vaps?.push(...getVaps);
|
||||
this.closeModal();
|
||||
this.$emit("update:modelValue", this.lineItems);
|
||||
this.promoCode = "";
|
||||
} else {
|
||||
if (promoCodeData.errorCode == "PromoStackingNotAllowed") {
|
||||
if (promoCodeData.errorCode == promoErrorCodes.PROMO_STACKING_NOT_ALLOWED) {
|
||||
this.displayInvalidPromoOnOrderAlert = true;
|
||||
this.focusOnPromoInput();
|
||||
this.resetModalButtonStyle();
|
||||
|
|
|
|||
Loading…
Reference in a new issue