Files
nobat724_front/components/dashboard/userAccount/tabs/relatives/index.js
T

85 lines
3.6 KiB
JavaScript

import CustomTable from "@/app/component/CustomTable";
import TextLoading from "@/app/component/loading/Text";
import EditB from "@/components/icons/EditB";
import TrashB from "@/components/icons/TrashB";
import { Button, TableCell, TableRow, Tooltip } from "@mui/material";
import Head from "../../components/Head";
function Relatives({ data }) {
const tableHead = ["ردیف", "نام", "نسبت", "شماره تماس", "ایمیل", "آدرس", ""];
const centerTable = [0];
return (
<div>
<Head text="لیست بستگان" />
<CustomTable
zeroRadius={true}
tableHead={tableHead}
centerTable={centerTable}
>
{data.relatives.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}>
{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">
<TextLoading width={15} height={18} loading={false}>
{row.contact.email}
</TextLoading>
</TableCell>
<TableCell className="!pr-[18px] dark:!border-transparent !text-[#616161] dark:!text-[#A1A1A1] !text-[16px] !font-medium !text-nowrap">
<Tooltip title={row.contact.address || ""} arrow>
<div className="truncate max-w-[150px] cursor-default">
<TextLoading width={15} height={18} loading={false}>
{(row.contact.address || "").substring(0, 15)}
{row.contact.address?.length > 15 ? "…" : ""}
</TextLoading>
</div>
</Tooltip>
</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>
</div>
);
}
export default Relatives;