Merge branch 'feature/maintainer' into 'develop'
add change phone number button and refer action in both login register of navy and welfare See merge request witel3/loan-facilities-user!13
This commit is contained in:
@@ -73,7 +73,7 @@
|
|||||||
"button_request_verification": "دریافت کد یکبارمصرف",
|
"button_request_verification": "دریافت کد یکبارمصرف",
|
||||||
"button_submit": "ورود",
|
"button_submit": "ورود",
|
||||||
"button_back_to_send_data": "بازگشت",
|
"button_back_to_send_data": "بازگشت",
|
||||||
"sent_token_to": "ارسال پیامک به شماره",
|
"sent_token_to": "ارسال کد یکبار مصرف به شماره",
|
||||||
"change_phone_number": "تغییر شماره"
|
"change_phone_number": "تغییر شماره"
|
||||||
},
|
},
|
||||||
"Dashboard": {
|
"Dashboard": {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import CenterLayout from "@/layouts/CenterLayout";
|
|||||||
import FullPageLayout from "@/layouts/FullPageLayout";
|
import FullPageLayout from "@/layouts/FullPageLayout";
|
||||||
import useDirection from "@/lib/app/hooks/useDirection";
|
import useDirection from "@/lib/app/hooks/useDirection";
|
||||||
import useUser from "@/lib/app/hooks/useUser";
|
import useUser from "@/lib/app/hooks/useUser";
|
||||||
|
import ChangeCircleIcon from "@mui/icons-material/ChangeCircle";
|
||||||
import LoginIcon from "@mui/icons-material/Login";
|
import LoginIcon from "@mui/icons-material/Login";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
@@ -22,7 +23,7 @@ import { useTranslations } from "next-intl";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|
||||||
const SendToken = ({ PhoneNumber }) => {
|
const SendToken = ({ PhoneNumber, setOtpToken }) => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { directionApp } = useDirection();
|
const { directionApp } = useDirection();
|
||||||
const { setToken } = useUser();
|
const { setToken } = useUser();
|
||||||
@@ -81,6 +82,25 @@ const SendToken = ({ PhoneNumber }) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<StyledForm sx={{ width: "100%" }}>
|
<StyledForm sx={{ width: "100%" }}>
|
||||||
<Stack spacing={3} sx={{ p: 2 }}>
|
<Stack spacing={3} sx={{ p: 2 }}>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography variant="button">
|
||||||
|
{t("RegisterPage.sent_token_to")}: {PhoneNumber}{" "}
|
||||||
|
</Typography>
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
startIcon={<ChangeCircleIcon />}
|
||||||
|
variant="outlined"
|
||||||
|
onClick={() => setOtpToken(false)}
|
||||||
|
>
|
||||||
|
{t("RegisterPage.change_phone_number")}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
name="verification_code"
|
name="verification_code"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import Image from "next/image";
|
|||||||
import { useSearchParams } from "next/navigation";
|
import { useSearchParams } from "next/navigation";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|
||||||
const SendUserData = ({ setOtpToken, setPhoneNumber }) => {
|
const SendUserData = ({ setOtpToken, setPhoneNumber, PhoneNumber }) => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { directionApp } = useDirection();
|
const { directionApp } = useDirection();
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ const SendUserData = ({ setOtpToken, setPhoneNumber }) => {
|
|||||||
const backUrlDecodedPath = searchParams.get("back_url");
|
const backUrlDecodedPath = searchParams.get("back_url");
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
phone_number: "",
|
phone_number: PhoneNumber,
|
||||||
};
|
};
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
phone_number: Yup.string().required(t("LoginPage.error_message_required")),
|
phone_number: Yup.string().required(t("LoginPage.error_message_required")),
|
||||||
|
|||||||
@@ -8,10 +8,14 @@ const LoginComponent = () => {
|
|||||||
|
|
||||||
if (!otpToken) {
|
if (!otpToken) {
|
||||||
return (
|
return (
|
||||||
<SendUserData setOtpToken={setOtpToken} setPhoneNumber={setPhoneNumber} />
|
<SendUserData
|
||||||
|
setOtpToken={setOtpToken}
|
||||||
|
setPhoneNumber={setPhoneNumber}
|
||||||
|
PhoneNumber={PhoneNumber}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return <SendToken PhoneNumber={PhoneNumber} />;
|
return <SendToken PhoneNumber={PhoneNumber} setOtpToken={setOtpToken} />;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import Image from "next/image";
|
|||||||
import { useSearchParams } from "next/navigation";
|
import { useSearchParams } from "next/navigation";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|
||||||
const SendUserData = ({ setOtpToken, setPhoneNumber }) => {
|
const SendUserData = ({ setOtpToken, setPhoneNumber, PhoneNumber }) => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { directionApp } = useDirection();
|
const { directionApp } = useDirection();
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ const SendUserData = ({ setOtpToken, setPhoneNumber }) => {
|
|||||||
const backUrlDecodedPath = searchParams.get("back_url");
|
const backUrlDecodedPath = searchParams.get("back_url");
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
phone_number: "",
|
phone_number: PhoneNumber,
|
||||||
};
|
};
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
phone_number: Yup.string().required(t("LoginPage.error_message_required")),
|
phone_number: Yup.string().required(t("LoginPage.error_message_required")),
|
||||||
|
|||||||
@@ -8,10 +8,14 @@ const LoginComponent = () => {
|
|||||||
|
|
||||||
if (!otpToken) {
|
if (!otpToken) {
|
||||||
return (
|
return (
|
||||||
<SendUserData setOtpToken={setOtpToken} setPhoneNumber={setPhoneNumber} />
|
<SendUserData
|
||||||
|
setOtpToken={setOtpToken}
|
||||||
|
setPhoneNumber={setPhoneNumber}
|
||||||
|
PhoneNumber={PhoneNumber}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return <SendToken PhoneNumber={PhoneNumber} />;
|
return <SendToken PhoneNumber={PhoneNumber} setOtpToken={setOtpToken} />;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import FullPageLayout from "@/layouts/FullPageLayout";
|
|||||||
import useDirection from "@/lib/app/hooks/useDirection";
|
import useDirection from "@/lib/app/hooks/useDirection";
|
||||||
import useUser from "@/lib/app/hooks/useUser";
|
import useUser from "@/lib/app/hooks/useUser";
|
||||||
import LoginIcon from "@mui/icons-material/Login";
|
import LoginIcon from "@mui/icons-material/Login";
|
||||||
|
import ChangeCircleIcon from "@mui/icons-material/ChangeCircle";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
@@ -22,7 +23,7 @@ import { useTranslations } from "next-intl";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|
||||||
const SendToken = ({ PhoneNumber }) => {
|
const SendToken = ({ PhoneNumber, setOtpToken }) => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { directionApp } = useDirection();
|
const { directionApp } = useDirection();
|
||||||
const { setToken } = useUser();
|
const { setToken } = useUser();
|
||||||
@@ -77,10 +78,29 @@ const SendToken = ({ PhoneNumber }) => {
|
|||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Typography margin={2} variant="h4" textAlign="center">
|
<Typography margin={2} variant="h4" textAlign="center">
|
||||||
{t("login_navy")}
|
{t("login_welfare_services")}
|
||||||
</Typography>
|
</Typography>
|
||||||
<StyledForm sx={{ width: "100%" }}>
|
<StyledForm sx={{ width: "100%" }}>
|
||||||
<Stack spacing={3} sx={{ p: 2 }}>
|
<Stack spacing={3} sx={{ p: 2 }}>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography variant="button">
|
||||||
|
{t("RegisterPage.sent_token_to")}: {PhoneNumber}{" "}
|
||||||
|
</Typography>
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
startIcon={<ChangeCircleIcon />}
|
||||||
|
variant="outlined"
|
||||||
|
onClick={() => setOtpToken(false)}
|
||||||
|
>
|
||||||
|
{t("RegisterPage.change_phone_number")}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
name="verification_code"
|
name="verification_code"
|
||||||
|
|||||||
@@ -7,13 +7,11 @@ import FullPageLayout from "@/layouts/FullPageLayout";
|
|||||||
import useDirection from "@/lib/app/hooks/useDirection";
|
import useDirection from "@/lib/app/hooks/useDirection";
|
||||||
import useUser from "@/lib/app/hooks/useUser";
|
import useUser from "@/lib/app/hooks/useUser";
|
||||||
import LoginIcon from "@mui/icons-material/Login";
|
import LoginIcon from "@mui/icons-material/Login";
|
||||||
import ReplyAllIcon from "@mui/icons-material/ReplyAll";
|
import ChangeCircleIcon from "@mui/icons-material/ChangeCircle";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
Container,
|
Container,
|
||||||
Grid,
|
|
||||||
Link,
|
|
||||||
Paper,
|
Paper,
|
||||||
Stack,
|
Stack,
|
||||||
TextField,
|
TextField,
|
||||||
@@ -25,7 +23,13 @@ import { useTranslations } from "next-intl";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|
||||||
const SendToken = ({ PhoneNumber, nationalId, navganId, typeId, setOtpToken }) => {
|
const SendToken = ({
|
||||||
|
PhoneNumber,
|
||||||
|
nationalId,
|
||||||
|
navganId,
|
||||||
|
typeId,
|
||||||
|
setOtpToken,
|
||||||
|
}) => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { directionApp } = useDirection();
|
const { directionApp } = useDirection();
|
||||||
const { setToken } = useUser();
|
const { setToken } = useUser();
|
||||||
@@ -90,6 +94,25 @@ const SendToken = ({ PhoneNumber, nationalId, navganId, typeId, setOtpToken }) =
|
|||||||
</Typography>
|
</Typography>
|
||||||
<StyledForm sx={{ width: "100%" }}>
|
<StyledForm sx={{ width: "100%" }}>
|
||||||
<Stack spacing={3} sx={{ p: 2 }}>
|
<Stack spacing={3} sx={{ p: 2 }}>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography variant="button">
|
||||||
|
{t("RegisterPage.sent_token_to")}: {PhoneNumber}{" "}
|
||||||
|
</Typography>
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
startIcon={<ChangeCircleIcon />}
|
||||||
|
variant="outlined"
|
||||||
|
onClick={() => setOtpToken(false)}
|
||||||
|
>
|
||||||
|
{t("RegisterPage.change_phone_number")}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
name="verification_code"
|
name="verification_code"
|
||||||
@@ -112,33 +135,6 @@ const SendToken = ({ PhoneNumber, nationalId, navganId, typeId, setOtpToken }) =
|
|||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
{/* <Grid
|
|
||||||
container
|
|
||||||
rowSpacing={{ xs: 1, sm: 0 }}
|
|
||||||
sx={{
|
|
||||||
flexDirection: { xs: "column-reverse", sm: "row" },
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Grid item xs={12} sm={6} sx={{ pr: { xs: 0, sm: 1 } }}>
|
|
||||||
<Button
|
|
||||||
fullWidth
|
|
||||||
type="back"
|
|
||||||
variant="outlined"
|
|
||||||
size="large"
|
|
||||||
onClick={() => setOtpToken(false)}
|
|
||||||
endIcon={<ReplyAllIcon />}
|
|
||||||
disabled={props.isSubmitting ? true : false}
|
|
||||||
>
|
|
||||||
{t("RegisterPage.button_back_to_send_data")}
|
|
||||||
</Button>
|
|
||||||
</Grid> */}
|
|
||||||
{/* <Grid item xs={12} sm={6} sx={{ pl: { xs: 0, sm: 1 } }}> */}
|
|
||||||
<Button size="small" onClick={() => setOtpToken(false)}>
|
|
||||||
<Link underline="hover">
|
|
||||||
{t("RegisterPage.sent_token_to")}: {PhoneNumber}{" "}
|
|
||||||
{t("RegisterPage.change_phone_number")}
|
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
<Button
|
<Button
|
||||||
fullWidth
|
fullWidth
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -149,8 +145,6 @@ const SendToken = ({ PhoneNumber, nationalId, navganId, typeId, setOtpToken }) =
|
|||||||
>
|
>
|
||||||
{t("RegisterPage.button_submit")}
|
{t("RegisterPage.button_submit")}
|
||||||
</Button>
|
</Button>
|
||||||
{/* </Grid> */}
|
|
||||||
{/* </Grid> */}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</StyledForm>
|
</StyledForm>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ const SendUserData = ({
|
|||||||
setPhoneNumber,
|
setPhoneNumber,
|
||||||
setNationalId,
|
setNationalId,
|
||||||
setTypeId,
|
setTypeId,
|
||||||
|
PhoneNumber,
|
||||||
|
nationalId,
|
||||||
}) => {
|
}) => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { directionApp } = useDirection();
|
const { directionApp } = useDirection();
|
||||||
@@ -36,8 +38,8 @@ const SendUserData = ({
|
|||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
type_id: "2",
|
type_id: "2",
|
||||||
phone_number: "",
|
phone_number: PhoneNumber,
|
||||||
national_id: "",
|
national_id: nationalId,
|
||||||
};
|
};
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
phone_number: Yup.string().required(
|
phone_number: Yup.string().required(
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ const RegisterNavyComponent = () => {
|
|||||||
const [otpToken, setOtpToken] = useState(false);
|
const [otpToken, setOtpToken] = useState(false);
|
||||||
const [PhoneNumber, setPhoneNumber] = useState("");
|
const [PhoneNumber, setPhoneNumber] = useState("");
|
||||||
const [nationalId, setNationalId] = useState("");
|
const [nationalId, setNationalId] = useState("");
|
||||||
const [navganId, setNavganId] = useState("");
|
|
||||||
const [typeId, setTypeId] = useState("");
|
const [typeId, setTypeId] = useState("");
|
||||||
|
|
||||||
if (!otpToken) {
|
if (!otpToken) {
|
||||||
@@ -16,6 +15,8 @@ const RegisterNavyComponent = () => {
|
|||||||
setPhoneNumber={setPhoneNumber}
|
setPhoneNumber={setPhoneNumber}
|
||||||
setNationalId={setNationalId}
|
setNationalId={setNationalId}
|
||||||
setTypeId={setTypeId}
|
setTypeId={setTypeId}
|
||||||
|
PhoneNumber={PhoneNumber}
|
||||||
|
nationalId={nationalId}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -24,6 +25,7 @@ const RegisterNavyComponent = () => {
|
|||||||
PhoneNumber={PhoneNumber}
|
PhoneNumber={PhoneNumber}
|
||||||
nationalId={nationalId}
|
nationalId={nationalId}
|
||||||
typeId={typeId}
|
typeId={typeId}
|
||||||
|
setOtpToken={setOtpToken}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import FullPageLayout from "@/layouts/FullPageLayout";
|
|||||||
import useDirection from "@/lib/app/hooks/useDirection";
|
import useDirection from "@/lib/app/hooks/useDirection";
|
||||||
import useUser from "@/lib/app/hooks/useUser";
|
import useUser from "@/lib/app/hooks/useUser";
|
||||||
import LoginIcon from "@mui/icons-material/Login";
|
import LoginIcon from "@mui/icons-material/Login";
|
||||||
|
import ChangeCircleIcon from "@mui/icons-material/ChangeCircle";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
@@ -21,7 +22,7 @@ import { useTranslations } from "next-intl";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|
||||||
const SendToken = ({ PhoneNumber, nationalId, typeId }) => {
|
const SendToken = ({ PhoneNumber, nationalId, typeId, setOtpToken }) => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { directionApp } = useDirection();
|
const { directionApp } = useDirection();
|
||||||
const { setToken } = useUser();
|
const { setToken } = useUser();
|
||||||
@@ -80,10 +81,29 @@ const SendToken = ({ PhoneNumber, nationalId, typeId }) => {
|
|||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Typography margin={2} variant="h4" textAlign="center">
|
<Typography margin={2} variant="h4" textAlign="center">
|
||||||
{t("register_navy")}
|
{t("register_welfare_services")}
|
||||||
</Typography>
|
</Typography>
|
||||||
<StyledForm sx={{ width: "100%" }}>
|
<StyledForm sx={{ width: "100%" }}>
|
||||||
<Stack spacing={3} sx={{ p: 2 }}>
|
<Stack spacing={3} sx={{ p: 2 }}>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography variant="button">
|
||||||
|
{t("RegisterPage.sent_token_to")}: {PhoneNumber}{" "}
|
||||||
|
</Typography>
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
startIcon={<ChangeCircleIcon />}
|
||||||
|
variant="outlined"
|
||||||
|
onClick={() => setOtpToken(false)}
|
||||||
|
>
|
||||||
|
{t("RegisterPage.change_phone_number")}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
<Field
|
<Field
|
||||||
as={TextField}
|
as={TextField}
|
||||||
name="verification_code"
|
name="verification_code"
|
||||||
|
|||||||
Reference in New Issue
Block a user