From a8be61b4e46f6920f9aeb2249d48fc757bf59282 Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Wed, 7 Dec 2022 17:28:21 +0300 Subject: [PATCH] =?UTF-8?q?[WIP]=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=B0=D0=BF?= =?UTF-8?q?=D0=B4=D0=B5=D0=B9=D1=82=D0=B0=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D1=85=20=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clients/components/ClientsTableRow.vue | 50 +++++++++++-------- .../FormCreateIdentityDocuments.vue | 8 ++- .../components/cells/TableCellBodyName.vue | 3 +- .../cells/TableCellBodyNetworks.vue | 2 +- 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index 3069491..c24ca9d 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -212,29 +212,31 @@ export default { (el) => el.text === this.dataClient.priority ); let data = {}; - if ( - this.dataClient.age !== this.client.birth_date && - this.dataClient.age - ) { + let clientName = `${this.client.last_name || ""} ${ + this.client.first_name || "" + } ${this.client.patronymic || ""}`; + + if (!this.dataClient.fullName) this.dataClient.fullName = clientName; + else if (this.dataClient.fullName !== clientName) + data.full_name = this.dataClient.fullName; + if (this.dataClient.age !== this.client.birth_date && this.dataClient.age) data.birth_date = this.dataClient.age; + else if (!this.dataClient.age) { + this.addErrorNotification( + "Пожалуйста, введите дату рождения корректно" + ); + this.dataClient.age = this.client.birth_date || ""; } - if ( - foundElement.id !== this.client.priority && - foundElement.text !== "-" - ) { - data.priority = foundElement.priority; - } else if (foundElement.text === "-") { - data.priority = 4; - } + if (foundElement.id !== this.client.priority) + data.priority = foundElement.id; if ( data.birth_date && moment(data.birth_date).isAfter(moment().format("YYYY-MM-DD")) ) { - this.addErrorNotification(); - this.dataClient.age = this.client.birth_date; - } else + this.addErrorNotification("Дата рождения позже текущего дня"); + this.dataClient.age = this.client.birth_date || ""; + } else if (!Object.keys(data).length == 0) fetchWrapper.post(`general/person/${this.client.id}/update/`, { - full_name: this.dataClient.fullName, ...data, }); }, @@ -264,16 +266,24 @@ export default { this.client.contacts.forEach((el) => { if ( el.kind === "PHONE" && + this.dataClient.phone.username.length === 18 && el.username !== this.dataClient.phone.username ) { updateContacts.push(this.dataClient.phone); - } + } else + this.dataClient.phone.username = + this.client.contacts.find((el) => el.kind === "PHONE")?.username || + ""; if ( el.kind === "EMAIL" && + this.dataClient.email.username && el.username !== this.dataClient.email.username ) { updateContacts.push(this.dataClient.email); - } + } else + this.dataClient.email.username = + this.client.contacts.find((el) => el.kind === "EMAIL")?.username || + ""; }); createContacts.forEach((el) => this.postCreateContact(el)); // deleteContacts.forEach((el) => this.postDeleteContact(el)); @@ -336,11 +346,11 @@ export default { 5000 ); }, - addErrorNotification() { + addErrorNotification(message) { addNotification( "Некорректная дата рождения", "Некорректная дата рождения", - "Дата рождения позже текущего дня", + message, "error", 5000 ); diff --git a/src/pages/clients/components/FormCreateIdentityDocuments.vue b/src/pages/clients/components/FormCreateIdentityDocuments.vue index 82b02f4..459f7ee 100644 --- a/src/pages/clients/components/FormCreateIdentityDocuments.vue +++ b/src/pages/clients/components/FormCreateIdentityDocuments.vue @@ -39,18 +39,22 @@ .flex.flex-col(class="gap-y-1.5") span.text-sm Номер СНИЛС base-input.input-info( + disabled, v-mask="'###-###-### ##'", v-model:value="identityDocument.snils.numba", placeholder="000–000–000 00", - :width-input="277" + :width-input="277", + :style="{backgroundColor: 'var(--bg-disable-grey-color)'}" ) .flex.flex-col(class="gap-y-1.5") span.text-sm Номер ИНН base-input.input-info( + disabled, v-mask="'############'", v-model:value="identityDocument.inn.numba", placeholder="000000000000", - :width-input="277" + :width-input="277", + :style="{backgroundColor: 'var(--bg-disable-grey-color)'}" ) .px-4 base-button(@click="saveClient" :size="40") diff --git a/src/pages/clients/components/cells/TableCellBodyName.vue b/src/pages/clients/components/cells/TableCellBodyName.vue index b7ee33c..ee405f9 100644 --- a/src/pages/clients/components/cells/TableCellBodyName.vue +++ b/src/pages/clients/components/cells/TableCellBodyName.vue @@ -9,7 +9,8 @@ @click.stop, type="text", v-model:value="value.fullName", - :width-input="300" + :width-input="300", + placeholder="Фамилия Имя Отчество" ) diff --git a/src/pages/clients/components/cells/TableCellBodyNetworks.vue b/src/pages/clients/components/cells/TableCellBodyNetworks.vue index 128300b..caf6151 100644 --- a/src/pages/clients/components/cells/TableCellBodyNetworks.vue +++ b/src/pages/clients/components/cells/TableCellBodyNetworks.vue @@ -8,7 +8,7 @@ .absolute.icon-cancel-mini.delete.flex.w-4.h-4.justify-center.items-center.bottom-4.left-2( v-if="isOpenChange", :id="network.kind", - @click="(e) => deleteNetwork(e)" + @click.stop="(e) => deleteNetwork(e)" ) .flex.relative.pb-2(class="pl-[46px]") base-button(