Merge pull request #292 from Safelite/feature/Digital/SSR-442

Changes for SSR-442, Defect SSR-463 and a little bit of cleanup for SSR-290
This commit is contained in:
DavidAtSafelite 2023-05-10 11:32:38 -04:00 committed by GitHub
commit 8f27feb9f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 94 additions and 76 deletions

View file

@ -147,6 +147,11 @@
this.mainStore.issConfig.disabledFields.policyNumber = true; this.mainStore.issConfig.disabledFields.policyNumber = true;
break; break;
case "policyzipcode":
this.mainStore.order.policy.policyZipCode = value;
this.mainStore.issConfig.disabledFields.policyZipCode = true;
break;
case "lossdate": case "lossdate":
// NOTE: May need some date parsing logic in here depending on client. // NOTE: May need some date parsing logic in here depending on client.
this.mainStore.order.policy.dateOfLoss = value; this.mainStore.order.policy.dateOfLoss = value;
@ -167,7 +172,7 @@
break; break;
} }
} }
}, }
}, },
computed:{ computed:{
}, },

View file

@ -95,9 +95,12 @@ export default {
name: "vehicle-damage", name: "vehicle-damage",
mixins: [BaseFormMixin], mixins: [BaseFormMixin],
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
const store = useMainStore();
// Call APIs // Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage); const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
const damageOptionsPromise = useMainStore().getDamageOptions(useMainStore().order.vehicle.carId); const damageOptionsPromise = store.getDamageOptions(store.order.vehicle.carId);
// Settle promises and get results // Settle promises and get results
const promiseResultMap = [ const promiseResultMap = [

View file

@ -108,7 +108,7 @@ data() {
}, },
computed: { computed: {
isForwardActionDisabled() { isForwardActionDisabled() {
return this.selectedGlassPartNumbers.length !== this.PartsFromApi.partsOrQuestions.length return this.selectedGlassPartNumbers?.length !== this.PartsFromApi.partsOrQuestions?.length
}, },
selectedGlassPartNumbers() { selectedGlassPartNumbers() {
// Compile all selected parts from the page. // Compile all selected parts from the page.
@ -124,7 +124,7 @@ computed: {
const partsData = this.PartsFromApi; const partsData = this.PartsFromApi;
// Map API result data, to vehicle-parts data structure // Map API result data, to vehicle-parts data structure
const mappedData = partsData.partsOrQuestions.map((g) => { const mappedData = partsData.partsOrQuestions?.map((g) => {
return { return {
glassName: g.glassName, glassName: g.glassName,
glassLocation: g.glassLocation, glassLocation: g.glassLocation,

View file

@ -23,8 +23,10 @@
<textboxQuestion <textboxQuestion
inputId="policyZipCode" inputId="policyZipCode"
cmsWidgetName="PolicyZipQuestion" cmsWidgetName="PolicyZipQuestion"
v-model="welcomePageModel.policyZipCode"
isRequired isRequired
ref="policyZip" /> ref="policyZip"
validationRules="policy-zip-required|policy-zip-format" />
</div> </div>
</div> </div>
<div class="row mt-4"> <div class="row mt-4">
@ -188,15 +190,13 @@ defineRule("email-address-format",
regex( regex(
/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,})$/, /^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,})$/,
errorMessages.EMAIL_ADDRESS_FORMAT errorMessages.EMAIL_ADDRESS_FORMAT
) ));
);
defineRule("phone-number-format", defineRule("phone-number-format",
regex( regex(
/^(\([0-9]{3}\)|[0-9]{3}) *[-.]? *[0-9]{3} *[-.]? *[0-9]{4}$/, /^(\([0-9]{3}\)|[0-9]{3}) *[-.]? *[0-9]{3} *[-.]? *[0-9]{4}$/,
errorMessages.PHONE_NUMBER_FORMAT errorMessages.PHONE_NUMBER_FORMAT
) ));
);
export default { export default {
name: "welcome-page", name: "welcome-page",
@ -250,6 +250,7 @@ export default {
getWelcomePageModelFromStore() { getWelcomePageModelFromStore() {
return { return {
policyNumber: this.mainStore.order.policy.policyNumber, policyNumber: this.mainStore.order.policy.policyNumber,
policyZipCode: this.mainStore.order.policy.policyZipCode,
dateOfLoss : this.mainStore.order.policy.dateOfLoss, dateOfLoss : this.mainStore.order.policy.dateOfLoss,
damageCause : this.mainStore.order.policy.damageCause, damageCause : this.mainStore.order.policy.damageCause,
damageState : this.mainStore.order.policy.damageState, damageState : this.mainStore.order.policy.damageState,
@ -257,7 +258,7 @@ export default {
isDamageGlassOnly : this.mainStore.order.policy.isDamageGlassOnly, isDamageGlassOnly : this.mainStore.order.policy.isDamageGlassOnly,
phoneNumber : this.mainStore.order.customer.phoneNumber, phoneNumber : this.mainStore.order.customer.phoneNumber,
email : this.mainStore.order.customer.emailAddress, email : this.mainStore.order.customer.emailAddress,
isPolicyNumberDisabled: this.mainStore.order.policy.isPolicyNumberDisabled, isPolicyNumberDisabled: this.mainStore.order.policy.isPolicyNumberDisabled
} }
}, },
}, },
@ -293,7 +294,8 @@ export default {
return !!this.getCmsContent("GlassOnlyQuestion","QuestionText"); return !!this.getCmsContent("GlassOnlyQuestion","QuestionText");
}, },
displayPolicyZip(){ displayPolicyZip(){
if(this.mainStore.issConfig.isAuthenticated){ if (this.mainStore.issConfig.isAuthenticated &&
!!this.mainStore.issConfig.disabledFields.policyZipCode) {
return false; return false;
} }
else{ else{

View file

@ -43,6 +43,7 @@ const getDefaultState = () => {
}, },
policy: { policy: {
policyNumber: null, policyNumber: null,
policyZipCode: null,
dateOfLoss: null, dateOfLoss: null,
damageCause: null, damageCause: null,
damageState: null, damageState: null,
@ -106,7 +107,8 @@ const getDefaultState = () => {
returnURL: null, returnURL: null,
returnURL2: null, returnURL2: null,
disabledFields: { disabledFields: {
policyNumber: null policyNumber: null,
policyZipCode: null
} }
} }
}; };
@ -608,6 +610,7 @@ export const useMainStore = defineStore({
if (isDamageChanging) { if (isDamageChanging) {
//Reset dependent state when changing //Reset dependent state when changing
//Was resetGlassPartsState, added dependencies for SSR-290
this.resetPartsAndDependencies(); this.resetPartsAndDependencies();
// Save new values // Save new values
@ -668,7 +671,8 @@ export const useMainStore = defineStore({
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(); this.resetSupportingItemsState();
this.resetVapsState();
}, },
updateVehicleVin(vin) { updateVehicleVin(vin) {
@ -725,6 +729,7 @@ export const useMainStore = defineStore({
previouslySelectedPartNumbers !== currentlySelectedPartNumbers; previouslySelectedPartNumbers !== currentlySelectedPartNumbers;
if (haveSelectedVehiclePartsChanged) { if (haveSelectedVehiclePartsChanged) {
//was updateGlassParts, added dependencies for SSR-290
this.resetPartsAndDependencies(); this.resetPartsAndDependencies();
this.updateMoldingQuestionAnswers(null); this.updateMoldingQuestionAnswers(null);
this.updateCapabilityQuestionAnswers(null); this.updateCapabilityQuestionAnswers(null);
@ -743,14 +748,15 @@ export const useMainStore = defineStore({
this.issConfig.enableTPAFlow = false; this.issConfig.enableTPAFlow = false;
this.issConfig.returnURL = null; this.issConfig.returnURL = null;
this.issConfig.returnURL2 = null; this.issConfig.returnURL2 = null;
this.issConfig.disabledFields.policyNumber = null; this.issConfig.disabledFields.policyNumber = false;
this.issConfig.disabledFields.policyZipCode = false;
}, },
updateVehicleYear(year) { updateVehicleYear(year) {
if(this.order.vehicle.year !== year) if(this.order.vehicle.year !== year)
{ {
this.resetVehicleState(); this.resetVehicleState();
this.resetDamagePartsAndDependencies(); this.resetDamageAndDependencies();
this.order.vehicle.year = year; this.order.vehicle.year = year;
} }
@ -762,7 +768,7 @@ export const useMainStore = defineStore({
const year = this.order.vehicle.year; const year = this.order.vehicle.year;
this.resetVehicleState(); this.resetVehicleState();
this.resetDamagePartsAndDependencies(); this.resetDamageAndDependencies();
this.order.vehicle.year = year; this.order.vehicle.year = year;
this.order.vehicle.make = make; this.order.vehicle.make = make;
@ -776,7 +782,7 @@ export const useMainStore = defineStore({
const make = this.order.vehicle.make; const make = this.order.vehicle.make;
this.resetVehicleState(); this.resetVehicleState();
this.resetDamagePartsAndDependencies(); this.resetDamageAndDependencies();
this.order.vehicle.year = year; this.order.vehicle.year = year;
this.order.vehicle.make = make; this.order.vehicle.make = make;
@ -793,7 +799,7 @@ export const useMainStore = defineStore({
const model = this.order.vehicle.model; const model = this.order.vehicle.model;
this.resetVehicleState(); this.resetVehicleState();
this.resetDamagePartsAndDependencies(); this.resetDamageAndDependencies();
this.order.vehicle.year = year; this.order.vehicle.year = year;
this.order.vehicle.make = make; this.order.vehicle.make = make;
@ -836,6 +842,7 @@ export const useMainStore = defineStore({
updatePolicyData(welcomePageModel) updatePolicyData(welcomePageModel)
{ {
this.order.policy.policyNumber = welcomePageModel?.policyNumber; this.order.policy.policyNumber = welcomePageModel?.policyNumber;
this.order.policy.policyZipCode = welcomePageModel?.policyZipCode;
this.order.policy.dateOfLoss = welcomePageModel?.dateOfLoss; this.order.policy.dateOfLoss = welcomePageModel?.dateOfLoss;
this.order.policy.damageCause = welcomePageModel?.damageCause; this.order.policy.damageCause = welcomePageModel?.damageCause;
this.order.policy.damageState = welcomePageModel?.damageState; this.order.policy.damageState = welcomePageModel?.damageState;
@ -874,6 +881,9 @@ export const useMainStore = defineStore({
this.updateGlassParts(null); this.updateGlassParts(null);
this.updateMoldingQuestionAnswers(null); this.updateMoldingQuestionAnswers(null);
this.updateCapabilityQuestionAnswers(null); this.updateCapabilityQuestionAnswers(null);
this.resetSupportingItemsState();
this.resetVapsState();
this.updatePageData({ page: issPageValues.VEHICLE_PARTS, data: null }); this.updatePageData({ page: issPageValues.VEHICLE_PARTS, data: null });
this.updatePageData({ page: issPageValues.MOLDING_QUESTIONS, data: null }); this.updatePageData({ page: issPageValues.MOLDING_QUESTIONS, data: null });
this.updatePageData({ page: issPageValues.CAPABILITY_QUESTIONS, data: null }); this.updatePageData({ page: issPageValues.CAPABILITY_QUESTIONS, data: null });
@ -882,8 +892,6 @@ 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(
@ -903,10 +911,7 @@ export const useMainStore = defineStore({
if (haveMoldingQuestionAnswersChanged) { if (haveMoldingQuestionAnswersChanged) {
this.resetPartsAndDependencies(); this.resetPartsAndDependencies();
this.updateCapabilityQuestionAnswers(null); this.updateCapabilityQuestionAnswers(null);
this.updatePageData({ this.updatePageData({ page: issPageValues.CAPABILITY_QUESTIONS, data: null });
page: issPageValues.CAPABILITY_QUESTIONS,
data: null
});
} }
// Save new values // Save new values
@ -929,8 +934,7 @@ export const useMainStore = defineStore({
); );
if (haveCapabilityQuestionAnswersChanged) { if (haveCapabilityQuestionAnswersChanged) {
this.updateGlassParts(null); this.resetPartsAndDependencies();
this.updateSupportingItems(null);
} }
// Save new values // Save new values
@ -1158,6 +1162,7 @@ export const useMainStore = defineStore({
if (!isSelectedGlassAvailableForVehicle) { if (!isSelectedGlassAvailableForVehicle) {
this.resetDamageState(); this.resetDamageState();
this.resetGlassPartsState();
} }
//Save new values //Save new values
@ -1173,6 +1178,7 @@ export const useMainStore = defineStore({
if (!isSelectedGlassAvailableForVehicle) { if (!isSelectedGlassAvailableForVehicle) {
this.resetDamageState(); this.resetDamageState();
this.resetGlassPartsState();
} }
//Save new values //Save new values
@ -1187,7 +1193,9 @@ export const useMainStore = defineStore({
this.resetRegistrationAndDependencies(); this.resetRegistrationAndDependencies();
if (!isSelectedGlassAvailableForVehicle) { if (!isSelectedGlassAvailableForVehicle) {
// Dependencies already cleared in above statement
this.resetDamageState(); this.resetDamageState();
this.resetGlassPartsState();
} }
//Save new values //Save new values
@ -1204,9 +1212,9 @@ export const useMainStore = defineStore({
this.resetVapsState(); this.resetVapsState();
}, },
resetDamagePartsAndDependencies() { resetDamageAndDependencies() {
//this.resetDamageState(); this.resetDamageState();
//this.resetGlassPartsState(); this.resetGlassPartsState();
this.resetSupportingItemsState(); this.resetSupportingItemsState();
this.resetVapsState(); this.resetVapsState();
}, },