handle limit page dashboard & change header profile user & get data from api in page clinics & clinic item and doctor item
This commit is contained in:
@@ -47,7 +47,7 @@ function HeadTab({
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-[22px] px-0 md:px-[24px]">{components[tab]}</div>
|
||||
<div className="my-[22px] px-0 md:px-[24px]">{components[tab]}</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import profileData from "@/data/profile_other.json";
|
||||
|
||||
import ArrowRightD from "@/components/icons/ArrowRightD";
|
||||
import { Button } from "@mui/material";
|
||||
import DownloadD from "@/components/icons/DownloadD";
|
||||
import Disease from "../detailUser/disease";
|
||||
import Allergies from "../detailUser/allergies";
|
||||
import Medications from "../detailUser/medications";
|
||||
import Surgeries from "../detailUser/surgeries";
|
||||
import FamilyHistory from "../detailUser/familyHistory";
|
||||
import Relatives from "../detailUser/relatives";
|
||||
import HeadTab from "./HeadTab";
|
||||
|
||||
import DetailUser from "../detailUser/information";
|
||||
import Turns from "../sidebars/turns";
|
||||
import Transactions from "../sidebars/transactions";
|
||||
import Comments from "../sidebars/comments";
|
||||
import Messages from "../sidebars/messages";
|
||||
import NotfoundDashboard from "../NotfoundDashboard";
|
||||
|
||||
const listTab = [
|
||||
"بیماریها",
|
||||
"آلرژیها",
|
||||
"داروهای مصرفی",
|
||||
"جراحیها",
|
||||
"سابقه خانوادگی بیماری",
|
||||
"بستگان",
|
||||
];
|
||||
|
||||
function ContentTabs({
|
||||
user,
|
||||
value,
|
||||
isTurnsDetails,
|
||||
setIsTurnsDetails,
|
||||
setValue,
|
||||
setIsOpenSide,
|
||||
}) {
|
||||
const [tab, setTab] = useState(0);
|
||||
const [data, setData] = useState(profileData[0]);
|
||||
|
||||
const handleChange = (_, newValue) => setTab(newValue);
|
||||
const changeData = (action, name, id, payload) => {
|
||||
const newData = {
|
||||
...data,
|
||||
[name]: [...data[name]],
|
||||
};
|
||||
|
||||
switch (action) {
|
||||
case "update":
|
||||
newData[name][id] = payload;
|
||||
break;
|
||||
|
||||
case "add":
|
||||
newData[name].push(payload);
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
newData[name].splice(id, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.warn(`Unknown action: ${action}`);
|
||||
return;
|
||||
}
|
||||
setData(newData);
|
||||
};
|
||||
|
||||
const components = [
|
||||
// <Disease data={data} changeData={changeData} />,
|
||||
// <Allergies data={data} changeData={changeData} />,
|
||||
// <Medications data={data} changeData={changeData} />,
|
||||
// <Surgeries data={data} changeData={changeData} />,
|
||||
// <FamilyHistory data={data} changeData={changeData} />,
|
||||
// <Relatives data={data} changeData={changeData} />,
|
||||
|
||||
<DetailUser
|
||||
user={user}
|
||||
isTurnsDetails={isTurnsDetails}
|
||||
setIsTurnsDetails={setIsTurnsDetails}
|
||||
/>,
|
||||
<Turns user={user} loading={false} setIsTurnsDetails={setIsTurnsDetails} />,
|
||||
<Transactions user={user} loading={false} />,
|
||||
<Comments user={user} loading={false} />,
|
||||
<Messages user={user} loading={false} />,
|
||||
<NotfoundDashboard />,
|
||||
];
|
||||
|
||||
return (
|
||||
<div
|
||||
className="md:mt-[12px] lg:mt-[24px] md:pt-[12px] pb-[24px] w-full rounded-[8px]
|
||||
shadow-none md:shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)]
|
||||
bg-transparent md:bg-[#FFF]"
|
||||
>
|
||||
<div className="w-full flex items-center justify-between">
|
||||
<Button
|
||||
className="!flex !p-1 md:!hidden !items-center !justify-start !gap-[8px]"
|
||||
onClick={() =>
|
||||
isTurnsDetails ? setIsTurnsDetails(false) : setIsOpenSide(true)
|
||||
}
|
||||
variant="text"
|
||||
>
|
||||
<ArrowRightD />
|
||||
<p className="text-[#525252] text-[14px] font-bold">
|
||||
{isTurnsDetails ? "جزئیات نوبت " : listTab[value]}
|
||||
</p>
|
||||
</Button>
|
||||
{value === 1 && isTurnsDetails ? (
|
||||
<Button
|
||||
className="!flex md:!hidden !py-[8px] !px-[12px] !text-[#616161] !text-[14px] !font-medium !justify-center !items-center !gap-[4px]"
|
||||
variant="text"
|
||||
>
|
||||
<DownloadD />
|
||||
دانلود اطلاعات نوبت
|
||||
</Button>
|
||||
) : undefined}
|
||||
</div>
|
||||
<div className="mt-[22px] px-0 md:px-[24px]">{components[value]}</div>
|
||||
{/* <HeadTab
|
||||
tab={tab}
|
||||
user={user}
|
||||
listTab={listTab}
|
||||
components={components}
|
||||
handleChange={handleChange}
|
||||
isTurnsDetails={isTurnsDetails}
|
||||
setIsTurnsDetails={setIsTurnsDetails}
|
||||
/> */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ContentTabs;
|
||||
Reference in New Issue
Block a user