[WIP] Добавил уведомление об ошибке

This commit is contained in:
megavrilinvv
2022-12-16 18:53:41 +03:00
parent cb1fcd9818
commit 838b971dad
2 changed files with 36 additions and 16 deletions

View File

@@ -59,7 +59,7 @@
v-click-outside="closePopup", v-click-outside="closePopup",
:width="485" :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") transition(name="section", mode="out-in")
.flex.justify-center.items-center( .flex.justify-center.items-center(
v-if="sectionDataPresence", v-if="sectionDataPresence",
@@ -126,7 +126,12 @@
.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(
:style="{fontWeight:key === 'numba'&&600}",
v-model:value="sectionInfo[key].title",
placeholder="Заголовок"
)
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].description",
@@ -261,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() {
@@ -324,7 +330,6 @@ export default {
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.createNote();
} else { } else {
this.updateNotes(); this.updateNotes();
} }

View File

@@ -628,6 +628,12 @@ export default {
}); });
}, },
postCreateNote(title, description) { postCreateNote(title, description) {
if (!title || !description) {
this.addErrorNotification(
"Ошибка создания дополнительных данных",
"Все поля должны быть заполнены"
);
} else
fetchWrapper fetchWrapper
.post("general/note/create/", { .post("general/note/create/", {
person_id: this.id, person_id: this.id,
@@ -637,12 +643,21 @@ export default {
.then(() => this.fetchClientDetail(this.id)); .then(() => this.fetchClientDetail(this.id));
}, },
postUpdateNotes() { postUpdateNotes() {
this.dataNotes.forEach((e) => {
if (!e.title || !e.description) {
this.addErrorNotification(
"Ошибка изменения дополнительных данных",
"Поля не могут быть пустыми"
);
this.fetchClientDetail(this.id);
} else
fetchWrapper fetchWrapper
.post(`general/note/${this.dataNotes[0].id}/update/`, { .post(`general/note/${e.id}/update/`, {
title: this.dataNotes[0].title, title: e.title,
description: this.dataNotes[0].description, description: e.description,
}) })
.then(() => this.fetchClientDetail(this.id)); .then(() => this.fetchClientDetail(this.id));
});
}, },
}, },