| @@ -343,9 +343,15 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, | |||||
| page={page} | page={page} | ||||
| rowsPerPage={pageSize} | rowsPerPage={pageSize} | ||||
| rowsPerPageOptions={_pageSizeOptions} | rowsPerPageOptions={_pageSizeOptions} | ||||
| labelDisplayedRows={() => | |||||
| `${(_rows?.length ? page * pageSize + 1 : 0)}-${page * pageSize + (_rows?.length ?? 0)} ${intl.formatMessage({ id: "of" })} ${rowCount}` | |||||
| } | |||||
| labelDisplayedRows={() => { | |||||
| const total = rowCount || 0; | |||||
| if (!_rows?.length || total === 0) { | |||||
| return `0-0 ${intl.formatMessage({ id: "of" })} ${total}`; | |||||
| } | |||||
| const from = page * pageSize + 1; | |||||
| const to = Math.min(page * pageSize + _rows.length, total); | |||||
| return `${from}-${to} ${intl.formatMessage({ id: "of" })} ${total}`; | |||||
| }} | |||||
| labelRowsPerPage={intl.formatMessage({ id: "rowsPerPage" }) + ":"} | labelRowsPerPage={intl.formatMessage({ id: "rowsPerPage" }) + ":"} | ||||
| getItemAriaLabel={(type) => { | getItemAriaLabel={(type) => { | ||||
| if (type === 'previous') { | if (type === 'previous') { | ||||
| @@ -7,7 +7,7 @@ import { | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import MainCard from "components/MainCard"; | import MainCard from "components/MainCard"; | ||||
| import { useForm } from "react-hook-form"; | import { useForm } from "react-hook-form"; | ||||
| import { useState,useEffect } from "react"; | |||||
| import { useState } from "react"; | |||||
| import {PNSPS_BUTTON_THEME} from "themes/buttonConst"; | import {PNSPS_BUTTON_THEME} from "themes/buttonConst"; | ||||
| import {ThemeProvider} from "@emotion/react"; | import {ThemeProvider} from "@emotion/react"; | ||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
| @@ -16,22 +16,15 @@ import {ThemeProvider} from "@emotion/react"; | |||||
| const UserSearchForm_Individual = ({ applySearch, onGridReady, searchCriteria }) => { | const UserSearchForm_Individual = ({ applySearch, onGridReady, searchCriteria }) => { | ||||
| const [type, setType] = useState([]); | const [type, setType] = useState([]); | ||||
| const [accountFilter, setAccountFilter] = useState("All"); | |||||
| const [accountFilter, setAccountFilter] = useState(() => { | |||||
| if (searchCriteria.accountFilter != undefined && searchCriteria.accountFilter !== "") { | |||||
| return searchCriteria.accountFilter; | |||||
| } | |||||
| return "All"; | |||||
| }); | |||||
| const { reset, register, handleSubmit } = useForm() | const { reset, register, handleSubmit } = useForm() | ||||
| useEffect(() => { | |||||
| if(searchCriteria.accountFilter!=undefined){ | |||||
| if(searchCriteria.accountFilter === ""){ | |||||
| setAccountFilter("All") | |||||
| }else{ | |||||
| setAccountFilter(searchCriteria.accountFilter) | |||||
| } | |||||
| }else{ | |||||
| setAccountFilter("All") | |||||
| } | |||||
| }, [searchCriteria]); | |||||
| const onSubmit = (data) => { | const onSubmit = (data) => { | ||||
| let typeArray = []; | let typeArray = []; | ||||
| @@ -52,6 +45,15 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady, searchCriteria }) | |||||
| applySearch(temp); | applySearch(temp); | ||||
| }; | }; | ||||
| function onToBeVerified() { | |||||
| applySearch({ | |||||
| accountFilter: "Not Verified", | |||||
| descOrder: true, | |||||
| start: 0, | |||||
| limit: 10 | |||||
| }); | |||||
| } | |||||
| function resetForm() { | function resetForm() { | ||||
| setType([]); | setType([]); | ||||
| setAccountFilter("All"); | setAccountFilter("All"); | ||||
| @@ -178,9 +180,22 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady, searchCriteria }) | |||||
| <Grid container maxWidth justifyContent="flex-end"> | <Grid container maxWidth justifyContent="flex-end"> | ||||
| <ThemeProvider theme={PNSPS_BUTTON_THEME}> | <ThemeProvider theme={PNSPS_BUTTON_THEME}> | ||||
| <Grid item sx={{ ml: 3, mr: 3, mb: 3 }}> | <Grid item sx={{ ml: 3, mr: 3, mb: 3 }}> | ||||
| <Button | |||||
| variant="contained" | |||||
| color="edit" | |||||
| type="button" | |||||
| onClick={onToBeVerified} | |||||
| disabled={onGridReady} | |||||
| > | |||||
| To be verified | |||||
| </Button> | |||||
| </Grid> | |||||
| <Grid item sx={{ mr: 3, mb: 3 }}> | |||||
| <Button | <Button | ||||
| variant="contained" | variant="contained" | ||||
| color="cancel" | color="cancel" | ||||
| type="button" | |||||
| onClick={resetForm} | onClick={resetForm} | ||||
| > | > | ||||
| Reset | Reset | ||||
| @@ -91,6 +91,18 @@ export default function UserTable_Individual({ searchCriteria, applyGridOnReady, | |||||
| flex: 1, | flex: 1, | ||||
| minWidth: 150, | minWidth: 150, | ||||
| }, | }, | ||||
| { | |||||
| id: 'created', | |||||
| field: 'created', | |||||
| headerName: 'Created Date', | |||||
| flex: 1, | |||||
| minWidth: 200, | |||||
| valueGetter: (params) => { | |||||
| if (params.value) { | |||||
| return DateUtils.datetimeStr(params.value); | |||||
| } | |||||
| } | |||||
| }, | |||||
| { | { | ||||
| id: 'lastLogin', | id: 'lastLogin', | ||||
| field: 'lastLogin', | field: 'lastLogin', | ||||
| @@ -9,7 +9,7 @@ import MainCard from "../../../components/MainCard"; | |||||
| import OrgComboAutocomplete from "../../../components/OrgComboAutocomplete"; | import OrgComboAutocomplete from "../../../components/OrgComboAutocomplete"; | ||||
| import {useForm} from "react-hook-form"; | import {useForm} from "react-hook-form"; | ||||
| import { useState, useEffect} from "react"; | |||||
| import { useState } from "react"; | |||||
| import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; | import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; | ||||
| import {ThemeProvider} from "@emotion/react"; | import {ThemeProvider} from "@emotion/react"; | ||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
| @@ -18,22 +18,15 @@ import {ThemeProvider} from "@emotion/react"; | |||||
| const UserSearchForm_Organization = ({applySearch, onGridReady, searchCriteria}) => { | const UserSearchForm_Organization = ({applySearch, onGridReady, searchCriteria}) => { | ||||
| const [type, setType] = useState([]); | const [type, setType] = useState([]); | ||||
| const [accountFilter, setAccountFilter] = useState("All"); | |||||
| const [accountFilter, setAccountFilter] = useState(() => { | |||||
| if (searchCriteria.accountFilter != undefined && searchCriteria.accountFilter !== "") { | |||||
| return searchCriteria.accountFilter; | |||||
| } | |||||
| return "All"; | |||||
| }); | |||||
| const [orgSelected, setOrgSelected] = useState({}); | const [orgSelected, setOrgSelected] = useState({}); | ||||
| const { reset, register, handleSubmit } = useForm() | const { reset, register, handleSubmit } = useForm() | ||||
| useEffect(() => { | |||||
| if(searchCriteria.accountFilter!=undefined){ | |||||
| if(searchCriteria.accountFilter === ""){ | |||||
| setAccountFilter("All") | |||||
| }else{ | |||||
| setAccountFilter(searchCriteria.accountFilter) | |||||
| } | |||||
| }else{ | |||||
| setAccountFilter("All") | |||||
| } | |||||
| }, [searchCriteria]); | |||||
| const onSubmit = (data) => { | const onSubmit = (data) => { | ||||
| @@ -58,6 +51,15 @@ const UserSearchForm_Organization = ({applySearch, onGridReady, searchCriteria}) | |||||
| applySearch(temp); | applySearch(temp); | ||||
| }; | }; | ||||
| function onToBeVerified() { | |||||
| applySearch({ | |||||
| accountFilter: "Not Verified", | |||||
| descOrder: true, | |||||
| start: 0, | |||||
| limit: 10 | |||||
| }); | |||||
| } | |||||
| function resetForm(){ | function resetForm(){ | ||||
| setType([]); | setType([]); | ||||
| setAccountFilter("All"); | setAccountFilter("All"); | ||||
| @@ -211,9 +213,22 @@ const UserSearchForm_Organization = ({applySearch, onGridReady, searchCriteria}) | |||||
| <Grid container maxWidth justifyContent="flex-end"> | <Grid container maxWidth justifyContent="flex-end"> | ||||
| <ThemeProvider theme={PNSPS_BUTTON_THEME}> | <ThemeProvider theme={PNSPS_BUTTON_THEME}> | ||||
| <Grid item sx={{ml:3, mr:3, mb:3}}> | <Grid item sx={{ml:3, mr:3, mb:3}}> | ||||
| <Button | |||||
| variant="contained" | |||||
| color="edit" | |||||
| type="button" | |||||
| onClick={onToBeVerified} | |||||
| disabled={onGridReady} | |||||
| > | |||||
| To be verified | |||||
| </Button> | |||||
| </Grid> | |||||
| <Grid item sx={{mr:3, mb:3}}> | |||||
| <Button | <Button | ||||
| variant="contained" | variant="contained" | ||||
| color="cancel" | color="cancel" | ||||
| type="button" | |||||
| onClick={resetForm} | onClick={resetForm} | ||||
| > | > | ||||
| Reset | Reset | ||||
| @@ -85,6 +85,18 @@ export default function UserTable_Organization({searchCriteria, applyGridOnReady | |||||
| flex: 1, | flex: 1, | ||||
| minWidth: 150, | minWidth: 150, | ||||
| }, | }, | ||||
| { | |||||
| id: 'created', | |||||
| field: 'created', | |||||
| headerName: 'Created Date', | |||||
| flex: 1, | |||||
| minWidth: 200, | |||||
| valueGetter:(params)=>{ | |||||
| if(params.value){ | |||||
| return DateUtils.datetimeStr(params.value); | |||||
| } | |||||
| } | |||||
| }, | |||||
| { | { | ||||
| id: 'lastLogin', | id: 'lastLogin', | ||||
| field: 'lastLogin', | field: 'lastLogin', | ||||