CSR-1088- Got Mobile location modal working and validating correctly
This commit is contained in:
parent
2be72ac348
commit
140d54e3b8
2 changed files with 47 additions and 6 deletions
|
|
@ -27,7 +27,6 @@
|
||||||
cornerStyle === 'rounded' ? 'rounded-pill' : '',
|
cornerStyle === 'rounded' ? 'rounded-pill' : '',
|
||||||
]"
|
]"
|
||||||
:validationRules="validationRules"
|
:validationRules="validationRules"
|
||||||
@input="handleOnInput === true ? 'handleChange' : ''"
|
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
@blur="handleChange"
|
@blur="handleChange"
|
||||||
:maxlength="maxLength ? maxLength : '999'"
|
:maxlength="maxLength ? maxLength : '999'"
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,11 @@
|
||||||
@footer-button-event="setMobileLocation">
|
@footer-button-event="setMobileLocation">
|
||||||
<addressQuestions
|
<addressQuestions
|
||||||
ref="addressQuestions"
|
ref="addressQuestions"
|
||||||
v-model="mobileLocationQuestionModel.addressQuestions"
|
v-model="mobileLocationQuestionsInput.addressQuestions"
|
||||||
captureApartmentNumberOrBusinessName="true" />
|
captureApartmentNumberOrBusinessName="true" />
|
||||||
<vehicleProtectedQuestion
|
<vehicleProtectedQuestion
|
||||||
ref="vehicleProtectedQuestion"
|
ref="vehicleProtectedQuestion"
|
||||||
v-model="mobileLocationQuestionModel.isVehicleProtected"
|
v-model="mobileLocationQuestionsInput.isVehicleProtected"
|
||||||
cmsWidgetName="VehicleProtectedQuestionWidget" />
|
cmsWidgetName="VehicleProtectedQuestionWidget" />
|
||||||
<textBlock cmsWidgetName="WorkspaceRequirementsWidget" typeStyle="caption" />
|
<textBlock cmsWidgetName="WorkspaceRequirementsWidget" typeStyle="caption" />
|
||||||
</modal>
|
</modal>
|
||||||
|
|
@ -45,12 +45,36 @@ import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location
|
||||||
import textBlock from "@/digital-components/text-block/text-block";
|
import textBlock from "@/digital-components/text-block/text-block";
|
||||||
|
|
||||||
// Supporting Files
|
// Supporting Files
|
||||||
|
import { useForm } from "vee-validate";
|
||||||
|
|
||||||
// Define Validation Rules
|
// Define Validation Rules
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "mobile-location-modal-questions",
|
name: "mobile-location-modal-questions",
|
||||||
emits: ["update:modelValue"], // The component emits an event
|
emits: ["update:modelValue"], // The component emits an event
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
mobileLocationQuestionsInput: {
|
||||||
|
addressQuestions: {
|
||||||
|
streetAddress: "",
|
||||||
|
apartmentNumberOrBusinessName: "",
|
||||||
|
city: "",
|
||||||
|
state: "",
|
||||||
|
zipCode: "",
|
||||||
|
},
|
||||||
|
isVehicleProtected: null,
|
||||||
|
isZipServiceableMobile: null,
|
||||||
|
isZipServiceableInShop: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
const modalForm = useForm();
|
||||||
|
|
||||||
|
return {
|
||||||
|
modalForm,
|
||||||
|
};
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -102,7 +126,7 @@ export default {
|
||||||
modalName() {
|
modalName() {
|
||||||
return this.modalWidgetName;
|
return this.modalWidgetName;
|
||||||
},
|
},
|
||||||
mobileLocationQuestionModel: {
|
mobileLocationQuestionsModel: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
},
|
},
|
||||||
|
|
@ -112,7 +136,7 @@ export default {
|
||||||
},
|
},
|
||||||
addressModel: {
|
addressModel: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.mobileLocationQuestionModel.addressQuestions;
|
return this.mobileLocationQuestionsModel.addressQuestions;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
_isVehicleProtected: {
|
_isVehicleProtected: {
|
||||||
|
|
@ -128,6 +152,9 @@ export default {
|
||||||
openModal() {
|
openModal() {
|
||||||
this.$refs[this.modalName].openModal();
|
this.$refs[this.modalName].openModal();
|
||||||
},
|
},
|
||||||
|
onModalClosed() {
|
||||||
|
this.mobileLocationQuestionsInput = this.mobileLocationQuestionsModel;
|
||||||
|
},
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.$refs[this.modalName].closeModal();
|
this.$refs[this.modalName].closeModal();
|
||||||
},
|
},
|
||||||
|
|
@ -140,9 +167,24 @@ export default {
|
||||||
this.addressModel.zipCode = "";
|
this.addressModel.zipCode = "";
|
||||||
|
|
||||||
// Is Vehicle Protected
|
// Is Vehicle Protected
|
||||||
this._isVehicleProtected = null;
|
this.mobileLocationQuestionsModel.isVehicleProtected = null;
|
||||||
},
|
},
|
||||||
async setMobileLocation() {
|
async setMobileLocation() {
|
||||||
|
|
||||||
|
this.mobileLocationQuestionsModel = {
|
||||||
|
addressQuestions: {
|
||||||
|
streetAddress: this.addressModel.streetAddress,
|
||||||
|
apartmentNumberOrBusinessName: this.addressModel.apartmentNumberOrBusinessName,
|
||||||
|
city: this.addressModel.city,
|
||||||
|
state: this.addressModel.state,
|
||||||
|
zipCode: this.addressModel.zipCode,
|
||||||
|
},
|
||||||
|
isVehicleProtected: this.mobileLocationQuestionsModel.isVehicleProtected,
|
||||||
|
isZipServiceableMobile: this.mobileLocationQuestionsModel.isZipServiceableMobile,
|
||||||
|
isZipServiceableInShop: this.mobileLocationQuestionsModel.isZipServiceableInShop,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue