company name

master
alex 2024-01-28 20:32:25 +01:00
parent 0f7ed023cb
commit 0c2cf8b12e
6 changed files with 65 additions and 24 deletions

View File

@ -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": {

View File

@ -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": {

View File

@ -142,6 +142,28 @@ export function MyCalendarMinEarliestBookingTimeFormInput() {
);
}
export function MyCompanyNameFormInput({ showSkeleton }) {
const { t } = useTranslation();
return (
<MyFormInput
formItemName="companyName"
label={t("common.companyName")}
inputPlaceholder={t("common.companyNamePlaceholder")}
showSkeleton={showSkeleton}
ruleMessageValueRequired={t("common.inputRules.companyNameRequired")}
ruleMessageValueMinLengthRequired={t(
"common.inputRules.companyNameMinLength",
{
minLength: Constants.GLOBALS.MIN_COMPANY_NAME_LENGTH,
}
)}
minLength={Constants.GLOBALS.MIN_COMPANY_NAME_LENGTH}
maxLength={Constants.GLOBALS.MAX_COMPANY_NAME_LENGTH}
/>
);
}
export function MyAvailableCheckFormInput({
propsFormItem,
propsInput,

View File

@ -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,
}}
>
<MyCompanyNameFormInput />
<MyUsernameFormInput />
<MyAccountNameFormInput hasFeedback={true} />

View File

@ -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,6 +71,9 @@ export default function StoreSettings() {
}
delayTimeout.current = setTimeout(() => {
form
.validateFields()
.then(() => {
myFetch({
url: `/store/${storeId}`,
method: "POST",
@ -82,6 +88,11 @@ export default function StoreSettings() {
})
.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() {
}
>
<Form form={form} requiredMark={false} layout="vertical">
<MyFormInput
formItemName="companyName"
label={t("common.companyName")}
inputPlaceholder={t("common.companyNamePlaceholder")}
showSkeleton={isRequesting}
/>
<MyCompanyNameFormInput showSkeleton={isRequesting} />
<MyFormInput
formItemName="phoneNumber"
label={t("common.companyPhoneNumber")}
inputPlaceholder={t("common.companyPhoneNumberPlaceholder")}
showSkeleton={isRequesting}
inputNotRequired
/>
<MyFormInput
@ -118,6 +125,7 @@ export default function StoreSettings() {
label={t("common.companyEmail")}
inputPlaceholder={t("common.companyEmailPlaceholder")}
showSkeleton={isRequesting}
inputNotRequired
/>
<MyFormInput
@ -126,6 +134,7 @@ export default function StoreSettings() {
inputType="textarea"
inputPlaceholder={t("common.companyAddressPlaceholder")}
showSkeleton={isRequesting}
inputNotRequired
/>
</Form>
</Card>

View File

@ -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",