Modifications to complete SSR-290
This commit is contained in:
parent
af8ecf5e9f
commit
6559eeea6b
3 changed files with 242 additions and 217 deletions
|
|
@ -22,6 +22,9 @@
|
||||||
TIER_TWO: 'TierTwo',
|
TIER_TWO: 'TierTwo',
|
||||||
TIER_THREE: 'TierThree',
|
TIER_THREE: 'TierThree',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const store = useMainStore();
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'servicePackageQuestion',
|
name: 'servicePackageQuestion',
|
||||||
emits: ['vapsItemsSelected'],
|
emits: ['vapsItemsSelected'],
|
||||||
|
|
@ -39,6 +42,11 @@
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
availableLineItems() {
|
||||||
|
if (this.allGlassPartsAndItemsHavePrices(store.order.lineItems)) {
|
||||||
|
this.selectDefaultPackage();
|
||||||
|
}
|
||||||
|
},
|
||||||
selectedPackageName(newValue) {
|
selectedPackageName(newValue) {
|
||||||
const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue);
|
const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue);
|
||||||
this.$emit('vapsItemsSelected', VapsProductsInSelectedPackage);
|
this.$emit('vapsItemsSelected', VapsProductsInSelectedPackage);
|
||||||
|
|
@ -54,7 +62,7 @@
|
||||||
},
|
},
|
||||||
servicePackageAnswers() {
|
servicePackageAnswers() {
|
||||||
if (!this.cmsWidgetName) return [];
|
if (!this.cmsWidgetName) return [];
|
||||||
let cmsAnswersContent = [
|
const cmsAnswersContent = [
|
||||||
{
|
{
|
||||||
Name: 'TierOne',
|
Name: 'TierOne',
|
||||||
cmsWidgetName: 'EconomyServicePackage'
|
cmsWidgetName: 'EconomyServicePackage'
|
||||||
|
|
@ -72,10 +80,6 @@
|
||||||
if (this.getCmsContent(cmsAnswersContent[0].cmsWidgetName, 'HeaderText') == '') {
|
if (this.getCmsContent(cmsAnswersContent[0].cmsWidgetName, 'HeaderText') == '') {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.shouldDisplayTierTwoPackage) {
|
|
||||||
cmsAnswersContent = cmsAnswersContent.filter((answer) => answer.Name != packageNames.TIER_TWO);
|
|
||||||
}
|
|
||||||
const modifiedAnswers = cmsAnswersContent.map((answer) => ({
|
const modifiedAnswers = cmsAnswersContent.map((answer) => ({
|
||||||
value: answer.Name,
|
value: answer.Name,
|
||||||
buttonLabel: this.getHeaderTextFromCms(answer.cmsWidgetName),
|
buttonLabel: this.getHeaderTextFromCms(answer.cmsWidgetName),
|
||||||
|
|
@ -92,9 +96,13 @@
|
||||||
},
|
},
|
||||||
frontWipersApplicableForTierTwo() {
|
frontWipersApplicableForTierTwo() {
|
||||||
const store = useMainStore();
|
const store = useMainStore();
|
||||||
const frontWipersAreAvailable = this.lineItemsContainsPartType(partTypeStrings.FRONT_WIPER);
|
const frontWipersAreAvailable = this.lineItemsContainsPartType(
|
||||||
|
partTypeStrings.FRONT_WIPER
|
||||||
|
);
|
||||||
const isRepair = store.order.damage.isRepair;
|
const isRepair = store.order.damage.isRepair;
|
||||||
const glassToReplaceContainsWindshield = this.glassToReplaceContainsGlassLocation(glassLocations.WINDSHIELD);
|
const glassToReplaceContainsWindshield = this.glassToReplaceContainsGlassLocation(
|
||||||
|
glassLocations.WINDSHIELD
|
||||||
|
);
|
||||||
if (frontWipersAreAvailable) {
|
if (frontWipersAreAvailable) {
|
||||||
if (isRepair) {
|
if (isRepair) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -162,7 +170,7 @@
|
||||||
},
|
},
|
||||||
getPackagePriceString(packageName) {
|
getPackagePriceString(packageName) {
|
||||||
const formattedPriceFloat = parseFloat(this.getPackagePrice(packageName)).toFixed(2);
|
const formattedPriceFloat = parseFloat(this.getPackagePrice(packageName)).toFixed(2);
|
||||||
return '+$' + formattedPriceFloat;
|
return '$' + formattedPriceFloat;
|
||||||
},
|
},
|
||||||
getPackagePrice(packageName) {
|
getPackagePrice(packageName) {
|
||||||
let priceFloat = 0;
|
let priceFloat = 0;
|
||||||
|
|
@ -178,9 +186,11 @@
|
||||||
const priceFrontWipers = this.frontWipersApplicableForTierTwo;
|
const priceFrontWipers = this.frontWipersApplicableForTierTwo;
|
||||||
const priceRearWipers = this.rearWiperApplicableForTierTwo;
|
const priceRearWipers = this.rearWiperApplicableForTierTwo;
|
||||||
this.nullSafeAvailableLineItems.forEach((item) => {
|
this.nullSafeAvailableLineItems.forEach((item) => {
|
||||||
if ((priceFrontWipers &&
|
if (
|
||||||
item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) ||
|
(priceFrontWipers &&
|
||||||
(priceRearWipers && item.partType.toUpperCase() === partTypeStrings.REAR_WIPER)) {
|
item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) ||
|
||||||
|
(priceRearWipers && item.partType.toUpperCase() === partTypeStrings.REAR_WIPER)
|
||||||
|
) {
|
||||||
vapsPrice += this.getTotalLineItemPrice(item);
|
vapsPrice += this.getTotalLineItemPrice(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -205,6 +215,26 @@
|
||||||
});
|
});
|
||||||
return vapsPrice;
|
return vapsPrice;
|
||||||
},
|
},
|
||||||
|
selectDefaultPackage() {
|
||||||
|
const vapsFromStore = store.order.lineItems.vaps;
|
||||||
|
let lowestTierForPackage = packageNames.TIER_ONE;
|
||||||
|
if (vapsFromStore?.length > 0) {
|
||||||
|
vapsFromStore.every((vapsItem) => {
|
||||||
|
let lowestTierForThisItem = this.getLowestTierForThisItem(vapsItem);
|
||||||
|
if (lowestTierForThisItem === packageNames.TIER_THREE) {
|
||||||
|
lowestTierForPackage = packageNames.TIER_THREE;
|
||||||
|
return false;
|
||||||
|
} else if (lowestTierForThisItem === packageNames.TIER_TWO) {
|
||||||
|
lowestTierForPackage = packageNames.TIER_TWO;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.selectedPackageName = lowestTierForPackage;
|
||||||
|
},
|
||||||
|
|
||||||
getLowestTierForThisItem(vapsItem) {
|
getLowestTierForThisItem(vapsItem) {
|
||||||
let lowestTierForThisItem = null;
|
let lowestTierForThisItem = null;
|
||||||
switch (vapsItem.partType) {
|
switch (vapsItem.partType) {
|
||||||
|
|
@ -282,6 +312,37 @@
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
allGlassPartsAndItemsHavePrices() {
|
||||||
|
if (this.pricedGlassParts) {
|
||||||
|
for (let i = 0; i < this.pricedGlassParts.length; i++) {
|
||||||
|
if (this.priceIsNullOrZero(this.pricedGlassParts[i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.supportingItems) {
|
||||||
|
for (let i = 0; i < this.supportingItems.length; i++) {
|
||||||
|
if (this.priceIsNullOrZero(this.supportingItems[i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.selectedVaps) {
|
||||||
|
for (let i = 0; i < this.selectedVaps.length; i++) {
|
||||||
|
if (this.priceIsNullOrZero(this.selectedVaps[i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
priceIsNullOrZero(lineItem) {
|
||||||
|
return (
|
||||||
|
(lineItem.kitPrice == null || lineItem.kitPrice == 0) &&
|
||||||
|
(lineItem.laborAmount == null || lineItem.laborAmount == 0) &&
|
||||||
|
(lineItem.sellingPrice == null || lineItem.sellingPrice == 0)
|
||||||
|
);
|
||||||
|
},
|
||||||
getLineItemsContainingPartType(partType) {
|
getLineItemsContainingPartType(partType) {
|
||||||
const partTypeMatches = this.nullSafeAvailableLineItems.filter(
|
const partTypeMatches = this.nullSafeAvailableLineItems.filter(
|
||||||
(lineItem) => lineItem.partType.toUpperCase() === partType
|
(lineItem) => lineItem.partType.toUpperCase() === partType
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
justification="left"
|
justification="left"
|
||||||
issContainingPage="service-packages"
|
issContainingPage="service-packages"
|
||||||
class="my-5"/>
|
class="my-5"/>
|
||||||
<div class="fade-on-route-transition">
|
<div class="fade-on-route-transition sub-container make-tall">
|
||||||
<servicePackageQuestion ref="servicePackage"
|
<servicePackageQuestion ref="servicePackage"
|
||||||
cmsWidgetName="ServicePackage"
|
cmsWidgetName="ServicePackage"
|
||||||
groupName="ServicePackageQuestion"
|
groupName="ServicePackageQuestion"
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
<textBlock cmsWidgetName="PriceDisclaimerWidget"
|
<textBlock cmsWidgetName="PriceDisclaimerWidget"
|
||||||
justifyText="left"
|
justifyText="left"
|
||||||
typeStyle="caption"
|
typeStyle="caption"
|
||||||
|
style="margin-bottom: 6rem;"
|
||||||
class="mt-2 mx-6 mb-2" />
|
class="mt-2 mx-6" />
|
||||||
<contentGroupModal ref="RainDefenseModal" cmsWidgetName="RainDefenseModal" />
|
<contentGroupModal ref="RainDefenseModal" cmsWidgetName="RainDefenseModal" />
|
||||||
<contentGroupModal ref="FrontWiperModal" cmsWidgetName="FrontWiperModal" />
|
<contentGroupModal ref="FrontWiperModal" cmsWidgetName="FrontWiperModal" />
|
||||||
<contentGroupModal ref="RearWiperModal" cmsWidgetName="RearWiperModal" />
|
<contentGroupModal ref="RearWiperModal" cmsWidgetName="RearWiperModal" />
|
||||||
|
|
@ -134,7 +134,7 @@
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
},
|
},
|
||||||
forwardButtonAction() {
|
forwardButtonAction() {
|
||||||
if (!this.allGlassPartsAndItemsHavePrices()) {
|
if (!this.$ref.servicePackage.allGlassPartsAndItemsHavePrices()) {
|
||||||
console.error('One or more items have no price assigned!');
|
console.error('One or more items have no price assigned!');
|
||||||
}
|
}
|
||||||
if (this.pricedGlassParts.length > 0) {
|
if (this.pricedGlassParts.length > 0) {
|
||||||
|
|
@ -145,37 +145,6 @@
|
||||||
store.saveVaps(this.selectedVaps);
|
store.saveVaps(this.selectedVaps);
|
||||||
|
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route);
|
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route);
|
||||||
},
|
|
||||||
allGlassPartsAndItemsHavePrices() {
|
|
||||||
if (this.pricedGlassParts) {
|
|
||||||
for (let i = 0; i < this.pricedGlassParts.length; i++) {
|
|
||||||
if (this.priceIsNullOrZero(this.pricedGlassParts[i])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.supportingItems) {
|
|
||||||
for (let i = 0; i < this.supportingItems.length; i++) {
|
|
||||||
if (this.priceIsNullOrZero(this.supportingItems[i])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.selectedVaps) {
|
|
||||||
for (let i = 0; i < this.selectedVaps.length; i++) {
|
|
||||||
if (this.priceIsNullOrZero(this.selectedVaps[i])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
priceIsNullOrZero(lineItem) {
|
|
||||||
return (
|
|
||||||
(lineItem.kitPrice == null || lineItem.kitPrice == 0) &&
|
|
||||||
(lineItem.laborAmount == null || lineItem.laborAmount == 0) &&
|
|
||||||
(lineItem.sellingPrice == null || lineItem.sellingPrice == 0)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -189,10 +158,4 @@
|
||||||
contentGroupModal
|
contentGroupModal
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
|
||||||
.fade-on-route-transition{
|
|
||||||
overflow-x:hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from 'pinia';
|
||||||
import { endpoints } from "@/constants/endpoints.js";
|
import { endpoints } from '@/constants/endpoints.js';
|
||||||
import { getDateForSavedSessionTimeout } from "@/helpers/session-helper";
|
import { getDateForSavedSessionTimeout } from '@/helpers/session-helper';
|
||||||
import globalMethods from "@/global-methods";
|
import globalMethods from '@/global-methods';
|
||||||
import { experimentTriggers } from "@/constants/experiments";
|
import { experimentTriggers } from '@/constants/experiments';
|
||||||
import { applicationConfig } from "@/constants/application-config";
|
import { applicationConfig } from '@/constants/application-config';
|
||||||
import { issPageValues } from "@/router/router-constants/issPage-values";
|
import { issPageValues } from '@/router/router-constants/issPage-values';
|
||||||
import { damageLocationsSelected } from "@/constants/damage-locations-selected";
|
import { damageLocationsSelected } from '@/constants/damage-locations-selected';
|
||||||
|
|
||||||
const storeId = 'main';
|
const storeId = 'main';
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ const getDefaultState = () => {
|
||||||
damageCause: null,
|
damageCause: null,
|
||||||
damageState: null,
|
damageState: null,
|
||||||
damageCity: null,
|
damageCity: null,
|
||||||
isDamageGlassOnly: null,
|
isDamageGlassOnly: null
|
||||||
},
|
},
|
||||||
customer: {
|
customer: {
|
||||||
address: {
|
address: {
|
||||||
|
|
@ -96,9 +96,9 @@ const getDefaultState = () => {
|
||||||
triggeredSiteEntry: false
|
triggeredSiteEntry: false
|
||||||
},
|
},
|
||||||
issConfig: {
|
issConfig: {
|
||||||
clientName: "Generic Insurance", // this is the default and will be overriden by the client's name
|
clientName: 'Generic Insurance', // this is the default and will be overriden by the client's name
|
||||||
clientDisplayName: "Generic Insurance", // this is the default and will be overridden by the client's name or client display name.
|
clientDisplayName: 'Generic Insurance', // this is the default and will be overridden by the client's name or client display name.
|
||||||
styleSheet: "",
|
styleSheet: '',
|
||||||
accountNumber: 0,
|
accountNumber: 0,
|
||||||
isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow.
|
isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow.
|
||||||
isAuthenticated: false, // Indicates if user is authenticated or not.
|
isAuthenticated: false, // Indicates if user is authenticated or not.
|
||||||
|
|
@ -144,10 +144,10 @@ export const useMainStore = defineStore({
|
||||||
streetAddress: registration.address,
|
streetAddress: registration.address,
|
||||||
city: registration.city,
|
city: registration.city,
|
||||||
state: registration.state,
|
state: registration.state,
|
||||||
zipCode: registration.zipCode,
|
zipCode: registration.zipCode
|
||||||
},
|
},
|
||||||
firstName: registration.firstName,
|
firstName: registration.firstName,
|
||||||
lastName: registration.lastName,
|
lastName: registration.lastName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -157,10 +157,10 @@ export const useMainStore = defineStore({
|
||||||
streetAddress: address.streetAddress,
|
streetAddress: address.streetAddress,
|
||||||
city: address.city,
|
city: address.city,
|
||||||
state: address.state,
|
state: address.state,
|
||||||
zipCode: address.zipCode,
|
zipCode: address.zipCode
|
||||||
},
|
},
|
||||||
firstName: state.order.customer.firstName,
|
firstName: state.order.customer.firstName,
|
||||||
lastName: state.order.customer.lastName,
|
lastName: state.order.customer.lastName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -182,41 +182,41 @@ export const useMainStore = defineStore({
|
||||||
issSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
issSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
|
||||||
issSelectedWindshieldGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
issSelectedWindshieldGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.damage.glassToReplace,
|
state.order.damage.glassToReplace,
|
||||||
"glassLocation"
|
'glassLocation'
|
||||||
).includes(damageLocationsSelected.WINDSHIELD),
|
).includes(damageLocationsSelected.WINDSHIELD),
|
||||||
issSelectedBackGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
issSelectedBackGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.damage.glassToReplace,
|
state.order.damage.glassToReplace,
|
||||||
"glassLocation"
|
'glassLocation'
|
||||||
).includes(damageLocationsSelected.REAR),
|
).includes(damageLocationsSelected.REAR),
|
||||||
issSelectedDriverSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
issSelectedDriverSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.damage.glassToReplace,
|
state.order.damage.glassToReplace,
|
||||||
"glassLocation"
|
'glassLocation'
|
||||||
).includes(damageLocationsSelected.DRIVER),
|
).includes(damageLocationsSelected.DRIVER),
|
||||||
issSelectedPassengerSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
issSelectedPassengerSideGlass: getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.damage.glassToReplace,
|
state.order.damage.glassToReplace,
|
||||||
"glassLocation"
|
'glassLocation'
|
||||||
).includes(damageLocationsSelected.PASSENGER),
|
).includes(damageLocationsSelected.PASSENGER),
|
||||||
issOrderPartNumbers: [
|
issOrderPartNumbers: [
|
||||||
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.lineItems.glassParts,
|
state.order.lineItems.glassParts,
|
||||||
"partNumber"
|
'partNumber'
|
||||||
),
|
),
|
||||||
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.lineItems.otherParts,
|
state.order.lineItems.otherParts,
|
||||||
"partNumber"
|
'partNumber'
|
||||||
),
|
)
|
||||||
],
|
],
|
||||||
|
|
||||||
issOrderPartTypes: [
|
issOrderPartTypes: [
|
||||||
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.lineItems.glassParts,
|
state.order.lineItems.glassParts,
|
||||||
"recalibrationType"
|
'recalibrationType'
|
||||||
),
|
),
|
||||||
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
...getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.lineItems.otherParts,
|
state.order.lineItems.otherParts,
|
||||||
"recalibrationType"
|
'recalibrationType'
|
||||||
),
|
)
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
experimentSettings: (state) => {
|
experimentSettings: (state) => {
|
||||||
|
|
@ -248,7 +248,7 @@ export const useMainStore = defineStore({
|
||||||
endpoint: endpoints.GetRouteInfo.url(applicationConfig.APPLICATION_ABBREVIATION),
|
endpoint: endpoints.GetRouteInfo.url(applicationConfig.APPLICATION_ABBREVIATION),
|
||||||
payload: {
|
payload: {
|
||||||
pageName: pageName
|
pageName: pageName
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getHomepageName() {
|
getHomepageName() {
|
||||||
|
|
@ -365,7 +365,8 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
// PartsOrQuestions API Actions
|
// PartsOrQuestions API Actions
|
||||||
async getPartsOrQuestions() {
|
async getPartsOrQuestions() {
|
||||||
this.resetGlassPartsState();
|
this.resetPartsAndDependencies();
|
||||||
|
|
||||||
const vehicle = this.vehicle;
|
const vehicle = this.vehicle;
|
||||||
const damage = this.damage;
|
const damage = this.damage;
|
||||||
const order = this.order;
|
const order = this.order;
|
||||||
|
|
@ -460,8 +461,8 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
async getWipers() {
|
async getWipers() {
|
||||||
const carId = this.order.vehicle.carId;
|
const carId = this.order.vehicle.carId;
|
||||||
///WARNING
|
//WARNING
|
||||||
///TODO: this is temp test code until serviceLocation is complete.
|
//TODO: this is temp test code until serviceLocation is complete.
|
||||||
//const serviceZipCode = this.order.serviceLocation.zipCode;
|
//const serviceZipCode = this.order.serviceLocation.zipCode;
|
||||||
const serviceZipCode = '44902';
|
const serviceZipCode = '44902';
|
||||||
return globalMethods
|
return globalMethods
|
||||||
|
|
@ -502,7 +503,7 @@ export const useMainStore = defineStore({
|
||||||
endpoint: endpoints.GetSupportingItems.url,
|
endpoint: endpoints.GetSupportingItems.url,
|
||||||
payload: {
|
payload: {
|
||||||
carId: carId,
|
carId: carId,
|
||||||
serviceType: isRepair ? 'Repair' : 'Replace',
|
damageType: isRepair ? 'Repair' : 'Replace',
|
||||||
parentAccountNumber: applicationConfig.CASH_PARENT_ACCOUNT_NUMBER,
|
parentAccountNumber: applicationConfig.CASH_PARENT_ACCOUNT_NUMBER,
|
||||||
parts: glassPartsArray,
|
parts: glassPartsArray,
|
||||||
numberOfRepairChips: isRepair ? numberOfChips : 0
|
numberOfRepairChips: isRepair ? numberOfChips : 0
|
||||||
|
|
@ -517,21 +518,21 @@ export const useMainStore = defineStore({
|
||||||
getLineItemQueryStringForPricing(availableLineItems);
|
getLineItemQueryStringForPricing(availableLineItems);
|
||||||
const vehicle = this.order.vehicle;
|
const vehicle = this.order.vehicle;
|
||||||
|
|
||||||
///WARNING
|
//WARNING
|
||||||
///TODO: this is temp test code until serviceLocation is complete.
|
//TODO: this is temp test code until serviceLocation is complete.
|
||||||
/// and ctu is available. Also, EON may need to be implemented.
|
// and ctu is available. Also, EON may need to be implemented.
|
||||||
zipCodeToUse = "44902";
|
zipCodeToUse = '44902';
|
||||||
ctuToUse = "01820";
|
ctuToUse = '01820';
|
||||||
let queryString =
|
const queryString =
|
||||||
`ParentAccountNumber=${applicationConfig.CASH_PARENT_ACCOUNT_NUMBER}` +
|
`ParentAccountNumber=${applicationConfig.CASH_PARENT_ACCOUNT_NUMBER}` +
|
||||||
`&CTU=${ctuToUse}` +
|
`&CTU=${ctuToUse}` +
|
||||||
`&CarId=${vehicle.carId}` +
|
`&CarId=${vehicle.carId}` +
|
||||||
`&Make=${vehicle.make}` +
|
`&Make=${vehicle.make}` +
|
||||||
`&Model=${vehicle.model}` +
|
`&Model=${vehicle.model}` +
|
||||||
`&Year=${vehicle.year}` +
|
`&Year=${vehicle.year}` +
|
||||||
`&EON=0` +
|
`&EON=0` +
|
||||||
`&ZipCode=${zipCodeToUse}` +
|
`&ZipCode=${zipCodeToUse}` +
|
||||||
`${availableLineItemsFormattedForRequest}`;
|
`${availableLineItemsFormattedForRequest}`;
|
||||||
|
|
||||||
|
|
||||||
const response = await globalMethods
|
const response = await globalMethods
|
||||||
|
|
@ -543,7 +544,7 @@ export const useMainStore = defineStore({
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
|
|
||||||
availableLineItems = addPricesToLineItems(availableLineItems, response.data.lineItems)
|
availableLineItems = addPricesToLineItems(availableLineItems, response.data.lineItems);
|
||||||
|
|
||||||
return availableLineItems;
|
return availableLineItems;
|
||||||
},
|
},
|
||||||
|
|
@ -554,7 +555,7 @@ export const useMainStore = defineStore({
|
||||||
const encodedLineItems = encodeURIComponent(JSON.stringify(lineItemsToSend));
|
const encodedLineItems = encodeURIComponent(JSON.stringify(lineItemsToSend));
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetServiceabilityDetails.method,
|
method: endpoints.GetServiceabilityDetails.method,
|
||||||
endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&lineItems=${encodedLineItems}`,
|
endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&lineItems=${encodedLineItems}`
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -563,8 +564,8 @@ export const useMainStore = defineStore({
|
||||||
method: endpoints.LookupVehicleByVin.method,
|
method: endpoints.LookupVehicleByVin.method,
|
||||||
endpoint: endpoints.LookupVehicleByVin.url,
|
endpoint: endpoints.LookupVehicleByVin.url,
|
||||||
payload: {
|
payload: {
|
||||||
vin,
|
vin
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -606,7 +607,7 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
if (isDamageChanging) {
|
if (isDamageChanging) {
|
||||||
//Reset dependent state when changing
|
//Reset dependent state when changing
|
||||||
this.resetGlassPartsState();
|
this.resetPartsAndDependencies();
|
||||||
|
|
||||||
// Save new values
|
// Save new values
|
||||||
this.updateIsRepair(isWindshieldRepair);
|
this.updateIsRepair(isWindshieldRepair);
|
||||||
|
|
@ -665,6 +666,8 @@ export const useMainStore = defineStore({
|
||||||
this.order.vehicle.imageUrl = vehicle.imageUrl;
|
this.order.vehicle.imageUrl = vehicle.imageUrl;
|
||||||
this.order.vehicle.imageVifNumber = vehicle.imageVifNumber;
|
this.order.vehicle.imageVifNumber = vehicle.imageVifNumber;
|
||||||
this.order.vehicle.imageColor = vehicle.imageVifColor;
|
this.order.vehicle.imageColor = vehicle.imageVifColor;
|
||||||
|
|
||||||
|
this.resetDamagePartsAndDependencies();
|
||||||
},
|
},
|
||||||
|
|
||||||
updateVehicleVin(vin) {
|
updateVehicleVin(vin) {
|
||||||
|
|
@ -699,7 +702,9 @@ export const useMainStore = defineStore({
|
||||||
resetSupportingItemsState() {
|
resetSupportingItemsState() {
|
||||||
this.order.lineItems.supportingItems = null;
|
this.order.lineItems.supportingItems = null;
|
||||||
},
|
},
|
||||||
|
resetVapsState() {
|
||||||
|
this.order.lineItems.vaps = null;
|
||||||
|
},
|
||||||
resetDamageState() {
|
resetDamageState() {
|
||||||
this.order.damage.isRepair = null;
|
this.order.damage.isRepair = null;
|
||||||
this.order.damage.numberOfChips = null;
|
this.order.damage.numberOfChips = null;
|
||||||
|
|
@ -719,8 +724,7 @@ export const useMainStore = defineStore({
|
||||||
previouslySelectedPartNumbers !== currentlySelectedPartNumbers;
|
previouslySelectedPartNumbers !== currentlySelectedPartNumbers;
|
||||||
|
|
||||||
if (haveSelectedVehiclePartsChanged) {
|
if (haveSelectedVehiclePartsChanged) {
|
||||||
this.updateGlassParts(null);
|
this.resetPartsAndDependencies();
|
||||||
this.resetSupportingItemsState();
|
|
||||||
this.updateMoldingQuestionAnswers(null);
|
this.updateMoldingQuestionAnswers(null);
|
||||||
this.updateCapabilityQuestionAnswers(null);
|
this.updateCapabilityQuestionAnswers(null);
|
||||||
this.updatePageData({ page: issPageValues.MOLDING_QUESTIONS, data: null});
|
this.updatePageData({ page: issPageValues.MOLDING_QUESTIONS, data: null});
|
||||||
|
|
@ -728,12 +732,11 @@ export const useMainStore = defineStore({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resetISSConfigState()
|
resetISSConfigState() {
|
||||||
{
|
this.issConfig.clientName = 'Generic Insurance';
|
||||||
this.issConfig.clientName = "Generic Insurance";
|
this.issConfig.clientDisplayName = 'Generic Insurance';
|
||||||
this.issConfig.clientDisplayName = "Generic Insurance";
|
|
||||||
this.issConfig.accountNumber = 0;
|
this.issConfig.accountNumber = 0;
|
||||||
this.issConfig.styleSheet = "";
|
this.issConfig.styleSheet = '';
|
||||||
this.issConfig.isCoverageEnabled = false;
|
this.issConfig.isCoverageEnabled = false;
|
||||||
this.issConfig.isAuthenticated = false;
|
this.issConfig.isAuthenticated = false;
|
||||||
this.issConfig.enableTPAFlow = false;
|
this.issConfig.enableTPAFlow = false;
|
||||||
|
|
@ -743,35 +746,36 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
|
|
||||||
updateVehicleYear(year) {
|
updateVehicleYear(year) {
|
||||||
if(this.order.vehicle.year != year)
|
if(this.order.vehicle.year !== year)
|
||||||
{
|
{
|
||||||
this.resetVehicleState();
|
this.resetVehicleState();
|
||||||
this.resetDamageState();
|
this.resetDamagePartsAndDependencies();
|
||||||
|
|
||||||
this.order.vehicle.year = year;
|
this.order.vehicle.year = year;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateVehicleMake(make) {
|
updateVehicleMake(make) {
|
||||||
if(this.order.vehicle.make != make)
|
if(this.order.vehicle.make !== make)
|
||||||
{
|
{
|
||||||
const year = this.order.vehicle.year;
|
const year = this.order.vehicle.year;
|
||||||
|
|
||||||
this.resetVehicleState();
|
this.resetVehicleState();
|
||||||
this.resetDamageState();
|
this.resetDamagePartsAndDependencies();
|
||||||
|
|
||||||
this.order.vehicle.year = year;
|
this.order.vehicle.year = year;
|
||||||
this.order.vehicle.make = make;
|
this.order.vehicle.make = make;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateVehicleModel(model) {
|
updateVehicleModel(model) {
|
||||||
if(this.order.vehicle.model != model)
|
if(this.order.vehicle.model !== model)
|
||||||
{
|
{
|
||||||
const year = this.order.vehicle.year;
|
const year = this.order.vehicle.year;
|
||||||
const make = this.order.vehicle.make;
|
const make = this.order.vehicle.make;
|
||||||
|
|
||||||
this.resetVehicleState();
|
this.resetVehicleState();
|
||||||
this.resetDamageState();
|
this.resetDamagePartsAndDependencies();
|
||||||
|
|
||||||
this.order.vehicle.year = year;
|
this.order.vehicle.year = year;
|
||||||
this.order.vehicle.make = make;
|
this.order.vehicle.make = make;
|
||||||
|
|
@ -781,14 +785,14 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
|
|
||||||
updateVehicleStyle(style) {
|
updateVehicleStyle(style) {
|
||||||
if(this.order.vehicle.style != style)
|
if(this.order.vehicle.style !== style)
|
||||||
{
|
{
|
||||||
const year = this.order.vehicle.year;
|
const year = this.order.vehicle.year;
|
||||||
const make = this.order.vehicle.make;
|
const make = this.order.vehicle.make;
|
||||||
const model = this.order.vehicle.model;
|
const model = this.order.vehicle.model;
|
||||||
|
|
||||||
this.resetVehicleState();
|
this.resetVehicleState();
|
||||||
this.resetDamageState();
|
this.resetDamagePartsAndDependencies();
|
||||||
|
|
||||||
this.order.vehicle.year = year;
|
this.order.vehicle.year = year;
|
||||||
this.order.vehicle.make = make;
|
this.order.vehicle.make = make;
|
||||||
|
|
@ -853,11 +857,11 @@ export const useMainStore = defineStore({
|
||||||
// if part question answers have changed, reset subsequent question answers
|
// if part question answers have changed, reset subsequent question answers
|
||||||
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(
|
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(
|
||||||
this.order.damage.partQuestionAnswers,
|
this.order.damage.partQuestionAnswers,
|
||||||
"result"
|
'result'
|
||||||
);
|
);
|
||||||
const sortedPartQuestionAnswersArray = sortArrayOfObjectsByPropertyValue(
|
const sortedPartQuestionAnswersArray = sortArrayOfObjectsByPropertyValue(
|
||||||
partQuestionAnswersArray,
|
partQuestionAnswersArray,
|
||||||
"result"
|
'result'
|
||||||
);
|
);
|
||||||
const havePartQuestionAnswersChanged =
|
const havePartQuestionAnswersChanged =
|
||||||
sortedPreviousResultsArray?.length !== sortedPartQuestionAnswersArray.length ||
|
sortedPreviousResultsArray?.length !== sortedPartQuestionAnswersArray.length ||
|
||||||
|
|
@ -876,15 +880,18 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
this.updatePartQuestionAnswers(partQuestionAnswersArray);
|
this.updatePartQuestionAnswers(partQuestionAnswersArray);
|
||||||
|
|
||||||
|
this.resetSupportingItemsState();
|
||||||
|
this.resetVapsState();
|
||||||
},
|
},
|
||||||
saveMoldingQuestionAnswers(moldingQuestionAnswersArray) {
|
saveMoldingQuestionAnswers(moldingQuestionAnswersArray) {
|
||||||
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(
|
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(
|
||||||
this.order.damage.moldingQuestionAnswers,
|
this.order.damage.moldingQuestionAnswers,
|
||||||
"result"
|
'result'
|
||||||
);
|
);
|
||||||
const sortedMoldingQuestionAnswersArray = sortArrayOfObjectsByPropertyValue(
|
const sortedMoldingQuestionAnswersArray = sortArrayOfObjectsByPropertyValue(
|
||||||
moldingQuestionAnswersArray,
|
moldingQuestionAnswersArray,
|
||||||
"result"
|
'result'
|
||||||
);
|
);
|
||||||
const haveMoldingQuestionAnswersChanged =
|
const haveMoldingQuestionAnswersChanged =
|
||||||
sortedPreviousResultsArray?.length !== sortedMoldingQuestionAnswersArray.length ||
|
sortedPreviousResultsArray?.length !== sortedMoldingQuestionAnswersArray.length ||
|
||||||
|
|
@ -893,8 +900,7 @@ export const useMainStore = defineStore({
|
||||||
);
|
);
|
||||||
|
|
||||||
if (haveMoldingQuestionAnswersChanged) {
|
if (haveMoldingQuestionAnswersChanged) {
|
||||||
this.updateGlassParts(null);
|
this.resetPartsAndDependencies();
|
||||||
this.updateSupportingItems(null);
|
|
||||||
this.updateCapabilityQuestionAnswers(null);
|
this.updateCapabilityQuestionAnswers(null);
|
||||||
this.updatePageData({
|
this.updatePageData({
|
||||||
page: issPageValues.CAPABILITY_QUESTIONS,
|
page: issPageValues.CAPABILITY_QUESTIONS,
|
||||||
|
|
@ -909,11 +915,11 @@ export const useMainStore = defineStore({
|
||||||
saveCapabilityQuestionAnswers(capabilityQuestionAnswersArray) {
|
saveCapabilityQuestionAnswers(capabilityQuestionAnswersArray) {
|
||||||
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(
|
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(
|
||||||
this.order.damage.capabilityQuestionAnswers,
|
this.order.damage.capabilityQuestionAnswers,
|
||||||
"result"
|
'result'
|
||||||
);
|
);
|
||||||
const sortedCapabilityQuestionAnswersArray = sortArrayOfObjectsByPropertyValue(
|
const sortedCapabilityQuestionAnswersArray = sortArrayOfObjectsByPropertyValue(
|
||||||
capabilityQuestionAnswersArray,
|
capabilityQuestionAnswersArray,
|
||||||
"result"
|
'result'
|
||||||
);
|
);
|
||||||
const haveCapabilityQuestionAnswersChanged =
|
const haveCapabilityQuestionAnswersChanged =
|
||||||
sortedPreviousResultsArray?.length !== sortedCapabilityQuestionAnswersArray.length ||
|
sortedPreviousResultsArray?.length !== sortedCapabilityQuestionAnswersArray.length ||
|
||||||
|
|
@ -986,21 +992,20 @@ export const useMainStore = defineStore({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
logPageView({ userId, sessionKey, pageName, sessionId, action, event, shouldUseSessionId, experimentsForUser })
|
logPageView({ userId, sessionKey, pageName, sessionId, action, event, shouldUseSessionId, experimentsForUser }) {
|
||||||
{
|
const payload = {
|
||||||
var payload = {
|
userId: userId,
|
||||||
userId: userId,
|
sessionKey: sessionKey,
|
||||||
sessionKey: sessionKey,
|
sessionId: sessionId,
|
||||||
sessionId: sessionId,
|
pageName: pageName,
|
||||||
pageName: pageName,
|
applicationName: applicationConfig.APPLICATION_NAME,
|
||||||
applicationName: applicationConfig.APPLICATION_NAME,
|
action: action,
|
||||||
action: action,
|
event: event,
|
||||||
event: event,
|
shouldUseSessionId: shouldUseSessionId,
|
||||||
shouldUseSessionId: shouldUseSessionId,
|
experimentsForUser: experimentsForUser
|
||||||
experimentsForUser: experimentsForUser,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.LogPageView.method,
|
method: endpoints.LogPageView.method,
|
||||||
endpoint: endpoints.LogPageView.url,
|
endpoint: endpoints.LogPageView.url,
|
||||||
payload: payload,
|
payload: payload,
|
||||||
|
|
@ -1010,27 +1015,27 @@ export const useMainStore = defineStore({
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
console.log("Analytics Service Error: " + error.data);
|
console.log('Analytics Service Error: ' + error.data);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
logCustomEvent({ userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId, experimentsForUser})
|
logCustomEvent({ userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId, experimentsForUser})
|
||||||
{
|
{
|
||||||
if ( pageName == null || pageName.length == 0 )
|
if ( pageName == null || pageName.length === 0 )
|
||||||
pageName = "none";
|
pageName = 'none';
|
||||||
|
|
||||||
var payload = {
|
const payload = {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
sessionKey: sessionKey,
|
sessionKey: sessionKey,
|
||||||
sessionId: sessionId,
|
sessionId: sessionId,
|
||||||
pageName: pageName,
|
pageName: pageName,
|
||||||
applicationName: applicationConfig.APPLICATION_NAME,
|
applicationName: applicationConfig.APPLICATION_NAME,
|
||||||
category: category,
|
category: category,
|
||||||
action: action,
|
action: action,
|
||||||
label: label,
|
label: label,
|
||||||
value: value,
|
value: value,
|
||||||
shouldUseSessionId: shouldUseSessionId,
|
shouldUseSessionId: shouldUseSessionId,
|
||||||
experimentsForUser: experimentsForUser
|
experimentsForUser: experimentsForUser
|
||||||
};
|
};
|
||||||
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
|
|
@ -1043,23 +1048,23 @@ export const useMainStore = defineStore({
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
console.log("Analytics Service Error: " + error.data);
|
console.log('Analytics Service Error: ' + error.data);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
initializeSession({ userId, sessionId, userAgent, referrer }) {
|
initializeSession({ userId, sessionId, userAgent, referrer }) {
|
||||||
var payload = {
|
const payload = {
|
||||||
applicationName: applicationConfig.APPLICATION_NAME,
|
applicationName: applicationConfig.APPLICATION_NAME,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
deviceId: userId,
|
deviceId: userId,
|
||||||
sessionId: sessionId,
|
sessionId: sessionId,
|
||||||
userAgent: userAgent,
|
userAgent: userAgent,
|
||||||
operatorId: "WEB",
|
operatorId: 'WEB',
|
||||||
userName: "SafeliteISS",
|
userName: 'SafeliteISS',
|
||||||
referrer: referrer
|
referrer: referrer
|
||||||
};
|
};
|
||||||
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.InitializeSession.method,
|
method: endpoints.InitializeSession.method,
|
||||||
endpoint: endpoints.InitializeSession.url,
|
endpoint: endpoints.InitializeSession.url,
|
||||||
payload: payload,
|
payload: payload,
|
||||||
|
|
@ -1069,7 +1074,7 @@ export const useMainStore = defineStore({
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
console.log("Analytics Service Error: " + error.data);
|
console.log('Analytics Service Error: ' + error.data);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
@ -1094,16 +1099,16 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
|
|
||||||
async runExperimentsForTrigger({ userId, triggerEvent, triggerValue }) {
|
async runExperimentsForTrigger({ userId, triggerEvent, triggerValue }) {
|
||||||
if (triggerEvent == experimentTriggers.SITE_ENTRY) {
|
if (triggerEvent === experimentTriggers.SITE_ENTRY) {
|
||||||
this.updateTriggeredSiteEntry(true);
|
this.updateTriggeredSiteEntry(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var payload = {
|
const payload = {
|
||||||
applicationName: applicationConfig.APPLICATION_NAME,
|
applicationName: applicationConfig.APPLICATION_NAME,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
triggerEvent: triggerEvent,
|
triggerEvent: triggerEvent,
|
||||||
triggerValue: triggerValue,
|
triggerValue: triggerValue,
|
||||||
experimentOrder: this.experimentOrder
|
experimentOrder: this.experimentOrder
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await globalMethods.callHttpClient({
|
const response = await globalMethods.callHttpClient({
|
||||||
|
|
@ -1148,8 +1153,7 @@ export const useMainStore = defineStore({
|
||||||
this.resetRegistrationAndDependencies();
|
this.resetRegistrationAndDependencies();
|
||||||
|
|
||||||
if (!isSelectedGlassAvailableForVehicle) {
|
if (!isSelectedGlassAvailableForVehicle) {
|
||||||
this.resetDamageAndDependencies();
|
this.resetDamageState();
|
||||||
this.resetPartsAndDependencies();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
|
|
@ -1164,8 +1168,7 @@ export const useMainStore = defineStore({
|
||||||
this.resetRegistrationAndDependencies();
|
this.resetRegistrationAndDependencies();
|
||||||
|
|
||||||
if (!isSelectedGlassAvailableForVehicle) {
|
if (!isSelectedGlassAvailableForVehicle) {
|
||||||
this.resetDamageAndDependencies();
|
this.resetDamageState();
|
||||||
this.resetPartsAndDependencies();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
|
|
@ -1174,42 +1177,40 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
saveRegistrationLicensePlateLookup({ isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo }) {
|
saveRegistrationLicensePlateLookup({ isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo }) {
|
||||||
//Reset dependent state when changing
|
//Reset dependent state when changing
|
||||||
if
|
if (registrationInfo?.licensePlate !== this.order.vehicle.registration?.licensePlate ||
|
||||||
(
|
registrationInfo?.state !== this.order.vehicle.registration?.state)
|
||||||
registrationInfo?.licensePlate !== this.order.vehicle.registration?.licensePlate ||
|
|
||||||
registrationInfo?.state !== this.order.vehicle.registration?.state
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
this.resetRegistrationAndDependencies();
|
this.resetRegistrationAndDependencies();
|
||||||
|
|
||||||
if (!isSelectedGlassAvailableForVehicle) {
|
if (!isSelectedGlassAvailableForVehicle) {
|
||||||
this.resetDamageAndDependencies();
|
this.resetDamageState();
|
||||||
this.resetPartsAndDependencies();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
this.updateVehicle(vehicleInfo);
|
this.updateVehicle(vehicleInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateRegistration(registrationInfo);
|
this.updateRegistration(registrationInfo);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetRegistrationAndDependencies() {
|
resetRegistrationAndDependencies() {
|
||||||
this.resetRegistrationState();
|
this.resetRegistrationState();
|
||||||
this.resetGlassPartsState();
|
this.resetGlassPartsState();
|
||||||
this.updateSupportingItems(null);
|
this.resetSupportingItemsState();
|
||||||
|
this.resetVapsState();
|
||||||
},
|
},
|
||||||
|
|
||||||
resetDamageAndDependencies() {
|
resetDamagePartsAndDependencies() {
|
||||||
this.resetDamageState();
|
this.resetDamageState();
|
||||||
this.resetGlassPartsState();
|
this.resetGlassPartsState();
|
||||||
this.updateSupportingItems(null);
|
this.resetSupportingItemsState();
|
||||||
this.updateVaps(null);
|
this.resetVapsState();
|
||||||
},
|
},
|
||||||
|
|
||||||
resetPartsAndDependencies() {
|
resetPartsAndDependencies() {
|
||||||
this.resetGlassPartsState();
|
this.resetGlassPartsState();
|
||||||
this.updateSupportingItems(null);
|
this.resetSupportingItemsState();
|
||||||
|
this.resetVapsState();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
persist: true
|
persist: true
|
||||||
|
|
@ -1219,16 +1220,16 @@ export const useMainStore = defineStore({
|
||||||
// Private Functions
|
// Private Functions
|
||||||
|
|
||||||
function getHasRecalibrationPart(state) {
|
function getHasRecalibrationPart(state) {
|
||||||
var hasRequiresRecalibration =
|
const hasRequiresRecalibration =
|
||||||
getNonFalseValuesOfPropertyInArrayOfObjects(
|
getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.lineItems.glassParts,
|
state.order.lineItems.glassParts,
|
||||||
"requiresRecalibration"
|
'requiresRecalibration'
|
||||||
)?.length > 0;
|
)?.length > 0;
|
||||||
var hasRecalibrationType =
|
const hasRecalibrationType =
|
||||||
getNonFalseValuesOfPropertyInArrayOfObjects(
|
getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.lineItems.glassParts,
|
state.order.lineItems.glassParts,
|
||||||
"recalibrationType"
|
'recalibrationType'
|
||||||
)?.length > 0;
|
)?.length > 0;
|
||||||
|
|
||||||
if (hasRequiresRecalibration) {
|
if (hasRequiresRecalibration) {
|
||||||
if (hasRecalibrationType) {
|
if (hasRecalibrationType) {
|
||||||
|
|
@ -1236,8 +1237,8 @@ function getHasRecalibrationPart(state) {
|
||||||
return (
|
return (
|
||||||
getNonFalseValuesOfPropertyInArrayOfObjects(
|
getNonFalseValuesOfPropertyInArrayOfObjects(
|
||||||
state.order.lineItems.glassParts,
|
state.order.lineItems.glassParts,
|
||||||
"recalibrationType"
|
'recalibrationType'
|
||||||
)[0].toLowerCase() != "unknown"
|
)[0].toLowerCase() !== 'unknown'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Has 'requiresRecalibration' but no 'recalibrationType' at all
|
// Has 'requiresRecalibration' but no 'recalibrationType' at all
|
||||||
|
|
@ -1311,9 +1312,9 @@ function getAllPartNumbers(partsOrQuestions) {
|
||||||
.map((glass) => glass.parts)
|
.map((glass) => glass.parts)
|
||||||
.flat()
|
.flat()
|
||||||
.map((part) => part.partNumber)
|
.map((part) => part.partNumber)
|
||||||
.filter((partNumber) => !partNumber.toUpperCase().includes("FEE"))
|
.filter((partNumber) => !partNumber.toUpperCase().includes('FEE'))
|
||||||
.sort()
|
.sort()
|
||||||
.join(",")
|
.join(',')
|
||||||
: [];
|
: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1321,14 +1322,14 @@ function addPricesToLineItems(lineItems, pricingLineItems) {
|
||||||
lineItems.forEach((lineItem) => {
|
lineItems.forEach((lineItem) => {
|
||||||
const lineItemIndex = pricingLineItems.findIndex(
|
const lineItemIndex = pricingLineItems.findIndex(
|
||||||
(pricingLineItem) => pricingLineItem.partNumber === lineItem.partNumber
|
(pricingLineItem) => pricingLineItem.partNumber === lineItem.partNumber
|
||||||
)
|
);
|
||||||
if (lineItem.childParts) {
|
if (lineItem.childParts) {
|
||||||
addPricesToLineItems(lineItem.childParts, pricingLineItems)
|
addPricesToLineItems(lineItem.childParts, pricingLineItems);
|
||||||
}
|
}
|
||||||
const pricedLineItem = pricingLineItems.splice(lineItemIndex, 1)[0]
|
const pricedLineItem = pricingLineItems.splice(lineItemIndex, 1)[0];
|
||||||
lineItem.laborAmount = pricedLineItem.laborAmount
|
lineItem.laborAmount = pricedLineItem.laborAmount;
|
||||||
lineItem.sellingPrice = pricedLineItem.sellingPrice
|
lineItem.sellingPrice = pricedLineItem.sellingPrice;
|
||||||
lineItem.kitPrice = pricedLineItem.kitPrice
|
lineItem.kitPrice = pricedLineItem.kitPrice;
|
||||||
});
|
});
|
||||||
return lineItems;
|
return lineItems;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue