added end_km, fixed time picker & typos #1
@@ -14,6 +14,7 @@ import useCities from "@/lib/hooks/useCities";
|
|||||||
const ControlList = () => {
|
const ControlList = () => {
|
||||||
const columns = useMemo(() => {
|
const columns = useMemo(() => {
|
||||||
const dynamicColumns = {
|
const dynamicColumns = {
|
||||||
|
accessorKey: "province_id",
|
||||||
header: "استان",
|
header: "استان",
|
||||||
id: "province_id",
|
id: "province_id",
|
||||||
enableColumnFilter: true,
|
enableColumnFilter: true,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import LtrTextField from "@/core/components/LtrTextField";
|
||||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||||
import MuiTimePicker from "@/core/components/MuiTimePicker";
|
import MuiTimePicker from "@/core/components/MuiTimePicker";
|
||||||
import { FINISH_MISSION } from "@/core/utils/routes";
|
import { FINISH_MISSION } from "@/core/utils/routes";
|
||||||
@@ -14,6 +15,7 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
|
|||||||
const requestServer = useRequest({ notificationSuccess: true });
|
const requestServer = useRequest({ notificationSuccess: true });
|
||||||
|
|
||||||
const validationSchema = object().shape({
|
const validationSchema = object().shape({
|
||||||
|
end_km: string().required("لطفاً کیلومتر را وارد کنید."),
|
||||||
start_date: mixed().required("تاریخ خروج خودرو را مشخص کنید."),
|
start_date: mixed().required("تاریخ خروج خودرو را مشخص کنید."),
|
||||||
start_time: mixed().required("ساعت خروج خودرو را مشخص کنید."),
|
start_time: mixed().required("ساعت خروج خودرو را مشخص کنید."),
|
||||||
});
|
});
|
||||||
@@ -24,6 +26,7 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
|
|||||||
formState: { isSubmitting },
|
formState: { isSubmitting },
|
||||||
} = useForm({
|
} = useForm({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
end_km: "",
|
||||||
start_date: null,
|
start_date: null,
|
||||||
start_time: null,
|
start_time: null,
|
||||||
},
|
},
|
||||||
@@ -36,6 +39,7 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
|
|||||||
const formattedTime = format(values.start_time, "HH:mm");
|
const formattedTime = format(values.start_time, "HH:mm");
|
||||||
requestServer(`${FINISH_MISSION}/${rowId}`, "post", {
|
requestServer(`${FINISH_MISSION}/${rowId}`, "post", {
|
||||||
data: {
|
data: {
|
||||||
|
end_km: values.end_km,
|
||||||
time: `${formattedDate} ${formattedTime}`,
|
time: `${formattedDate} ${formattedTime}`,
|
||||||
},
|
},
|
||||||
hasSidebarUpdate: true,
|
hasSidebarUpdate: true,
|
||||||
@@ -55,6 +59,27 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
|
|||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Stack alignItems="center" spacing={2}>
|
<Stack alignItems="center" spacing={2}>
|
||||||
<Typography mt={2}>آیا از ورود خودرو و پایان ماموریت اطمینان دارید؟</Typography>
|
<Typography mt={2}>آیا از ورود خودرو و پایان ماموریت اطمینان دارید؟</Typography>
|
||||||
|
<Stack>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name={"end_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 }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
@@ -65,8 +90,8 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
|
|||||||
error={error}
|
error={error}
|
||||||
value={field.value || null}
|
value={field.value || null}
|
||||||
disableFuture={false}
|
disableFuture={false}
|
||||||
placeholder={"تاریخ شروع ماموریت را وارد کنید"}
|
placeholder={"تاریخ پایان ماموریت را وارد کنید"}
|
||||||
label={"تاریخ شروع ماموریت"}
|
label={"تاریخ پایان ماموریت"}
|
||||||
setFieldValue={(name, value) => field.onChange(value || null)}
|
setFieldValue={(name, value) => field.onChange(value || null)}
|
||||||
helperText={error ? error.message : null}
|
helperText={error ? error.message : null}
|
||||||
/>
|
/>
|
||||||
@@ -83,8 +108,8 @@ const FinishMissionContent = ({ rowId, mutate, setOpenFinishMissionDialog }) =>
|
|||||||
error={error}
|
error={error}
|
||||||
value={field.value || null}
|
value={field.value || null}
|
||||||
views={["hours", "minutes"]}
|
views={["hours", "minutes"]}
|
||||||
placeholder={"زمان شروع ماموریت را وارد کنید"}
|
placeholder={"زمان پایان ماموریت را وارد کنید"}
|
||||||
label={"زمان شروع ماموریت"}
|
label={"زمان پایان ماموریت"}
|
||||||
setFieldValue={(name, value) => field.onChange(value || null)}
|
setFieldValue={(name, value) => field.onChange(value || null)}
|
||||||
helperText={error ? error.message : null}
|
helperText={error ? error.message : null}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ const MissionDates = ({ control }) => {
|
|||||||
name="start_time"
|
name="start_time"
|
||||||
error={error}
|
error={error}
|
||||||
value={field.value}
|
value={field.value}
|
||||||
views={["hours"]}
|
|
||||||
minTime={
|
minTime={
|
||||||
start_date && new Date(start_date).toDateString() === now.toDateString()
|
start_date && new Date(start_date).toDateString() === now.toDateString()
|
||||||
? now
|
? now
|
||||||
@@ -100,7 +99,6 @@ const MissionDates = ({ control }) => {
|
|||||||
name="end_time"
|
name="end_time"
|
||||||
error={error}
|
error={error}
|
||||||
value={field.value}
|
value={field.value}
|
||||||
views={["hours"]}
|
|
||||||
minTime={startDateTime ?? null}
|
minTime={startDateTime ?? null}
|
||||||
placeholder={"زمان پایان ماموریت را وارد کنید"}
|
placeholder={"زمان پایان ماموریت را وارد کنید"}
|
||||||
label={"زمان پایان ماموریت"}
|
label={"زمان پایان ماموریت"}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const Area = ({ allData, setAllData, handlePrev, setTabState }) => {
|
|||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
<Box sx={{ width: "100%", height: "400px" }}>
|
<Box sx={{ width: "100%", height: "400px" }}>
|
||||||
<MapLayer style={{ borderRadius: "4px" }}>
|
<MapLayer style={{ borderRadius: "4px" }}>
|
||||||
<MapControlPolygon bound={bound} setBound={setBound} boundType={"polyline"} />
|
<MapControlPolygon bound={bound} setBound={setBound} boundType={"polyline"} />
|
||||||
</MapLayer>
|
</MapLayer>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const ToDateController = ({ control }) => {
|
|||||||
maxDate={new Date()}
|
maxDate={new 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");
|
||||||
|
|||||||
@@ -5,10 +5,7 @@ const SearchReportList = ({ handleSubmit, onSearchSubmit, control, hasProvincesP
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<StyledForm onSubmit={handleSubmit(onSearchSubmit)}>
|
<StyledForm onSubmit={handleSubmit(onSearchSubmit)}>
|
||||||
<SearchReportField
|
<SearchReportField control={control} hasProvincesPermission={hasProvincesPermission} />
|
||||||
control={control}
|
|
||||||
hasProvincesPermission={hasProvincesPermission}
|
|
||||||
/>
|
|
||||||
</StyledForm>
|
</StyledForm>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,10 +5,7 @@ const SearchReportList = ({ handleSubmit, onSearchSubmit, control, hasProvincesP
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<StyledForm onSubmit={handleSubmit(onSearchSubmit)}>
|
<StyledForm onSubmit={handleSubmit(onSearchSubmit)}>
|
||||||
<SearchReportField
|
<SearchReportField control={control} hasProvincesPermission={hasProvincesPermission} />
|
||||||
control={control}
|
|
||||||
hasProvincesPermission={hasProvincesPermission}
|
|
||||||
/>
|
|
||||||
</StyledForm>
|
</StyledForm>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -47,10 +47,8 @@ export const GET_COUNTRY_ACTIVITY_REPORT = api + "/api/v3/missions/report/countr
|
|||||||
export const EXPORT_COUNTRY_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrols/report/country_activity_excel";
|
export const EXPORT_COUNTRY_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrols/report/country_activity_excel";
|
||||||
export const EXPORT_PROVINCE_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrols/report/province_activity_excel";
|
export const EXPORT_PROVINCE_ROAD_PATROL_REPORTS = api + "/api/v3/road_patrols/report/province_activity_excel";
|
||||||
|
|
||||||
export const GET_MISSIONS_REPORT_TARADOD_COUNTRY_ACTIVITY =
|
export const GET_MISSIONS_REPORT_TARADOD_COUNTRY_ACTIVITY = api + "/api/v3/missions/report_taradod/country_activity";
|
||||||
api + "/api/v3/missions/report_taradod/country_activity";
|
export const GET_MISSIONS_REPORT_TARADOD_PROVINCE_ACTIVITY = api + "/api/v3/missions/report_taradod/province_activity";
|
||||||
export const GET_MISSIONS_REPORT_TARADOD_PROVINCE_ACTIVITY =
|
|
||||||
api + "/api/v3/missions/report_taradod/province_activity";
|
|
||||||
export const EXPORT_MISSIONS_REPORT_TARADOD_COUNTRY_EXCEL_ACTIVITY =
|
export const EXPORT_MISSIONS_REPORT_TARADOD_COUNTRY_EXCEL_ACTIVITY =
|
||||||
api + "/api/v3/missions/report_taradod/country_excel_activity";
|
api + "/api/v3/missions/report_taradod/country_excel_activity";
|
||||||
export const EXPORT_MISSIONS_REPORT_TARADOD_PROVINCE_EXCEL_ACTIVITY =
|
export const EXPORT_MISSIONS_REPORT_TARADOD_PROVINCE_EXCEL_ACTIVITY =
|
||||||
|
|||||||
Reference in New Issue
Block a user