diff --git a/src/pages/pnspsUserDetailPage_Public/UserInformationCard_Public.js b/src/pages/pnspsUserDetailPage_Public/UserInformationCard_Public.js
new file mode 100644
index 0000000..07af1ed
--- /dev/null
+++ b/src/pages/pnspsUserDetailPage_Public/UserInformationCard_Public.js
@@ -0,0 +1,252 @@
+// 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 {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 UserInformationCard_Public = ({isCollectData, updateUserObject,userData}) => {
+
+ const readOnly = true;
+
+ //const params = useParams();
+ const [currentUserData, setCurrentUserData] = React.useState({});
+ const [locked, setLocked] = useState(false);
+ const [onReady, setOnReady] = useState(false);
+ const {register, getValues} = useForm()
+
+ 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,
+ locked: locked,
+ }
+ updateUserObject(objectData);
+ }, [isCollectData]);
+
+ return (
+ !onReady ?
+
+ :
+
+
+ Information
+
+
+
+
+
+ );
+};
+
+export default UserInformationCard_Public;
diff --git a/src/pages/pnspsUserDetailPage_Public/index.js b/src/pages/pnspsUserDetailPage_Public/index.js
new file mode 100644
index 0000000..65681d2
--- /dev/null
+++ b/src/pages/pnspsUserDetailPage_Public/index.js
@@ -0,0 +1,107 @@
+// material-ui
+import {
+ Button,
+ Grid, Typography
+} from '@mui/material';
+import {useEffect, useState} from "react";
+import * as React from "react";
+import axios from "axios";
+import {apiPath} from "../../auth/utils";
+import {useParams} from "react-router-dom";
+import UserInformationCard from "./UserInformationCard_Public";
+import LoadingComponent from "../extra-pages/LoadingComponent";
+import {GET_USER_PATH} from "../../utils/ApiPathConst";
+
+// ==============================|| DASHBOARD - DEFAULT ||============================== //
+
+
+const UserMaintainPage_Public = () => {
+ const params = useParams();
+ const [userData, setUserData] = React.useState({});
+ const [onReady, setOnReady] = useState(false);
+ const [isCollectData, setIsCollectData] = useState(false);
+ const [editedCustomerData, setEditedCustomerData] = useState({});
+ const [userConfirm, setUserConfirm] = useState(false);
+
+ function updateUserObject(userData) {
+ setEditedCustomerData(userData);
+ }
+
+ const submitData = () => {
+ setUserConfirm(true);
+ setIsCollectData(!isCollectData);
+ }
+
+ useEffect(() => {
+ console.log(params)
+ axios.get(`${apiPath}${GET_USER_PATH}/${params.id}`)
+ .then((response) => {
+ if (response.status === 200) {
+ setUserData(response.data);
+ }
+ })
+ .catch(error => {
+ console.log(error);
+ return false;
+ });
+ }, []);
+
+ useEffect(() => {
+ setOnReady(true);
+ }, [userData]);
+
+ useEffect(() => {
+ if(userConfirm && onReady){
+ console.log("update in parents");
+ console.log(editedCustomerData);
+ }
+ setUserConfirm(false);
+ }, [editedCustomerData]);
+
+ return (
+ !onReady ?
+
+ :
+
+
+ Maintain User
+
+ {/*col 1*/}
+
+
+
+
+
+
+
+
+ {/*col 2*/}
+
+ {/*bottom button*/}
+
+
+
+
+
+
+
+
+ );
+};
+
+export default UserMaintainPage_Public;
diff --git a/src/pages/pnspsUserSearchPage_Public/UserSearchForm_Public.js b/src/pages/pnspsUserSearchPage_Public/UserSearchForm_Public.js
index d96833f..b448c2f 100644
--- a/src/pages/pnspsUserSearchPage_Public/UserSearchForm_Public.js
+++ b/src/pages/pnspsUserSearchPage_Public/UserSearchForm_Public.js
@@ -8,35 +8,15 @@ import {
import MainCard from "../../components/MainCard";
import {useForm} from "react-hook-form";
-import {useEffect, useState} from "react";
-import Autocomplete from '@mui/material/Autocomplete';
-import {
- subDivision1,
- subDivision2,
- subDivision3,
- subDivision4,
- subDivision5,
- subDivision6
-} from "pages/pnspsUserSettingPage/DummyComboRecord";
+import { useState} from "react";
import Checkbox from "@mui/material/Checkbox";
import * as React from "react";
// ==============================|| DASHBOARD - DEFAULT ||============================== //
-const subDivisionArray =[
- ...subDivision1,
- ...subDivision2,
- ...subDivision3,
- ...subDivision4,
- ...subDivision5,
- ...subDivision6
-];
const UserSearchForm_Public = ({applySearch}) => {
const [type, setType] = useState([]);
- const [division, setDivision] = useState(null);
- const [subDivision, setSubDivision] = useState(null);
- const [isLotusNoteUser, setIsLotusNoteUser] = useState(false);
const [locked, setLocked] = useState(false);
@@ -52,27 +32,15 @@ const UserSearchForm_Public = ({applySearch}) => {
const temp = {
username: data.userName,
fullName: data.fullName,
- subDivision: subDivision,
email: data.email,
phone: data.phone,
- isLotusNoteUser: isLotusNoteUser,
locked: locked,
};
applySearch(temp);
};
- useEffect(() => {
- if(division != null){
- setSubDivision(subDivisionArray[division.type-1][0]);
- }
-
- }, [division]);
-
function resetForm(){
setType([]);
- setDivision(null);
- setSubDivision(null);
- setIsLotusNoteUser(false);
setLocked(false);
reset();
}
@@ -110,19 +78,6 @@ const UserSearchForm_Public = ({applySearch}) => {
/>
-
- {
- setSubDivision(newValue);
- }}
- renderInput={(params) => }
- />
-
-
{
/>
-
- setIsLotusNoteUser(event.target.checked)}
- name="checked"
- color="primary"
- size="small"
- />
- }
- label={Lotus Notes User}
- />
-
-
() => {
- navigate('/user/'+ id);
+ const handleActionClick = (id) => () => {
+ navigate('/publicUser/'+ id);
};
const columns = [
@@ -37,10 +37,10 @@ export default function UserTable_Public({recordList}) {
return [
}
- label="Edit"
+ icon={}
+ label="View"
className="textPrimary"
- onClick={handleEditClick(id)}
+ onClick={handleActionClick(id)}
color="primary"
/>]
},
@@ -57,45 +57,12 @@ export default function UserTable_Public({recordList}) {
headerName: 'Full Name',
flex: 1,
},
- {
- id: 'post',
- field: 'post',
- headerName: 'Post',
- flex: 1,
- },
{
id: 'email',
field: 'email',
headerName: 'Email',
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 (
-
- );
- },
- },
{
id: 'locked',
field: 'locked',
diff --git a/src/pages/pnspsUserSearchPage_Public/index.js b/src/pages/pnspsUserSearchPage_Public/index.js
index ffb3719..bb9a5c0 100644
--- a/src/pages/pnspsUserSearchPage_Public/index.js
+++ b/src/pages/pnspsUserSearchPage_Public/index.js
@@ -8,7 +8,7 @@ import EventTable from "./UserTable_Public";
import {useEffect, useState} from "react";
import axios from "axios";
import {apiPath} from "../../auth/utils";
-import {GET_USER_PATH} from "../../utils/ApiPathConst";
+import {GET_PUBLIC_USER_PATH} from "../../utils/ApiPathConst";
import * as React from "react";
import LoadingComponent from "../extra-pages/LoadingComponent";
@@ -33,7 +33,7 @@ const UserSearchPage_Public = () => {
}, [searchCriteria]);
function getUserList(){
- axios.get(`${apiPath}${GET_USER_PATH}`,
+ axios.get(`${apiPath}${GET_PUBLIC_USER_PATH}`,
{params: searchCriteria}
)
.then((response) => {
@@ -57,7 +57,7 @@ const UserSearchPage_Public = () => {
:
- View User
+ View Public User
{/*row 1*/}
diff --git a/src/routes/SettingRoutes.js b/src/routes/SettingRoutes.js
index ce5f4bc..493c096 100644
--- a/src/routes/SettingRoutes.js
+++ b/src/routes/SettingRoutes.js
@@ -9,6 +9,8 @@ const SettingPage = Loadable(lazy(() => import('pages/pnspsSettingPage')));
const PasswordPolicyPage = Loadable(lazy(()=> import('pages/pnspsPasswordPolicyPage')))
const UserSearchPage = Loadable(lazy(()=>import ('pages/pnspsUserSearchPage')));
const UserMaintainPage = Loadable(lazy(() => import('pages/pnspsUserDetailPage')));
+const UserSearchPage_Public = Loadable(lazy(()=>import ('pages/pnspsUserSearchPage_Public')));
+const UserMaintainPage_Public = Loadable(lazy(() => import('pages/pnspsUserDetailPage_Public')));
const UserGroupSearchPage = Loadable(lazy(() => import('pages/pnspsUserGroupSearchPage')));
const UserGroupDetailPage = Loadable(lazy(() => import('pages/pnspsUserGroupDetailPage')));
@@ -31,12 +33,16 @@ const SettingRoutes = {
element:
},
{
- path: 'publicUserSearchview',
+ path: '/user/:id',
+ element:
+ },
+ {
+ path: 'publicUser',
element:
},
{
- path: '/user/:id',
- element:
+ path: '/publicUser/:id',
+ element:
},
{
path: 'setting',
diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js
index 3408e3f..821fc0e 100644
--- a/src/utils/ApiPathConst.js
+++ b/src/utils/ApiPathConst.js
@@ -3,6 +3,7 @@ export const GET_GROUP_COMBO_PATH = "/group/combo"
export const GET_GROUP_MEMBER_LIST_PATH = "/group/member"
export const GET_GROUP_AUTH_LIST = "/group/auth/combo"
export const GET_USER_PATH = "/user"
+export const GET_PUBLIC_USER_PATH = "/user/public"
export const GET_AUTH_LIST = "/user/auth/combo"
export const GET_USER_COMBO_LIST = "/user/combo"