Merge branch 'develop' into feature/CSR-934

This commit is contained in:
Leah Schumann 2022-12-20 08:02:06 -05:00
commit d1db4a4787
21 changed files with 295 additions and 93 deletions

View file

@ -1,6 +1,9 @@
<template>
<label
:class="[buttonWrapperClasses, { 'has-error': errors.length > 0, selected: isChecked }]"
:class="[
buttonWrapperClasses,
{ 'has-error': errors.length > 0 && !suppressError, selected: isChecked },
]"
:for="buttonId"
@focusin="handleFocus"
@focusout="handleBlur"

View file

@ -27,4 +27,5 @@ export const inputButtonProps = {
type: Boolean,
default: false,
},
suppressError: Boolean,
};

View file

@ -51,6 +51,7 @@
:additionalButtonStyling="additionalButtonStyling"
:lastValuePushedToGa="lastValuePushedToGa"
:setLastValuePushedToGa="setLastValuePushedToGa"
:suppressError="suppressError"
v-model="selectedValues" />
<!-- For nested questions -->
<transition name="fade" mode="out-in">

View file

@ -2,7 +2,8 @@
<!-- Modal -->
<div
class="modal fade modal-component"
:id="this.cmsWidgetName"
v-on="{ 'hidden.bs.modal': resetButtonStyle }"
:id="cmsWidgetName"
tabindex="-1"
aria-labelledby="ModalComponentLabel"
aria-hidden="true">
@ -16,10 +17,14 @@
aria-label="Close"></button>
</div>
<div class="modal-body ps-4 pe-4 pt-5 pb-4">
<img :src="this.ModalImage" class="mw-100 d-flex mx-auto mb-4" alt="" />
<h5 class="mb-4" v-html="this.ModalHeadline"></h5>
<p class="fw-bold mb-2 subheader-text" v-html="this.ModalSubheadertext"></p>
<p class="mb-0" v-html="this.ModalBodyText"></p>
<img :src="ModalImage" class="mw-100 d-flex mx-auto mb-4" alt="" />
<h5 class="mb-4" v-html="ModalHeadline"></h5>
<p class="fw-bold mb-2 subheader-text" v-html="ModalSubheadertext"></p>
<p class="mb-0" v-html="ModalBodyText"></p>
<p
class="my-4 caption modal-sub-body"
v-if="ModalSubBodyText"
v-html="ModalSubBodyText"></p>
</div>
<div class="modal-footer px-5 py-4">
<buttonMain
@ -53,6 +58,9 @@ export default {
ModalBodyText() {
return this.getCmsContent(this.cmsWidgetName, "BodyText");
},
ModalSubBodyText() {
return this.getCmsContent(this.cmsWidgetName, "BodyText2");
},
ModalImage() {
return this.getCmsContent(this.cmsWidgetName, "Image");
},
@ -61,16 +69,10 @@ export default {
},
},
methods: {
setupModalEventListener() {
const modal = document.querySelector("#" + this.cmsWidgetName);
modal.addEventListener("hidden.bs.modal", (event) => {
this.$refs.buttonMain.resetButtonStyle();
});
resetButtonStyle() {
this.$refs.buttonMain.resetButtonStyle();
},
},
mounted() {
this.setupModalEventListener();
},
components: {
buttonMain,
},
@ -102,6 +104,9 @@ export default {
box-shadow: 0px 16px 48px -16px rgba(0, 0, 0, 0.25);
border-radius: 1.5rem 1.5rem 0 0;
.modal-body {
.modal-sub-body {
color: $gray-600;
}
ul {
margin-bottom: 0;
}

View file

@ -6,7 +6,12 @@
class="form-label"
:class="[questionAlignment === 'center' ? 'text-center w-100 mb-5' : '']"
v-html="labelText"></label>
<div class="input-wrapper" :class="[includeSearchIcon ? 'has-search-icon' : '']">
<div
class="input-wrapper"
:class="[
includeSearchIcon ? 'has-search-icon' : '',
includeCameraIcon ? 'has-camera-icon' : '',
]">
<input
class="form-control"
v-model.trim="value"
@ -31,6 +36,14 @@
:maxlength="maxLength ? maxLength : '999'"
@focus="$emit('focus', $event.target.value)" />
<button v-if="includeSearchIcon" type="submit" aria-label="Search button" />
<label class="camera-icon-input" v-if="includeCameraIcon">
<input
type="file"
id="vin-input"
accept="image/*"
aria-label="Camera icon/button"
@change="submitImage" />
</label>
</div>
<div v-show="errorMessage" class="row my-2 form-test-error">
<span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span>
@ -40,6 +53,7 @@
<script>
import { useField, validate } from "vee-validate";
import { storeActions } from "@/constants/store-actions";
export default {
name: "textbox-question",
@ -69,6 +83,7 @@ export default {
questionAlignment: String, // Left or center. Left is default.
cornerStyle: String, // Rounded or square. Square is default.
includeSearchIcon: Boolean,
includeCameraIcon: Boolean,
},
setup(props) {
const propsClone = Object.assign({}, props);
@ -105,6 +120,18 @@ export default {
errors,
};
},
methods: {
async submitImage(e) {
await this.dispatchStoreAction(storeActions.LOOKUP_VIN_BY_IMAGE, e.target.files[0])
.then((response) => {
document.getElementById(this.inputId).value = response.data;
})
.catch((error) => {
console.log(error);
});
e.target.value = null;
},
},
computed: {
questionText() {
return this.getCmsContent(this.cmsWidgetName, "QuestionText");
@ -182,6 +209,31 @@ export default {
display: flex;
}
}
&.has-camera-icon {
label {
&.camera-icon-input {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 1rem;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 40 36' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M19.9774 16.5228C17.3559 16.5228 15.1864 18.6621 15.1864 21.3476C15.1864 24.0331 17.3107 26.1724 19.9774 26.1724C22.6441 26.1724 24.7684 24.0331 24.7684 21.3476C24.7684 18.6621 22.6441 16.5228 19.9774 16.5228Z' fill='%231574A1'/%3E%3Cpath d='M38.4181 7.23725H29.8701C29.1469 2.64 24.7684 0 19.9774 0C15.1864 0 10.8531 2.64 10.0847 7.23725H1.58192C0.723164 7.23725 0 7.96553 0 8.83035V33.7738C0 34.6387 0.723164 35.3669 1.58192 35.3669H38.4181C39.2768 35.3669 40 34.6387 40 33.7738V8.83035C40 7.96553 39.2768 7.23725 38.4181 7.23725ZM19.9774 29.7683C15.3672 29.7683 11.5706 25.9904 11.5706 21.3021C11.5706 16.6138 15.3672 12.8814 19.9774 12.8814C24.5876 12.8814 28.3842 16.6593 28.3842 21.3476C28.3842 26.0359 24.6328 29.7683 19.9774 29.7683ZM36.565 14.5655H33.0395V11.0152H36.565V14.5655Z' fill='%231574A1'/%3E%3C/svg%3E%0A");
background-repeat: no-repeat;
background-position: center;
width: 2rem;
height: 100%;
display: flex;
border: none;
background-color: transparent;
&:hover {
cursor: pointer;
}
input[type="file"] {
position: absolute;
left: -9999px;
}
}
}
}
}
input {
&.has-icon {

View file

@ -88,7 +88,7 @@ const endpoints = {
},
LoadSession: {
url: "/order/api/v1/order/load-session",
method: "GET",
method: "POST",
},
ValidateZip: {
url: "/location/api/v1/location/zip",
@ -96,7 +96,7 @@ const endpoints = {
},
PriceOrderItems: {
url: "/price/api/v1/price/order-items",
method: "POST",
method: "GET",
},
LogExperimentExposureIfAssigned: {
url: "/experiments/api/v1/experiments/log-exposure",
@ -122,6 +122,10 @@ const endpoints = {
url: "/experiments/api/v1/experiments/run",
method: "POST",
},
LookupVinByImage: {
url: "https://slimagetovin.azurewebsites.net/home/FindVIN",
method: "POST",
},
};
export { endpoints };

View file

@ -19,6 +19,7 @@ const storeActions = {
LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin",
LOOKUP_VIN_BY_PLATE: "lookupVinByPlate",
LOOKUP_VIN_BY_ADDRESS: "lookupVinByAddress",
LOOKUP_VIN_BY_IMAGE: "lookupVinByImage",
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
GET_PARTS: "getParts",
GET_WIPERS: "getWipers",
@ -67,6 +68,7 @@ const storeActions = {
SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers",
SAVE_QUOTE_PAGE_SELECTIONS: "saveQuotePageSelections",
SAVE_PAYMENT_TYPE: "savePaymentType",
SAVE_ACCOUNT_NUMBER: "saveAccountNumber",
SAVE_SUPPORTING_ITEMS: "saveSupportingItems",
SAVE_VAPS: "saveVaps",
};

View file

@ -21,6 +21,7 @@ const storeMutations = {
UPDATE_GLASS_PARTS: "updateGlassParts",
UPDATE_VAPS: "updateVaps",
UPDATE_SUPPORTING_ITEMS: "updateSupportingItems",
UPDATE_LINE_ITEMS_SERVER_DATA: "updateLineItemsServerData",
UPDATE_REGISTRATION_LICENSE_PLATE: "updateRegistrationLicensePlate",
UPDATE_REGISTRATION_ADDRESS: "updateRegistrationAddress",

View file

@ -53,6 +53,25 @@ export default {
});
},
callSimpleHttpClient({ method, endpoint, payload }) {
return new Promise((resolve, reject) => {
axios({
method: method,
url: endpoint,
data: payload,
crossDomain: true,
headers: { "Access-Control-Allow-Origin": "*" },
}).then(
(response) => {
return resolve(response);
},
(error) => {
return reject(error.response);
}
);
});
},
/* istanbul ignore next */
callMockHttpClient({ method, endpoint }) {
// For Mock use only!

View file

@ -69,7 +69,7 @@ export async function skipVinLookup() {
return (
store.getters.damage.isRepair ||
isVinOptionalVehicle ||
experimentMixin.methods.hasSettingEqualTo(experimentSettings.SUPPRESS_VIN_CAPTURE, true)
experimentMixin.methods.hasSettingEqualTo(experimentSettings.SUPPRESS_VIN_CAPTURE, "true")
);
}
@ -83,7 +83,7 @@ export async function skipVinLookupNotRepair() {
(isVinOptionalVehicle ||
experimentMixin.methods.hasSettingEqualTo(
experimentSettings.SUPPRESS_VIN_CAPTURE,
true
"true"
))
);
}

View file

@ -14,11 +14,16 @@ import { storeMutations } from "@/constants/store-mutations";
it will reset the state and go back to the start of the funnel.
*/
export async function loadSessionIfPresent() {
export async function loadSessionIfPresent(isConceptInsurance) {
const funnelCookie = getFunnelCookie();
// Do nothing if there is no cookie or session to use for loading.
if (funnelCookie == null || funnelCookie.SavedSessionId == null) {
if (
funnelCookie == null ||
funnelCookie.SavedSessionId == null ||
funnelCookie.ReferralCorrelationId == null ||
!funnelCookie.ReferralNumber
) {
return null;
}
@ -34,8 +39,10 @@ export async function loadSessionIfPresent() {
await loadSession(
funnelCookie.SavedSessionId,
funnelCookie.ReferralNumber,
funnelCookie.ReferralDate,
funnelCookie.ReferralParentAccountNumber,
funnelCookie.ReferralCorrelationId
funnelCookie.ReferralCorrelationId,
isConceptInsurance
)
).data;
}
@ -68,16 +75,26 @@ export async function saveSession() {
Calls API to load session given the referral number, referralDate, and referralCorrelationId
and returns the response.
*/
async function loadSession(savedSessionId, referralNumber, accountNumber, referralCorrelationId) {
async function loadSession(
savedSessionId,
referralNumber,
referralDate,
accountNumber,
referralCorrelationId,
isConceptInsurance
) {
// await the saveSessionPromise in the store to make sure we're loading up to date information
await store.getters.applicationUser.saveSessionPromise;
const response = await baseMixin.methods.dispatchStoreAction(
storeActions.LOAD_SESSION,
{
savedSessionId: savedSessionId?.toString(),
referralNumber,
referralDate,
accountNumber,
referralCorrelationId,
isConceptInsurance,
},
false
);
@ -100,6 +117,7 @@ async function saveSessionHelper() {
accountNumber: savedSessionInfo.data.accountNumber?.toString(),
savedSessionId: savedSessionInfo.data.savedSessionId,
crmCustomerId: savedSessionInfo.data.crmCustomerId?.toString(),
eon: savedSessionInfo.data.eon,
},
false
);

View file

@ -149,10 +149,7 @@ export default {
const glassPartsForStore = partsLookup.data.glassPieceParts;
// this.navigateForward(glassPartsForStore);
// TODO KO delete for quote mvp
this.navigateForward(glassPartsForStore, null, this.shouldGoToHeritageQuote);
this.navigateForward(glassPartsForStore);
},
},
components: {

View file

@ -25,17 +25,19 @@
groupName="ServicePackageQuestion"
:availableLineItems="availableLineItems"
:isInsuranceSelected="isInsuranceSelected"
@vapsItemsSelected="vapsItemsSelectedAction" />
@vapsItemsSelected="vapsItemsSelectedAction"
validationRules="option-required"
isRequired />
<textBlock
cmsWidgetName="quoteDisclaimer"
justifyText="left"
typeStyle="caption"
class="mt-4" />
<modal cmsWidgetName="EstimateRainDefenseModal" />
<modal cmsWidgetName="EstimateFrontWiperModal" />
<modal cmsWidgetName="EstimateRearWiperModal" />
<modal cmsWidgetName="EstimateRecalModal" />
<modal cmsWidgetName="RainDefenseModal" />
<modal cmsWidgetName="FrontWiperModal" />
<modal cmsWidgetName="RearWiperModal" />
<modal cmsWidgetName="RecalModal" />
<funnel-footer
cmsWidgetName="FunnelFooterWidget"
:isForwardActionDisabled="!meta.valid"
@ -64,14 +66,19 @@ import { settleAllPromises } from "@/helpers/layout-helper";
import { storeActions } from "@/constants/store-actions";
import store from "@/store";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { Form } from "vee-validate";
import { required } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages";
import { Form, defineRule } from "vee-validate";
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
import { applicationConfig } from "@/constants/application-config";
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
export default {
name: "quote",
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContent = await fetchCmsContentForPage(to.query.fmgPage);
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const wipersPromise = baseMixin.methods.dispatchStoreAction(storeActions.GET_WIPERS);
const rainDefensePromise = baseMixin.methods.dispatchStoreAction(
storeActions.GET_RAIN_DEFENSE
@ -81,6 +88,10 @@ export default {
);
const promiseResultMap = [
{
resultKey: "cmsContent",
promise: cmsContentPromise,
},
{
resultKey: "wipers",
promise: wipersPromise,
@ -112,11 +123,10 @@ export default {
// Call the "next" function to complete the transition to this page.
next((vm) => {
vm.setCmsContent(cmsContent);
vm.setCmsContent(resultMap.cmsContent);
vm.supportingItems = resultMap.supportingItems;
vm.availableLineItems = pricingResults;
vm.isInsuranceSelected = vm.getDefaultIsInsuranceSelectedValue();
vm.isInsuranceSelected = vm.getDefaultIsInsuranceSelectedValue(vm.availableLineItems);
});
},
data() {
@ -137,19 +147,33 @@ export default {
store.getters.order.lineItems.glassParts.length > 0))
);
},
getDefaultIsInsuranceSelectedValue() {
getDefaultIsInsuranceSelectedValue(availableLineItems) {
// Override if coming back from QuoteDetails. Remove override after Quote release
const isInsuranceOverrideValue = this.$route.query?.isInsurance;
const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance;
if (defaultIsInsuranceSelectedValue != null) {
if (isInsuranceOverrideValue != null) {
return isInsuranceOverrideValue == "true";
} else if (defaultIsInsuranceSelectedValue != null) {
return defaultIsInsuranceSelectedValue;
} else {
return this.availableLineItems
? baseMixin.methods.getTierOnePackagePrice(this.availableLineItems) > 500
return availableLineItems
? baseMixin.methods.getTierOnePackagePrice(availableLineItems) > 500
: null;
}
},
vapsItemsSelectedAction(vapsItemsSelected) {
this.selectedVaps = vapsItemsSelected;
},
filterOutFees(currentSupportingItems) {
const filteredSupportingItems = currentSupportingItems.filter((item) => {
return (
!item.partType.includes("FEE") ||
(item.partType === "REPAIR FEE" && item.partNumber != "SUPPLIES-REPAIR")
);
});
return filteredSupportingItems;
},
backButtonAction() {
vehicleQuestionsMixin.methods.navigateBack(this);
},
@ -159,6 +183,16 @@ export default {
this.isInsuranceSelected,
false
);
if (!this.isInsuranceSelected) {
this.dispatchStoreAction(
this.storeActions.SAVE_ACCOUNT_NUMBER,
applicationConfig.CASH_ACCOUNT_NUMBER,
false
);
}
if (this.$store.getters.order.accountNumber != applicationConfig.CASH_ACCOUNT_NUMBER) {
this.supportingItems = this.filterOutFees(this.supportingItems);
}
this.dispatchStoreAction(
this.storeActions.SAVE_SUPPORTING_ITEMS,
this.supportingItems,

View file

@ -5,7 +5,8 @@
buttonTypeString="servicePackageRadio"
:buttonTypeObject="servicePackageRadio"
v-model="selectedPackageName"
isRequired />
:validationRules="validationRules"
:isRequired="isRequired" />
</template>
<script>
@ -28,6 +29,8 @@ export default {
groupName: String,
cashCmsWidgetName: String,
insuranceCmsWidgetName: String,
validationRules: String,
isRequired: Boolean,
isInsuranceSelected: Boolean,
availableLineItems: null,
},
@ -115,29 +118,24 @@ export default {
},
rearWiperApplicableForTierThree() {
const rearWiperIsAvailable = this.lineItemsContainsPartType(partTypeStrings.REAR_WIPER);
return (
this.glassToReplaceContainsGlassLocation(glassLocations.REAR) &&
rearWiperIsAvailable
);
},
rainDefenseApplicableForTierThree() {
const frontWipersAreAvailable = this.lineItemsContainsPartType(
partTypeStrings.FRONT_WIPER
);
const glassToReplaceContainsWindshield = this.glassToReplaceContainsGlassLocation(
glassLocations.WINDSHIELD
return (
rearWiperIsAvailable &&
(this.glassToReplaceContainsGlassLocation(glassLocations.REAR) ||
!frontWipersAreAvailable)
);
const glassToReplaceContainsRearGlass = this.glassToReplaceContainsGlassLocation(
glassLocations.REAR
);
if (this.frontWipersApplicableForTierTwo) {
return true;
} else if (!frontWipersAreAvailable) {
return true;
} else if (!glassToReplaceContainsWindshield && !glassToReplaceContainsRearGlass) {
return true;
} else {
},
rainDefenseApplicableForTierThree() {
if (
this.rearWiperApplicableForTierTwo &&
!this.frontWipersApplicableForTierTwo &&
this.frontWipersApplicableForTierThree
) {
return false;
} else {
return true;
}
},
shouldDisplayTierTwoPackage() {
@ -185,7 +183,7 @@ export default {
item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) ||
(priceRearWipers && item.partType.toUpperCase() === partTypeStrings.REAR_WIPER)
) {
vapsPrice += item.price;
vapsPrice += baseMixin.methods.getTotalLineItemPrice(item);
}
});
return vapsPrice;
@ -204,7 +202,7 @@ export default {
(priceRainDefense &&
item.partType.toUpperCase() === partTypeStrings.RAIN_DEFENSE)
) {
vapsPrice += item.price;
vapsPrice += baseMixin.methods.getTotalLineItemPrice(item);
}
});
return vapsPrice;

View file

@ -19,6 +19,7 @@
validationRules="vin-required|vin-format"
:isDisabled="vinPopulatedOnPageLoad"
maxLength="17"
includeCameraIcon
:mask="vinMask" />
</div>
</div>
@ -325,10 +326,13 @@ export default {
// If a VIN has already been found. Validate the Service Zip (in case of changes)
const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
// Check if Service Zip entered is serviceable
// Check if Service Zip entered is serviceable then save the ZIP info and email address
if (zipCodeData.isServiceable) {
// If the Service Zip entered is serviceable then save the Zip Info and Email Address and navigate forward
if (this.$store.getters.order.serviceLocation.zipCode != this.serviceZipCode) {
//Only save the service location if the zip changed or we lack zipCodeCtu
if (
this.$store.getters.order.serviceLocation.zipCode != this.serviceZipCode ||
!this.$store.getters.order.serviceLocation.zipCodeCtu
) {
const vehicleRegistrationInfo = this.$store.getters.vehicle.registration;
if (vehicleRegistrationInfo.zipCode == this.serviceZipCode) {
await this.dispatchStoreAction(
@ -338,6 +342,7 @@ export default {
city: vehicleRegistrationInfo.city,
zipCode: vehicleRegistrationInfo.zipCode,
state: vehicleRegistrationInfo.state,
zipCodeCtu: zipCodeData.zipCodeCtu,
},
false
);

View file

@ -72,11 +72,14 @@ export default {
partType != partTypeStrings.REAR_WIPER &&
partType != partTypeStrings.RAIN_DEFENSE
) {
totalPrice += lineItem.price;
totalPrice += this.getTotalLineItemPrice(lineItem);
}
});
return totalPrice;
},
getTotalLineItemPrice(lineItem) {
return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice;
},
},
computed: {
storeActions() {

View file

@ -42,7 +42,9 @@ export default {
requiresCapabilityQuestions: singlePart.requiresCapabilityQuestions,
recalibrationType: singlePart.recalibrationType,
childParts: singlePart.childParts,
price: singlePart.price,
kitPrice: singlePart.kitPrice,
sellingPrice: singlePart.sellingPrice,
laborAmount: singlePart.laborAmount,
});
}
});

View file

@ -67,7 +67,15 @@ const routes = [
// the saveSessionPromise will no longer point to a valid promise
baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
const loadSessionResponse = await loadSessionIfPresent();
// Remove the parameter after quote release
const loadSessionResponse = await loadSessionIfPresent(
to.query.isInsurance != null
? to.query.isInsurance == "true"
? true
: false
: null
);
const pageToRedirectTo = await getPageToRouteExistingOrderTo(
to,
loadSessionResponse

View file

@ -149,6 +149,9 @@ export const mutations = {
updateSupportingItems(state, partsData) {
state.order.lineItems.supportingItems = partsData;
},
updateLineItemsServerData(state, serverData) {
state.order.lineItems.serverData = serverData;
},
updatePageData(state, pageData) {
state.applicationUser.pageData[pageData.page] = pageData.data;
},
@ -519,6 +522,15 @@ export const actions = {
},
});
},
lookupVinByImage(context, image) {
const data = new FormData();
data.append("file", image);
return globalMethods.callSimpleHttpClient({
method: endpoints.LookupVinByImage.method,
endpoint: endpoints.LookupVinByImage.url,
payload: data,
});
},
getVehicleMakes(context, { year }) {
return globalMethods.callHttpClient({
method: endpoints.GetVehicleMakes.method,
@ -1022,25 +1034,35 @@ export const actions = {
referralDate: order.referralDate,
referralNumber: order.referralNumber?.toString(), // TODO It'd be nice to save these as strings in the first place
referralSequenceNumber: order.referralNumber?.toString(), // TODO Pass the referralSequence number once insurance flow creates it
eon: order.eon,
},
},
});
},
loadSession(context, { savedSessionId, referralNumber, referralCorrelationId, accountNumber }) {
loadSession(
context,
{
savedSessionId,
referralNumber,
referralDate,
referralCorrelationId,
accountNumber,
isConceptInsurance,
}
) {
const order = context.state.order;
return globalMethods
.callHttpClient({
method: endpoints.LoadSession.method,
endpoint: `${
endpoints.LoadSession.url
}?savedSessionId=${savedSessionId?.toString()}&referralNumber=${
referralNumber && referralNumber !== "" ? referralNumber : order.referralNumber
}&accountNumber=${accountNumber}&referralCorrelationId=${
referralCorrelationId !== ""
? referralCorrelationId
: order.referralCorrelationId
}`,
endpoint: endpoints.LoadSession.url,
payload: {
savedSessionId: savedSessionId?.toString(),
referralNumber: referralNumber?.toString(),
referralDate: referralDate?.toString(),
accountNumber: accountNumber,
referralCorrelationId: referralCorrelationId,
},
})
.then((response) => {
// Flatten location and name properties
@ -1379,6 +1401,9 @@ export const actions = {
savePaymentType(context, isInsurance) {
context.commit(storeMutations.UPDATE_IS_INSURANCE, isInsurance);
},
saveAccountNumber(context, accountNumber) {
context.commit(storeMutations.UPDATE_PARENT_ACCT_NUMBER, accountNumber);
},
saveSupportingItems(context, supportingItems) {
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems);
},
@ -1386,11 +1411,34 @@ export const actions = {
context.commit(storeMutations.UPDATE_VAPS, vaps);
},
// Price order actions
// PLACEHOLDER, WILL CHANGE WHEN PRICING END POINT IS IMPLEMENTED
priceOrderItems(context, availableLineItems) {
availableLineItems.forEach((lineItem) => {
lineItem["price"] = parseFloat((Math.random() * 100).toFixed(2));
async priceOrderItems(context, availableLineItems) {
const availableLineItemsFormattedForRequest = availableLineItems
.map((lineItem) => `&LineItems=${lineItem.partNumber}`)
.join("");
const vehicle = context.getters.order.vehicle;
let queryString =
`ParentAccountNumber=${applicationConfig.CASH_ACCOUNT_NUMBER}` +
`&CTU=${context.getters.order.serviceLocation.zipCodeCtu}` +
`&CarId=${vehicle.carId}` +
`&Make=${vehicle.make}` +
`&Model=${vehicle.model}` +
`&Year=${vehicle.year}` +
`&EON=${context.getters.order.eon}` +
`&ZipCode=${context.getters.order.serviceLocation.zipCode}` +
`${availableLineItemsFormattedForRequest}`;
const lineItemServerData = context.getters.order.lineItems.serverData;
if (lineItemServerData) {
queryString += `&ServerData=${lineItemServerData}`;
}
const response = await globalMethods.callHttpClient({
method: endpoints.PriceOrderItems.method,
endpoint: `${endpoints.PriceOrderItems.url}?${queryString}`,
});
context.commit(storeMutations.UPDATE_LINE_ITEMS_SERVER_DATA, response.data.serverData);
availableLineItems = addPricesToLineItems(availableLineItems, response.data.lineItems);
return availableLineItems;
},
// Misc order actions
@ -1540,3 +1588,15 @@ function convertGlassPieceNamingFromApi(glassArray) {
});
return glassArray;
}
function addPricesToLineItems(lineItems, pricingLineItems) {
lineItems.forEach((lineItem) => {
let pricedLineItem = pricingLineItems.find(
(pricingLineItem) => pricingLineItem.partNumber === lineItem.partNumber
);
lineItem.laborAmount = pricedLineItem.laborAmount;
lineItem.sellingPrice = pricedLineItem.sellingPrice;
lineItem.kitPrice = pricedLineItem.kitPrice;
});
return lineItems;
}

View file

@ -55,9 +55,6 @@ export default {
this.isLoaderDisplayed = false;
},
},
mounted() {
this.isLoaderDisplayed = false;
},
components: {
loader,
},

View file

@ -53,14 +53,6 @@ export default {
&:focus {
box-shadow: 0 0 0 2.5px $blue;
}
&,
& + .form-check-label {
margin-top: 0;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
}
&:hover {