CFE-13 Merge branch 'feature/CFE-13_change_fundamental' into 'develop'
This commit is contained in:
@@ -1,18 +1,15 @@
|
|||||||
import CenterLayout from "@/layouts/CenterLayout";
|
import CenterLayout from "@/layouts/CenterLayout";
|
||||||
import DashboardLayout from "@/layouts/DashboardLayout";
|
|
||||||
import {Container} from "@mui/material";
|
import {Container} from "@mui/material";
|
||||||
import ChangePasswordForm from "@/components/dashboard/change-password/change-password-form";
|
import ChangePasswordForm from "@/components/dashboard/change-password/change-password-form";
|
||||||
|
|
||||||
const DashboardChangePasswordComponent = () => {
|
const DashboardChangePasswordComponent = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardLayout>
|
<CenterLayout>
|
||||||
<CenterLayout>
|
<Container maxWidth="sm">
|
||||||
<Container maxWidth="sm">
|
<ChangePasswordForm/>
|
||||||
<ChangePasswordForm />
|
</Container>
|
||||||
</Container>
|
</CenterLayout>
|
||||||
</CenterLayout>
|
|
||||||
</DashboardLayout>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default DashboardChangePasswordComponent;
|
export default DashboardChangePasswordComponent;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import StyledForm from "@/core/components/StyledForm";
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
import CenterLayout from "@/layouts/CenterLayout";
|
import CenterLayout from "@/layouts/CenterLayout";
|
||||||
import DashboardLayout from "@/layouts/DashboardLayout";
|
|
||||||
import useUser from "@/lib/app/hooks/useUser";
|
import useUser from "@/lib/app/hooks/useUser";
|
||||||
import {Box, Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material";
|
import {Box, Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
@@ -50,148 +49,146 @@ const DashboardEditProfile = () => {
|
|||||||
const validationSchema = Yup.object().shape({});
|
const validationSchema = Yup.object().shape({});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardLayout>
|
<CenterLayout>
|
||||||
<CenterLayout>
|
<Container maxWidth="sm">
|
||||||
<Container maxWidth="sm">
|
<Formik
|
||||||
<Formik
|
initialValues={initialValues}
|
||||||
initialValues={initialValues}
|
onSubmit={handleSubmit}
|
||||||
onSubmit={handleSubmit}
|
validationSchema={validationSchema}
|
||||||
validationSchema={validationSchema}
|
>
|
||||||
>
|
{(props) => (
|
||||||
{(props) => (
|
<StyledForm
|
||||||
<StyledForm
|
onSubmit={(e) => {
|
||||||
onSubmit={(e) => {
|
e.preventDefault();
|
||||||
e.preventDefault();
|
props.handleSubmit();
|
||||||
props.handleSubmit();
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<Paper elevation={0}>
|
||||||
<Paper elevation={0}>
|
<Stack spacing={3} sx={{p: 5}} component="div">
|
||||||
<Stack spacing={3} sx={{p: 5}} component="div">
|
<Typography margin={2} variant="h4" textAlign="center">
|
||||||
<Typography margin={2} variant="h4" textAlign="center">
|
{t("UpdateProfile.typography_edit_profile")}
|
||||||
{t("UpdateProfile.typography_edit_profile")}
|
</Typography>
|
||||||
</Typography>
|
<Box
|
||||||
<Box
|
sx={{
|
||||||
sx={{
|
display: "flex",
|
||||||
display: "flex",
|
flexDirection: "column",
|
||||||
flexDirection: "column",
|
alignItems: "center",
|
||||||
alignItems: "center",
|
justifyContent: "center",
|
||||||
justifyContent: "center",
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<AvatarUpload
|
||||||
<AvatarUpload
|
user={user}
|
||||||
user={user}
|
setFieldValue={props.setFieldValue}
|
||||||
setFieldValue={props.setFieldValue}
|
valueAvatar="expert_avatar"
|
||||||
valueAvatar="expert_avatar"
|
changeFlag="change_avatar"
|
||||||
changeFlag="change_avatar"
|
/>
|
||||||
|
</Box>
|
||||||
|
<Grid container spacing={2} sx={{pb: 2}}>
|
||||||
|
<Grid item xs={12} sm={6}>
|
||||||
|
<Field
|
||||||
|
as={TextField}
|
||||||
|
name="username"
|
||||||
|
label={t("UpdateProfile.text_field_username")}
|
||||||
|
variant="outlined"
|
||||||
|
margin="normal"
|
||||||
|
size="small"
|
||||||
|
disabled={true}
|
||||||
|
error={!!(props.touched.username && props.errors.username)}
|
||||||
|
helperText={
|
||||||
|
props.touched.username
|
||||||
|
? props.errors.username
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
sx={{
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
|
||||||
<Grid container spacing={2} sx={{pb: 2}}>
|
|
||||||
<Grid item xs={12} sm={6}>
|
|
||||||
<Field
|
|
||||||
as={TextField}
|
|
||||||
name="username"
|
|
||||||
label={t("UpdateProfile.text_field_username")}
|
|
||||||
variant="outlined"
|
|
||||||
margin="normal"
|
|
||||||
size="small"
|
|
||||||
disabled={true}
|
|
||||||
error={!!(props.touched.username && props.errors.username)}
|
|
||||||
helperText={
|
|
||||||
props.touched.username
|
|
||||||
? props.errors.username
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12} sm={6}>
|
|
||||||
<Field
|
|
||||||
as={TextField}
|
|
||||||
name="name"
|
|
||||||
label={t("UpdateProfile.text_field_name")}
|
|
||||||
variant="outlined"
|
|
||||||
margin="normal"
|
|
||||||
size="small"
|
|
||||||
disabled={true}
|
|
||||||
error={!!(props.touched.name && props.errors.name)}
|
|
||||||
helperText={
|
|
||||||
props.touched.name ? props.errors.name : null
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12} sm={6}>
|
|
||||||
<Field
|
|
||||||
as={TextField}
|
|
||||||
name="email"
|
|
||||||
label={t("UpdateProfile.text_field_email")}
|
|
||||||
variant="outlined"
|
|
||||||
margin="normal"
|
|
||||||
size="small"
|
|
||||||
disabled={true}
|
|
||||||
error={!!(props.touched.email && props.errors.email)}
|
|
||||||
helperText={
|
|
||||||
props.touched.email ? props.errors.email : null
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={12} sm={6}>
|
|
||||||
<Field
|
|
||||||
as={TextField}
|
|
||||||
name="province_name"
|
|
||||||
label={t("UpdateProfile.text_field_province_name")}
|
|
||||||
variant="outlined"
|
|
||||||
margin="normal"
|
|
||||||
size="small"
|
|
||||||
disabled={true}
|
|
||||||
error={!!(props.touched.province_name && props.errors.province_name)}
|
|
||||||
helperText={
|
|
||||||
props.touched.province_name
|
|
||||||
? props.errors.province_name
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={12} sm={6}>
|
|
||||||
<Field
|
|
||||||
as={TextField}
|
|
||||||
name="position"
|
|
||||||
label={t("UpdateProfile.text_field_position")}
|
|
||||||
variant="outlined"
|
|
||||||
margin="normal"
|
|
||||||
size="small"
|
|
||||||
disabled={true}
|
|
||||||
error={!!(props.touched.position && props.errors.position)}
|
|
||||||
helperText={
|
|
||||||
props.touched.position
|
|
||||||
? props.errors.position
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
sx={{
|
|
||||||
width: "100%",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Stack>
|
<Grid item xs={12} sm={6}>
|
||||||
</Paper>
|
<Field
|
||||||
</StyledForm>
|
as={TextField}
|
||||||
)}
|
name="name"
|
||||||
</Formik>
|
label={t("UpdateProfile.text_field_name")}
|
||||||
</Container>
|
variant="outlined"
|
||||||
</CenterLayout>
|
margin="normal"
|
||||||
</DashboardLayout>
|
size="small"
|
||||||
|
disabled={true}
|
||||||
|
error={!!(props.touched.name && props.errors.name)}
|
||||||
|
helperText={
|
||||||
|
props.touched.name ? props.errors.name : null
|
||||||
|
}
|
||||||
|
sx={{
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12} sm={6}>
|
||||||
|
<Field
|
||||||
|
as={TextField}
|
||||||
|
name="email"
|
||||||
|
label={t("UpdateProfile.text_field_email")}
|
||||||
|
variant="outlined"
|
||||||
|
margin="normal"
|
||||||
|
size="small"
|
||||||
|
disabled={true}
|
||||||
|
error={!!(props.touched.email && props.errors.email)}
|
||||||
|
helperText={
|
||||||
|
props.touched.email ? props.errors.email : null
|
||||||
|
}
|
||||||
|
sx={{
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid item xs={12} sm={6}>
|
||||||
|
<Field
|
||||||
|
as={TextField}
|
||||||
|
name="province_name"
|
||||||
|
label={t("UpdateProfile.text_field_province_name")}
|
||||||
|
variant="outlined"
|
||||||
|
margin="normal"
|
||||||
|
size="small"
|
||||||
|
disabled={true}
|
||||||
|
error={!!(props.touched.province_name && props.errors.province_name)}
|
||||||
|
helperText={
|
||||||
|
props.touched.province_name
|
||||||
|
? props.errors.province_name
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
sx={{
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid item xs={12} sm={6}>
|
||||||
|
<Field
|
||||||
|
as={TextField}
|
||||||
|
name="position"
|
||||||
|
label={t("UpdateProfile.text_field_position")}
|
||||||
|
variant="outlined"
|
||||||
|
margin="normal"
|
||||||
|
size="small"
|
||||||
|
disabled={true}
|
||||||
|
error={!!(props.touched.position && props.errors.position)}
|
||||||
|
helperText={
|
||||||
|
props.touched.position
|
||||||
|
? props.errors.position
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
sx={{
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Stack>
|
||||||
|
</Paper>
|
||||||
|
</StyledForm>
|
||||||
|
)}
|
||||||
|
</Formik>
|
||||||
|
</Container>
|
||||||
|
</CenterLayout>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import DashboardLayouts from "@/layouts/DashboardLayout";
|
|
||||||
import ExpertManagementDataTable from "@/components/dashboard/expert-management/DataTable";
|
import ExpertManagementDataTable from "@/components/dashboard/expert-management/DataTable";
|
||||||
|
|
||||||
function DashboardExpertManagementComponent() {
|
function DashboardExpertManagementComponent() {
|
||||||
return (
|
return (
|
||||||
<DashboardLayouts>
|
<ExpertManagementDataTable/>
|
||||||
<ExpertManagementDataTable/>
|
|
||||||
</DashboardLayouts>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import DashboardLayout from "@/layouts/DashboardLayout";
|
|
||||||
|
|
||||||
const DashboardFirstComponent = () => {
|
const DashboardFirstComponent = () => {
|
||||||
return <DashboardLayout></DashboardLayout>;
|
return <></>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default DashboardFirstComponent;
|
export default DashboardFirstComponent;
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
import RoleManagementComponent from "@/components/dashboard/role-management/RoleManagementComponent";
|
import RoleManagementComponent from "@/components/dashboard/role-management/RoleManagementComponent";
|
||||||
import DashboardLayout from "@/layouts/DashboardLayout";
|
|
||||||
import moment from "jalali-moment";
|
|
||||||
|
|
||||||
function DashboardRoleManagementComponent() {
|
function DashboardRoleManagementComponent() {
|
||||||
return (
|
return (
|
||||||
<DashboardLayout>
|
<RoleManagementComponent/>
|
||||||
<RoleManagementComponent />
|
|
||||||
</DashboardLayout>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import CallTabPanel from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel";
|
import CallTabPanel from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel";
|
||||||
import useAnswers from "@/lib/callWidget/hooks/useAnswers";
|
import useAnswers from "@/lib/callWidget/hooks/useAnswers";
|
||||||
import CallTabsList from "src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList";
|
import CallTabsList from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList";
|
||||||
|
|
||||||
const CallTabs = () => {
|
const CallTabs = () => {
|
||||||
const {answersList} = useAnswers()
|
const {answersList} = useAnswers()
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import Header from "src/components/layouts/Dashboard/Header";
|
|
||||||
import Sidebar from "src/components/layouts/Dashboard/Sidebar";
|
|
||||||
import FullPageLayout from "@/layouts/FullPageLayout";
|
import FullPageLayout from "@/layouts/FullPageLayout";
|
||||||
import {Toolbar} from "@mui/material";
|
import {Toolbar} from "@mui/material";
|
||||||
import BreadCrumbs from "src/components/layouts/Dashboard/Breadcrumbs";
|
|
||||||
import {useState} from "react";
|
import {useState} from "react";
|
||||||
|
import RolePermissionMiddleware from "@/middlewares/RolePermission";
|
||||||
|
import Header from "@/components/layouts/Dashboard/Header";
|
||||||
|
import Sidebar from "@/components/layouts/Dashboard/Sidebar";
|
||||||
|
import BreadCrumbs from "@/components/layouts/Dashboard/Breadcrumbs";
|
||||||
|
|
||||||
const drawerWidth = 240;
|
const drawerWidth = 240;
|
||||||
|
|
||||||
@@ -34,8 +35,10 @@ const Dashboard = (props) => {
|
|||||||
>
|
>
|
||||||
<Toolbar/>
|
<Toolbar/>
|
||||||
<FullPageLayout sx={{mt: 3}}>
|
<FullPageLayout sx={{mt: 3}}>
|
||||||
<BreadCrumbs isVisible={true}/>
|
<RolePermissionMiddleware requiredPermissions={props.permissions}>
|
||||||
{props.children}
|
<BreadCrumbs isVisible={true}/>
|
||||||
|
{props.children}
|
||||||
|
</RolePermissionMiddleware>
|
||||||
</FullPageLayout>
|
</FullPageLayout>
|
||||||
</FullPageLayout>
|
</FullPageLayout>
|
||||||
</FullPageLayout>
|
</FullPageLayout>
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import Dashboard from "src/components/layouts/Dashboard";
|
|
||||||
import AppPermission from "@/middlewares/AppPermission";
|
import AppPermission from "@/middlewares/AppPermission";
|
||||||
import CallWidget from "@/components/layouts/Dashboard/CallWidget";
|
import CallWidget from "@/components/layouts/Dashboard/CallWidget";
|
||||||
|
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||||
|
import Dashboard from "@/components/layouts/Dashboard";
|
||||||
|
|
||||||
const DashboardLayout = (props) => {
|
const DashboardLayout = (props) => {
|
||||||
const permissions = ["NEXT_PUBLIC_HAS_WIDGET"];
|
const permissions = ["NEXT_PUBLIC_HAS_WIDGET"];
|
||||||
return (
|
return (
|
||||||
<>
|
<WithAuthMiddleware>
|
||||||
<Dashboard {...props}/>
|
<Dashboard {...props}/>
|
||||||
<AppPermission permissions={permissions}>
|
<AppPermission permissions={permissions}>
|
||||||
<CallWidget />
|
<CallWidget/>
|
||||||
</AppPermission>
|
</AppPermission>
|
||||||
</>
|
</WithAuthMiddleware>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
20
src/layouts/index.jsx
Normal file
20
src/layouts/index.jsx
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import DashboardLayout from "@/layouts/DashboardLayout";
|
||||||
|
import {Fragment} from "react";
|
||||||
|
|
||||||
|
const layoutList = {
|
||||||
|
DashboardLayout
|
||||||
|
}
|
||||||
|
|
||||||
|
const Layout = ({layout, children}) => {
|
||||||
|
|
||||||
|
const Component = layoutList[layout?.name] || Fragment
|
||||||
|
const props = layout?.props || {}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Component {...props}>
|
||||||
|
{children}
|
||||||
|
</Component>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Layout
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import useUser from "@/lib/app/hooks/useUser";
|
import useUser from "@/lib/app/hooks/useUser";
|
||||||
import RolePermissionComponent from "@/core/components/Middleware/RolePermissionComponent";
|
import RolePermissionComponent from "@/core/components/Middleware/RolePermissionComponent";
|
||||||
|
|
||||||
const RolePermissionMiddleware = ({children, requiredPermissions}) => {
|
const RolePermissionMiddleware = ({children, requiredPermissions = []}) => {
|
||||||
const {user} = useUser();
|
const {user} = useUser();
|
||||||
|
|
||||||
const hasPermission = requiredPermissions.some((permission) =>
|
const hasPermission = requiredPermissions.length === 0 ? true : requiredPermissions.some((permission) =>
|
||||||
user?.permissions?.includes(permission)
|
user?.permissions?.includes(permission)
|
||||||
);
|
);
|
||||||
|
|
||||||
return !hasPermission ? <RolePermissionComponent /> : <>{children}</>;
|
return !hasPermission ? <RolePermissionComponent/> : <>{children}</>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default RolePermissionMiddleware;
|
export default RolePermissionMiddleware;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {NextIntlProvider} from "next-intl";
|
|||||||
import TitlePage from "@/core/components/TitlePage";
|
import TitlePage from "@/core/components/TitlePage";
|
||||||
import {SocketProvider} from "@/lib/app/contexts/socket";
|
import {SocketProvider} from "@/lib/app/contexts/socket";
|
||||||
import {ToastProvider} from "@/lib/app/contexts/toast";
|
import {ToastProvider} from "@/lib/app/contexts/toast";
|
||||||
|
import Layout from "@/layouts";
|
||||||
|
|
||||||
const App = ({Component, pageProps}) => {
|
const App = ({Component, pageProps}) => {
|
||||||
|
|
||||||
@@ -22,7 +23,9 @@ const App = ({Component, pageProps}) => {
|
|||||||
<ToastProvider>
|
<ToastProvider>
|
||||||
<AppLayout isBot={pageProps.isBot}>
|
<AppLayout isBot={pageProps.isBot}>
|
||||||
<SocketProvider>
|
<SocketProvider>
|
||||||
<Component {...pageProps} />
|
<Layout layout={pageProps.layout}>
|
||||||
|
<Component {...pageProps} />
|
||||||
|
</Layout>
|
||||||
</SocketProvider>
|
</SocketProvider>
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
</ToastProvider>
|
</ToastProvider>
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import DashboardChangePasswordComponent from "@/components/dashboard/change-password";
|
import DashboardChangePasswordComponent from "@/components/dashboard/change-password";
|
||||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
|
||||||
import {parse} from "next-useragent";
|
import {parse} from "next-useragent";
|
||||||
|
|
||||||
export default function LoanFollowUp() {
|
export default function LoanFollowUp() {
|
||||||
return (
|
return (
|
||||||
<WithAuthMiddleware>
|
<DashboardChangePasswordComponent/>
|
||||||
<DashboardChangePasswordComponent/>
|
|
||||||
</WithAuthMiddleware>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +14,8 @@ export async function getServerSideProps({req, locale}) {
|
|||||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||||
title: "Dashboard.change_password",
|
title: "Dashboard.change_password",
|
||||||
isBot,
|
isBot,
|
||||||
locale
|
locale,
|
||||||
|
layout: {name: 'DashboardLayout'}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import DashboardEditProfile from "@/components/dashboard/edit-profile";
|
import DashboardEditProfile from "@/components/dashboard/edit-profile";
|
||||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
|
||||||
import {parse} from "next-useragent";
|
import {parse} from "next-useragent";
|
||||||
|
|
||||||
export default function LoanFollowUp() {
|
export default function LoanFollowUp() {
|
||||||
return (
|
return (
|
||||||
<WithAuthMiddleware>
|
<DashboardEditProfile/>
|
||||||
<DashboardEditProfile/>
|
|
||||||
</WithAuthMiddleware>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +14,8 @@ export async function getServerSideProps({req, locale}) {
|
|||||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||||
title: "Dashboard.edit_profile",
|
title: "Dashboard.edit_profile",
|
||||||
isBot,
|
isBot,
|
||||||
locale
|
locale,
|
||||||
|
layout: {name: 'DashboardLayout'}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
|
||||||
import {parse} from "next-useragent";
|
import {parse} from "next-useragent";
|
||||||
import DashboardExpertManagementComponent from "@/components/dashboard/expert-management";
|
import DashboardExpertManagementComponent from "@/components/dashboard/expert-management";
|
||||||
import RolePermissionMiddleware from "@/middlewares/RolePermission";
|
|
||||||
|
|
||||||
const requiredPermissions = ["manage_users"];
|
|
||||||
export default function ExpertManagement() {
|
export default function ExpertManagement() {
|
||||||
return (
|
return (
|
||||||
<WithAuthMiddleware>
|
<DashboardExpertManagementComponent/>
|
||||||
<RolePermissionMiddleware requiredPermissions={requiredPermissions}>
|
|
||||||
<DashboardExpertManagementComponent/>
|
|
||||||
</RolePermissionMiddleware>
|
|
||||||
</WithAuthMiddleware>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +14,8 @@ export async function getServerSideProps({req, locale}) {
|
|||||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||||
title: "Dashboard.expert_management",
|
title: "Dashboard.expert_management",
|
||||||
isBot,
|
isBot,
|
||||||
locale
|
locale,
|
||||||
|
layout: {name: 'DashboardLayout', props: {permissions: ["manage_users"]}}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import DashboardFirstComponent from "@/components/dashboard/first";
|
import DashboardFirstComponent from "@/components/dashboard/first";
|
||||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
|
||||||
import {parse} from "next-useragent";
|
import {parse} from "next-useragent";
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
return (
|
return (
|
||||||
<WithAuthMiddleware>
|
<DashboardFirstComponent/>
|
||||||
<DashboardFirstComponent/>
|
|
||||||
</WithAuthMiddleware>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +14,8 @@ export async function getServerSideProps({req, locale}) {
|
|||||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||||
title: "Dashboard.dashboard_page",
|
title: "Dashboard.dashboard_page",
|
||||||
isBot,
|
isBot,
|
||||||
locale
|
locale,
|
||||||
|
layout: {name: 'DashboardLayout'}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
import RolePermissionMiddleware from "@/middlewares/RolePermission";
|
|
||||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
|
||||||
import {parse} from "next-useragent";
|
import {parse} from "next-useragent";
|
||||||
import DashboardRoleManagementComponent from "@/components/dashboard/role-management";
|
import DashboardRoleManagementComponent from "@/components/dashboard/role-management";
|
||||||
|
|
||||||
const requiredPermissions = ["manage_roles"];
|
|
||||||
export default function RoleManagement() {
|
export default function RoleManagement() {
|
||||||
return (
|
return (
|
||||||
<WithAuthMiddleware>
|
<DashboardRoleManagementComponent/>
|
||||||
<RolePermissionMiddleware requiredPermissions={requiredPermissions}>
|
|
||||||
<DashboardRoleManagementComponent/>
|
|
||||||
</RolePermissionMiddleware>
|
|
||||||
</WithAuthMiddleware>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +14,8 @@ export async function getServerSideProps({req, locale}) {
|
|||||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||||
title: "Dashboard.role_management_page",
|
title: "Dashboard.role_management_page",
|
||||||
isBot,
|
isBot,
|
||||||
locale
|
locale,
|
||||||
|
layout: {name: 'DashboardLayout', props: {permissions: ["manage_roles"]}}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user