diff --git a/app/component/element/Field.js b/app/component/element/Field.js index 0257412..a4b2020 100644 --- a/app/component/element/Field.js +++ b/app/component/element/Field.js @@ -37,6 +37,7 @@ function Field({ }, "& .MuiInputBase-input": { padding: spaceNull ? "12.5px 0" : "12.5px 14px", + color: spaceNull && "#0009", }, "& .MuiInputBase-root": { borderRadius: "6px !important" }, "& .MuiOutlinedInput-notchedOutline": { diff --git a/app/panel/(layout)/dashboard/page.js b/app/panel/(layout)/dashboard/page.js index 7d2c7b6..dafec69 100644 --- a/app/panel/(layout)/dashboard/page.js +++ b/app/panel/(layout)/dashboard/page.js @@ -1,5 +1,3 @@ -"use client"; - import DashboardPage from "@/components/panel/dashboard"; import Information from "@/data/information.json"; diff --git a/components/dashboard/userAccount/ContentTabs.js b/components/dashboard/userAccount/ContentTabs.js deleted file mode 100644 index 5c5ddd2..0000000 --- a/components/dashboard/userAccount/ContentTabs.js +++ /dev/null @@ -1,131 +0,0 @@ -"use client"; - -import { useEffect, useState } from "react"; - -// Tabs -import Turns from "./tabs/turns"; -import DetailUser from "./tabs/detailUser"; -import Comments from "./tabs/comments"; -import Messages from "./tabs/messages"; -import Tabs from "@/app/component/Tabs"; -import Transactions from "./tabs/transactions"; -import IsTurnsDetails from "./tabs/turns/isTurnsDetails"; -import ArrowRightD from "@/components/icons/ArrowRightD"; -import { Button } from "@mui/material"; -import NotfoundDashboard from "./NotfoundDashboard"; -import DownloadD from "@/components/icons/DownloadD"; - -const listTab = [ - "حساب کاربری", - "نوبت های من", - "تراکنش های من", - "نظرات من", - "پیام ها", -]; - -function ContentTabs({ - user, - value, - isTurnsDetails, - setIsTurnsDetails, - setValue, - isOpenSide, - setIsOpenSide, -}) { - const [loading, setLoading] = useState(true); - const handleChange = (event, newValue) => setValue(newValue); - - useEffect(() => { - setTimeout(() => { - setLoading(false); - }, 2000); - }, []); - - const components = [ - , - , - , - , - , - , - ]; - - return ( -
-
- - {value === 1 && isTurnsDetails ? ( - - ) : undefined} -
- {isTurnsDetails ? ( - - ) : ( - <> -
- -
-
- {components[value]} -
- - )} -
- ); -} - -export default ContentTabs; diff --git a/components/dashboard/userAccount/UserAccount.js b/components/dashboard/userAccount/UserAccount.js index 033578b..9ddb45a 100644 --- a/components/dashboard/userAccount/UserAccount.js +++ b/components/dashboard/userAccount/UserAccount.js @@ -1,4 +1,4 @@ -import ContentTabs from "./ContentTabs"; +import ContentTabs from "./content"; import Head from "./Head"; import NotfoundDashboard from "./NotfoundDashboard"; diff --git a/components/dashboard/userAccount/content/HeadTab.js b/components/dashboard/userAccount/content/HeadTab.js new file mode 100644 index 0000000..03876a3 --- /dev/null +++ b/components/dashboard/userAccount/content/HeadTab.js @@ -0,0 +1,62 @@ +import Tabs from "@/app/component/Tabs"; +import IsTurnsDetails from "../sidebars/turns/isTurnsDetails"; + +function HeadTab({ + tab, + user, + listTab, + loading, + handleChange, + isTurnsDetails, + setIsTurnsDetails, + components, +}) { + + return ( + <> + {isTurnsDetails ? ( + + ) : ( + <> +
+ +
+
+ {components[tab]} +
+ + )} + + ); +} + +export default HeadTab; diff --git a/components/dashboard/userAccount/content/index.js b/components/dashboard/userAccount/content/index.js new file mode 100644 index 0000000..614e9bf --- /dev/null +++ b/components/dashboard/userAccount/content/index.js @@ -0,0 +1,111 @@ +"use client"; + +import { useEffect, useState } from "react"; + +import ArrowRightD from "@/components/icons/ArrowRightD"; +import { Button } from "@mui/material"; +import DownloadD from "@/components/icons/DownloadD"; +import Disease from "../tabs/disease"; +import Allergies from "../tabs/allergies"; +import Medications from "../tabs/medications"; +import Surgeries from "../tabs/surgeries"; +import FamilyHistory from "../tabs/familyHistory"; +import Relatives from "../tabs/relatives"; +import HeadTab from "./HeadTab"; + +import profileData from "@/data/profile_other.json"; + +const listTab = [ + "بیماری‌ها", + "آلرژی‌ها", + "داروهای مصرفی", + "جراحی‌ها", + "سابقه خانوادگی بیماری", + "بستگان", +]; + +function ContentTabs({ + user, + value, + isTurnsDetails, + setIsTurnsDetails, + setValue, + setIsOpenSide, +}) { + const [loading, setLoading] = useState(true); + const [tab, setTab] = useState(0); + + const handleChange = (event, newValue) => { + // setValue(newValue); + setTab(newValue); + }; + + useEffect(() => { + setTimeout(() => { + setLoading(false); + }, 2000); + }, []); + + const components = [ + // , + // , + // , + // , + // , + // , + , + , + , + , + , + , + ]; + + return ( +
+
+ + {value === 1 && isTurnsDetails ? ( + + ) : undefined} +
+ +
+ ); +} + +export default ContentTabs; diff --git a/components/dashboard/userAccount/tabs/comments/Comment.js b/components/dashboard/userAccount/sidebars/comments/Comment.js similarity index 100% rename from components/dashboard/userAccount/tabs/comments/Comment.js rename to components/dashboard/userAccount/sidebars/comments/Comment.js diff --git a/components/dashboard/userAccount/tabs/comments/index.js b/components/dashboard/userAccount/sidebars/comments/index.js similarity index 100% rename from components/dashboard/userAccount/tabs/comments/index.js rename to components/dashboard/userAccount/sidebars/comments/index.js diff --git a/components/dashboard/userAccount/tabs/comments/modal/index.js b/components/dashboard/userAccount/sidebars/comments/modal/index.js similarity index 100% rename from components/dashboard/userAccount/tabs/comments/modal/index.js rename to components/dashboard/userAccount/sidebars/comments/modal/index.js diff --git a/components/dashboard/userAccount/tabs/detailUser/Content.js b/components/dashboard/userAccount/sidebars/detailUser/Content.js similarity index 100% rename from components/dashboard/userAccount/tabs/detailUser/Content.js rename to components/dashboard/userAccount/sidebars/detailUser/Content.js diff --git a/components/dashboard/userAccount/tabs/detailUser/DateBirthday.js b/components/dashboard/userAccount/sidebars/detailUser/DateBirthday.js similarity index 100% rename from components/dashboard/userAccount/tabs/detailUser/DateBirthday.js rename to components/dashboard/userAccount/sidebars/detailUser/DateBirthday.js diff --git a/components/dashboard/userAccount/tabs/detailUser/Form.js b/components/dashboard/userAccount/sidebars/detailUser/Form.js similarity index 100% rename from components/dashboard/userAccount/tabs/detailUser/Form.js rename to components/dashboard/userAccount/sidebars/detailUser/Form.js diff --git a/components/dashboard/userAccount/tabs/detailUser/index.js b/components/dashboard/userAccount/sidebars/detailUser/index.js similarity index 100% rename from components/dashboard/userAccount/tabs/detailUser/index.js rename to components/dashboard/userAccount/sidebars/detailUser/index.js diff --git a/components/dashboard/userAccount/tabs/detailUser/listSelector.js b/components/dashboard/userAccount/sidebars/detailUser/listSelector.js similarity index 100% rename from components/dashboard/userAccount/tabs/detailUser/listSelector.js rename to components/dashboard/userAccount/sidebars/detailUser/listSelector.js diff --git a/components/dashboard/userAccount/tabs/messages/Message.js b/components/dashboard/userAccount/sidebars/messages/Message.js similarity index 100% rename from components/dashboard/userAccount/tabs/messages/Message.js rename to components/dashboard/userAccount/sidebars/messages/Message.js diff --git a/components/dashboard/userAccount/tabs/messages/index.js b/components/dashboard/userAccount/sidebars/messages/index.js similarity index 100% rename from components/dashboard/userAccount/tabs/messages/index.js rename to components/dashboard/userAccount/sidebars/messages/index.js diff --git a/components/dashboard/userAccount/tabs/transactions/Card.js b/components/dashboard/userAccount/sidebars/transactions/Card.js similarity index 100% rename from components/dashboard/userAccount/tabs/transactions/Card.js rename to components/dashboard/userAccount/sidebars/transactions/Card.js diff --git a/components/dashboard/userAccount/tabs/transactions/List.js b/components/dashboard/userAccount/sidebars/transactions/List.js similarity index 100% rename from components/dashboard/userAccount/tabs/transactions/List.js rename to components/dashboard/userAccount/sidebars/transactions/List.js diff --git a/components/dashboard/userAccount/tabs/transactions/index.js b/components/dashboard/userAccount/sidebars/transactions/index.js similarity index 100% rename from components/dashboard/userAccount/tabs/transactions/index.js rename to components/dashboard/userAccount/sidebars/transactions/index.js diff --git a/components/dashboard/userAccount/tabs/turns/Card.js b/components/dashboard/userAccount/sidebars/turns/Card.js similarity index 100% rename from components/dashboard/userAccount/tabs/turns/Card.js rename to components/dashboard/userAccount/sidebars/turns/Card.js diff --git a/components/dashboard/userAccount/tabs/turns/Head.js b/components/dashboard/userAccount/sidebars/turns/Head.js similarity index 100% rename from components/dashboard/userAccount/tabs/turns/Head.js rename to components/dashboard/userAccount/sidebars/turns/Head.js diff --git a/components/dashboard/userAccount/tabs/turns/List.js b/components/dashboard/userAccount/sidebars/turns/List.js similarity index 100% rename from components/dashboard/userAccount/tabs/turns/List.js rename to components/dashboard/userAccount/sidebars/turns/List.js diff --git a/components/dashboard/userAccount/tabs/turns/index.js b/components/dashboard/userAccount/sidebars/turns/index.js similarity index 100% rename from components/dashboard/userAccount/tabs/turns/index.js rename to components/dashboard/userAccount/sidebars/turns/index.js diff --git a/components/dashboard/userAccount/tabs/turns/isTurnsDetails/ButtonData.js b/components/dashboard/userAccount/sidebars/turns/isTurnsDetails/ButtonData.js similarity index 100% rename from components/dashboard/userAccount/tabs/turns/isTurnsDetails/ButtonData.js rename to components/dashboard/userAccount/sidebars/turns/isTurnsDetails/ButtonData.js diff --git a/components/dashboard/userAccount/tabs/turns/isTurnsDetails/DetailLg.js b/components/dashboard/userAccount/sidebars/turns/isTurnsDetails/DetailLg.js similarity index 100% rename from components/dashboard/userAccount/tabs/turns/isTurnsDetails/DetailLg.js rename to components/dashboard/userAccount/sidebars/turns/isTurnsDetails/DetailLg.js diff --git a/components/dashboard/userAccount/tabs/turns/isTurnsDetails/DetailSm.js b/components/dashboard/userAccount/sidebars/turns/isTurnsDetails/DetailSm.js similarity index 100% rename from components/dashboard/userAccount/tabs/turns/isTurnsDetails/DetailSm.js rename to components/dashboard/userAccount/sidebars/turns/isTurnsDetails/DetailSm.js diff --git a/components/dashboard/userAccount/tabs/turns/isTurnsDetails/Head.js b/components/dashboard/userAccount/sidebars/turns/isTurnsDetails/Head.js similarity index 100% rename from components/dashboard/userAccount/tabs/turns/isTurnsDetails/Head.js rename to components/dashboard/userAccount/sidebars/turns/isTurnsDetails/Head.js diff --git a/components/dashboard/userAccount/tabs/turns/isTurnsDetails/index.js b/components/dashboard/userAccount/sidebars/turns/isTurnsDetails/index.js similarity index 100% rename from components/dashboard/userAccount/tabs/turns/isTurnsDetails/index.js rename to components/dashboard/userAccount/sidebars/turns/isTurnsDetails/index.js diff --git a/components/dashboard/userAccount/tabs/turns/isTurnsDetails/modal/index.js b/components/dashboard/userAccount/sidebars/turns/isTurnsDetails/modal/index.js similarity index 100% rename from components/dashboard/userAccount/tabs/turns/isTurnsDetails/modal/index.js rename to components/dashboard/userAccount/sidebars/turns/isTurnsDetails/modal/index.js diff --git a/components/dashboard/userAccount/tabs/allergies/index.js b/components/dashboard/userAccount/tabs/allergies/index.js new file mode 100644 index 0000000..4bc21ea --- /dev/null +++ b/components/dashboard/userAccount/tabs/allergies/index.js @@ -0,0 +1,7 @@ +function Allergies() { + return ( +
Allergies
+ ) +} + +export default Allergies \ No newline at end of file diff --git a/components/dashboard/userAccount/tabs/disease/index.js b/components/dashboard/userAccount/tabs/disease/index.js new file mode 100644 index 0000000..6c479b2 --- /dev/null +++ b/components/dashboard/userAccount/tabs/disease/index.js @@ -0,0 +1,53 @@ +import CustomTable from "@/app/component/CustomTable"; +import CircularLoading from "@/app/component/loading/Circular"; +import TextLoading from "@/app/component/loading/Text"; +import { TableCell, TableRow } from "@mui/material"; + +function Disease({ data }) { + const tableHead = ["شماره", "اسم", "وضعیت"]; + const centerTable = [0, 4]; + + return ( +
+ + {data.map((row, idx) => ( + + + + {idx + 1} + + + + + {row.name} + + + + + {row.status} + + + + ))} + +
+ ); +} + +export default Disease; diff --git a/components/dashboard/userAccount/tabs/familyHistory/index.js b/components/dashboard/userAccount/tabs/familyHistory/index.js new file mode 100644 index 0000000..e0fd520 --- /dev/null +++ b/components/dashboard/userAccount/tabs/familyHistory/index.js @@ -0,0 +1,7 @@ +function FamilyHistory() { + return ( +
FamilyHistory
+ ) +} + +export default FamilyHistory \ No newline at end of file diff --git a/components/dashboard/userAccount/tabs/medications/index.js b/components/dashboard/userAccount/tabs/medications/index.js new file mode 100644 index 0000000..38a60a1 --- /dev/null +++ b/components/dashboard/userAccount/tabs/medications/index.js @@ -0,0 +1,7 @@ +function Medications() { + return ( +
Medications
+ ) +} + +export default Medications \ No newline at end of file diff --git a/components/dashboard/userAccount/tabs/relatives/index.js b/components/dashboard/userAccount/tabs/relatives/index.js new file mode 100644 index 0000000..74d9230 --- /dev/null +++ b/components/dashboard/userAccount/tabs/relatives/index.js @@ -0,0 +1,7 @@ +function Relatives() { + return ( +
Relatives
+ ) +} + +export default Relatives \ No newline at end of file diff --git a/components/dashboard/userAccount/tabs/surgeries/index.js b/components/dashboard/userAccount/tabs/surgeries/index.js new file mode 100644 index 0000000..1cf9106 --- /dev/null +++ b/components/dashboard/userAccount/tabs/surgeries/index.js @@ -0,0 +1,7 @@ +function Surgeries() { + return ( +
Surgeries
+ ) +} + +export default Surgeries \ No newline at end of file diff --git a/components/panel/dashboard/index.js b/components/panel/dashboard/index.js index 4a7ff5a..519e832 100644 --- a/components/panel/dashboard/index.js +++ b/components/panel/dashboard/index.js @@ -1,3 +1,5 @@ +"use client"; + import { useEffect, useState } from "react"; import Activities from "@/components/layoutPanel/userDetail/Activities"; diff --git a/components/register/LogInPage.js b/components/register/LogInPage.js index 4d378f3..465b498 100644 --- a/components/register/LogInPage.js +++ b/components/register/LogInPage.js @@ -1,5 +1,9 @@ import Field from "@/app/component/element/Field"; -import { changeNumToDefault, formatPhoneNumber, validatePhoneNumber } from "@/helper"; +import { + changeNumToDefault, + formatPhoneNumber, + validatePhoneNumber, +} from "@/helper"; import { request } from "@/services/response"; import { InputAdornment, Button } from "@mui/material"; import Link from "next/link"; @@ -13,7 +17,11 @@ function LogInPage({ setIsSendMsg, num, setNum, matchedCity }) { const formatted = formatPhoneNumber(val); const checkedNum = validatePhoneNumber(formatted); setError(checkedNum); + const digits = formatted.replace(/\D/g, ""); setNum(formatted); + if (digits.length === 9) { + handleReq(); + } }; const handleReq = () => { setLoading(true); @@ -21,7 +29,10 @@ function LogInPage({ setIsSendMsg, num, setNum, matchedCity }) { .sendCode(changeNumToDefault(num)) .then((response) => { setLoading(false); - if (response) setIsSendMsg(true); + if (response) { + setNum(""); + setIsSendMsg(true); + } }) .catch(() => { setLoading(false); diff --git a/components/register/SetCodePage.js b/components/register/SetCodePage.js index 6be6e5b..3b0c570 100644 --- a/components/register/SetCodePage.js +++ b/components/register/SetCodePage.js @@ -1,6 +1,5 @@ import { useRef, useState } from "react"; -import Link from "next/link"; import { Button } from "@mui/material"; import OTPForm from "./element/OTPForm"; import EditLogin from "../icons/EditLogin"; @@ -15,6 +14,7 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) { const retryIcon = useRef(); const [timer, setTimer] = useState(0); + const [loading, setLoading] = useState(false); const [code, setCode] = useState(["", "", "", ""]); const [isError, setIsError] = useState(false); const inputRefs = Array.from({ length: 5 }, () => useRef()); @@ -36,6 +36,9 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) { if (newCode.join("").length === 4 && isError) { setIsError(false); } + if (newCode.join("").length === 4) { + handleReq(); + } setCode(newCode); @@ -59,6 +62,7 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) { }; const handleReq = () => { + setLoading(true); request .getToken( "mobile", @@ -68,10 +72,10 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) { code.join("") ) .then((response) => { - console.log(response); + setLoading(false); }) .catch((err) => { - console.log(err); + setLoading(false); }); }; @@ -142,9 +146,7 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) { onClick={() => { if (!timer && timer !== "loading") { handleTimer(); - retryIcon.current.classList.add("retry-icon"); - setTimeout(() => { retryIcon.current && retryIcon.current.classList.remove("retry-icon"); @@ -171,6 +173,7 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) {