Compare commits
2 Commits
v1.9.1
...
6cf30a591c
| Author | SHA1 | Date | |
|---|---|---|---|
| 6cf30a591c | |||
| f0d9a17e01 |
@@ -4,16 +4,18 @@ import { Box } from "@mui/material";
|
||||
import { useMemo } from "react";
|
||||
import Toolbar from "./Toolbar";
|
||||
import RowActions from "./RowActions";
|
||||
import { GET_DRIVERS_ACTIVITY_REPORT } from "@/core/utils/routes";
|
||||
|
||||
const DriverReportsList = ({ data, specialFilter }) => {
|
||||
const DriverReportsList = ({ specialFilter }) => {
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
accessorKey: "driver_id",
|
||||
header: "کد یکتا",
|
||||
id: "driver_id",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
enableColumnFilter: true,
|
||||
columnFilterModeOptions: ["equals", "contains"],
|
||||
enableSorting: true,
|
||||
datatype: "numeric",
|
||||
grow: false,
|
||||
size: 50,
|
||||
@@ -22,8 +24,9 @@ const DriverReportsList = ({ data, specialFilter }) => {
|
||||
accessorKey: "driver_name",
|
||||
header: "نام راننده",
|
||||
id: "driver_name",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
enableColumnFilter: true,
|
||||
columnFilterModeOptions: ["equals", "contains"],
|
||||
enableSorting: true,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
@@ -33,7 +36,7 @@ const DriverReportsList = ({ data, specialFilter }) => {
|
||||
header: "کارکرد",
|
||||
id: "func",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
enableSorting: true,
|
||||
datatype: "number",
|
||||
grow: false,
|
||||
size: 50,
|
||||
@@ -43,7 +46,7 @@ const DriverReportsList = ({ data, specialFilter }) => {
|
||||
header: "تعداد ماموریت",
|
||||
id: "missions",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
enableSorting: true,
|
||||
datatype: "number",
|
||||
grow: false,
|
||||
size: 50,
|
||||
@@ -56,8 +59,9 @@ const DriverReportsList = ({ data, specialFilter }) => {
|
||||
<Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
|
||||
<DataTableWithAuth
|
||||
TableToolbar={Toolbar}
|
||||
need_filter={true}
|
||||
columns={columns}
|
||||
data={data.data}
|
||||
table_url={GET_DRIVERS_ACTIVITY_REPORT}
|
||||
page_name={"driverReport"}
|
||||
table_name={"driverReportList"}
|
||||
enablePagination={false}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
"use client";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import { GET_DRIVER_COUNTRY_ACTIVITY_REPORT, GET_DRIVER_PROVINCE_ACTIVITY_REPORT } from "@/core/utils/routes";
|
||||
import { useAuth } from "@/lib/contexts/auth";
|
||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { LinearProgress, Stack } from "@mui/material";
|
||||
import { Stack } from "@mui/material";
|
||||
import moment from "jalali-moment";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
@@ -14,10 +12,8 @@ import DriverReportsList from "./DriverReportsList";
|
||||
import SearchReportList from "./Search";
|
||||
|
||||
const DriverReportsPage = () => {
|
||||
const [data, setData] = useState(null);
|
||||
const { data: userPermissions } = usePermissions();
|
||||
const { user } = useAuth();
|
||||
const requestServer = useRequest();
|
||||
const hasProvincesPermission = userPermissions?.includes("mission-report-country");
|
||||
|
||||
const defaultValues = {
|
||||
@@ -32,38 +28,32 @@ const DriverReportsPage = () => {
|
||||
];
|
||||
const [specialFilter, setSpecialFilter] = useState(defaultFilter);
|
||||
|
||||
const onSearchSubmit = async (data) => {
|
||||
const params = new URLSearchParams();
|
||||
params.set("from_date", `${data.from_date} 00:00:00`);
|
||||
params.set("date_to", `${data.date_to} 23:59:59`);
|
||||
setSpecialFilter([
|
||||
{ value: `${data.province_id}`, datatype: "numeric", id: "province_id", fn: "equals" },
|
||||
{ value: `${data.from_date} 00:00:00`, datatype: "date", id: "start_time", fn: "greaterThan" },
|
||||
{ value: `${data.date_to} 23:59:59`, datatype: "date", id: "finish_time", fn: "lessThan" },
|
||||
]);
|
||||
if (data.province_id === "-1") {
|
||||
try {
|
||||
const response = await requestServer(`${GET_DRIVER_COUNTRY_ACTIVITY_REPORT}?${params}`);
|
||||
const result = response.data.data;
|
||||
const onSearchSubmit = (data) => {
|
||||
const filters = [
|
||||
{
|
||||
value: `${data.from_date} 00:00:00`,
|
||||
datatype: "date",
|
||||
id: "start_time",
|
||||
fn: "greaterThan",
|
||||
},
|
||||
{
|
||||
value: `${data.date_to} 23:59:59`,
|
||||
datatype: "date",
|
||||
id: "finish_time",
|
||||
fn: "lessThan",
|
||||
},
|
||||
];
|
||||
|
||||
setData({
|
||||
data: result.activities,
|
||||
filters: data,
|
||||
});
|
||||
} catch (e) {}
|
||||
} else {
|
||||
try {
|
||||
params.set("province_id", `${data.province_id}`);
|
||||
const response = await requestServer(`${GET_DRIVER_PROVINCE_ACTIVITY_REPORT}?${params}`);
|
||||
|
||||
const result = response.data.data;
|
||||
|
||||
setData({
|
||||
data: result.activities,
|
||||
filters: data,
|
||||
});
|
||||
} catch (e) {}
|
||||
if (data.province_id !== "-1") {
|
||||
filters.unshift({
|
||||
value: data.province_id,
|
||||
datatype: "numeric",
|
||||
id: "province_id",
|
||||
fn: "equals",
|
||||
});
|
||||
}
|
||||
|
||||
setSpecialFilter(filters);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -100,7 +90,7 @@ const DriverReportsPage = () => {
|
||||
handleSubmit={handleSubmit}
|
||||
onSearchSubmit={onSearchSubmit}
|
||||
/>
|
||||
{!data ? <LinearProgress /> : <DriverReportsList specialFilter={specialFilter} data={data} />}
|
||||
<DriverReportsList specialFilter={specialFilter} />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -4,17 +4,23 @@ import { Box } from "@mui/material";
|
||||
import { useMemo } from "react";
|
||||
import Toolbar from "./Toolbar";
|
||||
import RowActions from "./RowActions";
|
||||
import {
|
||||
GET_MACHINES_ACTIVITY_REPORT,
|
||||
GET_MACHINES_COUNTRY_ACTIVITY_REPORT,
|
||||
GET_MACHINES_PROVINCE_ACTIVITY_REPORT,
|
||||
} from "@/core/utils/routes";
|
||||
|
||||
const MachinesReportsList = ({ data, specialFilter }) => {
|
||||
const MachinesReportsList = ({ specialFilter }) => {
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
accessorKey: "machine_id",
|
||||
header: "کد یکتا",
|
||||
id: "machine_id",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
datatype: "numeric",
|
||||
enableColumnFilter: true,
|
||||
columnFilterModeOptions: ["equals", "contains"],
|
||||
enableSorting: true,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
},
|
||||
@@ -22,8 +28,9 @@ const MachinesReportsList = ({ data, specialFilter }) => {
|
||||
accessorKey: "car_name",
|
||||
header: "مدل ماشین",
|
||||
id: "car_name",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
enableColumnFilter: true,
|
||||
columnFilterModeOptions: ["equals", "contains"],
|
||||
enableSorting: true,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
@@ -32,8 +39,9 @@ const MachinesReportsList = ({ data, specialFilter }) => {
|
||||
accessorKey: "machine_code",
|
||||
header: "کد ماشین",
|
||||
id: "machine_code",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
enableColumnFilter: true,
|
||||
columnFilterModeOptions: ["equals", "contains"],
|
||||
enableSorting: true,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
@@ -43,6 +51,7 @@ const MachinesReportsList = ({ data, specialFilter }) => {
|
||||
header: "کارکرد",
|
||||
id: "func",
|
||||
enableColumnFilter: false,
|
||||
columnFilterModeOptions: ["equals", "contains"],
|
||||
enableSorting: false,
|
||||
datatype: "number",
|
||||
grow: false,
|
||||
@@ -53,7 +62,7 @@ const MachinesReportsList = ({ data, specialFilter }) => {
|
||||
header: "تعداد ماموریت",
|
||||
id: "missions",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
enableSorting: true,
|
||||
datatype: "number",
|
||||
grow: false,
|
||||
size: 50,
|
||||
@@ -67,11 +76,12 @@ const MachinesReportsList = ({ data, specialFilter }) => {
|
||||
<DataTableWithAuth
|
||||
TableToolbar={Toolbar}
|
||||
columns={columns}
|
||||
data={data.data}
|
||||
table_url={GET_MACHINES_ACTIVITY_REPORT}
|
||||
page_name={"roadMissionReport"}
|
||||
table_name={"roadMissionReportList"}
|
||||
enablePagination={false}
|
||||
enablePagination={true}
|
||||
specialFilter={specialFilter}
|
||||
need_filter={true}
|
||||
enableRowActions
|
||||
RowActions={RowActionsWithRowData}
|
||||
/>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
"use client";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import { GET_MACHINES_COUNTRY_ACTIVITY_REPORT, GET_MACHINES_PROVINCE_ACTIVITY_REPORT } from "@/core/utils/routes";
|
||||
import { useAuth } from "@/lib/contexts/auth";
|
||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { LinearProgress, Stack } from "@mui/material";
|
||||
import { Stack } from "@mui/material";
|
||||
import moment from "jalali-moment";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
@@ -14,10 +12,8 @@ import MachinesReportsList from "./MachinesReportsList";
|
||||
import SearchReportList from "./Search";
|
||||
|
||||
const MachinesReportsPage = () => {
|
||||
const [data, setData] = useState(null);
|
||||
const { data: userPermissions } = usePermissions();
|
||||
const { user } = useAuth();
|
||||
const requestServer = useRequest();
|
||||
const hasProvincesPermission = userPermissions?.includes("mission-report-country");
|
||||
|
||||
const defaultValues = {
|
||||
@@ -32,38 +28,32 @@ const MachinesReportsPage = () => {
|
||||
];
|
||||
const [specialFilter, setSpecialFilter] = useState(defaultFilter);
|
||||
|
||||
const onSearchSubmit = async (data) => {
|
||||
const params = new URLSearchParams();
|
||||
params.set("from_date", `${data.from_date} 00:00:00`);
|
||||
params.set("date_to", `${data.date_to} 23:59:59`);
|
||||
setSpecialFilter([
|
||||
{ value: `${data.province_id}`, datatype: "numeric", id: "province_id", fn: "equals" },
|
||||
{ value: `${data.from_date} 00:00:00`, datatype: "date", id: "start_time", fn: "greaterThan" },
|
||||
{ value: `${data.date_to} 23:59:59`, datatype: "date", id: "finish_time", fn: "lessThan" },
|
||||
]);
|
||||
if (data.province_id === "-1") {
|
||||
try {
|
||||
const response = await requestServer(`${GET_MACHINES_COUNTRY_ACTIVITY_REPORT}?${params}`);
|
||||
const result = response.data.data;
|
||||
const onSearchSubmit = (data) => {
|
||||
const filters = [
|
||||
{
|
||||
value: `${data.from_date} 00:00:00`,
|
||||
datatype: "date",
|
||||
id: "start_time",
|
||||
fn: "greaterThan",
|
||||
},
|
||||
{
|
||||
value: `${data.date_to} 23:59:59`,
|
||||
datatype: "date",
|
||||
id: "finish_time",
|
||||
fn: "lessThan",
|
||||
},
|
||||
];
|
||||
|
||||
setData({
|
||||
data: result.activities,
|
||||
filters: data,
|
||||
});
|
||||
} catch (e) {}
|
||||
} else {
|
||||
try {
|
||||
params.set("province_id", `${data.province_id}`);
|
||||
const response = await requestServer(`${GET_MACHINES_PROVINCE_ACTIVITY_REPORT}?${params}`);
|
||||
|
||||
const result = response.data.data;
|
||||
|
||||
setData({
|
||||
data: result.activities,
|
||||
filters: data,
|
||||
});
|
||||
} catch (e) {}
|
||||
if (data.province_id !== "-1") {
|
||||
filters.unshift({
|
||||
value: data.province_id,
|
||||
datatype: "numeric",
|
||||
id: "province_id",
|
||||
fn: "equals",
|
||||
});
|
||||
}
|
||||
|
||||
setSpecialFilter(filters);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -100,7 +90,7 @@ const MachinesReportsPage = () => {
|
||||
handleSubmit={handleSubmit}
|
||||
onSearchSubmit={onSearchSubmit}
|
||||
/>
|
||||
{!data ? <LinearProgress /> : <MachinesReportsList specialFilter={specialFilter} data={data} />}
|
||||
<MachinesReportsList specialFilter={specialFilter} />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -3,17 +3,22 @@ import DataTableWithAuth from "@/core/components/DataTableWithAuth";
|
||||
import { Box } from "@mui/material";
|
||||
import { useMemo } from "react";
|
||||
import Toolbar from "./Toolbar";
|
||||
import {
|
||||
GET_MACHINES_TYPE_COUNTRY_ACTIVITY_REPORT,
|
||||
GET_MACHINES_TYPE_PROVINCE_ACTIVITY_REPORT,
|
||||
} from "@/core/utils/routes";
|
||||
// import RowActions from "./RowActions";
|
||||
|
||||
const MachinesReportsList = ({ data, specialFilter }) => {
|
||||
const MachinesReportsList = ({ specialFilter }) => {
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
accessorKey: "car_type",
|
||||
header: "نوع ماشین",
|
||||
id: "car_type",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
enableColumnFilter: true,
|
||||
columnFilterModeOptions: ["equals", "contains"],
|
||||
enableSorting: true,
|
||||
datatype: "text",
|
||||
grow: false,
|
||||
size: 50,
|
||||
@@ -23,7 +28,7 @@ const MachinesReportsList = ({ data, specialFilter }) => {
|
||||
header: "کارکرد",
|
||||
id: "func",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
enableSorting: true,
|
||||
datatype: "number",
|
||||
grow: false,
|
||||
size: 50,
|
||||
@@ -33,7 +38,7 @@ const MachinesReportsList = ({ data, specialFilter }) => {
|
||||
header: "تعداد ماموریت",
|
||||
id: "missions",
|
||||
enableColumnFilter: false,
|
||||
enableSorting: false,
|
||||
enableSorting: true,
|
||||
datatype: "number",
|
||||
grow: false,
|
||||
size: 50,
|
||||
@@ -46,11 +51,16 @@ const MachinesReportsList = ({ data, specialFilter }) => {
|
||||
<DataTableWithAuth
|
||||
TableToolbar={Toolbar}
|
||||
columns={columns}
|
||||
data={data.data}
|
||||
table_url={
|
||||
specialFilter.find((x) => x.id === "province_id")?.value === "-1"
|
||||
? GET_MACHINES_TYPE_COUNTRY_ACTIVITY_REPORT
|
||||
: GET_MACHINES_TYPE_PROVINCE_ACTIVITY_REPORT
|
||||
}
|
||||
page_name={"roadMissionReportMachineTypeReport"}
|
||||
table_name={"roadMissionReportMachineTypeReportList"}
|
||||
enablePagination={false}
|
||||
specialFilter={specialFilter}
|
||||
need_filter={true}
|
||||
// enableRowActions
|
||||
// RowActions={RowActions}
|
||||
/>
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
"use client";
|
||||
import PageTitle from "@/core/components/PageTitle";
|
||||
import {
|
||||
GET_MACHINES_TYPE_COUNTRY_ACTIVITY_REPORT,
|
||||
GET_MACHINES_TYPE_PROVINCE_ACTIVITY_REPORT,
|
||||
} from "@/core/utils/routes";
|
||||
import { useAuth } from "@/lib/contexts/auth";
|
||||
import { usePermissions } from "@/lib/hooks/usePermissions";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { LinearProgress, Stack } from "@mui/material";
|
||||
import { Stack } from "@mui/material";
|
||||
import moment from "jalali-moment";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
@@ -17,10 +12,8 @@ import MachinesReportsList from "./MachinesReportsList";
|
||||
import SearchReportList from "./Search";
|
||||
|
||||
const MachinesTypeReportsPage = () => {
|
||||
const [data, setData] = useState(null);
|
||||
const { data: userPermissions } = usePermissions();
|
||||
const { user } = useAuth();
|
||||
const requestServer = useRequest();
|
||||
const hasProvincesPermission = userPermissions?.includes("mission-report-country");
|
||||
|
||||
const defaultValues = {
|
||||
@@ -30,43 +23,37 @@ const MachinesTypeReportsPage = () => {
|
||||
};
|
||||
const defaultFilter = [
|
||||
{ value: `${defaultValues.province_id}`, datatype: "numeric", id: "province_id", fn: "equals" },
|
||||
{ value: `${defaultValues.from_date}`, datatype: "date", id: "from_date", fn: "between" },
|
||||
{ value: `${defaultValues.date_to}`, datatype: "date", id: "date_to", fn: "between" },
|
||||
{ value: `${defaultValues.from_date} 00:00:00`, datatype: "date", id: "start_time", fn: "greaterThan" },
|
||||
{ value: `${defaultValues.date_to} 23:59:59`, datatype: "date", id: "finish_time", fn: "lessThan" },
|
||||
];
|
||||
const [specialFilter, setSpecialFilter] = useState(defaultFilter);
|
||||
|
||||
const onSearchSubmit = async (data) => {
|
||||
const params = new URLSearchParams();
|
||||
params.set("from_date", `${data.from_date} 00:00:00`);
|
||||
params.set("date_to", `${data.date_to} 23:59:59`);
|
||||
setSpecialFilter([
|
||||
{ value: `${data.province_id}`, datatype: "numeric", id: "province_id", fn: "equals" },
|
||||
{ value: `${data.from_date}`, datatype: "date", id: "from_date", fn: "between" },
|
||||
{ value: `${data.date_to}`, datatype: "date", id: "date_to", fn: "between" },
|
||||
]);
|
||||
if (data.province_id === "-1") {
|
||||
try {
|
||||
const response = await requestServer(`${GET_MACHINES_TYPE_COUNTRY_ACTIVITY_REPORT}?${params}`);
|
||||
const result = response.data.data;
|
||||
const onSearchSubmit = (data) => {
|
||||
const filters = [
|
||||
{
|
||||
value: `${data.from_date} 00:00:00`,
|
||||
datatype: "date",
|
||||
id: "start_time",
|
||||
fn: "greaterThan",
|
||||
},
|
||||
{
|
||||
value: `${data.date_to} 23:59:59`,
|
||||
datatype: "date",
|
||||
id: "finish_time",
|
||||
fn: "lessThan",
|
||||
},
|
||||
];
|
||||
|
||||
setData({
|
||||
data: result.activities,
|
||||
filters: data,
|
||||
});
|
||||
} catch (e) {}
|
||||
} else {
|
||||
try {
|
||||
params.set("province_id", `${data.province_id}`);
|
||||
const response = await requestServer(`${GET_MACHINES_TYPE_PROVINCE_ACTIVITY_REPORT}?${params}`);
|
||||
|
||||
const result = response.data.data;
|
||||
|
||||
setData({
|
||||
data: result.activities,
|
||||
filters: data,
|
||||
});
|
||||
} catch (e) {}
|
||||
if (data.province_id !== "-1") {
|
||||
filters.unshift({
|
||||
value: data.province_id,
|
||||
datatype: "numeric",
|
||||
id: "province_id",
|
||||
fn: "equals",
|
||||
});
|
||||
}
|
||||
|
||||
setSpecialFilter(filters);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -103,7 +90,7 @@ const MachinesTypeReportsPage = () => {
|
||||
handleSubmit={handleSubmit}
|
||||
onSearchSubmit={onSearchSubmit}
|
||||
/>
|
||||
{!data ? <LinearProgress /> : <MachinesReportsList specialFilter={specialFilter} data={data} />}
|
||||
<MachinesReportsList specialFilter={specialFilter} />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Button, DialogActions, DialogContent, Stack, Typography } from "@mui/material";
|
||||
import React, { useState } from "react";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { DELETE_VIOLATION } from "@/core/utils/routes";
|
||||
|
||||
const DeleteContent = ({ rowId, mutate, setOpenDeleteDialog }) => {
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const requestServer = useRequest({ notificationSuccess: true });
|
||||
const handleClick = () => {
|
||||
setSubmitting(true);
|
||||
requestServer(`${DELETE_VIOLATION}/${rowId}`, "post", {
|
||||
hasSidebarUpdate: true,
|
||||
})
|
||||
.then(() => {
|
||||
mutate();
|
||||
setOpenDeleteDialog(false);
|
||||
setSubmitting(false);
|
||||
})
|
||||
.catch(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<DialogContent>
|
||||
<Stack alignItems="center" spacing={2}>
|
||||
<Typography mt={2}>آیا از حذف تخلف اطمینان دارید؟</Typography>
|
||||
</Stack>
|
||||
</DialogContent>
|
||||
<DialogActions sx={{ justifyContent: "center", paddingBottom: 2, width: "100%" }}>
|
||||
<Button onClick={() => setOpenDeleteDialog(false)} variant="outlined" color="secondary">
|
||||
خیر !
|
||||
</Button>
|
||||
<Button onClick={handleClick} variant="contained" color="error" disabled={submitting}>
|
||||
{submitting ? "درحال حذف..." : "بله اطمینان دارم"}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default DeleteContent;
|
||||
@@ -0,0 +1,33 @@
|
||||
import { useState } from "react";
|
||||
import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
||||
import DeleteIcon from "@mui/icons-material/Delete";
|
||||
import DeleteContent from "./DeleteContent";
|
||||
|
||||
const DeleteViolation = ({ mutate, rowId }) => {
|
||||
const [openDeleteDialog, setOpenDeleteDialog] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tooltip title="حذف">
|
||||
<IconButton color="error" onClick={() => setOpenDeleteDialog(true)}>
|
||||
<DeleteIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog
|
||||
open={openDeleteDialog}
|
||||
onClose={() => setOpenDeleteDialog(false)}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
boxShadow: "rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px",
|
||||
},
|
||||
}}
|
||||
dir="rtl"
|
||||
maxWidth={"md"}
|
||||
>
|
||||
<DialogTitle>حذف تخلف</DialogTitle>
|
||||
<DeleteContent rowId={rowId} mutate={mutate} setOpenDeleteDialog={setOpenDeleteDialog} />
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
}
|
||||
export default DeleteViolation
|
||||
@@ -1,5 +1,6 @@
|
||||
// import CreateWithoutProcess from "../Actions/CreateWithoutProcess";
|
||||
import EditViolation from "../Actions/EditViolation";
|
||||
import DeleteViolation from "../Actions/DeleteViolation";
|
||||
|
||||
const RowActions = ({ row, mutate }) => {
|
||||
// const canEdit = row.original.status === 0 && row.original.type === 1;
|
||||
@@ -7,6 +8,7 @@ const RowActions = ({ row, mutate }) => {
|
||||
<>
|
||||
{!row.original.mileage && <EditViolation row={row} mutate={mutate} rowId={row.getValue("id")} />}
|
||||
{/*{canEdit && <CreateWithoutProcess row={row} mutate={mutate} />}*/}
|
||||
<DeleteViolation />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -61,23 +61,6 @@ const ViolationsList = () => {
|
||||
columnFilterModeOptions: ["equals", "contains"],
|
||||
grow: false,
|
||||
},
|
||||
{
|
||||
accessorKey: "status",
|
||||
header: "وضعیت",
|
||||
id: "status",
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterMode: "equals",
|
||||
sortDescFirst: true,
|
||||
grow: false,
|
||||
columnSelectOption: () => {
|
||||
return violationsCategoryStatus.map((category) => ({
|
||||
value: category.id,
|
||||
label: category.name_fa,
|
||||
}));
|
||||
},
|
||||
Cell: ({ row }) => (row.original.type === 1 ? "خروج بدون مجوز" : "عدم تحرک"),
|
||||
},
|
||||
{
|
||||
accessorKey: "machine_code",
|
||||
header: "کد خودرو",
|
||||
@@ -142,16 +125,6 @@ const ViolationsList = () => {
|
||||
grow: false,
|
||||
Cell: ({ row }) => row.original.machine?.car_name || "-",
|
||||
},
|
||||
{
|
||||
accessorKey: "mission_id",
|
||||
header: "کد ماموریت",
|
||||
id: "mission_id",
|
||||
enableColumnFilter: false,
|
||||
datatype: "numeric",
|
||||
filterMode: "equals",
|
||||
grow: false,
|
||||
Cell: ({ row }) => row.original.mission_id || "-",
|
||||
},
|
||||
{
|
||||
accessorKey: "request_date",
|
||||
header: "تاریخ تخلف",
|
||||
|
||||
@@ -249,14 +249,14 @@ export const FINISH_MISSION = api + "/api/v3/missions/control_unit/finish";
|
||||
export const GET_ROAD_MISSIONS_VIOLATIONS_LIST = api + "/api/v3/missions/violation_management";
|
||||
export const GET_MISSION_PROVINCE_ACTIVITY_REPORT = api + "/api/v3/missions/report/country_activity";
|
||||
export const GET_MISSION_CITY_ACTIVITY_REPORT = api + "/api/v3/missions/report/country_activity";
|
||||
export const GET_MACHINES_COUNTRY_ACTIVITY_REPORT = api + "/api/v3/missions/report_machine/country_machines_activity";
|
||||
export const GET_MACHINES_ACTIVITY_REPORT = api + "/api/v3/missions/report_machine/machines_activity";
|
||||
export const GET_MACHINES_PROVINCE_ACTIVITY_REPORT = api + "/api/v3/missions/report_machine/province_machines_activity";
|
||||
export const EXPORT_GET_MACHINES_COUNTRY_ACTIVITY_REPORT =
|
||||
api + "/api/v3/missions/report_machine/country_machines_activity_excel";
|
||||
export const EXPORT_GET_MACHINES_PROVINCE_ACTIVITY_REPORT =
|
||||
api + "/api/v3/missions/report_machine/province_machines_activity_excel";
|
||||
|
||||
export const GET_DRIVER_COUNTRY_ACTIVITY_REPORT =
|
||||
export const GET_DRIVERS_ACTIVITY_REPORT =
|
||||
api + "/api/v3/missions/report_machine/country_machine_drivers_activity";
|
||||
export const GET_DRIVER_PROVINCE_ACTIVITY_REPORT =
|
||||
api + "/api/v3/missions/report_machine/province_machine_drivers_activity";
|
||||
@@ -275,6 +275,7 @@ export const EXPORT_GET_MACHINES_TYPE_PROVINCE_ACTIVITY_REPORT =
|
||||
api + "/api/v3/missions/report_machine/province_machine_types_activity_excel";
|
||||
export const CREATE_VIOLATION = api + "/api/v3/missions/violation_management";
|
||||
export const EDIT_VIOLATION = api + "/api/v3/missions/violation_management";
|
||||
export const DELETE_VIOLATION = api + "/api/v3/missions/violation_management";
|
||||
export const EXPORT_COUNTRY_ROAD_MISSIONS_REPORTS = api + "/api/v3/missions/report/country_excel_activity";
|
||||
export const EXPORT_PROVINCE_ROAD_MISSIONS_REPORTS = api + "/api/v3/missions/report/province_excel_activity";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user