159 lines
5.4 KiB
JavaScript
159 lines
5.4 KiB
JavaScript
"use client";
|
|
|
|
import { useMemo } from "react";
|
|
import { Box, Typography } from "@mui/material";
|
|
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
|
import Toolbar from "./Toolbar";
|
|
import { GET_AZMAYESH_LIST } from "@/core/utils/routes";
|
|
import ShowLocation from "./ShowLocation";
|
|
import moment from "jalali-moment";
|
|
import RowActions from "./RowActions";
|
|
|
|
const AzmayeshList = () => {
|
|
const columns = useMemo(
|
|
() => [
|
|
{
|
|
accessorKey: "id",
|
|
header: "کد یکتا",
|
|
id: "id",
|
|
enableColumnFilter: false,
|
|
datatype: "text",
|
|
filterFn: "notEquals",
|
|
},
|
|
{
|
|
accessorKey: "azmayesh_type_name",
|
|
header: "نوع آزمایش",
|
|
id: "azmayesh_type_name",
|
|
enableColumnFilter: false,
|
|
datatype: "text",
|
|
filterFn: "notEquals",
|
|
},
|
|
{
|
|
accessorKey: "project_name",
|
|
header: "پروژه",
|
|
id: "project_name",
|
|
enableColumnFilter: false,
|
|
datatype: "text",
|
|
filterFn: "equals",
|
|
},
|
|
{
|
|
accessorKey: "lat",
|
|
header: "نمایش مختصات",
|
|
id: "lat",
|
|
enableColumnFilter: false,
|
|
datatype: "text",
|
|
filterFn: "equals",
|
|
Cell: ({ row }) => <ShowLocation lat={row.original.lat} lng={row.original.lng} />,
|
|
},
|
|
{
|
|
accessorKey: "employer",
|
|
header: "کارفرما",
|
|
id: "employer",
|
|
enableColumnFilter: false,
|
|
datatype: "text",
|
|
filterFn: "equals",
|
|
},
|
|
{
|
|
accessorKey: "consultant",
|
|
header: "مشاور",
|
|
id: "consultant",
|
|
enableColumnFilter: false,
|
|
datatype: "text",
|
|
filterFn: "equals",
|
|
},
|
|
{
|
|
accessorKey: "contractor",
|
|
header: "پیمانکار",
|
|
id: "contractor",
|
|
enableColumnFilter: false,
|
|
datatype: "text",
|
|
filterFn: "equals",
|
|
},
|
|
{
|
|
accessorKey: "applicant",
|
|
header: "متقاضی",
|
|
id: "applicant",
|
|
enableColumnFilter: false,
|
|
datatype: "text",
|
|
filterFn: "equals",
|
|
},
|
|
{
|
|
accessorKey: "work_number",
|
|
header: "شماره کار",
|
|
id: "work_number",
|
|
enableColumnFilter: false,
|
|
datatype: "text",
|
|
filterFn: "equals",
|
|
},
|
|
{
|
|
accessorKey: "request_number",
|
|
header: "شماره درخواست",
|
|
id: "request_number",
|
|
enableColumnFilter: false,
|
|
datatype: "text",
|
|
filterFn: "equals",
|
|
},
|
|
{
|
|
accessorKey: "request_date",
|
|
header: "تاریخ درخواست",
|
|
id: "request_date",
|
|
enableColumnFilter: false,
|
|
datatype: "date",
|
|
filterFn: "equals",
|
|
Cell: ({ renderedCellValue }) => (
|
|
<Typography variant="body2">
|
|
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"}
|
|
</Typography>
|
|
),
|
|
},
|
|
{
|
|
accessorKey: "report_date",
|
|
header: "تاریخ گزارش",
|
|
id: "report_date",
|
|
enableColumnFilter: false,
|
|
datatype: "date",
|
|
filterFn: "equals",
|
|
Cell: ({ renderedCellValue }) => (
|
|
<Typography variant="body2">
|
|
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("YYYY/MM/DD") : "-"}
|
|
</Typography>
|
|
),
|
|
},
|
|
{
|
|
accessorKey: "updated_at",
|
|
header: "تاریخ بروزرسانی",
|
|
id: "updated_at",
|
|
enableColumnFilter: false,
|
|
datatype: "date",
|
|
filterFn: "equals",
|
|
Cell: ({ renderedCellValue }) => (
|
|
<Typography variant="body2">
|
|
{renderedCellValue ? moment(renderedCellValue).locale("fa").format("HH:mm | YYYY/MM/DD") : "-"}
|
|
</Typography>
|
|
),
|
|
},
|
|
],
|
|
[]
|
|
);
|
|
|
|
return (
|
|
<>
|
|
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
|
<DataTableWithAuth
|
|
table_title={"لیست آزمایشات"}
|
|
need_filter={false}
|
|
columns={columns}
|
|
table_url={GET_AZMAYESH_LIST}
|
|
page_name={"azmayesh"}
|
|
table_name={"azmayeshList"}
|
|
TableToolbar={Toolbar}
|
|
enableRowActions
|
|
positionActionsColumn={"last"}
|
|
RowActions={RowActions}
|
|
/>
|
|
</Box>
|
|
</>
|
|
);
|
|
};
|
|
export default AzmayeshList;
|