Merge pull request #206 from dderbentsov/UC-155

[WIP] Добавил notes и их апдейт, поправил стили мед карты
This commit is contained in:
frontgavrilin
2022-12-15 19:06:41 +03:00
committed by GitHub
8 changed files with 107 additions and 40 deletions

View File

@@ -90,19 +90,22 @@
client-detail-info-wrapper.detail.px-52px(
:class="{'pb-[30px] pt-4': isOpenDetailInfo}"
:data-address="dataAddress",
:data-detail="dataDetail",
:data-attachments="dataAttachments",
:data-document="dataIdentityDocument",
:data-notes="dataNotes"
:save-new-doc="saveNewDoc",
:delete-doc="deleteDoc",
:update-document="postUpdateIdentityDocument",
:update-address="postUpdateAddress",
:update-notes="postUpdateNotes",
:lack-data="lackData",
:lack-address="lackAddress",
:dope-address="dopeAddress",
:lack-attachments="lackAttachments",
:lack-notes="lackNotes"
:create-address="postCreateAddress",
:create-document="postCreateIdentityDocument",
:create-note="postCreateNote",
:address-id="addressId",
:doc-id="docId",
)
@@ -155,7 +158,11 @@ export default {
initialization: true,
},
],
dataDetail: {},
dataNotes: [
{
initialization: true,
},
],
isOpenDetailInfo: false,
isOpenPopup: false,
columnBody: column,
@@ -167,6 +174,7 @@ export default {
lackData: true,
lackAddress: true,
lackAttachments: true,
lackNotes: true,
dopeAddress: {
city: "",
region: "",
@@ -401,9 +409,10 @@ export default {
addNotification(title, title, message, "error", 5000);
},
fetchClientDetail(id) {
fetchWrapper
.get(`general/person/${id}/detail/`)
.then((data) => this.saveClientDetail(data));
fetchWrapper.get(`general/person/${id}/detail/`).then((data) => {
this.saveClientDetail(data);
this.saveNote(data);
});
this.fetchAttachment();
},
saveClientDetail(data) {
@@ -423,6 +432,10 @@ export default {
this.dataAttachments = data.filter((e) => e.person_id.id === this.id);
this.lackAttachments = this.dataAttachments[0]?.id ? true : false;
},
saveNote(data) {
this.dataNotes = [...data.note];
this.lackNotes = this.dataNotes[0]?.id ? true : false;
},
saveIdentityDocument(data) {
if (data?.id) {
this.docId = data.id;
@@ -608,7 +621,25 @@ export default {
);
});
},
postCreateNote() {
fetchWrapper
.post("general/note/create/", {
person_id: this.id,
title: this.dataNotes[0].title,
description: this.dataNotes[0].title,
})
.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));
},
},
watch: {
rowOverlay() {
if (this.rowOverlay) this.startTimer();