Removing toast
This commit is contained in:
parent
fa16142627
commit
3873c23716
2 changed files with 19 additions and 22 deletions
|
|
@ -34,7 +34,6 @@
|
|||
class="pb-3"
|
||||
v-model="lineItems"
|
||||
:availableVaps="availableVaps"
|
||||
@added-to-cart="showAlert"
|
||||
linkWidgetName="PromoLinkWidget"
|
||||
modalWidgetName="PromoModalWidget" />
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,14 @@
|
|||
cmsWidgetName="AlertInvalidPromoWidget"
|
||||
alertClass="alert-danger"
|
||||
v-bind:isDismissible="true" />
|
||||
<alert
|
||||
ref="alertInvalidPromoOnOrder"
|
||||
v-if="displayInvalidOnOrderPromoAlert"
|
||||
v-html="InvalidPromoOnOrderText"
|
||||
class="my-4 alert"
|
||||
cmsWidgetName="AlertInvalidPromoOnOrderWidget"
|
||||
alertClass="alert-danger"
|
||||
v-bind:isDismissible="true" />
|
||||
<div v-for="(promo, i) in this.getPromoList()" :key="i">
|
||||
<span class="applied-promo">Promo code "{{ promo.promoCode }}" applied </span>
|
||||
<textLink
|
||||
|
|
@ -42,7 +50,9 @@ 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,
|
||||
} from "@/helpers/promotions-helper";
|
||||
import { deepClone } from "@/helpers/object-helper";
|
||||
import baseMixin from "@/mixins/base-mixin.js";
|
||||
import { cartItemCategories } from "@/constants/cart-item-categories";
|
||||
|
|
@ -97,9 +107,6 @@ export default {
|
|||
InvalidPromoText() {
|
||||
return this.PromoText?.replaceAll("{custom:PROMOCODE}", this.promoCode);
|
||||
},
|
||||
AddPromoSuccessMessageFromCms() {
|
||||
return this.getCmsContent("PromoSuccessAlertWidget", "Text");
|
||||
},
|
||||
removeLinkText() {
|
||||
return this.getCmsContent("RemoveCartItemTextWidget", "Text");
|
||||
},
|
||||
|
|
@ -165,6 +172,7 @@ export default {
|
|||
async addPromoCode() {
|
||||
if (this.promoCode) {
|
||||
this.resetAlerts();
|
||||
|
||||
const promoCodeData = await this.getPromoCodeData(
|
||||
this.promoCode,
|
||||
this.lineItems,
|
||||
|
|
@ -173,15 +181,6 @@ export default {
|
|||
);
|
||||
|
||||
if (promoCodeData.isValid) {
|
||||
const addedPromo = this.lineItems?.promos.find(
|
||||
(promoItem) =>
|
||||
promoItem?.promoCode == promoCodeData.promoCode?.[0]?.promoCode
|
||||
);
|
||||
if (addedPromo) {
|
||||
this.displayInvalidPromoAlert = true;
|
||||
this.focusOnPromoInput();
|
||||
this.resetModalButtonStyle();
|
||||
} else {
|
||||
const pricedLineItemsToTax = [];
|
||||
pricedLineItemsToTax.push(...promoCodeData.promoCode);
|
||||
const taxedLineItems =
|
||||
|
|
@ -221,17 +220,15 @@ export default {
|
|||
this.lineItems?.promos.push(...promoCodeData.promoCode);
|
||||
this.lineItems.vaps?.push(...getVaps);
|
||||
this.closeModal();
|
||||
const message = this.getPromoAddedMessage();
|
||||
this.$emit("update:modelValue", this.lineItems);
|
||||
this.$emit("added-to-cart", {
|
||||
messageHeadline: "Promo Applied!",
|
||||
messageCopy: message,
|
||||
type: "alert-success",
|
||||
isDismissible: true,
|
||||
});
|
||||
this.promoCode = "";
|
||||
}
|
||||
} else {
|
||||
if(promoCodeData.errorCode == "PromoStackingNotAllowed")
|
||||
{
|
||||
this.displayInvalidPromoOnOrderAlert = true;
|
||||
this.focusOnPromoInput();
|
||||
this.resetModalButtonStyle();
|
||||
}
|
||||
this.displayInvalidPromoAlert = true;
|
||||
this.focusOnPromoInput();
|
||||
this.resetModalButtonStyle();
|
||||
|
|
@ -242,6 +239,7 @@ export default {
|
|||
watch: {
|
||||
promoCode() {
|
||||
this.displayInvalidPromoAlert = false;
|
||||
this.displayInvalidOnOrderPromoAlert = false;
|
||||
},
|
||||
modelValue: {
|
||||
handler(newValue) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue