From e12e6c171c0eda27b0d0080d5145c58e3095058f Mon Sep 17 00:00:00 2001 From: Ehsan Date: Thu, 29 May 2025 05:07:11 +0330 Subject: [PATCH] handle register & retry code & edit phone number & fix bug select city and state & add basic modal to all tabs in dashboard --- app/clinics/page.js | 1 - app/component/element/AutoCompleteSelect.js | 4 +- app/component/modalSearchCity/index.js | 4 +- .../userAccount/components/AddBtn.js | 3 +- .../userAccount/tabs/allergies/index.js | 8 ++-- .../tabs/allergies/modal/Content.js | 27 +++++++++++ .../userAccount/tabs/allergies/modal/index.js | 45 +++++++++++++++++++ .../userAccount/tabs/familyHistory/index.js | 8 ++-- .../tabs/familyHistory/modal/index.js | 44 ++++++++++++++++++ .../userAccount/tabs/medications/index.js | 8 ++-- .../tabs/medications/modal/index.js | 44 ++++++++++++++++++ .../userAccount/tabs/relatives/index.js | 8 ++-- .../userAccount/tabs/relatives/modal/index.js | 44 ++++++++++++++++++ .../userAccount/tabs/surgeries/index.js | 8 ++-- .../userAccount/tabs/surgeries/modal/index.js | 44 ++++++++++++++++++ components/register/index.js | 1 + .../register/verificationPage/Recode.js | 36 ++++++++++++--- components/register/verificationPage/index.js | 10 ++++- 18 files changed, 313 insertions(+), 34 deletions(-) create mode 100644 components/dashboard/userAccount/tabs/allergies/modal/Content.js create mode 100644 components/dashboard/userAccount/tabs/allergies/modal/index.js create mode 100644 components/dashboard/userAccount/tabs/familyHistory/modal/index.js create mode 100644 components/dashboard/userAccount/tabs/medications/modal/index.js create mode 100644 components/dashboard/userAccount/tabs/relatives/modal/index.js create mode 100644 components/dashboard/userAccount/tabs/surgeries/modal/index.js diff --git a/app/clinics/page.js b/app/clinics/page.js index 4074d50..6250baa 100644 --- a/app/clinics/page.js +++ b/app/clinics/page.js @@ -12,7 +12,6 @@ export default async function Clinics() { ); const clinics = response.data.$data; - console.log(clinics); return ( diff --git a/app/component/element/AutoCompleteSelect.js b/app/component/element/AutoCompleteSelect.js index 202e9fe..53a34ef 100644 --- a/app/component/element/AutoCompleteSelect.js +++ b/app/component/element/AutoCompleteSelect.js @@ -11,6 +11,7 @@ function AutoCompleteSelect({ disabled = false, listboxProps, sendAll, + name, }) { return ( { if (provinceSelected) { const selectedState = states.find( - (state) => state.label === provinceSelected, + (state) => state.label === provinceSelected ); if (selectedState) { const stateId = selectedState.id; const filteredCities = cities.filter( - (city) => city.province_id === stateId, + (city) => city.province_id === stateId ); setFilteredCities(filteredCities); } diff --git a/components/dashboard/userAccount/components/AddBtn.js b/components/dashboard/userAccount/components/AddBtn.js index 0208d72..285cd8b 100644 --- a/components/dashboard/userAccount/components/AddBtn.js +++ b/components/dashboard/userAccount/components/AddBtn.js @@ -2,10 +2,11 @@ import PlusB from "@/components/icons/PlusB"; import { Button } from "@mui/material"; import React from "react"; -function AddBtn() { +function AddBtn({ handleOpen }) { return ( + + + + ); +} + +export default ModalAddAlergie; diff --git a/components/dashboard/userAccount/tabs/familyHistory/index.js b/components/dashboard/userAccount/tabs/familyHistory/index.js index bdb4acc..3e7d064 100644 --- a/components/dashboard/userAccount/tabs/familyHistory/index.js +++ b/components/dashboard/userAccount/tabs/familyHistory/index.js @@ -4,18 +4,18 @@ import EditB from "@/components/icons/EditB"; import TrashB from "@/components/icons/TrashB"; import { Button, TableCell, TableRow } from "@mui/material"; import Head from "../../components/Head"; -import AddBtn from "../../components/AddBtn"; -import UpdateBtn from "../../components/UpdateBtn"; +import { useState } from "react"; +import ModalAddHistory from "./modal"; function FamilyHistory({ data }) { const tableHead = ["ردیف", "بیماری", "نسبت خانوادگی", ""]; const centerTable = [0]; + const [open, setOpen] = useState(false); return (
- - + setOpen(true); + const handleClose = () => setOpen(false); + + return ( + <> + {/* Button Modal */} + <> + + + + + {/* Content Modal */} + +
+
+
+

اضافه کردن سابقه خانوادگی بیماری

+
+ {/* */} +
+ +
+
+ + ); +} + +export default ModalAddHistory; diff --git a/components/dashboard/userAccount/tabs/medications/index.js b/components/dashboard/userAccount/tabs/medications/index.js index b75e9cf..c4c25d1 100644 --- a/components/dashboard/userAccount/tabs/medications/index.js +++ b/components/dashboard/userAccount/tabs/medications/index.js @@ -4,18 +4,18 @@ import EditB from "@/components/icons/EditB"; import TrashB from "@/components/icons/TrashB"; import { Button, TableCell, TableRow } from "@mui/material"; import Head from "../../components/Head"; -import AddBtn from "../../components/AddBtn"; -import UpdateBtn from "../../components/UpdateBtn"; +import ModalAddMedications from "./modal"; +import { useState } from "react"; function Medications({ data }) { const tableHead = ["ردیف", "نام دارو", "دوز مصرفی", "تعداد و زمان مصرف", ""]; const centerTable = [0]; + const [open, setOpen] = useState(false); return (
- - + setOpen(true); + const handleClose = () => setOpen(false); + + return ( + <> + {/* Button Modal */} + <> + + + + + {/* Content Modal */} + +
+
+
+

اضافه کردن دارو های مصرفی

+
+ {/* */} +
+ +
+
+ + ); +} + +export default ModalAddMedications; diff --git a/components/dashboard/userAccount/tabs/relatives/index.js b/components/dashboard/userAccount/tabs/relatives/index.js index 3b26963..412b5ba 100644 --- a/components/dashboard/userAccount/tabs/relatives/index.js +++ b/components/dashboard/userAccount/tabs/relatives/index.js @@ -4,18 +4,18 @@ 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"; -import AddBtn from "../../components/AddBtn"; -import UpdateBtn from "../../components/UpdateBtn"; +import ModalAddRelatives from "./modal"; +import { useState } from "react"; function Relatives({ data }) { const tableHead = ["ردیف", "نام", "نسبت", "شماره تماس", "آدرس", ""]; const centerTable = [0]; + const [open, setOpen] = useState(false); return (
- - + setOpen(true); + const handleClose = () => setOpen(false); + + return ( + <> + {/* Button Modal */} + <> + + + + + {/* Content Modal */} + +
+
+
+

اضافه کردن بستگان

+
+ {/* */} +
+ +
+
+ + ); +} + +export default ModalAddRelatives; diff --git a/components/dashboard/userAccount/tabs/surgeries/index.js b/components/dashboard/userAccount/tabs/surgeries/index.js index 66590ef..799e30e 100644 --- a/components/dashboard/userAccount/tabs/surgeries/index.js +++ b/components/dashboard/userAccount/tabs/surgeries/index.js @@ -4,8 +4,8 @@ import EditB from "@/components/icons/EditB"; import TrashB from "@/components/icons/TrashB"; import { Button, TableCell, TableRow } from "@mui/material"; import Head from "../../components/Head"; -import AddBtn from "../../components/AddBtn"; -import UpdateBtn from "../../components/UpdateBtn"; +import ModalAddSurgeries from "./modal"; +import { useState } from "react"; function Surgeries({ data }) { const tableHead = [ @@ -16,12 +16,12 @@ function Surgeries({ data }) { "", ]; const centerTable = [0, 3]; + const [open, setOpen] = useState(false); return (
- - + setOpen(true); + const handleClose = () => setOpen(false); + + return ( + <> + {/* Button Modal */} + <> + + + + + {/* Content Modal */} + +
+
+
+

اضافه کردن جراحی

+
+ {/* */} +
+ +
+
+ + ); +} + +export default ModalAddSurgeries; diff --git a/components/register/index.js b/components/register/index.js index 90ecc46..79ae780 100644 --- a/components/register/index.js +++ b/components/register/index.js @@ -18,6 +18,7 @@ function RegisterPage({ matchedCity }) { num={num} uuid={uuid} setStep={false} + setUuid={setUuid} setIsSendMsg={setIsSendMsg} /> ) : ( diff --git a/components/register/verificationPage/Recode.js b/components/register/verificationPage/Recode.js index 0e81cb3..0d8dcf8 100644 --- a/components/register/verificationPage/Recode.js +++ b/components/register/verificationPage/Recode.js @@ -1,8 +1,10 @@ import RetryLogin from "@/components/icons/RetryLogin"; +import { changeNumToDefault } from "@/helper"; +import { request } from "@/services/response"; import { Button } from "@mui/material"; const time_resend_code = 120; -function Recode({ retryIcon, timer, setTimer }) { +function Recode({ retryIcon, timer, setUuid, num, setTimer }) { const handleTimer = () => { setTimer("loading"); setTimeout(() => { @@ -17,18 +19,38 @@ function Recode({ retryIcon, timer, setTimer }) { }, 1000); }; + const rotateIcon = () => { + retryIcon.current.classList.add("retry-icon"); + setTimeout(() => { + retryIcon.current && retryIcon.current.classList.remove("retry-icon"); + }, 1000); + }; + + const handleReq = () => { + rotateIcon(); + const interval = setInterval(() => { + rotateIcon(); + }, 1200); + request + .sendCode(changeNumToDefault(num), "") + .then((response) => { + clearInterval(interval); + if (response.uuid) { + setUuid(response.uuid); + handleTimer(); + } + }) + .catch(() => clearInterval(interval)); + }; + return ( - +