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