change response file & request get user-profile & change design dashboard page & handle limit page dashboard
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import ModalDeleteItem from "@/components/dashboard/userAccount/components/modal/ModalDeleteItem";
|
||||
import TextLoading from "@/app/component/loading/Text";
|
||||
import { TableCell, TableRow } from "@mui/material";
|
||||
import ModalEditItem from "@/components/dashboard/userAccount/components/modal/ModalEditItem";
|
||||
import Content from "./modal/Content";
|
||||
import { useState } from "react";
|
||||
|
||||
function ItemAllergie({ row, idx, changeData }) {
|
||||
const contentData = {
|
||||
substance: row.substance,
|
||||
reaction: row.reaction,
|
||||
severity: row.severity,
|
||||
};
|
||||
const [data, setData] = useState(contentData);
|
||||
const resetData = () => setData(contentData);
|
||||
|
||||
return (
|
||||
<TableRow className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent">
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="center"
|
||||
>
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{idx + 1}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.substance}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.reaction}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.severity}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="right"
|
||||
>
|
||||
<div className="flex items-center justify-center gap-[4px]">
|
||||
<ModalDeleteItem id={idx} name="allergies" changeData={changeData} />
|
||||
<ModalEditItem
|
||||
id={idx}
|
||||
data={data}
|
||||
title="آلرژی"
|
||||
name="allergies"
|
||||
resetData={resetData}
|
||||
changeData={changeData}
|
||||
>
|
||||
<Content data={data} setData={setData} />
|
||||
</ModalEditItem>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
|
||||
export default ItemAllergie;
|
||||
@@ -0,0 +1,45 @@
|
||||
import CustomTable from "@/app/component/CustomTable";
|
||||
import Head from "@/components/dashboard/userAccount/components/Head";
|
||||
import { useState } from "react";
|
||||
import ItemAllergie from "./ItemAllergie";
|
||||
import ModalAddAlergie from "./modal";
|
||||
|
||||
function Allergies({ data, changeData }) {
|
||||
const tableHead = ["ردیف", "ماده آلرژیزا", "واکنش", "شدت", ""];
|
||||
const centerTable = [0];
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
<Head text="لیست آلرژی ها">
|
||||
<ModalAddAlergie
|
||||
open={open}
|
||||
setOpen={setOpen}
|
||||
changeData={changeData}
|
||||
/>
|
||||
</Head>
|
||||
{data.allergies.length ? (
|
||||
<CustomTable
|
||||
zeroRadius={true}
|
||||
tableHead={tableHead}
|
||||
centerTable={centerTable}
|
||||
>
|
||||
{data.allergies.map((row, idx) => (
|
||||
<ItemAllergie
|
||||
key={idx}
|
||||
row={row}
|
||||
idx={idx}
|
||||
changeData={changeData}
|
||||
/>
|
||||
))}
|
||||
</CustomTable>
|
||||
) : (
|
||||
<p className="text-center py-10 text-gray-500">
|
||||
هیچ آلرژیای وجود ندارد!
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Allergies;
|
||||
@@ -0,0 +1,50 @@
|
||||
import FieldLabel from "@/components/contactUs/FieldLabel";
|
||||
import Field from "@/app/component/Field";
|
||||
import AutoSelector from "@/app/component/element/AutoSelector";
|
||||
|
||||
const listIntensity = [
|
||||
{ label: "شدید" },
|
||||
{ label: "متوسط" },
|
||||
{ label: "خفیف" },
|
||||
];
|
||||
|
||||
function Content({ setData, data }) {
|
||||
const handleChange = (name, value) =>
|
||||
setData((prev) => ({ ...prev, [name]: value }));
|
||||
|
||||
return (
|
||||
<div className="mt-[32px] md:mt-[36px] lg:mt-[40px] flex flex-col gap-[24px] md:gap-[28px] lg:gap-[32px] px-0 sm:px-[52px]">
|
||||
<FieldLabel title="ماده آلرژیزا">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="substance"
|
||||
isPlaceHolder={true}
|
||||
value={data?.substance}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
<FieldLabel title="واکنش">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="reaction"
|
||||
isPlaceHolder={true}
|
||||
value={data?.reaction}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
<FieldLabel title="ماده آلرژیزا">
|
||||
<AutoSelector
|
||||
label="شدت"
|
||||
name="severity"
|
||||
list={listIntensity}
|
||||
value={data?.severity}
|
||||
updateData={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Content;
|
||||
@@ -0,0 +1,67 @@
|
||||
import { styleDefault } from "@/mui";
|
||||
import AddBtn from "@/components/dashboard/userAccount/components/AddBtn";
|
||||
import UpdateBtn from "@/components/dashboard/userAccount/components/UpdateBtn";
|
||||
import { Button, Modal } from "@mui/material";
|
||||
import Content from "./Content";
|
||||
import { useState } from "react";
|
||||
|
||||
function ModalAddAlergie({ open, setOpen, changeData }) {
|
||||
const contentItem = {
|
||||
substance: "",
|
||||
reaction: "",
|
||||
severity: "",
|
||||
};
|
||||
|
||||
const handleOpen = () => setOpen(true);
|
||||
const handleClose = () => setOpen(false);
|
||||
const [newItem, setNewItem] = useState({
|
||||
substance: "",
|
||||
reaction: "",
|
||||
severity: "",
|
||||
});
|
||||
const handleAddData = () => {
|
||||
changeData("add", "allergies", null, newItem);
|
||||
setNewItem(contentItem);
|
||||
handleClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Button Modal */}
|
||||
<>
|
||||
<UpdateBtn />
|
||||
<AddBtn handleOpen={handleOpen} />
|
||||
</>
|
||||
|
||||
{/* Content Modal */}
|
||||
<Modal open={open} onClose={handleClose} className="w-full">
|
||||
<div
|
||||
style={styleDefault}
|
||||
className="!px-[16px] !overflow-auto md:!min-w-[580px] md:!px-[24px] lg:!px-[32px] !py-[24px] !bg-[#FFF] !rounded-[8px] !shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)]
|
||||
!w-full md:!w-fit !h-full md:!h-fit !flex !flex-col !justify-between !max-h-screen md:!max-h-[calc(100%_-_32px)]"
|
||||
>
|
||||
<div>
|
||||
<div className="flex justify-between w-full">
|
||||
<p className="text-[#3B3B3B] text-[20px] font-bold">
|
||||
اضافه کردن آلرژی
|
||||
</p>
|
||||
</div>
|
||||
<Content setData={setNewItem} />
|
||||
</div>
|
||||
<Button
|
||||
className="!mt-[32px] md:!mt-[36px] lg:!mt-[40px] !px-3 !py-2 !text-[16px] !font-medium !w-fit !mr-auto"
|
||||
onClick={handleAddData}
|
||||
disabled={
|
||||
!newItem.reaction || !newItem.severity || !newItem.substance
|
||||
}
|
||||
variant="contained"
|
||||
>
|
||||
اضافه کردن
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default ModalAddAlergie;
|
||||
@@ -0,0 +1,58 @@
|
||||
import CustomTable from "@/app/component/CustomTable";
|
||||
import TextLoading from "@/app/component/loading/Text";
|
||||
import { Switch, TableCell, TableRow } from "@mui/material";
|
||||
import Head from "@/components/dashboard/userAccount/components/Head";
|
||||
import UpdateBtn from "@/components/dashboard/userAccount/components/UpdateBtn";
|
||||
|
||||
function Disease({ data, changeData }) {
|
||||
const tableHead = ["ردیف", "اسم", "وضعیت", ""];
|
||||
const centerTable = [0];
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
<Head text="لیست بیماری ها" add={false}>
|
||||
<UpdateBtn />
|
||||
</Head>
|
||||
<CustomTable
|
||||
zeroRadius={true}
|
||||
tableHead={tableHead}
|
||||
centerTable={centerTable}
|
||||
>
|
||||
{data.disease.map((row, idx) => (
|
||||
<TableRow
|
||||
key={idx}
|
||||
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
|
||||
>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="center"
|
||||
>
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{idx + 1}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.name}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
<Switch
|
||||
defaultChecked={row.status === "true"}
|
||||
onChange={(e) => {
|
||||
const newData = row;
|
||||
newData.status = JSON.stringify(e.target.checked);
|
||||
changeData("update", "disease", idx, newData);
|
||||
}}
|
||||
/>
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</CustomTable>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Disease;
|
||||
@@ -0,0 +1,65 @@
|
||||
import ModalDeleteItem from "@/components/dashboard/userAccount/components/modal/ModalDeleteItem";
|
||||
import TextLoading from "@/app/component/loading/Text";
|
||||
import { TableCell, TableRow } from "@mui/material";
|
||||
import ModalEditItem from "@/components/dashboard/userAccount/components/modal/ModalEditItem";
|
||||
import Content from "./modal/Content";
|
||||
import { useState } from "react";
|
||||
|
||||
function ItemHistory({ row, idx, changeData }) {
|
||||
const contentData = {
|
||||
relation: row.relation,
|
||||
disease: row.disease,
|
||||
};
|
||||
const [data, setData] = useState(contentData);
|
||||
const resetData = () => setData(contentData);
|
||||
|
||||
return (
|
||||
<TableRow
|
||||
key={idx}
|
||||
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
|
||||
>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="center"
|
||||
>
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{idx + 1}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.relation}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.disease}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="right"
|
||||
>
|
||||
<div className="flex items-center justify-center gap-[4px]">
|
||||
<ModalDeleteItem
|
||||
id={idx}
|
||||
name="family_history"
|
||||
changeData={changeData}
|
||||
/>
|
||||
<ModalEditItem
|
||||
id={idx}
|
||||
data={data}
|
||||
title="سابقه خانوادگی"
|
||||
name="family_history"
|
||||
resetData={resetData}
|
||||
changeData={changeData}
|
||||
>
|
||||
<Content data={data} setData={setData} />
|
||||
</ModalEditItem>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
|
||||
export default ItemHistory;
|
||||
@@ -0,0 +1,45 @@
|
||||
import CustomTable from "@/app/component/CustomTable";
|
||||
import Head from "@/components/dashboard/userAccount/components/Head";
|
||||
import { useState } from "react";
|
||||
import ModalAddHistory from "./modal";
|
||||
import ItemHistory from "./ItemHistory";
|
||||
|
||||
function FamilyHistory({ data, changeData }) {
|
||||
const tableHead = ["ردیف", "بیماری", "نسبت خانوادگی", ""];
|
||||
const centerTable = [0];
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
<Head text="لیست سابقه خانوادگی بیماری">
|
||||
<ModalAddHistory
|
||||
open={open}
|
||||
setOpen={setOpen}
|
||||
changeData={changeData}
|
||||
/>
|
||||
</Head>
|
||||
{data.medications.length ? (
|
||||
<CustomTable
|
||||
zeroRadius={true}
|
||||
tableHead={tableHead}
|
||||
centerTable={centerTable}
|
||||
>
|
||||
{data.family_history.map((row, idx) => (
|
||||
<ItemHistory
|
||||
key={idx}
|
||||
row={row}
|
||||
idx={idx}
|
||||
changeData={changeData}
|
||||
/>
|
||||
))}
|
||||
</CustomTable>
|
||||
) : (
|
||||
<p className="text-center py-10 text-gray-500">
|
||||
هیچ سابقه خانوادگی وجود ندارد!
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default FamilyHistory;
|
||||
@@ -0,0 +1,34 @@
|
||||
import FieldLabel from "@/components/contactUs/FieldLabel";
|
||||
import Field from "@/app/component/Field";
|
||||
|
||||
function Content({ setData, data }) {
|
||||
const handleChange = (name, value) =>
|
||||
setData((prev) => ({ ...prev, [name]: value }));
|
||||
|
||||
return (
|
||||
<div className="mt-[32px] md:mt-[36px] lg:mt-[40px] flex flex-col gap-[24px] md:gap-[28px] lg:gap-[32px] px-0 sm:px-[52px]">
|
||||
<FieldLabel title="بیماری">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="relation"
|
||||
isPlaceHolder={true}
|
||||
value={data?.relation}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
<FieldLabel title="نسبت خانوادگی">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="disease"
|
||||
isPlaceHolder={true}
|
||||
value={data?.disease}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Content;
|
||||
@@ -0,0 +1,59 @@
|
||||
import { styleDefault } from "@/mui";
|
||||
import AddBtn from "@/components/dashboard/userAccount/components/AddBtn";
|
||||
import UpdateBtn from "@/components/dashboard/userAccount/components/UpdateBtn";
|
||||
import { Button, Modal } from "@mui/material";
|
||||
import Content from "./Content";
|
||||
import { useState } from "react";
|
||||
|
||||
function ModalAddHistory({ open, setOpen, changeData }) {
|
||||
const contentItem = {
|
||||
relation: "",
|
||||
disease: "",
|
||||
};
|
||||
const handleOpen = () => setOpen(true);
|
||||
const handleClose = () => setOpen(false);
|
||||
const [newItem, setNewItem] = useState(contentItem);
|
||||
const handleAddData = () => {
|
||||
changeData("add", "family_history", null, newItem);
|
||||
setNewItem(contentItem);
|
||||
handleClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Button Modal */}
|
||||
<>
|
||||
<UpdateBtn />
|
||||
<AddBtn handleOpen={handleOpen} />
|
||||
</>
|
||||
|
||||
{/* Content Modal */}
|
||||
<Modal open={open} onClose={handleClose} className="w-full">
|
||||
<div
|
||||
style={styleDefault}
|
||||
className="!px-[16px] !overflow-auto md:!min-w-[580px] md:!px-[24px] lg:!px-[32px] !py-[24px] !bg-[#FFF] !rounded-[8px] !shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)]
|
||||
!w-full md:!w-fit !h-full md:!h-fit !flex !flex-col !justify-between !max-h-screen md:!max-h-[calc(100%_-_32px)]"
|
||||
>
|
||||
<div>
|
||||
<div className="flex justify-between w-full">
|
||||
<p className="text-[#3B3B3B] text-[20px] font-bold">
|
||||
اضافه کردن سابقه خانوادگی بیماری
|
||||
</p>
|
||||
</div>
|
||||
<Content setData={setNewItem} />
|
||||
</div>
|
||||
<Button
|
||||
className="!mt-[32px] md:!mt-[36px] lg:!mt-[40px] !px-3 !py-2 !text-[16px] !font-medium !w-fit !mr-auto"
|
||||
onClick={handleAddData}
|
||||
disabled={!newItem.relation || !newItem.disease}
|
||||
variant="contained"
|
||||
>
|
||||
اضافه کردن
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default ModalAddHistory;
|
||||
@@ -0,0 +1,82 @@
|
||||
import { useState } from "react";
|
||||
import HeadTab from "../content/HeadTab";
|
||||
import profileData from "@/data/profile_other.json";
|
||||
|
||||
// Tabs
|
||||
import Medications from "./medications";
|
||||
import Information from "./information";
|
||||
import Disease from "./disease";
|
||||
import Allergies from "./allergies";
|
||||
import Surgeries from "./surgeries";
|
||||
import FamilyHistory from "./familyHistory";
|
||||
import Relatives from "./relatives";
|
||||
|
||||
const listTab = [
|
||||
"اطلاعات عمومی",
|
||||
"بیماریها",
|
||||
"آلرژیها",
|
||||
"داروهای مصرفی",
|
||||
"جراحیها",
|
||||
"سابقه خانوادگی بیماری",
|
||||
"بستگان",
|
||||
];
|
||||
|
||||
function DetailUser({ user, isTurnsDetails, setIsTurnsDetails }) {
|
||||
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 = [
|
||||
<Information
|
||||
user={user}
|
||||
isTurnsDetails={isTurnsDetails}
|
||||
setIsTurnsDetails={setIsTurnsDetails}
|
||||
/>,
|
||||
<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} />,
|
||||
];
|
||||
|
||||
return (
|
||||
<HeadTab
|
||||
tab={tab}
|
||||
user={user}
|
||||
listTab={listTab}
|
||||
components={components}
|
||||
handleChange={handleChange}
|
||||
isTurnsDetails={isTurnsDetails}
|
||||
setIsTurnsDetails={setIsTurnsDetails}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default DetailUser;
|
||||
@@ -0,0 +1,20 @@
|
||||
function Content({ isConfirmed, children, title }) {
|
||||
return (
|
||||
<div className="flex w-full flex-col items-start justify-start gap-[8px] sm:gap-[3px] md:gap-[7px] lg:gap-[9px]">
|
||||
<div className="flex min-h-[32px] items-center justify-start gap-[8px] md:gap-[6px] lg:gap-[4px]">
|
||||
<p className="text-[#525252] text-[14px] font-medium">{title}</p>
|
||||
{isConfirmed && (
|
||||
<p
|
||||
className="py-[4px] md:py-[2px] px-[5px] bg-[#05BA58] rounded-[40px] text-[#FFF]
|
||||
text-[10px] md:text-[12px] font-normal h-[26px] grid place-items-center"
|
||||
>
|
||||
تایید شده
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Content;
|
||||
@@ -0,0 +1,69 @@
|
||||
import CalendarEdit from "@/components/icons/CalendarEdit";
|
||||
import { convertToJalali } from "@/helper";
|
||||
import { Button, Popover } from "@mui/material";
|
||||
import { DatePicker } from "jalaali-react-date-picker";
|
||||
import { useState } from "react";
|
||||
|
||||
function DateBirthday({ data, changeData }) {
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
|
||||
const handleClick = (event) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
const open = Boolean(anchorEl);
|
||||
const id = open ? "simple-popover" : undefined;
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<div
|
||||
className="relative w-full border cursor-pointer py-[15px] px-[16px] border-solid border-[#D7D7D7] rounded-[8px] h-[48px]"
|
||||
onClick={handleClick}
|
||||
>
|
||||
<p className="text-[#7E7E7E] text-[14px] font-normal cursor-pointer">
|
||||
{data.value}
|
||||
</p>
|
||||
<Button className="!absolute !left-[8px] !top-1/2 !-translate-y-1/2 !min-w-fit !p-1">
|
||||
<CalendarEdit />
|
||||
</Button>
|
||||
</div>
|
||||
<Popover
|
||||
id={id}
|
||||
open={open}
|
||||
anchorEl={anchorEl}
|
||||
onClose={handleClose}
|
||||
anchorOrigin={{
|
||||
vertical: "bottom",
|
||||
horizontal: "right",
|
||||
}}
|
||||
transformOrigin={{
|
||||
vertical: "top",
|
||||
horizontal: "right",
|
||||
}}
|
||||
sx={{
|
||||
"& .MuiPaper-root": {
|
||||
padding: "12px",
|
||||
background: "#FAFAFA !important",
|
||||
borderRadius: "16px",
|
||||
border: "1px solid #E9ECEF",
|
||||
boxShadow: "0px 2px 28.4px 0px rgba(112, 112, 112, 0.28)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DatePicker
|
||||
locale="fa"
|
||||
onChange={(e) => {
|
||||
changeData(convertToJalali(e._d), "value", "date_of_birth");
|
||||
handleClose();
|
||||
}}
|
||||
/>
|
||||
</Popover>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default DateBirthday;
|
||||
@@ -0,0 +1,144 @@
|
||||
import Content from "./Content";
|
||||
import EditField from "@/app/component/EditField";
|
||||
import AutoCompleteSelect from "@/app/component/element/AutoCompleteSelect";
|
||||
import DateBirthday from "./DateBirthday";
|
||||
import {
|
||||
insurance,
|
||||
gender,
|
||||
blood_group,
|
||||
marital_status,
|
||||
education,
|
||||
job,
|
||||
} from "./listSelector";
|
||||
|
||||
function Form({ data, changeData, updateSelect }) {
|
||||
return (
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-[24px]">
|
||||
<Content title="شماره موبایل" isConfirmed={true}>
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
type="number"
|
||||
changeData={changeData}
|
||||
data={data?.phone}
|
||||
name="phone"
|
||||
/>
|
||||
</Content>
|
||||
<Content title="کد ملی" isConfirmed={false}>
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
type="number"
|
||||
changeData={changeData}
|
||||
data={data?.national_code}
|
||||
name="national_code"
|
||||
/>
|
||||
</Content>
|
||||
<Content title="نام و نام خانوادگی" isConfirmed={false}>
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
data={data?.name}
|
||||
name="name"
|
||||
/>
|
||||
</Content>
|
||||
<Content title="جنسیت">
|
||||
<AutoCompleteSelect
|
||||
updateData={updateSelect}
|
||||
label="جنسیت"
|
||||
name="gender"
|
||||
list={gender}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="تاریخ تولد">
|
||||
<DateBirthday
|
||||
data={data?.date_of_birth}
|
||||
isConfirmed={false}
|
||||
changeData={changeData}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="نام پدر" isConfirmed={false}>
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
data={data?.father_name}
|
||||
name="father_name"
|
||||
/>
|
||||
</Content>
|
||||
<Content title="نوع بیمه">
|
||||
<AutoCompleteSelect
|
||||
updateData={updateSelect}
|
||||
label="نوع بیمه"
|
||||
name="insurance"
|
||||
list={insurance}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="شماره بیمه" isConfirmed={false}>
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
type="number"
|
||||
changeData={changeData}
|
||||
data={data?.insurance_number}
|
||||
name="insurance_number"
|
||||
/>
|
||||
</Content>
|
||||
<Content title="گروه خونی">
|
||||
<AutoCompleteSelect
|
||||
updateData={updateSelect}
|
||||
label="گروه خونی"
|
||||
name="blood_group"
|
||||
list={blood_group}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="وضعیت تاهل">
|
||||
<AutoCompleteSelect
|
||||
updateData={updateSelect}
|
||||
label="وضعیت تاهل"
|
||||
name="marital_status"
|
||||
list={marital_status}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="تلفن منزل" isConfirmed={false}>
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
type="number"
|
||||
changeData={changeData}
|
||||
data={data?.home_phone}
|
||||
name="home_phone"
|
||||
/>
|
||||
</Content>
|
||||
<Content title="تحصیلات">
|
||||
<AutoCompleteSelect
|
||||
updateData={updateSelect}
|
||||
label="تحصیلات"
|
||||
name="education"
|
||||
list={education}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="شغل">
|
||||
<AutoCompleteSelect
|
||||
updateData={updateSelect}
|
||||
label="شغل"
|
||||
name="job"
|
||||
list={job}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="تلفن محل کار" isConfirmed={false}>
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
type="number"
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
data={data?.work_phone}
|
||||
name="work_phone"
|
||||
/>
|
||||
</Content>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Form;
|
||||
@@ -0,0 +1,53 @@
|
||||
import { useState } from "react";
|
||||
import Form from "./Form";
|
||||
import { Button } from "@mui/material";
|
||||
import ArrowLeftWhiteD from "@/components/icons/ArrowLeftWhiteD";
|
||||
|
||||
function Information({ user }) {
|
||||
const [data, setData] = useState({
|
||||
phone: { value: user.phone, isEdit: true },
|
||||
national_code: { value: user.national_code, isEdit: true },
|
||||
name: { value: user.name, isEdit: true },
|
||||
date_of_birth: { value: user.date_of_birth, isEdit: true },
|
||||
father_name: { value: user.father_name, isEdit: true },
|
||||
insurance_number: { value: user.insurance_number, isEdit: true },
|
||||
home_phone: { value: user.home_phone, isEdit: true },
|
||||
work_phone: { value: user.work_phone, isEdit: true },
|
||||
});
|
||||
const [selected, setSelected] = useState({
|
||||
gender: "",
|
||||
blood_group: "",
|
||||
insurance: "",
|
||||
marital_status: "",
|
||||
education: "",
|
||||
job: "",
|
||||
});
|
||||
|
||||
const changeData = (value, type, name) =>
|
||||
setData({
|
||||
...data,
|
||||
[name]: {
|
||||
...data[name],
|
||||
[type]: value,
|
||||
},
|
||||
});
|
||||
|
||||
const updateSelect = (event, name) =>
|
||||
setSelected({ ...selected, [name]: event });
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
<Form data={data} changeData={changeData} updateSelect={updateSelect} />
|
||||
<Button
|
||||
className="!gap-[4px] !mr-auto !text-nowrap !flex !flex-nowrap !py-[8px]
|
||||
!bg-[#5559CE] !rounded-[4px] !text-[#EFEFEF] !text-[14px] md:!text-[16px] !font-medium
|
||||
!mt-[32px] sm:!mt-[38px] md:!mt-[43px] lg:!mt-[48px] !px-[16px] sm:!px-[19px] md:!px-[22px] lg:!px-[24px]"
|
||||
>
|
||||
ثبت اطلاعات
|
||||
<ArrowLeftWhiteD />
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Information;
|
||||
@@ -0,0 +1,34 @@
|
||||
export const gender = [
|
||||
{ label: "مرد", id: 10 },
|
||||
{ label: "زن", id: 20 },
|
||||
];
|
||||
|
||||
export const blood_group = [
|
||||
{ label: "A+", id: 10 },
|
||||
{ label: "B+", id: 20 },
|
||||
{ label: "AB", id: 30 },
|
||||
{ label: "O+", id: 40 },
|
||||
];
|
||||
|
||||
export const marital_status = [
|
||||
{ label: "متاهل", id: 10 },
|
||||
{ label: "مجرد", id: 20 },
|
||||
];
|
||||
|
||||
export const education = [
|
||||
{ label: "دیپلم", id: 10 },
|
||||
{ label: "فوق دیپلم", id: 20 },
|
||||
{ label: "لیسانس", id: 30 },
|
||||
{ label: "کارشناسی ارشد", id: 40 },
|
||||
];
|
||||
|
||||
export const job = [
|
||||
{ label: "آزاد", id: 10 },
|
||||
{ label: "دولتی", id: 20 },
|
||||
];
|
||||
|
||||
export const insurance = [
|
||||
{ label: "بیمه 1", id: 10 },
|
||||
{ label: "بیمه 2", id: 20 },
|
||||
{ label: "بیمه 3", id: 30 },
|
||||
];
|
||||
@@ -0,0 +1,71 @@
|
||||
import ModalDeleteItem from "@/components/dashboard/userAccount/components/modal/ModalDeleteItem";
|
||||
import TextLoading from "@/app/component/loading/Text";
|
||||
import { TableCell, TableRow } from "@mui/material";
|
||||
import ModalEditItem from "@/components/dashboard/userAccount/components/modal/ModalEditItem";
|
||||
import Content from "./modal/Content";
|
||||
import { useState } from "react";
|
||||
|
||||
function ItemMedication({ row, idx, changeData }) {
|
||||
const contentData = {
|
||||
name: row.name,
|
||||
dose: row.dose,
|
||||
frequency: row.frequency,
|
||||
};
|
||||
const [data, setData] = useState(contentData);
|
||||
const resetData = () => setData(contentData);
|
||||
|
||||
return (
|
||||
<TableRow
|
||||
key={idx}
|
||||
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
|
||||
>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="center"
|
||||
>
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{idx + 1}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.name}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.dose}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.frequency}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="right"
|
||||
>
|
||||
<div className="flex items-center justify-center gap-[4px]">
|
||||
<ModalDeleteItem
|
||||
id={idx}
|
||||
name="medications"
|
||||
changeData={changeData}
|
||||
/>
|
||||
<ModalEditItem
|
||||
id={idx}
|
||||
data={data}
|
||||
title="داروی مصرفی"
|
||||
name="medications"
|
||||
resetData={resetData}
|
||||
changeData={changeData}
|
||||
>
|
||||
<Content data={data} setData={setData} />
|
||||
</ModalEditItem>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
|
||||
export default ItemMedication;
|
||||
@@ -0,0 +1,45 @@
|
||||
import CustomTable from "@/app/component/CustomTable";
|
||||
import Head from "@/components/dashboard/userAccount/components/Head";
|
||||
import { useState } from "react";
|
||||
import ItemMedication from "./ItemMedication";
|
||||
import ModalAddMedications from "./modal";
|
||||
|
||||
function Medications({ data, changeData }) {
|
||||
const tableHead = ["ردیف", "نام دارو", "دوز مصرفی", "تعداد و زمان مصرف", ""];
|
||||
const centerTable = [0];
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
<Head text="لیست دارو های مصرفی">
|
||||
<ModalAddMedications
|
||||
open={open}
|
||||
setOpen={setOpen}
|
||||
changeData={changeData}
|
||||
/>
|
||||
</Head>
|
||||
{data.medications.length ? (
|
||||
<CustomTable
|
||||
zeroRadius={true}
|
||||
tableHead={tableHead}
|
||||
centerTable={centerTable}
|
||||
>
|
||||
{data.medications.map((row, idx) => (
|
||||
<ItemMedication
|
||||
key={idx}
|
||||
row={row}
|
||||
idx={idx}
|
||||
changeData={changeData}
|
||||
/>
|
||||
))}
|
||||
</CustomTable>
|
||||
) : (
|
||||
<p className="text-center py-10 text-gray-500">
|
||||
هیچ داروی مصرفی وجود ندارد!
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Medications;
|
||||
@@ -0,0 +1,44 @@
|
||||
import FieldLabel from "@/components/contactUs/FieldLabel";
|
||||
import Field from "@/app/component/Field";
|
||||
|
||||
function Content({ setData, data }) {
|
||||
const handleChange = (name, value) =>
|
||||
setData((prev) => ({ ...prev, [name]: value }));
|
||||
|
||||
return (
|
||||
<div className="mt-[32px] md:mt-[36px] lg:mt-[40px] flex flex-col gap-[24px] md:gap-[28px] lg:gap-[32px] px-0 sm:px-[52px]">
|
||||
<FieldLabel title="نام دارو">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="name"
|
||||
isPlaceHolder={true}
|
||||
value={data?.name}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
<FieldLabel title="دوز مصرفی (mg)">
|
||||
<Field
|
||||
title=""
|
||||
type="number"
|
||||
name="dose"
|
||||
isPlaceHolder={true}
|
||||
value={data?.dose.match(/\d+/)[0]}
|
||||
handleChange={(name, value) => handleChange(name, `${value}mg`)}
|
||||
/>
|
||||
</FieldLabel>
|
||||
<FieldLabel title="تعداد و زمان مصرف">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="frequency"
|
||||
isPlaceHolder={true}
|
||||
value={data?.frequency}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Content;
|
||||
@@ -0,0 +1,61 @@
|
||||
import { styleDefault } from "@/mui";
|
||||
import AddBtn from "@/components/dashboard/userAccount/components/AddBtn";
|
||||
import UpdateBtn from "@/components/dashboard/userAccount/components/UpdateBtn";
|
||||
import { Button, Modal } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import Content from "./Content";
|
||||
|
||||
function ModalAddMedications({ open, setOpen, changeData }) {
|
||||
const contentItem = {
|
||||
name: "",
|
||||
dose: "",
|
||||
frequency: "",
|
||||
};
|
||||
|
||||
const handleOpen = () => setOpen(true);
|
||||
const handleClose = () => setOpen(false);
|
||||
const [newItem, setNewItem] = useState(contentItem);
|
||||
const handleAddData = () => {
|
||||
changeData("add", "medications", null, newItem);
|
||||
setNewItem(contentItem);
|
||||
handleClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Button Modal */}
|
||||
<>
|
||||
<UpdateBtn />
|
||||
<AddBtn handleOpen={handleOpen} />
|
||||
</>
|
||||
|
||||
{/* Content Modal */}
|
||||
<Modal open={open} onClose={handleClose} className="w-full">
|
||||
<div
|
||||
style={styleDefault}
|
||||
className="!px-[16px] !overflow-auto md:!min-w-[580px] md:!px-[24px] lg:!px-[32px] !py-[24px] !bg-[#FFF] !rounded-[8px] !shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)]
|
||||
!w-full md:!w-fit !h-full md:!h-fit !flex !flex-col !justify-between !max-h-screen md:!max-h-[calc(100%_-_32px)]"
|
||||
>
|
||||
<div>
|
||||
<div className="flex justify-between w-full">
|
||||
<p className="text-[#3B3B3B] text-[20px] font-bold">
|
||||
اضافه کردن دارو های مصرفی
|
||||
</p>
|
||||
</div>
|
||||
<Content setData={setNewItem} />
|
||||
</div>
|
||||
<Button
|
||||
className="!mt-[32px] md:!mt-[36px] lg:!mt-[40px] !px-3 !py-2 !text-[16px] !font-medium !w-fit !mr-auto"
|
||||
onClick={handleAddData}
|
||||
disabled={!newItem.name || !newItem.dose || !newItem.frequency}
|
||||
variant="contained"
|
||||
>
|
||||
اضافه کردن
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default ModalAddMedications;
|
||||
@@ -0,0 +1,71 @@
|
||||
import ModalDeleteItem from "@/components/dashboard/userAccount/components/modal/ModalDeleteItem";
|
||||
import TextLoading from "@/app/component/loading/Text";
|
||||
import { TableCell, TableRow } from "@mui/material";
|
||||
import ModalEditItem from "@/components/dashboard/userAccount/components/modal/ModalEditItem";
|
||||
import Content from "./modal/Content";
|
||||
import { useState } from "react";
|
||||
|
||||
function ItemRelatives({ row, idx, changeData }) {
|
||||
const contentData = {
|
||||
name: row.name,
|
||||
relation: row.relation,
|
||||
phone: row.contact.phone,
|
||||
address: row.contact.address,
|
||||
};
|
||||
const [data, setData] = useState(contentData);
|
||||
const resetData = () => setData(contentData);
|
||||
|
||||
return (
|
||||
<TableRow
|
||||
key={idx}
|
||||
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
|
||||
>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="center"
|
||||
>
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{idx + 1}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.name}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.relation}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{`${row.contact.phone?.replace("+", "")}+`}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
{row.contact.address}
|
||||
</TableCell>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="right"
|
||||
>
|
||||
<div className="flex items-center justify-center gap-[4px]">
|
||||
<ModalDeleteItem id={idx} name="relatives" changeData={changeData} />
|
||||
<ModalEditItem
|
||||
id={idx}
|
||||
data={data}
|
||||
name="relatives"
|
||||
title="داروی مصرفی"
|
||||
resetData={resetData}
|
||||
changeData={changeData}
|
||||
>
|
||||
<Content data={data} setData={setData} />
|
||||
</ModalEditItem>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
|
||||
export default ItemRelatives;
|
||||
@@ -0,0 +1,45 @@
|
||||
import { useState } from "react";
|
||||
import CustomTable from "@/app/component/CustomTable";
|
||||
import Head from "@/components/dashboard/userAccount/components/Head";
|
||||
import ModalAddRelatives from "./modal";
|
||||
import ItemRelatives from "./ItemRelatives";
|
||||
|
||||
function Relatives({ data, changeData }) {
|
||||
const tableHead = ["ردیف", "نام", "نسبت", "شماره تماس", "آدرس", ""];
|
||||
const centerTable = [0];
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
<Head text="لیست بستگان">
|
||||
<ModalAddRelatives
|
||||
open={open}
|
||||
setOpen={setOpen}
|
||||
changeData={changeData}
|
||||
/>
|
||||
</Head>
|
||||
{data.medications.length ? (
|
||||
<CustomTable
|
||||
zeroRadius={true}
|
||||
tableHead={tableHead}
|
||||
centerTable={centerTable}
|
||||
>
|
||||
{data.relatives.map((row, idx) => (
|
||||
<ItemRelatives
|
||||
key={idx}
|
||||
row={row}
|
||||
idx={idx}
|
||||
changeData={changeData}
|
||||
/>
|
||||
))}
|
||||
</CustomTable>
|
||||
) : (
|
||||
<p className="text-center py-10 text-gray-500">
|
||||
هیچ داروی مصرفی وجود ندارد!
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Relatives;
|
||||
@@ -0,0 +1,54 @@
|
||||
import FieldLabel from "@/components/contactUs/FieldLabel";
|
||||
import Field from "@/app/component/Field";
|
||||
|
||||
function Content({ setData, data }) {
|
||||
const handleChange = (name, value) =>
|
||||
setData((prev) => ({ ...prev, [name]: value }));
|
||||
|
||||
return (
|
||||
<div className="mt-[32px] md:mt-[36px] lg:mt-[40px] flex flex-col gap-[24px] md:gap-[28px] lg:gap-[32px] px-0 sm:px-[52px]">
|
||||
<FieldLabel title="نام">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="name"
|
||||
isPlaceHolder={true}
|
||||
value={data?.name}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
<FieldLabel title="نسبت">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="relation"
|
||||
isPlaceHolder={true}
|
||||
value={data?.relation}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
<FieldLabel title="شماره تماس">
|
||||
<Field
|
||||
title=""
|
||||
type="number"
|
||||
name="phone"
|
||||
isPlaceHolder={true}
|
||||
value={Number(data?.phone.replace(/^\+/, ""))}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
<FieldLabel title="آدرس">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="address"
|
||||
isPlaceHolder={true}
|
||||
value={data?.address}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Content;
|
||||
@@ -0,0 +1,76 @@
|
||||
import { styleDefault } from "@/mui";
|
||||
import AddBtn from "@/components/dashboard/userAccount/components/AddBtn";
|
||||
import UpdateBtn from "@/components/dashboard/userAccount/components/UpdateBtn";
|
||||
import { Button, Modal } from "@mui/material";
|
||||
import Content from "./Content";
|
||||
import { useState } from "react";
|
||||
|
||||
function ModalAddRelatives({ open, setOpen, changeData }) {
|
||||
const contentItem = {
|
||||
name: "",
|
||||
relation: "",
|
||||
phone: "",
|
||||
address: "",
|
||||
};
|
||||
|
||||
const handleOpen = () => setOpen(true);
|
||||
const handleClose = () => setOpen(false);
|
||||
const [newItem, setNewItem] = useState(contentItem);
|
||||
const handleAddData = () => {
|
||||
const changedKey = {
|
||||
name: newItem.name,
|
||||
relation: newItem.relation,
|
||||
contact: {
|
||||
phone: newItem.phone,
|
||||
address: newItem.address,
|
||||
},
|
||||
};
|
||||
|
||||
changeData("add", "relatives", null, changedKey);
|
||||
setNewItem(contentItem);
|
||||
handleClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Button Modal */}
|
||||
<>
|
||||
<UpdateBtn />
|
||||
<AddBtn handleOpen={handleOpen} />
|
||||
</>
|
||||
|
||||
{/* Content Modal */}
|
||||
<Modal open={open} onClose={handleClose} className="w-full">
|
||||
<div
|
||||
style={styleDefault}
|
||||
className="!px-[16px] !overflow-auto md:!min-w-[580px] md:!px-[24px] lg:!px-[32px] !py-[24px] !bg-[#FFF] !rounded-[8px] !shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)]
|
||||
!w-full md:!w-fit !h-full md:!h-fit !flex !flex-col !justify-between !max-h-screen md:!max-h-[calc(100%_-_32px)]"
|
||||
>
|
||||
<div>
|
||||
<div className="flex justify-between w-full">
|
||||
<p className="text-[#3B3B3B] text-[20px] font-bold">
|
||||
اضافه کردن بستگان
|
||||
</p>
|
||||
</div>
|
||||
<Content setData={setNewItem} />
|
||||
</div>
|
||||
<Button
|
||||
className="!mt-[32px] md:!mt-[36px] lg:!mt-[40px] !px-3 !py-2 !text-[16px] !font-medium !w-fit !mr-auto"
|
||||
onClick={handleAddData}
|
||||
disabled={
|
||||
!newItem.name ||
|
||||
!newItem.relation ||
|
||||
!newItem.phone ||
|
||||
!newItem.address
|
||||
}
|
||||
variant="contained"
|
||||
>
|
||||
اضافه کردن
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default ModalAddRelatives;
|
||||
@@ -0,0 +1,70 @@
|
||||
import ModalDeleteItem from "@/components/dashboard/userAccount/components/modal/ModalDeleteItem";
|
||||
import TextLoading from "@/app/component/loading/Text";
|
||||
import { TableCell, TableRow } from "@mui/material";
|
||||
import ModalEditItem from "@/components/dashboard/userAccount/components/modal/ModalEditItem";
|
||||
import Content from "./modal/Content";
|
||||
import { useState } from "react";
|
||||
|
||||
function ItemSurgeries({ row, idx, changeData }) {
|
||||
const contentData = {
|
||||
type: row.type,
|
||||
year: row.year,
|
||||
hospital: row.hospital,
|
||||
};
|
||||
const [data, setData] = useState(contentData);
|
||||
const resetData = () => setData(contentData);
|
||||
|
||||
return (
|
||||
<TableRow
|
||||
key={idx}
|
||||
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
|
||||
>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="center"
|
||||
>
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{idx + 1}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.type}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.hospital}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="center"
|
||||
>
|
||||
<TextLoading width={15} height={18} loading={false}>
|
||||
{row.year}
|
||||
</TextLoading>
|
||||
</TableCell>
|
||||
<TableCell
|
||||
className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap"
|
||||
align="right"
|
||||
>
|
||||
<div className="flex items-center justify-center gap-[4px]">
|
||||
<ModalDeleteItem id={idx} name="surgeries" changeData={changeData} />
|
||||
<ModalEditItem
|
||||
id={idx}
|
||||
data={data}
|
||||
title="جراحی"
|
||||
name="surgeries"
|
||||
resetData={resetData}
|
||||
changeData={changeData}
|
||||
>
|
||||
<Content data={data} setData={setData} />
|
||||
</ModalEditItem>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
|
||||
export default ItemSurgeries;
|
||||
@@ -0,0 +1,49 @@
|
||||
import CustomTable from "@/app/component/CustomTable";
|
||||
import Head from "@/components/dashboard/userAccount/components/Head";
|
||||
import { useState } from "react";
|
||||
import ItemSurgeries from "./ItemSurgeries";
|
||||
import ModalAddSurgeries from "./modal";
|
||||
|
||||
function Surgeries({ data, changeData }) {
|
||||
const tableHead = [
|
||||
"ردیف",
|
||||
"نوع جراحی",
|
||||
"نام بیمارستان",
|
||||
"سال انجام جراحی",
|
||||
"",
|
||||
];
|
||||
const centerTable = [0, 3];
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
<Head text="لیست جراحی ها">
|
||||
<ModalAddSurgeries
|
||||
open={open}
|
||||
setOpen={setOpen}
|
||||
changeData={changeData}
|
||||
/>
|
||||
</Head>
|
||||
{data.surgeries.length ? (
|
||||
<CustomTable
|
||||
zeroRadius={true}
|
||||
tableHead={tableHead}
|
||||
centerTable={centerTable}
|
||||
>
|
||||
{data.surgeries.map((row, idx) => (
|
||||
<ItemSurgeries
|
||||
key={idx}
|
||||
row={row}
|
||||
idx={idx}
|
||||
changeData={changeData}
|
||||
/>
|
||||
))}
|
||||
</CustomTable>
|
||||
) : (
|
||||
<p className="text-center py-10 text-gray-500">هیچ جراحی وجود ندارد!</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Surgeries;
|
||||
@@ -0,0 +1,50 @@
|
||||
import FieldLabel from "@/components/contactUs/FieldLabel";
|
||||
import Field from "@/app/component/Field";
|
||||
|
||||
const listIntensity = [
|
||||
{ label: "شدید" },
|
||||
{ label: "متوسط" },
|
||||
{ label: "خفیف" },
|
||||
];
|
||||
|
||||
function Content({ setData, data }) {
|
||||
const handleChange = (name, value) =>
|
||||
setData((prev) => ({ ...prev, [name]: value }));
|
||||
|
||||
return (
|
||||
<div className="mt-[32px] md:mt-[36px] lg:mt-[40px] flex flex-col gap-[24px] md:gap-[28px] lg:gap-[32px] px-0 sm:px-[52px]">
|
||||
<FieldLabel title="نوع جراحی">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="type"
|
||||
isPlaceHolder={true}
|
||||
value={data?.type}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
<FieldLabel title="نام بیمارستان">
|
||||
<Field
|
||||
title=""
|
||||
type="text"
|
||||
name="hospital"
|
||||
isPlaceHolder={true}
|
||||
value={data?.hospital}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
<FieldLabel title="سال انجام جراحی">
|
||||
<Field
|
||||
title=""
|
||||
type="number"
|
||||
name="year"
|
||||
isPlaceHolder={true}
|
||||
value={data?.year}
|
||||
handleChange={handleChange}
|
||||
/>
|
||||
</FieldLabel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Content;
|
||||
@@ -0,0 +1,61 @@
|
||||
import { styleDefault } from "@/mui";
|
||||
import AddBtn from "@/components/dashboard/userAccount/components/AddBtn";
|
||||
import UpdateBtn from "@/components/dashboard/userAccount/components/UpdateBtn";
|
||||
import { Button, Modal } from "@mui/material";
|
||||
import Content from "./Content";
|
||||
import { useState } from "react";
|
||||
|
||||
function ModalAddSurgeries({ open, setOpen, changeData }) {
|
||||
const contentItem = {
|
||||
type: "",
|
||||
year: "",
|
||||
hospital: "",
|
||||
};
|
||||
|
||||
const handleOpen = () => setOpen(true);
|
||||
const handleClose = () => setOpen(false);
|
||||
const [newItem, setNewItem] = useState(contentItem);
|
||||
const handleAddData = () => {
|
||||
changeData("add", "surgeries", null, newItem);
|
||||
setNewItem(contentItem);
|
||||
handleClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Button Modal */}
|
||||
<>
|
||||
<UpdateBtn />
|
||||
<AddBtn handleOpen={handleOpen} />
|
||||
</>
|
||||
|
||||
{/* Content Modal */}
|
||||
<Modal open={open} onClose={handleClose} className="w-full">
|
||||
<div
|
||||
style={styleDefault}
|
||||
className="!px-[16px] !overflow-auto md:!min-w-[580px] md:!px-[24px] lg:!px-[32px] !py-[24px] !bg-[#FFF] !rounded-[8px] !shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)]
|
||||
!w-full md:!w-fit !h-full md:!h-fit !flex !flex-col !justify-between !max-h-screen md:!max-h-[calc(100%_-_32px)]"
|
||||
>
|
||||
<div>
|
||||
<div className="flex justify-between w-full">
|
||||
<p className="text-[#3B3B3B] text-[20px] font-bold">
|
||||
اضافه کردن جراحی
|
||||
</p>
|
||||
</div>
|
||||
<Content setData={setNewItem} />
|
||||
</div>
|
||||
<Button
|
||||
className="!mt-[32px] md:!mt-[36px] lg:!mt-[40px] !px-3 !py-2 !text-[16px] !font-medium !w-fit !mr-auto"
|
||||
onClick={handleAddData}
|
||||
disabled={!newItem.type || !newItem.year || !newItem.hospital}
|
||||
variant="contained"
|
||||
>
|
||||
اضافه کردن
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default ModalAddSurgeries;
|
||||
Reference in New Issue
Block a user