From cb1fcd9818d5e6840d19aa14794f82c571d350c8 Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Fri, 16 Dec 2022 15:54:10 +0300 Subject: [PATCH 1/2] =?UTF-8?q?[WIP]=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=B0=D0=BB=20note=20=D0=B8=20=D0=B2=D0=BE=D0=B7?= =?UTF-8?q?=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D0=B8=D1=85?= =?UTF-8?q?=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/base/BaseInput.vue | 2 +- .../components/ClientDetailInfoSection.vue | 23 +++++-- .../components/ClientDetailInfoWrapper.vue | 2 +- .../clients/components/ClientsTableRow.vue | 16 +++-- .../clients/components/TableCreateNote.vue | 65 +++++++++++++++++++ src/pages/clients/utils/tableConfig.js | 3 + tailwind.config.js | 1 + 7 files changed, 99 insertions(+), 13 deletions(-) create mode 100644 src/pages/clients/components/TableCreateNote.vue diff --git a/src/components/base/BaseInput.vue b/src/components/base/BaseInput.vue index 2e0ff6b..342e5cb 100644 --- a/src/components/base/BaseInput.vue +++ b/src/components/base/BaseInput.vue @@ -9,7 +9,7 @@ :type="type", @input="$emit('update:value', $event.target.value)", :placeholder="placeholder", - :maxlength="maxLength", + :maxLength="maxLength", :max="maxDate", :disabled="disabled" ) diff --git a/src/pages/clients/components/ClientDetailInfoSection.vue b/src/pages/clients/components/ClientDetailInfoSection.vue index 60602fc..34cafa9 100644 --- a/src/pages/clients/components/ClientDetailInfoSection.vue +++ b/src/pages/clients/components/ClientDetailInfoSection.vue @@ -54,6 +54,12 @@ v-click-outside="closeAddDocs" ) table-create-package-doc(v-if="isOpenPackage") + base-popup.right-3.top-5( + v-if="section === 'additional' && isOpenAddingWrap", + v-click-outside="closePopup", + :width="485" + ) + table-create-note(create-note="createNote", :close-popup="closePopup") transition(name="section", mode="out-in") .flex.justify-center.items-center( v-if="sectionDataPresence", @@ -123,7 +129,8 @@ .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].description" + v-model:value="sectionInfo[key].description", + placeholder="Описание" ) .flex.items-center(v-if="item.title && section !== 'additional'") .icon-cancel.cancel.cursor-pointer.pr-3.text-xsm( @@ -148,6 +155,7 @@ import BaseButton from "@/components/base/BaseButton"; import TableAddingNewDoc from "@/pages/clients/components/TableAddingNewDoc"; import TableAddingNewAdditional from "@/pages/clients/components/TableAddingNewAdditional"; import TableCreatePackageDoc from "@/pages/clients/components/TableCreatePackageDoc"; +import TableCreateNote from "@/pages/clients/components/TableCreateNote"; import ClientDetailSectionAddress from "@/pages/clients/components/ClientDetailSectionAddress"; import TableChoiceAddingDoc from "@/pages/clients/components/TableChoiceAddingDoc"; import BasePopup from "@/components/base/BasePopup"; @@ -166,17 +174,17 @@ export default { BaseInputDate, BasePopup, BaseModal, + BaseLoader, ClientDetailInput, ClientDetailSectionAddress, TableAddingNewAdditional, TableCreatePackageDoc, TableAddingNewDoc, TableChoiceAddingDoc, - BaseLoader, + TableCreateNote, }, props: { saveNewDoc: Function, - createNote: Function, sectionInfo: Object, section: String, deleteDoc: Function, @@ -190,6 +198,7 @@ export default { dopeAddress: Object, createAddress: Function, createDocument: Function, + createNote: Function, addressId: String, docId: String, }, @@ -313,10 +322,12 @@ export default { } else this.updateAddress(); } if (this.section === "additional") { - if (!this.sectionInfo[0].id) { + if (!this.sectionInfo[0]?.id) { this.isNotes = false; - this.createAddress(); - } else this.updateNotes(); + this.createNote(); + } else { + this.updateNotes(); + } } }, copyValue(text) { diff --git a/src/pages/clients/components/ClientDetailInfoWrapper.vue b/src/pages/clients/components/ClientDetailInfoWrapper.vue index 416db2d..54c212f 100644 --- a/src/pages/clients/components/ClientDetailInfoWrapper.vue +++ b/src/pages/clients/components/ClientDetailInfoWrapper.vue @@ -46,7 +46,6 @@ export default { dataAttachments: Array, dataNotes: Array, saveNewDoc: Function, - createNote: Function, deleteDoc: Function, dataDocument: Object, updateDocument: Function, @@ -59,6 +58,7 @@ export default { dopeAddress: Object, createAddress: Function, createDocument: Function, + createNote: Function, addressId: String, docId: String, }, diff --git a/src/pages/clients/components/ClientsTableRow.vue b/src/pages/clients/components/ClientsTableRow.vue index 5001100..b16bf7e 100644 --- a/src/pages/clients/components/ClientsTableRow.vue +++ b/src/pages/clients/components/ClientsTableRow.vue @@ -433,9 +433,15 @@ export default { this.lackAttachments = this.dataAttachments[0]?.id ? true : false; }, saveNote(data) { - this.dataNotes = [...data.note]; - this.lackNotes = this.dataNotes[0]?.id ? true : false; + if (data?.note[0]) { + this.dataNotes = [...data.note]; + this.lackNotes = true; + } else { + this.lackNotes = false; + this.dataNotes = [{ title: "", description: "" }]; + } }, + saveIdentityDocument(data) { if (data?.id) { this.docId = data.id; @@ -621,12 +627,12 @@ export default { ); }); }, - postCreateNote() { + postCreateNote(title, description) { fetchWrapper .post("general/note/create/", { person_id: this.id, - title: this.dataNotes[0].title, - description: this.dataNotes[0].title, + title: title, + description: description, }) .then(() => this.fetchClientDetail(this.id)); }, diff --git a/src/pages/clients/components/TableCreateNote.vue b/src/pages/clients/components/TableCreateNote.vue new file mode 100644 index 0000000..6aecd13 --- /dev/null +++ b/src/pages/clients/components/TableCreateNote.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/pages/clients/utils/tableConfig.js b/src/pages/clients/utils/tableConfig.js index 4594fa9..5886a35 100644 --- a/src/pages/clients/utils/tableConfig.js +++ b/src/pages/clients/utils/tableConfig.js @@ -175,6 +175,9 @@ export const detail = { }, additional: { title: "Дополнительные данные", + placeholder: { + numba: "Редактировать данные", + }, height: 280, width: 360, addFile: true, diff --git a/tailwind.config.js b/tailwind.config.js index 63c3547..cf161d8 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -10,6 +10,7 @@ module.exports = { xsm: ["10px", { lineHeight: "12px" }], ins: ["11px", { lineHeight: "12px" }], xxs: ["12px", { lineHeight: "14px" }], + xsx: ["12px", { lineHeight: "16px" }], xs: ["13px", { lineHeight: "15px" }], xss: ["13px", { lineHeight: "19px" }], sm: ["14px", { lineHeight: "16px" }], From 838b971dad548083141827a9bbc9c6a8a9962772 Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Fri, 16 Dec 2022 18:53:41 +0300 Subject: [PATCH 2/2] =?UTF-8?q?[WIP]=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BE=D0=B1=20=D0=BE=D1=88=D0=B8=D0=B1?= =?UTF-8?q?=D0=BA=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)); + }); }, },