From e5fb950f46b0d3e95ee747883b090e00f7238fda Mon Sep 17 00:00:00 2001 From: Jason Chuang Date: Sun, 9 Aug 2026 00:55:21 +0800 Subject: [PATCH] CR023 - update user search --- src/components/FiDataGrid.js | 12 ++++-- .../UserSearchForm_Individual.js | 43 +++++++++++++------ .../UserTable_Individual.js | 12 ++++++ .../UserSearchForm_Organization.js | 43 +++++++++++++------ .../UserTable_Organization.js | 12 ++++++ 5 files changed, 91 insertions(+), 31 deletions(-) diff --git a/src/components/FiDataGrid.js b/src/components/FiDataGrid.js index 4470d9d..d8fd662 100644 --- a/src/components/FiDataGrid.js +++ b/src/components/FiDataGrid.js @@ -343,9 +343,15 @@ export function FiDataGrid({ rows, columns, sx, autoHeight = true, page={page} rowsPerPage={pageSize} 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" }) + ":"} getItemAriaLabel={(type) => { if (type === 'previous') { diff --git a/src/pages/User/SearchPage_Individual/UserSearchForm_Individual.js b/src/pages/User/SearchPage_Individual/UserSearchForm_Individual.js index 3be7555..aa0a348 100644 --- a/src/pages/User/SearchPage_Individual/UserSearchForm_Individual.js +++ b/src/pages/User/SearchPage_Individual/UserSearchForm_Individual.js @@ -7,7 +7,7 @@ import { } from '@mui/material'; import MainCard from "components/MainCard"; import { useForm } from "react-hook-form"; -import { useState,useEffect } from "react"; +import { useState } from "react"; import {PNSPS_BUTTON_THEME} from "themes/buttonConst"; import {ThemeProvider} from "@emotion/react"; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -16,22 +16,15 @@ import {ThemeProvider} from "@emotion/react"; const UserSearchForm_Individual = ({ applySearch, onGridReady, searchCriteria }) => { 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() - useEffect(() => { - if(searchCriteria.accountFilter!=undefined){ - if(searchCriteria.accountFilter === ""){ - setAccountFilter("All") - }else{ - setAccountFilter(searchCriteria.accountFilter) - } - }else{ - setAccountFilter("All") - } - }, [searchCriteria]); - const onSubmit = (data) => { let typeArray = []; @@ -52,6 +45,15 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady, searchCriteria }) applySearch(temp); }; + function onToBeVerified() { + applySearch({ + accountFilter: "Not Verified", + descOrder: true, + start: 0, + limit: 10 + }); + } + function resetForm() { setType([]); setAccountFilter("All"); @@ -178,9 +180,22 @@ const UserSearchForm_Individual = ({ applySearch, onGridReady, searchCriteria }) + + + + + + +