Merge branch 'feature/delete_button_dialog' into 'develop'
close button dialog See merge request witel-front-end/rms!72
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
import DamagesReportPage from "@/components/dashboard/damages/report"
|
import DamagesReportPage from "@/components/dashboard/damages/report";
|
||||||
import WithPermission from "@/core/middlewares/withPermission"
|
import WithPermission from "@/core/middlewares/withPermission";
|
||||||
|
|
||||||
const Page = () => {
|
const Page = () => {
|
||||||
return <WithPermission permission_name={["show-receipt", 'show-receipt-province']}><DamagesReportPage /></WithPermission>
|
return (
|
||||||
}
|
<WithPermission permission_name={["show-receipt", "show-receipt-province"]}>
|
||||||
export default Page
|
<DamagesReportPage />
|
||||||
|
</WithPermission>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default Page;
|
||||||
|
|||||||
@@ -1,13 +1,27 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Dialog } from "@mui/material";
|
import { Dialog, IconButton } from "@mui/material";
|
||||||
import FormAndRequest from "./FormAndRequest";
|
import FormAndRequest from "./FormAndRequest";
|
||||||
import DialogLoading from "@/core/components/DialogLoading";
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const CandUAzmayesh = ({ open, setOpen, mutate, updateInfo, rowId, loadingOpen, fromUpdate = false }) => {
|
const CandUAzmayesh = ({ open, setOpen, mutate, updateInfo, rowId, loadingOpen, fromUpdate = false }) => {
|
||||||
const isUpdateReady = fromUpdate ? updateInfo !== null : true;
|
const isUpdateReady = fromUpdate ? updateInfo !== null : true;
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth maxWidth="lg">
|
<Dialog open={open} fullWidth maxWidth="lg">
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{isUpdateReady ? (
|
{isUpdateReady ? (
|
||||||
<FormAndRequest
|
<FormAndRequest
|
||||||
setOpen={setOpen}
|
setOpen={setOpen}
|
||||||
|
|||||||
@@ -1,11 +1,25 @@
|
|||||||
import { Dialog } from "@mui/material";
|
import { Dialog, IconButton } from "@mui/material";
|
||||||
import FormAndRequest from "./FormAndRequest";
|
import FormAndRequest from "./FormAndRequest";
|
||||||
import DialogLoading from "@/core/components/DialogLoading";
|
import DialogLoading from "@/core/components/DialogLoading";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const CandUAzmayeshType = ({ open, setOpen, mutate, rowId, updateInfo, loadingOpen, fromUpdate = false }) => {
|
const CandUAzmayeshType = ({ open, setOpen, mutate, rowId, updateInfo, loadingOpen, fromUpdate = false }) => {
|
||||||
const isUpdateReady = fromUpdate ? updateInfo !== null : true;
|
const isUpdateReady = fromUpdate ? updateInfo !== null : true;
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth maxWidth="lg">
|
<Dialog open={open} fullWidth maxWidth="lg">
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{isUpdateReady ? (
|
{isUpdateReady ? (
|
||||||
<FormAndRequest
|
<FormAndRequest
|
||||||
setOpen={setOpen}
|
setOpen={setOpen}
|
||||||
|
|||||||
@@ -1,9 +1,23 @@
|
|||||||
import { Dialog } from "@mui/material";
|
import { Dialog, IconButton } from "@mui/material";
|
||||||
import CreateFormContent from "./CreateFormContent";
|
import CreateFormContent from "./CreateFormContent";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const CreateForm = ({ open, setOpen, mutate }) => {
|
const CreateForm = ({ open, setOpen, mutate }) => {
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth maxWidth="xs">
|
<Dialog open={open} fullWidth maxWidth="xs">
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{open && <CreateFormContent setOpen={setOpen} mutate={mutate} />}
|
{open && <CreateFormContent setOpen={setOpen} mutate={mutate} />}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import BorderColorIcon from "@mui/icons-material/BorderColor";
|
|||||||
import { Dialog, IconButton, Tooltip } from "@mui/material";
|
import { Dialog, IconButton, Tooltip } from "@mui/material";
|
||||||
import EditFormContent from "./Form";
|
import EditFormContent from "./Form";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const Edit = ({ row, mutate, rowId }) => {
|
const Edit = ({ row, mutate, rowId }) => {
|
||||||
const [openEditDialog, setOpenEditDialog] = useState(false);
|
const [openEditDialog, setOpenEditDialog] = useState(false);
|
||||||
@@ -20,6 +21,19 @@ const Edit = ({ row, mutate, rowId }) => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Dialog open={openEditDialog} fullWidth maxWidth="xs">
|
<Dialog open={openEditDialog} fullWidth maxWidth="xs">
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpenEditDialog(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{openEditDialog && (
|
{openEditDialog && (
|
||||||
<EditFormContent rowId={rowId} row={row} setOpen={setOpenEditDialog} mutate={mutate} />
|
<EditFormContent rowId={rowId} row={row} setOpen={setOpenEditDialog} mutate={mutate} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { Dialog } from "@mui/material";
|
import { Dialog, IconButton } from "@mui/material";
|
||||||
import CreateFormContent from "./CreateFormContent";
|
import CreateFormContent from "./CreateFormContent";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { CREATE_DAMAGE } from "@/core/utils/routes";
|
import { CREATE_DAMAGE } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const OperatorCreateForm = ({ open, setOpen, mutate }) => {
|
const OperatorCreateForm = ({ open, setOpen, mutate }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
@@ -74,6 +75,19 @@ const OperatorCreateForm = ({ open, setOpen, mutate }) => {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth maxWidth="md">
|
<Dialog open={open} fullWidth maxWidth="md">
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{open && (
|
{open && (
|
||||||
<CreateFormContent
|
<CreateFormContent
|
||||||
defaultData={defaultData}
|
defaultData={defaultData}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import BorderColorIcon from "@mui/icons-material/BorderColor";
|
import BorderColorIcon from "@mui/icons-material/BorderColor";
|
||||||
import EditController from "./EditController";
|
import EditController from "./EditController";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const EditForm = ({ row, mutate, rowId }) => {
|
const EditForm = ({ row, mutate, rowId }) => {
|
||||||
const [openEditDialog, setOpenEditDialog] = useState(false);
|
const [openEditDialog, setOpenEditDialog] = useState(false);
|
||||||
@@ -29,6 +30,19 @@ const EditForm = ({ row, mutate, rowId }) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpenEditDialog(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{openEditDialog && (
|
{openEditDialog && (
|
||||||
<EditController
|
<EditController
|
||||||
openEditDialog={openEditDialog}
|
openEditDialog={openEditDialog}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Dialog, IconButton, Tooltip } from "@mui/material";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ReceiptIcon from "@mui/icons-material/Receipt";
|
import ReceiptIcon from "@mui/icons-material/Receipt";
|
||||||
import RegisterInsuranceContent from "./RegisterInsuranceContent";
|
import RegisterInsuranceContent from "./RegisterInsuranceContent";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const RegisterInsurance = ({ row, mutate, rowId }) => {
|
const RegisterInsurance = ({ row, mutate, rowId }) => {
|
||||||
const [openRegisterInsuranceDialog, setOpenRegisterInsuranceDialog] = useState(false);
|
const [openRegisterInsuranceDialog, setOpenRegisterInsuranceDialog] = useState(false);
|
||||||
@@ -24,6 +25,19 @@ const RegisterInsurance = ({ row, mutate, rowId }) => {
|
|||||||
maxWidth={"sm"}
|
maxWidth={"sm"}
|
||||||
scroll="paper"
|
scroll="paper"
|
||||||
>
|
>
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpenRegisterInsuranceDialog(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{openRegisterInsuranceDialog && (
|
{openRegisterInsuranceDialog && (
|
||||||
<RegisterInsuranceContent
|
<RegisterInsuranceContent
|
||||||
rowId={rowId}
|
rowId={rowId}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const PrintExcel = ({ table, filterData }) => {
|
|||||||
const filename = `خروجی کارتابل گزارشات خسارات وارده بر ابنیه فنی تاریخ_${moment().format("jYYYY_jMM_jDD")}.xlsx`;
|
const filename = `خروجی کارتابل گزارشات خسارات وارده بر ابنیه فنی تاریخ_${moment().format("jYYYY_jMM_jDD")}.xlsx`;
|
||||||
FileSaver.saveAs(response.data, filename);
|
FileSaver.saveAs(response.data, filename);
|
||||||
})
|
})
|
||||||
.catch(() => { })
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ const ReportLists = ({ data, specialFilter }) => {
|
|||||||
return (renderedCellValue / 1).toLocaleString();
|
return (renderedCellValue / 1).toLocaleString();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "kol_sabt_shode",
|
accessorKey: "kol_sabt_shode",
|
||||||
@@ -219,7 +219,7 @@ const ReportLists = ({ data, specialFilter }) => {
|
|||||||
return (renderedCellValue / 1).toLocaleString();
|
return (renderedCellValue / 1).toLocaleString();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const FromDateController = ({ control }) => {
|
|||||||
name="from_date"
|
name="from_date"
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={'تاریخ تصادف (از تاریخ)'}
|
label={"تاریخ تصادف (از تاریخ)"}
|
||||||
placeholder={"از تاریخ"}
|
placeholder={"از تاریخ"}
|
||||||
setFieldValue={(name, newValue) => {
|
setFieldValue={(name, newValue) => {
|
||||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const ToDateController = ({ control }) => {
|
|||||||
minDate={minDate}
|
minDate={minDate}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={'تاریخ تصادف (تا تاریخ)'}
|
label={"تاریخ تصادف (تا تاریخ)"}
|
||||||
placeholder={"تا تاریخ"}
|
placeholder={"تا تاریخ"}
|
||||||
setFieldValue={(name, newValue) => {
|
setFieldValue={(name, newValue) => {
|
||||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
'use client'
|
"use client";
|
||||||
import PageTitle from "@/core/components/PageTitle";
|
import PageTitle from "@/core/components/PageTitle";
|
||||||
import { GET_PROVINCE_RECEIPT_REPORT, GET_COUNTRY_RECEIPT_REPORT } from "@/core/utils/routes";
|
import { GET_PROVINCE_RECEIPT_REPORT, GET_COUNTRY_RECEIPT_REPORT } from "@/core/utils/routes";
|
||||||
import { useAuth } from "@/lib/contexts/auth";
|
import { useAuth } from "@/lib/contexts/auth";
|
||||||
@@ -92,12 +92,12 @@ const DamagesReportPage = () => {
|
|||||||
],
|
],
|
||||||
filters: data,
|
filters: data,
|
||||||
});
|
});
|
||||||
} catch (e) { }
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!userPermissions) return
|
if (!userPermissions) return;
|
||||||
onSearchSubmit(defaultValues);
|
onSearchSubmit(defaultValues);
|
||||||
}, [userPermissions]);
|
}, [userPermissions]);
|
||||||
|
|
||||||
@@ -133,5 +133,5 @@ const DamagesReportPage = () => {
|
|||||||
{!data ? <LinearProgress /> : <ReportLists specialFilter={specialFilter} data={data} />}
|
{!data ? <LinearProgress /> : <ReportLists specialFilter={specialFilter} data={data} />}
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
export default DamagesReportPage
|
export default DamagesReportPage;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { Dialog } from "@mui/material";
|
import { Dialog, IconButton } from "@mui/material";
|
||||||
import CreateFormContent from "@/components/dashboard/roadItems/operator/Actions/Create/Forms/CreateFormContent";
|
import CreateFormContent from "@/components/dashboard/roadItems/operator/Actions/Create/Forms/CreateFormContent";
|
||||||
import { CREATE_ROAD_ITEMS } from "@/core/utils/routes";
|
import { CREATE_ROAD_ITEMS } from "@/core/utils/routes";
|
||||||
import useRequest from "@/lib/hooks/useRequest";
|
import useRequest from "@/lib/hooks/useRequest";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const OperatorCreateForm = ({ open, setOpen, mutate }) => {
|
const OperatorCreateForm = ({ open, setOpen, mutate }) => {
|
||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
@@ -22,6 +23,19 @@ const OperatorCreateForm = ({ open, setOpen, mutate }) => {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth maxWidth="sm">
|
<Dialog open={open} fullWidth maxWidth="sm">
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{open && <CreateFormContent setOpen={setOpen} mutate={mutate} onSubmit={HandleSubmit} />}
|
{open && <CreateFormContent setOpen={setOpen} mutate={mutate} onSubmit={HandleSubmit} />}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,11 +1,25 @@
|
|||||||
import { Dialog } from "@mui/material";
|
import { Dialog, IconButton } from "@mui/material";
|
||||||
import GashtCreateContent from "./GashtCreateContent";
|
import GashtCreateContent from "./GashtCreateContent";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const GashtCreate = ({ open, setOpen, mutate, rowId }) => {
|
const GashtCreate = ({ open, setOpen, mutate, rowId }) => {
|
||||||
const [tabState, setTabState] = useState(0);
|
const [tabState, setTabState] = useState(0);
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth maxWidth={tabState === 0 ? "md" : "sm"}>
|
<Dialog open={open} fullWidth maxWidth={tabState === 0 ? "md" : "sm"}>
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{open && (
|
{open && (
|
||||||
<GashtCreateContent mutate={mutate} setOpen={setOpen} setTabState={setTabState} tabState={tabState} />
|
<GashtCreateContent mutate={mutate} setOpen={setOpen} setTabState={setTabState} tabState={tabState} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Dialog, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import BorderColorIcon from "@mui/icons-material/BorderColor";
|
import BorderColorIcon from "@mui/icons-material/BorderColor";
|
||||||
import EditController from "./EditController";
|
import EditController from "./EditController";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const EditForm = ({ row, mutate, rowId }) => {
|
const EditForm = ({ row, mutate, rowId }) => {
|
||||||
const [openEditDialog, setOpenEditDialog] = useState(false);
|
const [openEditDialog, setOpenEditDialog] = useState(false);
|
||||||
@@ -30,6 +31,19 @@ const EditForm = ({ row, mutate, rowId }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DialogTitle>ویرایش اطلاعات</DialogTitle>
|
<DialogTitle>ویرایش اطلاعات</DialogTitle>
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpenEditDialog(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{openEditDialog && (
|
{openEditDialog && (
|
||||||
<EditController
|
<EditController
|
||||||
openEditDialog={openEditDialog}
|
openEditDialog={openEditDialog}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const FromDateController = ({ control }) => {
|
|||||||
name="from_date"
|
name="from_date"
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={'تاریخ فعالیت (از تاریخ)'}
|
label={"تاریخ فعالیت (از تاریخ)"}
|
||||||
placeholder={"از تاریخ"}
|
placeholder={"از تاریخ"}
|
||||||
setFieldValue={(name, newValue) => {
|
setFieldValue={(name, newValue) => {
|
||||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const ToDateController = ({ control }) => {
|
|||||||
minDate={minDate}
|
minDate={minDate}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={'تاریخ فعالیت (تا تاریخ)'}
|
label={"تاریخ فعالیت (تا تاریخ)"}
|
||||||
placeholder={"تا تاریخ"}
|
placeholder={"تا تاریخ"}
|
||||||
setFieldValue={(name, newValue) => {
|
setFieldValue={(name, newValue) => {
|
||||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ const ReportPage = () => {
|
|||||||
edare_name: "کل کشور",
|
edare_name: "کل کشور",
|
||||||
sum: result.activities.length
|
sum: result.activities.length
|
||||||
? result.activities
|
? result.activities
|
||||||
.filter((report) => report.p === -1)
|
.filter((report) => report.p === -1)
|
||||||
.reduce((acc, report) => acc + (report.s || 0), 0)
|
.reduce((acc, report) => acc + (report.s || 0), 0)
|
||||||
: 0,
|
: 0,
|
||||||
};
|
};
|
||||||
itemsList.forEach((item) => {
|
itemsList.forEach((item) => {
|
||||||
@@ -82,7 +82,7 @@ const ReportPage = () => {
|
|||||||
],
|
],
|
||||||
filters: data,
|
filters: data,
|
||||||
});
|
});
|
||||||
} catch (e) { }
|
} catch (e) {}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
params.set("province_id", `${data.province_id}`);
|
params.set("province_id", `${data.province_id}`);
|
||||||
@@ -92,8 +92,8 @@ const ReportPage = () => {
|
|||||||
edare_name: "کل استان",
|
edare_name: "کل استان",
|
||||||
sum: result.activities.length
|
sum: result.activities.length
|
||||||
? result.activities
|
? result.activities
|
||||||
.filter((report) => report.c === -1)
|
.filter((report) => report.c === -1)
|
||||||
.reduce((acc, report) => acc + (report.s || 0), 0)
|
.reduce((acc, report) => acc + (report.s || 0), 0)
|
||||||
: 0,
|
: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -126,12 +126,12 @@ const ReportPage = () => {
|
|||||||
],
|
],
|
||||||
filters: data,
|
filters: data,
|
||||||
});
|
});
|
||||||
} catch (e) { }
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!userPermissions) return
|
if (!userPermissions) return;
|
||||||
if (itemsList.length === 0) return;
|
if (itemsList.length === 0) return;
|
||||||
onSearchSubmit(defaultValues);
|
onSearchSubmit(defaultValues);
|
||||||
}, [itemsList, userPermissions]);
|
}, [itemsList, userPermissions]);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const FromDateController = ({ control }) => {
|
|||||||
name="from_date"
|
name="from_date"
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={'تاریخ فعالیت (از تاریخ)'}
|
label={"تاریخ فعالیت (از تاریخ)"}
|
||||||
placeholder={"از تاریخ"}
|
placeholder={"از تاریخ"}
|
||||||
setFieldValue={(name, newValue) => {
|
setFieldValue={(name, newValue) => {
|
||||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const ToDateController = ({ control }) => {
|
|||||||
minDate={minDate}
|
minDate={minDate}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={'تاریخ فعالیت (تا تاریخ)'}
|
label={"تاریخ فعالیت (تا تاریخ)"}
|
||||||
placeholder={"تا تاریخ"}
|
placeholder={"تا تاریخ"}
|
||||||
setFieldValue={(name, newValue) => {
|
setFieldValue={(name, newValue) => {
|
||||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ const SubItemsReports = () => {
|
|||||||
columns: createColumns(result.sub_items),
|
columns: createColumns(result.sub_items),
|
||||||
filters: data,
|
filters: data,
|
||||||
});
|
});
|
||||||
} catch (e) { }
|
} catch (e) {}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
params.set("province_id", `${data.province_id}`);
|
params.set("province_id", `${data.province_id}`);
|
||||||
@@ -216,7 +216,7 @@ const SubItemsReports = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!userPermissions) return
|
if (!userPermissions) return;
|
||||||
onSearchSubmit(defaultValues);
|
onSearchSubmit(defaultValues);
|
||||||
}, [userPermissions]);
|
}, [userPermissions]);
|
||||||
|
|
||||||
|
|||||||
@@ -125,8 +125,8 @@ const SupervisorList = () => {
|
|||||||
props.dependencyFieldValue?.value === ""
|
props.dependencyFieldValue?.value === ""
|
||||||
? "empty"
|
? "empty"
|
||||||
: loadingEdaratList
|
: loadingEdaratList
|
||||||
? "loading"
|
? "loading"
|
||||||
: props.filterParameters.value
|
: props.filterParameters.value
|
||||||
}
|
}
|
||||||
columnSelectOption={getColumnSelectOptions}
|
columnSelectOption={getColumnSelectOptions}
|
||||||
/>
|
/>
|
||||||
@@ -217,8 +217,8 @@ const SupervisorList = () => {
|
|||||||
props.dependencyFieldValue.value === ""
|
props.dependencyFieldValue.value === ""
|
||||||
? "empty"
|
? "empty"
|
||||||
: loadingSubItemsList
|
: loadingSubItemsList
|
||||||
? "loading"
|
? "loading"
|
||||||
: props.filterParameters.value
|
: props.filterParameters.value
|
||||||
}
|
}
|
||||||
columnSelectOption={getColumnSelectOptions}
|
columnSelectOption={getColumnSelectOptions}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,11 +1,25 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Dialog } from "@mui/material";
|
import { Dialog, IconButton } from "@mui/material";
|
||||||
import PatrolForms from "./PatrolForms";
|
import PatrolForms from "./PatrolForms";
|
||||||
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
const CreatePatrol = ({ open, setOpen, mutate }) => {
|
const CreatePatrol = ({ open, setOpen, mutate }) => {
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} fullWidth maxWidth="md">
|
<Dialog open={open} fullWidth maxWidth="md">
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
sx={(theme) => ({
|
||||||
|
position: "absolute",
|
||||||
|
right: 8,
|
||||||
|
top: 8,
|
||||||
|
zIndex: 50,
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
{open && <PatrolForms setOpen={setOpen} mutate={mutate} />}
|
{open && <PatrolForms setOpen={setOpen} mutate={mutate} />}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const FromDateController = ({ control }) => {
|
|||||||
name="from_date"
|
name="from_date"
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={'تاریخ شروع (از تاریخ)'}
|
label={"تاریخ شروع (از تاریخ)"}
|
||||||
placeholder={"از تاریخ"}
|
placeholder={"از تاریخ"}
|
||||||
setFieldValue={(name, newValue) => {
|
setFieldValue={(name, newValue) => {
|
||||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const ToDateController = ({ control }) => {
|
|||||||
minDate={minDate}
|
minDate={minDate}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={'تاریخ شروع (تا تاریخ)'}
|
label={"تاریخ شروع (تا تاریخ)"}
|
||||||
placeholder={"تا تاریخ"}
|
placeholder={"تا تاریخ"}
|
||||||
setFieldValue={(name, newValue) => {
|
setFieldValue={(name, newValue) => {
|
||||||
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
const formattedDate = moment(new Date(newValue)).locale("en").format("YYYY-MM-DD");
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ const ReportPage = () => {
|
|||||||
],
|
],
|
||||||
filters: data,
|
filters: data,
|
||||||
});
|
});
|
||||||
} catch (e) { }
|
} catch (e) {}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
params.set("province_id", `${data.province_id}`);
|
params.set("province_id", `${data.province_id}`);
|
||||||
@@ -90,12 +90,12 @@ const ReportPage = () => {
|
|||||||
],
|
],
|
||||||
filters: data,
|
filters: data,
|
||||||
});
|
});
|
||||||
} catch (e) { }
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!userPermissions) return
|
if (!userPermissions) return;
|
||||||
onSearchSubmit(defaultValues);
|
onSearchSubmit(defaultValues);
|
||||||
}, [userPermissions]);
|
}, [userPermissions]);
|
||||||
|
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ const SupervisorList = () => {
|
|||||||
props.dependencyFieldValue?.value === ""
|
props.dependencyFieldValue?.value === ""
|
||||||
? "empty"
|
? "empty"
|
||||||
: loadingEdaratList
|
: loadingEdaratList
|
||||||
? "loading"
|
? "loading"
|
||||||
: props.filterParameters.value
|
: props.filterParameters.value
|
||||||
}
|
}
|
||||||
columnSelectOption={getColumnSelectOptions}
|
columnSelectOption={getColumnSelectOptions}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ export const pageMenu = [
|
|||||||
type: "page",
|
type: "page",
|
||||||
route: "/dashboard/damages/report",
|
route: "/dashboard/damages/report",
|
||||||
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
permissions: ["show-receipt", 'show-receipt-province'],
|
permissions: ["show-receipt", "show-receipt-province"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from "react";
|
||||||
function usePersianInput(inputRef, onChange) {
|
function usePersianInput(inputRef, onChange) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const input = inputRef.current;
|
const input = inputRef.current;
|
||||||
@@ -6,7 +6,7 @@ function usePersianInput(inputRef, onChange) {
|
|||||||
|
|
||||||
const handleInput = (event) => {
|
const handleInput = (event) => {
|
||||||
const originalValue = event.target.value;
|
const originalValue = event.target.value;
|
||||||
const filteredValue = originalValue.replace(/[A-Za-z]/g, '');
|
const filteredValue = originalValue.replace(/[A-Za-z]/g, "");
|
||||||
if (filteredValue !== originalValue) {
|
if (filteredValue !== originalValue) {
|
||||||
event.target.value = filteredValue;
|
event.target.value = filteredValue;
|
||||||
if (onChange) {
|
if (onChange) {
|
||||||
@@ -19,15 +19,15 @@ function usePersianInput(inputRef, onChange) {
|
|||||||
|
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = (event) => {
|
||||||
const controlKeys = [
|
const controlKeys = [
|
||||||
'Backspace',
|
"Backspace",
|
||||||
'Delete',
|
"Delete",
|
||||||
'Tab',
|
"Tab",
|
||||||
'Escape',
|
"Escape",
|
||||||
'Enter',
|
"Enter",
|
||||||
'ArrowLeft',
|
"ArrowLeft",
|
||||||
'ArrowRight',
|
"ArrowRight",
|
||||||
'ArrowUp',
|
"ArrowUp",
|
||||||
'ArrowDown'
|
"ArrowDown",
|
||||||
];
|
];
|
||||||
if (controlKeys.includes(event.key)) return;
|
if (controlKeys.includes(event.key)) return;
|
||||||
|
|
||||||
@@ -36,12 +36,12 @@ function usePersianInput(inputRef, onChange) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
input.addEventListener('input', handleInput);
|
input.addEventListener("input", handleInput);
|
||||||
input.addEventListener('keydown', handleKeyDown);
|
input.addEventListener("keydown", handleKeyDown);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
input.removeEventListener('input', handleInput);
|
input.removeEventListener("input", handleInput);
|
||||||
input.removeEventListener('keydown', handleKeyDown);
|
input.removeEventListener("keydown", handleKeyDown);
|
||||||
};
|
};
|
||||||
}, [inputRef, onChange]);
|
}, [inputRef, onChange]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user