diff --git a/src/components/base/BaseButton.vue b/src/components/base/BaseButton.vue index 25105e6..26b6062 100644 --- a/src/components/base/BaseButton.vue +++ b/src/components/base/BaseButton.vue @@ -1,5 +1,6 @@ @@ -181,18 +181,20 @@ export default { chooseNetwork(e, index) { this.contacts.networks[index].kind = e.currentTarget.id; }, - addNewContact(key) { - if (key === "networks") { - this.contacts[key].push({ - filled: false, - kind: this.configData[key]?.kind, - username: null, - }); - } else { - this.contacts[key].push({ - kind: this.configData[key]?.kind, - username: null, - }); + addNewContact(e, key) { + if (e.pointerType) { + if (key === "networks") { + this.contacts[key].push({ + filled: false, + kind: this.configData[key]?.kind, + username: null, + }); + } else { + this.contacts[key].push({ + kind: this.configData[key]?.kind, + username: null, + }); + } } this.checkChangeInput(); }, diff --git a/src/shared/utils/rulesInputs.js b/src/shared/utils/rulesInputs.js index 3e61452..ffd4dfd 100644 --- a/src/shared/utils/rulesInputs.js +++ b/src/shared/utils/rulesInputs.js @@ -12,15 +12,8 @@ export function ruleOptionalFields(val, minLength, text) { } export function ruleEmailValue(val, text) { - return ( - (val && - val.length < 100 && - val.includes("@") && - val.match(/@(?=\S+)/) && - val.match(/(?<=\S+)@/)) || - text || - false - ); + const regExp = new RegExp(/^[^\s()<>@,;:/]+@\w[\w.-]+\.[a-z]{2,}$/i); + return (val && val.length < 100 && regExp.test(val)) || text || false; } export function ruleMaxLength(val, maxLength, text) { diff --git a/src/store/modules/medicalCard.js b/src/store/modules/medicalCard.js index ff8ab84..a342588 100644 --- a/src/store/modules/medicalCard.js +++ b/src/store/modules/medicalCard.js @@ -70,15 +70,14 @@ const getters = { let DMS = person?.insurance_policy?.find((e) => e.title === "DMS"); return { personalData: { - last_name: person?.last_name, - first_name: person?.first_name, - patronymic: person?.patronymic, + last_name: person?.last_name || "", + first_name: person?.first_name || "", + patronymic: person?.patronymic || "", gender: - person?.gender && - genderOptions.find((el) => el.id === person?.gender), - birth_date: person?.birth_date - ? new Date(person?.birth_date) - : new Date(), + (person?.gender && + genderOptions.find((el) => el.id === person?.gender)) || + "", + birth_date: person?.birth_date ? new Date(person?.birth_date) : "", photo: person?.photo ? { photo: rootState.getUrl + person.photo, @@ -88,20 +87,20 @@ const getters = { id: person?.id, }, registrationAddress: { - region: registrationAddress?.region, - city: registrationAddress?.city, - street: registrationAddress?.street, - house_number: registrationAddress?.house_number, - apartment_number: registrationAddress?.apartment_number, - id: registrationAddress?.id, + region: registrationAddress?.region || "", + city: registrationAddress?.city || "", + street: registrationAddress?.street || "", + house_number: registrationAddress?.house_number || "", + apartment_number: registrationAddress?.apartment_number || "", + id: registrationAddress?.id || "", }, residenceAddress: { - region: residenceAddress?.region, - city: residenceAddress?.city, - street: residenceAddress?.street, - house_number: residenceAddress?.house_number, - apartment_number: residenceAddress?.apartment_number, - id: residenceAddress?.id, + region: residenceAddress?.region || "", + city: residenceAddress?.city || "", + street: residenceAddress?.street || "", + house_number: residenceAddress?.house_number || "", + apartment_number: residenceAddress?.apartment_number || "", + id: residenceAddress?.id || "", }, insuranceDMS: { series: DMS?.series,