diff --git a/src/_base/FunctionBase.js b/src/_base/FunctionBase.js index 6e5c01a..338e3d3 100644 --- a/src/_base/FunctionBase.js +++ b/src/_base/FunctionBase.js @@ -3,6 +3,8 @@ import { LinkApp } from "../_constants/linkDownloadApp"; import { history } from "../_helpers"; export const handleNavigateCurriculumDownload = (type) => { + const urlParams = new URLSearchParams(window.location.search); + const mds = urlParams.get('mds'); const osMobile = getMobileOperatingSystem(); if (osMobile == "Android") { window.open(LinkApp[`${type}`].GG_PLAY, "_blank"); @@ -21,6 +23,6 @@ export const handleNavigateCurriculumDownload = (type) => { // // history.push(`/login`); // } - history.push(`/download_page/${type}`); + history.push(`/download_page/${type}?mds=${mds}`); } }; diff --git a/src/_components/AdvisementForm/AdvisementForm.jsx b/src/_components/AdvisementForm/AdvisementForm.jsx index 977f238..1d62d07 100644 --- a/src/_components/AdvisementForm/AdvisementForm.jsx +++ b/src/_components/AdvisementForm/AdvisementForm.jsx @@ -6,6 +6,8 @@ import InputSelectNews from "../Input/InputSelect"; import { userConstants } from "../../_constants"; import ModalSuccessMsg from "../Modal/ModalSuccessMsg/ModalSuccessMsg"; import LazyLoad from "react-lazyload"; +import { useSelector } from "react-redux"; +import { Alert } from "../Alert"; const AdvisementForm = (props) => { let { @@ -37,12 +39,22 @@ const AdvisementForm = (props) => { setGradeError, isSuccessRegist, handleCloseModal, + email, + emailError, + changeEmail, + setEmailError, + message, + changeMessage } = advisementLogic(props); + const alert = useSelector((state) => state.alert); return (
{/* Img Banner */} - + {alert?.message && + alert?.screen === 'form_register' && ( + + )}
{ src="/assets/images/homeNews/content/teacher/title_advisement_teacher.png" alt="Titlte Advisement" className="contain_image title_header_teacher" + style={{width: '90%'}} /> ) : ( <> @@ -132,24 +145,40 @@ const AdvisementForm = (props) => { }} errorAbsolute={true} /> + renderAuthIcon("phone")} + errorText={emailError} + setErrorText={setEmailError} + onBlur={() => { + onBlurField("email"); + }} + errorAbsolute={true} + /> {props.type == userConstants.ROLE_TEACHER ? ( - renderAuthIcon("phone")} - errorText={addressTeachError} - setErrorText={setAddressTeachError} - onFocus={() => setAddressTeach(addressTeach?.trim())} - onBlur={() => { - onBlurField("address"); - }} - errorAbsolute={true} - /> + // renderAuthIcon("phone")} + // errorText={addressTeachError} + // setErrorText={setAddressTeachError} + // onFocus={() => setAddressTeach(addressTeach?.trim())} + // onBlur={() => { + // onBlurField("address"); + // }} + // errorAbsolute={true} + // /> + null ) : ( { /> )} - + + {/* { }; })} errorAbsolute={true} - /> + /> */}
{ + const urlParams = new URLSearchParams(window.location.search); + const mds = urlParams.get('mds'); + const dispatch = useDispatch() // Time Advisement const [timeAdvisement, setTimeAdvisement] = useState({}); const [timeAdvisementError, setTimeAdvisementError] = useState(); @@ -130,6 +135,14 @@ export const advisementLogic = (props) => { const [errorAdviseTrial, setErrorAdviseTrial] = useState(""); + // message + const [message, setMessage] = useState(""); + + // Handle Change Address Teach for Teacher + const changeMessage = (newValue) => { + setMessage(newValue); + }; + // Variable compulsory advise trial const [compulError, setCompulError] = useState(false); @@ -198,39 +211,36 @@ export const advisementLogic = (props) => { phone && !nameUserError && !phoneWarning && - timeAdvisement?.value && - !timeAdvisementError + !!email?.trim() && + !emailError + // timeAdvisement?.value && + // !timeAdvisementError ) { - if ( - (!addressTeach && props.type == userConstants.ROLE_TEACHER) || - (!gradeSelected?.value && props.type != userConstants.ROLE_TEACHER) - ) { - setAddressTeachError("Vui lòng nhập thông tin."); - setGradeError("Vui lòng nhập thông tin."); - } else { try { - let [from_time, end_time] = timeAdvisement?.value.split("-"); - + // let [from_time, end_time] = timeAdvisement?.value.split("-"); const data = { - user_name: nameUser, + agents_code: mds, + guest_name: nameUser, phone, - from_time, - end_time, - grade_id: gradeSelected?.value, - school: addressTeach, - source: "advise", - role: props.type, + grade: gradeSelected?.title, + email, + message + // from_time, + // end_time, + // school: addressTeach, + // source: "advise", + // role: props.type, }; const result = await sendMsgContact(data); if (result.status) { - // setIsSuccess(true); setIsSuccessRegist(true); + } else { + dispatch(alertActions.error({ 'message': typeof result?.msg === 'string' ? result?.msg : Object.values(result?.msg)?.join('\n'), 'screen': 'form_register', isShowPopup: true })); } } catch (e) { - // console.log(e); + dispatch(alertActions.error({ 'message': e, 'screen': 'form_register', isShowPopup: true })); } - } } else { if (!nameUser) { setNameUserError("Vui lòng nhập thông tin."); @@ -238,17 +248,8 @@ export const advisementLogic = (props) => { if (!phone) { setPhoneWarning("Vui lòng nhập thông tin."); } else { - if ( - (!addressTeach && props.type == userConstants.ROLE_TEACHER) || - (!gradeSelected?.value && props.type != userConstants.ROLE_TEACHER) - ) { - setAddressTeachError("Vui lòng nhập thông tin."); - setGradeError("Vui lòng nhập thông tin."); - } else if ( - (!addressTeachError || !gradeError) && - !timeAdvisement?.value - ) { - setTimeAdvisementError("Vui lòng nhập thông tin."); + if(!email) { + setEmailError("Vui lòng nhập thông tin.") } } } @@ -454,5 +455,8 @@ export const advisementLogic = (props) => { setCompulError, setIsVisibleTime, setIsAgreePolicy, + message, + setMessage, + changeMessage }; }; diff --git a/src/_components/Alert/error.js b/src/_components/Alert/error.js index b656114..deee1dd 100644 --- a/src/_components/Alert/error.js +++ b/src/_components/Alert/error.js @@ -27,7 +27,7 @@ function AlertError(props) { return ( - */}
); diff --git a/src/_components/ScrollFixed/ScrollFixed.jsx b/src/_components/ScrollFixed/ScrollFixed.jsx index 0355e35..13243a1 100644 --- a/src/_components/ScrollFixed/ScrollFixed.jsx +++ b/src/_components/ScrollFixed/ScrollFixed.jsx @@ -4,11 +4,13 @@ import { TypeHeaderNewsItem } from "../../_constants/headerNews"; const ScrollFixed = () => { let { handleScrollTop, handleNavigate } = scrollFixedLogic(); + const urlParams = new URLSearchParams(window.location.search); + const mds = urlParams.get('mds'); return ( <>
-
handleNavigate('/'+TypeHeaderNewsItem.HOME)}> +
handleNavigate('/'+TypeHeaderNewsItem.HOME+'?mds='+mds)}> Icon phu huynh {
-
handleNavigate('/'+TypeHeaderNewsItem.PARENT)}> +
handleNavigate('/'+TypeHeaderNewsItem.PARENT+'?mds='+mds)}> Icon phu huynh
-
handleNavigate('/'+TypeHeaderNewsItem.TEACHER)}> +
handleNavigate('/'+TypeHeaderNewsItem.TEACHER+'?mds='+mds)}> Icon giao vien {
+
+ + +
+
+ GIẢI PHÁP ƯU VIỆT +
+ +
+ giúp thầy cô giảng dạy Tiếng Anh +
+ + HIỆU QUẢ + +
+
+ Slider 3 +
+
+ + + Img Bg Circle + +
+ + {/* MOBILE */} + + Img Slider Mobile +
+
+
+ GIẢI PHÁP ƯU VIỆT +
+ +
+ giúp thầy cô giảng dạy Tiếng Anh +
+ + HIỆU QUẢ + +
+ + Slider 3 + +
+ + + {/* Video Slider Teacher */} + +
+
+
- + {/* */}
{
*/} - diff --git a/src/_screens/DownloadPage/DownloadPage.jsx b/src/_screens/DownloadPage/DownloadPage.jsx index 4308d36..23e146a 100644 --- a/src/_screens/DownloadPage/DownloadPage.jsx +++ b/src/_screens/DownloadPage/DownloadPage.jsx @@ -9,6 +9,8 @@ import { history } from "../../_helpers"; const DownloadPage = () => { const { type } = useParams(); + const urlParams = new URLSearchParams(window.location.search); + const mds = urlParams.get('mds'); let { dataTeacher, dataStudent, dataParent, handleLinkApp } = downloadLogic(); @@ -59,7 +61,7 @@ const DownloadPage = () => { src="/assets/images/logo_home.png" alt="Img Logo" className="contain_image" - onClick={() => {history.push('/')}} + onClick={() => {history.push((type === 'student' ? '/' : `/${type}`) +'?mds='+mds)}} />
diff --git a/src/_services/user.js b/src/_services/user.js index aa9b0a6..e50fdd9 100644 --- a/src/_services/user.js +++ b/src/_services/user.js @@ -1,3 +1,4 @@ +import { configConstants } from "../_constants"; import { apiCaller, apiRequest } from "../_helpers"; export async function logoutAuth(deviceId) { @@ -42,10 +43,13 @@ export async function deleteAccount() { // Send Msg export function sendMsgContact(data) { return apiCaller( - `/web_advertise/api_contact/send_contact`, + `/agent/add_customer`, "POST", data, null, + true, + configConstants.API_URL_AGENT, + true, true ); }