From 593f00a7d323e8536a7624f3f6b0ad9002c51bdd Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 29 Aug 2023 15:54:44 +0800 Subject: [PATCH] add file list --- package.json | 3 +- src/auth/utils.js | 3 +- src/components/FileList.js | 156 ++++++ .../OrganizationCard.js | 479 ++++++++++++++++++ .../UserInformationCard_Organization.js | 447 ---------------- .../UserInformationOrgCard_Organization.js | 294 ----------- src/pages/OrganizationDetailPage/index.js | 40 +- .../index_loadFormUser.js | 71 +++ src/pages/OrganizationSearchPage/index.js | 4 +- .../UserInformationCard_Organization.js | 164 ++++++ .../UserInformationOrgCard_Organization.js | 294 ----------- .../pnspsUserDetailPage_Organization/index.js | 19 +- src/routes/SettingRoutes.js | 5 + src/utils/ApiPathConst.js | 6 + src/utils/IconUtils.js | 10 + 15 files changed, 927 insertions(+), 1068 deletions(-) create mode 100644 src/components/FileList.js create mode 100644 src/pages/OrganizationDetailPage/OrganizationCard.js delete mode 100644 src/pages/OrganizationDetailPage/UserInformationCard_Organization.js delete mode 100644 src/pages/OrganizationDetailPage/UserInformationOrgCard_Organization.js create mode 100644 src/pages/OrganizationDetailPage/index_loadFormUser.js delete mode 100644 src/pages/pnspsUserDetailPage_Organization/UserInformationOrgCard_Organization.js create mode 100644 src/utils/IconUtils.js diff --git a/package.json b/package.json index 6e719d7..66b897b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "pnsps-react", "version": "1.1.2", "private": true, - "homepage": ".", + "homepage": "/", "dependencies": { "@ant-design/colors": "^6.0.0", "@ant-design/icons": "^4.7.0", @@ -15,6 +15,7 @@ "@mui/lab": "^5.0.0-alpha.139", "@mui/material": "^5.10.6", "@mui/x-data-grid": "^6.11.1", + "@mui/x-date-pickers": "^6.12.0", "@reduxjs/toolkit": "^1.8.5", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", diff --git a/src/auth/utils.js b/src/auth/utils.js index 94e8de5..442053c 100644 --- a/src/auth/utils.js +++ b/src/auth/utils.js @@ -7,9 +7,10 @@ import useJwt from 'auth/jwt/coreUseJwt'; */ // eslint-disable-next-line arrow-body-style export const hostname = 'localhost'; -const hostPort = '8090'; +const hostPort = '8080'; export const hostPath = `http://${hostname}:${hostPort}`; export const apiPath = `${hostPath}/api`; +//export const apiPath = `/api`; export const isUserLoggedIn = () => { return localStorage.getItem('userData') && localStorage.getItem(useJwt.jwtConfig.storageTokenKeyName); diff --git a/src/components/FileList.js b/src/components/FileList.js new file mode 100644 index 0000000..f1e3e07 --- /dev/null +++ b/src/components/FileList.js @@ -0,0 +1,156 @@ +// material-ui +import * as React from 'react'; +import { + DataGrid, + GridActionsCellItem, +} from "@mui/x-data-grid"; +import {useEffect} from "react"; +import * as Icon from '../utils/IconUtils'; +import * as HttpUtils from "../utils/HttpUtils" +import * as UrlUtils from "../utils/ApiPathConst" +import * as DateUtils from "../utils/DateUtils" +// ==============================|| EVENT TABLE ||============================== // + +export default function FileList({refType, refId, allowDelete, sx}) { + const [rows, setRows] = React.useState([]); + const [rowModesModel] = React.useState({}); + + useEffect(() => { + loadData(); + }, []); + + const onDeleteClick = (fileId, skey, filename) => () => { + HttpUtils.get( + { + url: UrlUtils.GET_FILE_DELETE, + params:{ + fileId: fileId, + skey:skey, + filename: filename + }, + onSuccess: function(){ + loadData(); + } + } + ); + }; + + const onDownloadClick = (fileId, skey, filename) => () => { + HttpUtils.fileDownload({ + fileId:fileId, + skey:skey, + filename:filename, + }); + }; + + + const loadData = ()=>{ + HttpUtils.post( + { + url: UrlUtils.POST_FILE_LIST, + params:{ + refType: refType, + refId: refId, + }, + onSuccess: function(responseData){ + setRows(responseData.records); + } + } + ); + }; + + const convertToStr=(bytes,decimals)=>{ + if(bytes == 0) return '0 Bytes'; + var dm = decimals || 2, + sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + let i = 0; + i = Math.floor(Math.log(bytes) / Math.log(1024)); + return parseFloat((bytes / Math.pow(1024, i)).toFixed(dm)) + ' ' + sizes[i]; + } + + const columns = [ + { + id: 'created', + field: 'created', + headerName: 'created', + flex: 1, + valueGetter:(params)=>{ + return DateUtils.datetimeStr(params.value); + } + }, + { + field: 'actions', + type: 'actions', + headerName: '', + width: 50, + cellClassName: 'actions', + getActions: (params) => { + return [ + } + label="Download" + className="textPrimary" + onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} + color="primary" + />] + }, + },{ + id: 'filename', + field: 'filename', + headerName: 'filename', + flex: 3, + }, + { + id: 'filesize', + field: 'filesize', + headerName: 'filesize', + flex: 1, + valueGetter:(params)=>{ + return convertToStr(params.value); + } + }, + ]; + + + + if(allowDelete){ + columns.push({ + field: 'actions', + type: 'actions', + headerName: 'Delete', + width: 100, + cellClassName: 'actions', + getActions: (params) => { + return [ + } + label="Delete" + className="textPrimary" + onClick={onDeleteClick(params.id, params.row.skey, params.row.filename)} + color="primary" + />] + }, + }); + } + + return ( +
+ +
+ ); +} diff --git a/src/pages/OrganizationDetailPage/OrganizationCard.js b/src/pages/OrganizationDetailPage/OrganizationCard.js new file mode 100644 index 0000000..ca85a91 --- /dev/null +++ b/src/pages/OrganizationDetailPage/OrganizationCard.js @@ -0,0 +1,479 @@ +// material-ui +import { + Grid, TextField, Typography, Button +} from '@mui/material'; +import { DatePicker } from '@mui/x-date-pickers/DatePicker'; +import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; +import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; +import MainCard from "../../components/MainCard"; +import * as React from "react"; +import {useForm} from "react-hook-form"; +import {useEffect, useState} from "react"; +//import * as DateUtils from '../../utils/DateUtils'; +import * as HttpUtils from '../../utils/HttpUtils'; +import * as UrlUtils from "../../utils/ApiPathConst"; + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + + +const OrganizationCard = ({userData, loadDataFun, id}) => { + + const [currentUserData, setCurrentUserData] = useState(userData); + const [editMode, setEditMode] = useState(false); + const [createMode, setCreateMode] = useState(false); + + const from = useForm({defaultValues: userData}); + const {register,reset, handleSubmit} = from; + + useEffect(() => { + if(id>0){ + userData["country"] = userData.addressTemp?.country; + userData["district"] = userData.addressTemp?.district; + userData["addressLine1"] = userData.addressTemp?.addressLine1; + userData["addressLine2"] = userData.addressTemp?.addressLine2; + userData["addressLine3"] = userData.addressTemp?.addressLine3; + + userData["phoneNumber"] = userData.contactTel?.phoneNumber; + userData["tel_countryCode"] = userData.contactTel?.countryCode; + + userData["faxNumber"] = userData.faxNo?.faxNumber; + userData["fax_countryCode"] = userData.faxNo?.countryCode; + + userData["brExpiryDate"] = userData.brExpiryDate?userData.brExpiryDate: ""; + userData["brExpiryDateTemp"] = userData.brExpiryDateTemp?userData.brExpiryDate: ""; + }else{ + setCreateMode(id==0); + setEditMode(id==0); + + userData["brExpiryDate"] = ""; + userData["brExpiryDateTemp"] = ""; + } + + setCurrentUserData(userData); + }, [userData]); + + useEffect(() => { + reset(currentUserData); + }, [currentUserData]); + + + function onSubmitForm(_formData) { + HttpUtils.post({ + url: UrlUtils.POST_ORG_SAVE_PATH, + params: { + id:id>0?id:null, + enCompanyName: _formData.enCompanyName, + chCompanyName: _formData.chCompanyName, + brNo: _formData.brNo, + brExpiryDate: _formData.brExpiryDate, + enCompanyNameTemp: _formData.enCompanyNameTemp, + chCompanyNameTemp: _formData.chCompanyNameTemp, + brExpiryDateTemp: _formData.brExpiryDateTemp, + contactPerson: _formData.contactPerson, + contactTel: { + countryCode: _formData.tel_countryCode, + phoneNumber: _formData.phoneNumber + }, + faxNo: { + countryCode: _formData.fax_countryCode, + faxNumber: _formData.faxNumber + }, + addressTemp: { + country: _formData.country, + district: _formData.district, + addressLine1: _formData.addressLine1, + addressLine2: _formData.addressLine2, + addressLine3: _formData.addressLine3, + } + }, + onSuccess: function(){ + loadDataFun(); + setEditMode(false); + } + }); + } + + const onEditClick = () => { + setEditMode(true); + }; + + return ( + + + Information + + +
+ + + + + + + BR No.: + + + + + + + + + + + + + + Name (Eng): + + + + + + + + + + + + Name (Ch): + + + + + + + + + + + + Expiry Date: + + + + + + + + + + + + + + + + Temp Name (Eng): + + + + + + + + + + + + Temp Name (Ch): + + + + + + + + + + + + Temp Expiry Date: + + + + + + + + + + + + + + + Contact Person: + + + + + + + + + + + + Contact Tel: + + + + + + + + + + + + + + fax No: + + + + + + + + + + + + + + Country : + + + + + + + + + + + + District : + + + + + + + + + + + + Adress : + + + + + + + + + + + + + + + + + + + {/*bottom button*/} + + + + + {editMode? + <> + {createMode? + <> + + + + : + <> + + + + + } + + : + <> + + + + + } + + + + + + + +
+
+ ); +}; + +export default OrganizationCard; diff --git a/src/pages/OrganizationDetailPage/UserInformationCard_Organization.js b/src/pages/OrganizationDetailPage/UserInformationCard_Organization.js deleted file mode 100644 index 53d8327..0000000 --- a/src/pages/OrganizationDetailPage/UserInformationCard_Organization.js +++ /dev/null @@ -1,447 +0,0 @@ -// material-ui -import { - Grid, TextField, Typography, Button -} 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 * as DateUtils from '../../utils/DateUtils'; -import * as HttpUtils from '../../utils/HttpUtils'; -import * as UrlUtils from "../../utils/ApiPathConst"; - -// ==============================|| DASHBOARD - DEFAULT ||============================== // - - -const UserInformationCard_Organization = ({userData, loadDataFun}) => { - - const [currentUserData, setCurrentUserData] = useState(userData); - const [editMode, setEditMode] = useState(false); - const [locked, setLocked] = useState(false); - - - const from = useForm({defaultValues: userData}); - const {register,reset, handleSubmit} = from; - - useEffect(() => { - let createDate = DateUtils.datetimeStr(userData.created); - let modifiedBy = DateUtils.datetimeStr(userData.modified)+", "+userData.modifiedBy; - userData["createDate"] = createDate; - userData["modifieDate"] = modifiedBy; - userData["verifiedStatus"] = userData.verified? "Not verify yet":"Verified"; - - userData["country"] = userData.address?.country; - userData["addressLine1"] = userData.address?.addressLine1; - userData["addressLine2"] = userData.address?.addressLine2; - userData["addressLine3"] = userData.address?.addressLine3; - userData["addressLine3"] = userData.address?.addressLine3; - - userData["phoneNumber"] = userData.contactTel?.phoneNumber; - userData["tel_countryCode"] = userData.contactTel?.countryCode; - - userData["faxNumber"] = userData.faxNo?.faxNumber; - userData["fax_countryCode"] = userData.faxNo?.countryCode; - - setCurrentUserData(userData); - }, [userData]); - - useEffect(() => { - reset(currentUserData); - setLocked(currentUserData.locked); - }, [currentUserData]); - - - function onSubmitForm(_formData) { - HttpUtils.post({ - url: UrlUtils.POST_IND_USER+"/"+userData.id, - params: { - name: _formData.name, - prefix: _formData.prefix, - contactTel: { - countryCode: _formData.tel_countryCode, - phoneNumber: _formData.phoneNumber - }, - identification: _formData.identification, - emailAddress:_formData.emailAddress, - }, - onSuccess: function(){ - loadDataFun(); - } - }); - } - - const onEditClick = () => { - setEditMode(true); - }; - - const doLock = () => { - HttpUtils.get({ - url: UrlUtils.GET_USER_LOCK+"/"+userData.id, - onSuccess: function(){ - loadDataFun(); - } - }); - }; - - const doUnlock = () => { - HttpUtils.get({ - url: UrlUtils.GET_USER_UNLOCK+"/"+userData.id, - onSuccess: function(){ - loadDataFun(); - } - }); - }; - - return ( - - - Information - - -
- - - - - - Username: - - - - - - - - - - - - Name: - - - - - - - - - - - - Created Date: - - - - - - - - - - - - Prefix: - - - - - - - - - - - - Contact Tel: - - - - - - - - - - - - - - Last Updated: - - - - - - - - - - - - Organization: - - - - - {/* */} - - - - - - - - - Email: - - - - - - - - - - - - - Verified: - - - { - currentUserData.verified || editMode? - - - - : - <> - - - - - - - - } - - - - - - - - - - Last Login: - - - - - - - - - - - - - - - - Status: - - - - - - - - - - - {/*bottom button*/} - - - - {editMode? - <> - - - - - - - - : - <> - {locked? - - - - : - - - - } - - - - - } - - - - - -
-
- ); -}; - -export default UserInformationCard_Organization; diff --git a/src/pages/OrganizationDetailPage/UserInformationOrgCard_Organization.js b/src/pages/OrganizationDetailPage/UserInformationOrgCard_Organization.js deleted file mode 100644 index 865f52d..0000000 --- a/src/pages/OrganizationDetailPage/UserInformationOrgCard_Organization.js +++ /dev/null @@ -1,294 +0,0 @@ -// material-ui -import { - Grid, TextField, Typography, Button -} 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 * as DateUtils from '../../utils/DateUtils'; -import * as HttpUtils from '../../utils/HttpUtils'; -import * as UrlUtils from "../../utils/ApiPathConst"; - -// ==============================|| DASHBOARD - DEFAULT ||============================== // - - -const UserInformationOgCard_Organization = ({userData, loadDataFun}) => { - - const [currentUserData, setCurrentUserData] = useState(userData); - const [editMode, setEditMode] = useState(false); - - - const from = useForm({defaultValues: userData}); - const {register,reset, handleSubmit} = from; - - useEffect(() => { - let createDate = DateUtils.datetimeStr(userData.created); - let modifiedBy = DateUtils.datetimeStr(userData.modified)+", "+userData.modifiedBy; - userData["createDate"] = createDate; - userData["modifieDate"] = modifiedBy; - userData["verifiedStatus"] = userData.verified? "Not verify yet":"Verified"; - - userData["country"] = userData.address?.country; - userData["addressLine1"] = userData.address?.addressLine1; - userData["addressLine2"] = userData.address?.addressLine2; - userData["addressLine3"] = userData.address?.addressLine3; - userData["addressLine3"] = userData.address?.addressLine3; - - userData["phoneNumber"] = userData.contactTel?.phoneNumber; - userData["tel_countryCode"] = userData.contactTel?.countryCode; - - userData["faxNumber"] = userData.faxNo?.faxNumber; - userData["fax_countryCode"] = userData.faxNo?.countryCode; - - setCurrentUserData(userData); - setEditMode(false); - }, [userData]); - - useEffect(() => { - reset(currentUserData); - }, [currentUserData]); - - - function onSubmitForm(_formData) { - HttpUtils.post({ - url: UrlUtils.POST_IND_USER+"/"+userData.id, - params: { - name: _formData.name, - prefix: _formData.prefix, - contactTel: { - countryCode: _formData.tel_countryCode, - phoneNumber: _formData.phoneNumber - }, - identification: _formData.identification, - emailAddress:_formData.emailAddress, - }, - onSuccess: function(){ - loadDataFun(); - } - }); - } - - - return ( - - - Organization - - -
- - - - - - - Org.Name (English): - - - - - - - - - - - - Org.Name (Chinese): - - - - - - - - - - - - BR No.: - - - - - - - - - - - - - Fax No.: - - - - - - - - - - - - - - Contact Tel: - - - - - - - - - - - - - - - - Email: - - - - - - - - - - - - - BR Expiry Date.: - - - - - - - - - - - - {/*bottom button*/} - - - - {editMode? - <> - - - - - - - - : - - - - - - } - - - - - -
-
- ); -}; - -export default UserInformationOgCard_Organization; diff --git a/src/pages/OrganizationDetailPage/index.js b/src/pages/OrganizationDetailPage/index.js index 21370a4..cc38787 100644 --- a/src/pages/OrganizationDetailPage/index.js +++ b/src/pages/OrganizationDetailPage/index.js @@ -2,43 +2,42 @@ import {Grid, Typography} from '@mui/material'; import {useEffect, useState} from "react"; import * as React from "react"; -//import axios from "axios"; import * as HttpUtils from "../../utils/HttpUtils"; -import {apiPath} from "../../auth/utils"; import {useParams} from "react-router-dom"; -import UserInformationCard from "./UserInformationCard_Organization"; -import OrgCard from "./UserInformationOrgCard_Organization"; +import InfoCard from "./OrganizationCard"; import LoadingComponent from "../extra-pages/LoadingComponent"; import * as UrlUtils from "../../utils/ApiPathConst"; // ==============================|| DASHBOARD - DEFAULT ||============================== // -const UserMaintainPage_Organization = () => { +const OrganizationDetailPage = () => { const params = useParams(); - const [userData, setUserData] = useState({}) + const [formData, setFormData] = useState({}) const [isLoading, setLoding] = useState(true); useEffect(()=>{ - console.log(userData); + console.log(formData); loadData(); },[]); const loadData = ()=>{ setLoding(true); - HttpUtils.get({ - url: `${apiPath}${UrlUtils.GET_USER_PATH}/${params.id}`, - onSuccess: function(response){ - setUserData(response.data) - } - }); + if(params.id>0){ + HttpUtils.get({ + url: UrlUtils.GET_ORG_PATH+"/"+params.id, + onSuccess: function(response){ + setFormData(response.data) + } + }); + } }; useEffect(() => { setLoding(false); - }, [userData]); + }, [formData]); return ( isLoading ? @@ -46,19 +45,16 @@ const UserMaintainPage_Organization = () => { : - Organization User + Organization {/*col 1*/} - - @@ -70,4 +66,4 @@ const UserMaintainPage_Organization = () => { }; -export default UserMaintainPage_Organization; +export default OrganizationDetailPage; diff --git a/src/pages/OrganizationDetailPage/index_loadFormUser.js b/src/pages/OrganizationDetailPage/index_loadFormUser.js new file mode 100644 index 0000000..aa9d413 --- /dev/null +++ b/src/pages/OrganizationDetailPage/index_loadFormUser.js @@ -0,0 +1,71 @@ +// material-ui +import {Grid, Typography} from '@mui/material'; +import {useEffect, useState} from "react"; +import * as React from "react"; +import * as HttpUtils from "../../utils/HttpUtils"; +import {useParams} from "react-router-dom"; +import InfoCard from "./OrganizationCard"; +import LoadingComponent from "../extra-pages/LoadingComponent"; +import * as UrlUtils from "../../utils/ApiPathConst"; + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + + +const OrganizationDetailPage = () => { + const params = useParams(); + const [formData, setFormData] = useState({}) + const [isLoading, setLoding] = useState(true); + + + useEffect(()=>{ + console.log(formData); + loadData(); + },[]); + + const loadData = ()=>{ + setLoding(true); + if(params.id>0){ + HttpUtils.get({ + url: UrlUtils.GET_ORG_FROM_USER_PATH+"/"+params.id, + onSuccess: function(response){ + setFormData(response.data) + } + }); + }else{ + navigate('/org/0'); + } + }; + + + useEffect(() => { + setLoding(false); + }, [formData]); + + return ( + isLoading ? + + : + + + Organization (Create From User) + + {/*col 1*/} + + + + + + + + + {/*col 2*/} + + ); +}; + + +export default OrganizationDetailPage; diff --git a/src/pages/OrganizationSearchPage/index.js b/src/pages/OrganizationSearchPage/index.js index 12d7680..07556d8 100644 --- a/src/pages/OrganizationSearchPage/index.js +++ b/src/pages/OrganizationSearchPage/index.js @@ -33,7 +33,7 @@ const OrganizationSearchPage = () => { function getUserList(){ HttpUtils.get({ - url: UrlUtils.GET_ORG_USER_PATH, + url: UrlUtils.GET_ORG_PATH, params: searchCriteria, onSuccess: function(responseData){ setRecord(responseData); @@ -69,9 +69,7 @@ const OrganizationSearchPage = () => { /> - - ); }; diff --git a/src/pages/pnspsUserDetailPage_Organization/UserInformationCard_Organization.js b/src/pages/pnspsUserDetailPage_Organization/UserInformationCard_Organization.js index 5a58588..c817058 100644 --- a/src/pages/pnspsUserDetailPage_Organization/UserInformationCard_Organization.js +++ b/src/pages/pnspsUserDetailPage_Organization/UserInformationCard_Organization.js @@ -438,6 +438,170 @@ const UserInformationCard_Organization = ({userData, loadDataFun}) => { + + + + Organization + + + + + + + + + + + + + Org.Name (English): + + + + + + + + + + + + Org.Name (Chinese): + + + + + + + + + + + + BR No.: + + + + + + + + + + + + + Fax No.: + + + + + + + + + + + + + + Contact Tel: + + + + + + + + + + + + + + + + Email: + + + + + + + + + + + + + BR Expiry Date.: + + + + + + + + + + + ); diff --git a/src/pages/pnspsUserDetailPage_Organization/UserInformationOrgCard_Organization.js b/src/pages/pnspsUserDetailPage_Organization/UserInformationOrgCard_Organization.js deleted file mode 100644 index 865f52d..0000000 --- a/src/pages/pnspsUserDetailPage_Organization/UserInformationOrgCard_Organization.js +++ /dev/null @@ -1,294 +0,0 @@ -// material-ui -import { - Grid, TextField, Typography, Button -} 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 * as DateUtils from '../../utils/DateUtils'; -import * as HttpUtils from '../../utils/HttpUtils'; -import * as UrlUtils from "../../utils/ApiPathConst"; - -// ==============================|| DASHBOARD - DEFAULT ||============================== // - - -const UserInformationOgCard_Organization = ({userData, loadDataFun}) => { - - const [currentUserData, setCurrentUserData] = useState(userData); - const [editMode, setEditMode] = useState(false); - - - const from = useForm({defaultValues: userData}); - const {register,reset, handleSubmit} = from; - - useEffect(() => { - let createDate = DateUtils.datetimeStr(userData.created); - let modifiedBy = DateUtils.datetimeStr(userData.modified)+", "+userData.modifiedBy; - userData["createDate"] = createDate; - userData["modifieDate"] = modifiedBy; - userData["verifiedStatus"] = userData.verified? "Not verify yet":"Verified"; - - userData["country"] = userData.address?.country; - userData["addressLine1"] = userData.address?.addressLine1; - userData["addressLine2"] = userData.address?.addressLine2; - userData["addressLine3"] = userData.address?.addressLine3; - userData["addressLine3"] = userData.address?.addressLine3; - - userData["phoneNumber"] = userData.contactTel?.phoneNumber; - userData["tel_countryCode"] = userData.contactTel?.countryCode; - - userData["faxNumber"] = userData.faxNo?.faxNumber; - userData["fax_countryCode"] = userData.faxNo?.countryCode; - - setCurrentUserData(userData); - setEditMode(false); - }, [userData]); - - useEffect(() => { - reset(currentUserData); - }, [currentUserData]); - - - function onSubmitForm(_formData) { - HttpUtils.post({ - url: UrlUtils.POST_IND_USER+"/"+userData.id, - params: { - name: _formData.name, - prefix: _formData.prefix, - contactTel: { - countryCode: _formData.tel_countryCode, - phoneNumber: _formData.phoneNumber - }, - identification: _formData.identification, - emailAddress:_formData.emailAddress, - }, - onSuccess: function(){ - loadDataFun(); - } - }); - } - - - return ( - - - Organization - - -
- - - - - - - Org.Name (English): - - - - - - - - - - - - Org.Name (Chinese): - - - - - - - - - - - - BR No.: - - - - - - - - - - - - - Fax No.: - - - - - - - - - - - - - - Contact Tel: - - - - - - - - - - - - - - - - Email: - - - - - - - - - - - - - BR Expiry Date.: - - - - - - - - - - - - {/*bottom button*/} - - - - {editMode? - <> - - - - - - - - : - - - - - - } - - - - - -
-
- ); -}; - -export default UserInformationOgCard_Organization; diff --git a/src/pages/pnspsUserDetailPage_Organization/index.js b/src/pages/pnspsUserDetailPage_Organization/index.js index 21370a4..32b2d1d 100644 --- a/src/pages/pnspsUserDetailPage_Organization/index.js +++ b/src/pages/pnspsUserDetailPage_Organization/index.js @@ -6,8 +6,9 @@ import * as React from "react"; import * as HttpUtils from "../../utils/HttpUtils"; import {apiPath} from "../../auth/utils"; import {useParams} from "react-router-dom"; +import FileList from "../../components/FileList" +import MainCard from "../../components/MainCard"; import UserInformationCard from "./UserInformationCard_Organization"; -import OrgCard from "./UserInformationOrgCard_Organization"; import LoadingComponent from "../extra-pages/LoadingComponent"; import * as UrlUtils from "../../utils/ApiPathConst"; @@ -56,12 +57,18 @@ const UserMaintainPage_Organization = () => { userData={userData} loadDataFun={loadData} /> - - + + + + Files + + + + {/*col 2*/} diff --git a/src/routes/SettingRoutes.js b/src/routes/SettingRoutes.js index 98354db..7cafcfc 100644 --- a/src/routes/SettingRoutes.js +++ b/src/routes/SettingRoutes.js @@ -17,6 +17,7 @@ const UserGroupSearchPage = Loadable(lazy(() => import('pages/pnspsUserGroupSear const UserGroupDetailPage = Loadable(lazy(() => import('pages/pnspsUserGroupDetailPage'))); const OrganizationSearchPage = Loadable(lazy(() => import('pages/OrganizationSearchPage'))); const OrganizationDetailPage = Loadable(lazy(() => import('pages/OrganizationDetailPage'))); +const OrganizationDetailPage_fromUser = Loadable(lazy(() => import('pages/OrganizationDetailPage/index_loadFormUser'))); // ==============================|| AUTH ROUTING ||============================== // @@ -65,6 +66,10 @@ const SettingRoutes = { path: '/org/:id', element: }, + { + path: '/org/fromUser/:id', + element: + }, { path: 'setting', element: diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 0779cdb..9cdaca6 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -20,10 +20,16 @@ export const POST_IND_USER = apiPath+'/user/ind'; export const GET_ORG_USER_PATH = apiPath+'/user/org'; +export const GET_ORG_PATH = apiPath+'/org'; +export const GET_ORG_FROM_USER_PATH = apiPath+'/org/from-user'; +export const POST_ORG_SAVE_PATH = apiPath+'/org/save'; + //File Up/Download export const FILE_UP_POST = apiPath+'/file/ul'; export const FILE_DOWN_GET = apiPath+"/file/dl"; +export const POST_FILE_LIST = apiPath+'/file/list'; +export const GET_FILE_DELETE = apiPath+'/file/delete'; //export const FILE_DOWN_GET = ({id,skey,filename})=>{ return apiPath+'/file/dl/'+id+'/'+skey+'/'+filename}; // POST request diff --git a/src/utils/IconUtils.js b/src/utils/IconUtils.js new file mode 100644 index 0000000..f8b633c --- /dev/null +++ b/src/utils/IconUtils.js @@ -0,0 +1,10 @@ + +import DeleteIcon from '@mui/icons-material/DeleteForever'; +import EditIcon from '@mui/icons-material/Edit'; +import ViewIcon from '@mui/icons-material/Visibility'; +import DownloadICon from '@mui/icons-material/Download'; + +export const Delete = DeleteIcon; +export const Edit = EditIcon; +export const View = ViewIcon; +export const Download = DownloadICon; \ No newline at end of file