50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
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, loading, updateData }) {
|
|
const { other } = data;
|
|
const { family_history } = other && other[0];
|
|
const tableHead = ["ردیف", "بیماری", "نسبت خانوادگی", ""];
|
|
const centerTable = [0];
|
|
const [open, setOpen] = useState(false);
|
|
|
|
return (
|
|
<div className="opacity-page">
|
|
<Head text="لیست سابقه خانوادگی بیماری">
|
|
<ModalAddHistory
|
|
open={open}
|
|
setOpen={setOpen}
|
|
loading={loading}
|
|
changeData={changeData}
|
|
updateData={updateData}
|
|
/>
|
|
</Head>
|
|
{family_history.length ? (
|
|
<CustomTable
|
|
zeroRadius={true}
|
|
tableHead={tableHead}
|
|
centerTable={centerTable}
|
|
>
|
|
{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;
|