Merge pull request #210 from dderbentsov/UC-155
[WIP] Доработал note и возможность их создания, добавил уведомление об ошибке
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
:type="type",
|
:type="type",
|
||||||
@input="$emit('update:value', $event.target.value)",
|
@input="$emit('update:value', $event.target.value)",
|
||||||
:placeholder="placeholder",
|
:placeholder="placeholder",
|
||||||
:maxlength="maxLength",
|
:maxLength="maxLength",
|
||||||
:max="maxDate",
|
:max="maxDate",
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -54,6 +54,12 @@
|
|||||||
v-click-outside="closeAddDocs"
|
v-click-outside="closeAddDocs"
|
||||||
)
|
)
|
||||||
table-create-package-doc(v-if="isOpenPackage")
|
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")
|
transition(name="section", mode="out-in")
|
||||||
.flex.justify-center.items-center(
|
.flex.justify-center.items-center(
|
||||||
v-if="sectionDataPresence",
|
v-if="sectionDataPresence",
|
||||||
@@ -120,10 +126,16 @@
|
|||||||
.flex.flex-col.gap-y-4(v-if="section === 'addresses' && isChange")
|
.flex.flex-col.gap-y-4(v-if="section === 'addresses' && isChange")
|
||||||
client-detail-section-address(:dope-address="dopeAddress")
|
client-detail-section-address(:dope-address="dopeAddress")
|
||||||
.flex.flex-col.gap-y-2(v-if="section === 'additional' && isChange")
|
.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(
|
client-detail-input.text-sm.w-max-fit(
|
||||||
:style="{fontWeight:key === 'numba'&&600}",
|
:style="{fontWeight:key === 'numba'&&600}",
|
||||||
v-model:value="sectionInfo[key].description"
|
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",
|
||||||
|
placeholder="Описание"
|
||||||
)
|
)
|
||||||
.flex.items-center(v-if="item.title && section !== 'additional'")
|
.flex.items-center(v-if="item.title && section !== 'additional'")
|
||||||
.icon-cancel.cancel.cursor-pointer.pr-3.text-xsm(
|
.icon-cancel.cancel.cursor-pointer.pr-3.text-xsm(
|
||||||
@@ -148,6 +160,7 @@ import BaseButton from "@/components/base/BaseButton";
|
|||||||
import TableAddingNewDoc from "@/pages/clients/components/TableAddingNewDoc";
|
import TableAddingNewDoc from "@/pages/clients/components/TableAddingNewDoc";
|
||||||
import TableAddingNewAdditional from "@/pages/clients/components/TableAddingNewAdditional";
|
import TableAddingNewAdditional from "@/pages/clients/components/TableAddingNewAdditional";
|
||||||
import TableCreatePackageDoc from "@/pages/clients/components/TableCreatePackageDoc";
|
import TableCreatePackageDoc from "@/pages/clients/components/TableCreatePackageDoc";
|
||||||
|
import TableCreateNote from "@/pages/clients/components/TableCreateNote";
|
||||||
import ClientDetailSectionAddress from "@/pages/clients/components/ClientDetailSectionAddress";
|
import ClientDetailSectionAddress from "@/pages/clients/components/ClientDetailSectionAddress";
|
||||||
import TableChoiceAddingDoc from "@/pages/clients/components/TableChoiceAddingDoc";
|
import TableChoiceAddingDoc from "@/pages/clients/components/TableChoiceAddingDoc";
|
||||||
import BasePopup from "@/components/base/BasePopup";
|
import BasePopup from "@/components/base/BasePopup";
|
||||||
@@ -166,17 +179,17 @@ export default {
|
|||||||
BaseInputDate,
|
BaseInputDate,
|
||||||
BasePopup,
|
BasePopup,
|
||||||
BaseModal,
|
BaseModal,
|
||||||
|
BaseLoader,
|
||||||
ClientDetailInput,
|
ClientDetailInput,
|
||||||
ClientDetailSectionAddress,
|
ClientDetailSectionAddress,
|
||||||
TableAddingNewAdditional,
|
TableAddingNewAdditional,
|
||||||
TableCreatePackageDoc,
|
TableCreatePackageDoc,
|
||||||
TableAddingNewDoc,
|
TableAddingNewDoc,
|
||||||
TableChoiceAddingDoc,
|
TableChoiceAddingDoc,
|
||||||
BaseLoader,
|
TableCreateNote,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
saveNewDoc: Function,
|
saveNewDoc: Function,
|
||||||
createNote: Function,
|
|
||||||
sectionInfo: Object,
|
sectionInfo: Object,
|
||||||
section: String,
|
section: String,
|
||||||
deleteDoc: Function,
|
deleteDoc: Function,
|
||||||
@@ -190,6 +203,7 @@ export default {
|
|||||||
dopeAddress: Object,
|
dopeAddress: Object,
|
||||||
createAddress: Function,
|
createAddress: Function,
|
||||||
createDocument: Function,
|
createDocument: Function,
|
||||||
|
createNote: Function,
|
||||||
addressId: String,
|
addressId: String,
|
||||||
docId: String,
|
docId: String,
|
||||||
},
|
},
|
||||||
@@ -252,6 +266,7 @@ export default {
|
|||||||
this.isOpenAddDoc = true;
|
this.isOpenAddDoc = true;
|
||||||
} else if (this.section === "additional") {
|
} else if (this.section === "additional") {
|
||||||
this.isNotes = true;
|
this.isNotes = true;
|
||||||
|
this.isOpenAddingWrap = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeOpenAddDoc() {
|
changeOpenAddDoc() {
|
||||||
@@ -313,10 +328,11 @@ export default {
|
|||||||
} else this.updateAddress();
|
} else this.updateAddress();
|
||||||
}
|
}
|
||||||
if (this.section === "additional") {
|
if (this.section === "additional") {
|
||||||
if (!this.sectionInfo[0].id) {
|
if (!this.sectionInfo[0]?.id) {
|
||||||
this.isNotes = false;
|
this.isNotes = false;
|
||||||
this.createAddress();
|
} else {
|
||||||
} else this.updateNotes();
|
this.updateNotes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
copyValue(text) {
|
copyValue(text) {
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ export default {
|
|||||||
dataAttachments: Array,
|
dataAttachments: Array,
|
||||||
dataNotes: Array,
|
dataNotes: Array,
|
||||||
saveNewDoc: Function,
|
saveNewDoc: Function,
|
||||||
createNote: Function,
|
|
||||||
deleteDoc: Function,
|
deleteDoc: Function,
|
||||||
dataDocument: Object,
|
dataDocument: Object,
|
||||||
updateDocument: Function,
|
updateDocument: Function,
|
||||||
@@ -59,6 +58,7 @@ export default {
|
|||||||
dopeAddress: Object,
|
dopeAddress: Object,
|
||||||
createAddress: Function,
|
createAddress: Function,
|
||||||
createDocument: Function,
|
createDocument: Function,
|
||||||
|
createNote: Function,
|
||||||
addressId: String,
|
addressId: String,
|
||||||
docId: String,
|
docId: String,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -433,9 +433,15 @@ export default {
|
|||||||
this.lackAttachments = this.dataAttachments[0]?.id ? true : false;
|
this.lackAttachments = this.dataAttachments[0]?.id ? true : false;
|
||||||
},
|
},
|
||||||
saveNote(data) {
|
saveNote(data) {
|
||||||
this.dataNotes = [...data.note];
|
if (data?.note[0]) {
|
||||||
this.lackNotes = this.dataNotes[0]?.id ? true : false;
|
this.dataNotes = [...data.note];
|
||||||
|
this.lackNotes = true;
|
||||||
|
} else {
|
||||||
|
this.lackNotes = false;
|
||||||
|
this.dataNotes = [{ title: "", description: "" }];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
saveIdentityDocument(data) {
|
saveIdentityDocument(data) {
|
||||||
if (data?.id) {
|
if (data?.id) {
|
||||||
this.docId = data.id;
|
this.docId = data.id;
|
||||||
@@ -621,22 +627,37 @@ export default {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
postCreateNote() {
|
postCreateNote(title, description) {
|
||||||
fetchWrapper
|
if (!title || !description) {
|
||||||
.post("general/note/create/", {
|
this.addErrorNotification(
|
||||||
person_id: this.id,
|
"Ошибка создания дополнительных данных",
|
||||||
title: this.dataNotes[0].title,
|
"Все поля должны быть заполнены"
|
||||||
description: this.dataNotes[0].title,
|
);
|
||||||
})
|
} else
|
||||||
.then(() => this.fetchClientDetail(this.id));
|
fetchWrapper
|
||||||
|
.post("general/note/create/", {
|
||||||
|
person_id: this.id,
|
||||||
|
title: title,
|
||||||
|
description: description,
|
||||||
|
})
|
||||||
|
.then(() => this.fetchClientDetail(this.id));
|
||||||
},
|
},
|
||||||
postUpdateNotes() {
|
postUpdateNotes() {
|
||||||
fetchWrapper
|
this.dataNotes.forEach((e) => {
|
||||||
.post(`general/note/${this.dataNotes[0].id}/update/`, {
|
if (!e.title || !e.description) {
|
||||||
title: this.dataNotes[0].title,
|
this.addErrorNotification(
|
||||||
description: this.dataNotes[0].description,
|
"Ошибка изменения дополнительных данных",
|
||||||
})
|
"Поля не могут быть пустыми"
|
||||||
.then(() => this.fetchClientDetail(this.id));
|
);
|
||||||
|
this.fetchClientDetail(this.id);
|
||||||
|
} else
|
||||||
|
fetchWrapper
|
||||||
|
.post(`general/note/${e.id}/update/`, {
|
||||||
|
title: e.title,
|
||||||
|
description: e.description,
|
||||||
|
})
|
||||||
|
.then(() => this.fetchClientDetail(this.id));
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
65
src/pages/clients/components/TableCreateNote.vue
Normal file
65
src/pages/clients/components/TableCreateNote.vue
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
.flex.flex-col.gap-y-3
|
||||||
|
.flex.flex-col.gap-y-3.relative
|
||||||
|
base-input.text-smm(placeholder="Заголовок", v-model:value="title", :maxLength="40")
|
||||||
|
.text.flex.absolute.text-xsx.right-7.top-3 {{`${changeValue}/40`}}
|
||||||
|
.input-wrapper.flex.gap-x-2.px-4.box-border.w-max-fit.text-smm(class="py-2.5")
|
||||||
|
textarea.place-input.w-full.outline-0.not-italic.resize-none(
|
||||||
|
:cols="24",
|
||||||
|
placeholder="Описание",
|
||||||
|
v-model="description"
|
||||||
|
)
|
||||||
|
.flex
|
||||||
|
base-button(:size="40", @click="sendNote") Добавить
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import BaseButton from "@/components/base/BaseButton";
|
||||||
|
import BaseInput from "@/components/base/BaseInput";
|
||||||
|
export default {
|
||||||
|
name: "TableCreateNote",
|
||||||
|
components: { BaseButton, BaseInput },
|
||||||
|
props: {
|
||||||
|
createNote: Function,
|
||||||
|
closePopup: Function,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
username: "",
|
||||||
|
title: "",
|
||||||
|
description: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
changeValue() {
|
||||||
|
return this.title.length;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
sendNote() {
|
||||||
|
this.createNote(this.title, this.description);
|
||||||
|
this.closePopup();
|
||||||
|
this.title = "";
|
||||||
|
this.description = "";
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.title
|
||||||
|
min-height: 39px
|
||||||
|
.description
|
||||||
|
min-height: 70px
|
||||||
|
.input-wrapper
|
||||||
|
border: 2px solid var(--border-light-grey-color)
|
||||||
|
border-radius: 4px
|
||||||
|
background-color: var(--default-white)
|
||||||
|
textarea
|
||||||
|
overflow: hidden
|
||||||
|
.text
|
||||||
|
color: var(--font-grey-color)
|
||||||
|
.button
|
||||||
|
&:hover
|
||||||
|
opacity: 0.7
|
||||||
|
</style>
|
||||||
@@ -175,6 +175,9 @@ export const detail = {
|
|||||||
},
|
},
|
||||||
additional: {
|
additional: {
|
||||||
title: "Дополнительные данные",
|
title: "Дополнительные данные",
|
||||||
|
placeholder: {
|
||||||
|
numba: "Редактировать данные",
|
||||||
|
},
|
||||||
height: 280,
|
height: 280,
|
||||||
width: 360,
|
width: 360,
|
||||||
addFile: true,
|
addFile: true,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ module.exports = {
|
|||||||
xsm: ["10px", { lineHeight: "12px" }],
|
xsm: ["10px", { lineHeight: "12px" }],
|
||||||
ins: ["11px", { lineHeight: "12px" }],
|
ins: ["11px", { lineHeight: "12px" }],
|
||||||
xxs: ["12px", { lineHeight: "14px" }],
|
xxs: ["12px", { lineHeight: "14px" }],
|
||||||
|
xsx: ["12px", { lineHeight: "16px" }],
|
||||||
xs: ["13px", { lineHeight: "15px" }],
|
xs: ["13px", { lineHeight: "15px" }],
|
||||||
xss: ["13px", { lineHeight: "19px" }],
|
xss: ["13px", { lineHeight: "19px" }],
|
||||||
sm: ["14px", { lineHeight: "16px" }],
|
sm: ["14px", { lineHeight: "16px" }],
|
||||||
|
|||||||
Reference in New Issue
Block a user