CSR-297 persist vehicle damage selections and tests
This commit is contained in:
parent
42b9a1a981
commit
eead9f0ccd
5 changed files with 268 additions and 47 deletions
|
|
@ -1,8 +0,0 @@
|
||||||
const damageLocationsParts = {
|
|
||||||
WINDSHIELD: "Windshield",
|
|
||||||
DRIVER: "Driver",
|
|
||||||
PASSENGER: "Passenger",
|
|
||||||
REAR: "Rear",
|
|
||||||
};
|
|
||||||
|
|
||||||
export { damageLocationsParts };
|
|
||||||
|
|
@ -2,6 +2,20 @@ const damageLocationsSelected = {
|
||||||
WINDSHIELD: "Windshield",
|
WINDSHIELD: "Windshield",
|
||||||
SIDEDOOR: "SideDoor",
|
SIDEDOOR: "SideDoor",
|
||||||
REARWINDOW: "RearWindow",
|
REARWINDOW: "RearWindow",
|
||||||
|
REPAIR: "Repair",
|
||||||
|
REPLACE: "Replace",
|
||||||
|
DRIVER: "Driver",
|
||||||
|
PASSENGER: "Passenger",
|
||||||
|
FRONT: "Front",
|
||||||
|
REAR: "Rear",
|
||||||
|
BACK: "Back",
|
||||||
|
QUARTER: "Quarter",
|
||||||
|
VENT: "Vent",
|
||||||
|
SINGLE: "Single",
|
||||||
|
DRIVERSIDE: "DriverSide",
|
||||||
|
PASSENGERSIDE: "PassengerSide",
|
||||||
|
STATIONARY: "Stationary",
|
||||||
|
SLIDER: "Slider"
|
||||||
};
|
};
|
||||||
|
|
||||||
export { damageLocationsSelected };
|
export { damageLocationsSelected };
|
||||||
|
|
@ -19,6 +19,7 @@ import { nextTick } from "vue";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import { storeMutations } from "@/constants/store-mutations";
|
import { storeMutations } from "@/constants/store-mutations";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
|
||||||
|
|
||||||
// Mock our module for promises.
|
// Mock our module for promises.
|
||||||
jest.mock("@/helpers/layout-helper.js", () => ({
|
jest.mock("@/helpers/layout-helper.js", () => ({
|
||||||
|
|
@ -38,6 +39,9 @@ jest.mock("@/store", () => ({
|
||||||
vehicle: {
|
vehicle: {
|
||||||
carId: "C00000000",
|
carId: "C00000000",
|
||||||
},
|
},
|
||||||
|
damage: {
|
||||||
|
glassToReplace: []
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -252,7 +256,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
describe("vehicle-damage.vue", () => {
|
||||||
test("Windshield replace with single part on ForwardButtonAction triggers a router.navigateAfterSave and saves selections to store", async () => {
|
test("Windshield replace with single part on ForwardButtonAction triggers a router.navigate and saves selections to store", async () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
const partsData = { partsOrQuestions: [
|
const partsData = { partsOrQuestions: [
|
||||||
{
|
{
|
||||||
|
|
@ -272,7 +276,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
pageHeaderWidgetHeaderText: "",
|
pageHeaderWidgetHeaderText: "",
|
||||||
mountOptionsMockData: {
|
mountOptionsMockData: {
|
||||||
router: { navigateAfterSave: jest.fn(), },
|
router: { navigate: jest.fn(), },
|
||||||
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },],},
|
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },],},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -296,7 +300,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.$router.navigateAfterSave).toHaveBeenCalled();
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
||||||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_IS_REPAIR, false);
|
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_IS_REPAIR, false);
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_GLASS_TO_REPLACE, expectedGlassToReplace);
|
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_GLASS_TO_REPLACE, expectedGlassToReplace);
|
||||||
|
|
@ -389,13 +393,13 @@ describe("vehicle-damage.vue", () => {
|
||||||
|
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
describe("vehicle-damage.vue", () => {
|
||||||
test("Windshield repair on ForwardButtonAction triggers a router.navigateAfterSave and saves selection to store", async () => {
|
test("Windshield repair on ForwardButtonAction triggers a router.navigate and saves selection to store", async () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
const partsData = { partsOrQuestions: []};
|
const partsData = { partsOrQuestions: []};
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
pageHeaderWidgetHeaderText: "",
|
pageHeaderWidgetHeaderText: "",
|
||||||
mountOptionsMockData: {
|
mountOptionsMockData: {
|
||||||
router: { navigateAfterSave: jest.fn(), },
|
router: { navigate: jest.fn(), },
|
||||||
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },],},
|
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },],},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -416,7 +420,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.$router.navigateAfterSave).toHaveBeenCalled();
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_IS_REPAIR, true);
|
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_IS_REPAIR, true);
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_NUMBER_OF_CHIPS, 2);
|
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_NUMBER_OF_CHIPS, 2);
|
||||||
});
|
});
|
||||||
|
|
@ -596,6 +600,162 @@ describe("vehicle-damage.vue", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const damageLocations = [["Windshield", [damageLocationsSelected.WINDSHIELD]],
|
||||||
|
["Driver", [damageLocationsSelected.SIDEDOOR]],
|
||||||
|
["Passenger", [damageLocationsSelected.SIDEDOOR]],
|
||||||
|
["Rear", [damageLocationsSelected.REARWINDOW]]];
|
||||||
|
describe("vehicle-damage.vue", () => {
|
||||||
|
test.each(damageLocations)("getDamageLocationsFromStore for %s returns expected %s", async (damageLocation, expectedGlass) => {
|
||||||
|
|
||||||
|
//Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
//Act
|
||||||
|
vehicleDamage.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle-damage" } },
|
||||||
|
undefined,
|
||||||
|
(c) => c(wrapper.vm)
|
||||||
|
);
|
||||||
|
|
||||||
|
store.getters = { vehicle: { carId: "C0000000" }, damage: { glassToReplace: [{location: damageLocation}] }, isRepair: true};
|
||||||
|
|
||||||
|
var glassSelections = wrapper.vm.getDamageLocationsFromStore();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
expect(glassSelections).toEqual(expectedGlass);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const storeWindshieldOptions = [[1, false, "Windshield", "Single", { selectedWindshieldDamageType: [damageLocationsSelected.REPLACE],
|
||||||
|
selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.SINGLE]}],
|
||||||
|
[2, false, "Windshield", "Driver", { selectedWindshieldDamageType: [damageLocationsSelected.REPLACE],
|
||||||
|
selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.DRIVER]}],
|
||||||
|
[3, false, "Windshield", "Passenger", { selectedWindshieldDamageType: [damageLocationsSelected.REPLACE],
|
||||||
|
selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.PASSENGER]}],
|
||||||
|
[4, true, "", "", { selectedWindshieldDamageType: [damageLocationsSelected.REPAIR],
|
||||||
|
selectedWindshieldChipCount: [2], selectedWindshieldReplaceOptions: []}]
|
||||||
|
];
|
||||||
|
describe("vehicle-damage.vue", () => {
|
||||||
|
test.each(storeWindshieldOptions)("getWindshieldOptionsFromStore test #%s", async (testNum, isRepair, damageLocation, damageName, expectedWindshieldOptions) => {
|
||||||
|
|
||||||
|
//Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
//Act
|
||||||
|
vehicleDamage.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle-damage" } },
|
||||||
|
undefined,
|
||||||
|
(c) => c(wrapper.vm)
|
||||||
|
);
|
||||||
|
|
||||||
|
store.getters = {
|
||||||
|
vehicle:
|
||||||
|
{ carId: "C0000000" },
|
||||||
|
damage:
|
||||||
|
{
|
||||||
|
glassToReplace: [{location: damageLocation, name: damageName}],
|
||||||
|
isRepair: isRepair,
|
||||||
|
numberOfChips: 2
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
var windshieldSelections = wrapper.vm.getWindshieldOptionsFromStore();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
expect(windshieldSelections).toEqual(expectedWindshieldOptions);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const driverDoorSides = [["Driver", "Front", [damageLocationsSelected.FRONT]],
|
||||||
|
["Driver", "Back", [damageLocationsSelected.BACK]],
|
||||||
|
["Driver", "Vent", [damageLocationsSelected.VENT]],
|
||||||
|
["Driver", "Quarter", [damageLocationsSelected.QUARTER]]
|
||||||
|
];
|
||||||
|
describe("vehicle-damage.vue", () => {
|
||||||
|
test.each(driverDoorSides)("getDriverSideReplaceOptionsFromStore for %s-%s returns expected %s", async (damageLocation, damageName, expectedGlass) => {
|
||||||
|
|
||||||
|
//Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
//Act
|
||||||
|
vehicleDamage.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle-damage" } },
|
||||||
|
undefined,
|
||||||
|
(c) => c(wrapper.vm)
|
||||||
|
);
|
||||||
|
|
||||||
|
store.getters = { vehicle: { carId: "C0000000" }, damage: { glassToReplace: [{location: damageLocation, name: damageName}] }, isRepair: true};
|
||||||
|
|
||||||
|
var glassSelections = wrapper.vm.getDriverSideReplaceOptionsFromStore();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
expect(glassSelections).toEqual(expectedGlass);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const passengerDoorSides = [["Passenger", "Front", [damageLocationsSelected.FRONT]],
|
||||||
|
["Passenger", "Back", [damageLocationsSelected.BACK]],
|
||||||
|
["Passenger", "Vent", [damageLocationsSelected.VENT]],
|
||||||
|
["Passenger", "Quarter", [damageLocationsSelected.QUARTER]]
|
||||||
|
];
|
||||||
|
describe("vehicle-damage.vue", () => {
|
||||||
|
test.each(passengerDoorSides)("getPassengerSideReplaceOptionsFromStore for %s-%s returns expected %s", async (damageLocation, damageName, expectedGlass) => {
|
||||||
|
|
||||||
|
//Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
//Act
|
||||||
|
vehicleDamage.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle-damage" } },
|
||||||
|
undefined,
|
||||||
|
(c) => c(wrapper.vm)
|
||||||
|
);
|
||||||
|
|
||||||
|
store.getters = { vehicle: { carId: "C0000000" }, damage: { glassToReplace: [{location: damageLocation, name: damageName}] }, isRepair: true};
|
||||||
|
|
||||||
|
var glassSelections = wrapper.vm.getPassengerSideReplaceOptionsFromStore();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
expect(glassSelections).toEqual(expectedGlass);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const rearReplaceOptions = [["Rear", "Stationary", [damageLocationsSelected.STATIONARY]],
|
||||||
|
["Rear", "Slider", [damageLocationsSelected.SLIDER]]
|
||||||
|
];
|
||||||
|
describe("vehicle-damage.vue", () => {
|
||||||
|
test.each(rearReplaceOptions)("getRearReplaceOptionsFromStore for %s-%s returns expected %s", async (damageLocation, damageName, expectedGlass) => {
|
||||||
|
|
||||||
|
//Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
//Act
|
||||||
|
vehicleDamage.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle-damage" } },
|
||||||
|
undefined,
|
||||||
|
(c) => c(wrapper.vm)
|
||||||
|
);
|
||||||
|
|
||||||
|
store.getters = { vehicle: { carId: "C0000000" }, damage: { glassToReplace: [{location: damageLocation, name: damageName}] }, isRepair: true};
|
||||||
|
|
||||||
|
var glassSelections = wrapper.vm.getRearReplaceOptionsFromStore();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
expect(glassSelections).toEqual(expectedGlass);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function setupMocks({
|
function setupMocks({
|
||||||
pageHeaderWidgetHeaderText = {},
|
pageHeaderWidgetHeaderText = {},
|
||||||
mountOptionsMockData = {
|
mountOptionsMockData = {
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import baseMixin from "@/mixins/base-mixin";
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
import { damageLocationsParts } from "@/constants/damage-locations-parts.js";
|
|
||||||
import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
|
import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
|
||||||
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
|
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
|
||||||
|
|
||||||
|
|
@ -107,14 +106,14 @@ export default {
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
selectedDamageLocations: this.getDamageLocations(),
|
selectedDamageLocations: this.getDamageLocationsFromStore(),
|
||||||
sideDoorOptionsData: {
|
sideDoorOptionsData: {
|
||||||
selectedDoorSides: [],
|
selectedDoorSides: this.getDoorSidesFromStore(),
|
||||||
selectedDriverSideReplaceOptions: [],
|
selectedDriverSideReplaceOptions: this.getDriverSideReplaceOptionsFromStore(),
|
||||||
selectedPassengerSideReplaceOptions: []
|
selectedPassengerSideReplaceOptions: this.getPassengerSideReplaceOptionsFromStore()
|
||||||
},
|
},
|
||||||
selectedWindshieldOptions: this.getWindshieldOptions(),
|
selectedWindshieldOptions: this.getWindshieldOptionsFromStore(),
|
||||||
selectedRearReplaceOptions: [],
|
selectedRearReplaceOptions: this.getRearReplaceOptionsFromStore(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -125,6 +124,10 @@ export default {
|
||||||
store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
|
store.commit(this.storeMutations.UPDATE_IS_REPAIR, null);
|
||||||
|
store.commit(this.storeMutations.UPDATE_NUMBER_OF_CHIPS, null);
|
||||||
|
store.commit(this.storeMutations.UPDATE_GLASS_TO_REPLACE, []);
|
||||||
|
|
||||||
// route to move backwards
|
// route to move backwards
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.CLICKED_BACK,
|
this.navigationScenarios.CLICKED_BACK,
|
||||||
|
|
@ -132,58 +135,106 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
getDamageLocations() {
|
getDamageLocationsFromStore() {
|
||||||
var glassSelections = [];
|
var glassSelections = [];
|
||||||
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsParts.WINDSHIELD }) ||
|
|
||||||
|
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsSelected.WINDSHIELD }) ||
|
||||||
store.getters.damage.isRepair) {
|
store.getters.damage.isRepair) {
|
||||||
glassSelections.push(damageLocationsSelected.WINDSHIELD);
|
glassSelections.push(damageLocationsSelected.WINDSHIELD);
|
||||||
}
|
}
|
||||||
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsParts.DRIVER })) {
|
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsSelected.DRIVER ||
|
||||||
|
glass.location === damageLocationsSelected.PASSENGER })) {
|
||||||
glassSelections.push(damageLocationsSelected.SIDEDOOR);
|
glassSelections.push(damageLocationsSelected.SIDEDOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsParts.PASSENGER })) {
|
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsSelected.REAR })) {
|
||||||
glassSelections.push(damageLocationsSelected.SIDEDOOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsParts.REAR })) {
|
|
||||||
glassSelections.push(damageLocationsSelected.REARWINDOW);
|
glassSelections.push(damageLocationsSelected.REARWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
return glassSelections;
|
return glassSelections;
|
||||||
},
|
},
|
||||||
|
|
||||||
getWindshieldOptions() {
|
getWindshieldOptionsFromStore() {
|
||||||
var windShieldOptions = { selectedWindshieldDamageType: [], selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: []};
|
var windShieldOptions = { selectedWindshieldDamageType: [], selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: []};
|
||||||
|
|
||||||
if (store.getters.damage.isRepair === undefined) return windshieldOptions;
|
if (store.getters.damage.isRepair === undefined) return windshieldOptions;
|
||||||
|
|
||||||
if (!store.getters.damage.isRepair) {
|
if (!store.getters.damage.isRepair) {
|
||||||
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsParts.WINDSHIELD &&
|
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsSelected.WINDSHIELD &&
|
||||||
glass.name === "Single" })) {
|
glass.name === damageLocationsSelected.SINGLE })) {
|
||||||
windShieldOptions.selectedWindshieldDamageType.push("Replace");
|
windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPLACE);
|
||||||
windShieldOptions.selectedWindshieldReplaceOptions.push("Single");
|
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.SINGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsParts.WINDSHIELD &&
|
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsSelected.WINDSHIELD &&
|
||||||
glass.name === "Driver" })) {
|
glass.name === damageLocationsSelected.DRIVER })) {
|
||||||
windShieldOptions.selectedWindshieldDamageType.push("Replace");
|
windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPLACE);
|
||||||
windShieldOptions.selectedWindshieldReplaceOptions.push("Driver");
|
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.DRIVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsParts.WINDSHIELD &&
|
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsSelected.WINDSHIELD &&
|
||||||
glass.name === "Passenger" })) {
|
glass.name === damageLocationsSelected.PASSENGER })) {
|
||||||
windShieldOptions.selectedWindshieldDamageType.push("Replace");
|
windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPLACE);
|
||||||
windShieldOptions.selectedWindshieldReplaceOptions.push("Passenger");
|
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.PASSENGER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store.getters.damage.isRepair) {
|
if (store.getters.damage.isRepair) {
|
||||||
windShieldOptions.selectedWindshieldDamageType.push("Repair");
|
windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPAIR);
|
||||||
windShieldOptions.selectedWindshieldChipCount.push(store.getters.damage.numberOfChips);
|
windShieldOptions.selectedWindshieldChipCount.push(store.getters.damage.numberOfChips);
|
||||||
}
|
}
|
||||||
|
|
||||||
return windShieldOptions;
|
return windShieldOptions;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
getDoorSidesFromStore() {
|
||||||
|
var doorSides = [];
|
||||||
|
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsSelected.DRIVER })){
|
||||||
|
doorSides.push(damageLocationsSelected.DRIVERSIDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (store.getters.damage.glassToReplace.some(glass => { return glass.location === damageLocationsSelected.PASSENGER })){
|
||||||
|
doorSides.push(damageLocationsSelected.PASSENGERSIDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return doorSides;
|
||||||
|
},
|
||||||
|
|
||||||
|
getDriverSideReplaceOptionsFromStore() {
|
||||||
|
var driverSideReplaceOptions = [];
|
||||||
|
|
||||||
|
store.getters.damage.glassToReplace.forEach(glass => {
|
||||||
|
if (glass.location === damageLocationsSelected.DRIVER){
|
||||||
|
driverSideReplaceOptions.push(glass.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return driverSideReplaceOptions;
|
||||||
|
},
|
||||||
|
|
||||||
|
getPassengerSideReplaceOptionsFromStore() {
|
||||||
|
var passengerSideReplaceOptions = [];
|
||||||
|
|
||||||
|
store.getters.damage.glassToReplace.forEach(glass => {
|
||||||
|
if (glass.location === damageLocationsSelected.PASSENGER){
|
||||||
|
passengerSideReplaceOptions.push(glass.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return passengerSideReplaceOptions;
|
||||||
|
},
|
||||||
|
|
||||||
|
getRearReplaceOptionsFromStore(){
|
||||||
|
var rearReplaceOptions = [];
|
||||||
|
|
||||||
|
store.getters.damage.glassToReplace.forEach(glass => {
|
||||||
|
if (glass.location === damageLocationsSelected.REAR){
|
||||||
|
rearReplaceOptions.push(glass.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return rearReplaceOptions;
|
||||||
},
|
},
|
||||||
|
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
|
|
@ -233,25 +284,25 @@ export default {
|
||||||
const selectedGlassToReplace = [];
|
const selectedGlassToReplace = [];
|
||||||
if (this.isWindshieldDamageLocation && !this.isWindshieldRepair){
|
if (this.isWindshieldDamageLocation && !this.isWindshieldRepair){
|
||||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.forEach(wsItem => {
|
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.forEach(wsItem => {
|
||||||
selectedGlassToReplace.push({ location: damageLocationsParts.WINDSHIELD, name: wsItem});
|
selectedGlassToReplace.push({ location: damageLocationsSelected.WINDSHIELD, name: wsItem});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isDriverSideReplace){
|
if (this.isDriverSideReplace){
|
||||||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.forEach(driverItem => {
|
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.forEach(driverItem => {
|
||||||
selectedGlassToReplace.push({ location: damageLocationsParts.DRIVER, name: driverItem});
|
selectedGlassToReplace.push({ location: damageLocationsSelected.DRIVER, name: driverItem});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isPassengerSideReplace){
|
if (this.isPassengerSideReplace){
|
||||||
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.forEach(passengerItem => {
|
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.forEach(passengerItem => {
|
||||||
selectedGlassToReplace.push({ location: damageLocationsParts.PASSENGER, name: passengerItem});
|
selectedGlassToReplace.push({ location: damageLocationsSelected.PASSENGER, name: passengerItem});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isRearWindowDamageLocation) {
|
if (this.isRearWindowDamageLocation) {
|
||||||
this.selectedRearReplaceOptions.forEach(rearItem => {
|
this.selectedRearReplaceOptions.forEach(rearItem => {
|
||||||
selectedGlassToReplace.push({ location: damageLocationsParts.REAR, name: rearItem});
|
selectedGlassToReplace.push({ location: damageLocationsSelected.REAR, name: rearItem});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,10 @@ export default {
|
||||||
store.commit(storeMutations.UPDATE_STYLE, null);
|
store.commit(storeMutations.UPDATE_STYLE, null);
|
||||||
store.commit(storeMutations.UPDATE_CAR_ID, null);
|
store.commit(storeMutations.UPDATE_CAR_ID, null);
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
|
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
|
||||||
|
store.commit(storeMutations.UPDATE_IS_REPAIR, null);
|
||||||
|
store.commit(storeMutations.UPDATE_NUMBER_OF_CHIPS, null);
|
||||||
|
store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, []);
|
||||||
|
|
||||||
|
|
||||||
// Invokes
|
// Invokes
|
||||||
store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue