WIP Изменены уведомления

This commit is contained in:
Daria Golova
2022-11-29 16:12:39 +03:00
parent 2ddeb1ffd9
commit 6036500b18
7 changed files with 95 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
<template lang="pug">
.notification-container.flex.justify-between(:style="{ backgroundColor: bgColor }")
.notification-content.flex.mr-16
.grid.grid-rows-2
.grid(:class="{'grid-rows': message}")
.text-white.text-xs.icon.row-span-full.flex.justify-center.items-center(:class="iconClass")
.text-white.text-base(v-if="title") {{ title }}
.text-white.text-base(v-if="message") {{ message }}
@@ -83,4 +83,6 @@ export default {
.grid
grid-template-columns: 24px 1fr
grid-column-gap: 8px
.grid-rows
grid-template-rows: repeat(2, auto)
</style>

View File

@@ -53,6 +53,8 @@ import FormCreateAddresses from "@/pages/clients/components/FormCreateAddresses"
import FormCreateAdditional from "@/pages/clients/components/FormCreateAdditional";
import BaseInput from "@/components/base/BaseInput";
import BaseButton from "@/components/base/BaseButton";
import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider";
import { addNotification } from "@/components/Notifications/notificationContext";
export default {
name: "BaseClientFormClient",
components: {
@@ -62,6 +64,7 @@ export default {
FormCreateAddresses,
FormCreateAdditional,
BaseButton,
TheNotificationProvider,
},
props: {
closeForm: Function,
@@ -209,6 +212,7 @@ export default {
fetchWrapper.post("general/person/create/", sentData).then((result) => {
this.createIdentityDocument(result.id);
this.createAddress(result.id);
this.addSuccessNotification();
});
this.$emit("update-client");
},
@@ -283,11 +287,29 @@ export default {
},
checkFormFullness() {
if (!this.infoClient.basic.full_name) {
alert("Не заполнено ФИО клиента");
this.addErrrorNotification();
return false;
}
return true;
},
addErrrorNotification() {
addNotification(
new Date().getTime(),
"Не заполнено ФИО клиента",
"Пожалуйста, заполните ФИО клиента",
"error",
3000
);
},
addSuccessNotification() {
addNotification(
new Date().getTime(),
"Клиент успешно создан",
"",
"success",
3000
);
},
},
};
</script>