Updated Draft
This commit is contained in:
parent
0588b182a0
commit
af78d9b4e1
4 changed files with 323 additions and 321 deletions
|
|
@ -11,6 +11,7 @@ const applicationConfig = {
|
||||||
CLIENTTAG_QUERYSTRING: 'CientTag',
|
CLIENTTAG_QUERYSTRING: 'CientTag',
|
||||||
GOOGLE_PLACES_API_KEY: process.env.VUE_APP_GOOGLE_PLACES_API_KEY,
|
GOOGLE_PLACES_API_KEY: process.env.VUE_APP_GOOGLE_PLACES_API_KEY,
|
||||||
ISS_DEV_CMS_DOMAIN: "https://digitalisscms.dev.safelite.io",
|
ISS_DEV_CMS_DOMAIN: "https://digitalisscms.dev.safelite.io",
|
||||||
|
CASH_PARENT_ACCOUNT_NUMBER: 167132
|
||||||
};
|
};
|
||||||
|
|
||||||
export { applicationConfig };
|
export { applicationConfig };
|
||||||
|
|
@ -10,352 +10,353 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import buttonQuestion from '@/digital-components/button-question/button-question';
|
import buttonQuestion from '@/digital-components/button-question/button-question';
|
||||||
import baseMixin from '@/mixins/base-mixin.js';
|
import baseMixin from '@/mixins/base-mixin.js';
|
||||||
import { processIfStatements } from '@/helpers/cms-content-helper';
|
import { processIfStatements } from '@/helpers/cms-content-helper';
|
||||||
import { damageLocationsSelected as glassLocations } from '@/constants/damage-locations-selected';
|
import { damageLocationsSelected as glassLocations } from '@/constants/damage-locations-selected';
|
||||||
import servicePackageRadio from './service-package-radio/service-package-radio';
|
import servicePackageRadio from './service-package-radio/service-package-radio';
|
||||||
import { partTypeStrings } from '@/constants/part-type-strings';
|
import { partTypeStrings } from '@/constants/part-type-strings';
|
||||||
const packageNames = {
|
import { useMainStore } from '@/store';
|
||||||
TIER_ONE: 'TierOne',
|
|
||||||
TIER_TWO: 'TierTwo',
|
const packageNames = {
|
||||||
TIER_THREE: 'TierThree'
|
TIER_ONE: 'TierOne',
|
||||||
};
|
TIER_TWO: 'TierTwo',
|
||||||
export default {
|
TIER_THREE: 'TierThree'
|
||||||
name: 'servicePackageQuestion',
|
};
|
||||||
props: {
|
export default {
|
||||||
cmsWidgetName: String,
|
name: 'servicePackageQuestion',
|
||||||
groupName: String,
|
props: {
|
||||||
validationRules: String,
|
cmsWidgetName: String,
|
||||||
isRequired: Boolean,
|
groupName: String,
|
||||||
availableLineItems: []
|
validationRules: String,
|
||||||
},
|
isRequired: Boolean,
|
||||||
data() {
|
availableLineItems: []
|
||||||
return {
|
|
||||||
servicePackageRadio: servicePackageRadio,
|
|
||||||
selectedPackageName: null
|
|
||||||
};
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
availableLineItems() {
|
|
||||||
if (this.allGlassPartsAndSupportingItemsHavePrices(this.$store.lineItems)) {
|
|
||||||
this.selectDefaultPackage();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
selectedPackageName(newValue) {
|
data() {
|
||||||
const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue);
|
return {
|
||||||
this.$emit('vapsItemsSelected', VapsProductsInSelectedPackage);
|
servicePackageRadio: servicePackageRadio,
|
||||||
}
|
selectedPackageName: null
|
||||||
},
|
};
|
||||||
computed: {
|
|
||||||
nullSafeAvailableLineItems() {
|
|
||||||
return this.availableLineItems ?? [];
|
|
||||||
},
|
},
|
||||||
servicePackageAnswers() {
|
watch: {
|
||||||
if (!this.cmsWidgetName) return {};
|
availableLineItems() {
|
||||||
const cmsAnswersContent = [
|
const store = useMainStore();
|
||||||
{
|
if (this.allGlassPartsAndSupportingItemsHavePrices(store.order.lineItems)) {
|
||||||
Name: 'EconomyServicePackage',
|
this.selectDefaultPackage();
|
||||||
cmsWidgetName: 'EconomyServicePackage'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: 'StandardServicePackage',
|
|
||||||
cmsWidgetName: 'StandardServicePackage'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: 'PremiumServicePackage',
|
|
||||||
cmsWidgetName: 'PremiumServicePackage'
|
|
||||||
}
|
}
|
||||||
];
|
},
|
||||||
|
selectedPackageName(newValue) {
|
||||||
//This isn't mainly about header text, header text is just the canary in the coal mine
|
const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue);
|
||||||
//Vue will often hit this code twice during a pageload. The first time without
|
this.$emit('vapsItemsSelected', VapsProductsInSelectedPackage);
|
||||||
//having yet loaded cms content- and so this just skips that first time
|
|
||||||
if (this.getCmsContent(cmsAnswersContent[0].cmsWidgetName, 'HeaderText') == '') {
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
console.log(this.getCmsContent(this.cmsWidgetName, 'HeaderText'));
|
},
|
||||||
|
computed: {
|
||||||
|
nullSafeAvailableLineItems() {
|
||||||
|
return this.availableLineItems ?? [];
|
||||||
|
},
|
||||||
|
servicePackageAnswers() {
|
||||||
|
if (!this.cmsWidgetName) return {};
|
||||||
|
const cmsAnswersContent = [
|
||||||
|
{
|
||||||
|
Name: 'EconomyServicePackage',
|
||||||
|
cmsWidgetName: 'EconomyServicePackage'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: 'StandardServicePackage',
|
||||||
|
cmsWidgetName: 'StandardServicePackage'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: 'PremiumServicePackage',
|
||||||
|
cmsWidgetName: 'PremiumServicePackage'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
const modifiedAnswers = [{
|
//This isn't mainly about header text, header text is just the canary in the coal mine
|
||||||
Answers: {
|
//Vue will often hit this code twice during a pageload. The first time without
|
||||||
|
//having yet loaded cms content- and so this just skips that first time
|
||||||
|
if (this.getCmsContent(cmsAnswersContent[0].cmsWidgetName, 'HeaderText') == '') {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
console.log(this.getCmsContent(this.cmsWidgetName, 'HeaderText'));
|
||||||
|
|
||||||
|
const modifiedAnswers = cmsAnswersContent.map((answer) => ({
|
||||||
value: answer.Name,
|
value: answer.Name,
|
||||||
buttonLabel: this.getHeaderTextFromCms(this.cmsWidgetName),
|
buttonLabel: this.getHeaderTextFromCms(this.cmsWidgetName),
|
||||||
buttonLabelSubCopy: this.getSubheaderTextFromCms(this.cmsWidgetName),
|
buttonLabelSubCopy: this.getSubheaderTextFromCms(this.cmsWidgetName),
|
||||||
buttonBodyCopy: this.getBodyTextFromCms(this.cmsWidgetName),
|
buttonBodyCopy: this.getBodyTextFromCms(this.cmsWidgetName),
|
||||||
buttonAuxiliaryCopy: 'Aux Copy', //his.getPackagePriceString(answer.Name),
|
buttonAuxiliaryCopy: 'Aux Copy', //his.getPackagePriceString(answer.Name),
|
||||||
buttonFooterCopy: this.getFooterTextFromCms(this.cmsWidgetName),
|
buttonFooterCopy: this.getFooterTextFromCms(this.cmsWidgetName)
|
||||||
}
|
}));
|
||||||
}];
|
return modifiedAnswers;
|
||||||
return modifiedAnswers;
|
},
|
||||||
},
|
frontWipersApplicableForTierTwo() {
|
||||||
frontWipersApplicableForTierTwo() {
|
const frontWipersAreAvailable = this.lineItemsContainsPartType(
|
||||||
const frontWipersAreAvailable = this.lineItemsContainsPartType(
|
partTypeStrings.FRONT_WIPER
|
||||||
partTypeStrings.FRONT_WIPER
|
);
|
||||||
);
|
const isRepair = this.$store.order.damage.isRepair;
|
||||||
const isRepair = this.$store.order.damage.isRepair;
|
const glassToReplaceContainsWindshield = this.glassToReplaceContainsGlassLocation(
|
||||||
const glassToReplaceContainsWindshield = this.glassToReplaceContainsGlassLocation(
|
glassLocations.WINDSHIELD
|
||||||
glassLocations.WINDSHIELD
|
);
|
||||||
);
|
if (frontWipersAreAvailable) {
|
||||||
if (frontWipersAreAvailable) {
|
if (isRepair) {
|
||||||
if (isRepair) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if (glassToReplaceContainsWindshield) {
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
if (glassToReplaceContainsWindshield) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
},
|
||||||
return false;
|
rearWiperApplicableForTierTwo() {
|
||||||
}
|
const rearWiperIsAvailable = this.lineItemsContainsPartType(partTypeStrings.REAR_WIPER);
|
||||||
},
|
return (
|
||||||
rearWiperApplicableForTierTwo() {
|
this.glassToReplaceContainsGlassLocation(glassLocations.REAR) &&
|
||||||
const rearWiperIsAvailable = this.lineItemsContainsPartType(partTypeStrings.REAR_WIPER);
|
rearWiperIsAvailable
|
||||||
return (
|
);
|
||||||
this.glassToReplaceContainsGlassLocation(glassLocations.REAR) &&
|
},
|
||||||
rearWiperIsAvailable
|
frontWipersApplicableForTierThree() {
|
||||||
);
|
const frontWipersAreAvailable = this.lineItemsContainsPartType(
|
||||||
},
|
partTypeStrings.FRONT_WIPER
|
||||||
frontWipersApplicableForTierThree() {
|
);
|
||||||
const frontWipersAreAvailable = this.lineItemsContainsPartType(
|
return frontWipersAreAvailable;
|
||||||
partTypeStrings.FRONT_WIPER
|
},
|
||||||
);
|
rearWiperApplicableForTierThree() {
|
||||||
return frontWipersAreAvailable;
|
const rearWiperIsAvailable = this.lineItemsContainsPartType(partTypeStrings.REAR_WIPER);
|
||||||
},
|
const frontWipersAreAvailable = this.lineItemsContainsPartType(
|
||||||
rearWiperApplicableForTierThree() {
|
partTypeStrings.FRONT_WIPER
|
||||||
const rearWiperIsAvailable = this.lineItemsContainsPartType(partTypeStrings.REAR_WIPER);
|
);
|
||||||
const frontWipersAreAvailable = this.lineItemsContainsPartType(
|
return (
|
||||||
partTypeStrings.FRONT_WIPER
|
rearWiperIsAvailable &&
|
||||||
);
|
(this.glassToReplaceContainsGlassLocation(glassLocations.REAR) ||
|
||||||
return (
|
!frontWipersAreAvailable)
|
||||||
rearWiperIsAvailable &&
|
);
|
||||||
(this.glassToReplaceContainsGlassLocation(glassLocations.REAR) ||
|
},
|
||||||
!frontWipersAreAvailable)
|
rainDefenseApplicableForTierThree() {
|
||||||
);
|
|
||||||
},
|
|
||||||
rainDefenseApplicableForTierThree() {
|
|
||||||
if (
|
|
||||||
this.rearWiperApplicableForTierTwo &&
|
|
||||||
!this.frontWipersApplicableForTierTwo &&
|
|
||||||
this.frontWipersApplicableForTierThree
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
shouldDisplayTierTwoPackage() {
|
|
||||||
return this.frontWipersApplicableForTierTwo || this.rearWiperApplicableForTierTwo;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
processIfStatements,
|
|
||||||
getHeaderTextFromCms(cmsWidgetName) {
|
|
||||||
return this.getCmsContent(cmsWidgetName, 'HeaderText');
|
|
||||||
},
|
|
||||||
getSubheaderTextFromCms(cmsWidgetName) {
|
|
||||||
return this.getCmsContent(cmsWidgetName, 'SubheaderText');
|
|
||||||
},
|
|
||||||
getBodyTextFromCms(cmsWidgetName) {
|
|
||||||
const bodyText = this.getCmsContent(cmsWidgetName, "BodyText");
|
|
||||||
return this.processIfStatements(bodyText, "custom", this.getCustomValueFromString);
|
|
||||||
},
|
|
||||||
getFooterTextFromCms(cmsWidgetName) {
|
|
||||||
const footerText = this.getCmsContent(cmsWidgetName, "FooterText");
|
|
||||||
return this.processIfStatements(footerText, "custom", this.getCustomValueFromString);
|
|
||||||
},
|
|
||||||
getPackagePriceString(packageName) {
|
|
||||||
const formattedPriceFloat = parseFloat(this.getPackagePrice(packageName)).toFixed(2);
|
|
||||||
return 'As little as $' + formattedPriceFloat;
|
|
||||||
},
|
|
||||||
getPackagePrice(packageName) {
|
|
||||||
let priceFloat = this.isInsuranceSelected
|
|
||||||
? 0
|
|
||||||
: baseMixin.methods.getTierOnePackagePrice(
|
|
||||||
baseMixin.methods.filterOutFees(this.nullSafeAvailableLineItems)
|
|
||||||
);
|
|
||||||
if (packageName === packageNames.TIER_TWO) {
|
|
||||||
priceFloat += this.getTierTwoPackageVapsPrice();
|
|
||||||
} else if (packageName === packageNames.TIER_THREE) {
|
|
||||||
priceFloat += this.getTierThreePackageVapsPrice();
|
|
||||||
}
|
|
||||||
return priceFloat;
|
|
||||||
},
|
|
||||||
getTierTwoPackageVapsPrice() {
|
|
||||||
let vapsPrice = 0;
|
|
||||||
const priceFrontWipers = this.frontWipersApplicableForTierTwo;
|
|
||||||
const priceRearWipers = this.rearWiperApplicableForTierTwo;
|
|
||||||
this.nullSafeAvailableLineItems.forEach((item) => {
|
|
||||||
if (
|
if (
|
||||||
(priceFrontWipers &&
|
this.rearWiperApplicableForTierTwo &&
|
||||||
item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) ||
|
!this.frontWipersApplicableForTierTwo &&
|
||||||
(priceRearWipers && item.partType.toUpperCase() === partTypeStrings.REAR_WIPER)
|
this.frontWipersApplicableForTierThree
|
||||||
) {
|
) {
|
||||||
vapsPrice += baseMixin.methods.getTotalLineItemPrice(item);
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
return vapsPrice;
|
shouldDisplayTierTwoPackage() {
|
||||||
|
return this.frontWipersApplicableForTierTwo || this.rearWiperApplicableForTierTwo;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getTierThreePackageVapsPrice() {
|
methods: {
|
||||||
let vapsPrice = 0;
|
processIfStatements,
|
||||||
const priceFrontWipers = this.frontWipersApplicableForTierThree;
|
getHeaderTextFromCms(cmsWidgetName) {
|
||||||
const priceRearWipers = this.rearWiperApplicableForTierThree;
|
return this.getCmsContent(cmsWidgetName, 'HeaderText');
|
||||||
const priceRainDefense = this.rainDefenseApplicableForTierThree;
|
},
|
||||||
this.nullSafeAvailableLineItems.forEach((item) => {
|
getSubheaderTextFromCms(cmsWidgetName) {
|
||||||
if (
|
return this.getCmsContent(cmsWidgetName, 'SubheaderText');
|
||||||
(priceFrontWipers &&
|
},
|
||||||
item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) ||
|
getBodyTextFromCms(cmsWidgetName) {
|
||||||
(priceRearWipers &&
|
const bodyText = this.getCmsContent(cmsWidgetName, "BodyText");
|
||||||
item.partType.toUpperCase() === partTypeStrings.REAR_WIPER) ||
|
return this.processIfStatements(bodyText, "custom", this.getCustomValueFromString);
|
||||||
(priceRainDefense &&
|
},
|
||||||
item.partType.toUpperCase() === partTypeStrings.RAIN_DEFENSE)
|
getFooterTextFromCms(cmsWidgetName) {
|
||||||
) {
|
const footerText = this.getCmsContent(cmsWidgetName, "FooterText");
|
||||||
vapsPrice += baseMixin.methods.getTotalLineItemPrice(item);
|
return this.processIfStatements(footerText, "custom", this.getCustomValueFromString);
|
||||||
|
},
|
||||||
|
getPackagePriceString(packageName) {
|
||||||
|
const formattedPriceFloat = parseFloat(this.getPackagePrice(packageName)).toFixed(2);
|
||||||
|
return 'As little as $' + formattedPriceFloat;
|
||||||
|
},
|
||||||
|
getPackagePrice(packageName) {
|
||||||
|
let priceFloat = this.isInsuranceSelected
|
||||||
|
? 0
|
||||||
|
: baseMixin.methods.getTierOnePackagePrice(
|
||||||
|
baseMixin.methods.filterOutFees(this.nullSafeAvailableLineItems)
|
||||||
|
);
|
||||||
|
if (packageName === packageNames.TIER_TWO) {
|
||||||
|
priceFloat += this.getTierTwoPackageVapsPrice();
|
||||||
|
} else if (packageName === packageNames.TIER_THREE) {
|
||||||
|
priceFloat += this.getTierThreePackageVapsPrice();
|
||||||
}
|
}
|
||||||
});
|
return priceFloat;
|
||||||
return vapsPrice;
|
},
|
||||||
},
|
getTierTwoPackageVapsPrice() {
|
||||||
selectDefaultPackage() {
|
let vapsPrice = 0;
|
||||||
const vapsFromStore = this.$store.lineItems.vaps;
|
const priceFrontWipers = this.frontWipersApplicableForTierTwo;
|
||||||
let lowestTierForPackage = packageNames.TIER_ONE;
|
const priceRearWipers = this.rearWiperApplicableForTierTwo;
|
||||||
if (vapsFromStore?.length > 0) {
|
this.nullSafeAvailableLineItems.forEach((item) => {
|
||||||
vapsFromStore.every((vapsItem) => {
|
if (
|
||||||
let lowestTierForThisItem = this.getLowestTierForThisItem(vapsItem);
|
(priceFrontWipers &&
|
||||||
if (lowestTierForThisItem === packageNames.TIER_THREE) {
|
item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) ||
|
||||||
lowestTierForPackage = packageNames.TIER_THREE;
|
(priceRearWipers && item.partType.toUpperCase() === partTypeStrings.REAR_WIPER)
|
||||||
return false;
|
) {
|
||||||
} else if (lowestTierForThisItem === packageNames.TIER_TWO) {
|
vapsPrice += baseMixin.methods.getTotalLineItemPrice(item);
|
||||||
lowestTierForPackage = packageNames.TIER_TWO;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
return vapsPrice;
|
||||||
this.selectedPackageName = lowestTierForPackage;
|
},
|
||||||
},
|
getTierThreePackageVapsPrice() {
|
||||||
allGlassPartsAndSupportingItemsHavePrices(lineItems) {
|
let vapsPrice = 0;
|
||||||
if (lineItems?.glassParts) {
|
const priceFrontWipers = this.frontWipersApplicableForTierThree;
|
||||||
for (let i = 0; i < lineItems.glassParts.length; i++) {
|
const priceRearWipers = this.rearWiperApplicableForTierThree;
|
||||||
if (this.priceIsNullOrZero(lineItems.glassParts[i])) {
|
const priceRainDefense = this.rainDefenseApplicableForTierThree;
|
||||||
return false;
|
this.nullSafeAvailableLineItems.forEach((item) => {
|
||||||
|
if (
|
||||||
|
(priceFrontWipers &&
|
||||||
|
item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) ||
|
||||||
|
(priceRearWipers &&
|
||||||
|
item.partType.toUpperCase() === partTypeStrings.REAR_WIPER) ||
|
||||||
|
(priceRainDefense &&
|
||||||
|
item.partType.toUpperCase() === partTypeStrings.RAIN_DEFENSE)
|
||||||
|
) {
|
||||||
|
vapsPrice += baseMixin.methods.getTotalLineItemPrice(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return vapsPrice;
|
||||||
|
},
|
||||||
|
selectDefaultPackage() {
|
||||||
|
const vapsFromStore = this.$store.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;
|
||||||
|
},
|
||||||
|
allGlassPartsAndSupportingItemsHavePrices(lineItems) {
|
||||||
|
if (lineItems?.glassParts) {
|
||||||
|
for (let i = 0; i < lineItems.glassParts.length; i++) {
|
||||||
|
if (this.priceIsNullOrZero(lineItems.glassParts[i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (lineItems?.supportingItems) {
|
||||||
if (lineItems?.supportingItems) {
|
for (let i = 0; i < lineItems.supportingItems.length; i++) {
|
||||||
for (let i = 0; i < lineItems.supportingItems.length; i++) {
|
if (this.priceIsNullOrZero(lineItems.supportingItems[i])) {
|
||||||
if (this.priceIsNullOrZero(lineItems.supportingItems[i])) {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return true;
|
||||||
return true;
|
},
|
||||||
},
|
priceIsNullOrZero(lineItem) {
|
||||||
priceIsNullOrZero(lineItem) {
|
return (
|
||||||
return (
|
(lineItem.kitPrice == null || lineItem.kitPrice == 0) &&
|
||||||
(lineItem.kitPrice == null || lineItem.kitPrice == 0) &&
|
(lineItem.laborAmount == null || lineItem.laborAmount == 0) &&
|
||||||
(lineItem.laborAmount == null || lineItem.laborAmount == 0) &&
|
(lineItem.sellingPrice == null || lineItem.sellingPrice == 0)
|
||||||
(lineItem.sellingPrice == null || lineItem.sellingPrice == 0)
|
);
|
||||||
);
|
},
|
||||||
},
|
getLowestTierForThisItem(vapsItem) {
|
||||||
getLowestTierForThisItem(vapsItem) {
|
let lowestTierForThisItem = null;
|
||||||
let lowestTierForThisItem = null;
|
switch (vapsItem.partType) {
|
||||||
switch (vapsItem.partType) {
|
case partTypeStrings.FRONT_WIPER:
|
||||||
case partTypeStrings.FRONT_WIPER:
|
if (this.frontWipersApplicableForTierThree) {
|
||||||
if (this.frontWipersApplicableForTierThree) {
|
lowestTierForThisItem = packageNames.TIER_THREE;
|
||||||
lowestTierForThisItem = packageNames.TIER_THREE;
|
}
|
||||||
}
|
if (this.frontWipersApplicableForTierTwo) {
|
||||||
|
lowestTierForThisItem = packageNames.TIER_TWO;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case partTypeStrings.REAR_WIPER:
|
||||||
|
if (this.rearWiperApplicableForTierThree) {
|
||||||
|
lowestTierForThisItem = packageNames.TIER_THREE;
|
||||||
|
}
|
||||||
|
if (this.rearWiperApplicableForTierTwo) {
|
||||||
|
lowestTierForThisItem = packageNames.TIER_TWO;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case partTypeStrings.RAIN_DEFENSE:
|
||||||
|
if (this.rainDefenseApplicableForTierThree) {
|
||||||
|
lowestTierForThisItem = packageNames.TIER_THREE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return lowestTierForThisItem;
|
||||||
|
},
|
||||||
|
getVapsLineItemsForSelectedPackage(packageName) {
|
||||||
|
const vapsLineItemsForSelectedPackage = [];
|
||||||
|
if (packageName === packageNames.TIER_TWO) {
|
||||||
if (this.frontWipersApplicableForTierTwo) {
|
if (this.frontWipersApplicableForTierTwo) {
|
||||||
lowestTierForThisItem = packageNames.TIER_TWO;
|
vapsLineItemsForSelectedPackage.push(
|
||||||
}
|
...this.getLineItemsContainingPartType(partTypeStrings.FRONT_WIPER)
|
||||||
break;
|
);
|
||||||
case partTypeStrings.REAR_WIPER:
|
|
||||||
if (this.rearWiperApplicableForTierThree) {
|
|
||||||
lowestTierForThisItem = packageNames.TIER_THREE;
|
|
||||||
}
|
}
|
||||||
if (this.rearWiperApplicableForTierTwo) {
|
if (this.rearWiperApplicableForTierTwo) {
|
||||||
lowestTierForThisItem = packageNames.TIER_TWO;
|
vapsLineItemsForSelectedPackage.push(
|
||||||
|
...this.getLineItemsContainingPartType(partTypeStrings.REAR_WIPER)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (packageName === packageNames.TIER_THREE) {
|
||||||
|
if (this.frontWipersApplicableForTierThree) {
|
||||||
|
vapsLineItemsForSelectedPackage.push(
|
||||||
|
...this.getLineItemsContainingPartType(partTypeStrings.FRONT_WIPER)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (this.rearWiperApplicableForTierThree) {
|
||||||
|
vapsLineItemsForSelectedPackage.push(
|
||||||
|
...this.getLineItemsContainingPartType(partTypeStrings.REAR_WIPER)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case partTypeStrings.RAIN_DEFENSE:
|
|
||||||
if (this.rainDefenseApplicableForTierThree) {
|
if (this.rainDefenseApplicableForTierThree) {
|
||||||
lowestTierForThisItem = packageNames.TIER_THREE;
|
vapsLineItemsForSelectedPackage.push(
|
||||||
|
...this.getLineItemsContainingPartType(partTypeStrings.RAIN_DEFENSE)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
return lowestTierForThisItem;
|
|
||||||
},
|
|
||||||
getVapsLineItemsForSelectedPackage(packageName) {
|
|
||||||
const vapsLineItemsForSelectedPackage = [];
|
|
||||||
if (packageName === packageNames.TIER_TWO) {
|
|
||||||
if (this.frontWipersApplicableForTierTwo) {
|
|
||||||
vapsLineItemsForSelectedPackage.push(
|
|
||||||
...this.getLineItemsContainingPartType(partTypeStrings.FRONT_WIPER)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (this.rearWiperApplicableForTierTwo) {
|
return vapsLineItemsForSelectedPackage;
|
||||||
vapsLineItemsForSelectedPackage.push(
|
},
|
||||||
...this.getLineItemsContainingPartType(partTypeStrings.REAR_WIPER)
|
getCustomValueFromString(str) {
|
||||||
);
|
switch (str) {
|
||||||
|
case 'isRecalibrationOnOrder':
|
||||||
|
return this.isRecalibrationOnOrder;
|
||||||
|
case 'frontWipersApplicableForTierTwo':
|
||||||
|
return this.frontWipersApplicableForTierTwo;
|
||||||
|
case 'rearWiperApplicableForTierTwo':
|
||||||
|
return this.rearWiperApplicableForTierTwo;
|
||||||
|
case 'frontWipersApplicableForTierThree':
|
||||||
|
return this.frontWipersApplicableForTierThree;
|
||||||
|
case 'rearWiperApplicableForTierThree':
|
||||||
|
return this.rearWiperApplicableForTierThree;
|
||||||
|
case 'rainDefenseApplicableForTierThree':
|
||||||
|
return this.rainDefenseApplicableForTierThree;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
} else if (packageName === packageNames.TIER_THREE) {
|
},
|
||||||
if (this.frontWipersApplicableForTierThree) {
|
getLineItemsContainingPartType(partType) {
|
||||||
vapsLineItemsForSelectedPackage.push(
|
const partTypeMatches = this.nullSafeAvailableLineItems.filter(
|
||||||
...this.getLineItemsContainingPartType(partTypeStrings.FRONT_WIPER)
|
(lineItem) => lineItem.partType.toUpperCase() === partType
|
||||||
);
|
);
|
||||||
}
|
return partTypeMatches;
|
||||||
if (this.rearWiperApplicableForTierThree) {
|
},
|
||||||
vapsLineItemsForSelectedPackage.push(
|
lineItemsContainsPartType(partType) {
|
||||||
...this.getLineItemsContainingPartType(partTypeStrings.REAR_WIPER)
|
const partTypeMatches = this.getLineItemsContainingPartType(partType);
|
||||||
);
|
return !!partTypeMatches.length;
|
||||||
}
|
},
|
||||||
if (this.rainDefenseApplicableForTierThree) {
|
glassToReplaceContainsGlassLocation(glassLocation) {
|
||||||
vapsLineItemsForSelectedPackage.push(
|
const glassLocationMatches =
|
||||||
...this.getLineItemsContainingPartType(partTypeStrings.RAIN_DEFENSE)
|
this.$store.order.damage.glassToReplace?.filter(
|
||||||
);
|
(glassToReplace) => glassToReplace.glassLocation === glassLocation
|
||||||
}
|
) ?? [];
|
||||||
}
|
return !!glassLocationMatches.length;
|
||||||
return vapsLineItemsForSelectedPackage;
|
|
||||||
},
|
|
||||||
getCustomValueFromString(str) {
|
|
||||||
switch (str) {
|
|
||||||
case 'isRecalibrationOnOrder':
|
|
||||||
return this.isRecalibrationOnOrder;
|
|
||||||
case 'frontWipersApplicableForTierTwo':
|
|
||||||
return this.frontWipersApplicableForTierTwo;
|
|
||||||
case 'rearWiperApplicableForTierTwo':
|
|
||||||
return this.rearWiperApplicableForTierTwo;
|
|
||||||
case 'frontWipersApplicableForTierThree':
|
|
||||||
return this.frontWipersApplicableForTierThree;
|
|
||||||
case 'rearWiperApplicableForTierThree':
|
|
||||||
return this.rearWiperApplicableForTierThree;
|
|
||||||
case 'rainDefenseApplicableForTierThree':
|
|
||||||
return this.rainDefenseApplicableForTierThree;
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getLineItemsContainingPartType(partType) {
|
components: {
|
||||||
const partTypeMatches = this.nullSafeAvailableLineItems.filter(
|
buttonQuestion
|
||||||
(lineItem) => lineItem.partType.toUpperCase() === partType
|
|
||||||
);
|
|
||||||
return partTypeMatches;
|
|
||||||
},
|
|
||||||
lineItemsContainsPartType(partType) {
|
|
||||||
const partTypeMatches = this.getLineItemsContainingPartType(partType);
|
|
||||||
return !!partTypeMatches.length;
|
|
||||||
},
|
|
||||||
glassToReplaceContainsGlassLocation(glassLocation) {
|
|
||||||
const glassLocationMatches =
|
|
||||||
this.$store.order.damage.glassToReplace?.filter(
|
|
||||||
(glassToReplace) => glassToReplace.glassLocation === glassLocation
|
|
||||||
) ?? [];
|
|
||||||
return !!glassLocationMatches.length;
|
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
components: {
|
|
||||||
buttonQuestion
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -91,19 +91,19 @@
|
||||||
...resultMap.wipers,
|
...resultMap.wipers,
|
||||||
...clonedGlassParts
|
...clonedGlassParts
|
||||||
];
|
];
|
||||||
const pricingResults = await baseMixin.methods.dispatchStoreAction(
|
//const pricingResults = await baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
// storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
||||||
{
|
// {
|
||||||
availableLineItems: availableLineItems
|
// availableLineItems: availableLineItems
|
||||||
},
|
// },
|
||||||
false
|
// false
|
||||||
);
|
//);
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.pricedGlassParts = clonedGlassParts;
|
vm.pricedGlassParts = clonedGlassParts;
|
||||||
vm.supportingItems = resultMap.supportingItems;
|
vm.supportingItems = resultMap.supportingItems;
|
||||||
vm.availableLineItems = pricingResults;
|
vm.availableLineItems = availableLineItems; //pricingResults;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,7 @@ export const useMainStore = defineStore({
|
||||||
payload: {
|
payload: {
|
||||||
carId: carId,
|
carId: carId,
|
||||||
serviceType: isRepair ? 'Repair' : 'Replace',
|
serviceType: isRepair ? 'Repair' : 'Replace',
|
||||||
parentAccountNumber: 0,
|
parentAccountNumber: applicationConfig.CASH_PARENT_ACCOUNT_NUMBER,
|
||||||
parts: glassPartsArray,
|
parts: glassPartsArray,
|
||||||
numberOfRepairChips: isRepair ? numberOfChips : 0
|
numberOfRepairChips: isRepair ? numberOfChips : 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue