diff --git a/src/pages/ManageOrgUserPage/index.js b/src/pages/ManageOrgUserPage/index.js index 826d1b5..e82473b 100644 --- a/src/pages/ManageOrgUserPage/index.js +++ b/src/pages/ManageOrgUserPage/index.js @@ -160,7 +160,7 @@ const ManageOrgUserPage = () => { }, }} pageSizeOptions={[5, 10]} - autoHeight = {true} + autoHeight /> diff --git a/src/pages/OrganizationSearchPage/OrganizationTable.js b/src/pages/OrganizationSearchPage/OrganizationTable.js index 2253f0d..24b8c55 100644 --- a/src/pages/OrganizationSearchPage/OrganizationTable.js +++ b/src/pages/OrganizationSearchPage/OrganizationTable.js @@ -86,7 +86,7 @@ export default function OrganizationTable({recordList}) { }, }} pageSizeOptions={[5, 10]} - autoHeight = {true} + autoHeight /> ); diff --git a/src/pages/pnspsUserDetailPage/UserAuthTable.js b/src/pages/pnspsUserDetailPage/UserAuthTable.js index 9bf2a9b..8a92d15 100644 --- a/src/pages/pnspsUserDetailPage/UserAuthTable.js +++ b/src/pages/pnspsUserDetailPage/UserAuthTable.js @@ -73,11 +73,11 @@ export default function UserAuthTable({setSelectedRow, userAuth}) { checkboxSelection rowSelectionModel={currentSelectedRow} onRowSelectionModelChange={(ids) => { - console.log(ids); + // console.log(ids); setSelectedRow(ids); setCurrentSelectedRow(ids); }} - autoHeight = {true} + autoHeight /> ); diff --git a/src/pages/pnspsUserDetailPage/UserGroupTable.js b/src/pages/pnspsUserDetailPage/UserGroupTable.js index e5db51c..b3ac9c8 100644 --- a/src/pages/pnspsUserDetailPage/UserGroupTable.js +++ b/src/pages/pnspsUserDetailPage/UserGroupTable.js @@ -5,10 +5,8 @@ import { import {useEffect, useState} from "react"; import axios from "axios"; import {apiPath} from "../../auth/utils"; -//import LoadingComponent from "../extra-pages/LoadingComponent"; import * as React from "react"; import {GET_GROUP_COMBO_PATH} from "../../utils/ApiPathConst"; - import Loadable from 'components/Loadable'; import { lazy } from 'react'; const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent'))); @@ -35,8 +33,7 @@ export default function UserGroupTable({setSelectedRow, userGroup}) { useEffect(() => { //if state data are ready and assign to different field - console.log(groupData.length) - if (groupData !== "" && groupData !== undefined) { + if (groupData.length > 0) { setOnReady(true); } }, [groupData]); @@ -73,7 +70,7 @@ export default function UserGroupTable({setSelectedRow, userGroup}) { setSelectedRow(ids); setCurrentSelectedRow(ids); }} - autoHeight = {true} + autoHeight /> ); diff --git a/src/pages/pnspsUserDetailPage/UserInformationCard.js b/src/pages/pnspsUserDetailPage/UserInformationCard.js index 1c88171..01baee3 100644 --- a/src/pages/pnspsUserDetailPage/UserInformationCard.js +++ b/src/pages/pnspsUserDetailPage/UserInformationCard.js @@ -1,82 +1,32 @@ // material-ui import { - Grid, TextField, Typography + FormControl, IconButton, + Grid, InputAdornment, Typography, FormLabel, + OutlinedInput, } from '@mui/material'; import MainCard from "../../components/MainCard"; import * as React from "react"; import {useForm} from "react-hook-form"; -// import Autocomplete from "@mui/material/Autocomplete"; -// import { -// subDivision1, -// subDivision2, -// subDivision3, -// subDivision4, -// subDivision5, -// subDivision6 -// } from "../pnspsUserSearchPage/DummyComboRecord"; import {useEffect, useState} from "react"; import Checkbox from "@mui/material/Checkbox"; -//import LoadingComponent from "../extra-pages/LoadingComponent"; import Loadable from 'components/Loadable'; import { lazy } from 'react'; const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent'))); //import {useParams} from "react-router-dom"; +import Visibility from '@mui/icons-material/Visibility'; +import VisibilityOff from '@mui/icons-material/VisibilityOff'; // ==============================|| DASHBOARD - DEFAULT ||============================== // - - -// const subDivisionArray = [ -// ...subDivision1, -// ...subDivision2, -// ...subDivision3, -// ...subDivision4, -// ...subDivision5, -// ...subDivision6 -// ]; - - -const UserInformationCard = ({isCollectData, updateUserObject,userData}) => { +const UserInformationCard = ({isCollectData, updateUserObject,userData,isNewRecord}) => { //const params = useParams(); const [currentUserData, setCurrentUserData] = React.useState({}); - // const [subDivision, setSubDivision] = useState(null); const [locked, setLocked] = useState(false); - // const [isLotusNoteUser, setIsLotusNoteUser] = useState(false); - // const [lotusNoteUserList, setLotusNoteUserList] = useState([]) - // const [selectedLotusUser, setSelectedLotusUser] = useState(null); - + const [showPassword, setShowPassword] = React.useState(false); const [onReady, setOnReady] = useState(false); const {register, getValues} = useForm() - // useEffect(() => { - // //TODO: Get lotus note user list - // setLotusNoteUserList([ - // { - // key: 1, - // label: "user01", - // account: "user123456" - // }, - // { - // key: 2, - // label: "user02", - // account: "userabcde1" - // }, - // { - // key: 3, - // label: "user03", - // account: "user2001" - // }, - // { - // key: 4, - // label: "user04", - // account: "user2000" - // }, - // { - // key: 5, - // label: "user05", - // account: "user1999" - // }, - // ]) - // }, []); + const handleClickShowPassword = () => setShowPassword((show) => !show); + const handleMouseDownPassword = () => setShowPassword(!showPassword); useEffect(() => { //if user data from parent are not null @@ -87,9 +37,12 @@ const UserInformationCard = ({isCollectData, updateUserObject,userData}) => { useEffect(() => { //if state data are ready and assign to different field - if (Object.keys(userData).length > 0 &¤tUserData !== undefined) { + if (Object.keys(userData).length > 0 &¤tUserData !== undefined&¤tUserData.id!==undefined) { setLocked(currentUserData.locked); setOnReady(true); + }else if(isNewRecord){ + setLocked(false); + setOnReady(true); } }, [currentUserData]); @@ -98,8 +51,6 @@ const UserInformationCard = ({isCollectData, updateUserObject,userData}) => { const values = getValues(); const objectData ={ ...values, - // selectedLotusUser: selectedLotusUser, - // subDivision: subDivision, locked: locked, } updateUserObject(objectData); @@ -120,25 +71,28 @@ const UserInformationCard = ({isCollectData, updateUserObject,userData}) => {
diff --git a/src/pages/pnspsUserSearchPage/UserTable.js b/src/pages/pnspsUserSearchPage/UserTable.js index c9b2e91..a122fbc 100644 --- a/src/pages/pnspsUserSearchPage/UserTable.js +++ b/src/pages/pnspsUserSearchPage/UserTable.js @@ -9,9 +9,12 @@ import {useEffect} from "react"; import {useNavigate} from "react-router-dom"; import { useTheme } from '@mui/material/styles'; import Checkbox from '@mui/material/Checkbox'; +import * as UrlUtils from "../../utils/ApiPathConst"; +import * as HttpUtils from '../../utils/HttpUtils'; + // ==============================|| EVENT TABLE ||============================== // -export default function UserTable({recordList}) { +export default function UserTable({recordList,setChangeLocked}) { const [rows, setRows] = React.useState(recordList); const [rowModesModel] = React.useState({}); const theme = useTheme(); @@ -26,6 +29,36 @@ export default function UserTable({recordList}) { navigate('/user/'+ id); }; + const handleLock = (params) => () => { + setChangeLocked(false) + if (params.row.locked==true){ + doUnlock(params.id) + }else{ + doLock(params.id) + setRows(recordList); + } + } + + const doLock = (id) => { + HttpUtils.get({ + url: UrlUtils.GET_USER_LOCK+"/"+id, + onSuccess: function(){ + setRows(recordList); + setChangeLocked(true) + } + }); + }; + + const doUnlock = (id) => { + HttpUtils.get({ + url: UrlUtils.GET_USER_UNLOCK+"/"+id, + onSuccess: function(){ + setRows(recordList); + setChangeLocked(true) + } + }); + }; + const columns = [ { field: 'actions', @@ -52,8 +85,8 @@ export default function UserTable({recordList}) { flex: 1, }, { - id: 'name', - field: 'name', + id: 'enName', + field: 'enName', headerName: 'Full Name', flex: 1, }, @@ -64,47 +97,11 @@ export default function UserTable({recordList}) { flex: 1, }, { - id: 'email', - field: 'email', + id: 'emailAddress', + field: 'emailAddress', headerName: 'Email', flex: 1, }, - // { - // id: 'subDivisionId', - // field: 'subDivisionId', - // //type: 'date', - // //sortable: false, - // headerName: 'Sub-Division', - // flex: 1, - // }, - - // { - // id: 'subDivisionId', - // field: 'subDivisionId', - // //type: 'date', - // //sortable: false, - // headerName: 'Sub-Division', - // flex: 1, - // }, - // { - // id: 'lotusNotesUser', - // field: 'lotusNotesUser', - // type: 'bool', - // headerName: 'Lotus Notes User', - // flex: 1, - // renderCell: (params) => { - // return ( - //