design and handle modal add, edit and delete in all tabs dashboard & change list & update data profile_other
This commit is contained in:
@@ -3,10 +3,27 @@ import AddBtn from "../../../components/AddBtn";
|
||||
import UpdateBtn from "../../../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: "",
|
||||
};
|
||||
|
||||
function ModalAddAlergie({ open, setOpen }) {
|
||||
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 (
|
||||
<>
|
||||
@@ -25,16 +42,19 @@ function ModalAddAlergie({ open, setOpen }) {
|
||||
>
|
||||
<div>
|
||||
<div className="flex justify-between w-full">
|
||||
<p className="text-[#3B3B3B] text-[20px] font-bold">اضافه کردن آلرژی</p>
|
||||
<p className="text-[#3B3B3B] text-[20px] font-bold">
|
||||
اضافه کردن آلرژی
|
||||
</p>
|
||||
</div>
|
||||
<Content />
|
||||
<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={handleClose}
|
||||
onClick={handleAddData}
|
||||
disabled={!newItem.reaction || !newItem.severity || !newItem.substance}
|
||||
variant="contained"
|
||||
>
|
||||
اعمال تغییرات
|
||||
اضافه کردن
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user