From 838b971dad548083141827a9bbc9c6a8a9962772 Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Fri, 16 Dec 2022 18:53:41 +0300 Subject: [PATCH] =?UTF-8?q?[WIP]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BE=D0=B1=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ClientDetailInfoSection.vue | 11 +++-- .../clients/components/ClientsTableRow.vue | 41 +++++++++++++------ 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/pages/clients/components/ClientDetailInfoSection.vue b/src/pages/clients/components/ClientDetailInfoSection.vue index 34cafa9..fffc868 100644 --- a/src/pages/clients/components/ClientDetailInfoSection.vue +++ b/src/pages/clients/components/ClientDetailInfoSection.vue @@ -59,7 +59,7 @@ v-click-outside="closePopup", :width="485" ) - table-create-note(create-note="createNote", :close-popup="closePopup") + table-create-note(:create-note="createNote", :close-popup="closePopup") transition(name="section", mode="out-in") .flex.justify-center.items-center( v-if="sectionDataPresence", @@ -126,7 +126,12 @@ .flex.flex-col.gap-y-4(v-if="section === 'addresses' && isChange") client-detail-section-address(:dope-address="dopeAddress") .flex.flex-col.gap-y-2(v-if="section === 'additional' && isChange") - .title-section.text-xxs.font-semibold {{item.title}} + //- .title-section.text-xxs.font-semibold {{item.title}} + client-detail-input.text-sm.w-max-fit( + :style="{fontWeight:key === 'numba'&&600}", + v-model:value="sectionInfo[key].title", + placeholder="Заголовок" + ) client-detail-input.text-sm.w-max-fit( :style="{fontWeight:key === 'numba'&&600}", v-model:value="sectionInfo[key].description", @@ -261,6 +266,7 @@ export default { this.isOpenAddDoc = true; } else if (this.section === "additional") { this.isNotes = true; + this.isOpenAddingWrap = true; } }, changeOpenAddDoc() { @@ -324,7 +330,6 @@ export default { if (this.section === "additional") { if (!this.sectionInfo[0]?.id) { this.isNotes = false; - this.createNote(); } else { this.updateNotes(); } diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index b16bf7e..e4f58f7 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -628,21 +628,36 @@ export default { }); }, postCreateNote(title, description) { - fetchWrapper - .post("general/note/create/", { - person_id: this.id, - title: title, - description: description, - }) - .then(() => this.fetchClientDetail(this.id)); + if (!title || !description) { + this.addErrorNotification( + "Ошибка создания дополнительных данных", + "Все поля должны быть заполнены" + ); + } else + fetchWrapper + .post("general/note/create/", { + person_id: this.id, + title: title, + description: description, + }) + .then(() => this.fetchClientDetail(this.id)); }, postUpdateNotes() { - fetchWrapper - .post(`general/note/${this.dataNotes[0].id}/update/`, { - title: this.dataNotes[0].title, - description: this.dataNotes[0].description, - }) - .then(() => this.fetchClientDetail(this.id)); + this.dataNotes.forEach((e) => { + if (!e.title || !e.description) { + this.addErrorNotification( + "Ошибка изменения дополнительных данных", + "Поля не могут быть пустыми" + ); + this.fetchClientDetail(this.id); + } else + fetchWrapper + .post(`general/note/${e.id}/update/`, { + title: e.title, + description: e.description, + }) + .then(() => this.fetchClientDetail(this.id)); + }); }, },