Merge pull request #178 from dderbentsov/UC-98
WIP Добавлены уведомления при некорректном ДУЛ
This commit is contained in:
@@ -38,12 +38,6 @@ export default {
|
|||||||
return Object.entries(notifications);
|
return Object.entries(notifications);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
|
||||||
notificationsList(val) {
|
|
||||||
console.log(val);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ import BaseModal from "@/components/base/BaseModal";
|
|||||||
import addImageIcon from "@/assets/icons/photo.svg";
|
import addImageIcon from "@/assets/icons/photo.svg";
|
||||||
import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider";
|
import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider";
|
||||||
import { addNotification } from "@/components/Notifications/notificationContext";
|
import { addNotification } from "@/components/Notifications/notificationContext";
|
||||||
|
import * as moment from "moment";
|
||||||
export default {
|
export default {
|
||||||
name: "BaseClientFormClient",
|
name: "BaseClientFormClient",
|
||||||
components: {
|
components: {
|
||||||
@@ -246,16 +247,33 @@ export default {
|
|||||||
!this.showModal ? this.closeForm() : null;
|
!this.showModal ? this.closeForm() : null;
|
||||||
},
|
},
|
||||||
createIdentityDocument(id) {
|
createIdentityDocument(id) {
|
||||||
Object.keys(
|
let filteredData = Object.keys(
|
||||||
this.filterDataEmptyProperty(this.infoClient.identity_document.pass)
|
this.filterDataEmptyProperty(this.infoClient.identity_document.pass)
|
||||||
).length > 0 &&
|
);
|
||||||
fetchWrapper.post("general/identity_document/create/", {
|
if (filteredData.length > 0) {
|
||||||
...this.filterDataEmptyProperty(
|
if (filteredData.length < 4) {
|
||||||
this.infoClient.identity_document.pass
|
this.addErrorNotification(
|
||||||
),
|
"Паспортные данные заполнены не полностью",
|
||||||
person_id: id,
|
"Паспортные данные не будут записаны в профиль клиента"
|
||||||
kind: "Паспорт",
|
);
|
||||||
});
|
} else if (
|
||||||
|
moment(this.infoClient.identity_document.pass.issued_by_date).isAfter(
|
||||||
|
moment().format("YYYY-MM-DD")
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
this.addErrorNotification(
|
||||||
|
"Некорректная дата выдачи паспорта",
|
||||||
|
"Паспортные данные не будут записаны в профиль клиента"
|
||||||
|
);
|
||||||
|
} else
|
||||||
|
fetchWrapper.post("general/identity_document/create/", {
|
||||||
|
...this.filterDataEmptyProperty(
|
||||||
|
this.infoClient.identity_document.pass
|
||||||
|
),
|
||||||
|
person_id: id,
|
||||||
|
kind: "Паспорт",
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
createAddress(id) {
|
createAddress(id) {
|
||||||
Object.keys(this.filterDataEmptyProperty(this.infoClient.addresses))
|
Object.keys(this.filterDataEmptyProperty(this.infoClient.addresses))
|
||||||
@@ -301,11 +319,18 @@ export default {
|
|||||||
fetchWrapper
|
fetchWrapper
|
||||||
.post("general/person/create/", formData, "formData")
|
.post("general/person/create/", formData, "formData")
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.createIdentityDocument(result.id);
|
if (result.id) {
|
||||||
this.createAddress(result.id);
|
this.createIdentityDocument(result.id);
|
||||||
this.createContacts(result.id);
|
this.createAddress(result.id);
|
||||||
this.setUpdatedClients();
|
this.createContacts(result.id);
|
||||||
this.addSuccessNotification();
|
this.setUpdatedClients();
|
||||||
|
this.addSuccessNotification();
|
||||||
|
} else {
|
||||||
|
this.addErrorNotification(
|
||||||
|
"Клиент не создан",
|
||||||
|
"Произошла ошибка сервера"
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
filterDataEmptyProperty(data) {
|
filterDataEmptyProperty(data) {
|
||||||
@@ -393,21 +418,14 @@ export default {
|
|||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.infoClient.basic.full_name.split(" ").length < 3) {
|
|
||||||
this.addErrorNotification(
|
|
||||||
"Некорректное ФИО клиента",
|
|
||||||
"Пожалуйста, введите ФИО клиента правильно"
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
addErrorNotification(title, message) {
|
addErrorNotification(title, message) {
|
||||||
addNotification(new Date().getTime(), title, message, "error", 5000);
|
addNotification(title, title, message, "error", 5000);
|
||||||
},
|
},
|
||||||
addSuccessNotification() {
|
addSuccessNotification() {
|
||||||
addNotification(
|
addNotification(
|
||||||
new Date().getTime(),
|
"Клиент успешно создан",
|
||||||
"Клиент успешно создан",
|
"Клиент успешно создан",
|
||||||
"",
|
"",
|
||||||
"success",
|
"success",
|
||||||
|
|||||||
@@ -206,7 +206,11 @@ export default {
|
|||||||
this.textSearch = "";
|
this.textSearch = "";
|
||||||
this.clearingTextSearch = true;
|
this.clearingTextSearch = true;
|
||||||
this.clientsCount += 1;
|
this.clientsCount += 1;
|
||||||
this.currentTablePage = this.calculatePageCount(this.clientsCount);
|
if (
|
||||||
|
this.currentTablePage !== this.calculatePageCount(this.clientsCount)
|
||||||
|
)
|
||||||
|
this.currentTablePage = this.calculatePageCount(this.clientsCount);
|
||||||
|
else this.fetchDataClients();
|
||||||
this.$emit("reset-updated-clients");
|
this.$emit("reset-updated-clients");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ export default {
|
|||||||
this.timer = null;
|
this.timer = null;
|
||||||
},
|
},
|
||||||
startTimer() {
|
startTimer() {
|
||||||
this.countdown = 10;
|
this.countdown = 30;
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
this.changeCountdown();
|
this.changeCountdown();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user