Feature/update profile sidebar
This commit is contained in:
@@ -19,32 +19,23 @@ const HeaderMenu = ({ menu }) => {
|
||||
<Button
|
||||
color="inherit"
|
||||
aria-haspopup="true"
|
||||
aria-expanded={open ? 'true' : undefined}
|
||||
aria-expanded={open ? "true" : undefined}
|
||||
onClick={handleClick}
|
||||
endIcon={open ? <ExpandLess /> : <ExpandMore />}
|
||||
>
|
||||
{menu.title}
|
||||
</Button>
|
||||
<Menu
|
||||
anchorEl={anchorEl}
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
>
|
||||
<Menu anchorEl={anchorEl} open={open} onClose={handleClose}>
|
||||
{menu.subMenu.flatMap((subMenu, index) => [
|
||||
...subMenu.map(sub => (
|
||||
<MenuItem
|
||||
component={NextLink}
|
||||
href={sub.href}
|
||||
key={sub.title}
|
||||
onClick={handleClose}
|
||||
>
|
||||
...subMenu.map((sub) => (
|
||||
<MenuItem component={NextLink} href={sub.href} key={sub.title} onClick={handleClose}>
|
||||
<ListItemIcon>
|
||||
<Link fontSize="small" />
|
||||
</ListItemIcon>
|
||||
<ListItemText>{sub.title}</ListItemText>
|
||||
</MenuItem>
|
||||
)),
|
||||
index < menu.subMenu.length - 1 && <Divider key={`divider-${index}`} />
|
||||
index < menu.subMenu.length - 1 && <Divider key={`divider-${index}`} />,
|
||||
])}
|
||||
</Menu>
|
||||
</>
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
import { getValueByPath } from "@/core/utils/getValueByPath";
|
||||
import { useSidebarBadge } from "@/lib/hooks/useSidebarBadge"
|
||||
import { Chip } from "@mui/material"
|
||||
import { useSidebarBadge } from "@/lib/hooks/useSidebarBadge";
|
||||
import { Chip } from "@mui/material";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const SidebarBadge = ({ badge, chipProps = {} }) => {
|
||||
const { data } = useSidebarBadge()
|
||||
const [value, setValue] = useState()
|
||||
const { data } = useSidebarBadge();
|
||||
const [value, setValue] = useState();
|
||||
|
||||
useEffect(() => {
|
||||
setValue(getValueByPath(data, badge))
|
||||
}, [data, badge])
|
||||
setValue(getValueByPath(data, badge));
|
||||
}, [data, badge]);
|
||||
|
||||
if (!data) return null;
|
||||
if (!value) return null;
|
||||
|
||||
if (!data) return null
|
||||
if (!value) return null
|
||||
|
||||
return (
|
||||
<Chip label={(value).toLocaleString("fa-IR")} size="small" {...chipProps} />
|
||||
)
|
||||
}
|
||||
export default SidebarBadge
|
||||
return <Chip label={value.toLocaleString("fa-IR")} size="small" {...chipProps} />;
|
||||
};
|
||||
export default SidebarBadge;
|
||||
|
||||
@@ -31,8 +31,10 @@ const SidebarListItems = ({ menuItem, dispatch }) => {
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={menuItem.label} />
|
||||
{menuItem.badges && (
|
||||
<Stack direction={'row'} sx={{ px: .5 }} spacing={.5}>
|
||||
{menuItem.badges.map((badge, i) => <SidebarBadge chipProps={{ color: 'primary' }} key={i} badge={badge} />)}
|
||||
<Stack direction={"row"} sx={{ px: 0.5 }} spacing={0.5}>
|
||||
{menuItem.badges.map((badge, i) => (
|
||||
<SidebarBadge chipProps={{ color: "primary" }} key={i} badge={badge} />
|
||||
))}
|
||||
</Stack>
|
||||
)}
|
||||
{menuItem.hasSubitems ? menuItem.showSubitems ? <ExpandLess /> : <ExpandMore /> : null}
|
||||
|
||||
@@ -28,9 +28,7 @@ function selectPage(item, route) {
|
||||
|
||||
function toggleSubitems(items, actionId) {
|
||||
return items.map((item) =>
|
||||
actionId === item.id
|
||||
? { ...item, showSubitems: !item.showSubitems }
|
||||
: { ...item, showSubitems: false }
|
||||
actionId === item.id ? { ...item, showSubitems: !item.showSubitems } : { ...item, showSubitems: false }
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,28 +46,23 @@ function reducer(state, action) {
|
||||
|
||||
case "COLLAPSE_SUB_ITEMS":
|
||||
return state.map((item) =>
|
||||
item.hasSubitems
|
||||
? { ...item, Subitems: toggleSubitems(item.Subitems, action.id) }
|
||||
: item
|
||||
item.hasSubitems ? { ...item, Subitems: toggleSubitems(item.Subitems, action.id) } : item
|
||||
);
|
||||
|
||||
case "COLLAPSE_SUB_SECOND_ITEMS":
|
||||
return state.map((item) =>
|
||||
item.hasSubitems
|
||||
? {
|
||||
...item,
|
||||
Subitems: item.Subitems.map((subitem) =>
|
||||
subitem.hasSubitems
|
||||
? {
|
||||
...subitem,
|
||||
Subitems: toggleSubitems(
|
||||
subitem.Subitems,
|
||||
action.id
|
||||
),
|
||||
}
|
||||
: subitem
|
||||
),
|
||||
}
|
||||
...item,
|
||||
Subitems: item.Subitems.map((subitem) =>
|
||||
subitem.hasSubitems
|
||||
? {
|
||||
...subitem,
|
||||
Subitems: toggleSubitems(subitem.Subitems, action.id),
|
||||
}
|
||||
: subitem
|
||||
),
|
||||
}
|
||||
: item
|
||||
);
|
||||
|
||||
@@ -108,15 +101,13 @@ const SidebarMenu = () => {
|
||||
return (
|
||||
<>
|
||||
<Profile />
|
||||
{
|
||||
userPermissions && (
|
||||
<List sx={{ overflow: "auto", flex: 1 }} disablePadding dense>
|
||||
{menuItems.map((menuItem) => {
|
||||
return <SidebarListItems dispatch={dispatch} key={menuItem.id} menuItem={menuItem} />;
|
||||
})}
|
||||
</List>
|
||||
)
|
||||
}
|
||||
{userPermissions && (
|
||||
<List sx={{ overflow: "auto", flex: 1 }} disablePadding dense>
|
||||
{menuItems.map((menuItem) => {
|
||||
return <SidebarListItems dispatch={dispatch} key={menuItem.id} menuItem={menuItem} />;
|
||||
})}
|
||||
</List>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -29,11 +29,21 @@ const SidebarSubitems = ({ subitem, dispatch }) => {
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={subitem.label} />
|
||||
{subitem.badges && (
|
||||
<Stack direction={'row'} sx={{ px: .5 }} spacing={.5}>
|
||||
{subitem.badges.map((badge, i) => <SidebarBadge key={i} badge={badge} />)}
|
||||
<Stack direction={"row"} sx={{ px: 0.5 }} spacing={0.5}>
|
||||
{subitem.badges.map((badge, i) => (
|
||||
<SidebarBadge key={i} badge={badge} />
|
||||
))}
|
||||
</Stack>
|
||||
)}
|
||||
{subitem.hasSubitems ? subitem.showSubitems ? <ExpandLess /> : <ExpandMore /> : <Box sx={{ width: 29 }} />}
|
||||
{subitem.hasSubitems ? (
|
||||
subitem.showSubitems ? (
|
||||
<ExpandLess />
|
||||
) : (
|
||||
<ExpandMore />
|
||||
)
|
||||
) : (
|
||||
<Box sx={{ width: 29 }} />
|
||||
)}
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
<Collapse in={subitem.showSubitems} timeout="auto" mountOnEnter={true} unmountOnExit={true}>
|
||||
|
||||
@@ -10,7 +10,7 @@ import { headerMenu } from "@/core/utils/headerMenu";
|
||||
import SidebarMenu from "./Sidebar/SidebarMenu";
|
||||
|
||||
const drawerWidth = 300;
|
||||
const headersHeight = 136
|
||||
const headersHeight = 136;
|
||||
|
||||
const Main = styled(Stack, { shouldForwardProp: (prop) => prop !== "open" })(({ theme, open }) => ({
|
||||
flexGrow: 1,
|
||||
@@ -66,9 +66,14 @@ const HeaderWithSidebar = ({ children }) => {
|
||||
setOpen(false);
|
||||
};
|
||||
return (
|
||||
<Box sx={{
|
||||
display: "flex", height: `calc(100% - ${headersHeight}px)`, width: "100%", mt: `${headersHeight}px`
|
||||
}}>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
height: `calc(100% - ${headersHeight}px)`,
|
||||
width: "100%",
|
||||
mt: `${headersHeight}px`,
|
||||
}}
|
||||
>
|
||||
<AppBar sx={{ position: "fixed", top: "unset" }} elevation={0} open={open}>
|
||||
<Toolbar variant="dense" sx={{ minHeight: 40 }}>
|
||||
<IconButton
|
||||
@@ -81,7 +86,9 @@ const HeaderWithSidebar = ({ children }) => {
|
||||
<MenuIcon />
|
||||
</IconButton>
|
||||
<Box sx={{ flexGrow: 1, display: { xs: "none", md: "flex" } }}>
|
||||
{headerMenu.map(menu => <HeaderMenu key={menu.title} menu={menu} />)}
|
||||
{headerMenu.map((menu) => (
|
||||
<HeaderMenu key={menu.title} menu={menu} />
|
||||
))}
|
||||
</Box>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
@@ -104,7 +111,9 @@ const HeaderWithSidebar = ({ children }) => {
|
||||
open={open}
|
||||
>
|
||||
<DrawerHeader sx={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
|
||||
<Typography variant="subtitle2" color="#757575" sx={{ px: 1 }}>تاریخ امروز: {now}</Typography>
|
||||
<Typography variant="subtitle2" color="#757575" sx={{ px: 1 }}>
|
||||
تاریخ امروز: {now}
|
||||
</Typography>
|
||||
<IconButton onClick={handleDrawerClose}>
|
||||
<ChevronRightIcon />
|
||||
</IconButton>
|
||||
|
||||
@@ -221,7 +221,7 @@ const DataTable_TableBodyCell = ({ cell, numRows, rowRef, staticColumnIndex, sta
|
||||
{tableCellProps.children ?? (
|
||||
<>
|
||||
{cell.getIsPlaceholder() ? (
|
||||
columnDef.PlaceholderCell?.({ cell, column, row, table }) ?? null
|
||||
(columnDef.PlaceholderCell?.({ cell, column, row, table }) ?? null)
|
||||
) : showSkeletons !== false && (isLoading || showSkeletons) ? (
|
||||
<Skeleton animation="wave" height={20} width={skeletonWidth} {...skeletonProps} />
|
||||
) : columnDefType === "display" &&
|
||||
|
||||
@@ -27,9 +27,10 @@ const DataTable_TableContainer = ({ table, ...rest }) => {
|
||||
};
|
||||
|
||||
useIsomorphicLayoutEffect(() => {
|
||||
const topToolbarHeight = typeof document !== "undefined" ? topToolbarRef.current?.offsetHeight ?? 0 : 0;
|
||||
const topToolbarHeight = typeof document !== "undefined" ? (topToolbarRef.current?.offsetHeight ?? 0) : 0;
|
||||
|
||||
const bottomToolbarHeight = typeof document !== "undefined" ? bottomToolbarRef?.current?.offsetHeight ?? 0 : 0;
|
||||
const bottomToolbarHeight =
|
||||
typeof document !== "undefined" ? (bottomToolbarRef?.current?.offsetHeight ?? 0) : 0;
|
||||
|
||||
setTotalToolbarHeight(topToolbarHeight + bottomToolbarHeight);
|
||||
});
|
||||
|
||||
@@ -24,13 +24,11 @@ import VisibilityOff from "@mui/icons-material/VisibilityOff";
|
||||
const validationSchema = object({
|
||||
current_password: string().required("اجباری"),
|
||||
new_password: string().required("اجباری"),
|
||||
repeat_new_password: string().required("اجباری").test(
|
||||
"password-match",
|
||||
"رمز عبور جدید و تکرار آن باید یکسان باشند",
|
||||
function(value) {
|
||||
repeat_new_password: string()
|
||||
.required("اجباری")
|
||||
.test("password-match", "رمز عبور جدید و تکرار آن باید یکسان باشند", function (value) {
|
||||
return this.parent.new_password === value;
|
||||
},
|
||||
),
|
||||
}),
|
||||
});
|
||||
|
||||
const Form = ({ handleCloseForm, setLoading }) => {
|
||||
@@ -61,8 +59,7 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
try {
|
||||
await request(CHANGE_USER_PASSWORD, "post", { data: formData, signal: controller.signal });
|
||||
handleCloseForm();
|
||||
} catch (error) {
|
||||
}
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -152,4 +149,4 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Form;
|
||||
export default Form;
|
||||
|
||||
@@ -19,19 +19,29 @@ const ChangePass = ({ open, setOpen }) => {
|
||||
<Form handleCloseForm={handleCloseForm} setLoading={setLoading} />
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<LoadingButton loading={loading} variant="outlined" color="error" size="large"
|
||||
onClick={handleCloseForm}>
|
||||
<LoadingButton
|
||||
loading={loading}
|
||||
variant="outlined"
|
||||
color="error"
|
||||
size="large"
|
||||
onClick={handleCloseForm}
|
||||
>
|
||||
بستن
|
||||
</LoadingButton>
|
||||
<LoadingButton type="submit" loading={loading} form="ChangePassword"
|
||||
size="large" autoFocus
|
||||
variant="contained"
|
||||
loadingPosition="end"
|
||||
endIcon={<SaveIcon />}>
|
||||
<LoadingButton
|
||||
type="submit"
|
||||
loading={loading}
|
||||
form="ChangePassword"
|
||||
size="large"
|
||||
autoFocus
|
||||
variant="contained"
|
||||
loadingPosition="end"
|
||||
endIcon={<SaveIcon />}
|
||||
>
|
||||
ثبت
|
||||
</LoadingButton>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
export default ChangePass;
|
||||
export default ChangePass;
|
||||
|
||||
@@ -35,9 +35,13 @@ const ProfileActions = () => {
|
||||
</Tooltip>
|
||||
<Divider orientation="vertical" variant="middle" flexItem sx={{ mx: 1 }} />
|
||||
<Tooltip title="تغییر رمز عبور" arrow>
|
||||
<IconButton aria-label="تغییر رمز عبور" color="primary" onClick={() => {
|
||||
setOpenChangePass(true);
|
||||
}}>
|
||||
<IconButton
|
||||
aria-label="تغییر رمز عبور"
|
||||
color="primary"
|
||||
onClick={() => {
|
||||
setOpenChangePass(true);
|
||||
}}
|
||||
>
|
||||
<VpnKeyIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
|
||||
@@ -1,31 +1,35 @@
|
||||
"use client";
|
||||
|
||||
import { useAuth } from "@/lib/contexts/auth";
|
||||
import { Avatar, Box, Chip, Divider, Stack, Typography } from "@mui/material";
|
||||
import moment from "jalali-moment";
|
||||
|
||||
const ProfileInfo = () => {
|
||||
const { user } = useAuth();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box sx={{ display: "flex", alignItems: "center", my: 0.5 }}>
|
||||
<Avatar
|
||||
alt="User Image"
|
||||
src=""
|
||||
sx={{ width: 56, height: 56 }}
|
||||
/>
|
||||
<Avatar alt="User Image" src={user?.avatar} sx={{ width: 56, height: 56 }} />
|
||||
<Stack sx={{ ml: 1 }}>
|
||||
<Box sx={{ display: "flex", alignItems: "end", gap: 0.7 }}>
|
||||
<Typography variant="h6">حسن محمد زاده عبدالله</Typography>
|
||||
<Typography variant="h6">{`${user.first_name} ${user.last_name}`}</Typography>
|
||||
</Box>
|
||||
<Typography variant="caption">.: اداره کل ستاد :.</Typography>
|
||||
<Typography variant="caption">.: {user.name} :.</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
<Box sx={{ display: "flex", alignItems: "center", my: 0.5 }}>
|
||||
<Typography variant="button" color="#757575">آخرین ورود</Typography>
|
||||
<Typography variant="button" color="#757575">
|
||||
آخرین ورود
|
||||
</Typography>
|
||||
<Divider sx={{ mx: 2, flexGrow: 1 }} />
|
||||
<Typography variant="subtitle2" color="#757575">1 ساعت پیش</Typography>
|
||||
<Typography variant="subtitle2" color="#757575">
|
||||
{moment(user.last_login).locale("fa").fromNow()}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box sx={{ my: 0.5 }}>
|
||||
<Divider>
|
||||
<Chip size="small" label="userName" color="success" variant="outlined" />
|
||||
<Chip size="small" label={user.username} color="success" variant="outlined" />
|
||||
</Divider>
|
||||
</Box>
|
||||
</>
|
||||
|
||||
@@ -53,11 +53,11 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
const { user, getUser } = useAuth();
|
||||
const [uploadBackDrop, setUploadBackDrop] = useState(false);
|
||||
const defaultValues = {
|
||||
first_name: user.data.first_name,
|
||||
last_name: user.data.last_name,
|
||||
major: user.data.major,
|
||||
degree: user.data.degree,
|
||||
mobile: user.data.mobile,
|
||||
first_name: user.first_name,
|
||||
last_name: user.last_name,
|
||||
major: user.major,
|
||||
degree: user.degree,
|
||||
mobile: user.mobile,
|
||||
avatar: null,
|
||||
};
|
||||
|
||||
@@ -89,8 +89,7 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
await request(UPDATE_USER_ROUTE, "post", { data: formData });
|
||||
getUser();
|
||||
handleCloseForm();
|
||||
} catch (error) {
|
||||
}
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -99,15 +98,17 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
<Chip color="success" variant="outlined" label="ویرایش پروفایل" />
|
||||
</Divider>
|
||||
<StyledForm onSubmit={handleSubmit(onSubmit)} id={"UpdateProfile"}>
|
||||
<Box sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
mb: 4,
|
||||
position: "relative",
|
||||
borderRadius: "50%",
|
||||
}}>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
mb: 4,
|
||||
position: "relative",
|
||||
borderRadius: "50%",
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
component="label"
|
||||
sx={{
|
||||
@@ -123,15 +124,16 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
onMouseEnter={() => setUploadBackDrop(true)}
|
||||
onMouseLeave={() => setUploadBackDrop(false)}
|
||||
>
|
||||
<Avatar
|
||||
src={`${process.env.NEXT_PUBLIC_API_URL}/${user.data.avatar}`}
|
||||
sx={{ width: 120, height: 120, border: "1px solid #e1e1e1" }}
|
||||
/>
|
||||
<Avatar src={user?.avatar} sx={{ width: 120, height: 120, border: "1px solid #e1e1e1" }} />
|
||||
<Backdrop
|
||||
sx={{
|
||||
color: "#fff", zIndex: (theme) => theme.zIndex.drawer + 1,
|
||||
position: "absolute", width: 120, height: 120,
|
||||
marginLeft: "auto", marginRight: "auto",
|
||||
color: "#fff",
|
||||
zIndex: (theme) => theme.zIndex.drawer + 1,
|
||||
position: "absolute",
|
||||
width: 120,
|
||||
height: 120,
|
||||
marginLeft: "auto",
|
||||
marginRight: "auto",
|
||||
borderRadius: "50%",
|
||||
}}
|
||||
open={uploadBackDrop}
|
||||
@@ -139,8 +141,11 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
<CloudUploadIcon sx={{ fontSize: "2rem" }} color="inherit" />
|
||||
</Backdrop>
|
||||
</Box>
|
||||
<VisuallyHiddenInput type="file" accept="image/*"
|
||||
onChange={(event) => setValue("avatar", event.target.files[0])} />
|
||||
<VisuallyHiddenInput
|
||||
type="file"
|
||||
accept="image/*"
|
||||
onChange={(event) => setValue("avatar", event.target.files[0])}
|
||||
/>
|
||||
</Button>
|
||||
</Box>
|
||||
<Grid container columns={{ xs: 1, sm: 2 }} spacing={2}>
|
||||
@@ -156,8 +161,9 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
fullWidth
|
||||
type="text"
|
||||
/>
|
||||
<FormHelperText
|
||||
id="first_name">{errors.first_name ? errors.first_name.message : null}</FormHelperText>
|
||||
<FormHelperText id="first_name">
|
||||
{errors.first_name ? errors.first_name.message : null}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid item xs={1}>
|
||||
@@ -172,8 +178,9 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
fullWidth
|
||||
type="text"
|
||||
/>
|
||||
<FormHelperText
|
||||
id="last_name">{errors.last_name ? errors.last_name.message : null}</FormHelperText>
|
||||
<FormHelperText id="last_name">
|
||||
{errors.last_name ? errors.last_name.message : null}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid item xs={1}>
|
||||
@@ -188,8 +195,7 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
fullWidth
|
||||
type="text"
|
||||
/>
|
||||
<FormHelperText
|
||||
id="major">{errors.major ? errors.major.message : null}</FormHelperText>
|
||||
<FormHelperText id="major">{errors.major ? errors.major.message : null}</FormHelperText>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid item xs={1}>
|
||||
@@ -217,9 +223,7 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<FormHelperText>
|
||||
{error ? error.message : null}
|
||||
</FormHelperText>
|
||||
<FormHelperText>{error ? error.message : null}</FormHelperText>
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
@@ -236,8 +240,7 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
fullWidth
|
||||
type="text"
|
||||
/>
|
||||
<FormHelperText
|
||||
id="mobile">{errors.mobile ? errors.mobile.message : null}</FormHelperText>
|
||||
<FormHelperText id="mobile">{errors.mobile ? errors.mobile.message : null}</FormHelperText>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
</Grid>
|
||||
@@ -245,4 +248,4 @@ const Form = ({ handleCloseForm, setLoading }) => {
|
||||
</>
|
||||
);
|
||||
};
|
||||
export default Form;
|
||||
export default Form;
|
||||
|
||||
@@ -25,14 +25,20 @@ const Update = ({ open, setOpen }) => {
|
||||
<Button autoFocus variant="outlined" color="error" size="large" onClick={handleCloseForm}>
|
||||
بستن
|
||||
</Button>
|
||||
<LoadingButton type="submit" loading={loading} form="UpdateProfile" size="large" autoFocus
|
||||
variant="contained"
|
||||
loadingPosition="end"
|
||||
endIcon={<SaveIcon />}>
|
||||
<LoadingButton
|
||||
type="submit"
|
||||
loading={loading}
|
||||
form="UpdateProfile"
|
||||
size="large"
|
||||
autoFocus
|
||||
variant="contained"
|
||||
loadingPosition="end"
|
||||
endIcon={<SaveIcon />}
|
||||
>
|
||||
ثبت
|
||||
</LoadingButton>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
export default Update;
|
||||
export default Update;
|
||||
|
||||
@@ -6,12 +6,14 @@ import ProfileActions from "./ProfileActions";
|
||||
|
||||
const Profile = () => {
|
||||
return (
|
||||
<Stack sx={{
|
||||
px: 2,
|
||||
background: "#f7f7f7",
|
||||
borderTop: "1px dashed #e1e1e1",
|
||||
borderBottom: "1px dashed #e1e1e1",
|
||||
}}>
|
||||
<Stack
|
||||
sx={{
|
||||
px: 2,
|
||||
background: "#f7f7f7",
|
||||
borderTop: "1px dashed #e1e1e1",
|
||||
borderBottom: "1px dashed #e1e1e1",
|
||||
}}
|
||||
>
|
||||
<ProfileInfo />
|
||||
<ProfileActions />
|
||||
</Stack>
|
||||
|
||||
@@ -11,4 +11,4 @@ export const getValueByPath = (obj, path) => {
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,80 +1,80 @@
|
||||
export const headerMenu = [
|
||||
{
|
||||
title: 'تصادفات',
|
||||
title: "تصادفات",
|
||||
subMenu: [
|
||||
[
|
||||
{
|
||||
title: 'تصادفات روزانه',
|
||||
href: 'https://rms.witel.ir/v2/daily_accidents/create'
|
||||
}
|
||||
]
|
||||
]
|
||||
title: "تصادفات روزانه",
|
||||
href: "https://rms.witel.ir/v2/daily_accidents/create",
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'گزارش های جامع',
|
||||
title: "گزارش های جامع",
|
||||
subMenu: [
|
||||
[
|
||||
{
|
||||
title: 'گزارش محوری',
|
||||
href: 'https://rms.witel.ir/v2/axis_reports'
|
||||
title: "گزارش محوری",
|
||||
href: "https://rms.witel.ir/v2/axis_reports",
|
||||
},
|
||||
{
|
||||
title: 'هوش تجاری (BI)',
|
||||
href: 'https://rms.witel.ir/v2/axis_reports'
|
||||
}
|
||||
]
|
||||
]
|
||||
title: "هوش تجاری (BI)",
|
||||
href: "https://rms.witel.ir/v2/axis_reports",
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'زیرساخت و ناوگان',
|
||||
title: "زیرساخت و ناوگان",
|
||||
subMenu: [
|
||||
[
|
||||
{
|
||||
title: 'پراکندگی بر روی نقشه راهدارخانه ها',
|
||||
href: 'https://rms.witel.ir/v2/map?type=rahdar'
|
||||
title: "پراکندگی بر روی نقشه راهدارخانه ها",
|
||||
href: "https://rms.witel.ir/v2/map?type=rahdar",
|
||||
},
|
||||
{
|
||||
title: 'راهدارخانه ها',
|
||||
href: 'https://rms.witel.ir/v2/rahdari_points'
|
||||
}
|
||||
title: "راهدارخانه ها",
|
||||
href: "https://rms.witel.ir/v2/rahdari_points",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
title: 'ممیزی ماشین آلات راهداری کشور',
|
||||
href: 'https://rms.witel.ir/cmms-audit'
|
||||
}
|
||||
]
|
||||
]
|
||||
title: "ممیزی ماشین آلات راهداری کشور",
|
||||
href: "https://rms.witel.ir/cmms-audit",
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'سامانه های راهداری',
|
||||
title: "سامانه های راهداری",
|
||||
subMenu: [
|
||||
[
|
||||
{
|
||||
title: 'تحقیق و توسعه',
|
||||
href: 'https://rms.witel.ir/RandD'
|
||||
title: "تحقیق و توسعه",
|
||||
href: "https://rms.witel.ir/RandD",
|
||||
},
|
||||
{
|
||||
title: 'سامانه مدیریت یکپارچه زیرساخت های راه (PMS,BMS,SMS)',
|
||||
href: 'http://roadams.rmto.ir'
|
||||
title: "سامانه مدیریت یکپارچه زیرساخت های راه (PMS,BMS,SMS)",
|
||||
href: "http://roadams.rmto.ir",
|
||||
},
|
||||
{
|
||||
title: 'سامانه مدیریت ناوگان (FMS)',
|
||||
href: 'http://fms.141.ir'
|
||||
title: "سامانه مدیریت ناوگان (FMS)",
|
||||
href: "http://fms.141.ir",
|
||||
},
|
||||
{
|
||||
title: 'سامانه جامع مدیریت سوانح و حوادث جاده ای',
|
||||
href: 'https://items.rmto.ir'
|
||||
title: "سامانه جامع مدیریت سوانح و حوادث جاده ای",
|
||||
href: "https://items.rmto.ir",
|
||||
},
|
||||
{
|
||||
title: 'سامانه مدیریت نگهداری ماشین آلات (CMMS)',
|
||||
href: 'https://cmms.rmto.ir/Login.aspx?ReturnUrl=%2f'
|
||||
title: "سامانه مدیریت نگهداری ماشین آلات (CMMS)",
|
||||
href: "https://cmms.rmto.ir/Login.aspx?ReturnUrl=%2f",
|
||||
},
|
||||
{
|
||||
title: 'درگاه کاتالوگ داده',
|
||||
href: 'https://roadams.rmto.ir:8080'
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
title: "درگاه کاتالوگ داده",
|
||||
href: "https://roadams.rmto.ir:8080",
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -91,7 +91,7 @@ export const pageMenu = [
|
||||
type: "menu",
|
||||
icon: <FactCheckIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
hasSubitems: true,
|
||||
badges: ['road_items.total'],
|
||||
badges: ["road_items.total"],
|
||||
Subitems: [
|
||||
{
|
||||
id: "roadItemManagmentSupervisor",
|
||||
@@ -99,7 +99,7 @@ export const pageMenu = [
|
||||
type: "menu",
|
||||
icon: <SpeedIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
hasSubitems: true,
|
||||
badges: ['road_items.supervise_cnt'],
|
||||
badges: ["road_items.supervise_cnt"],
|
||||
Subitems: [
|
||||
{
|
||||
id: "roadItemManagmentSupervisorCartable",
|
||||
@@ -119,7 +119,7 @@ export const pageMenu = [
|
||||
type: "menu",
|
||||
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
hasSubitems: true,
|
||||
badges: ['road_items.operation_cnt'],
|
||||
badges: ["road_items.operation_cnt"],
|
||||
Subitems: [
|
||||
{
|
||||
id: "roadItemManagmentOparationCreate",
|
||||
@@ -169,7 +169,7 @@ export const pageMenu = [
|
||||
type: "menu",
|
||||
icon: <FireTruckIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
hasSubitems: true,
|
||||
badges: ['road_patrols.total'],
|
||||
badges: ["road_patrols.total"],
|
||||
Subitems: [
|
||||
{
|
||||
id: "roadPatrolManagmentSupervisor",
|
||||
@@ -177,7 +177,7 @@ export const pageMenu = [
|
||||
type: "menu",
|
||||
icon: <SpeedIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
hasSubitems: true,
|
||||
badges: ['road_patrols.supervise_cnt'],
|
||||
badges: ["road_patrols.supervise_cnt"],
|
||||
Subitems: [
|
||||
{
|
||||
id: "roadPatrolManagmentSupervisorCartable",
|
||||
@@ -197,7 +197,7 @@ export const pageMenu = [
|
||||
type: "menu",
|
||||
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
hasSubitems: true,
|
||||
badges: ['road_patrols.operation_cnt'],
|
||||
badges: ["road_patrols.operation_cnt"],
|
||||
Subitems: [
|
||||
{
|
||||
id: "roadPatrolManagmentOparationCreate",
|
||||
@@ -277,7 +277,7 @@ export const pageMenu = [
|
||||
type: "menu",
|
||||
icon: <RouteIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
hasSubitems: true,
|
||||
badges: ['safety_and_privacy.step_one', 'safety_and_privacy.step_two'],
|
||||
badges: ["safety_and_privacy.step_one", "safety_and_privacy.step_two"],
|
||||
Subitems: [
|
||||
{
|
||||
id: "safetyAndPrivacyManagmentOparation",
|
||||
@@ -340,7 +340,7 @@ export const pageMenu = [
|
||||
type: "menu",
|
||||
icon: <ElectricBoltIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
hasSubitems: true,
|
||||
badges: ['road_observations.total'],
|
||||
badges: ["road_observations.total"],
|
||||
Subitems: [
|
||||
{
|
||||
id: "roadObservationsManagmentSupervisor",
|
||||
@@ -348,7 +348,7 @@ export const pageMenu = [
|
||||
type: "menu",
|
||||
icon: <SpeedIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
hasSubitems: true,
|
||||
badges: ['road_observations.supervise_cnt'],
|
||||
badges: ["road_observations.supervise_cnt"],
|
||||
Subitems: [
|
||||
{
|
||||
id: "roadObservationsManagmentSupervisorCartable",
|
||||
@@ -373,7 +373,7 @@ export const pageMenu = [
|
||||
type: "menu",
|
||||
icon: <EngineeringIcon sx={{ width: "inherit", height: "inherit" }} />,
|
||||
hasSubitems: true,
|
||||
badges: ['road_observations.operation_cnt'],
|
||||
badges: ["road_observations.operation_cnt"],
|
||||
Subitems: [
|
||||
{
|
||||
id: "roadObservationsManagmentOparationCartable",
|
||||
|
||||
@@ -54,7 +54,7 @@ export const AuthProvider = ({ children }) => {
|
||||
const getUser = useCallback(async () => {
|
||||
try {
|
||||
const { data } = await axios.get(GET_USER_ROUTE, { withCredentials: true });
|
||||
changeUser(data);
|
||||
changeUser(data.data);
|
||||
changeAuthState(true);
|
||||
changeInitAuth(true);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user