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