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",
|
||||
props: {
|
||||
modelValue: Object,
|
||||
inactivePromos: Object,
|
||||
damage: Object,
|
||||
servicePackageOptionsCmsName: String,
|
||||
availableVaps: Object,
|
||||
|
|
@ -327,15 +328,26 @@ export default {
|
|||
this.lineItems.vaps = [...lineItems.vaps];
|
||||
this.lineItems.promos = [...lineItems.promos];
|
||||
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(
|
||||
storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS,
|
||||
{
|
||||
activePromos: this.lineItems.promos,
|
||||
inactivePromos: this.inactivePromos,
|
||||
},
|
||||
false
|
||||
);
|
||||
},
|
||||
|
||||
updateInactivePromos(newInactivePromos) {
|
||||
this.$emit("update:inactivePromos", newInactivePromos);
|
||||
},
|
||||
getPromoCodeList() {
|
||||
if (this.$refs["promoModalQuestion"]) {
|
||||
return this.$refs["promoModalQuestion"].getPromoCodeList();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
:availableVaps="availableVaps"
|
||||
:allowItemRemoval="true"
|
||||
v-model="lineItems"
|
||||
v-model:inactivePromos="inactivePromos"
|
||||
pageName="payment-method"
|
||||
servicePackageOptionsCmsName="ServicePackageTitle"
|
||||
recyclingModalCmsWidgetName="RecycleModal"
|
||||
|
|
|
|||
Loading…
Reference in a new issue