Merge pull request #1230 from Safelite/feature/richardson/INSR-9659
Manual form validation on service packages
This commit is contained in:
commit
76ebbf335a
3 changed files with 57 additions and 13 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
ref="buttonQuestion"
|
ref="buttonQuestion"
|
||||||
v-model="selectedPackageName"
|
v-model="selectedPackageName"
|
||||||
class="service-package-question"
|
:class="['service-package-question', additionalClass]"
|
||||||
:answers="servicePackageAnswers"
|
:answers="servicePackageAnswers"
|
||||||
:groupName="groupName"
|
:groupName="groupName"
|
||||||
:questionText="questionText"
|
:questionText="questionText"
|
||||||
|
|
@ -39,6 +39,7 @@ export default {
|
||||||
buttonQuestion
|
buttonQuestion
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
additionalClass: String,
|
||||||
cmsWidgetName: String,
|
cmsWidgetName: String,
|
||||||
groupName: String,
|
groupName: String,
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,16 @@
|
||||||
ref="servicePackage"
|
ref="servicePackage"
|
||||||
cmsWidgetName="ServicePackage"
|
cmsWidgetName="ServicePackage"
|
||||||
groupName="ServicePackageQuestion"
|
groupName="ServicePackageQuestion"
|
||||||
|
:additionalClass="showFormErrorState ? 'parent-error' : ''"
|
||||||
:availableLineItems="availableLineItems"
|
:availableLineItems="availableLineItems"
|
||||||
:validationRules="rules.optionRequired"
|
:validationRules="rules.optionRequired"
|
||||||
isRequired
|
isRequired
|
||||||
@vapsItemsSelected="vapsItemsSelectedAction"
|
@vapsItemsSelected="vapsItemsSelectedAction"
|
||||||
@packageSelected="packageSelectedAction"
|
@packageSelected="packageSelectedAction"
|
||||||
@link-event="openModalAction" />
|
@link-event="openModalAction" />
|
||||||
|
<div v-if="showFormErrorState" class="form-test-error">
|
||||||
|
{{ errorMessageText }}
|
||||||
|
</div>
|
||||||
<div class="d-flex justify-content-center mt-8 mb-4">
|
<div class="d-flex justify-content-center mt-8 mb-4">
|
||||||
<buttonMain
|
<buttonMain
|
||||||
ref="buttonMain"
|
ref="buttonMain"
|
||||||
|
|
@ -44,7 +48,7 @@
|
||||||
</div>
|
</div>
|
||||||
<p
|
<p
|
||||||
class="caption disclaimer"
|
class="caption disclaimer"
|
||||||
v-html="PriceDisclaimerText"></p>
|
v-html="priceDisclaimerText"></p>
|
||||||
</div>
|
</div>
|
||||||
<loadingModal
|
<loadingModal
|
||||||
ref="loadingModal"
|
ref="loadingModal"
|
||||||
|
|
@ -67,7 +71,6 @@
|
||||||
import baseFormMixin from '@/mixins/base-form-mixin';
|
import baseFormMixin from '@/mixins/base-form-mixin';
|
||||||
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
import siteHeader from '@/iss-components/site-header/site-header.vue';
|
||||||
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue';
|
|
||||||
import contentGroupModal from '@/iss-components/content-group-modal/content-group-modal.vue';
|
import contentGroupModal from '@/iss-components/content-group-modal/content-group-modal.vue';
|
||||||
import loadingModal from '@/iss-components/loading-modal/loading-modal.vue';
|
import loadingModal from '@/iss-components/loading-modal/loading-modal.vue';
|
||||||
import settleAllPromises from '@/helpers/layout-helper';
|
import settleAllPromises from '@/helpers/layout-helper';
|
||||||
|
|
@ -80,6 +83,7 @@ import globalRules from '@/constants/global-rules';
|
||||||
import servicePackageQuestion from '@/layouts/service-packages/service-package-question/service-package-question.vue';
|
import servicePackageQuestion from '@/layouts/service-packages/service-package-question/service-package-question.vue';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import bailoutMessage from '@/constants/bailoutMessage';
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
|
import errorMessages from '@/constants/error-messages.js';
|
||||||
import buttonMain from '@/ux-components/button-main/button-main.vue';
|
import buttonMain from '@/ux-components/button-main/button-main.vue';
|
||||||
import { analyticsServicePackageMap, analyticsVapsModalMap } from '@/constants/analytics';
|
import { analyticsServicePackageMap, analyticsVapsModalMap } from '@/constants/analytics';
|
||||||
|
|
||||||
|
|
@ -174,6 +178,7 @@ export default {
|
||||||
selectedVaps: [],
|
selectedVaps: [],
|
||||||
selectedPackageTier: '',
|
selectedPackageTier: '',
|
||||||
availableLineItems: [],
|
availableLineItems: [],
|
||||||
|
formSubmitAttempted: false,
|
||||||
loadingText: [
|
loadingText: [
|
||||||
'Finding shops near you',
|
'Finding shops near you',
|
||||||
'Looking for dates',
|
'Looking for dates',
|
||||||
|
|
@ -187,22 +192,31 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
PriceDisclaimerText() {
|
errorMessageText() {
|
||||||
|
return errorMessages.OPTION_REQUIRED;
|
||||||
|
},
|
||||||
|
hasSelectedServicePackage() {
|
||||||
|
return !!this.selectedPackageTier;
|
||||||
|
},
|
||||||
|
priceDisclaimerText() {
|
||||||
return this.getCmsContent('PriceDisclaimerWidget', 'Text');
|
return this.getCmsContent('PriceDisclaimerWidget', 'Text');
|
||||||
},
|
},
|
||||||
vehicleMake() {
|
secondaryText() {
|
||||||
return (store.order.vehicle.make ?? '').toUpperCase();
|
return this.getCmsContent('SiteSubHeaderWidget', 'SecondaryText');
|
||||||
},
|
|
||||||
vehicleModel() {
|
|
||||||
return (store.order.vehicle.model ?? '').toUpperCase();
|
|
||||||
},
|
},
|
||||||
servicePackagesSubHeader() {
|
servicePackagesSubHeader() {
|
||||||
return this.getCmsContent('SiteSubHeaderWidget', 'SubHeaderText')
|
return this.getCmsContent('SiteSubHeaderWidget', 'SubHeaderText')
|
||||||
.replace('{custom:vehicleMake}', this.vehicleMake)
|
.replace('{custom:vehicleMake}', this.vehicleMake)
|
||||||
.replace('{custom:vehicleModel}', this.vehicleModel);
|
.replace('{custom:vehicleModel}', this.vehicleModel);
|
||||||
},
|
},
|
||||||
secondaryText() {
|
showFormErrorState() {
|
||||||
return this.getCmsContent('SiteSubHeaderWidget', 'SecondaryText');
|
return this.formSubmitAttempted && !this.hasSelectedServicePackage;
|
||||||
|
},
|
||||||
|
vehicleMake() {
|
||||||
|
return (store.order.vehicle.make ?? '').toUpperCase();
|
||||||
|
},
|
||||||
|
vehicleModel() {
|
||||||
|
return (store.order.vehicle.model ?? '').toUpperCase();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -232,6 +246,11 @@ export default {
|
||||||
this.selectedPackageTier = packageTier;
|
this.selectedPackageTier = packageTier;
|
||||||
},
|
},
|
||||||
forwardButtonAction() {
|
forwardButtonAction() {
|
||||||
|
if (!this.hasSelectedServicePackage) {
|
||||||
|
this.formSubmitAttempted = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
showIssLoadingModal(true);
|
showIssLoadingModal(true);
|
||||||
const parts = {
|
const parts = {
|
||||||
vaps: this.selectedVaps
|
vaps: this.selectedVaps
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ html {
|
||||||
input[type="radio"]:focus+.list-button-content {
|
input[type="radio"]:focus+.list-button-content {
|
||||||
box-shadow: 0 0 0 2.5px $red;
|
box-shadow: 0 0 0 2.5px $red;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(.selected):not(.no-hover):hover {
|
&:not(.selected):not(.no-hover):hover {
|
||||||
position: relative;
|
position: relative;
|
||||||
@include box-shadow-hover($red-200);
|
@include box-shadow-hover($red-200);
|
||||||
|
|
@ -135,6 +136,7 @@ html {
|
||||||
}
|
}
|
||||||
|
|
||||||
.has-success {
|
.has-success {
|
||||||
|
|
||||||
// START HOVER
|
// START HOVER
|
||||||
&.list-button,
|
&.list-button,
|
||||||
&.list-button.list-group,
|
&.list-button.list-group,
|
||||||
|
|
@ -271,7 +273,8 @@ html {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Quote page radio button group
|
// Service Packages page radio button group
|
||||||
|
// With form validation error state
|
||||||
.package-main {
|
.package-main {
|
||||||
.package-wrapper {
|
.package-wrapper {
|
||||||
.has-error {
|
.has-error {
|
||||||
|
|
@ -284,7 +287,28 @@ html {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restore to default style if alert box is present
|
// With parent form validation error state
|
||||||
|
div.service-package-question.parent-error {
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
+.form-test-error {
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
padding: 0 1.5rem 0 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.package-main {
|
||||||
|
.package-wrapper {
|
||||||
|
input[type="radio"] {
|
||||||
|
+.package-label {
|
||||||
|
border: 1px solid $red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Restore to default style if alert box is present
|
||||||
.alertError {
|
.alertError {
|
||||||
.has-error {
|
.has-error {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue