diff --git a/public/locales/de/translation.json b/public/locales/de/translation.json
index 424aba1..2ecc259 100644
--- a/public/locales/de/translation.json
+++ b/public/locales/de/translation.json
@@ -52,7 +52,9 @@
"passwordRequired": "Passwort ist erforderlich",
"passwordMinLength": "Passwort muss mindestens {{minLength}} Zeichen lang sein",
"calendarMaxFutureBookingDaysRequired": "Maximaler Buchungszeitraum ist erforderlich",
- "calendarMinEarliestBookingTimeRequired": "Minimaler frühester Buchungszeitpunkt ist erforderlich"
+ "calendarMinEarliestBookingTimeRequired": "Minimaler frühester Buchungszeitpunkt ist erforderlich",
+ "companyNameRequired": "Firmenname ist erforderlich",
+ "companyNameMinLength": "Firmenname muss mindestens {{minLength}} Zeichen lang sein"
},
"request": {
"inputsInvalid": {
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json
index bb025c6..c41647c 100644
--- a/public/locales/en/translation.json
+++ b/public/locales/en/translation.json
@@ -52,7 +52,9 @@
"passwordRequired": "Please enter your password",
"passwordMinLength": "Password must be at least {{minLength}} characters",
"calendarMaxFutureBookingDaysRequired": "Please enter the max. future booking days",
- "calendarMinEarliestBookingTimeRequired": "Please enter the min. earliest booking time"
+ "calendarMinEarliestBookingTimeRequired": "Please enter the min. earliest booking time",
+ "companyNameRequired": "Please enter the company name",
+ "companyNameMinLength": "Company name must be at least {{minLength}} characters"
},
"request": {
"inputsInvalid": {
diff --git a/src/Components/MyFormInputs/index.js b/src/Components/MyFormInputs/index.js
index 0bbe7fb..791e2dd 100644
--- a/src/Components/MyFormInputs/index.js
+++ b/src/Components/MyFormInputs/index.js
@@ -142,6 +142,28 @@ export function MyCalendarMinEarliestBookingTimeFormInput() {
);
}
+export function MyCompanyNameFormInput({ showSkeleton }) {
+ const { t } = useTranslation();
+
+ return (
+
+ );
+}
+
export function MyAvailableCheckFormInput({
propsFormItem,
propsInput,
diff --git a/src/Pages/Authentication/index.js b/src/Pages/Authentication/index.js
index c682408..f3e8361 100644
--- a/src/Pages/Authentication/index.js
+++ b/src/Pages/Authentication/index.js
@@ -20,6 +20,7 @@ import {
import { useEffect, useState } from "react";
import {
MyAccountNameFormInput,
+ MyCompanyNameFormInput,
MyPasswordFormInput,
MyUsernameFormInput,
} from "../../Components/MyFormInputs";
@@ -337,6 +338,7 @@ function SignUp({ notificationApi }) {
setIsRequesting(true);
let body = {
+ companyName: values.companyName,
accountName: values.accountName.toLocaleLowerCase(),
password: EncodeStringToBase64(values.password),
username: values.username,
@@ -375,6 +377,8 @@ function SignUp({ notificationApi }) {
rememberMe: false,
}}
>
+
+
diff --git a/src/Pages/Store/Settings/index.js b/src/Pages/Store/Settings/index.js
index d7ede98..564be2f 100644
--- a/src/Pages/Store/Settings/index.js
+++ b/src/Pages/Store/Settings/index.js
@@ -1,8 +1,11 @@
import { useEffect, useRef, useState } from "react";
-import { myFetch } from "../../../utils";
+import { myFetch, showInputsInvalidNotification } from "../../../utils";
import { useParams } from "react-router-dom";
import { Card, Form, notification } from "antd";
-import { MyFormInput } from "../../../Components/MyFormInputs";
+import {
+ MyCompanyNameFormInput,
+ MyFormInput,
+} from "../../../Components/MyFormInputs";
import { useTranslation } from "react-i18next";
import {
RequestState,
@@ -68,20 +71,28 @@ export default function StoreSettings() {
}
delayTimeout.current = setTimeout(() => {
- myFetch({
- url: `/store/${storeId}`,
- method: "POST",
- body: {
- name: companyName,
- phoneNumber,
- email,
- address,
- },
- notificationApi: notificationApi,
- t: t,
- })
- .then(() => setRequestState(RequestState.SUCCESS))
- .catch(() => setRequestState(RequestState.FAILED));
+ form
+ .validateFields()
+ .then(() => {
+ myFetch({
+ url: `/store/${storeId}`,
+ method: "POST",
+ body: {
+ name: companyName,
+ phoneNumber,
+ email,
+ address,
+ },
+ notificationApi: notificationApi,
+ t: t,
+ })
+ .then(() => setRequestState(RequestState.SUCCESS))
+ .catch(() => setRequestState(RequestState.FAILED));
+ })
+ .catch(() => {
+ setRequestState(RequestState.NOTHING);
+ showInputsInvalidNotification(notificationApi, t);
+ });
}, 500);
}, [companyName, phoneNumber, email, address]);
@@ -99,18 +110,14 @@ export default function StoreSettings() {
}
>
diff --git a/src/utils.js b/src/utils.js
index 7cc9bf5..38feab7 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -76,6 +76,8 @@ export const Constants = {
MAX_CALENDAR_EARLIEST_BOOKING_TIME: 60 * 24, // 24 hours in minutes
MIN_FEEDBACK_LENGTH: 10,
MAX_FEEDBACK_LENGTH: 1024,
+ MIN_COMPANY_NAME_LENGTH: 3,
+ MAX_COMPANY_NAME_LENGTH: 64,
},
DELAY_ACCOUNT_NAME_CHECK: 250,
CLARITY_PROJECT_ID: "kr0pale8uy",