Merge remote-tracking branch 'origin/develop' into feature/skiener/INSR-2124
This commit is contained in:
commit
b2dfe2fef9
4 changed files with 39 additions and 5 deletions
|
|
@ -11,7 +11,7 @@ export function isRecalPartOrHasChildRecalPart(glassPart) {
|
|||
const isGlassPartRecalPart = isRecalPart(glassPart);
|
||||
|
||||
if (!isGlassPartRecalPart && glassPart.childParts && glassPart.childParts.length > 0) {
|
||||
return glassPart.childParts.filter((cp) => isRecalPartOrHasChildRecalPart(cp));
|
||||
return glassPart.childParts.some((cp) => isRecalPartOrHasChildRecalPart(cp));
|
||||
}
|
||||
|
||||
return isGlassPartRecalPart;
|
||||
|
|
@ -52,3 +52,24 @@ export function getRecalPartNumbers(glassPartsArray) {
|
|||
}
|
||||
}
|
||||
|
||||
export function containsRecalParts(lineItems) {
|
||||
if (!lineItems) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Array.isArray(lineItems)) {
|
||||
return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li));
|
||||
} else {
|
||||
// complex object form -- flatten and re-call.
|
||||
const flattened = [
|
||||
...(lineItems.glassParts ?? []),
|
||||
...(lineItems.supportingItems ?? []),
|
||||
...(lineItems.otherParts ?? []),
|
||||
...(lineItems.feeItems ?? []),
|
||||
...(lineItems.vaps ?? []),
|
||||
];
|
||||
|
||||
return flattened.some((li) => isRecalPartOrHasChildRecalPart(li));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ jest.mock('@/helpers/text-helper', () => ({
|
|||
formatAmountInDollars: jest.fn()
|
||||
}));
|
||||
|
||||
jest.mock('@/helpers/recal-helper.js', () => ({
|
||||
containsRecalParts: jest.fn()
|
||||
}));
|
||||
|
||||
import { containsRecalParts } from '@/helpers/recal-helper.js';
|
||||
|
||||
const SAFELITE_PROVIDER = 'Safelite';
|
||||
const CANCEL_CLAIM_REF_NAME = 'CancelClaimModal';
|
||||
|
||||
|
|
@ -337,15 +343,17 @@ describe('coverageStatement.vue', () => {
|
|||
// Assert
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
test('returns true when a part in glassParts require recalibration', () => {
|
||||
test('returns true when a part in glassParts require recalibration and recalibration has been added to order', () => {
|
||||
// Arrange
|
||||
containsRecalParts.mockReturnValue(true);
|
||||
const mainInitialState = {
|
||||
order: {
|
||||
lineItems: {
|
||||
glassParts: [
|
||||
{
|
||||
partNumber: 123,
|
||||
requiresRecalibration: true
|
||||
requiresRecalibration: true,
|
||||
partType: 'RECALIBRATION'
|
||||
},
|
||||
{
|
||||
partNumber: 111,
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ import { getPriceOfLineItems } from '@/helpers/price-calculator';
|
|||
import coverageStatuses from '@/constants/coverage-statuses';
|
||||
import coverageType from '@/constants/coverage-type';
|
||||
import oemEndorsementModal from '@/layouts/coverage-statement/oem-endorsement-modal/oem-endorsement-modal.vue';
|
||||
import { containsRecalParts } from '@/helpers/recal-helper';
|
||||
|
||||
const RECAL_MODAL_REF_NAME = 'RecalModal';
|
||||
const CANCEL_CLAIM_REF_NAME = 'CancelClaimModal';
|
||||
|
|
@ -305,9 +306,11 @@ export default {
|
|||
},
|
||||
isADAS() {
|
||||
const { glassParts } = useMainStore().order.lineItems;
|
||||
const orderContainsRecalPart = containsRecalParts(glassParts);
|
||||
return (
|
||||
glassParts !== null
|
||||
&& !!glassParts.find((part) => part.requiresRecalibration)
|
||||
&& orderContainsRecalPart
|
||||
);
|
||||
},
|
||||
totalServicePrice() {
|
||||
|
|
@ -410,7 +413,8 @@ export default {
|
|||
}
|
||||
},
|
||||
async navigateForward() {
|
||||
if (this.isUnverifiedVisible || this.isDeductibleVisible) {
|
||||
showIssLoadingModal(true);
|
||||
if (this.isUnverifiedVisible || this.isDeductibleVisible) {
|
||||
this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD);
|
||||
} else if (this.isITACQuoteVisible || this.isNoCompQuoteVisible) {
|
||||
this.mainStore.updateIsSafeliteProvider(true);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import partTypeStrings from '@/constants/part-type-strings';
|
|||
import { useMainStore } from '@/store';
|
||||
import { getPriceOfLineItem } from '@/helpers/price-calculator';
|
||||
import { shallowRef } from 'vue';
|
||||
import { containsRecalParts } from '@/helpers/recal-helper';
|
||||
|
||||
const glassLocations = damageLocationsSelected;
|
||||
|
||||
|
|
@ -100,7 +101,7 @@ export default {
|
|||
return modifiedAnswers;
|
||||
},
|
||||
isRecalibrationOnOrder() {
|
||||
return this.mainStore.hasRecalibrationPart;
|
||||
return this.mainStore.hasRecalibrationPart && containsRecalParts(this.mainStore.order.lineItems);
|
||||
},
|
||||
frontWipersApplicableForTierTwo() {
|
||||
const frontWipersAreAvailable = this.lineItemsContainsPartType(partTypeStrings.FRONT_WIPER);
|
||||
|
|
|
|||
Loading…
Reference in a new issue