// material-ui import { Grid, TextField, Typography } 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 {useParams} from "react-router-dom"; // ==============================|| DASHBOARD - DEFAULT ||============================== // // const subDivisionArray = [ // ...subDivision1, // ...subDivision2, // ...subDivision3, // ...subDivision4, // ...subDivision5, // ...subDivision6 // ]; const UserInformationCard = ({isCollectData, updateUserObject,userData}) => { //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 [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" // }, // ]) // }, []); useEffect(() => { //if user data from parent are not null if (Object.keys(userData).length > 0 && userData !== undefined) { setCurrentUserData(userData.data); } }, [userData]); useEffect(() => { //if state data are ready and assign to different field if (Object.keys(userData).length > 0 &¤tUserData !== undefined) { setLocked(currentUserData.locked); setOnReady(true); } }, [currentUserData]); useEffect(() => { //upload latest data to parent const values = getValues(); const objectData ={ ...values, // selectedLotusUser: selectedLotusUser, // subDivision: subDivision, locked: locked, } updateUserObject(objectData); }, [isCollectData]); return ( !onReady ? : Information
Username: Password: Full Name: Post: {/* Sub-Division: { setSubDivision(newValue); }} renderInput={(params) => } /> */} Email: Phone: Locked: setLocked(event.target.checked)} name="checked" color="primary" size="small" />
); }; export default UserInformationCard;