CFE-12 Merge branch 'develop' into 'feature/CFE-12_change_password_test'
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -27,7 +27,7 @@ node_modules
|
||||
cypress/videos
|
||||
cypress/screenshots
|
||||
.next
|
||||
.env.local
|
||||
.env*
|
||||
.env
|
||||
.idea
|
||||
package-lock.json
|
||||
@@ -2,8 +2,6 @@ import '@testing-library/jest-dom'
|
||||
import {server} from "./mocks/server";
|
||||
import mockRouter from 'next-router-mock'
|
||||
|
||||
require('dotenv').config({path: './.env.local'});
|
||||
|
||||
jest.mock('next/router', () => jest.requireActual('next-router-mock'))
|
||||
|
||||
beforeAll(() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import StyledForm from "@/core/components/StyledForm";
|
||||
import CenterLayout from "@/layouts/CenterLayout";
|
||||
import DashboardLayouts from "@/layouts/dashboardLayouts";
|
||||
import DashboardLayouts from "@/layouts/DashboardLayout";
|
||||
import useUser from "@/lib/app/hooks/useUser";
|
||||
import {Box, Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material";
|
||||
import * as Yup from "yup";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import DashboardLayouts from "@/layouts/dashboardLayouts";
|
||||
import DashboardLayouts from "@/layouts/DashboardLayout";
|
||||
|
||||
const DashboardFirstComponent = () => {
|
||||
return <DashboardLayouts></DashboardLayouts>;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import PermPhoneMsgIcon from '@mui/icons-material/PermPhoneMsg';
|
||||
import StyledFab from "@/core/components/StyledFab";
|
||||
|
||||
const CallWidgetButton = ({setOpen}) => {
|
||||
return (
|
||||
<StyledFab color="primary" aria-label="open-dialog"
|
||||
onClick={() => setOpen(true)}>
|
||||
<PermPhoneMsgIcon/>
|
||||
</StyledFab>
|
||||
)
|
||||
}
|
||||
|
||||
export default CallWidgetButton
|
||||
@@ -0,0 +1,24 @@
|
||||
import {Dialog} from "@mui/material";
|
||||
import {DialogTransition} from "@/core/components/DialogTransition";
|
||||
|
||||
const CallWidgetDialog = ({open, setOpen}) => {
|
||||
|
||||
const handleClose = () => {
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog
|
||||
fullScreen
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
TransitionComponent={DialogTransition}
|
||||
>
|
||||
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default CallWidgetDialog
|
||||
15
src/components/layouts/Dashboard/CallWidget/index.jsx
Normal file
15
src/components/layouts/Dashboard/CallWidget/index.jsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import CallWidgetButton from "@/components/layouts/Dashboard/CallWidget/CallWidgetButton";
|
||||
import CallWidgetDialog from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog";
|
||||
import {useState} from "react";
|
||||
|
||||
const CallWidget = () => {
|
||||
const [open, setOpen] = useState(false)
|
||||
return (
|
||||
<>
|
||||
<CallWidgetButton setOpen={setOpen}/>
|
||||
<CallWidgetDialog open={open} setOpen={setOpen}/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default CallWidget
|
||||
@@ -14,7 +14,7 @@ const SidebarDrawer = ({handleDrawerToggle}) => {
|
||||
{t("app_short_name")}
|
||||
</Typography>
|
||||
<Typography variant="caption">
|
||||
{user.name} | {user.position}
|
||||
{user.full_name} | {user.position}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Toolbar>
|
||||
@@ -18,7 +18,6 @@ function reducer(state, action) {
|
||||
case "SELECTED":
|
||||
return state.map((itemsArr) =>
|
||||
itemsArr.map((item) => {
|
||||
console.log(item)
|
||||
if (item.type === "page") {
|
||||
if (action.route === item.route)
|
||||
return {...item, selected: true}
|
||||
@@ -1,13 +1,13 @@
|
||||
import {useState} from "react";
|
||||
import FullPageLayout from "../FullPageLayout";
|
||||
import Header from "./header";
|
||||
import Sidebar from "./sidebar";
|
||||
import Header from "src/components/layouts/Dashboard/Header";
|
||||
import Sidebar from "src/components/layouts/Dashboard/Sidebar";
|
||||
import FullPageLayout from "@/layouts/FullPageLayout";
|
||||
import {Toolbar} from "@mui/material";
|
||||
import BreadCrumbs from "./breadcrumbs";
|
||||
import BreadCrumbs from "src/components/layouts/Dashboard/Breadcrumbs";
|
||||
import {useState} from "react";
|
||||
|
||||
const drawerWidth = 240;
|
||||
|
||||
const DashboardLayouts = (props) => {
|
||||
const Dashboard = (props) => {
|
||||
const {window} = props;
|
||||
const [mobileOpen, setMobileOpen] = useState(false);
|
||||
const container =
|
||||
@@ -39,7 +39,7 @@ const DashboardLayouts = (props) => {
|
||||
</FullPageLayout>
|
||||
</FullPageLayout>
|
||||
</FullPageLayout>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
export default DashboardLayouts;
|
||||
export default Dashboard
|
||||
@@ -10,7 +10,7 @@ import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import useUser from "@/lib/app/hooks/useUser";
|
||||
import {useTranslations} from "next-intl";
|
||||
|
||||
const LoginExpertComponent = () =>{
|
||||
const LoginExpertComponent = () => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest()
|
||||
const {setToken} = useUser(); // pass token to set token
|
||||
@@ -24,7 +24,7 @@ const LoginExpertComponent = () =>{
|
||||
notification: {show: false}
|
||||
}
|
||||
}).then((response) => {
|
||||
setToken(response.data.token)
|
||||
setToken(response.data.data.token)
|
||||
}).catch(() => {
|
||||
props.setSubmitting(false)
|
||||
})
|
||||
@@ -38,7 +38,7 @@ const LoginExpertComponent = () =>{
|
||||
password: Yup.string().required(t("LoginPage.password_error_message_required")),
|
||||
});
|
||||
|
||||
return(
|
||||
return (
|
||||
<Container maxWidth="sm">
|
||||
<Paper elevation={0}>
|
||||
<Formik
|
||||
|
||||
6
src/core/components/DialogTransition.jsx
Normal file
6
src/core/components/DialogTransition.jsx
Normal file
@@ -0,0 +1,6 @@
|
||||
import {forwardRef} from "react";
|
||||
import {Slide} from "@mui/material";
|
||||
|
||||
export const DialogTransition = forwardRef(function DialogTransition(props, ref) {
|
||||
return <Slide direction="up" ref={ref} {...props}/>;
|
||||
});
|
||||
11
src/core/components/StyledFab.jsx
Normal file
11
src/core/components/StyledFab.jsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import {Fab, styled} from "@mui/material";
|
||||
|
||||
const StyledFab = styled(Fab)`
|
||||
position: absolute;
|
||||
bottom: 16px;
|
||||
/* @noflip */
|
||||
left: 16px;
|
||||
z-index: 1500;
|
||||
`;
|
||||
|
||||
export default StyledFab;
|
||||
@@ -1,7 +1,7 @@
|
||||
const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL;
|
||||
|
||||
//login
|
||||
export const GET_USER_TOKEN = BASE_URL + "/dashboard/login";
|
||||
export const GET_USER_TOKEN = BASE_URL + "/api/auth/login";
|
||||
//end login
|
||||
|
||||
//change password
|
||||
@@ -9,5 +9,5 @@ export const SET_USER_PASSWORD = BASE_URL + "/api/profile/change_password";
|
||||
//end change password
|
||||
|
||||
//user data
|
||||
export const GET_USER_ROUTE = BASE_URL + "/dashboard/profile/info";
|
||||
export const GET_USER_ROUTE = BASE_URL + "/api/profile/info";
|
||||
//user data
|
||||
14
src/layouts/DashboardLayout.jsx
Normal file
14
src/layouts/DashboardLayout.jsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import CallWidget from "src/components/layouts/Dashboard/CallWidget";
|
||||
import Dashboard from "src/components/layouts/Dashboard";
|
||||
|
||||
const DashboardLayouts = (props) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dashboard {...props}/>
|
||||
<CallWidget/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default DashboardLayouts;
|
||||
Reference in New Issue
Block a user