update
parent
d7930f9f78
commit
2245fad297
|
@ -1,9 +1,8 @@
|
||||||
import { Button, Form, Input, InputNumber, Skeleton, Space } from "antd";
|
import { Form, Input, InputNumber, Skeleton } from "antd";
|
||||||
import { Constants, isEmailValid, myFetch } from "../../utils";
|
import { Constants, isEmailValid, myFetch } from "../../utils";
|
||||||
import { createElement, useRef } from "react";
|
import { createElement, useRef } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useAppContext } from "../../Contexts/AppContext";
|
import { useAppContext } from "../../Contexts/AppContext";
|
||||||
import { EditOutlined } from "@ant-design/icons";
|
|
||||||
|
|
||||||
export function MyUsernameFormInput({
|
export function MyUsernameFormInput({
|
||||||
propsFormItem,
|
propsFormItem,
|
||||||
|
@ -76,6 +75,7 @@ export function MyPasswordFormInput({
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MyEmailFormInput({
|
export function MyEmailFormInput({
|
||||||
|
inputNotRequired,
|
||||||
propsFormItem,
|
propsFormItem,
|
||||||
propsInput,
|
propsInput,
|
||||||
disableEmailCheck,
|
disableEmailCheck,
|
||||||
|
@ -88,6 +88,7 @@ export function MyEmailFormInput({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MyAvailableCheckFormInput
|
<MyAvailableCheckFormInput
|
||||||
|
inputNotRequired={inputNotRequired}
|
||||||
propsFormItem={propsFormItem}
|
propsFormItem={propsFormItem}
|
||||||
propsInput={propsInput}
|
propsInput={propsInput}
|
||||||
hasFeedback={hasFeedback}
|
hasFeedback={hasFeedback}
|
||||||
|
@ -123,29 +124,6 @@ export function MyEmailFormInput({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
export function MyEmailFormInput() {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MyFormInput
|
|
||||||
formItemName="email"
|
|
||||||
minLength={0}
|
|
||||||
maxLength={64}
|
|
||||||
label={t("common.email")}
|
|
||||||
ruleMessageValueRequired={t("common.inputRules.emailRequired")}
|
|
||||||
inputPlaceholder={t("common.emailPlaceholder")}
|
|
||||||
inputType="email"
|
|
||||||
formItemRules={[
|
|
||||||
{
|
|
||||||
type: "email",
|
|
||||||
message: t("common.inputRules.emailInvalid"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} */
|
|
||||||
|
|
||||||
export function MyCalendarMaxFutureBookingDaysFormInput({
|
export function MyCalendarMaxFutureBookingDaysFormInput({
|
||||||
formItemName = "calendarMaxFutureBookingDays",
|
formItemName = "calendarMaxFutureBookingDays",
|
||||||
}) {
|
}) {
|
||||||
|
@ -219,6 +197,7 @@ export function MyCompanyNameFormInput({ showSkeleton }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MyAvailableCheckFormInput({
|
export function MyAvailableCheckFormInput({
|
||||||
|
inputNotRequired,
|
||||||
propsFormItem,
|
propsFormItem,
|
||||||
propsInput,
|
propsInput,
|
||||||
formItemName,
|
formItemName,
|
||||||
|
@ -246,6 +225,7 @@ export function MyAvailableCheckFormInput({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MyFormInput
|
<MyFormInput
|
||||||
|
inputNotRequired={inputNotRequired}
|
||||||
propsFormItem={{
|
propsFormItem={{
|
||||||
...propsFormItem,
|
...propsFormItem,
|
||||||
hasFeedback: hasFeedback,
|
hasFeedback: hasFeedback,
|
||||||
|
@ -264,6 +244,10 @@ export function MyAvailableCheckFormInput({
|
||||||
...formItemRules,
|
...formItemRules,
|
||||||
() => ({
|
() => ({
|
||||||
validator(_, value) {
|
validator(_, value) {
|
||||||
|
if (inputNotRequired && !value) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!value ||
|
!value ||
|
||||||
!isValid(value) ||
|
!isValid(value) ||
|
||||||
|
|
|
@ -32,8 +32,6 @@ export function SideMenuContent({
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
console.log("selectedKeys", selectedKeys);
|
|
||||||
|
|
||||||
const getFirstMenuItems = () => {
|
const getFirstMenuItems = () => {
|
||||||
let items = [
|
let items = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -364,9 +364,10 @@ function ModalAddEditEmployee({
|
||||||
formUsername === modalOptions.selectedEmployee.username &&
|
formUsername === modalOptions.selectedEmployee.username &&
|
||||||
formEmail === modalOptions.selectedEmployee.email &&
|
formEmail === modalOptions.selectedEmployee.email &&
|
||||||
formCalendarMaxFutureBookingDays ===
|
formCalendarMaxFutureBookingDays ===
|
||||||
modalOptions.selectedEmployee.maxFutureBookingDays &&
|
modalOptions.selectedEmployee
|
||||||
|
.calendarMaxFutureBookingDays &&
|
||||||
formCalendarMinEarliestBookingTime ===
|
formCalendarMinEarliestBookingTime ===
|
||||||
modalOptions.selectedEmployee.minEarliestBookingTime
|
modalOptions.selectedEmployee.calendarMinEarliestBookingTime
|
||||||
) {
|
) {
|
||||||
handleModalClose();
|
handleModalClose();
|
||||||
return;
|
return;
|
||||||
|
@ -382,20 +383,21 @@ function ModalAddEditEmployee({
|
||||||
body.username = formUsername;
|
body.username = formUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"email",
|
||||||
|
formEmail,
|
||||||
|
modalOptions.selectedEmployee.email,
|
||||||
|
formEmail !== modalOptions.selectedEmployee.email
|
||||||
|
);
|
||||||
|
|
||||||
if (formEmail !== modalOptions.selectedEmployee.email) {
|
if (formEmail !== modalOptions.selectedEmployee.email) {
|
||||||
validateFields.push("email");
|
validateFields.push("email");
|
||||||
body.email = formEmail;
|
body.email = formEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
|
||||||
"max",
|
|
||||||
formCalendarMaxFutureBookingDays,
|
|
||||||
modalOptions.selectedEmployee.maxFutureBookingDays
|
|
||||||
);
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
formCalendarMaxFutureBookingDays !==
|
formCalendarMaxFutureBookingDays !==
|
||||||
modalOptions.selectedEmployee.maxFutureBookingDays
|
modalOptions.selectedEmployee.calendarMaxFutureBookingDays
|
||||||
) {
|
) {
|
||||||
validateFields.push("calendarMaxFutureBookingDays");
|
validateFields.push("calendarMaxFutureBookingDays");
|
||||||
body.calendarMaxFutureBookingDays =
|
body.calendarMaxFutureBookingDays =
|
||||||
|
@ -404,7 +406,7 @@ function ModalAddEditEmployee({
|
||||||
|
|
||||||
if (
|
if (
|
||||||
formCalendarMinEarliestBookingTime !==
|
formCalendarMinEarliestBookingTime !==
|
||||||
modalOptions.selectedEmployee.minEarliestBookingTime
|
modalOptions.selectedEmployee.calendarMinEarliestBookingTime
|
||||||
) {
|
) {
|
||||||
validateFields.push("calendarMinEarliestBookingTime");
|
validateFields.push("calendarMinEarliestBookingTime");
|
||||||
body.calendarMinEarliestBookingTime =
|
body.calendarMinEarliestBookingTime =
|
||||||
|
@ -449,7 +451,7 @@ function ModalAddEditEmployee({
|
||||||
>
|
>
|
||||||
<MyUsernameFormInput thirdPerson />
|
<MyUsernameFormInput thirdPerson />
|
||||||
|
|
||||||
<MyEmailFormInput hasFeedback thirdPerson />
|
<MyEmailFormInput inputNotRequired={true} hasFeedback thirdPerson />
|
||||||
|
|
||||||
{modalOptions.mode === "add" && (
|
{modalOptions.mode === "add" && (
|
||||||
<>
|
<>
|
||||||
|
|
Loading…
Reference in New Issue