change response file & request get user-profile & change design dashboard page & handle limit page dashboard

This commit is contained in:
Ehsan
2025-05-31 03:35:23 +03:30
parent 0969eca274
commit 80c74361eb
38 changed files with 233 additions and 121 deletions
@@ -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;