@@ -10,10 +10,10 @@ export const hostname = 'localhost'; | |||||
const hostPort = '8090'; | const hostPort = '8090'; | ||||
export const hostPath = `http://${hostname}:${hostPort}`; | export const hostPath = `http://${hostname}:${hostPort}`; | ||||
//export const apiPath = `http://192.168.0.112:8090/api`; | //export const apiPath = `http://192.168.0.112:8090/api`; | ||||
export const apiPath = window.location.hostname.match("localhost")?`${hostPath}/api`:`/api`; | |||||
//export const apiPath = `/api`; | |||||
export const apiPath = window.location.href.match("localhost:3000")?`${hostPath}/api`:`/api`; | |||||
//export const apiPath = `/api`;zz | |||||
export const paymentPath = `https://pnspsdev.gld.gov.hk/payment`; | export const paymentPath = `https://pnspsdev.gld.gov.hk/payment`; | ||||
export const iAmSmartPath = `https://<iAM_Smart_domain>`; | |||||
export const iAmSmartPath = `https://apigw-isit.staging-eid.gov.hk`; | |||||
export const clientId = "cf61fa7c121e4869966f69c8694b1cd2"; | export const clientId = "cf61fa7c121e4869966f69c8694b1cd2"; | ||||
export const iAmSmartCallbackPath = () => { | export const iAmSmartCallbackPath = () => { | ||||
@@ -87,8 +87,16 @@ const FormPanel = ({ formData }) => { | |||||
colValue = obj.value; | colValue = obj.value; | ||||
return obj.colCount === responseData.data.column | return obj.colCount === responseData.data.column | ||||
})); | })); | ||||
formik.setFieldValue("noOfPages", responseData.data.no_of_page); | |||||
formik.setFieldValue("fee", (data.groupType == "Private Bill" ? 6552 * responseData.data.no_of_page : responseData.data.length * colValue)); | |||||
formik.setFieldValue("noOfPages", responseData.data.total_no_of_page); | |||||
formik.setFieldValue("fee", (data.groupType == "Private Bill" ? 6552 * responseData.data.total_no_of_page : responseData.data.length * colValue)); | |||||
if(data.groupType == "Private Bill" && responseData.data.file.length>0){ | |||||
let attachmentList = attachments; | |||||
for(let i=0; i<responseData.data.file.length; i++){ | |||||
let file = responseData.data.file[i]; | |||||
attachmentList.find(item=> item.name == file.filename)["no_of_page"] = file.no_of_page; | |||||
} | |||||
setAttachments(attachmentList); | |||||
} | |||||
setWait(false); | setWait(false); | ||||
}, | }, | ||||
onError: function () { | onError: function () { | ||||
@@ -200,7 +208,7 @@ const FormPanel = ({ formData }) => { | |||||
WebkitTextFillColor: "#000000", | WebkitTextFillColor: "#000000", | ||||
background: "#f8f8f8", | background: "#f8f8f8", | ||||
}, | }, | ||||
width: '15%' | |||||
width: '30%' | |||||
} | } | ||||
} | } | ||||
/> | /> | ||||
@@ -233,7 +241,12 @@ const FormPanel = ({ formData }) => { | |||||
<Grid item xs={12} md={12}> | <Grid item xs={12} md={12}> | ||||
<UploadFileTable key="uploadTable" recordList={attachments} setRecordList={setAttachments} /> | |||||
<UploadFileTable | |||||
key="uploadTable" | |||||
recordList={attachments} | |||||
setRecordList={setAttachments} | |||||
showPageColumn = {formik.values.groupType == "Private Bill"} | |||||
/> | |||||
</Grid> | </Grid> | ||||
{ | { | ||||
@@ -16,10 +16,11 @@ import { | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function UploadFileTable({ recordList, setRecordList, }) { | |||||
export default function UploadFileTable({ recordList, setRecordList, showPageColumn }) { | |||||
const [rows, setRows] = React.useState(recordList); | const [rows, setRows] = React.useState(recordList); | ||||
const [rowModesModel, setRowModesModel] = React.useState({}); | const [rowModesModel, setRowModesModel] = React.useState({}); | ||||
const [showPage, setShowPage] = React.useState(false); | |||||
// const theme = useTheme(); | // const theme = useTheme(); | ||||
// const navigate = useNavigate() | // const navigate = useNavigate() | ||||
@@ -29,6 +30,11 @@ export default function UploadFileTable({ recordList, setRecordList, }) { | |||||
// console.log(disableDelete); | // console.log(disableDelete); | ||||
}, [recordList]); | }, [recordList]); | ||||
useEffect(() => { | |||||
setShowPage(showPageColumn); | |||||
// console.log(disableDelete); | |||||
}, [showPageColumn]); | |||||
function NoRowsOverlay() { | function NoRowsOverlay() { | ||||
return ( | return ( | ||||
<Stack height="100%" alignItems="center" justifyContent="center"> | <Stack height="100%" alignItems="center" justifyContent="center"> | ||||
@@ -53,16 +59,16 @@ export default function UploadFileTable({ recordList, setRecordList, }) { | |||||
const handlePreviewClick = (param) => () => { | const handlePreviewClick = (param) => () => { | ||||
var reader = new FileReader(); | var reader = new FileReader(); | ||||
reader.onload = function(){ | |||||
reader.onload = function () { | |||||
let path = reader.result; | let path = reader.result; | ||||
var pdf_newTab = window.open(""); | var pdf_newTab = window.open(""); | ||||
pdf_newTab.document.write( | pdf_newTab.document.write( | ||||
"<html>" | "<html>" | ||||
+"<head><title>"+param.row.name+"</title></head>" | |||||
+"<body>" | |||||
+"<iframe title='"+param.row.name+"' width='100%' height='100%' src='"+path+"" + "'></iframe>" | |||||
+"</body>" | |||||
+"</html>" | |||||
+ "<head><title>" + param.row.name + "</title></head>" | |||||
+ "<body>" | |||||
+ "<iframe title='" + param.row.name + "' width='100%' height='100%' src='" + path + "" + "'></iframe>" | |||||
+ "</body>" | |||||
+ "</html>" | |||||
); | ); | ||||
}; | }; | ||||
reader.readAsDataURL(param.row); | reader.readAsDataURL(param.row); | ||||
@@ -70,7 +76,52 @@ export default function UploadFileTable({ recordList, setRecordList, }) { | |||||
const columns = [ | |||||
const columns = showPage?[ | |||||
{ | |||||
field: 'actions', | |||||
type: 'actions', | |||||
headerName: '', | |||||
width: 30, | |||||
cellClassName: 'actions', | |||||
// hide:true, | |||||
getActions: ({ id }) => { | |||||
return [ | |||||
<GridActionsCellItem | |||||
key="OutSave" | |||||
icon={<RemoveCircleOutlineIcon />} | |||||
label="delete" | |||||
className="textPrimary" | |||||
onClick={handleCancelClick(id)} | |||||
color="error" | |||||
/>] | |||||
}, | |||||
}, | |||||
{ | |||||
field: 'name', | |||||
headerName: 'File Name', | |||||
flex: 1, | |||||
renderCell: (params) => { | |||||
return <Button onClick={handlePreviewClick(params)}><u>{params.row.name}</u></Button>; | |||||
}, | |||||
}, | |||||
{ | |||||
id: 'size', | |||||
field: 'size', | |||||
headerName: 'File Size', | |||||
valueGetter: (params) => { | |||||
// console.log(params) | |||||
return Math.ceil(params.value / 1024) + " KB"; | |||||
}, | |||||
flex: 1, | |||||
}, | |||||
{ | |||||
id: 'no_of_page', | |||||
field: 'no_of_page', | |||||
headerName: 'Page', | |||||
flex: 1, | |||||
hide: true | |||||
}, | |||||
]:[ | |||||
{ | { | ||||
field: 'actions', | field: 'actions', | ||||
type: 'actions', | type: 'actions', | ||||
@@ -21,9 +21,11 @@ export default function Verify() { | |||||
const [isLoading, setIsLoading] = useState(true) | const [isLoading, setIsLoading] = useState(true) | ||||
const [verifyState, setVerifyState] = useState(null) | const [verifyState, setVerifyState] = useState(null) | ||||
const [enterUseEffect, setEnterUseEffect] = useState(false) | |||||
const params = useParams() | const params = useParams() | ||||
const handleVerify = async () => { | const handleVerify = async () => { | ||||
console.log("handleVerify()"); | |||||
const response = await axios.get(GET_VERIFY_USER_ACCOUNT, { | const response = await axios.get(GET_VERIFY_USER_ACCOUNT, { | ||||
params: { | params: { | ||||
email: decodeURIComponent(params.email), | email: decodeURIComponent(params.email), | ||||
@@ -38,12 +40,17 @@ export default function Verify() { | |||||
setIsLoading(false) | setIsLoading(false) | ||||
} | } | ||||
let enterUseEffect = false | |||||
useEffect(() => { | useEffect(() => { | ||||
if (enterUseEffect) handleVerify() | |||||
enterUseEffect = true | |||||
console.log("setEnterUseEffect(true)"); | |||||
setEnterUseEffect(true) | |||||
}, []) | }, []) | ||||
useEffect(() => { | |||||
console.log("if (enterUseEffect) handleVerify()"); | |||||
if (enterUseEffect) handleVerify() | |||||
}, [enterUseEffect]) | |||||
return ( | return ( | ||||
<Stack sx={{ width: '100%', fontSize: '2rem', paddingTop: '65px' }} alignItems="center"> | <Stack sx={{ width: '100%', fontSize: '2rem', paddingTop: '65px' }} alignItems="center"> | ||||
<AuthWrapper> | <AuthWrapper> | ||||
@@ -11,6 +11,8 @@ import * as React from "react"; | |||||
import { useFormik, FormikProvider } from 'formik'; | import { useFormik, FormikProvider } from 'formik'; | ||||
import * as yup from 'yup'; | import * as yup from 'yup'; | ||||
import { useParams } from "react-router-dom"; | import { useParams } from "react-router-dom"; | ||||
import * as HttpUtils from "utils/HttpUtils"; | |||||
import * as UrlUtils from "utils/ApiPathConst"; | |||||
//import { iAmSmartPath, clientId, getBowerType , iAmSmartCallbackPath} from 'auth/utils' | //import { iAmSmartPath, clientId, getBowerType , iAmSmartCallbackPath} from 'auth/utils' | ||||
import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
@@ -40,12 +42,21 @@ const Index = () => { | |||||
if(params.code){ | if(params.code){ | ||||
setOnReady(true); | setOnReady(true); | ||||
setProps({}); | setProps({}); | ||||
getPrfile(); | |||||
} | } | ||||
}, []); | }, []); | ||||
// function loadIAmSmartProfile(){ | |||||
function getPrfile(){ | |||||
HttpUtils.post({ | |||||
url: UrlUtils.GET_SMART_PROFILE, | |||||
params:{ | |||||
code: params.code | |||||
}, | |||||
onSuccess: () => { | |||||
// } | |||||
} | |||||
}); | |||||
} | |||||
function displayErrorMsg(errorMsg) { | function displayErrorMsg(errorMsg) { | ||||
return <Typography variant="errorMessage1">{errorMsg}</Typography> | return <Typography variant="errorMessage1">{errorMsg}</Typography> | ||||
@@ -100,4 +100,7 @@ export const GET_EMAIL_LIST = apiPath+'/email/list'; | |||||
export const GET_EMAIL_COMBO = apiPath+'/email/combo'; | export const GET_EMAIL_COMBO = apiPath+'/email/combo'; | ||||
export const GET_EMAIL = apiPath+'/email/load'; | export const GET_EMAIL = apiPath+'/email/load'; | ||||
export const POST_EMAIL_SAVE = apiPath+'/email/save'; | export const POST_EMAIL_SAVE = apiPath+'/email/save'; | ||||
export const DELETE_EMAIL = apiPath+'/email/delete'; | |||||
export const DELETE_EMAIL = apiPath+'/email/delete'; | |||||
//iAmSmart | |||||
export const GET_SMART_PROFILE = apiPath+'smart/getProfile'; //POST |