@@ -4,6 +4,9 @@ import enMessages from '../translations/en.json'; | |||
import cnMessages from '../translations/zh-CN.json'; | |||
import hkMessages from '../translations/zh-HK.json'; | |||
import { POST_TERMS_N_CONDITIONS } from "utils/ApiPathConst"; | |||
import * as HttpUtils from "utils/HttpUtils"; | |||
const LocaleContext = createContext(); | |||
export const I18nProvider = ({ children }) => { | |||
@@ -13,11 +16,24 @@ export const I18nProvider = ({ children }) => { | |||
"zh-HK": hkMessages, | |||
"zh-CN": cnMessages | |||
}; | |||
const [locale, setLocale] = useState('en'); // Default locale, you can change this as per your requirement | |||
const [messages, setMessages] = useState(systemMessages[locale]); | |||
const loadTermsAndConditions = () => { | |||
HttpUtils.get({ | |||
url: POST_TERMS_N_CONDITIONS, | |||
onSuccess: (responseData) => { | |||
enMessages["termsAndCon"]= responseData.en; | |||
cnMessages["termsAndCon"]= responseData.cn; | |||
hkMessages["termsAndCon"]= responseData.zh; | |||
} | |||
}); | |||
} | |||
useEffect(() => { | |||
loadTermsAndConditions(); | |||
if(localStorage.getItem('locale') === null){ | |||
//no locale case | |||
localStorage.setItem('locale','en'); | |||
@@ -41,7 +41,10 @@ const Table = ({onRowClick, dataList}) => { | |||
id: 'value', | |||
field: 'value', | |||
headerName: 'Value', | |||
flex: 1 | |||
flex: 1, | |||
renderCell:(params)=>{ | |||
return <div dangerouslySetInnerHTML={{__html: params.value}} /> | |||
} | |||
}, | |||
]; | |||
return ( | |||
@@ -17,7 +17,6 @@ import {FormattedMessage, useIntl} from "react-intl"; | |||
// ================================|| LOGIN ||================================ // | |||
const RegisterCustom = () => { | |||
const [isPopUp, setIsPopUp] = React.useState(false); | |||
const intl = useIntl(); | |||
const { locale } = intl; | |||
@@ -104,14 +104,14 @@ const BusCustomFormWizard = (props) => { | |||
const address4ComboList = ComboData.district; | |||
const address5ComboList = ComboData.country; | |||
const termsAndCon = "此網址由香港特別行政區政府物流服務署製作及管理。本署會盡力確保網址上的資料無誤,\n" | |||
+ "但有絕對酌情權隨時刪除、暫停登載或編輯各項資料而無須給予任何理由。\n由於任何與網址" | |||
+ "內資料有關的理由或原因,而導致出現申索、損失或損害,本署概不負責。\n使用者須自行評" | |||
+ "估本網址所載或與本網址有關連的各項資料,並應在根據該等資料行事前,參照印行的香港" | |||
+ "特別行政區憲報以核實該等資料,以及徵詢獨立意見。\n版權公告本網頁的內容,包括但不限" | |||
+ "於所有文本、平面圖像、圖畫、圖片、照片以及數據或其他資料的匯編,均受版權保障。\n香" | |||
+ "港特別行政區政府是本網頁內所有版權作品的擁有人,除非預先得到政府物流服務署的書面" | |||
+ "授權,否則嚴禁複製、改編、分發、發布或向公眾提供該等版權作品。" | |||
// const termsAndCon = "此網址由香港特別行政區政府物流服務署製作及管理。本署會盡力確保網址上的資料無誤,\n" | |||
// + "但有絕對酌情權隨時刪除、暫停登載或編輯各項資料而無須給予任何理由。\n由於任何與網址" | |||
// + "內資料有關的理由或原因,而導致出現申索、損失或損害,本署概不負責。\n使用者須自行評" | |||
// + "估本網址所載或與本網址有關連的各項資料,並應在根據該等資料行事前,參照印行的香港" | |||
// + "特別行政區憲報以核實該等資料,以及徵詢獨立意見。\n版權公告本網頁的內容,包括但不限" | |||
// + "於所有文本、平面圖像、圖畫、圖片、照片以及數據或其他資料的匯編,均受版權保障。\n香" | |||
// + "港特別行政區政府是本網頁內所有版權作品的擁有人,除非預先得到政府物流服務署的書面" | |||
// + "授權,否則嚴禁複製、改編、分發、發布或向公眾提供該等版權作品。" | |||
const refType = "identification"; | |||
useEffect(() => { | |||
@@ -1365,7 +1365,7 @@ const BusCustomFormWizard = (props) => { | |||
<Grid container> | |||
<Grid item xs={12} md={12}> | |||
<Typography variant="h6" height="100%" sx={{ textAlign: "left", /*overflow: "scroll",*/ borderRadius: "inherit", borderStyle: "solid", borderWidth: "1px", borderColor: "#0C489E" }}> | |||
{termsAndCon} | |||
<div dangerouslySetInnerHTML={{__html: intl.formatMessage({id: "termsAndCon"})}} /> | |||
</Typography> | |||
</Grid> | |||
</Grid> | |||
@@ -1,5 +1,6 @@ | |||
import { useEffect, useState } from 'react'; | |||
// material-ui | |||
import { | |||
Box, | |||
@@ -24,7 +25,7 @@ import * as yup from 'yup'; | |||
import { strengthColorChi, strengthIndicator } from 'utils/password-strength'; | |||
// import {apiPath} from "auth/utils"; | |||
import axios from "axios"; | |||
import { GET_USERNAME, GET_USER_EMAIL, POST_CAPTCHA, POST_PUBLIC_USER_REGISTER } from "utils/ApiPathConst"; | |||
import { GET_USERNAME, GET_USER_EMAIL, POST_CAPTCHA, POST_PUBLIC_USER_REGISTER } from "utils/ApiPathConst"; | |||
// import * as HttpUtils from 'utils/HttpUtils'; | |||
import * as ComboData from "utils/ComboData"; | |||
@@ -52,6 +53,7 @@ import * as HttpUtils from "../../../utils/HttpUtils"; | |||
// ============================|| FIREBASE - REGISTER ||============================ // | |||
const CustomFormWizard = (props) => { | |||
const intl = useIntl(); | |||
const theme = useTheme() | |||
const [level, setLevel] = useState(); | |||
@@ -64,6 +66,7 @@ const CustomFormWizard = (props) => { | |||
const [updateRows, setUpdateRows] = useState([]); | |||
const [captchaImg, setCaptchaImage] = useState(""); | |||
const handleClickShowPassword = () => { | |||
setShowPassword(!showPassword); | |||
}; | |||
@@ -99,20 +102,21 @@ const CustomFormWizard = (props) => { | |||
const [districtErrStr, setDistrictErrStr] = useState("") | |||
const idDocTypeComboList = ComboData.idDocType; | |||
const termsAndCon = "此網址由香港特別行政區政府物流服務署製作及管理。本署會盡力確保網址上的資料無誤,\n" | |||
+ "但有絕對酌情權隨時刪除、暫停登載或編輯各項資料而無須給予任何理由。\n由於任何與網址" | |||
+ "內資料有關的理由或原因,而導致出現申索、損失或損害,本署概不負責。\n使用者須自行評" | |||
+ "估本網址所載或與本網址有關連的各項資料,並應在根據該等資料行事前,參照印行的香港" | |||
+ "特別行政區憲報以核實該等資料,以及徵詢獨立意見。\n版權公告本網頁的內容,包括但不限" | |||
+ "於所有文本、平面圖像、圖畫、圖片、照片以及數據或其他資料的匯編,均受版權保障。\n香" | |||
+ "港特別行政區政府是本網頁內所有版權作品的擁有人,除非預先得到政府物流服務署的書面" | |||
+ "授權,否則嚴禁複製、改編、分發、發布或向公眾提供該等版權作品。" | |||
// const termsAndCon = "此網址由香港特別行政區政府物流服務署製作及管理。本署會盡力確保網址上的資料無誤,\n" | |||
// + "但有絕對酌情權隨時刪除、暫停登載或編輯各項資料而無須給予任何理由。\n由於任何與網址" | |||
// + "內資料有關的理由或原因,而導致出現申索、損失或損害,本署概不負責。\n使用者須自行評" | |||
// + "估本網址所載或與本網址有關連的各項資料,並應在根據該等資料行事前,參照印行的香港" | |||
// + "特別行政區憲報以核實該等資料,以及徵詢獨立意見。\n版權公告本網頁的內容,包括但不限" | |||
// + "於所有文本、平面圖像、圖畫、圖片、照片以及數據或其他資料的匯編,均受版權保障。\n香" | |||
// + "港特別行政區政府是本網頁內所有版權作品的擁有人,除非預先得到政府物流服務署的書面" | |||
// + "授權,否則嚴禁複製、改編、分發、發布或向公眾提供該等版權作品。" | |||
const refType = "identification"; | |||
useEffect(() => { | |||
changePassword(''); | |||
if (captchaImg == "") | |||
if (captchaImg == ""){ | |||
onCaptchaChange(); | |||
} | |||
}, []); | |||
const handleCheckUsername = async () => { | |||
@@ -1550,7 +1554,7 @@ const CustomFormWizard = (props) => { | |||
<Grid container> | |||
<Grid item xs={12} md={12}> | |||
<Typography variant="h6" height="100%" sx={{ textAlign: "left", /*overflow: "scroll",*/ borderRadius: "inherit", borderStyle: "solid", borderWidth: "1px", borderColor: "#0C489E" }}> | |||
{termsAndCon} | |||
<div dangerouslySetInnerHTML={{__html: intl.formatMessage({id: "termsAndCon"})}} /> | |||
</Typography> | |||
</Grid> | |||
</Grid> | |||
@@ -67,14 +67,14 @@ const CustomFormWizard = (props) => { | |||
const address4ComboList = ComboData.district; | |||
const address5ComboList = ComboData.country; | |||
const termsAndCon = "此網址由香港特別行政區政府物流服務署製作及管理。本署會盡力確保網址上的資料無誤,\n" | |||
+ "但有絕對酌情權隨時刪除、暫停登載或編輯各項資料而無須給予任何理由。\n由於任何與網址" | |||
+ "內資料有關的理由或原因,而導致出現申索、損失或損害,本署概不負責。\n使用者須自行評" | |||
+ "估本網址所載或與本網址有關連的各項資料,並應在根據該等資料行事前,參照印行的香港" | |||
+ "特別行政區憲報以核實該等資料,以及徵詢獨立意見。\n版權公告本網頁的內容,包括但不限" | |||
+ "於所有文本、平面圖像、圖畫、圖片、照片以及數據或其他資料的匯編,均受版權保障。\n香" | |||
+ "港特別行政區政府是本網頁內所有版權作品的擁有人,除非預先得到政府物流服務署的書面" | |||
+ "授權,否則嚴禁複製、改編、分發、發布或向公眾提供該等版權作品。" | |||
// const termsAndCon = "此網址由香港特別行政區政府物流服務署製作及管理。本署會盡力確保網址上的資料無誤,\n" | |||
// + "但有絕對酌情權隨時刪除、暫停登載或編輯各項資料而無須給予任何理由。\n由於任何與網址" | |||
// + "內資料有關的理由或原因,而導致出現申索、損失或損害,本署概不負責。\n使用者須自行評" | |||
// + "估本網址所載或與本網址有關連的各項資料,並應在根據該等資料行事前,參照印行的香港" | |||
// + "特別行政區憲報以核實該等資料,以及徵詢獨立意見。\n版權公告本網頁的內容,包括但不限" | |||
// + "於所有文本、平面圖像、圖畫、圖片、照片以及數據或其他資料的匯編,均受版權保障。\n香" | |||
// + "港特別行政區政府是本網頁內所有版權作品的擁有人,除非預先得到政府物流服務署的書面" | |||
// + "授權,否則嚴禁複製、改編、分發、發布或向公眾提供該等版權作品。" | |||
useEffect(() => { | |||
@@ -826,7 +826,8 @@ const CustomFormWizard = (props) => { | |||
<Grid container> | |||
<Grid item xs={12} md={12}> | |||
<Typography variant="h5" height="80%" sx={{ textAlign: "left", overflow: "scroll", borderRadius: "inherit", borderStyle: "solid", borderWidth: "1px", borderColor: "#0C489E" }}> | |||
{termsAndCon} | |||
<div dangerouslySetInnerHTML={{__html: intl.formatMessage({id: "termsAndCon"})}} /> | |||
</Typography> | |||
</Grid> | |||
</Grid> | |||
@@ -77,6 +77,7 @@ export const AUDIT_LOG_EXPORT = apiPath+'/settings/auditLog-export'; | |||
//Login | |||
export const POST_LOGIN = '/login'; | |||
export const POST_CAPTCHA = apiPath+'/captcha'; | |||
export const POST_TERMS_N_CONDITIONS = apiPath+'/termsAndConditions'; | |||
export const POST_VERIFY_CAPTCHA = apiPath+'/verifyCaptcha'; | |||
//register | |||