design and handle modal add, edit and delete in all tabs dashboard & change list & update data profile_other

This commit is contained in:
Ehsan
2025-05-30 02:22:10 +03:30
parent e12e6c171c
commit 0969eca274
28 changed files with 1108 additions and 337 deletions
@@ -6,8 +6,9 @@ import { Button, TableCell, TableRow } from "@mui/material";
import Head from "../../components/Head";
import ModalAddSurgeries from "./modal";
import { useState } from "react";
import ItemSurgeries from "./ItemSurgeries";
function Surgeries({ data }) {
function Surgeries({ data, updateData, changeData }) {
const tableHead = [
"ردیف",
"نوع جراحی",
@@ -21,60 +22,30 @@ function Surgeries({ data }) {
return (
<div>
<Head text="لیست جراحی ها">
<ModalAddSurgeries open={open} setOpen={setOpen} />
<ModalAddSurgeries
open={open}
setOpen={setOpen}
changeData={changeData}
/>
</Head>
<CustomTable
zeroRadius={true}
tableHead={tableHead}
centerTable={centerTable}
>
{data.surgeries.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.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]">
<Button className="!min-w-fit !p-1" variant="text">
<TrashB />
</Button>
<Button className="!min-w-fit !p-1" variant="text">
<EditB />
</Button>
</div>
</TableCell>
</TableRow>
))}
</CustomTable>
{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>
);
}