state changes
This commit is contained in:
parent
9636d358d8
commit
7daa667552
17 changed files with 54 additions and 50 deletions
|
|
@ -14,10 +14,10 @@ const storeActions = {
|
||||||
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
|
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
|
||||||
|
|
||||||
// DEPENDENCY MUTATIONS
|
// DEPENDENCY MUTATIONS
|
||||||
RESET_VEHICLE_AND_DEPS: "resetVehicleAndDependencies",
|
RESET_VEHICLE_STATE: "resetVehicleAndDependencies",
|
||||||
RESET_DAMAGE_AND_DEPS: "resetDamageAndDependencies",
|
RESET_DAMAGE_STATE: "resetDamageAndDependencies",
|
||||||
RESET_REGISTRATION_AND_DEPS: "resetRegistrationAndDependencies",
|
RESET_REGISTRATION_STATE: "resetRegistrationAndDependencies",
|
||||||
RESET_PARTS_AND_DEPS: "resetPartsAndDependencies",
|
RESET_PARTS_STATE: "resetPartsAndDependencies",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { storeActions };
|
export { storeActions };
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ const storeMutations = {
|
||||||
REMOVE_EVENT_FROM_BUS: "removeEventFromBus",
|
REMOVE_EVENT_FROM_BUS: "removeEventFromBus",
|
||||||
|
|
||||||
// DEPENDENCY MUTATIONS
|
// DEPENDENCY MUTATIONS
|
||||||
RESET_VEHICLE_AND_DEPS: "resetVehicleAndDependencies",
|
RESET_VEHICLE_STATE: "resetVehicleState",
|
||||||
RESET_DAMAGE_AND_DEPS: "resetDamageAndDependencies",
|
RESET_DAMAGE_STATE: "resetDamageState",
|
||||||
RESET_REGISTRATION_AND_DEPS: "resetRegistrationAndDependencies",
|
RESET_REGISTRATION_STATE: "resetRegistrationState",
|
||||||
RESET_PARTS_AND_DEPS: "resetPartsAndDependencies",
|
RESET_PARTS_STATE: "resetPartsState",
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ export default {
|
||||||
},
|
},
|
||||||
resetDependentState() {
|
resetDependentState() {
|
||||||
// Invokes
|
// Invokes
|
||||||
store.dispatch(storeActions.RESET_PARTS_AND_DEPS);
|
store.dispatch(storeActions.RESET_PARTS_STATE);
|
||||||
},
|
},
|
||||||
onSubmit(values) {
|
onSubmit(values) {
|
||||||
window.alert('Success! Submitted values: ' + JSON.stringify(values, null ,2))
|
window.alert('Success! Submitted values: ' + JSON.stringify(values, null ,2))
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ describe("vehicle-damage.vue", () => {
|
||||||
wrapper.vm.resetDependentState();
|
wrapper.vm.resetDependentState();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(store.dispatch).toBeCalledWith(storeActions.RESET_PARTS_AND_DEPS)
|
expect(store.dispatch).toBeCalledWith(storeActions.RESET_PARTS_STATE)
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ export default {
|
||||||
},
|
},
|
||||||
resetDependentState() {
|
resetDependentState() {
|
||||||
// Invokes
|
// Invokes
|
||||||
store.dispatch(storeActions.RESET_PARTS_AND_DEPS);
|
store.dispatch(storeActions.RESET_PARTS_STATE);
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
// route to move backwards
|
// route to move backwards
|
||||||
|
|
|
||||||
|
|
@ -223,8 +223,8 @@ describe("vehicle-make.vue", () => {
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null)
|
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null)
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null)
|
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null)
|
||||||
|
|
||||||
expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_AND_DEPS)
|
expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE)
|
||||||
expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_AND_DEPS)
|
expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE)
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -94,8 +94,8 @@ export default {
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
|
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
|
||||||
|
|
||||||
// Invokes
|
// Invokes
|
||||||
store.dispatch(storeActions.RESET_DAMAGE_AND_DEPS);
|
store.dispatch(storeActions.RESET_DAMAGE_STATE);
|
||||||
store.dispatch(storeActions.RESET_REGISTRATION_AND_DEPS);
|
store.dispatch(storeActions.RESET_REGISTRATION_STATE);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,8 +208,8 @@ describe("vehicle-model.vue", () => {
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null)
|
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null)
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null)
|
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null)
|
||||||
|
|
||||||
expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_AND_DEPS)
|
expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE)
|
||||||
expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_AND_DEPS)
|
expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE)
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -94,8 +94,8 @@ export default {
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
|
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
|
||||||
|
|
||||||
// Invokes
|
// Invokes
|
||||||
store.dispatch(storeActions.RESET_DAMAGE_AND_DEPS);
|
store.dispatch(storeActions.RESET_DAMAGE_STATE);
|
||||||
store.dispatch(storeActions.RESET_REGISTRATION_AND_DEPS);
|
store.dispatch(storeActions.RESET_REGISTRATION_STATE);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<p>{{ colorQuestionText }}</p>
|
<p class="mb-0">{{ colorQuestionText }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-for="(item, i) in Parts" :key="i">
|
<div v-for="(item, i) in Parts" :key="i">
|
||||||
|
|
||||||
|
<!-- Render horizontal lines if there is multi-glass (aka if i > 0) -->
|
||||||
|
<div class="container-fluid">
|
||||||
|
<hr v-if="i > 0">
|
||||||
|
</div>
|
||||||
|
|
||||||
<partQuestion :ref="`${refPrefix}-${item.glassLocation}`" v-model="glassParts[item.glassLocation + '-' + item.glassName]" :glassLocation="item.glassLocation" :glassName="item.glassName" :colorAnswers="item.colorAnswers" />
|
<partQuestion :ref="`${refPrefix}-${item.glassLocation}`" v-model="glassParts[item.glassLocation + '-' + item.glassName]" :glassLocation="item.glassLocation" :glassName="item.glassName" :colorAnswers="item.colorAnswers" />
|
||||||
<br />
|
|
||||||
</div>
|
</div>
|
||||||
<funnelFooter ref="funnelFooter" @back-clicked="backButtonAction" />
|
<funnelFooter ref="funnelFooter" @back-clicked="backButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -146,7 +151,6 @@ export default {
|
||||||
glassName: g.glassName,
|
glassName: g.glassName,
|
||||||
glassLocation: g.glassLocation,
|
glassLocation: g.glassLocation,
|
||||||
colorAnswers: g.parts.reduce((arr, p) => {
|
colorAnswers: g.parts.reduce((arr, p) => {
|
||||||
|
|
||||||
arr.push({
|
arr.push({
|
||||||
ColorAnswerText: p.color,
|
ColorAnswerText: p.color,
|
||||||
FeatureAnswers: [{
|
FeatureAnswers: [{
|
||||||
|
|
@ -154,7 +158,6 @@ export default {
|
||||||
PartNumber: p.partNumber
|
PartNumber: p.partNumber
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
return arr;
|
return arr;
|
||||||
}, [])
|
}, [])
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,8 @@ export default {
|
||||||
},
|
},
|
||||||
resetDependentState() {
|
resetDependentState() {
|
||||||
// Invokes
|
// Invokes
|
||||||
store.dispatch(storeActions.RESET_DAMAGE_AND_DEPS);
|
store.dispatch(storeActions.RESET_DAMAGE_STATE);
|
||||||
store.dispatch(storeActions.RESET_REGISTRATION_AND_DEPS);
|
store.dispatch(storeActions.RESET_REGISTRATION_STATE);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,8 +163,8 @@ describe("vehicle-year.vue", () => {
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null)
|
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null)
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null)
|
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null)
|
||||||
|
|
||||||
expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_AND_DEPS)
|
expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE)
|
||||||
expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_AND_DEPS)
|
expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE)
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,8 @@ export default {
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
|
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
|
||||||
|
|
||||||
// Invokes
|
// Invokes
|
||||||
store.dispatch(storeActions.RESET_DAMAGE_AND_DEPS);
|
store.dispatch(storeActions.RESET_DAMAGE_STATE);
|
||||||
store.dispatch(storeActions.RESET_REGISTRATION_AND_DEPS);
|
store.dispatch(storeActions.RESET_REGISTRATION_STATE);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ export const mutations = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// DEPENDENCY MUTATIONS
|
// DEPENDENCY MUTATIONS
|
||||||
resetVehicleAndDependencies(state) {
|
resetVehicleState(state) {
|
||||||
state.order.vehicle.year = null;
|
state.order.vehicle.year = null;
|
||||||
state.order.vehicle.make = null;
|
state.order.vehicle.make = null;
|
||||||
state.order.vehicle.model = null;
|
state.order.vehicle.model = null;
|
||||||
|
|
@ -94,7 +94,7 @@ export const mutations = {
|
||||||
state.order.vehicle.carId = null;
|
state.order.vehicle.carId = null;
|
||||||
state.order.vehicle.category = null;
|
state.order.vehicle.category = null;
|
||||||
},
|
},
|
||||||
resetDamageAndDependencies(state) {
|
resetDamageState(state) {
|
||||||
state.order.damage.isRepair = null;
|
state.order.damage.isRepair = null;
|
||||||
state.order.damage.numberOfChips = null;
|
state.order.damage.numberOfChips = null;
|
||||||
state.order.damage.windshieldGlassToReplace = null;
|
state.order.damage.windshieldGlassToReplace = null;
|
||||||
|
|
@ -103,10 +103,10 @@ export const mutations = {
|
||||||
state.order.damage.rearGlassToReplace = null;
|
state.order.damage.rearGlassToReplace = null;
|
||||||
|
|
||||||
},
|
},
|
||||||
resetRegistrationAndDependencies(state) {
|
resetRegistrationState(state) {
|
||||||
|
|
||||||
},
|
},
|
||||||
resetPartsAndDependencies(state) {
|
resetPartsState(state) {
|
||||||
state.glassParts = null;
|
state.glassParts = null;
|
||||||
state.childParts = null;
|
state.childParts = null;
|
||||||
state.otherParts = null;
|
state.otherParts = null;
|
||||||
|
|
@ -202,20 +202,20 @@ export const actions = {
|
||||||
|
|
||||||
// DEPENDENCY ACTIONS
|
// DEPENDENCY ACTIONS
|
||||||
resetVehicleAndDependencies(context) {
|
resetVehicleAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_VEHICLE_AND_DEPS);
|
context.commit(storeMutations.RESET_VEHICLE_STATE);
|
||||||
context.commit(storeMutations.RESET_DAMAGE_AND_DEPS);
|
context.commit(storeMutations.RESET_DAMAGE_STATE);
|
||||||
context.commit(storeMutations.RESET_REGISTRATION_AND_DEPS);
|
context.commit(storeMutations.RESET_REGISTRATION_STATE);
|
||||||
},
|
},
|
||||||
resetDamageAndDependencies(context) {
|
resetDamageAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_DAMAGE_AND_DEPS);
|
context.commit(storeMutations.RESET_DAMAGE_STATE);
|
||||||
context.commit(storeMutations.RESET_PARTS_AND_DEPS);
|
context.commit(storeMutations.RESET_PARTS_STATE);
|
||||||
},
|
},
|
||||||
resetRegistrationAndDependencies(context) {
|
resetRegistrationAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_REGISTRATION_AND_DEPS);
|
context.commit(storeMutations.RESET_REGISTRATION_STATE);
|
||||||
context.commit(storeMutations.RESET_PARTS_AND_DEPS)
|
context.commit(storeMutations.RESET_PARTS_STATE)
|
||||||
},
|
},
|
||||||
resetPartsAndDependencies(context) {
|
resetPartsAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_PARTS_AND_DEPS);
|
context.commit(storeMutations.RESET_PARTS_STATE);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Content API Actions
|
// Content API Actions
|
||||||
|
|
|
||||||
|
|
@ -313,9 +313,9 @@ describe("Actions", () => {
|
||||||
// Act
|
// Act
|
||||||
await actions.resetVehicleAndDependencies(context)
|
await actions.resetVehicleAndDependencies(context)
|
||||||
|
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_VEHICLE_AND_DEPS);
|
expect(commit).toBeCalledWith(storeMutations.RESET_VEHICLE_STATE);
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_DAMAGE_AND_DEPS);
|
expect(commit).toBeCalledWith(storeMutations.RESET_DAMAGE_STATE);
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_REGISTRATION_AND_DEPS);
|
expect(commit).toBeCalledWith(storeMutations.RESET_REGISTRATION_STATE);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -330,8 +330,8 @@ describe("Actions", () => {
|
||||||
// Act
|
// Act
|
||||||
await actions.resetDamageAndDependencies(context)
|
await actions.resetDamageAndDependencies(context)
|
||||||
|
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_DAMAGE_AND_DEPS);
|
expect(commit).toBeCalledWith(storeMutations.RESET_DAMAGE_STATE);
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_PARTS_AND_DEPS);
|
expect(commit).toBeCalledWith(storeMutations.RESET_PARTS_STATE);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -346,8 +346,8 @@ describe("Actions", () => {
|
||||||
// Act
|
// Act
|
||||||
await actions.resetRegistrationAndDependencies(context)
|
await actions.resetRegistrationAndDependencies(context)
|
||||||
|
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_REGISTRATION_AND_DEPS);
|
expect(commit).toBeCalledWith(storeMutations.RESET_REGISTRATION_STATE);
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_PARTS_AND_DEPS);
|
expect(commit).toBeCalledWith(storeMutations.RESET_PARTS_STATE);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -362,7 +362,7 @@ describe("Actions", () => {
|
||||||
// Act
|
// Act
|
||||||
await actions.resetPartsAndDependencies(context)
|
await actions.resetPartsAndDependencies(context)
|
||||||
|
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_PARTS_AND_DEPS);
|
expect(commit).toBeCalledWith(storeMutations.RESET_PARTS_STATE);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
:aria-required="isRequired"
|
:aria-required="isRequired"
|
||||||
:value="value"
|
:value="value"
|
||||||
:v-model="checkValue"
|
:v-model="checkValue"
|
||||||
@change="handleCheckChange()"
|
@change="handleCheckChanged()"
|
||||||
/>
|
/>
|
||||||
<label class="d-flex align-items-start form-check-label" :for="buttonID">
|
<label class="d-flex align-items-start form-check-label" :for="buttonID">
|
||||||
<p v-if="buttonLabel" class="m-0">{{ buttonLabel }}</p>
|
<p v-if="buttonLabel" class="m-0">{{ buttonLabel }}</p>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue