diff --git a/components/booking/index.js b/components/booking/index.js index 8f48411..77bb05e 100644 --- a/components/booking/index.js +++ b/components/booking/index.js @@ -12,7 +12,7 @@ import Detail from "@/components/booking/detail"; import FailedPay from "@/components/booking/failedPay"; import LogInPage from "@/components/register/LogInPage"; import SuccessPay from "@/components/booking/successPay"; -import SetCodePage from "@/components/register/SetCodePage"; +import VerificationPage from "@/components/register/verificationPage"; function BookingPage({ slug, matchedCity }) { const doctor = doctors.find((item) => item.id === +slug); @@ -29,7 +29,7 @@ function BookingPage({ slug, matchedCity }) { const elements = [ , , - , + , +

+ {text} +

+ + + ); +} + +export default Head; diff --git a/components/dashboard/userAccount/content/HeadTab.js b/components/dashboard/userAccount/content/HeadTab.js index 03876a3..2736fa8 100644 --- a/components/dashboard/userAccount/content/HeadTab.js +++ b/components/dashboard/userAccount/content/HeadTab.js @@ -11,7 +11,6 @@ function HeadTab({ setIsTurnsDetails, components, }) { - return ( <> {isTurnsDetails ? ( @@ -50,9 +49,7 @@ function HeadTab({ handleChange={handleChange} /> -
- {components[tab]} -
+
{components[tab]}
)} diff --git a/components/dashboard/userAccount/content/index.js b/components/dashboard/userAccount/content/index.js index 614e9bf..65675fe 100644 --- a/components/dashboard/userAccount/content/index.js +++ b/components/dashboard/userAccount/content/index.js @@ -34,6 +34,7 @@ function ContentTabs({ }) { const [loading, setLoading] = useState(true); const [tab, setTab] = useState(0); + const data = profileData[0]; const handleChange = (event, newValue) => { // setValue(newValue); @@ -57,12 +58,12 @@ function ContentTabs({ // , // , // , - , - , - , - , - , - , + , + , + , + , + , + , ]; return ( diff --git a/components/dashboard/userAccount/tabs/allergies/index.js b/components/dashboard/userAccount/tabs/allergies/index.js index 4bc21ea..83ce10d 100644 --- a/components/dashboard/userAccount/tabs/allergies/index.js +++ b/components/dashboard/userAccount/tabs/allergies/index.js @@ -1,7 +1,68 @@ -function Allergies() { +import CustomTable from "@/app/component/CustomTable"; +import TextLoading from "@/app/component/loading/Text"; +import EditB from "@/components/icons/EditB"; +import TrashB from "@/components/icons/TrashB"; +import { Button, TableCell, TableRow } from "@mui/material"; +import Head from "../../components/Head"; + +function Allergies({ data }) { + const tableHead = ["ردیف", "ماده آلرژی‌زا", "واکنش", "شدت", ""]; + const centerTable = [0]; + return ( -
Allergies
- ) +
+ + + {data.allergies.map((row, idx) => ( + + + + {idx + 1} + + + + + {row.substance} + + + + + {row.reaction} + + + + + {row.severity} + + + +
+ + +
+
+
+ ))} +
+
+ ); } -export default Allergies \ No newline at end of file +export default Allergies; diff --git a/components/dashboard/userAccount/tabs/disease/index.js b/components/dashboard/userAccount/tabs/disease/index.js index 6c479b2..323e68b 100644 --- a/components/dashboard/userAccount/tabs/disease/index.js +++ b/components/dashboard/userAccount/tabs/disease/index.js @@ -1,20 +1,23 @@ 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"; +import EditB from "@/components/icons/EditB"; +import TrashB from "@/components/icons/TrashB"; +import { Button, Switch, TableCell, TableRow } from "@mui/material"; +import Head from "../../components/Head"; function Disease({ data }) { - const tableHead = ["شماره", "اسم", "وضعیت"]; - const centerTable = [0, 4]; + const tableHead = ["ردیف", "اسم", "وضعیت", ""]; + const centerTable = [0]; return ( -
+
+ - {data.map((row, idx) => ( + {data.disease.map((row, idx) => ( - + {row.name} + + + {/* {row.status} */} + + + - - {row.status} - +
+ + +
))} diff --git a/components/dashboard/userAccount/tabs/familyHistory/index.js b/components/dashboard/userAccount/tabs/familyHistory/index.js index e0fd520..1ea29ed 100644 --- a/components/dashboard/userAccount/tabs/familyHistory/index.js +++ b/components/dashboard/userAccount/tabs/familyHistory/index.js @@ -1,7 +1,63 @@ -function FamilyHistory() { +import CustomTable from "@/app/component/CustomTable"; +import TextLoading from "@/app/component/loading/Text"; +import EditB from "@/components/icons/EditB"; +import TrashB from "@/components/icons/TrashB"; +import { Button, TableCell, TableRow } from "@mui/material"; +import Head from "../../components/Head"; + +function FamilyHistory({ data }) { + const tableHead = ["ردیف", "بیماری", "نسبت خانوادگی", ""]; + const centerTable = [0]; + return ( -
FamilyHistory
- ) +
+ + + {data.family_history.map((row, idx) => ( + + + + {idx + 1} + + + + + {row.disease} + + + + + {row.relation} + + + +
+ + +
+
+
+ ))} +
+
+ ); } -export default FamilyHistory \ No newline at end of file +export default FamilyHistory; diff --git a/components/dashboard/userAccount/tabs/medications/index.js b/components/dashboard/userAccount/tabs/medications/index.js index 38a60a1..3a74a24 100644 --- a/components/dashboard/userAccount/tabs/medications/index.js +++ b/components/dashboard/userAccount/tabs/medications/index.js @@ -1,7 +1,68 @@ -function Medications() { +import CustomTable from "@/app/component/CustomTable"; +import TextLoading from "@/app/component/loading/Text"; +import EditB from "@/components/icons/EditB"; +import TrashB from "@/components/icons/TrashB"; +import { Button, TableCell, TableRow } from "@mui/material"; +import Head from "../../components/Head"; + +function Medications({ data }) { + const tableHead = ["ردیف", "نام دارو", "دوز مصرفی", "تعداد و زمان مصرف", ""]; + const centerTable = [0]; + return ( -
Medications
- ) +
+ + + {data.medications.map((row, idx) => ( + + + + {idx + 1} + + + + + {row.name} + + + + + {row.dose} + + + + + {row.frequency} + + + +
+ + +
+
+
+ ))} +
+
+ ); } -export default Medications \ No newline at end of file +export default Medications; diff --git a/components/dashboard/userAccount/tabs/relatives/index.js b/components/dashboard/userAccount/tabs/relatives/index.js index 74d9230..933c4a6 100644 --- a/components/dashboard/userAccount/tabs/relatives/index.js +++ b/components/dashboard/userAccount/tabs/relatives/index.js @@ -1,7 +1,84 @@ -function Relatives() { +import CustomTable from "@/app/component/CustomTable"; +import TextLoading from "@/app/component/loading/Text"; +import EditB from "@/components/icons/EditB"; +import TrashB from "@/components/icons/TrashB"; +import { Button, TableCell, TableRow, Tooltip } from "@mui/material"; +import Head from "../../components/Head"; + +function Relatives({ data }) { + const tableHead = ["ردیف", "نام", "نسبت", "شماره تماس", "ایمیل", "آدرس", ""]; + const centerTable = [0]; + return ( -
Relatives
- ) +
+ + + {data.relatives.map((row, idx) => ( + + + + {idx + 1} + + + + + {row.name} + + + + + {row.relation} + + + + + {`${row.contact.phone?.replace("+", "")}+`} + + + + + {row.contact.email} + + + + +
+ + {(row.contact.address || "").substring(0, 15)} + {row.contact.address?.length > 15 ? "…" : ""} + +
+
+
+ + +
+ + +
+
+
+ ))} +
+
+ ); } -export default Relatives \ No newline at end of file +export default Relatives; diff --git a/components/dashboard/userAccount/tabs/surgeries/index.js b/components/dashboard/userAccount/tabs/surgeries/index.js index 1cf9106..6cf31ff 100644 --- a/components/dashboard/userAccount/tabs/surgeries/index.js +++ b/components/dashboard/userAccount/tabs/surgeries/index.js @@ -1,7 +1,77 @@ -function Surgeries() { +import CustomTable from "@/app/component/CustomTable"; +import TextLoading from "@/app/component/loading/Text"; +import EditB from "@/components/icons/EditB"; +import TrashB from "@/components/icons/TrashB"; +import { Button, TableCell, TableRow } from "@mui/material"; +import Head from "../../components/Head"; + +function Surgeries({ data }) { + const tableHead = [ + "ردیف", + "نوع جراحی", + "نام بیمارستان", + "سال انجام جراحی", + "", + ]; + const centerTable = [0, 3]; + return ( -
Surgeries
- ) +
+ + + {data.surgeries.map((row, idx) => ( + + + + {idx + 1} + + + + + {row.type} + + + + + {row.hospital} + + + + + {row.year} + + + +
+ + +
+
+
+ ))} +
+
+ ); } -export default Surgeries \ No newline at end of file +export default Surgeries; diff --git a/components/panel/userAccount/bank/head/modal/index.js b/components/panel/userAccount/bank/head/modal/index.js index 422c534..7ec63dd 100644 --- a/components/panel/userAccount/bank/head/modal/index.js +++ b/components/panel/userAccount/bank/head/modal/index.js @@ -2,7 +2,6 @@ import { useState } from "react"; import Form from "./Form"; import { styleDefault } from "@/mui"; import { Box, Button, Modal } from "@mui/material"; -import { validate_phone_number } from "./validate"; // Icons import PlusB from "@/components/icons/PlusB"; diff --git a/components/register/ContentVerify.js b/components/register/ContentVerify.js index 98ff167..feece55 100644 --- a/components/register/ContentVerify.js +++ b/components/register/ContentVerify.js @@ -1,7 +1,7 @@ "use client"; import RegisterPage from "@/components/register"; -import SetCodePage from "@/components/register/SetCodePage"; +import VerificationPage from "@/components/register/verificationPage"; import LogInPage from "@/components/register/LogInPage"; import { useState } from "react"; @@ -11,7 +11,7 @@ function ContentVerify() { return ( {isSendMsg ? ( - diff --git a/components/register/LogInPage.js b/components/register/LogInPage.js index 573c234..c52e775 100644 --- a/components/register/LogInPage.js +++ b/components/register/LogInPage.js @@ -25,38 +25,37 @@ function LogInPage({ setIsSendMsg, num, setNum, matchedCity }) { // } }; const handleReq = async () => { - try { - const res = await axios.post( - "https://back-dev.clinic-pro.ir/api/v1/user/auth?_format=json", - { mobile_number: changeNumToDefault(num) }, - { - withCredentials: true, - headers: { - "Content-Type": "application/json", - }, - } - ); - console.log(res); - if (res.data) { - setIsSendMsg(true); - } - } catch (err) { - console.error("Request failed:", err); - } - - // setLoading(true); - // request - // .sendCode(changeNumToDefault(num)) - // .then((response) => { - // setLoading(false); - // if (response) { - // // setNum(""); - // setIsSendMsg(true); + // try { + // const res = await axios.post( + // "https://back-dev.clinic-pro.ir/api/v1/user/auth?_format=json", + // { mobile_number: changeNumToDefault(num) }, + // { + // withCredentials: true, + // headers: { + // "Content-Type": "application/json", + // }, // } - // }) - // .catch(() => { - // setLoading(false); - // }); + // ); + // console.log(res); + // if (res.data) { + // setIsSendMsg(true); + // } + // } catch (err) { + // console.error("Request failed:", err); + // } + setLoading(true); + request + .sendCode(changeNumToDefault(num)) + .then((response) => { + setLoading(false); + if (response) { + // setNum(""); + setIsSendMsg(true); + } + }) + .catch(() => { + setLoading(false); + }); }; return ( diff --git a/components/register/index.js b/components/register/index.js index 0231d9c..3c58af3 100644 --- a/components/register/index.js +++ b/components/register/index.js @@ -1,6 +1,6 @@ "use client"; -import SetCodePage from "@/components/register/SetCodePage"; +import VerificationPage from "@/components/register/verificationPage"; import LogInPage from "@/components/register/LogInPage"; import { useState } from "react"; import LayoutRegister from "./LayoutRegister"; @@ -12,7 +12,7 @@ function RegisterPage({ matchedCity }) { return ( {isSendMsg ? ( - { + setTimer("loading"); + setTimeout(() => { + setTimer(time_resend_code); + let timePresent = time_resend_code; + const timerInterval = setInterval(() => { + timePresent--; + setTimer(timePresent); + + !timePresent && clearInterval(timerInterval); + }, 1000); + }, 1000); + }; + + return ( + + ); +} + +export default Recode; diff --git a/components/register/SetCodePage.js b/components/register/verificationPage/index.js similarity index 56% rename from components/register/SetCodePage.js rename to components/register/verificationPage/index.js index 1df045f..0b78b89 100644 --- a/components/register/SetCodePage.js +++ b/components/register/verificationPage/index.js @@ -1,17 +1,14 @@ import { useRef, useState } from "react"; import { Button } from "@mui/material"; -import OTPForm from "./element/OTPForm"; -import EditLogin from "../icons/EditLogin"; -import RetryLogin from "../icons/RetryLogin"; -import ArrowRightS from "../icons/ArrowRightS"; +import OTPForm from "../element/OTPForm"; +import EditLogin from "../../icons/EditLogin"; +import ArrowRightS from "../../icons/ArrowRightS"; import { request } from "@/services/response"; import { changeNumToDefault } from "@/helper"; -import axios from "axios"; +import Recode from "./Recode"; -const time_resend_code = 120; - -function SetCodePage({ setIsSendMsg, link, num, setStep }) { +function VerificationPage({ setIsSendMsg, link, num, setStep }) { const retryIcon = useRef(); const [timer, setTimer] = useState(0); @@ -48,58 +45,45 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) { } }; - const handleTimer = () => { - setTimer("loading"); - setTimeout(() => { - setTimer(time_resend_code); - let timePresent = time_resend_code; - const timerInterval = setInterval(() => { - timePresent--; - setTimer(timePresent); - - !timePresent && clearInterval(timerInterval); - }, 1000); - }, 1000); - }; - const handleReq = async () => { - const formData = new URLSearchParams(); - formData.append("grant_type", "mobile"); - formData.append("client_id", process.env.NEXT_PUBLIC_CLIENT_ID); - formData.append("client_secret", process.env.NEXT_PUBLIC_CLIENT_SECRET); - formData.append("mobile_number", changeNumToDefault(num)); - formData.append("code", code.join("")); + // const formData = new URLSearchParams(); + // formData.append("grant_type", "mobile"); + // formData.append("client_id", process.env.NEXT_PUBLIC_CLIENT_ID); + // formData.append("client_secret", process.env.NEXT_PUBLIC_CLIENT_SECRET); + // formData.append("mobile_number", changeNumToDefault(num)); + // formData.append("code", code.join("")); - try { - const res = await axios.post( - "https://back-dev.clinic-pro.ir/oauth/token", - formData, - { - withCredentials: true, - headers: { - "Content-Type": "application/x-www-form-urlencoded", - }, - } - ); - console.log(res); - } catch (err) { - console.error("Request failed:", err); - } - // setLoading(true); - // request - // .getToken( - // "mobile", - // process.env.NEXT_PUBLIC_CLIENT_ID, - // process.env.NEXT_PUBLIC_CLIENT_SECRET, - // changeNumToDefault(num), - // code.join("") - // ) - // .then((response) => { - // setLoading(false); - // }) - // .catch((err) => { - // setLoading(false); - // }); + // try { + // const res = await axios.post( + // "https://back-dev.clinic-pro.ir/oauth/token", + // formData, + // { + // withCredentials: true, + // headers: { + // "Content-Type": "application/x-www-form-urlencoded", + // }, + // } + // ); + // console.log(res); + // } catch (err) { + // console.error("Request failed:", err); + // } + + setLoading(true); + request + .getToken( + "mobile", + process.env.NEXT_PUBLIC_CLIENT_ID, + process.env.NEXT_PUBLIC_CLIENT_SECRET, + changeNumToDefault(num), + code.join("") + ) + .then((response) => { + setLoading(false); + }) + .catch((err) => { + setLoading(false); + }); }; return ( @@ -120,7 +104,7 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) { کد تایید را وارد نمایید

- کد تایید برای شماره 09013261200 ارسال شد. + کد تایید برای شماره 09{num} ارسال شد.

@@ -163,35 +147,7 @@ function SetCodePage({ setIsSendMsg, link, num, setStep }) {

- +