More changes from tech review

This commit is contained in:
Leah Schumann 2023-03-08 13:23:53 -05:00
parent cff0f89e76
commit 4b6be3fa5c
4 changed files with 27 additions and 18 deletions

View file

@ -7,7 +7,7 @@ export async function getPricedMobileFeePart(serviceZipCode) {
}
const zipCodeData = await baseMixin.methods.getZipCodeData(serviceZipCode);
// Get the Mobile Fee Part
const mobileFeePart = await baseMixin.methods.dispatchStoreAction(
storeActions.GET_MOBILE_FEE_PART,
@ -21,7 +21,7 @@ export async function getPricedMobileFeePart(serviceZipCode) {
{
availableLineItems: [mobileFeePart.data],
serviceZipCode: serviceZipCode,
ctu: zipCodeData.zipCodeCtu,
serviceZipCodeCtu: zipCodeData.zipCodeCtu,
},
false
);

View file

@ -59,6 +59,7 @@ import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location
// Helpers
import { deepClone } from "@/helpers/object-cloning-helper";
import { object } from "yup/lib/locale";
export default {
name: "mobile-location-modal-questions",
@ -81,10 +82,12 @@ export default {
zipCode: "",
},
isVehicleProtected: null,
serviceZipCode: "",
mobileFeePart: null,
}),
},
mobileFeePart: {
type: Object,
default: () => ({}),
},
isZipServiceableMobile: Boolean,
isZipServiceableInShop: Boolean,
linkWidgetName: String,
@ -122,13 +125,14 @@ export default {
return cmsContentText.replaceAll("{custom:mobileFee}", this.mobileFee);
},
mobileFee() {
if (!this.modelValue.mobileFeePart) {
if (!this.mobileFeePart) {
return 0;
}
return (
this.modelValue.mobileFeePart.laborAmount +
this.modelValue.mobileFeePart.sellingPrice +
this.modelValue.mobileFeePart.kitPrice
this.mobileFeePart.laborAmount +
this.mobileFeePart.sellingPrice +
this.mobileFeePart.kitPrice
);
},
modalFooterText() {

View file

@ -11,6 +11,7 @@
modalWidgetName="ServiceZipModalWidget" />
<mobileLocationModalQuestions
v-model="mobileLocationQuestions"
:mobileFeePart="mobileFeePart"
ref="mobileLocationModalQuestions"
linkWidgetName="MobileLocationLinkWidget"
modalWidgetName="MobileLocationModalWidget" />
@ -90,7 +91,7 @@ export default {
},
set: function (newValue) {
if (newValue.zipCode !== this.zipCode) {
this.resetMobileLocation(this.zipCode);
this.resetMobileLocation(newValue.zipCode);
}
this.state = newValue.state;
@ -108,7 +109,6 @@ export default {
zipCode: this.zipCode,
},
isVehicleProtected: this.isVehicleProtected,
mobileFeePart: this.mobileFeePart,
};
},
set: function (newValue) {
@ -119,17 +119,17 @@ export default {
this.state = newValue.addressQuestions.state;
this.zipCode = newValue.addressQuestions.zipCode;
this.isVehicleProtected = newValue.isVehicleProtected;
this.mobileFeePart = newValue.mobileFeePart;
},
},
},
methods: {
arePagePrerequisitesValid() {
return (
store.getters.lineItems.supportingItems !== null &&
store.getters.order.serviceLocation.zipCode !== null &&
store.getters.payment.isInsurance !== null
);
return true;
// return (
// store.getters.lineItems.supportingItems !== null &&
// store.getters.order.serviceLocation.zipCode !== null &&
// store.getters.payment.isInsurance !== null
// );
},
setData(mobileFeePart) {
if (mobileFeePart) {

View file

@ -1431,11 +1431,16 @@ export const actions = {
context.commit(storeMutations.UPDATE_VAPS, vaps);
},
// Price order actions
async priceOrderItemsAndSaveServerData(context, { availableLineItems, serviceZipCode, serviceZipCodeCtu }) {
async priceOrderItemsAndSaveServerData(
context,
{ availableLineItems, serviceZipCode, serviceZipCodeCtu }
) {
const zipCodeToUse = serviceZipCode
? serviceZipCode
: context.getters.order.serviceLocation.zipCode;
const ctuToUse = serviceZipCodeCtu ? serviceZipCodeCtu : context.getters.order.serviceLocation.zipCodeCtu;
const ctuToUse = serviceZipCodeCtu
? serviceZipCodeCtu
: context.getters.order.serviceLocation.zipCodeCtu;
const availableLineItemsFormattedForRequest =
getLineItemQueryStringForPricing(availableLineItems);