CSR-1384: refactoring re: deepClone, naming
This commit is contained in:
parent
5903115a22
commit
575978ae65
2 changed files with 24 additions and 25 deletions
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<cart
|
||||
:damage="damageInfo"
|
||||
:availableLineItems="availableLineItems || []"
|
||||
:availableLineItems="availableLineItems"
|
||||
:lineItems="lineItems"
|
||||
servicePackageOptionsCmsName="ServicePackageTitle"
|
||||
@cart-remove="cartRemove" />
|
||||
|
|
@ -34,10 +34,10 @@
|
|||
|
||||
<add-vaps-modal-buttons
|
||||
:cartItems="cartItems"
|
||||
:wiperItems="availableWipers || []"
|
||||
:rainDefenseItem="availableRainDefense || {}"
|
||||
:wiperItems="availableWipers"
|
||||
:rainDefenseItem="availableRainDefense"
|
||||
vapsTilesCmsName="VapsProductTiles"
|
||||
v-on="{ 'buttonEvent.openModal': openModalAction }" />
|
||||
v-on="{ 'buttonEvent.openModal': openModal }" />
|
||||
|
||||
<div>
|
||||
<button v-on:click="ccdPayment">
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
alt="Afterpay" />
|
||||
</button>
|
||||
</div>
|
||||
<button @click="openModalAction('RainDefenseModal')">OPEN MODAL</button>
|
||||
<button @click="openModal('RainDefenseModal')">OPEN MODAL</button>
|
||||
<contentGroupModal ref="RainDefenseModal" cmsWidgetName="RainDefenseModal" />
|
||||
<navbar
|
||||
cmsWidgetName="FunnelFooterWidget"
|
||||
|
|
@ -160,21 +160,20 @@ export default {
|
|||
const glassPartsCopy = deepClone(store.getters.order.lineItems.glassParts) ?? [];
|
||||
|
||||
const availableLineItems = [
|
||||
resultMapCopy.rainDefense,
|
||||
...resultMapCopy.supportingItems,
|
||||
...resultMapCopy.wipers,
|
||||
resultMap.rainDefense,
|
||||
...resultMap.supportingItems,
|
||||
...resultMap.wipers,
|
||||
...glassPartsCopy,
|
||||
];
|
||||
|
||||
// TODO - DO WE NEED TO GET PRICINGRESULTS HERE? SEEMS TO BE THE SAME AS availableLineItems
|
||||
// const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
// storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
||||
// {
|
||||
// availableLineItems: availableLineItems,
|
||||
// },
|
||||
// "payment-method",
|
||||
// false
|
||||
// );
|
||||
const pricedAvailableLineItems = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
||||
{
|
||||
availableLineItems: availableLineItems,
|
||||
},
|
||||
"payment-method",
|
||||
false
|
||||
);
|
||||
const lineItems = store.getters.lineItems;
|
||||
|
||||
const cartItems = [...glassPartsCopy, ...lineItems.supportingItems, ...lineItems.vaps];
|
||||
|
|
@ -186,18 +185,18 @@ export default {
|
|||
vm.cartItems = cartItems; // TOBEREMOVED BY AJC IN CSR-1384
|
||||
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
vm.availableLineItems = availableLineItems;
|
||||
vm.availableLineItems = pricedAvailableLineItems;
|
||||
vm.lineItems = lineItems;
|
||||
});
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cartItems: [], // TOBEREMOVED BY AJC IN CSR-1384
|
||||
availableWipers: null, // TOBEREMOVED BY AJC IN CSR-1384
|
||||
availableRainDefense: null, // TOBEREMOVED BY AJC IN CSR-1384
|
||||
availableWipers: [], // TOBEREMOVED BY AJC IN CSR-1384
|
||||
availableRainDefense: {}, // TOBEREMOVED BY AJC IN CSR-1384
|
||||
|
||||
lineItems: null,
|
||||
availableLineItems: null,
|
||||
lineItems: [],
|
||||
availableLineItems: [],
|
||||
displayPaypalAlert: this.getPaypalAlert(),
|
||||
};
|
||||
},
|
||||
|
|
@ -254,7 +253,7 @@ export default {
|
|||
packageReqs && serviceLocationReqs && isInsuranceSet && scheduleReqs && customerReqs
|
||||
);
|
||||
},
|
||||
openModalAction(modalName) {
|
||||
openModal(modalName) {
|
||||
this.$refs[modalName].openModal();
|
||||
},
|
||||
getPaypalAlert() {
|
||||
|
|
|
|||
|
|
@ -2064,9 +2064,9 @@ export const actions = {
|
|||
|
||||
context.commit(storeMutations.UPDATE_LINE_ITEMS_SERVER_DATA, response.data.serverData);
|
||||
|
||||
availableLineItems = addPricesToLineItems(availableLineItems, response.data.lineItems);
|
||||
const pricedLineItems = addPricesToLineItems(availableLineItems, response.data.lineItems);
|
||||
|
||||
return availableLineItems;
|
||||
return pricedLineItems;
|
||||
},
|
||||
|
||||
// Misc order actions
|
||||
|
|
|
|||
Loading…
Reference in a new issue