CASH-1499: additional piece to update inactive promos
This commit is contained in:
parent
3c9493220c
commit
3d44e5522c
2 changed files with 13 additions and 0 deletions
|
|
@ -195,6 +195,7 @@ export default {
|
||||||
name: "cart",
|
name: "cart",
|
||||||
props: {
|
props: {
|
||||||
modelValue: Object,
|
modelValue: Object,
|
||||||
|
inactivePromos: Object,
|
||||||
damage: Object,
|
damage: Object,
|
||||||
servicePackageOptionsCmsName: String,
|
servicePackageOptionsCmsName: String,
|
||||||
availableVaps: Object,
|
availableVaps: Object,
|
||||||
|
|
@ -327,15 +328,26 @@ export default {
|
||||||
this.lineItems.vaps = [...lineItems.vaps];
|
this.lineItems.vaps = [...lineItems.vaps];
|
||||||
this.lineItems.promos = [...lineItems.promos];
|
this.lineItems.promos = [...lineItems.promos];
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false);
|
await this.dispatchStoreAction(storeActions.SAVE_VAPS, this.lineItems.vaps, false);
|
||||||
|
|
||||||
|
// any new promos that are also in inactive list?
|
||||||
|
const newInactivePromos = this.inactivePromos.filter((promo) => {
|
||||||
|
return this.lineItems.promos.includes(promo);
|
||||||
|
});
|
||||||
|
this.updateInactivePromos(newInactivePromos);
|
||||||
|
|
||||||
await this.dispatchStoreAction(
|
await this.dispatchStoreAction(
|
||||||
storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS,
|
storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS,
|
||||||
{
|
{
|
||||||
activePromos: this.lineItems.promos,
|
activePromos: this.lineItems.promos,
|
||||||
|
inactivePromos: this.inactivePromos,
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateInactivePromos(newInactivePromos) {
|
||||||
|
this.$emit("update:inactivePromos", newInactivePromos);
|
||||||
|
},
|
||||||
getPromoCodeList() {
|
getPromoCodeList() {
|
||||||
if (this.$refs["promoModalQuestion"]) {
|
if (this.$refs["promoModalQuestion"]) {
|
||||||
return this.$refs["promoModalQuestion"].getPromoCodeList();
|
return this.$refs["promoModalQuestion"].getPromoCodeList();
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
:availableVaps="availableVaps"
|
:availableVaps="availableVaps"
|
||||||
:allowItemRemoval="true"
|
:allowItemRemoval="true"
|
||||||
v-model="lineItems"
|
v-model="lineItems"
|
||||||
|
v-model:inactivePromos="inactivePromos"
|
||||||
pageName="payment-method"
|
pageName="payment-method"
|
||||||
servicePackageOptionsCmsName="ServicePackageTitle"
|
servicePackageOptionsCmsName="ServicePackageTitle"
|
||||||
recyclingModalCmsWidgetName="RecycleModal"
|
recyclingModalCmsWidgetName="RecycleModal"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue