notifications

master
alex 2024-01-25 22:24:04 +01:00
parent a8f6f75d28
commit ffe42d2a74
6 changed files with 86 additions and 49 deletions

View File

@ -130,12 +130,13 @@
"serviceActivityDescription": "Beschreibung der Tätigkeit", "serviceActivityDescription": "Beschreibung der Tätigkeit",
"serviceActivityDescriptionPlaceholder": "Geben Sie die Beschreibung der Tätigkeit ein", "serviceActivityDescriptionPlaceholder": "Geben Sie die Beschreibung der Tätigkeit ein",
"serviceActivityPrice": "Preis der Tätigkeit", "serviceActivityPrice": "Preis der Tätigkeit",
"serviceActivityPricePlaceholder": "Geben Sie den Preis der Tätigkeit ein", "serviceActivityPricePlaceholder": "20",
"serviceActivityPriceUnit": "€", "serviceActivityPriceUnit": "€",
"serviceActivityDurationMinutes": "Dauer der Tätigkeit", "serviceActivityDurationMinutes": "Dauer der Tätigkeit",
"serviceActivityDurationMinutesPlaceholder": "Geben Sie die Dauer der Tätigkeit in Minuten ein", "serviceActivityDurationMinutesPlaceholder": "15",
"serviceActivityDurationMinutesUnit": "Minuten", "serviceActivityDurationMinutesUnit": "Minuten",
"serviceActivityResponsible": "Verantwortliche Mitarbeiter", "serviceActivityResponsible": "Verantwortliche Mitarbeiter",
"serviceActivityResponsibleDescription": "Geben Sie für diese Tätigkeit geeignete Mitarbeiter an, die diese Tätigkeit durchführen können. Diese werden Kunden bei der Buchung dieser Tätigkeit als Auswahlmöglichkeit angezeigt.",
"inputRules": { "inputRules": {
"serviceNameRequired": "Name der Dienstleistung ist erforderlich", "serviceNameRequired": "Name der Dienstleistung ist erforderlich",
"serviceNameMinLength": "Name der Dienstleistung muss mindestens {{minLength}} Zeichen lang sein", "serviceNameMinLength": "Name der Dienstleistung muss mindestens {{minLength}} Zeichen lang sein",
@ -196,7 +197,13 @@
"title": "Google Kalender trennen", "title": "Google Kalender trennen",
"description": "Aus Sicherheitsgründen müssen Sie Ihr Passwort eingeben, um die Verbindung zu Ihrem Google Kalender zu trennen.", "description": "Aus Sicherheitsgründen müssen Sie Ihr Passwort eingeben, um die Verbindung zu Ihrem Google Kalender zu trennen.",
"checkboxDeleteCalendars": "Kalender für Öffnungszeiten und Termine löschen (Alle Termine werden gelöscht und können nicht wiederhergestellt werden)", "checkboxDeleteCalendars": "Kalender für Öffnungszeiten und Termine löschen (Alle Termine werden gelöscht und können nicht wiederhergestellt werden)",
"button": "Google Kalender trennen" "button": "Google Kalender trennen",
"request": {
"400": {
"title": "Passwort ungültig",
"description": "Bitte überprüfen Sie Ihr Passwort und versuchen Sie es erneut."
}
}
}, },
"calendarFrameCustomerView": "Terminkalenderansicht der Kunden" "calendarFrameCustomerView": "Terminkalenderansicht der Kunden"
}, },

View File

@ -139,6 +139,7 @@
"serviceActivityDurationMinutesPlaceholder": "Enter the duration of the activity in minutes", "serviceActivityDurationMinutesPlaceholder": "Enter the duration of the activity in minutes",
"serviceActivityDurationMinutesUnit": "Minutes", "serviceActivityDurationMinutesUnit": "Minutes",
"serviceActivityResponsible": "Responsible employees", "serviceActivityResponsible": "Responsible employees",
"serviceActivityResponsibleDescription": "Specify suitable employees who can carry out this activity. These are displayed to customers as a selection option when booking this activity.",
"inputRules": { "inputRules": {
"serviceNameRequired": "Service name is required", "serviceNameRequired": "Service name is required",
"serviceNameMinLength": "Service name must be at least {{minLength}} characters long", "serviceNameMinLength": "Service name must be at least {{minLength}} characters long",
@ -199,7 +200,13 @@
"title": "Unlink Google Calendar", "title": "Unlink Google Calendar",
"description": "For security reasons, you need to enter your password to unlink your Google Calendar.", "description": "For security reasons, you need to enter your password to unlink your Google Calendar.",
"checkboxDeleteCalendars": "Delete calendar for opening hours and appointments (all appointments are deleted and cannot be restored)", "checkboxDeleteCalendars": "Delete calendar for opening hours and appointments (all appointments are deleted and cannot be restored)",
"button": "Unlink Google Calendar" "button": "Unlink Google Calendar",
"request": {
"400": {
"title": "Password incorrect",
"description": "Please check your password and try again."
}
}
}, },
"calendarFrameCustomerView": "Appointment diary view of customers" "calendarFrameCustomerView": "Appointment diary view of customers"
}, },

View File

@ -18,6 +18,7 @@ import {
EncodeStringToBase64, EncodeStringToBase64,
getUserSessionFromLocalStorage, getUserSessionFromLocalStorage,
myFetch, myFetch,
showInputsInvalidNotification,
} from "../../../utils"; } from "../../../utils";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import MyCenteredContainer from "../../../Components/MyContainer"; import MyCenteredContainer from "../../../Components/MyContainer";
@ -310,7 +311,9 @@ function CardPersonalCalendarSettings({ settings }) {
onCancel={handleModalClose} onCancel={handleModalClose}
isConfirmButtonLoading={isRequesting} isConfirmButtonLoading={isRequesting}
onConfirm={() => { onConfirm={() => {
formUnlinkCalendar.validateFields().then((values) => { formUnlinkCalendar
.validateFields()
.then((values) => {
setIsRequesting(true); setIsRequesting(true);
myFetch({ myFetch({
@ -324,11 +327,21 @@ function CardPersonalCalendarSettings({ settings }) {
}) })
.then(() => window.location.reload()) .then(() => window.location.reload())
.catch((errStatus) => { .catch((errStatus) => {
console.log(errStatus);
setIsRequesting(false); setIsRequesting(false);
// TODO: show error message
if (errStatus === 400) {
notificationApi["error"]({
message: t(
"calendar.unlinkGoogleCalendar.request.400.title"
),
description: t(
"calendar.unlinkGoogleCalendar.request.400.description"
),
}); });
}
}); });
})
.catch(() => showInputsInvalidNotification(notificationApi, t));
}} }}
/> />
} }

View File

@ -13,7 +13,11 @@ import MyModal, {
MyModalCloseSaveButtonFooter, MyModalCloseSaveButtonFooter,
} from "../../../Components/MyModal"; } from "../../../Components/MyModal";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { myFetch, EncodeStringToBase64 } from "../../../utils"; import {
myFetch,
EncodeStringToBase64,
showInputsInvalidNotification,
} from "../../../utils";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import MyTable from "../../../Components/MyTable"; import MyTable from "../../../Components/MyTable";
import { import {
@ -198,6 +202,8 @@ function ModalAddEditEmployee({
fetchEmployees, fetchEmployees,
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
const [notificationApi, notificationContextHolder] =
notification.useNotification();
const { storeId } = useParams(); const { storeId } = useParams();
const screenBreakpoint = useBreakpoint(); const screenBreakpoint = useBreakpoint();
const [form] = Form.useForm(); const [form] = Form.useForm();
@ -240,6 +246,8 @@ function ModalAddEditEmployee({
return ( return (
<> <>
{notificationContextHolder}
<Button <Button
type="primary" type="primary"
block={screenBreakpoint.xs} block={screenBreakpoint.xs}
@ -312,9 +320,9 @@ function ModalAddEditEmployee({
setIsRequesting(false); setIsRequesting(false);
}); });
}) })
.catch((info) => { .catch(() =>
console.log("Validate Failed:", info); showInputsInvalidNotification(notificationApi, t)
}); );
}} }}
/> />
) : ( ) : (
@ -404,9 +412,9 @@ function ModalAddEditEmployee({
setIsRequesting(false); setIsRequesting(false);
}); });
}) })
.catch((info) => { .catch(() =>
console.log("Validate Failed:", info); showInputsInvalidNotification(notificationApi, t)
}); );
}} }}
/> />
) )

View File

@ -1,4 +1,4 @@
import { PlusOutlined } from "@ant-design/icons"; import { InfoCircleOutlined, PlusOutlined } from "@ant-design/icons";
import { import {
Avatar, Avatar,
Button, Button,
@ -15,7 +15,11 @@ import {
} from "antd"; } from "antd";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Constants, myFetch } from "../../../utils"; import {
Constants,
myFetch,
showInputsInvalidNotification,
} from "../../../utils";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import MyModal, { import MyModal, {
MyModalCloseCreateButtonFooter, MyModalCloseCreateButtonFooter,
@ -468,6 +472,7 @@ function ModalAddEditService({
setAddEditServiceModalOptions({ setAddEditServiceModalOptions({
...addEditServiceModalOptions, ...addEditServiceModalOptions,
isOpen: false, isOpen: false,
mode: "add",
}); });
form.resetFields(); form.resetFields();
@ -521,7 +526,7 @@ function ModalAddEditService({
setIsRequesting(true); setIsRequesting(true);
myFetch({ myFetch({
url: "/store/services", url: "/store/services/service",
method: "POST", method: "POST",
body: { body: {
storeId: storeId, storeId: storeId,
@ -540,9 +545,9 @@ function ModalAddEditService({
console.log(errStatus); console.log(errStatus);
}); });
}) })
.catch((info) => { .catch(() =>
console.log("Validate Failed:", info); showInputsInvalidNotification(notificationApi, t)
}); );
}} }}
/> />
) : ( ) : (
@ -585,9 +590,9 @@ function ModalAddEditService({
console.log(errStatus); console.log(errStatus);
}); });
}) })
.catch((info) => { .catch(() =>
console.log("Validate Failed:", info); showInputsInvalidNotification(notificationApi, t)
}); );
}} }}
/> />
) )
@ -665,10 +670,6 @@ function ModalAddEditServiceActivity({
) )
); );
} else { } else {
form.setFieldsValue({
serviceActivityDurationHours: 0,
});
setSelectedEmployeesRowKeys(users.map((user) => user.user_id)); setSelectedEmployeesRowKeys(users.map((user) => user.user_id));
} }
}, [addEditServiceActivityModalOptions.isOpen]); }, [addEditServiceActivityModalOptions.isOpen]);
@ -724,9 +725,9 @@ function ModalAddEditServiceActivity({
console.log(errStatus); console.log(errStatus);
}); });
}) })
.catch((info) => { .catch(() =>
console.log("Validate Failed:", info); showInputsInvalidNotification(notificationApi, t)
}); );
}} }}
/> />
) : ( ) : (
@ -830,9 +831,9 @@ function ModalAddEditServiceActivity({
console.log(errStatus); console.log(errStatus);
}); });
}) })
.catch((info) => { .catch(() =>
console.log("Validate Failed:", info); showInputsInvalidNotification(notificationApi, t)
}); );
}} }}
/> />
) )
@ -851,6 +852,9 @@ function ModalAddEditServiceActivity({
<Typography.Text> <Typography.Text>
{t("storeServices.serviceActivityResponsible")} {t("storeServices.serviceActivityResponsible")}
</Typography.Text> </Typography.Text>
<Typography.Text type="secondary">
{t("storeServices.serviceActivityResponsibleDescription")}
</Typography.Text>
<MyTable <MyTable
props={{ props={{

View File

@ -200,8 +200,6 @@ export function myFetch({
//window.location.href = "/"; //window.location.href = "/";
} }
console.warn("response status", response.status);
throw response.status; throw response.status;
} }