@@ -50,8 +50,9 @@ const AuthFooter = () => { | |||||
W3C WAI Web Content Accessibility Guidelines 2.0"/> | W3C WAI Web Content Accessibility Guidelines 2.0"/> | ||||
</a> | </a> | ||||
<a href="https://www.brandhk.gov.hk/zh-hk" | <a href="https://www.brandhk.gov.hk/zh-hk" | ||||
title=""> | |||||
<img src={bhkLogo} alt="logo" height="32" width="88" /> | |||||
title="Brand Hong Kong"> | |||||
<img src={bhkLogo} alt="logo" height="32" width="88" | |||||
/> | |||||
</a> | </a> | ||||
</Stack> | </Stack> | ||||
</Container> | </Container> | ||||
@@ -1,6 +1,6 @@ | |||||
// material-ui | // material-ui | ||||
import { | import { | ||||
Grid, Button, Checkbox,FormControlLabel | |||||
Grid, Button, Checkbox, FormControlLabel, Typography | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
// import { FormControlLabel } from '@material-ui/core'; | // import { FormControlLabel } from '@material-ui/core'; | ||||
import MainCard from "../../components/MainCard"; | import MainCard from "../../components/MainCard"; | ||||
@@ -129,7 +129,7 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
<> | <> | ||||
{createMode ? | {createMode ? | ||||
<> | <> | ||||
<Grid item sx={{ ml: 3, mr: 3 }}> | |||||
<Grid item sx={{ ml: 0, mr: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -144,7 +144,7 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
</Grid> | </Grid> | ||||
</> : | </> : | ||||
<> | <> | ||||
<Grid item sx={{ ml: 3, mr: 3 }}> | |||||
<Grid item sx={{ ml: 0, mr: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -176,7 +176,7 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
</> | </> | ||||
: | : | ||||
<> | <> | ||||
<Grid item sx={{ ml: 3, mr: 3 }}> | |||||
<Grid item sx={{ ml: 0, mr: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -195,11 +195,15 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
</Grid> | </Grid> | ||||
{/*top*/} | {/*top*/} | ||||
{!onReady? | |||||
<LoadingComponent /> | |||||
: | |||||
{!onReady ? | |||||
<LoadingComponent /> | |||||
: | |||||
<Grid container spacing={1}> | <Grid container spacing={1}> | ||||
<Grid item xs={12}> | |||||
<Typography variant="h5" sx={{mb: 2, mr: 3, borderBottom: "1px solid black" }}> | |||||
Organization Details | |||||
</Typography> | |||||
</Grid> | |||||
<Grid item lg={4} > | <Grid item lg={4} > | ||||
{FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
label: FieldUtils.notNullFieldLabel("BR No.:"), | label: FieldUtils.notNullFieldLabel("BR No.:"), | ||||
@@ -214,8 +218,8 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
control={<Checkbox checked={formik.values.creditor} />} | control={<Checkbox checked={formik.values.creditor} />} | ||||
label="is Creditor" | label="is Creditor" | ||||
name="creditor" | name="creditor" | ||||
onChange={()=>{ | |||||
formik.setFieldValue("creditor",!formik.values.creditor); | |||||
onChange={() => { | |||||
formik.setFieldValue("creditor", !formik.values.creditor); | |||||
}} | }} | ||||
disabled={!editMode && !createMode} | disabled={!editMode && !createMode} | ||||
/> | /> | ||||
@@ -233,84 +237,84 @@ const OrganizationCard = ({ userData, loadDataFun, id }) => { | |||||
</Grid> | </Grid> | ||||
<Grid item lg={4} > | <Grid item lg={4} > | ||||
{FieldUtils.getTextField({ | |||||
label: "Name (Ch):", | |||||
valueName: "chCompanyName", | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
{FieldUtils.getTextField({ | |||||
label: "Name (Ch):", | |||||
valueName: "chCompanyName", | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
</Grid> | </Grid> | ||||
<Grid item lg={4} > | <Grid item lg={4} > | ||||
{FieldUtils.getDateField({ | |||||
label: FieldUtils.notNullFieldLabel("Expiry Date:"), | |||||
valueName: "brExpiryDate", | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
{FieldUtils.getDateField({ | |||||
label: FieldUtils.notNullFieldLabel("Expiry Date:"), | |||||
valueName: "brExpiryDate", | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
</Grid> | </Grid> | ||||
<Grid item lg={4} > | <Grid item lg={4} > | ||||
{FieldUtils.getTextField({ | |||||
label: FieldUtils.notNullFieldLabel("Contact Person:"), | |||||
valueName: "contactPerson", | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
{FieldUtils.getTextField({ | |||||
label: FieldUtils.notNullFieldLabel("Contact Person:"), | |||||
valueName: "contactPerson", | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
</Grid> | </Grid> | ||||
<Grid item lg={4} > | <Grid item lg={4} > | ||||
{FieldUtils.getPhoneField({ | |||||
label: FieldUtils.notNullFieldLabel("Contact Tel:"), | |||||
valueName: { | |||||
code: "tel_countryCode", | |||||
num: "phoneNumber" | |||||
}, | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
{FieldUtils.getPhoneField({ | |||||
label: FieldUtils.notNullFieldLabel("Contact Tel:"), | |||||
valueName: { | |||||
code: "tel_countryCode", | |||||
num: "phoneNumber" | |||||
}, | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
</Grid> | </Grid> | ||||
<Grid item lg={4} > | <Grid item lg={4} > | ||||
{FieldUtils.getPhoneField({ | |||||
label: "Fax No:", | |||||
valueName: { | |||||
code: "fax_countryCode", | |||||
num: "faxNumber" | |||||
}, | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
{FieldUtils.getPhoneField({ | |||||
label: "Fax No:", | |||||
valueName: { | |||||
code: "fax_countryCode", | |||||
num: "faxNumber" | |||||
}, | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
</Grid> | </Grid> | ||||
<Grid item lg={4} > | <Grid item lg={4} > | ||||
{FieldUtils.getComboField({ | |||||
label: FieldUtils.notNullFieldLabel("Country:"), | |||||
valueName: "country", | |||||
disabled: (!editMode && !createMode), | |||||
dataList: ComboData.country, | |||||
form: formik | |||||
})} | |||||
{FieldUtils.getComboField({ | |||||
label: FieldUtils.notNullFieldLabel("Country:"), | |||||
valueName: "country", | |||||
disabled: (!editMode && !createMode), | |||||
dataList: ComboData.country, | |||||
form: formik | |||||
})} | |||||
</Grid> | </Grid> | ||||
<Grid item lg={4} > | <Grid item lg={4} > | ||||
{FieldUtils.getComboField({ | |||||
label: FieldUtils.notNullFieldLabel("District:"), | |||||
valueName: "district", | |||||
disabled: (!editMode && !createMode), | |||||
dataList: ComboData.district, | |||||
form: formik | |||||
})} | |||||
{FieldUtils.getComboField({ | |||||
label: FieldUtils.notNullFieldLabel("District:"), | |||||
valueName: "district", | |||||
disabled: (!editMode && !createMode), | |||||
dataList: ComboData.district, | |||||
form: formik | |||||
})} | |||||
</Grid> | </Grid> | ||||
<Grid item lg={4} > | <Grid item lg={4} > | ||||
{FieldUtils.getAddressField({ | |||||
label: FieldUtils.notNullFieldLabel("Address:"), | |||||
valueName: ["addressLine1", "addressLine2", "addressLine3"], | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
{FieldUtils.getAddressField({ | |||||
label: FieldUtils.notNullFieldLabel("Address:"), | |||||
valueName: ["addressLine1", "addressLine2", "addressLine3"], | |||||
disabled: (!editMode && !createMode), | |||||
form: formik | |||||
})} | |||||
</Grid> | </Grid> | ||||
<Grid item lg={12} ></Grid> | <Grid item lg={12} ></Grid> | ||||
@@ -1,9 +1,9 @@ | |||||
// material-ui | // material-ui | ||||
import {Grid, Typography} from '@mui/material'; | |||||
import {useEffect, useState} from "react"; | |||||
import { Grid, Typography, Stack, Box, Button } from '@mui/material'; | |||||
import { useEffect, useState } from "react"; | |||||
import * as React from "react"; | import * as React from "react"; | ||||
import * as HttpUtils from "../../utils/HttpUtils"; | import * as HttpUtils from "../../utils/HttpUtils"; | ||||
import {useParams} from "react-router-dom"; | |||||
import { useParams } from "react-router-dom"; | |||||
import * as UrlUtils from "../../utils/ApiPathConst"; | import * as UrlUtils from "../../utils/ApiPathConst"; | ||||
import * as DateUtils from "../../utils/DateUtils"; | import * as DateUtils from "../../utils/DateUtils"; | ||||
@@ -11,41 +11,53 @@ import Loadable from 'components/Loadable'; | |||||
import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
const InfoCard = Loadable(lazy(() => import('./OrganizationCard'))); | const InfoCard = Loadable(lazy(() => import('./OrganizationCard'))); | ||||
const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent'))); | ||||
import KeyboardBackspaceOutlinedIcon from '@mui/icons-material/KeyboardBackspaceOutlined'; | |||||
import { useNavigate } from 'react-router-dom'; | |||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize: 'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
} | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const OrganizationDetailPage = () => { | const OrganizationDetailPage = () => { | ||||
const params = useParams(); | const params = useParams(); | ||||
const [formData, setFormData] = useState({}) | |||||
const [formData, setFormData] = useState({}) | |||||
const [isLoading, setLoding] = useState(true); | const [isLoading, setLoding] = useState(true); | ||||
const navigate = useNavigate(); | |||||
useEffect(()=>{ | |||||
useEffect(() => { | |||||
console.log(formData); | console.log(formData); | ||||
loadData(); | loadData(); | ||||
},[]); | |||||
}, []); | |||||
const loadData = ()=>{ | |||||
const loadData = () => { | |||||
setLoding(true); | setLoding(true); | ||||
if(params.id>0){ | |||||
if (params.id > 0) { | |||||
HttpUtils.get({ | HttpUtils.get({ | ||||
url: UrlUtils.GET_ORG_PATH+"/"+params.id, | |||||
onSuccess: function(response){ | |||||
url: UrlUtils.GET_ORG_PATH + "/" + params.id, | |||||
onSuccess: function (response) { | |||||
response.data["country"] = response.data.addressTemp?.country; | response.data["country"] = response.data.addressTemp?.country; | ||||
response.data["district"] = response.data.addressTemp?.district; | response.data["district"] = response.data.addressTemp?.district; | ||||
response.data["addressLine1"] = response.data.addressTemp?.addressLine1; | response.data["addressLine1"] = response.data.addressTemp?.addressLine1; | ||||
response.data["addressLine2"] = response.data.addressTemp?.addressLine2; | response.data["addressLine2"] = response.data.addressTemp?.addressLine2; | ||||
response.data["addressLine3"] = response.data.addressTemp?.addressLine3; | response.data["addressLine3"] = response.data.addressTemp?.addressLine3; | ||||
response.data["phoneNumber"] = response.data.contactTel?.phoneNumber; | response.data["phoneNumber"] = response.data.contactTel?.phoneNumber; | ||||
response.data["tel_countryCode"] = response.data.contactTel?.countryCode; | response.data["tel_countryCode"] = response.data.contactTel?.countryCode; | ||||
response.data["faxNumber"] = response.data.faxNo?.faxNumber; | response.data["faxNumber"] = response.data.faxNo?.faxNumber; | ||||
response.data["fax_countryCode"] = response.data.faxNo?.countryCode; | response.data["fax_countryCode"] = response.data.faxNo?.countryCode; | ||||
response.data["brExpiryDate"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate): ""; | |||||
response.data["brExpiryDate"] = response.data.brExpiryDate ? DateUtils.dateStr(response.data.brExpiryDate) : ""; | |||||
setFormData(response.data) | setFormData(response.data) | ||||
} | } | ||||
}); | }); | ||||
@@ -54,28 +66,40 @@ const OrganizationDetailPage = () => { | |||||
useEffect(() => { | useEffect(() => { | ||||
setLoding(false); | |||||
setLoding(false); | |||||
}, [formData]); | }, [formData]); | ||||
return ( | return ( | ||||
isLoading ? | isLoading ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<Grid container rowSpacing={4.5} columnSpacing={2.75}> | |||||
<Grid item xs={12} sx={{mb: -2.25}}> | |||||
<Typography variant="h5" >Organization Details</Typography> | |||||
<Grid container> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4">Maintain Organization</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | |||||
<Grid item xs={12}> | |||||
<Button sx={{ ml: 3.5, mt: 2 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate("/org") }}> | |||||
<KeyboardBackspaceOutlinedIcon /> | |||||
<Typography variant="h4">Back</Typography> | |||||
</Button> | |||||
</Grid> | </Grid> | ||||
{/*col 1*/} | {/*col 1*/} | ||||
<Grid item xs={12} > | <Grid item xs={12} > | ||||
<Grid container> | <Grid container> | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<InfoCard | |||||
userData={formData} | |||||
loadDataFun={loadData} | |||||
id={params.id} | |||||
/> | |||||
<Box xs={12} ml={4} mt={3} mr={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<InfoCard | |||||
userData={formData} | |||||
loadDataFun={loadData} | |||||
id={params.id} | |||||
/> | |||||
</Box> | |||||
<br /> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
{/*col 2*/} | {/*col 2*/} | ||||
@@ -1,10 +1,10 @@ | |||||
// material-ui | // material-ui | ||||
import { | import { | ||||
Grid, Typography | |||||
Grid, Typography, Stack | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../components/MainCard"; | import MainCard from "../../components/MainCard"; | ||||
import {useEffect, useState} from "react"; | |||||
import { useEffect, useState } from "react"; | |||||
import * as UrlUtils from "../../utils/ApiPathConst"; | import * as UrlUtils from "../../utils/ApiPathConst"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import * as HttpUtils from "../../utils/HttpUtils"; | import * as HttpUtils from "../../utils/HttpUtils"; | ||||
@@ -17,12 +17,22 @@ import { lazy } from 'react'; | |||||
const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingComponent'))); | ||||
const SearchForm = Loadable(lazy(() => import('./OrganizationSearchForm'))); | const SearchForm = Loadable(lazy(() => import('./OrganizationSearchForm'))); | ||||
const EventTable = Loadable(lazy(() => import('./OrganizationTable'))); | const EventTable = Loadable(lazy(() => import('./OrganizationTable'))); | ||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize:'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
} | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const OrganizationSearchPage = () => { | const OrganizationSearchPage = () => { | ||||
const [record,setRecord] = useState([]); | |||||
const [record, setRecord] = useState([]); | |||||
const [searchCriteria, setSearchCriteria] = useState({}); | const [searchCriteria, setSearchCriteria] = useState({}); | ||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
@@ -38,11 +48,11 @@ const OrganizationSearchPage = () => { | |||||
getUserList(); | getUserList(); | ||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
function getUserList(){ | |||||
function getUserList() { | |||||
HttpUtils.get({ | HttpUtils.get({ | ||||
url: UrlUtils.GET_ORG_PATH, | url: UrlUtils.GET_ORG_PATH, | ||||
params: searchCriteria, | params: searchCriteria, | ||||
onSuccess: function(responseData){ | |||||
onSuccess: function (responseData) { | |||||
setRecord(responseData); | setRecord(responseData); | ||||
} | } | ||||
}); | }); | ||||
@@ -54,29 +64,32 @@ const OrganizationSearchPage = () => { | |||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<Grid container rowSpacing={4.5} columnSpacing={2.75}> | |||||
<Grid item xs={12} sx={{mb: -2.25}}> | |||||
<Typography variant="h5">View Organization</Typography> | |||||
<Grid container> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4">View Organization</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | |||||
{/*row 1*/} | |||||
<Grid item xs={12} md={12} lg={12}> | |||||
<SearchForm applySearch={applySearch} /> | |||||
</Grid> | |||||
{/*row 2*/} | |||||
<Grid item xs={12} md={12} lg={12}> | |||||
<MainCard elevation={0} | |||||
border={false} | |||||
content={false} | |||||
> | |||||
<EventTable | |||||
recordList={record} | |||||
/> | |||||
</MainCard> | |||||
</Grid> | |||||
</Grid> | </Grid> | ||||
{/*row 1*/} | |||||
<Grid item xs={12} md={12} lg={12}> | |||||
<SearchForm applySearch={applySearch}/> | |||||
</Grid> | |||||
{/*row 2*/} | |||||
<Grid item xs={12} md={12} lg={12}> | |||||
<MainCard elevation={0} | |||||
border={false} | |||||
content={false} | |||||
> | |||||
<EventTable | |||||
recordList={record} | |||||
/> | |||||
</MainCard> | |||||
</Grid> | |||||
</Grid> | |||||
); | ); | ||||
}; | }; | ||||
@@ -16,7 +16,7 @@ const MainCard = Loadable(React.lazy(() => import('components/MainCard'))); | |||||
import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils"; | import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils"; | ||||
import FileList from "components/FileList" | import FileList from "components/FileList" | ||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const ApplicationDetailCard = ({ formData, }) => { | |||||
const ApplicationDetailCard = ({ formData, setBackButtonPos }) => { | |||||
const params = useParams(); | const params = useParams(); | ||||
@@ -63,10 +63,14 @@ const ApplicationDetailCard = ({ formData, }) => { | |||||
minimumFractionDigits: 2 | minimumFractionDigits: 2 | ||||
}); | }); | ||||
} | } | ||||
React.useEffect(()=>{ | |||||
if (document.getElementById("applicationDetailsMainCard")) setBackButtonPos(`${document.getElementById("applicationDetailsMainCard")?.getBoundingClientRect().left / 2}px`) | |||||
},[document.getElementById("applicationDetailsMainCard")]) | |||||
return ( | return ( | ||||
<MainCard elevation={0} | |||||
<MainCard | |||||
id={"applicationDetailsMainCard"} | |||||
border={false} | border={false} | ||||
content={false} | content={false} | ||||
> | > | ||||
@@ -3,7 +3,8 @@ import { | |||||
Grid, | Grid, | ||||
Typography, | Typography, | ||||
Stack, | Stack, | ||||
Box | |||||
Box, | |||||
Button | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import * as UrlUtils from "utils/ApiPathConst"; | import * as UrlUtils from "utils/ApiPathConst"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
@@ -11,6 +12,7 @@ import * as HttpUtils from "utils/HttpUtils"; | |||||
import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
import { useParams } from "react-router-dom"; | import { useParams } from "react-router-dom"; | ||||
import { useNavigate } from "react-router-dom"; | import { useNavigate } from "react-router-dom"; | ||||
import KeyboardBackspaceOutlinedIcon from '@mui/icons-material/KeyboardBackspaceOutlined'; | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | ||||
@@ -36,11 +38,11 @@ const Index = () => { | |||||
const [record, setRecord] = React.useState(); | const [record, setRecord] = React.useState(); | ||||
const [onReady, setOnReady] = React.useState(false); | const [onReady, setOnReady] = React.useState(false); | ||||
React.useEffect(() => { | |||||
React.useLayoutEffect(() => { | |||||
loadForm(); | loadForm(); | ||||
}, []); | }, []); | ||||
React.useEffect(() => { | |||||
React.useLayoutEffect(() => { | |||||
setOnReady(true); | setOnReady(true); | ||||
}, [record]); | }, [record]); | ||||
@@ -80,6 +82,26 @@ const Index = () => { | |||||
return Array(+(zero > 0 && zero)).join("0") + num; | return Array(+(zero > 0 && zero)).join("0") + num; | ||||
} | } | ||||
// calculate back button position | |||||
// const applicationDetailsRef = React.useCallback(node => { | |||||
// if (node === null) { | |||||
// return | |||||
// } else { | |||||
// setBackButtonLeftPos(`${node.getBoundingClientRect()?.left}px`) | |||||
// } | |||||
// }) | |||||
const [backButtonPos, setBackButtonPos] = React.useState() | |||||
const backButtonRef = React.useRef() | |||||
React.useLayoutEffect(()=>{ | |||||
// console.log(applicationDetailsRef.current?.getBoundingClientRect()) | |||||
if (backButtonRef.current) backButtonRef.current.style.marginLeft = `${backButtonPos}` | |||||
},[backButtonPos]) | |||||
// React.useEffect(()=>{ | |||||
// if (backButtonRef.current) backButtonRef.current.style.marginLeft = `${backButtonLeftPos}` | |||||
// }, [backButtonLeftPos]) | |||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
@@ -94,13 +116,20 @@ const Index = () => { | |||||
</Stack> | </Stack> | ||||
</div> | </div> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} width="100%"> | |||||
<Button ref={backButtonRef} sx={{ml: backButtonPos, mt:2}} style={{ border: '2px solid' }} variant="outlined" onClick={()=>{navigate("/proof/search")}}> | |||||
<KeyboardBackspaceOutlinedIcon/> | |||||
<Typography variant="h4">Back</Typography> | |||||
</Button> | |||||
</Grid> | |||||
{/*row 1*/} | {/*row 1*/} | ||||
<Grid item xs={12} md={12} > | <Grid item xs={12} md={12} > | ||||
<Grid container justifyContent="flex-start" alignItems="center" > | <Grid container justifyContent="flex-start" alignItems="center" > | ||||
<center> | <center> | ||||
<Grid item xs={12} md={12} sx={{ pt: 2 }}> | <Grid item xs={12} md={12} sx={{ pt: 2 }}> | ||||
<Box xs={12} md={12} sx={{ p: 4, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<Box xs={12} md={12} sx={{ p: 4, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<ApplicationDetails | <ApplicationDetails | ||||
setBackButtonPos={setBackButtonPos} | |||||
formData={record} | formData={record} | ||||
style={{ | style={{ | ||||
display: "flex", | display: "flex", | ||||
@@ -8,7 +8,8 @@ import { | |||||
Grid, | Grid, | ||||
Typography, | Typography, | ||||
Stack, | Stack, | ||||
Box | |||||
Box, | |||||
Button | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
@@ -36,13 +37,14 @@ import { | |||||
const StatusChangeDialog = Loadable(lazy(() => import('./StatusChangeDialog'))); | const StatusChangeDialog = Loadable(lazy(() => import('./StatusChangeDialog'))); | ||||
import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
import { notifyActionSuccess, notifySaveSuccess } from "utils/CommonFunction"; | import { notifyActionSuccess, notifySaveSuccess } from "utils/CommonFunction"; | ||||
import KeyboardBackspaceOutlinedIcon from '@mui/icons-material/KeyboardBackspaceOutlined'; | |||||
import { useNavigate } from "react-router-dom"; | |||||
// ==============================|| Body - DEFAULT ||============================== // | // ==============================|| Body - DEFAULT ||============================== // | ||||
const PublicNoticeDetail_GLD = () => { | const PublicNoticeDetail_GLD = () => { | ||||
const params = useParams(); | const params = useParams(); | ||||
// const navigate = useNavigate() | |||||
const navigate = useNavigate() | |||||
const [applicationDetailData, setApplicationDetailData] = useState({}); | const [applicationDetailData, setApplicationDetailData] = useState({}); | ||||
const [proofList, setProofList] = useState([]); | const [proofList, setProofList] = useState([]); | ||||
// const [refApplicationDetailData, setRefApplicationDetailData] = React.useState({}); | // const [refApplicationDetailData, setRefApplicationDetailData] = React.useState({}); | ||||
@@ -319,6 +321,12 @@ const PublicNoticeDetail_GLD = () => { | |||||
</Stack> | </Stack> | ||||
</div> | </div> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12}> | |||||
<Button sx={{ml:3.5, mt:2}} style={{ border: '2px solid' }} variant="outlined" onClick={()=>{navigate("/application/search")}}> | |||||
<KeyboardBackspaceOutlinedIcon/> | |||||
<Typography variant="h4">Back</Typography> | |||||
</Button> | |||||
</Grid> | |||||
<Grid item xs={12} > | <Grid item xs={12} > | ||||
<Stack direction="row" height='20px' justifyContent="flex-start" alignItems="center"> | <Stack direction="row" height='20px' justifyContent="flex-start" alignItems="center"> | ||||
<Typography ml={4} mt={3} variant="h4">{title}</Typography> | <Typography ml={4} mt={3} variant="h4">{title}</Typography> | ||||
@@ -19,7 +19,24 @@ export default function UserAuthTable({setSelectedRow, userAuth,isNewRecord}) { | |||||
const [authData, setAuthData] = useState([]); | const [authData, setAuthData] = useState([]); | ||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [currentSelectedRow, setCurrentSelectedRow] = useState(userAuth); | const [currentSelectedRow, setCurrentSelectedRow] = useState(userAuth); | ||||
const _sx = { | |||||
ml: 3, | |||||
mb: 3, | |||||
mr: 3, | |||||
padding: "4 2 4 2", | |||||
boxShadow: 1, | |||||
border: 1, | |||||
borderColor: '#DDD', | |||||
'& .MuiDataGrid-cell': { | |||||
borderTop: 1, | |||||
borderBottom: 1, | |||||
borderColor: "#EEE" | |||||
}, | |||||
'& .MuiDataGrid-footerContainer': { | |||||
border: 1, | |||||
borderColor: "#EEE" | |||||
} | |||||
} | |||||
useEffect(() => { | useEffect(() => { | ||||
axios.get(`${apiPath}${GET_AUTH_LIST}`) | axios.get(`${apiPath}${GET_AUTH_LIST}`) | ||||
.then((response) => { | .then((response) => { | ||||
@@ -78,6 +95,7 @@ export default function UserAuthTable({setSelectedRow, userAuth,isNewRecord}) { | |||||
setCurrentSelectedRow(ids); | setCurrentSelectedRow(ids); | ||||
}} | }} | ||||
autoHeight | autoHeight | ||||
sx={_sx} | |||||
/> | /> | ||||
</div> | </div> | ||||
); | ); | ||||
@@ -4,7 +4,7 @@ import { | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../../components/MainCard"; | import MainCard from "../../../components/MainCard"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import {useEffect, useState} from "react"; | |||||
import { useEffect, useState } from "react"; | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
@@ -16,7 +16,7 @@ const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingCo | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserAuthorityCard = ({isCollectData, updateUserAuthList,userData,isNewRecord}) => { | |||||
const UserAuthorityCard = ({ isCollectData, updateUserAuthList, userData, isNewRecord }) => { | |||||
const [currentAuthData, setCurrentAuthData] = React.useState({}); | const [currentAuthData, setCurrentAuthData] = React.useState({}); | ||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [selectedRow, setSelectedRow] = useState([]); | const [selectedRow, setSelectedRow] = useState([]); | ||||
@@ -44,13 +44,13 @@ const UserAuthorityCard = ({isCollectData, updateUserAuthList,userData,isNewReco | |||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<MainCard elevation={0} | <MainCard elevation={0} | ||||
border={false} | |||||
content={false} | |||||
border={false} | |||||
content={false} | |||||
> | > | ||||
<Typography variant="h5" sx={{mt: 3, ml: 3}}> | |||||
<Typography variant="h5" sx={{ mt: 3, ml: 3, mb: 2, mr: 3, borderBottom: "1px solid black" }}> | |||||
User Authority | User Authority | ||||
</Typography> | </Typography> | ||||
@@ -59,6 +59,7 @@ const UserAuthorityCard = ({isCollectData, updateUserAuthList,userData,isNewReco | |||||
setSelectedRow={setSelectedRow} | setSelectedRow={setSelectedRow} | ||||
isNewRecord={isNewRecord} | isNewRecord={isNewRecord} | ||||
/> | /> | ||||
<br/> | |||||
</MainCard> | </MainCard> | ||||
); | ); | ||||
}; | }; | ||||
@@ -49,7 +49,7 @@ const UserGroupCard = ({isCollectData, updateUserGroupList,userData,isNewRecord} | |||||
border={false} | border={false} | ||||
content={false} | content={false} | ||||
> | > | ||||
<Typography variant="h5" sx={{mt: 3, ml: 3}}> | |||||
<Typography variant="h5" sx={{mt: 3, ml: 3, mb: 2, mr: 3, borderBottom: "1px solid black"}}> | |||||
Group(s) | Group(s) | ||||
</Typography> | </Typography> | ||||
<UserGroupTable | <UserGroupTable | ||||
@@ -57,6 +57,7 @@ const UserGroupCard = ({isCollectData, updateUserGroupList,userData,isNewRecord} | |||||
setSelectedRow={setSelectedRow} | setSelectedRow={setSelectedRow} | ||||
isNewRecord={isNewRecord} | isNewRecord={isNewRecord} | ||||
/> | /> | ||||
<br/> | |||||
</MainCard> | </MainCard> | ||||
); | ); | ||||
}; | }; | ||||
@@ -17,6 +17,25 @@ export default function UserGroupTable({setSelectedRow, userGroup,isNewRecord}) | |||||
const [groupData, setGroupData] = useState([]); | const [groupData, setGroupData] = useState([]); | ||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [currentSelectedRow, setCurrentSelectedRow] = useState(userGroup); | const [currentSelectedRow, setCurrentSelectedRow] = useState(userGroup); | ||||
const _sx = { | |||||
ml: 3, | |||||
mb: 3, | |||||
mr: 3, | |||||
padding: "4 2 4 2", | |||||
boxShadow: 1, | |||||
border: 1, | |||||
borderColor: '#DDD', | |||||
'& .MuiDataGrid-cell': { | |||||
borderTop: 1, | |||||
borderBottom: 1, | |||||
borderColor: "#EEE" | |||||
}, | |||||
'& .MuiDataGrid-footerContainer': { | |||||
border: 1, | |||||
borderColor: "#EEE" | |||||
} | |||||
} | |||||
useEffect(() => { | useEffect(() => { | ||||
axios.get(`${apiPath}${GET_GROUP_COMBO_PATH}`) | axios.get(`${apiPath}${GET_GROUP_COMBO_PATH}`) | ||||
@@ -71,6 +90,7 @@ export default function UserGroupTable({setSelectedRow, userGroup,isNewRecord}) | |||||
setCurrentSelectedRow(ids); | setCurrentSelectedRow(ids); | ||||
}} | }} | ||||
autoHeight | autoHeight | ||||
sx={_sx} | |||||
/> | /> | ||||
</div> | </div> | ||||
); | ); | ||||
@@ -68,17 +68,16 @@ const UserInformationCard = ({isCollectData, updateUserObject,userData,isNewReco | |||||
border={false} | border={false} | ||||
content={false} | content={false} | ||||
> | > | ||||
<Typography variant="h5" sx={{mt: 3, ml: 3, mb: 1}}> | |||||
<Typography variant="h5" sx={{mt: 3, ml: 3, mr: 3, borderBottom: "1px solid black"}}> | |||||
Information | Information | ||||
</Typography> | </Typography> | ||||
<form> | <form> | ||||
<Grid container> | <Grid container> | ||||
<Grid item xs={12} s={12} md={12} lg={12} sx={{ml: 3, mr: 3, mb: 3}}> | |||||
<Grid item xs={12} s={12} md={12} lg={12} sx={{ml: 3, mr: 3, mb: 3, mt:3}}> | |||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
<Grid item xs={4} s={4} md={4} lg={4} | <Grid item xs={4} s={4} md={4} lg={4} | ||||
sx={{ml: 3, mr: 3, display: 'flex', alignItems: 'center'}}> | |||||
sx={{ml: 3, mr: 3, display: 'flex', alignItems: 'center'}}> | |||||
<FormLabel required>Username:</FormLabel> | <FormLabel required>Username:</FormLabel> | ||||
</Grid> | </Grid> | ||||
@@ -1,15 +1,16 @@ | |||||
// material-ui | // material-ui | ||||
import { | import { | ||||
Button, | Button, | ||||
Grid, | |||||
Grid, | |||||
Typography, | Typography, | ||||
Stack | |||||
Stack, | |||||
Box, | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import {useEffect, useState} from "react"; | |||||
import { useEffect, useState } from "react"; | |||||
import * as React from "react"; | import * as React from "react"; | ||||
import axios from "axios"; | import axios from "axios"; | ||||
import {useNavigate,useParams} from "react-router-dom"; | |||||
import {GLD_USER_PATH,DELETE_USER,POST_ADMIN_USER_REGISTER} from "../../../utils/ApiPathConst"; | |||||
import { useNavigate, useParams } from "react-router-dom"; | |||||
import { GLD_USER_PATH, DELETE_USER, POST_ADMIN_USER_REGISTER } from "../../../utils/ApiPathConst"; | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
@@ -23,7 +24,18 @@ import { | |||||
notifyDeleteSuccess, | notifyDeleteSuccess, | ||||
notifySaveSuccess, | notifySaveSuccess, | ||||
} from "../../../utils/CommonFunction"; | } from "../../../utils/CommonFunction"; | ||||
import KeyboardBackspaceOutlinedIcon from '@mui/icons-material/KeyboardBackspaceOutlined'; | |||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize: 'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
} | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
@@ -34,8 +46,8 @@ const UserMaintainPage = () => { | |||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [isCollectData, setIsCollectData] = useState(false); | const [isCollectData, setIsCollectData] = useState(false); | ||||
const [editedCustomerData, setEditedCustomerData] = useState({}); | const [editedCustomerData, setEditedCustomerData] = useState({}); | ||||
const [userGroupData,setUserGroupData] = useState([]); | |||||
const [userAuthData,setUserAuthData] = useState([]); | |||||
const [userGroupData, setUserGroupData] = useState([]); | |||||
const [userAuthData, setUserAuthData] = useState([]); | |||||
const [userConfirm, setUserConfirm] = useState(false); | const [userConfirm, setUserConfirm] = useState(false); | ||||
const [isNewRecord, setIsNewRecord] = useState(false); | const [isNewRecord, setIsNewRecord] = useState(false); | ||||
const [refUserData, setRefUserData] = React.useState({}); | const [refUserData, setRefUserData] = React.useState({}); | ||||
@@ -45,11 +57,11 @@ const UserMaintainPage = () => { | |||||
setEditedCustomerData(userData); | setEditedCustomerData(userData); | ||||
} | } | ||||
function updateUserGroupList(userGroupData){ | |||||
function updateUserGroupList(userGroupData) { | |||||
setUserGroupData(userGroupData); | setUserGroupData(userGroupData); | ||||
} | } | ||||
function updateUserAuthList(userAuthData){ | |||||
function updateUserAuthList(userAuthData) { | |||||
setUserAuthData(userAuthData); | setUserAuthData(userAuthData); | ||||
} | } | ||||
@@ -68,7 +80,7 @@ const UserMaintainPage = () => { | |||||
setIsWindowOpen(true); | setIsWindowOpen(true); | ||||
}; | }; | ||||
function deleteData(){ | |||||
function deleteData() { | |||||
axios.delete(`${DELETE_USER}/${params.id}`, | axios.delete(`${DELETE_USER}/${params.id}`, | ||||
) | ) | ||||
.then((response) => { | .then((response) => { | ||||
@@ -83,10 +95,10 @@ const UserMaintainPage = () => { | |||||
return false; | return false; | ||||
}); | }); | ||||
} | } | ||||
// ==============================|| DELETE WINDOW RELATED ||============================== // | |||||
// ==============================|| DELETE WINDOW RELATED ||============================== // | |||||
useEffect(() => { | useEffect(() => { | ||||
if(params.id > 0 ){ | |||||
if (params.id > 0) { | |||||
axios.get(`${GLD_USER_PATH}/${params.id}`) | axios.get(`${GLD_USER_PATH}/${params.id}`) | ||||
.then((response) => { | .then((response) => { | ||||
if (response.status === 200) { | if (response.status === 200) { | ||||
@@ -99,7 +111,7 @@ const UserMaintainPage = () => { | |||||
return false; | return false; | ||||
}); | }); | ||||
} | } | ||||
else{ | |||||
else { | |||||
setUserData( | setUserData( | ||||
{ | { | ||||
"authIds": [], | "authIds": [], | ||||
@@ -123,18 +135,18 @@ const UserMaintainPage = () => { | |||||
if (Object.keys(userData).length > 0 && userData !== undefined) { | if (Object.keys(userData).length > 0 && userData !== undefined) { | ||||
setOnReady(true); | setOnReady(true); | ||||
} | } | ||||
else if(isNewRecord){ | |||||
else if (isNewRecord) { | |||||
setOnReady(true); | setOnReady(true); | ||||
} | } | ||||
}, [userData]); | }, [userData]); | ||||
useEffect(() => { | useEffect(() => { | ||||
if(userConfirm && onReady){ | |||||
const deletedUserAuth = getDeletedRecordWithRefList(refUserData.authIds,userAuthData); | |||||
const deletedUserGroup = getDeletedRecordWithRefList(refUserData.groupIds,userGroupData); | |||||
if (userConfirm && onReady) { | |||||
const deletedUserAuth = getDeletedRecordWithRefList(refUserData.authIds, userAuthData); | |||||
const deletedUserGroup = getDeletedRecordWithRefList(refUserData.groupIds, userGroupData); | |||||
// console.log(userGroupData) | // console.log(userGroupData) | ||||
// console.log(userAuthData) | // console.log(userAuthData) | ||||
if( parseInt(params.id) >= -1){ | |||||
if (parseInt(params.id) >= -1) { | |||||
axios.post(`${GLD_USER_PATH}/${params.id}`, | axios.post(`${GLD_USER_PATH}/${params.id}`, | ||||
{ | { | ||||
"enName": editedCustomerData.enName, | "enName": editedCustomerData.enName, | ||||
@@ -157,8 +169,8 @@ const UserMaintainPage = () => { | |||||
.catch(error => { | .catch(error => { | ||||
console.log(error); | console.log(error); | ||||
return false; | return false; | ||||
}); | |||||
}else{ | |||||
}); | |||||
} else { | |||||
axios.post(POST_ADMIN_USER_REGISTER, | axios.post(POST_ADMIN_USER_REGISTER, | ||||
{ | { | ||||
"username": editedCustomerData.username, | "username": editedCustomerData.username, | ||||
@@ -182,58 +194,72 @@ const UserMaintainPage = () => { | |||||
.catch(error => { | .catch(error => { | ||||
console.log(error); | console.log(error); | ||||
return false; | return false; | ||||
}); | |||||
}); | |||||
} | } | ||||
} | } | ||||
setUserConfirm(false); | setUserConfirm(false); | ||||
}, [editedCustomerData,userGroupData,userAuthData]); | |||||
}, [editedCustomerData, userGroupData, userAuthData]); | |||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<Grid container sx={{minHeight: '90vh'}}> | |||||
<Grid item xs={12} height='60px'> | |||||
<Stack direction="row" height='100%' justifyContent="flex-start" alignItems="center"> | |||||
<Typography variant="h5">Maintain User</Typography> | |||||
</Stack> | |||||
<Grid container sx={{ minHeight: '90vh' }}> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4">{isNewRecord ? "Create GLD User" : "Maintain GLD User"}</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | |||||
<Grid item xs={12}> | |||||
<Button sx={{ ml: 3.5, mt: 2 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate("/userSearchview") }}> | |||||
<KeyboardBackspaceOutlinedIcon /> | |||||
<Typography variant="h4">Back</Typography> | |||||
</Button> | |||||
</Grid> | </Grid> | ||||
{/*col 1*/} | {/*col 1*/} | ||||
<Grid item xs={12} md={5} lg={5}> | <Grid item xs={12} md={5} lg={5}> | ||||
<Grid container> | <Grid container> | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<UserInformationCard | |||||
updateUserObject={updateUserObject} | |||||
userData={userData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
<Box xs={12} ml={4} mt={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<UserInformationCard | |||||
updateUserObject={updateUserObject} | |||||
userData={userData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
</Box> | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} sx={{mt: 3}}> | |||||
<UserGroupCard | |||||
updateUserGroupList={updateUserGroupList} | |||||
userData={userData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
<Grid item xs={12} md={12} lg={12} sx={{ mt: 3 }}> | |||||
<Box xs={12} ml={4} mt={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<UserGroupCard | |||||
updateUserGroupList={updateUserGroupList} | |||||
userData={userData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
</Box> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
{/*col 2*/} | {/*col 2*/} | ||||
<Grid item xs={12} md={7} lg={7}> | <Grid item xs={12} md={7} lg={7}> | ||||
<UserAuthorityCard | |||||
updateUserAuthList={updateUserAuthList} | |||||
userData={userData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
<Box xs={12} ml={4} mt={3} mr={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<UserAuthorityCard | |||||
updateUserAuthList={updateUserAuthList} | |||||
userData={userData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
</Box> | |||||
</Grid> | </Grid> | ||||
{/*bottom button*/} | {/*bottom button*/} | ||||
<Grid item s={12} md={12} lg={12} sx={{mb: 3}} alignItems={"end"} justifyContent="center"> | |||||
<Grid item s={12} md={12} lg={12} sx={{ mb: 3 }} alignItems={"end"} justifyContent="center"> | |||||
<Grid container maxWidth justifyContent="flex-end"> | <Grid container maxWidth justifyContent="flex-end"> | ||||
<Grid item sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item sx={{ ml: 3, mr: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -255,7 +281,7 @@ const UserMaintainPage = () => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item sx={{ml: 3, mr: 3}}> | |||||
<Grid item sx={{ ml: 3, mr: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -1,6 +1,6 @@ | |||||
// material-ui | // material-ui | ||||
import { | import { | ||||
Grid, Button | |||||
Grid, Button, Typography | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../../components/MainCard"; | import MainCard from "../../../components/MainCard"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
@@ -142,8 +142,7 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||||
{!onReady ? | {!onReady ? | ||||
<LoadingComponent /> | <LoadingComponent /> | ||||
: | : | ||||
<form onSubmit={formik.handleSubmit} style={{ padding: 24 }}> | |||||
<form onSubmit={formik.handleSubmit} style={{ padding: 12 }}> | |||||
{/*top button*/} | {/*top button*/} | ||||
<Grid item s={12} md={12} lg={12} sx={{ mb: 3 }} alignItems={"start"} justifyContent="center"> | <Grid item s={12} md={12} lg={12} sx={{ mb: 3 }} alignItems={"start"} justifyContent="center"> | ||||
<Grid container maxWidth justifyContent="flex-start"> | <Grid container maxWidth justifyContent="flex-start"> | ||||
@@ -200,9 +199,10 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
{/*end top button*/} | {/*end top button*/} | ||||
<Grid container spacing={1}> | |||||
<Typography variant="h5" sx={{ mt: 3, ml: 3, mb: 2, mr: 3, borderBottom: "1px solid black" }}> | |||||
Individual User Details | |||||
</Typography> | |||||
<Grid container spacing={1} sx={{ mt: 3, ml: 3, mb: 2, mr: 3}}> | |||||
<Grid item lg={4}> | <Grid item lg={4}> | ||||
{FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
label: "Username:", | label: "Username:", | ||||
@@ -1,15 +1,27 @@ | |||||
// material-ui | // material-ui | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import {Grid, Typography} from '@mui/material'; | |||||
import { Grid, Typography, Button, Stack, Box } from '@mui/material'; | |||||
import FileList from "../../../components/FileList" | import FileList from "../../../components/FileList" | ||||
import MainCard from "../../../components/MainCard"; | import MainCard from "../../../components/MainCard"; | ||||
import * as HttpUtils from "../../../utils/HttpUtils"; | import * as HttpUtils from "../../../utils/HttpUtils"; | ||||
import {useParams} from "react-router-dom"; | |||||
import { useParams } from "react-router-dom"; | |||||
import * as UrlUtils from "../../../utils/ApiPathConst"; | import * as UrlUtils from "../../../utils/ApiPathConst"; | ||||
import * as DateUtils from '../../../utils/DateUtils'; | import * as DateUtils from '../../../utils/DateUtils'; | ||||
import KeyboardBackspaceOutlinedIcon from '@mui/icons-material/KeyboardBackspaceOutlined'; | |||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize: 'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
} | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
import { useNavigate } from "react-router-dom"; | |||||
const LoadingComponent = Loadable(React.lazy(() => import('../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(React.lazy(() => import('../../extra-pages/LoadingComponent'))); | ||||
const UserInformationCard = Loadable(React.lazy(() => import('./UserInformationCard_Individual'))); | const UserInformationCard = Loadable(React.lazy(() => import('./UserInformationCard_Individual'))); | ||||
@@ -19,42 +31,61 @@ const UserInformationCard = Loadable(React.lazy(() => import('./UserInformationC | |||||
const UserMaintainPage_Individual = () => { | const UserMaintainPage_Individual = () => { | ||||
const params = useParams(); | const params = useParams(); | ||||
const [formData, setFormData] = React.useState({}) | |||||
const navigate = useNavigate(); | |||||
const [formData, setFormData] = React.useState({}) | |||||
const [isLoading, setLoding] = React.useState(true); | const [isLoading, setLoding] = React.useState(true); | ||||
const _sx = { | |||||
ml: 3, | |||||
mb: 3, | |||||
mr: 3, | |||||
padding: "4 2 4 2", | |||||
boxShadow: 1, | |||||
border: 1, | |||||
borderColor: '#DDD', | |||||
'& .MuiDataGrid-cell': { | |||||
borderTop: 1, | |||||
borderBottom: 1, | |||||
borderColor: "#EEE" | |||||
}, | |||||
'& .MuiDataGrid-footerContainer': { | |||||
border: 1, | |||||
borderColor: "#EEE" | |||||
} | |||||
} | |||||
React.useEffect(()=>{ | |||||
React.useEffect(() => { | |||||
loadData(); | loadData(); | ||||
},[]); | |||||
}, []); | |||||
const loadData = ()=>{ | |||||
const loadData = () => { | |||||
setLoding(true); | setLoding(true); | ||||
HttpUtils.get({ | HttpUtils.get({ | ||||
url: `${UrlUtils.GET_IND_USER_PATH}/${params.id}`, | url: `${UrlUtils.GET_IND_USER_PATH}/${params.id}`, | ||||
onSuccess: function(response){ | |||||
onSuccess: function (response) { | |||||
response.data["address"] = JSON.parse(response.data["address"]); | response.data["address"] = JSON.parse(response.data["address"]); | ||||
response.data["mobileNumber"] = JSON.parse(response.data["mobileNumber"]); | response.data["mobileNumber"] = JSON.parse(response.data["mobileNumber"]); | ||||
response.data["faxNo"] = JSON.parse(response.data["faxNo"]); | response.data["faxNo"] = JSON.parse(response.data["faxNo"]); | ||||
let createDate = DateUtils.datetimeStr(response.data.created); | let createDate = DateUtils.datetimeStr(response.data.created); | ||||
let modifiedBy = DateUtils.datetimeStr(response.data.modified)+", "+response.data.modifiedBy; | |||||
let modifiedBy = DateUtils.datetimeStr(response.data.modified) + ", " + response.data.modifiedBy; | |||||
response.data["createDate"] = createDate; | response.data["createDate"] = createDate; | ||||
response.data["modifieDate"] = modifiedBy; | response.data["modifieDate"] = modifiedBy; | ||||
response.data["verifiedStatus"] = response.data.verifiedBy? DateUtils.datetimeStr(response.data.verifiedDate)+", "+response.data.verifiedByName: "Not verified"; | |||||
response.data["verifiedStatus"] = response.data.verifiedBy ? DateUtils.datetimeStr(response.data.verifiedDate) + ", " + response.data.verifiedByName : "Not verified"; | |||||
response.data["country"] = response.data.address?.country; | response.data["country"] = response.data.address?.country; | ||||
response.data["district"] = response.data.address?.district; | response.data["district"] = response.data.address?.district; | ||||
response.data["addressLine1"] = response.data.address?.addressLine1; | response.data["addressLine1"] = response.data.address?.addressLine1; | ||||
response.data["addressLine2"] = response.data.address?.addressLine2; | response.data["addressLine2"] = response.data.address?.addressLine2; | ||||
response.data["addressLine3"] = response.data.address?.addressLine3; | response.data["addressLine3"] = response.data.address?.addressLine3; | ||||
response.data["phoneNumber"] = response.data.mobileNumber?.phoneNumber; | response.data["phoneNumber"] = response.data.mobileNumber?.phoneNumber; | ||||
response.data["tel_countryCode"] = response.data.mobileNumber?.countryCode; | response.data["tel_countryCode"] = response.data.mobileNumber?.countryCode; | ||||
response.data["faxNumber"] = response.data.faxNo?.faxNumber; | response.data["faxNumber"] = response.data.faxNo?.faxNumber; | ||||
response.data["fax_countryCode"] = response.data.faxNo?.countryCode; | response.data["fax_countryCode"] = response.data.faxNo?.countryCode; | ||||
response.data["lastLoginDate"] = response.data.lastLogin?DateUtils.datetimeStr(response.data.lastLogin):""; | |||||
response.data["lastLoginDate"] = response.data.lastLogin ? DateUtils.datetimeStr(response.data.lastLogin) : ""; | |||||
setFormData(response.data); | setFormData(response.data); | ||||
} | } | ||||
@@ -63,37 +94,52 @@ const UserMaintainPage_Individual = () => { | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
setLoding(false); | |||||
setLoding(false); | |||||
}, [formData]); | }, [formData]); | ||||
return ( | return ( | ||||
isLoading ? | isLoading ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<Grid container rowSpacing={4.5} columnSpacing={2.75}> | |||||
<Grid item xs={12} sx={{mb: -2.25}}> | |||||
<Typography variant="h5">Individual User Details</Typography> | |||||
<Grid container> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4">Maintain Individual User</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | |||||
<Grid item xs={12}> | |||||
<Button sx={{ ml: 3.5, mt: 2 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate("/indUser") }}> | |||||
<KeyboardBackspaceOutlinedIcon /> | |||||
<Typography variant="h4">Back</Typography> | |||||
</Button> | |||||
</Grid> | </Grid> | ||||
{/*col 1*/} | {/*col 1*/} | ||||
<Grid item xs={12} > | <Grid item xs={12} > | ||||
<Grid container> | <Grid container> | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<UserInformationCard | |||||
formData={formData} | |||||
loadDataFun={loadData} | |||||
/> | |||||
<Box xs={12} ml={4} mt={3} mr={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<UserInformationCard | |||||
formData={formData} | |||||
loadDataFun={loadData} | |||||
/> | |||||
</Box> | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<MainCard elevation={0} border={false} content={false}> | |||||
<Typography variant="h5" sx={{mt: 3, ml: 3, mb: 1}}> | |||||
Files | |||||
</Typography> | |||||
<FileList sx={{mt: 3, ml: 3, mb: 1}} | |||||
refId={params.id} | |||||
refType={"identification"} | |||||
/> | |||||
</MainCard> | |||||
</Grid> | |||||
<MainCard elevation={0} border={false} content={false}> | |||||
<Box xs={12} ml={4} mt={3} mr={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }} style={{ padding: 12 }}> | |||||
<Typography variant="h5" sx={{ mt: 3, ml: 3, mb: 2, mr: 3, borderBottom: "1px solid black" }}> | |||||
Files | |||||
</Typography> | |||||
<FileList sx={_sx} | |||||
refId={params.id} | |||||
refType={"identification"} | |||||
/> | |||||
</Box> | |||||
</MainCard> | |||||
<br/> | |||||
</Grid> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
{/*col 2*/} | {/*col 2*/} | ||||
@@ -165,22 +165,20 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
setIsConfirmPopUp(true); | setIsConfirmPopUp(true); | ||||
}; | }; | ||||
return ( | return ( | ||||
<MainCard elevation={0} | <MainCard elevation={0} | ||||
border={false} | border={false} | ||||
content={false} | content={false} | ||||
> | > | ||||
{!onReady? | |||||
<LoadingComponent /> | |||||
: | |||||
{!onReady ? | |||||
<LoadingComponent /> | |||||
: | |||||
<form onSubmit={formik.handleSubmit}> | <form onSubmit={formik.handleSubmit}> | ||||
{/*top button*/} | {/*top button*/} | ||||
<Grid item s={12} md={12} lg={12} sx={{ mb: 3 }} alignItems={"start"} justifyContent="center"> | |||||
<Grid item s={12} md={12} lg={12} sx={{ mb: 3, mt: 2 }} alignItems={"start"} justifyContent="center"> | |||||
<Grid container maxWidth justifyContent="flex-start"> | <Grid container maxWidth justifyContent="flex-start"> | ||||
{editMode ? | {editMode ? | ||||
<> | <> | ||||
<Grid item sx={{ ml: 3, mr: 3 }}> | <Grid item sx={{ ml: 3, mr: 3 }}> | ||||
@@ -236,6 +234,9 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
</Grid> | </Grid> | ||||
{/*end top button*/} | {/*end top button*/} | ||||
<div style={{ paddingLeft: 24, paddingRight: 24 }}> | <div style={{ paddingLeft: 24, paddingRight: 24 }}> | ||||
<Typography variant="h5" sx={{ mt: 3, mb: 2, mr: 3, borderBottom: "1px solid black" }}> | |||||
Organization User Details | |||||
</Typography> | |||||
<Grid container spacing={1}> | <Grid container spacing={1}> | ||||
<Grid item lg={4}> | <Grid item lg={4}> | ||||
{FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
@@ -312,8 +313,8 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
); | ); | ||||
return displayOptions; | return displayOptions; | ||||
}, | }, | ||||
getOptionLabel: (item) => item ? typeof item === 'number' ? item + "" : (item["brNo"] ? | |||||
<div>BR No.: {item["brNo"]}<div>Org. Name(Eng): {item["enCompanyName"] === null ? "N/A" : item["enCompanyName"]}</div><div>Org. Name(CH): {item["chCompanyName"] === null ? "N/A" : item["chCompanyName"]}</div></div>: "") | |||||
getOptionLabel: (item) => item ? typeof item === 'number' ? item + "" : (item["brNo"] ? | |||||
<div>BR No.: {item["brNo"]}<div>Org. Name(Eng): {item["enCompanyName"] === null ? "N/A" : item["enCompanyName"]}</div><div>Org. Name(CH): {item["chCompanyName"] === null ? "N/A" : item["chCompanyName"]}</div></div> : "") | |||||
: "", | : "", | ||||
isOptionEqualToValue: (option, newValue, setValue, setInputValue) => { | isOptionEqualToValue: (option, newValue, setValue, setInputValue) => { | ||||
if (option.id == newValue || option.id == newValue.id) { | if (option.id == newValue || option.id == newValue.id) { | ||||
@@ -324,7 +325,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
return option == newValue || option.id == newValue.id; | return option == newValue || option.id == newValue.id; | ||||
}, | }, | ||||
onInputChange: (event, newValue, setInputValue) => { | onInputChange: (event, newValue, setInputValue) => { | ||||
if (newValue !== "[object Object]" ) { | |||||
if (newValue !== "[object Object]") { | |||||
setInputValue(newValue); | setInputValue(newValue); | ||||
} | } | ||||
}, | }, | ||||
@@ -449,28 +450,18 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
</Button> | </Button> | ||||
</Grid> | </Grid> | ||||
} | } | ||||
</> | </> | ||||
} | } | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</div> | </div> | ||||
<br/> | |||||
<div style={{ paddingLeft: 24, paddingRight: 24 }}> | <div style={{ paddingLeft: 24, paddingRight: 24 }}> | ||||
<Grid container spacing={1} > | <Grid container spacing={1} > | ||||
<Grid item lg={12} > | |||||
<Grid item lg={12}> | |||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
<Grid item lg={1} > | |||||
<Typography variant="h5" sx={{ display: 'flex', alignItems: 'center' }}> | |||||
Organization | |||||
</Typography> | |||||
</Grid> | |||||
{currentUserData.orgId==null? | |||||
{currentUserData.orgId == null ? | |||||
<Grid item lg={2} > | <Grid item lg={2} > | ||||
<Button variant="contained" | <Button variant="contained" | ||||
onClick={createOrgClick} | onClick={createOrgClick} | ||||
@@ -478,11 +469,15 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
Create Organization | Create Organization | ||||
</Button> | </Button> | ||||
</Grid> | </Grid> | ||||
:null | |||||
: null | |||||
} | } | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
<Grid item lg={12} > | |||||
<Typography variant="h5" sx={{ mt: 3, mb: 2, mr: 3, borderBottom: "1px solid black" }}> | |||||
Organization | |||||
</Typography> | |||||
</Grid> | |||||
<Grid item lg={4}> | <Grid item lg={4}> | ||||
{FieldUtils.getTextField({ | {FieldUtils.getTextField({ | ||||
label: "Org.Name (English):", | label: "Org.Name (English):", | ||||
@@ -587,7 +582,6 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
</Dialog> | </Dialog> | ||||
</div> | </div> | ||||
</MainCard> | </MainCard> | ||||
); | ); | ||||
}; | }; | ||||
@@ -1,10 +1,10 @@ | |||||
// material-ui | // material-ui | ||||
import {Grid, Typography} from '@mui/material'; | |||||
import {useEffect, useState} from "react"; | |||||
import { Grid, Typography, Stack, Box, Button } from '@mui/material'; | |||||
import { useEffect, useState } from "react"; | |||||
import * as React from "react"; | import * as React from "react"; | ||||
//import axios from "axios"; | //import axios from "axios"; | ||||
import * as HttpUtils from "../../../utils/HttpUtils"; | import * as HttpUtils from "../../../utils/HttpUtils"; | ||||
import {useParams} from "react-router-dom"; | |||||
import { useParams } from "react-router-dom"; | |||||
import FileList from "../../../components/FileList" | import FileList from "../../../components/FileList" | ||||
import MainCard from "../../../components/MainCard"; | import MainCard from "../../../components/MainCard"; | ||||
import * as UrlUtils from "../../../utils/ApiPathConst"; | import * as UrlUtils from "../../../utils/ApiPathConst"; | ||||
@@ -14,74 +14,105 @@ import Loadable from 'components/Loadable'; | |||||
import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | ||||
const UserInformationCard = Loadable(lazy(() => import('./UserInformationCard_Organization'))); | const UserInformationCard = Loadable(lazy(() => import('./UserInformationCard_Organization'))); | ||||
import KeyboardBackspaceOutlinedIcon from '@mui/icons-material/KeyboardBackspaceOutlined'; | |||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
import { useNavigate } from 'react-router-dom'; | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize: 'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
} | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserMaintainPage_Organization = () => { | const UserMaintainPage_Organization = () => { | ||||
const params = useParams(); | const params = useParams(); | ||||
const [userData, setUserData] = useState({}) | |||||
const [orgData, setOrgData] = useState({}) | |||||
const navigate = useNavigate(); | |||||
const [userData, setUserData] = useState({}) | |||||
const [orgData, setOrgData] = useState({}) | |||||
const [isLoading, setLoding] = useState(true); | const [isLoading, setLoding] = useState(true); | ||||
const _sx = { | |||||
ml: 3, | |||||
mb: 3, | |||||
mr: 3, | |||||
padding: "4 2 4 2", | |||||
boxShadow: 1, | |||||
border: 1, | |||||
borderColor: '#DDD', | |||||
'& .MuiDataGrid-cell': { | |||||
borderTop: 1, | |||||
borderBottom: 1, | |||||
borderColor: "#EEE" | |||||
}, | |||||
'& .MuiDataGrid-footerContainer': { | |||||
border: 1, | |||||
borderColor: "#EEE" | |||||
} | |||||
} | |||||
useEffect(()=>{ | |||||
useEffect(() => { | |||||
// console.log(userData); | // console.log(userData); | ||||
loadData(); | loadData(); | ||||
},[]); | |||||
}, []); | |||||
// const reloadPage=()=>{ | // const reloadPage=()=>{ | ||||
// window.location.reload(false); | // window.location.reload(false); | ||||
// } | // } | ||||
const loadData = ()=>{ | |||||
const loadData = () => { | |||||
setLoding(true); | setLoding(true); | ||||
HttpUtils.get({ | HttpUtils.get({ | ||||
url: `${UrlUtils.GET_ORG_USER_PATH}/${params.id}`, | url: `${UrlUtils.GET_ORG_USER_PATH}/${params.id}`, | ||||
onSuccess: function(response){ | |||||
onSuccess: function (response) { | |||||
console.log(response) | console.log(response) | ||||
if(response.data.orgId !=null){ | |||||
if (response.data.orgId != null) { | |||||
response.data["addressBus"] = response.orgDetail.data["addressTemp"]; | response.data["addressBus"] = response.orgDetail.data["addressTemp"]; | ||||
response.data["contactTel"] = response.orgDetail.data["contactTel"]; | response.data["contactTel"] = response.orgDetail.data["contactTel"]; | ||||
response.data["faxNo"] = response.orgDetail.data["faxNo"]; | response.data["faxNo"] = response.orgDetail.data["faxNo"]; | ||||
response.data["brExpiryDate"] = response.orgDetail.data.brExpiryDate?DateUtils.dateStr(response.orgDetail.data.brExpiryDate):""; | |||||
response.data["brExpiryDate"] = response.orgDetail.data.brExpiryDate ? DateUtils.dateStr(response.orgDetail.data.brExpiryDate) : ""; | |||||
response.data["brNo"] = response.orgDetail.data.brNo; | response.data["brNo"] = response.orgDetail.data.brNo; | ||||
response.data["enCompanyName"] = response.orgDetail.data.enCompanyName; | response.data["enCompanyName"] = response.orgDetail.data.enCompanyName; | ||||
response.data["chCompanyName"] = response.orgDetail.data.chCompanyName; | response.data["chCompanyName"] = response.orgDetail.data.chCompanyName; | ||||
response.data["chCompanyName"] = response.orgDetail.data.chCompanyName; | response.data["chCompanyName"] = response.orgDetail.data.chCompanyName; | ||||
}else{ | |||||
} else { | |||||
response.data["addressBus"] = JSON.parse(response.data["addressBus"]); | response.data["addressBus"] = JSON.parse(response.data["addressBus"]); | ||||
response.data["contactTel"] = JSON.parse(response.data["contactTel"]); | response.data["contactTel"] = JSON.parse(response.data["contactTel"]); | ||||
response.data["faxNo"] = JSON.parse(response.data["faxNo"]); | response.data["faxNo"] = JSON.parse(response.data["faxNo"]); | ||||
response.data["brExpiryDate"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; | |||||
response.data["brExpiryDate"] = response.data.brExpiryDate ? DateUtils.dateStr(response.data.brExpiryDate) : ""; | |||||
} | } | ||||
let createDate = DateUtils.datetimeStr(response.data.created); | let createDate = DateUtils.datetimeStr(response.data.created); | ||||
let modifiedBy = DateUtils.datetimeStr(response.data.modified)+", "+response.data.modifiedBy; | |||||
let modifiedBy = DateUtils.datetimeStr(response.data.modified) + ", " + response.data.modifiedBy; | |||||
response.data["createDate"] = createDate; | response.data["createDate"] = createDate; | ||||
response.data["modifieDate"] = modifiedBy; | response.data["modifieDate"] = modifiedBy; | ||||
response.data["verifiedStatus"] = response.data.verifiedBy? DateUtils.datetimeStr(response.data.verifiedDate)+", "+response.data.verifiedByName: "Not verified"; | |||||
response.data["lastLoginDate"] = response.data.lastLogin?DateUtils.datetimeStr(response.data.lastLoginDate):""; | |||||
response.data["verifiedStatus"] = response.data.verifiedBy ? DateUtils.datetimeStr(response.data.verifiedDate) + ", " + response.data.verifiedByName : "Not verified"; | |||||
response.data["lastLoginDate"] = response.data.lastLogin ? DateUtils.datetimeStr(response.data.lastLoginDate) : ""; | |||||
response.data["country"] = response.data.addressBus?.country; | response.data["country"] = response.data.addressBus?.country; | ||||
response.data["district"] = response.data.addressBus?.district; | response.data["district"] = response.data.addressBus?.district; | ||||
response.data["addressLine1"] = response.data.addressBus?.addressLine1; | response.data["addressLine1"] = response.data.addressBus?.addressLine1; | ||||
response.data["addressLine2"] = response.data.addressBus?.addressLine2; | response.data["addressLine2"] = response.data.addressBus?.addressLine2; | ||||
response.data["addressLine3"] = response.data.addressBus?.addressLine3; | response.data["addressLine3"] = response.data.addressBus?.addressLine3; | ||||
response.data["phoneNumber"] = response.data.contactTel?.phoneNumber; | response.data["phoneNumber"] = response.data.contactTel?.phoneNumber; | ||||
response.data["tel_countryCode"] = response.data.contactTel?.countryCode; | response.data["tel_countryCode"] = response.data.contactTel?.countryCode; | ||||
response.data["faxNumber"] = response.data.faxNo?.faxNumber; | response.data["faxNumber"] = response.data.faxNo?.faxNumber; | ||||
response.data["fax_countryCode"] = response.data.faxNo?.countryCode; | response.data["fax_countryCode"] = response.data.faxNo?.countryCode; | ||||
//response.data["orgId"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; | //response.data["orgId"] = response.data.brExpiryDate?DateUtils.dateStr(response.data.brExpiryDate):""; | ||||
setUserData(response.data); | setUserData(response.data); | ||||
setOrgData(response.orgList); | setOrgData(response.orgList); | ||||
} | } | ||||
@@ -90,37 +121,53 @@ const UserMaintainPage_Organization = () => { | |||||
useEffect(() => { | useEffect(() => { | ||||
setLoding(false); | |||||
setLoding(false); | |||||
}, [userData]); | }, [userData]); | ||||
return ( | return ( | ||||
isLoading ? | isLoading ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<Grid container rowSpacing={4.5} columnSpacing={2.75}> | |||||
<Grid item xs={12} sx={{mb: -2.25}}> | |||||
<Typography variant="h5">Organization User Details</Typography> | |||||
<Grid container> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4">Maintain Organization User</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | |||||
<Grid item xs={12}> | |||||
<Button sx={{ ml: 3.5, mt: 2 }} style={{ border: '2px solid' }} variant="outlined" onClick={() => { navigate("/orgUser") }}> | |||||
<KeyboardBackspaceOutlinedIcon /> | |||||
<Typography variant="h4">Back</Typography> | |||||
</Button> | |||||
</Grid> | </Grid> | ||||
{/*col 1*/} | {/*col 1*/} | ||||
<Grid item xs={12} > | <Grid item xs={12} > | ||||
<Grid container> | <Grid container> | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<UserInformationCard | |||||
userData={userData} | |||||
loadDataFun={loadData} | |||||
orgData={orgData} | |||||
/> | |||||
<Box xs={12} ml={4} mt={3} mr={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<UserInformationCard | |||||
userData={userData} | |||||
loadDataFun={loadData} | |||||
orgData={orgData} | |||||
/> | |||||
<br/> | |||||
</Box> | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<MainCard elevation={0} border={false} content={false}> | |||||
<Typography variant="h5" sx={{mt: 3, ml: 3, mb: 1}}> | |||||
Files | |||||
</Typography> | |||||
<FileList sx={{mt: 3, ml: 3, mb: 1}} | |||||
refId={params.id} | |||||
refType={"identification"} | |||||
/> | |||||
</MainCard> | |||||
<Box xs={12} ml={4} mt={3} mr={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<MainCard elevation={0} border={false} content={false}> | |||||
<Typography variant="h5" sx={{ mt: 3, ml: 3, mb: 1 }}> | |||||
Files | |||||
</Typography> | |||||
<FileList sx={_sx} | |||||
refId={params.id} | |||||
refType={"identification"} | |||||
/> | |||||
</MainCard> | |||||
</Box> | |||||
<br/> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
@@ -6,21 +6,22 @@ import { | |||||
Typography | Typography | ||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../../components/MainCard"; | import MainCard from "../../../components/MainCard"; | ||||
import {useForm} from "react-hook-form"; | |||||
import { useForm } from "react-hook-form"; | |||||
import { | import { | ||||
// useEffect, | // useEffect, | ||||
useState} from "react"; | |||||
useState | |||||
} from "react"; | |||||
import Checkbox from "@mui/material/Checkbox"; | import Checkbox from "@mui/material/Checkbox"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; | import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'; | ||||
import {useNavigate} from "react-router"; | |||||
import { useNavigate } from "react-router"; | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserSearchForm = ({applySearch}) => { | |||||
const UserSearchForm = ({ applySearch }) => { | |||||
const navigate = useNavigate(); | const navigate = useNavigate(); | ||||
const [type, setType] = useState([]); | const [type, setType] = useState([]); | ||||
@@ -32,7 +33,7 @@ const UserSearchForm = ({applySearch}) => { | |||||
let typeArray = []; | let typeArray = []; | ||||
for(let i =0; i < type.length; i++){ | |||||
for (let i = 0; i < type.length; i++) { | |||||
typeArray.push(type[i].label); | typeArray.push(type[i].label); | ||||
} | } | ||||
@@ -48,21 +49,22 @@ const UserSearchForm = ({applySearch}) => { | |||||
}; | }; | ||||
function resetForm(){ | |||||
function resetForm() { | |||||
setType([]); | setType([]); | ||||
setLocked(false); | setLocked(false); | ||||
reset(); | reset(); | ||||
} | } | ||||
const handleNewUserClick = (id) => { | |||||
const handleNewUserClick = () => { | |||||
// console.log(id) | // console.log(id) | ||||
navigate('/user/'+ id); | |||||
navigate('/user/-1'); | |||||
// navigate('/user/' + id); | |||||
}; | }; | ||||
return ( | return ( | ||||
<MainCard xs={12} md={12} lg={12} | <MainCard xs={12} md={12} lg={12} | ||||
border={false} | |||||
content={false}> | |||||
border={false} | |||||
content={false}> | |||||
<form onSubmit={handleSubmit(onSubmit)}> | <form onSubmit={handleSubmit(onSubmit)}> | ||||
{/*row 1*/} | {/*row 1*/} | ||||
@@ -74,7 +76,7 @@ const UserSearchForm = ({applySearch}) => { | |||||
{/*row 2*/} | {/*row 2*/} | ||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<TextField | <TextField | ||||
fullWidth | fullWidth | ||||
{...register("userName")} | {...register("userName")} | ||||
@@ -83,7 +85,7 @@ const UserSearchForm = ({applySearch}) => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<TextField | <TextField | ||||
fullWidth | fullWidth | ||||
{...register("fullenName")} | {...register("fullenName")} | ||||
@@ -92,7 +94,7 @@ const UserSearchForm = ({applySearch}) => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<TextField | <TextField | ||||
fullWidth | fullWidth | ||||
{...register("post")} | {...register("post")} | ||||
@@ -101,7 +103,7 @@ const UserSearchForm = ({applySearch}) => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<TextField | <TextField | ||||
fullWidth | fullWidth | ||||
{...register("email")} | {...register("email")} | ||||
@@ -110,7 +112,7 @@ const UserSearchForm = ({applySearch}) => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<TextField | <TextField | ||||
fullWidth | fullWidth | ||||
{...register("phone")} | {...register("phone")} | ||||
@@ -119,7 +121,7 @@ const UserSearchForm = ({applySearch}) => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<FormControlLabel | <FormControlLabel | ||||
control={ | control={ | ||||
<Checkbox | <Checkbox | ||||
@@ -139,8 +141,7 @@ const UserSearchForm = ({applySearch}) => { | |||||
<Grid container direction="row" | <Grid container direction="row" | ||||
justifyContent="space-between" | justifyContent="space-between" | ||||
alignItems="center"> | alignItems="center"> | ||||
<Grid item xs={3} md={3} sx={{ml:1, mr:1, mb:3, mt:3}}> | |||||
<Grid item xs={3} md={3} sx={{ ml: 3, mr: 1, mb: 3, mt: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -149,13 +150,13 @@ const UserSearchForm = ({applySearch}) => { | |||||
textTransform: 'capitalize', | textTransform: 'capitalize', | ||||
alignItems: 'end' | alignItems: 'end' | ||||
}}> | }}> | ||||
<AddCircleOutlineIcon/> | |||||
<AddCircleOutlineIcon /> | |||||
New User | New User | ||||
</Button> | </Button> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={8} md={8} sx={{ml:3, mr:3, mb:3, mt:3}}> | |||||
<Grid container > | |||||
<Grid item sx={{ml:3, mr:3, mb:3, mt:3}}> | |||||
<Grid item xs={8} md={8} sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}> | |||||
<Grid container maxWidth justifyContent="flex-end"> | |||||
<Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -168,7 +169,7 @@ const UserSearchForm = ({applySearch}) => { | |||||
</Button> | </Button> | ||||
</Grid> | </Grid> | ||||
<Grid item sx={{ml:3, mr:3, mb:3, mt:3}}> | |||||
<Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -16,7 +16,17 @@ import { lazy } from 'react'; | |||||
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | ||||
const SearchForm = Loadable(lazy(() => import('./UserSearchForm'))); | const SearchForm = Loadable(lazy(() => import('./UserSearchForm'))); | ||||
const EventTable = Loadable(lazy(() => import('./UserTable'))); | const EventTable = Loadable(lazy(() => import('./UserTable'))); | ||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize:'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
} | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserSettingPage = () => { | const UserSettingPage = () => { | ||||
@@ -25,15 +35,17 @@ const UserSettingPage = () => { | |||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [changelocked, setChangeLocked] = React.useState(false); | const [changelocked, setChangeLocked] = React.useState(false); | ||||
useEffect(() => { | |||||
React.useLayoutEffect(() => { | |||||
getUserList(); | getUserList(); | ||||
}, [changelocked]); | }, [changelocked]); | ||||
useEffect(() => { | useEffect(() => { | ||||
setOnReady(true); | |||||
if (record.length > 0) { | |||||
setOnReady(true); | |||||
} | |||||
}, [record]); | }, [record]); | ||||
useEffect(() => { | |||||
React.useLayoutEffect(() => { | |||||
getUserList(); | getUserList(); | ||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
@@ -60,16 +72,14 @@ const UserSettingPage = () => { | |||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | <LoadingComponent/> | ||||
: | : | ||||
<Grid container sx={{minHeight: '90vh'}}> | |||||
<Grid item xs={12} md={12} lg={12}> | |||||
<Grid direction="row" container justifyContent="flex-start" alignItems="center" ml={2}> | |||||
<Grid item xs={2} height='50px'> | |||||
<Stack direction="row" height='100%' justifyContent="space-between" alignItems="center"> | |||||
<Typography align="center" variant="h5">View User</Typography> | |||||
</Stack> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
<Grid container sx={{minHeight: '90vh'}} direction="column"> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4">View GLD User</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | |||||
{/*row 1*/} | {/*row 1*/} | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
@@ -1,6 +1,6 @@ | |||||
// material-ui | // material-ui | ||||
import { | import { | ||||
Grid, Typography | |||||
Grid, Typography, Stack | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../../components/MainCard"; | import MainCard from "../../../components/MainCard"; | ||||
import {useEffect, useState} from "react"; | import {useEffect, useState} from "react"; | ||||
@@ -18,7 +18,17 @@ import { lazy } from 'react'; | |||||
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | ||||
const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Individual'))); | const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Individual'))); | ||||
const EventTable = Loadable(lazy(() => import('./UserTable_Individual'))); | const EventTable = Loadable(lazy(() => import('./UserTable_Individual'))); | ||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize:'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
} | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserSearchPage_Individual = () => { | const UserSearchPage_Individual = () => { | ||||
@@ -57,10 +67,14 @@ const UserSearchPage_Individual = () => { | |||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | <LoadingComponent/> | ||||
: | : | ||||
<Grid container rowSpacing={4.5} columnSpacing={2.75}> | |||||
<Grid item xs={12} sx={{mb: -2.25}}> | |||||
<Typography variant="h5">View Individual User</Typography> | |||||
</Grid> | |||||
<Grid container> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4">View Individual User</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | |||||
{/*row 1*/} | {/*row 1*/} | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
@@ -1,9 +1,9 @@ | |||||
// material-ui | // material-ui | ||||
import { | import { | ||||
Grid, Typography | |||||
Grid, Typography, Stack | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../../components/MainCard"; | import MainCard from "../../../components/MainCard"; | ||||
import {useEffect, useState} from "react"; | |||||
import { useEffect, useState } from "react"; | |||||
//import axios from "axios"; | //import axios from "axios"; | ||||
//import {apiPath} from "../../auth/utils"; | //import {apiPath} from "../../auth/utils"; | ||||
import * as UrlUtils from "../../../utils/ApiPathConst"; | import * as UrlUtils from "../../../utils/ApiPathConst"; | ||||
@@ -18,13 +18,23 @@ import { lazy } from 'react'; | |||||
const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | ||||
const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Organization'))); | const SearchForm = Loadable(lazy(() => import('./UserSearchForm_Organization'))); | ||||
const EventTable = Loadable(lazy(() => import('./UserTable_Organization'))); | const EventTable = Loadable(lazy(() => import('./UserTable_Organization'))); | ||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize: 'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
} | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserSearchPage_Organization = () => { | const UserSearchPage_Organization = () => { | ||||
const [record,setRecord] = useState([]); | |||||
const [record, setRecord] = useState([]); | |||||
const [searchCriteria, setSearchCriteria] = useState({}); | const [searchCriteria, setSearchCriteria] = useState({}); | ||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
@@ -40,11 +50,11 @@ const UserSearchPage_Organization = () => { | |||||
getUserList(); | getUserList(); | ||||
}, [searchCriteria]); | }, [searchCriteria]); | ||||
function getUserList(){ | |||||
function getUserList() { | |||||
HttpUtils.get({ | HttpUtils.get({ | ||||
url: UrlUtils.GET_ORG_USER_PATH, | url: UrlUtils.GET_ORG_USER_PATH, | ||||
params: searchCriteria, | params: searchCriteria, | ||||
onSuccess: function(responseData){ | |||||
onSuccess: function (responseData) { | |||||
setRecord(responseData); | setRecord(responseData); | ||||
} | } | ||||
}); | }); | ||||
@@ -56,31 +66,34 @@ const UserSearchPage_Organization = () => { | |||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<Grid container rowSpacing={4.5} columnSpacing={2.75}> | |||||
<Grid item xs={12} sx={{mb: -2.25}}> | |||||
<Typography variant="h5">View Organization User</Typography> | |||||
</Grid> | |||||
<Grid container> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4">View Organization User</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | |||||
{/*row 1*/} | |||||
<Grid item xs={12} md={12} lg={12}> | |||||
<SearchForm applySearch={applySearch} /> | |||||
</Grid> | |||||
{/*row 2*/} | |||||
<Grid item xs={12} md={12} lg={12}> | |||||
<MainCard elevation={0} | |||||
border={false} | |||||
content={false} | |||||
> | |||||
<EventTable | |||||
recordList={record} | |||||
/> | |||||
</MainCard> | |||||
</Grid> | |||||
{/*row 1*/} | |||||
<Grid item xs={12} md={12} lg={12}> | |||||
<SearchForm applySearch={applySearch}/> | |||||
</Grid> | |||||
{/*row 2*/} | |||||
<Grid item xs={12} md={12} lg={12}> | |||||
<MainCard elevation={0} | |||||
border={false} | |||||
content={false} | |||||
> | |||||
<EventTable | |||||
recordList={record} | |||||
/> | |||||
</MainCard> | |||||
</Grid> | </Grid> | ||||
</Grid> | |||||
); | ); | ||||
}; | }; | ||||
@@ -14,7 +14,6 @@ const GroupAuthTable = Loadable(lazy(() => import('./GroupAuthTable'))); | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const GroupAuthCard = ({isCollectData, updateUserAuthList,userGroupData,isNewRecord}) => { | const GroupAuthCard = ({isCollectData, updateUserAuthList,userGroupData,isNewRecord}) => { | ||||
const [currentAuthData, setCurrentAuthData] = React.useState({}); | const [currentAuthData, setCurrentAuthData] = React.useState({}); | ||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
@@ -55,7 +54,7 @@ const GroupAuthCard = ({isCollectData, updateUserAuthList,userGroupData,isNewRec | |||||
border={false} | border={false} | ||||
content={false} | content={false} | ||||
> | > | ||||
<Typography variant="h5" sx={{mt: 3, ml: 3}}> | |||||
<Typography variant="h5" sx={{ mt: 3, ml: 3, mb: 2, mr: 3, borderBottom: "1px solid black" }}> | |||||
User Authority | User Authority | ||||
</Typography> | </Typography> | ||||
@@ -20,6 +20,25 @@ export default function GroupAuthTable({setSelectedRow, userAuth,isNewRecord}) { | |||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [currentSelectedRow, setCurrentSelectedRow] = useState(userAuth); | const [currentSelectedRow, setCurrentSelectedRow] = useState(userAuth); | ||||
const _sx = { | |||||
ml: 3, | |||||
mb: 3, | |||||
mr: 3, | |||||
padding: "4 2 4 2", | |||||
boxShadow: 1, | |||||
border: 1, | |||||
borderColor: '#DDD', | |||||
'& .MuiDataGrid-cell': { | |||||
borderTop: 1, | |||||
borderBottom: 1, | |||||
borderColor: "#EEE" | |||||
}, | |||||
'& .MuiDataGrid-footerContainer': { | |||||
border: 1, | |||||
borderColor: "#EEE" | |||||
} | |||||
} | |||||
useEffect(() => { | useEffect(() => { | ||||
axios.get(`${apiPath}${GET_GROUP_AUTH_LIST}`) | axios.get(`${apiPath}${GET_GROUP_AUTH_LIST}`) | ||||
.then((response) => { | .then((response) => { | ||||
@@ -77,7 +96,8 @@ export default function GroupAuthTable({setSelectedRow, userAuth,isNewRecord}) { | |||||
setSelectedRow(ids); | setSelectedRow(ids); | ||||
setCurrentSelectedRow(ids); | setCurrentSelectedRow(ids); | ||||
}} | }} | ||||
autoHeight | |||||
autoHeight | |||||
sx={_sx} | |||||
/> | /> | ||||
</div> | </div> | ||||
); | ); | ||||
@@ -6,12 +6,12 @@ import { | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../components/MainCard"; | import MainCard from "../../components/MainCard"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import {useEffect, useState} from "react"; | |||||
import {GET_GROUP_MEMBER_LIST_PATH, GET_USER_GLD_COMBO_LIST} from "../../utils/ApiPathConst"; | |||||
import { useEffect, useState } from "react"; | |||||
import { GET_GROUP_MEMBER_LIST_PATH, GET_USER_GLD_COMBO_LIST } from "../../utils/ApiPathConst"; | |||||
import axios from "axios"; | import axios from "axios"; | ||||
import {apiPath} from "../../auth/utils"; | |||||
import { apiPath } from "../../auth/utils"; | |||||
import Autocomplete from "@mui/material/Autocomplete"; | import Autocomplete from "@mui/material/Autocomplete"; | ||||
import {getIdList} from "../../utils/CommonFunction"; | |||||
import { getIdList } from "../../utils/CommonFunction"; | |||||
//import LoadingComponent from "../extra-pages/LoadingComponent"; | //import LoadingComponent from "../extra-pages/LoadingComponent"; | ||||
//import UserAddTable from "./UserAddTable"; | //import UserAddTable from "./UserAddTable"; | ||||
@@ -23,7 +23,7 @@ const UserAddTable = Loadable(lazy(() => import('./UserAddTable'))); | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserAddCard = ({isCollectData, updateGroupMember,userGroupData,isNewRecord}) => { | |||||
const UserAddCard = ({ isCollectData, updateGroupMember, userGroupData, isNewRecord }) => { | |||||
const [currentUserData, setCurrentUserData] = React.useState({}); | const [currentUserData, setCurrentUserData] = React.useState({}); | ||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [groupUserData, setGroupUserData] = useState([]); | const [groupUserData, setGroupUserData] = useState([]); | ||||
@@ -31,10 +31,10 @@ const UserAddCard = ({isCollectData, updateGroupMember,userGroupData,isNewRecord | |||||
const [selectedUser, setSelectedUser] = useState(null); | const [selectedUser, setSelectedUser] = useState(null); | ||||
const [deletedList, setDeletedList] = useState([]); | const [deletedList, setDeletedList] = useState([]); | ||||
function updateUserList (){ | |||||
function updateUserList() { | |||||
const idList = getIdList(groupUserData); | const idList = getIdList(groupUserData); | ||||
if(selectedUser!==null){ | |||||
if(!idList.includes(selectedUser.id)){ | |||||
if (selectedUser !== null) { | |||||
if (!idList.includes(selectedUser.id)) { | |||||
const userList = [...groupUserData, selectedUser]; | const userList = [...groupUserData, selectedUser]; | ||||
setGroupUserData(userList); | setGroupUserData(userList); | ||||
console.log(userList); | console.log(userList); | ||||
@@ -64,11 +64,11 @@ const UserAddCard = ({isCollectData, updateGroupMember,userGroupData,isNewRecord | |||||
useEffect(() => { | useEffect(() => { | ||||
//if state data are ready and assign to different field | //if state data are ready and assign to different field | ||||
if(isNewRecord){ | |||||
if (isNewRecord) { | |||||
setOnReady(true); | setOnReady(true); | ||||
} | } | ||||
else{ | |||||
if (Object.keys(userGroupData).length > 0 &¤tUserData !== undefined) { | |||||
else { | |||||
if (Object.keys(userGroupData).length > 0 && currentUserData !== undefined) { | |||||
axios.get(`${apiPath}${GET_GROUP_MEMBER_LIST_PATH}?id=${userGroupData.data.id}`) | axios.get(`${apiPath}${GET_GROUP_MEMBER_LIST_PATH}?id=${userGroupData.data.id}`) | ||||
.then((response) => { | .then((response) => { | ||||
if (response.status === 200) { | if (response.status === 200) { | ||||
@@ -87,27 +87,27 @@ const UserAddCard = ({isCollectData, updateGroupMember,userGroupData,isNewRecord | |||||
useEffect(() => { | useEffect(() => { | ||||
//upload latest data to parent | //upload latest data to parent | ||||
updateGroupMember({ | updateGroupMember({ | ||||
"currentList" : groupUserData, | |||||
"deletedList" : deletedList | |||||
"currentList": groupUserData, | |||||
"deletedList": deletedList | |||||
}); | }); | ||||
}, [isCollectData]); | }, [isCollectData]); | ||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<MainCard elevation={0} | <MainCard elevation={0} | ||||
border={false} | |||||
content={false} | |||||
border={false} | |||||
content={false} | |||||
> | > | ||||
<Typography variant="h5" sx={{mt: 3, ml: 3}}> | |||||
<Typography variant="h5" sx={{ mt: 3, ml: 3, mb: 2, mr: 3, borderBottom: "1px solid black" }}> | |||||
User(s) | User(s) | ||||
</Typography> | </Typography> | ||||
<Grid item xs={12} s={12} md={12} lg={12} sx={{ml: 3, mr: 3, mt: 2}}> | |||||
<Grid item xs={12} s={12} md={12} lg={12} sx={{ ml: 3, mr: 3, mt: 2 }}> | |||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
<Grid item xs={3} s={3} md={2} lg={2} | <Grid item xs={3} s={3} md={2} lg={2} | ||||
sx={{display: 'flex', alignItems: 'center'}}> | |||||
sx={{ display: 'flex', alignItems: 'center' }}> | |||||
User: | User: | ||||
</Grid> | </Grid> | ||||
<Grid item xs={6} s={5} md={5} lg={5}> | <Grid item xs={6} s={5} md={5} lg={5}> | ||||
@@ -123,7 +123,7 @@ const UserAddCard = ({isCollectData, updateGroupMember,userGroupData,isNewRecord | |||||
renderInput={(params) => <TextField {...params} />} | renderInput={(params) => <TextField {...params} />} | ||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={3} s={3} md={4} lg={4} sx={{ml: 3}}> | |||||
<Grid item xs={3} s={3} md={4} lg={4} sx={{ ml: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -139,12 +139,15 @@ const UserAddCard = ({isCollectData, updateGroupMember,userGroupData,isNewRecord | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
<UserAddTable | |||||
setGroupUserData={setGroupUserData} | |||||
setDeletedList={setDeletedList} | |||||
userList={groupUserData} | |||||
/> | |||||
<Grid container> | |||||
<Grid item xs={12} sx={{mt:3}}> | |||||
<UserAddTable | |||||
setGroupUserData={setGroupUserData} | |||||
setDeletedList={setDeletedList} | |||||
userList={groupUserData} | |||||
/> | |||||
</Grid> | |||||
</Grid> | |||||
</MainCard> | </MainCard> | ||||
); | ); | ||||
}; | }; | ||||
@@ -18,6 +18,24 @@ export default function UserAddTable({setGroupUserData, userList,setDeletedList} | |||||
const [groupData, setGroupData] = useState([]); | const [groupData, setGroupData] = useState([]); | ||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [localDeletedList, setLocalDeletedList] = React.useState([]); | const [localDeletedList, setLocalDeletedList] = React.useState([]); | ||||
const _sx = { | |||||
ml: 3, | |||||
mb: 3, | |||||
mr: 3, | |||||
padding: "4 2 4 2", | |||||
boxShadow: 1, | |||||
border: 1, | |||||
borderColor: '#DDD', | |||||
'& .MuiDataGrid-cell': { | |||||
borderTop: 1, | |||||
borderBottom: 1, | |||||
borderColor: "#EEE" | |||||
}, | |||||
'& .MuiDataGrid-footerContainer': { | |||||
border: 1, | |||||
borderColor: "#EEE" | |||||
} | |||||
} | |||||
useEffect(() => { | useEffect(() => { | ||||
setGroupData(userList); | setGroupData(userList); | ||||
@@ -95,6 +113,7 @@ export default function UserAddTable({setGroupUserData, userList,setDeletedList} | |||||
pageSizeOptions={[3, 5]} | pageSizeOptions={[3, 5]} | ||||
pageSize={20} | pageSize={20} | ||||
autoHeight={true} | autoHeight={true} | ||||
sx={_sx} | |||||
/> | /> | ||||
</div> | </div> | ||||
); | ); | ||||
@@ -4,8 +4,8 @@ import { | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../components/MainCard"; | import MainCard from "../../components/MainCard"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import {useForm} from "react-hook-form"; | |||||
import {useEffect, useState} from "react"; | |||||
import { useForm } from "react-hook-form"; | |||||
import { useEffect, useState } from "react"; | |||||
//import LoadingComponent from "../extra-pages/LoadingComponent"; | //import LoadingComponent from "../extra-pages/LoadingComponent"; | ||||
//import {useParams} from "react-router-dom"; | //import {useParams} from "react-router-dom"; | ||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
@@ -14,11 +14,11 @@ const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingCompo | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserGroupInfoCard = ({isCollectData, updateGroupObject,userGroupData}) => { | |||||
const UserGroupInfoCard = ({ isCollectData, updateGroupObject, userGroupData }) => { | |||||
//const params = useParams(); | //const params = useParams(); | ||||
const [currentUserGroupData, setCurrentUserGroupData] = React.useState({}); | const [currentUserGroupData, setCurrentUserGroupData] = React.useState({}); | ||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const {register, getValues} = useForm() | |||||
const { register, getValues } = useForm() | |||||
useEffect(() => { | useEffect(() => { | ||||
//if user data from parent are not null | //if user data from parent are not null | ||||
@@ -29,7 +29,7 @@ const UserGroupInfoCard = ({isCollectData, updateGroupObject,userGroupData}) => | |||||
useEffect(() => { | useEffect(() => { | ||||
//if state data are ready and assign to different field | //if state data are ready and assign to different field | ||||
if (Object.keys(userGroupData).length > 0 &¤tUserGroupData !== undefined) { | |||||
if (Object.keys(userGroupData).length > 0 && currentUserGroupData !== undefined) { | |||||
setOnReady(true); | setOnReady(true); | ||||
} | } | ||||
}, [currentUserGroupData]); | }, [currentUserGroupData]); | ||||
@@ -37,7 +37,7 @@ const UserGroupInfoCard = ({isCollectData, updateGroupObject,userGroupData}) => | |||||
useEffect(() => { | useEffect(() => { | ||||
//upload latest data to parent | //upload latest data to parent | ||||
const values = getValues(); | const values = getValues(); | ||||
const objectData ={ | |||||
const objectData = { | |||||
...values, | ...values, | ||||
} | } | ||||
updateGroupObject(objectData); | updateGroupObject(objectData); | ||||
@@ -46,22 +46,22 @@ const UserGroupInfoCard = ({isCollectData, updateGroupObject,userGroupData}) => | |||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<MainCard elevation={0} | <MainCard elevation={0} | ||||
border={false} | |||||
content={false} | |||||
border={false} | |||||
content={false} | |||||
> | > | ||||
<Typography variant="h5" sx={{mt: 3, ml: 3, mb: 1}}> | |||||
<Typography variant="h5" sx={{ mt: 3, ml: 3, mr: 3, borderBottom: "1px solid black" }}> | |||||
Information | Information | ||||
</Typography> | </Typography> | ||||
<form> | <form> | ||||
<Grid container> | <Grid container> | ||||
<Grid item xs={12} s={12} md={12} lg={12} sx={{ml: 3, mr: 3, mb: 3}}> | |||||
<Grid item xs={12} s={12} md={12} lg={12} sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}> | |||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
<Grid item xs={4} s={4} md={4} lg={4} | <Grid item xs={4} s={4} md={4} lg={4} | ||||
sx={{ml: 3, mr: 3, display: 'flex', alignItems: 'center'}}> | |||||
sx={{ ml: 3, mr: 3, display: 'flex', alignItems: 'center' }}> | |||||
User Group Name: | User Group Name: | ||||
</Grid> | </Grid> | ||||
@@ -79,10 +79,10 @@ const UserGroupInfoCard = ({isCollectData, updateGroupObject,userGroupData}) => | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} s={12} md={12} lg={12} sx={{ml: 3, mr: 3, mb: 3}}> | |||||
<Grid item xs={12} s={12} md={12} lg={12} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
<Grid item xs={4} s={4} md={4} lg={4} | <Grid item xs={4} s={4} md={4} lg={4} | ||||
sx={{ml: 3, mr: 3, mb:3, display: 'flex', alignItems: 'center'}}> | |||||
sx={{ ml: 3, mr: 3, mb: 3, display: 'flex', alignItems: 'center' }}> | |||||
User Group Description: | User Group Description: | ||||
</Grid> | </Grid> | ||||
@@ -1,13 +1,13 @@ | |||||
// material-ui | // material-ui | ||||
import { | import { | ||||
Button, | Button, | ||||
Grid, Typography | |||||
Grid, Typography, Stack, Box | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import {useEffect, useState} from "react"; | |||||
import { useEffect, useState } from "react"; | |||||
import * as React from "react"; | import * as React from "react"; | ||||
import axios from "axios"; | import axios from "axios"; | ||||
import {apiPath} from "../../auth/utils"; | |||||
import {useParams} from "react-router-dom"; | |||||
import { apiPath } from "../../auth/utils"; | |||||
import { useParams } from "react-router-dom"; | |||||
import { | import { | ||||
GeneralConfirmWindow, | GeneralConfirmWindow, | ||||
getDeletedRecordWithRefList, | getDeletedRecordWithRefList, | ||||
@@ -16,7 +16,7 @@ import { | |||||
// notifyDeleteSuccess, | // notifyDeleteSuccess, | ||||
notifySaveSuccess | notifySaveSuccess | ||||
} from "../../utils/CommonFunction"; | } from "../../utils/CommonFunction"; | ||||
import {POST_AND_UPDATE_USER_GROUP,GET_GROUP_LIST_PATH } from "../../utils/ApiPathConst"; | |||||
import { POST_AND_UPDATE_USER_GROUP, GET_GROUP_LIST_PATH } from "../../utils/ApiPathConst"; | |||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
@@ -24,9 +24,18 @@ const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingCompo | |||||
const GroupAuthCard = Loadable(lazy(() => import('./GroupAuthCard'))); | const GroupAuthCard = Loadable(lazy(() => import('./GroupAuthCard'))); | ||||
const UserGroupInfoCard = Loadable(lazy(() => import('./UserGroupInfoCard'))); | const UserGroupInfoCard = Loadable(lazy(() => import('./UserGroupInfoCard'))); | ||||
const UserAddCard = Loadable(lazy(() => import('./UserAddCard'))); | const UserAddCard = Loadable(lazy(() => import('./UserAddCard'))); | ||||
import {useNavigate} from "react-router"; | |||||
import { useNavigate } from "react-router"; | |||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize: 'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
} | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
@@ -37,8 +46,8 @@ const UserMaintainPage = () => { | |||||
const [onReady, setOnReady] = useState(false); | const [onReady, setOnReady] = useState(false); | ||||
const [isCollectData, setIsCollectData] = useState(false); | const [isCollectData, setIsCollectData] = useState(false); | ||||
const [editedGroupData, setEditedGroupData] = useState({}); | const [editedGroupData, setEditedGroupData] = useState({}); | ||||
const [userGroupData,setUserGroupData] = useState([]); | |||||
const [userAuthData,setUserAuthData] = useState([]); | |||||
const [userGroupData, setUserGroupData] = useState([]); | |||||
const [userAuthData, setUserAuthData] = useState([]); | |||||
const [userConfirm, setUserConfirm] = useState(false); | const [userConfirm, setUserConfirm] = useState(false); | ||||
const [groupMember, setGroupMember] = useState([]); | const [groupMember, setGroupMember] = useState([]); | ||||
const [isNewRecord, setIsNewRecord] = useState(false); | const [isNewRecord, setIsNewRecord] = useState(false); | ||||
@@ -54,7 +63,7 @@ const UserMaintainPage = () => { | |||||
setIsWindowOpen(true); | setIsWindowOpen(true); | ||||
}; | }; | ||||
function deleteData(){ | |||||
function deleteData() { | |||||
axios.delete(`${apiPath}${GET_GROUP_LIST_PATH}/${params.id}`, | axios.delete(`${apiPath}${GET_GROUP_LIST_PATH}/${params.id}`, | ||||
) | ) | ||||
.then((response) => { | .then((response) => { | ||||
@@ -74,12 +83,12 @@ const UserMaintainPage = () => { | |||||
setEditedGroupData(groupData); | setEditedGroupData(groupData); | ||||
} | } | ||||
function updateGroupMember(groupMember){ | |||||
function updateGroupMember(groupMember) { | |||||
setGroupMember(groupMember.currentList); | setGroupMember(groupMember.currentList); | ||||
setDeletedUserList(groupMember.deletedList); | setDeletedUserList(groupMember.deletedList); | ||||
} | } | ||||
function updateUserAuthList(userAuthData){ | |||||
function updateUserAuthList(userAuthData) { | |||||
setUserAuthData(userAuthData.currentList); | setUserAuthData(userAuthData.currentList); | ||||
setDeletedAuthList(userAuthData.deletedList); | setDeletedAuthList(userAuthData.deletedList); | ||||
} | } | ||||
@@ -90,7 +99,7 @@ const UserMaintainPage = () => { | |||||
} | } | ||||
useEffect(() => { | useEffect(() => { | ||||
if(params.id > 0 ){ | |||||
if (params.id > 0) { | |||||
axios.get(`${apiPath}${GET_GROUP_LIST_PATH}/${params.id}`) | axios.get(`${apiPath}${GET_GROUP_LIST_PATH}/${params.id}`) | ||||
.then((response) => { | .then((response) => { | ||||
if (response.status === 200) { | if (response.status === 200) { | ||||
@@ -102,7 +111,7 @@ const UserMaintainPage = () => { | |||||
return false; | return false; | ||||
}); | }); | ||||
} | } | ||||
else{ | |||||
else { | |||||
//new record case | //new record case | ||||
setUserGroupData( | setUserGroupData( | ||||
{ | { | ||||
@@ -120,19 +129,19 @@ const UserMaintainPage = () => { | |||||
if (Object.keys(userGroupData).length > 0 && userGroupData !== undefined) { | if (Object.keys(userGroupData).length > 0 && userGroupData !== undefined) { | ||||
setOnReady(true); | setOnReady(true); | ||||
} | } | ||||
else if(isNewRecord){ | |||||
else if (isNewRecord) { | |||||
setOnReady(true); | setOnReady(true); | ||||
} | } | ||||
}, [userGroupData]); | }, [userGroupData]); | ||||
useEffect(() => { | useEffect(() => { | ||||
if(userConfirm && onReady){ | |||||
if (userConfirm && onReady) { | |||||
//avoid delete and add user at the same time | //avoid delete and add user at the same time | ||||
let finalDeletedUserList = getDeletedRecordWithRefList(deletedUserList, getIdList(groupMember)); | let finalDeletedUserList = getDeletedRecordWithRefList(deletedUserList, getIdList(groupMember)); | ||||
console.log(finalDeletedUserList) | console.log(finalDeletedUserList) | ||||
axios.post(POST_AND_UPDATE_USER_GROUP, | axios.post(POST_AND_UPDATE_USER_GROUP, | ||||
{ | { | ||||
"id": parseInt(params.id) !== -1? parseInt(params.id) : null, | |||||
"id": parseInt(params.id) !== -1 ? parseInt(params.id) : null, | |||||
"name": editedGroupData.userGroupName, | "name": editedGroupData.userGroupName, | ||||
"description": editedGroupData.description, | "description": editedGroupData.description, | ||||
"addUserIds": getIdList(groupMember), | "addUserIds": getIdList(groupMember), | ||||
@@ -153,52 +162,62 @@ const UserMaintainPage = () => { | |||||
}); | }); | ||||
} | } | ||||
setUserConfirm(false); | setUserConfirm(false); | ||||
}, [editedGroupData,userGroupData,userAuthData]); | |||||
}, [editedGroupData, userGroupData, userAuthData]); | |||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<Grid container rowSpacing={4.5} columnSpacing={2.75}> | |||||
<Grid item xs={12} sx={{mb: -2.25}}> | |||||
<Typography variant="h5">{isNewRecord? "Create User Group" : "Maintain User Group"}</Typography> | |||||
<Grid container> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4">{isNewRecord ? "Create User Group" : "Maintain User Group"}</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | </Grid> | ||||
{/*col 1*/} | {/*col 1*/} | ||||
<Grid item xs={12} md={5} lg={5}> | <Grid item xs={12} md={5} lg={5}> | ||||
<Grid container> | <Grid container> | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<UserGroupInfoCard | |||||
updateGroupObject={updateGroupObject} | |||||
userGroupData={userGroupData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
<Box xs={12} ml={4} mt={3} mr={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<UserGroupInfoCard | |||||
updateGroupObject={updateGroupObject} | |||||
userGroupData={userGroupData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
</Box> | |||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12} sx={{mt:3}}> | |||||
<UserAddCard | |||||
updateGroupMember={updateGroupMember} | |||||
userGroupData={userGroupData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
<Grid item xs={12} md={12} lg={12} sx={{ mt: 3 }}> | |||||
<Box xs={12} ml={4} mt={3} mr={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<UserAddCard | |||||
updateGroupMember={updateGroupMember} | |||||
userGroupData={userGroupData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
</Box> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
{/*col 2*/} | {/*col 2*/} | ||||
<Grid item xs={12} md={7} lg={7}> | <Grid item xs={12} md={7} lg={7}> | ||||
<GroupAuthCard | |||||
updateUserAuthList={updateUserAuthList} | |||||
userGroupData={userGroupData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
<Box xs={12} ml={4} mt={3} mr={3} sx={{ p: 1, border: '3px groove grey', borderRadius: '10px' }}> | |||||
<GroupAuthCard | |||||
updateUserAuthList={updateUserAuthList} | |||||
userGroupData={userGroupData} | |||||
isCollectData={isCollectData} | |||||
isNewRecord={isNewRecord} | |||||
/> | |||||
</Box> | |||||
</Grid> | </Grid> | ||||
{/*bottom button*/} | {/*bottom button*/} | ||||
<Grid item s={12} md={12} lg={12} sx={{mb: 3}} alignItems={"end"} justifyContent="center"> | |||||
<Grid item s={12} md={12} lg={12} sx={{ mb: 3 }} alignItems={"end"} justifyContent="center"> | |||||
<Grid container maxWidth justifyContent="flex-end"> | <Grid container maxWidth justifyContent="flex-end"> | ||||
<Grid item sx={{ml:3, mr:3, mb:3}}> | |||||
<Grid item sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -220,7 +239,7 @@ const UserMaintainPage = () => { | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
<Grid item sx={{ml: 3, mr: 3}}> | |||||
<Grid item sx={{ ml: 3, mr: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -63,13 +63,11 @@ const UserGroupSearchForm = ({applySearch}) => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
{/*last row*/} | {/*last row*/} | ||||
<Grid container direction="row" | <Grid container direction="row" | ||||
justifyContent="space-between" | justifyContent="space-between" | ||||
alignItems="center"> | alignItems="center"> | ||||
<Grid item xs={3} md={3} sx={{ml:1, mr:1, mb:3, mt:3}}> | |||||
<Grid item xs={3} md={3} sx={{ ml: 3, mr: 1, mb: 3, mt: 3 }}> | |||||
<Button | <Button | ||||
size="large" | size="large" | ||||
variant="contained" | variant="contained" | ||||
@@ -83,7 +81,7 @@ const UserGroupSearchForm = ({applySearch}) => { | |||||
</Button> | </Button> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={8} md={8} sx={{ml:3, mr:3, mb:3, mt:3}}> | <Grid item xs={8} md={8} sx={{ml:3, mr:3, mb:3, mt:3}}> | ||||
<Grid container > | |||||
<Grid container maxWidth justifyContent="flex-end"> | |||||
<Grid item sx={{ml:3, mr:3, mb:3, mt:3}}> | <Grid item sx={{ml:3, mr:3, mb:3, mt:3}}> | ||||
<Button | <Button | ||||
size="large" | size="large" | ||||
@@ -6,10 +6,10 @@ import { | |||||
Grid, Typography | Grid, Typography | ||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../components/MainCard"; | import MainCard from "../../components/MainCard"; | ||||
import {useEffect, useState} from "react"; | |||||
import { useEffect, useState } from "react"; | |||||
import axios from "axios"; | import axios from "axios"; | ||||
import {apiPath} from "../../auth/utils"; | |||||
import {GET_GROUP_LIST_PATH} from "../../utils/ApiPathConst"; | |||||
import { apiPath } from "../../auth/utils"; | |||||
import { GET_GROUP_LIST_PATH } from "../../utils/ApiPathConst"; | |||||
import * as React from "react"; | import * as React from "react"; | ||||
//import LoadingComponent from "../extra-pages/LoadingComponent"; | //import LoadingComponent from "../extra-pages/LoadingComponent"; | ||||
@@ -21,7 +21,17 @@ const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingCompo | |||||
const UserGroupSearchForm = Loadable(lazy(() => import('./UserGroupSearchForm'))); | const UserGroupSearchForm = Loadable(lazy(() => import('./UserGroupSearchForm'))); | ||||
const UserGroupTable = Loadable(lazy(() => import('./UserGroupTable'))); | const UserGroupTable = Loadable(lazy(() => import('./UserGroupTable'))); | ||||
// import {useNavigate} from "react-router"; | // import {useNavigate} from "react-router"; | ||||
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | |||||
const BackgroundHead = { | |||||
backgroundImage: `url(${titleBackgroundImg})`, | |||||
width: '100%', | |||||
height: '100%', | |||||
backgroundSize: 'contain', | |||||
backgroundRepeat: 'no-repeat', | |||||
backgroundColor: '#0C489E', | |||||
backgroundPosition: 'right' | |||||
} | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const UserGroupSearchPanel = () => { | const UserGroupSearchPanel = () => { | ||||
@@ -44,7 +54,7 @@ const UserGroupSearchPanel = () => { | |||||
function getGroupList() { | function getGroupList() { | ||||
axios.get(`${apiPath}${GET_GROUP_LIST_PATH}`, | axios.get(`${apiPath}${GET_GROUP_LIST_PATH}`, | ||||
{params: searchCriteria} | |||||
{ params: searchCriteria } | |||||
) | ) | ||||
.then((response) => { | .then((response) => { | ||||
if (response.status === 200) { | if (response.status === 200) { | ||||
@@ -63,28 +73,26 @@ const UserGroupSearchPanel = () => { | |||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
<LoadingComponent/> | |||||
<LoadingComponent /> | |||||
: | : | ||||
<Grid container sx={{minHeight: '90vh', paddingTop: '53px'}}> | |||||
<Grid item xs={12} md={12} lg={12}> | |||||
<Grid direction="row" container justifyContent="flex-start" alignItems="center" ml={2}> | |||||
<Grid item xs={2} height='50px'> | |||||
<Stack direction="row" height='100%' justifyContent="space-between" alignItems="center"> | |||||
<Typography align="center" variant="h5">View User Group</Typography> | |||||
</Stack> | |||||
</Grid> | |||||
</Grid> | |||||
<Grid container sx={{ minHeight: '90vh'}} direction="column"> | |||||
<Grid item xs={12}> | |||||
<div style={BackgroundHead}> | |||||
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> | |||||
<Typography ml={15} color='#FFF' variant="h4">View User Group</Typography> | |||||
</Stack> | |||||
</div> | |||||
</Grid> | </Grid> | ||||
{/*row 1*/} | {/*row 1*/} | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<UserGroupSearchForm applySearch={applySearch}/> | |||||
<UserGroupSearchForm applySearch={applySearch} /> | |||||
</Grid> | </Grid> | ||||
{/*row 2*/} | {/*row 2*/} | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<MainCard elevation={0} | <MainCard elevation={0} | ||||
border={false} | |||||
content={false} | |||||
border={false} | |||||
content={false} | |||||
> | > | ||||
<UserGroupTable | <UserGroupTable | ||||
recordList={record} | recordList={record} | ||||