| @@ -4,7 +4,7 @@ import { | |||||
| DataGrid, GridOverlay, | DataGrid, GridOverlay, | ||||
| } from "@mui/x-data-grid"; | } from "@mui/x-data-grid"; | ||||
| import {FormattedMessage, useIntl} from "react-intl"; | import {FormattedMessage, useIntl} from "react-intl"; | ||||
| import {Typography} from '@mui/material'; | |||||
| import {TablePagination, Typography} from '@mui/material'; | |||||
| // ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
| @@ -124,27 +124,12 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, | |||||
| return ( | return ( | ||||
| <GridOverlay> | <GridOverlay> | ||||
| <Typography variant="body1"> | <Typography variant="body1"> | ||||
| <FormattedMessage id="rowsPerPage" /> | |||||
| <FormattedMessage id="noRecordFound" /> | |||||
| </Typography> | </Typography> | ||||
| </GridOverlay> | </GridOverlay> | ||||
| ); | ); | ||||
| } | } | ||||
| const CustomPagination = (props) => { | |||||
| const { pagination } = props; | |||||
| const { page, pageSize, rowCount } = pagination; | |||||
| const startIndex = page * pageSize + 1; | |||||
| const endIndex = Math.min((page + 1) * pageSize, rowCount); | |||||
| return ( | |||||
| <div> | |||||
| <div>{`${startIndex}-${endIndex} YES ${rowCount}`}</div> | |||||
| {/* Render other pagination controls */} | |||||
| </div> | |||||
| ); | |||||
| }; | |||||
| return ( | return ( | ||||
| <DataGrid | <DataGrid | ||||
| {...props} | {...props} | ||||
| @@ -164,11 +149,19 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, | |||||
| ) | ) | ||||
| }} | }} | ||||
| components={{ | components={{ | ||||
| Pagination: CustomPagination, | |||||
| Pagination: () => ( | |||||
| <TablePagination | |||||
| labelDisplayedRows={ | |||||
| ({ from, to, count }) => { | |||||
| return '' + from + '-' + to + ' 123 ' + count | |||||
| } | |||||
| } | |||||
| /> | |||||
| ), | |||||
| }} | }} | ||||
| componentsProps={{ | componentsProps={{ | ||||
| pagination: { | pagination: { | ||||
| labelRowsPerPage: intl.formatMessage({id: 'rowsPerPage'}), | |||||
| labelRowsPerPage: intl.formatMessage({id: 'rowsPerPage'}) + ":", | |||||
| } | } | ||||
| }} | }} | ||||
| /> | /> | ||||
| @@ -1,4 +1,4 @@ | |||||
| import React, {useEffect, useState} from 'react'; | |||||
| import React, {useContext, useEffect, useState} from 'react'; | |||||
| import {useNavigate} from 'react-router-dom'; | import {useNavigate} from 'react-router-dom'; | ||||
| // material-ui | // material-ui | ||||
| @@ -36,6 +36,7 @@ import {useDispatch} from "react-redux"; | |||||
| import {handleLogin} from "auth/index"; | import {handleLogin} from "auth/index"; | ||||
| import { notifyActionSuccess } from 'utils/CommonFunction'; | import { notifyActionSuccess } from 'utils/CommonFunction'; | ||||
| import {FormattedMessage} from "react-intl"; | import {FormattedMessage} from "react-intl"; | ||||
| import LocaleContext from "../../../components/I18nProvider"; | |||||
| // ============================|| FIREBASE - LOGIN ||============================ // | // ============================|| FIREBASE - LOGIN ||============================ // | ||||
| const AuthLogin = () => { | const AuthLogin = () => { | ||||
| @@ -69,6 +70,7 @@ const AuthLogin = () => { | |||||
| }) | }) | ||||
| .then((response) => { | .then((response) => { | ||||
| //setPosts("12354") | //setPosts("12354") | ||||
| console.log(response.data); | |||||
| setPosts(response.data); | setPosts(response.data); | ||||
| const userData = { | const userData = { | ||||
| id: response.data.id, | id: response.data.id, | ||||
| @@ -1,7 +1,7 @@ | |||||
| import React, { | import React, { | ||||
| useEffect, | useEffect, | ||||
| useState, | useState, | ||||
| lazy | |||||
| lazy, useContext | |||||
| } from 'react'; | } from 'react'; | ||||
| import { Link as RouterLink } from 'react-router-dom'; | import { Link as RouterLink } from 'react-router-dom'; | ||||
| import { useNavigate } from 'react-router-dom'; | import { useNavigate } from 'react-router-dom'; | ||||
| @@ -45,12 +45,14 @@ import { handleLogin } from "auth/index"; | |||||
| import useJwt from "../../../auth/jwt/useJwt"; | import useJwt from "../../../auth/jwt/useJwt"; | ||||
| import { handleLogoutFunction } from 'auth/index'; | import { handleLogoutFunction } from 'auth/index'; | ||||
| import {FormattedMessage, useIntl} from "react-intl"; | import {FormattedMessage, useIntl} from "react-intl"; | ||||
| import LocaleContext from "../../../components/I18nProvider"; | |||||
| // ============================|| FIREBASE - LOGIN ||============================ // | // ============================|| FIREBASE - LOGIN ||============================ // | ||||
| const AuthLoginCustom = () => { | const AuthLoginCustom = () => { | ||||
| const dispatch = useDispatch() | const dispatch = useDispatch() | ||||
| const navigate = useNavigate() | const navigate = useNavigate() | ||||
| const intl = useIntl(); | const intl = useIntl(); | ||||
| const { setLocale } = useContext(LocaleContext); | |||||
| const [showPassword, setShowPassword] = useState(false); | const [showPassword, setShowPassword] = useState(false); | ||||
| const handleClickShowPassword = () => { | const handleClickShowPassword = () => { | ||||
| @@ -88,6 +90,11 @@ const AuthLoginCustom = () => { | |||||
| } | } | ||||
| const data = { ...userData, accessToken: response.data.accessToken, refreshToken: response.data.refreshToken } | const data = { ...userData, accessToken: response.data.accessToken, refreshToken: response.data.refreshToken } | ||||
| // setSuccess(true) | // setSuccess(true) | ||||
| console.log(response.data.role); | |||||
| if(response.data.type === "GLD"){ | |||||
| setLocale("en"); | |||||
| localStorage.setItem('locale','en'); | |||||
| } | |||||
| dispatch(handleLogin(data)) | dispatch(handleLogin(data)) | ||||
| navigate('/dashboard'); | navigate('/dashboard'); | ||||
| location.reload() | location.reload() | ||||