WIP Добавлены уведомления при некорректном ДУЛ

This commit is contained in:
Daria Golova
2022-12-06 18:17:00 +03:00
parent bc95fbcfb7
commit 4b4a4917e4
2 changed files with 22 additions and 32 deletions

View File

@@ -250,18 +250,15 @@ export default {
let filteredData = Object.keys( let filteredData = Object.keys(
this.filterDataEmptyProperty(this.infoClient.identity_document.pass) this.filterDataEmptyProperty(this.infoClient.identity_document.pass)
); );
console.log( console.log(filteredData.length);
moment(this.infoClient.identity_document.pass.issued_by_date).isAfter(
moment().format("YYYY-MM-DD")
)
);
if (filteredData.length > 0) { if (filteredData.length > 0) {
if (filteredData.length !== 4) if (filteredData.length < 4) {
this.addErrorNotification( this.addErrorNotification(
"Паспортные данные заполнены не полностью", "Паспортные данные заполнены не полностью",
"Паспортные данные не будут записаны в профиль клиента" "Паспортные данные не будут записаны в профиль клиента"
); );
else if ( console.log("запрос отлетел из-за нехватки данных");
} else if (
moment(this.infoClient.identity_document.pass.issued_by_date).isAfter( moment(this.infoClient.identity_document.pass.issued_by_date).isAfter(
moment().format("YYYY-MM-DD") moment().format("YYYY-MM-DD")
) )
@@ -270,6 +267,7 @@ export default {
"Некорректная дата выдачи паспорта", "Некорректная дата выдачи паспорта",
"Паспортные данные не будут записаны в профиль клиента" "Паспортные данные не будут записаны в профиль клиента"
); );
console.log("запрос отлетел из-за времени");
} else } else
fetchWrapper.post("general/identity_document/create/", { fetchWrapper.post("general/identity_document/create/", {
...this.filterDataEmptyProperty( ...this.filterDataEmptyProperty(
@@ -279,16 +277,6 @@ export default {
kind: "Паспорт", kind: "Паспорт",
}); });
} }
/*bject.keys(
this.filterDataEmptyProperty(this.infoClient.identity_document.pass)
).length > 0 &&
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))
@@ -331,14 +319,23 @@ export default {
); );
if (foundElement.priority) if (foundElement.priority)
formData.append("priority", foundElement.priority); formData.append("priority", foundElement.priority);
console.log(formData);
fetchWrapper fetchWrapper
.post("general/person/create/", formData, "formData") .post("general/person/create/", formData, "formData")
.then((result) => { .then((result) => {
if (result.id) {
this.createIdentityDocument(result.id); this.createIdentityDocument(result.id);
this.createAddress(result.id); this.createAddress(result.id);
this.createContacts(result.id); this.createContacts(result.id);
this.setUpdatedClients(); this.setUpdatedClients();
this.addSuccessNotification(); this.addSuccessNotification();
} else {
this.addErrorNotification(
"Клиент не создан",
"Произошла ошибка сервера"
);
console.log(result);
}
}); });
}, },
filterDataEmptyProperty(data) { filterDataEmptyProperty(data) {
@@ -426,21 +423,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",

View File

@@ -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);