Merge branch 'release/heavy.truck' into nation/CASH-417

This commit is contained in:
CarlNation 2025-04-03 09:10:09 -04:00
commit 809c96e654
3 changed files with 58 additions and 0 deletions

View file

@ -149,6 +149,23 @@ export async function getAvailabilityRating(
return shopStatus; return shopStatus;
} }
export async function getClosestApplicableShops(serviceZipCode, carId, pageNameToLog) {
if (!serviceZipCode) {
return null;
}
const closestShops = await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.GET_CLOSEST_APPLICABLE_SHOPS,
{
zip: serviceZipCode,
carId: carId,
},
pageNameToLog
);
return closestShops.data;
}
export async function getZipCodeData(serviceZipCode) { export async function getZipCodeData(serviceZipCode) {
return await baseMixin.methods.getZipCodeData(serviceZipCode, "service-location"); return await baseMixin.methods.getZipCodeData(serviceZipCode, "service-location");
} }

View file

@ -15,6 +15,8 @@
editScreenReaderTextCmsWidgetName="ScreenReaderZipEditWidget" editScreenReaderTextCmsWidgetName="ScreenReaderZipEditWidget"
v-model="serviceZipCodeQuestion" v-model="serviceZipCodeQuestion"
ref="serviceZipCodeQuestion" ref="serviceZipCodeQuestion"
:carId="carId"
:isVehicleHeavyTruck="isVehicleHeavyTruck"
:mobileFeePart="mobileFeePart" :mobileFeePart="mobileFeePart"
@updated-mobile-fee-part="setMobileFeePart" @updated-mobile-fee-part="setMobileFeePart"
@updated-recycle-fee-part="setRecycleFeePart" @updated-recycle-fee-part="setRecycleFeePart"
@ -186,9 +188,11 @@ export default {
return { return {
streetAddress: this.getServiceAddressFromStore(), streetAddress: this.getServiceAddressFromStore(),
apartmentNumberOrBusinessName: this.getServiceAddress2FromStore(), apartmentNumberOrBusinessName: this.getServiceAddress2FromStore(),
carId: this.getCarIdfromStore(),
city: this.getServiceCityFromStore(), city: this.getServiceCityFromStore(),
state: this.getServiceStateFromStore(), state: this.getServiceStateFromStore(),
zipCode: this.getServiceZipCodeFromStore(), zipCode: this.getServiceZipCodeFromStore(),
isVehicleHeavyTruck: this.getIsVehicleHeavyTruckFromStore(),
isVehicleProtected: this.getIsVehicleProtectedFromStore(), isVehicleProtected: this.getIsVehicleProtectedFromStore(),
isGlassServiceableInshop: null, isGlassServiceableInshop: null,
isRecalibrationServiceableInshop: null, isRecalibrationServiceableInshop: null,
@ -514,6 +518,9 @@ export default {
}); });
} }
}, },
getCarIdfromStore() {
return store.getters.vehicle.carId;
},
getServiceAddressFromStore() { getServiceAddressFromStore() {
return store.getters.order.serviceLocation.address; return store.getters.order.serviceLocation.address;
}, },
@ -529,6 +536,9 @@ export default {
getServiceZipCodeFromStore() { getServiceZipCodeFromStore() {
return store.getters.order.serviceLocation.zipCode; return store.getters.order.serviceLocation.zipCode;
}, },
getIsVehicleHeavyTruckFromStore() {
return store.getters.isHeavyTruckVehicle;
},
getIsVehicleProtectedFromStore() { getIsVehicleProtectedFromStore() {
return store.getters.order.serviceLocation.isVehicleProtected; return store.getters.order.serviceLocation.isVehicleProtected;
}, },

View file

@ -33,6 +33,13 @@
cmsWidgetName="AlertInvalidZipWidget" cmsWidgetName="AlertInvalidZipWidget"
alertClass="alert-danger" alertClass="alert-danger"
v-bind:isDismissible="false" /> v-bind:isDismissible="false" />
<alert
ref="AlertNoService"
v-if="displayNoServiceAlert"
class="my-4"
cmsWidgetName="AlertNoServiceWidget"
alertClass="alert-danger"
v-bind:isDismissible="false" />
</modal> </modal>
</template> </template>
@ -48,6 +55,7 @@ import {
getPricedRecycleFeePart, getPricedRecycleFeePart,
getServiceabilityDetails, getServiceabilityDetails,
getBillToAccountNumber, getBillToAccountNumber,
getClosestApplicableShops,
} from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
export default { export default {
@ -63,6 +71,7 @@ export default {
internalModel: this.copyModel(this.modelValue), internalModel: this.copyModel(this.modelValue),
serviceZipCodeTextInputId: "", serviceZipCodeTextInputId: "",
displayInvalidZipAlert: false, displayInvalidZipAlert: false,
displayNoServiceAlert: false,
}; };
}, },
props: { props: {
@ -73,6 +82,11 @@ export default {
zipCode: "", zipCode: "",
}), }),
}, },
carId: String,
isVehicleHeavyTruck: {
type: Boolean,
default: false,
},
mobileFeePart: { mobileFeePart: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
@ -107,6 +121,7 @@ export default {
methods: { methods: {
resetAlerts() { resetAlerts() {
this.displayInvalidZipAlert = false; this.displayInvalidZipAlert = false;
this.displayNoServiceAlert = false;
}, },
resetsOnZipInput() { resetsOnZipInput() {
this.resetAlerts(); this.resetAlerts();
@ -155,6 +170,22 @@ export default {
this.focusOnZipInput(); this.focusOnZipInput();
this.resetModalButtonStyle(); this.resetModalButtonStyle();
} else { } else {
if (this.isVehicleHeavyTruck) {
// check the location endpoint to verify this zip can service a heavy truck
const closestShops = await getClosestApplicableShops(
this.internalModel.zipCode,
this.carId,
"service-location"
);
if (!closestShops || closestShops.providers?.length === 0) {
this.displayNoServiceAlert = true;
this.focusOnZipInput();
this.resetModalButtonStyle();
return null;
}
}
this.internalModel.state = zipCodeData.state; this.internalModel.state = zipCodeData.state;
this.internalModel.zipCodeCtu = zipCodeData.zipCodeCtu; this.internalModel.zipCodeCtu = zipCodeData.zipCodeCtu;