Feature/amiriis mission new tasks

This commit is contained in:
AmirHossein Mahmoodi
2025-07-28 07:35:45 +00:00
parent fc9706bb0e
commit c6ccc39829
62 changed files with 2561 additions and 894 deletions

View File

@@ -4,15 +4,11 @@ import { GET_ROAD_MISSIONS_CONTROL_LIST } from "@/core/utils/routes";
import { Box, Stack } from "@mui/material";
import moment from "jalali-moment";
import { useMemo } from "react";
import ShowArea from "./Actions/showArea";
import MachinesDialog from "./RowActions/Machines";
import RowActions from "./RowActions";
import RahdaranDialog from "./RowActions/Rahdaran";
const ControlList = () => {
const typeOptions = [
{ value: 1, label: "روزانه" },
{ value: 2, label: "ساعتی" },
];
const columns = useMemo(
() => [
{
@@ -27,25 +23,10 @@ const ControlList = () => {
size: 100,
},
{
accessorKey: "type",
header: "نوع",
id: "type",
enableColumnFilter: true,
datatype: "numeric",
filterMode: "equals",
sortDescFirst: true,
grow: false,
size: 100,
columnSelectOption: () => {
return typeOptions.map((type) => ({
value: type.value,
label: type.label,
}));
},
Cell: ({ row }) => row.original.type_fa,
},
{
accessorFn: (row) => moment(row.start_date).locale("fa").format("HH:mm | yyyy/MM/DD"),
accessorFn: (row) =>
row.type == 1
? moment(row.start_date).locale("fa").format("HH:mm | yyyy/MM/DD")
: moment(row.start_date).locale("fa").format("yyyy/MM/DD"),
header: "تاریخ شروع",
id: "start_date",
enableColumnFilter: true,
@@ -55,7 +36,10 @@ const ControlList = () => {
size: 100,
},
{
accessorFn: (row) => moment(row.end_date).locale("fa").format("HH:mm | yyyy/MM/DD"),
accessorFn: (row) =>
row.type == 1
? moment(row.end_date).locale("fa").format("HH:mm | yyyy/MM/DD")
: moment(row.end_date).locale("fa").format("yyyy/MM/DD"),
header: "تاریخ پایان",
id: "end_date",
enableColumnFilter: true,
@@ -65,21 +49,13 @@ const ControlList = () => {
size: 100,
},
{
accessorKey: "end_point",
header: "مقصد",
id: "end_point",
enableColumnFilter: false,
datatype: "numeric",
filterMode: "equals",
grow: false,
size: 100,
},
{
header: "محدوده",
id: "area",
enableColumnFilter: false,
datatype: "numeric",
filterMode: "equals",
header: "خودرو",
id: "cmmsMachines__machine_code",
enableColumnFilter: true,
datatype: "text",
filterMode: "contains",
enableSorting: false,
columnFilterModeOptions: ["equals", "contains"],
grow: false,
size: 100,
muiTableBodyCellProps: {
@@ -91,14 +67,40 @@ const ControlList = () => {
},
},
},
Cell: ({ row }) =>
row.original.area ? (
Cell: ({ renderedCellValue, row }) => {
return (
<Stack alignItems={"center"} justifyContent={"center"}>
<ShowArea area={row.original.area} />
<MachinesDialog rowId={row.original.id} />
</Stack>
) : (
"-"
),
);
},
},
{
header: "افراد",
id: "rahdaran__code",
enableColumnFilter: true,
enableSorting: false,
datatype: "text",
filterMode: "contains",
columnFilterModeOptions: ["equals", "contains"],
grow: false,
size: 100,
muiTableBodyCellProps: {
sx: {
borderLeft: "1px solid #e1e1e1",
py: 0,
"&:first-of-type": {
borderLeft: "unset",
},
},
},
Cell: ({ renderedCellValue, row }) => {
return (
<Stack alignItems={"center"} justifyContent={"center"}>
<RahdaranDialog rowId={row.original.id} />
</Stack>
);
},
},
],
[]