Merge branch 'release/v1.8.6'
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
HOST="rms.witel.ir"
|
HOST="rms.witel.ir"
|
||||||
HOST_RMTO="rms.rmto.ir"
|
HOST_RMTO="rms.rmto.ir"
|
||||||
NEXT_PUBLIC_VERSION="1.8.5"
|
NEXT_PUBLIC_VERSION="1.8.6"
|
||||||
NEXT_PUBLIC_API_URL="https://rms.witel.ir"
|
NEXT_PUBLIC_API_URL="https://rms.witel.ir"
|
||||||
NEXT_PUBLIC_MAPTILE_ENDPOINT="https://rmsmap.rmto.ir/141map"
|
NEXT_PUBLIC_MAPTILE_ENDPOINT="https://rmsmap.rmto.ir/141map"
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Controller } from "react-hook-form";
|
|
||||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||||
import React from "react";
|
|
||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
|
import { Controller } from "react-hook-form";
|
||||||
|
|
||||||
const FromDateController = ({ control }) => {
|
const FromDateController = ({ control }) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { Button, Grid, LinearProgress, Typography } from "@mui/material";
|
|
||||||
import SearchIcon from "@mui/icons-material/Search";
|
import SearchIcon from "@mui/icons-material/Search";
|
||||||
import React from "react";
|
import { Button, Grid } from "@mui/material";
|
||||||
import FromDateController from "./FromDateController";
|
|
||||||
import ToDateController from "./ToDateController";
|
|
||||||
import SelectProvince from "./SelectProvince";
|
|
||||||
import { Controller } from "react-hook-form";
|
import { Controller } from "react-hook-form";
|
||||||
|
import FromDateController from "./FromDateController";
|
||||||
|
import SelectProvince from "./SelectProvince";
|
||||||
|
import ToDateController from "./ToDateController";
|
||||||
|
|
||||||
const SearchReportField = ({ control, hasProvincesPermission }) => {
|
const SearchReportField = ({ control, hasProvincesPermission }) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { Controller } from "react-hook-form";
|
|
||||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
|
||||||
import React from "react";
|
|
||||||
import { FormControl, FormHelperText, InputLabel, LinearProgress, MenuItem, Select, Typography } from "@mui/material";
|
|
||||||
import useProvinces from "@/lib/hooks/useProvince";
|
import useProvinces from "@/lib/hooks/useProvince";
|
||||||
|
import { FormControl, FormHelperText, InputLabel, MenuItem, Select } from "@mui/material";
|
||||||
|
import { Controller } from "react-hook-form";
|
||||||
|
|
||||||
const SelectProvince = ({ control }) => {
|
const SelectProvince = ({ control }) => {
|
||||||
const { provinces, loadingProvinces, errorProvinces } = useProvinces();
|
const { provinces, loadingProvinces, errorProvinces } = useProvinces();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Controller, useWatch } from "react-hook-form";
|
|
||||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||||
import React from "react";
|
|
||||||
import moment from "jalali-moment";
|
import moment from "jalali-moment";
|
||||||
|
import { Controller, useWatch } from "react-hook-form";
|
||||||
|
|
||||||
const ToDateController = ({ control }) => {
|
const ToDateController = ({ control }) => {
|
||||||
const minDate = useWatch({ control, name: "from_date" });
|
const minDate = useWatch({ control, name: "from_date" });
|
||||||
@@ -13,6 +12,7 @@ const ToDateController = ({ control }) => {
|
|||||||
<MuiDatePicker
|
<MuiDatePicker
|
||||||
name="date_to"
|
name="date_to"
|
||||||
minDate={minDate}
|
minDate={minDate}
|
||||||
|
maxDate={new Date()}
|
||||||
error={!!error}
|
error={!!error}
|
||||||
value={value}
|
value={value}
|
||||||
label={"تاریخ شروع (تا تاریخ)"}
|
label={"تاریخ شروع (تا تاریخ)"}
|
||||||
|
|||||||
@@ -2,10 +2,6 @@ import PrintExcel from "./ExcelPrint";
|
|||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
|
|
||||||
const Toolbar = ({ table, filterData, mutate }) => {
|
const Toolbar = ({ table, filterData, mutate }) => {
|
||||||
return (
|
return <Box sx={{ display: "flex", gap: 1 }}>{/* <PrintExcel table={table} filterData={filterData} /> */}</Box>;
|
||||||
<Box sx={{ display: "flex", gap: 1 }}>
|
|
||||||
<PrintExcel table={table} filterData={filterData} />
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
export default Toolbar;
|
export default Toolbar;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const ReportPage = () => {
|
|||||||
const { data: userPermissions } = usePermissions();
|
const { data: userPermissions } = usePermissions();
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const requestServer = useRequest();
|
const requestServer = useRequest();
|
||||||
const hasProvincesPermission = userPermissions?.includes("all"); // TODO : change permission
|
const hasProvincesPermission = userPermissions?.includes("mission-report-country");
|
||||||
|
|
||||||
const defaultValues = {
|
const defaultValues = {
|
||||||
from_date: moment(new Date()).format("YYYY-MM-DD"),
|
from_date: moment(new Date()).format("YYYY-MM-DD"),
|
||||||
@@ -118,6 +118,7 @@ const ReportPage = () => {
|
|||||||
resolver: yupResolver(validationSchema),
|
resolver: yupResolver(validationSchema),
|
||||||
mode: "all",
|
mode: "all",
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack spacing={1}>
|
<Stack spacing={1}>
|
||||||
<PageTitle title={"کارتابل گزارش ماموریت"} />
|
<PageTitle title={"کارتابل گزارش ماموریت"} />
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
|
import CarCode from "@/core/components/CarCode";
|
||||||
|
import LtrTextField from "@/core/components/LtrTextField";
|
||||||
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import { Button, DialogActions, DialogContent, Stack } from "@mui/material";
|
import { Button, DialogActions, DialogContent, Stack } from "@mui/material";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import CarCode from "@/core/components/CarCode";
|
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
|
||||||
import * as yup from "yup";
|
import * as yup from "yup";
|
||||||
import StyledForm from "@/core/components/StyledForm";
|
|
||||||
const schema = yup.object().shape({
|
const schema = yup.object().shape({
|
||||||
machinesId: yup.object().required("کد خودرو الزامی است."),
|
machinesId: yup.object().required("کد خودرو الزامی است."),
|
||||||
|
km: yup.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const CreateViolationForm = ({ setOpenMachinesDialog, defaultValues, onSubmitBase }) => {
|
const CreateViolationForm = ({ setOpenMachinesDialog, defaultValues, onSubmitBase }) => {
|
||||||
@@ -22,20 +24,43 @@ const CreateViolationForm = ({ setOpenMachinesDialog, defaultValues, onSubmitBas
|
|||||||
<>
|
<>
|
||||||
<StyledForm onSubmit={handleSubmit(handleOnSubmit)}>
|
<StyledForm onSubmit={handleSubmit(handleOnSubmit)}>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Stack sx={{ minWidth: "200px" }}>
|
<Stack alignItems="stretch" spacing={2}>
|
||||||
<Controller
|
<Stack sx={{ minWidth: "200px" }}>
|
||||||
control={control}
|
<Controller
|
||||||
render={({ field, fieldState: { error } }) => {
|
control={control}
|
||||||
return (
|
render={({ field, fieldState: { error } }) => {
|
||||||
<CarCode
|
return (
|
||||||
carCode={field.value}
|
<CarCode
|
||||||
setCarCode={(value) => field.onChange(value)}
|
carCode={field.value}
|
||||||
error={error}
|
setCarCode={(value) => field.onChange(value)}
|
||||||
|
error={error}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
name={"machinesId"}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<Stack>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name={"km"}
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<LtrTextField
|
||||||
|
autoComplete="off"
|
||||||
|
type="tel"
|
||||||
|
value={field.value}
|
||||||
|
onChange={(e) => {
|
||||||
|
if (isNaN(Number(e.target.value))) return;
|
||||||
|
field.onChange(e.target.value);
|
||||||
|
}}
|
||||||
|
size="small"
|
||||||
|
fullWidth
|
||||||
|
label="کیلومتر خودرو / ساعت کار"
|
||||||
|
InputLabelProps={{ shrink: true }}
|
||||||
/>
|
/>
|
||||||
);
|
)}
|
||||||
}}
|
/>
|
||||||
name={"machinesId"}
|
</Stack>
|
||||||
/>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions sx={{ alignItems: "center", justifyContent: "end" }}>
|
<DialogActions sx={{ alignItems: "center", justifyContent: "end" }}>
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ const ViolationForm = ({ setOpenMachinesDialog, mutate, openMachinesDialog }) =>
|
|||||||
|
|
||||||
const defaultValues = {
|
const defaultValues = {
|
||||||
machinesId: null,
|
machinesId: null,
|
||||||
|
km: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
const submitForm = async (result) => {
|
const submitForm = async (result) => {
|
||||||
await requestServer(CREATE_VIOLATION, "post", {
|
await requestServer(CREATE_VIOLATION, "post", {
|
||||||
data: {
|
data: {
|
||||||
machine_code: result.machinesId.machine_code,
|
machine_code: result.machinesId.machine_code,
|
||||||
|
km: result.km,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|||||||
@@ -33,12 +33,21 @@ const ViolationsList = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "machine_code",
|
accessorKey: "machine_code",
|
||||||
header: "خودرو",
|
header: "کد خودرو",
|
||||||
id: "machine_code",
|
id: "machine_code",
|
||||||
datatype: "text",
|
datatype: "text",
|
||||||
columnFilterModeOptions: ["equals", "contains"],
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
grow: false,
|
grow: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "machine",
|
||||||
|
header: "نام خودرو",
|
||||||
|
id: "machine",
|
||||||
|
datatype: "text",
|
||||||
|
columnFilterModeOptions: ["equals", "contains"],
|
||||||
|
grow: false,
|
||||||
|
Cell: ({ row }) => row.original.machine?.car_name || "-",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
accessorKey: "mission_id",
|
accessorKey: "mission_id",
|
||||||
header: "کد ماموریت",
|
header: "کد ماموریت",
|
||||||
|
|||||||
@@ -164,15 +164,15 @@ export const pageMenu = [
|
|||||||
"manage-violation-station",
|
"manage-violation-station",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// id: "roadMissionsReports",
|
id: "roadMissionsReports",
|
||||||
// label: "گزارشات",
|
label: "گزارشات",
|
||||||
// type: "page",
|
type: "page",
|
||||||
// route: "/dashboard/road-missions/reports",
|
route: "/dashboard/road-missions/reports",
|
||||||
// icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
// // badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
||||||
// permissions: ["all"],
|
permissions: ["all"],
|
||||||
// },
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -163,15 +163,15 @@ export const pageMenuDev = [
|
|||||||
"manage-violation-station",
|
"manage-violation-station",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// id: "roadMissionsReports",
|
id: "roadMissionsReports",
|
||||||
// label: "گزارشات",
|
label: "گزارشات",
|
||||||
// type: "page",
|
type: "page",
|
||||||
// route: "/dashboard/road-missions/reports",
|
route: "/dashboard/road-missions/reports",
|
||||||
// icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
icon: <AssessmentIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||||
// // badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
// badges: [{ key: "mission.control" }], // TODO: add badge and permission
|
||||||
// permissions: ["all"],
|
permissions: ["all"],
|
||||||
// },
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user