From ff461ba20a109f7781a86163880ebceb74006b3c Mon Sep 17 00:00:00 2001 From: cherif Date: Fri, 7 Jul 2023 16:12:46 +0200 Subject: [PATCH] 07/07/23 - 16h --- src/components/GestionAdministrative.js | 279 +++++++++++++++--------- src/components/Recherche_new_v2.js | 92 ++++++-- src/components/SignIn.js | 59 +++-- src/styles/components/_signin.scss | 31 ++- 4 files changed, 311 insertions(+), 150 deletions(-) diff --git a/src/components/GestionAdministrative.js b/src/components/GestionAdministrative.js index 38f8af3..a6d157f 100644 --- a/src/components/GestionAdministrative.js +++ b/src/components/GestionAdministrative.js @@ -415,12 +415,15 @@ function GestionAdministrative(props) { var myurl = process.env.REACT_APP_API_URL + "myclass/api/UpdateUserEmargementDate/"; axios.post(myurl, form).then(res => { - if (String(res.data.status) !== "false") { + if (String(res.data.status) === String("true")) { //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); setUpdateStagiaireEmargement_api("true"); setUpdateStagiaireEmargement_result(res.data.message); GetListeEmargement(mysession); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setUpdateStagiaireEmargement_api("false"); @@ -477,12 +480,15 @@ function GestionAdministrative(props) { var myurl = process.env.REACT_APP_API_URL + "myclass/api/UpdateUserEmargementDate/"; axios.post(myurl, form).then(res => { - if (String(res.data.status) !== "false") { + if (String(res.data.status) === String("true")) { //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); setUpdateStagiaireEmargement_api("true"); setUpdateStagiaireEmargement_result(res.data.message); GetListeEmargement(mysession); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setUpdateStagiaireEmargement_api("false"); @@ -744,7 +750,7 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { - if (res.data.status != "false") { + if (res.data.status === String("true")) { //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); setUpdateStagiaireData_api("true"); @@ -792,7 +798,7 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { - if (res.data.status != "false") { + if (res.data.status === String("true")) { //console.log(" In GetCurrentClass res.data.status = " + res.data.status); //console.log(" In GetCurrentClass res.data.message r_class = " + res.data.message); setGetCurrentClass_api("true"); @@ -812,6 +818,9 @@ function GestionAdministrative(props) { + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setGetCurrentClass_api("false"); @@ -852,13 +861,17 @@ function GestionAdministrative(props) { //console.log('Success:', data['message'], "data['status'] = ", data['status']); setGetListePreinscrit_result(data['message']); setRows(data['message']); - if (String(data['status']) === String("false")) { - //console.log("erreur rrrr:" + data['status']) - setGetListePreinscrit_api("false"); + if (String(data['status']) === String("Err_Connexion")) { + alert('Erreur: ' + data['message']); + history.push("/Connexion"); + } + else if (String(data['status']) === String("true")) { + setGetListePreinscrit_api("true"); } else { - setGetListePreinscrit_api("true"); + //console.log("erreur rrrr:" + data['status']) + setGetListePreinscrit_api("false"); } @@ -883,7 +896,7 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { - if (res.data.status != "false") { + if (String(res.data.status) === String("true")) { //console.log(" In GetCurrentClass_trainingsession res.data.status = " + res.data.status); //console.log(" In GetCurrentClass_trainingsession res.data.message r_class = " + res.data.message); setGetCurrentClass_trainingsession_api("true"); @@ -935,7 +948,7 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { - if (String(res.data.status) === "true") { + if (String(res.data.status) === String("true")) { //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); setSendInscriptionCancell_api("true"); @@ -947,6 +960,9 @@ function GestionAdministrative(props) { GetListeEvaluation(mysession); submenu_inscrit(); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setSendInscriptionCancell_api("false"); @@ -986,12 +1002,15 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { - if (res.data.status != "false") { + if (String(res.data.status) === String("true")) { //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); setSendInscriptionConfirmation_api("true"); setSendInscriptionConfirmation_result(res.data.message); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setSendInscriptionConfirmation_api("false"); @@ -1039,6 +1058,9 @@ function GestionAdministrative(props) { //console.log("erreur rrrr:" + data['status']) setGetListePreinscrit_insc_api("false"); + } else if (String(data['status']) === String("Err_Connexion")) { + alert('Erreur: ' + data['message']); + history.push("/Connexion"); } else { setGetListePreinscrit_insc_api("true"); @@ -1079,15 +1101,18 @@ function GestionAdministrative(props) { //console.log('Success:', data['message'], "data['status'] = ", data['status']); setGetListePreinscrit_emarg_result(data['message']); setRows_emarg(data['message']); - if (String(data['status']) === String("false")) { + if (String(data['status']) === String("Err_Connexion")) { + alert('Erreur: ' + data['message']); + history.push("/Connexion"); + } + else if (String(data['status']) === String("true")) { + setGetListePreinscrit_emarg_api("true"); + + } else { //console.log("erreur rrrr:" + data['status']) setGetListePreinscrit_emarg_api("false"); } - else { - setGetListePreinscrit_emarg_api("true"); - - } }).catch((error) => { console.error('Error:', error); @@ -1123,15 +1148,18 @@ function GestionAdministrative(props) { //console.log('GetListeEvaluation -- Success:', data['message'], "data['status'] = ", data['status']); setGetListePreinscrit_evaluation_result(data['message']); setRows_evaluation(data['message']); - if (String(data['status']) === String("false")) { + if (String(data['status']) === String("Err_Connexion")) { + alert('Erreur: ' + data['message']); + history.push("/Connexion"); + } + else if (String(data['status']) === String("true")) { + setGetListePreinscrit_evaluation_api("true"); + + } else { //console.log("GetListeEvaluation rrrr:" + data['status']) setGetListePreinscrit_evaluation_api("false"); } - else { - setGetListePreinscrit_evaluation_api("true"); - - } }).catch((error) => { console.error('Error:', error); @@ -1150,7 +1178,7 @@ function GestionAdministrative(props) { window.scrollTo({ top: 0, behavior: "smooth", - }); + }); }, []); @@ -1169,7 +1197,7 @@ function GestionAdministrative(props) { setSendInscriptionConfirmation_api(); setreduction_session("0"); - console.log(" reduction_session = ", reduction_session); + //console.log(" reduction_session = ", reduction_session); /* if (String(reduction_session) === "1") setreduction_session("0"); @@ -1253,13 +1281,16 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { - if (String(res.data.status) !== "false") { + if (String(res.data.status) === String("true")) { //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); setCreateListEmargement_api("true"); setCreateListEmargement_result(res.data.message); GetListeEmargement(mysession); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setCreateListEmargement_api("false"); @@ -1422,13 +1453,16 @@ function GestionAdministrative(props) { //console.log(" In CreateSessionFormation res.data.status = " + res.data.status); //console.log(" In CreateSessionFormation res.data.message r_class = " + res.data.message); - if (String(res.data.status) !== "false") { + if (String(res.data.status) === String("true")) { setCreateSessionFormation_api("true"); setCreateSessionFormation_result(res.data.message); setsessionChanged(false); desableSessionFields(); GetCurrentClass_trainingsession(); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setCreateSessionFormation_api("false"); @@ -1611,7 +1645,7 @@ function GestionAdministrative(props) { //console.log(" In One_CreateSessionFormation res.data.status = " + res.data.status); //console.log(" In One_CreateSessionFormation res.data.message r_class = " + res.data.message); - if (String(res.data.status) !== "false") { + if (String(res.data.status) === String("true")) { setone_CreateSessionFormation_api("true"); setone_CreateSessionFormation_result(res.data.message); setsessionChanged(false); @@ -1621,6 +1655,9 @@ function GestionAdministrative(props) { setaddOneSession(); setreduction_session("1"); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setone_CreateSessionFormation_api("false"); @@ -1759,7 +1796,11 @@ function GestionAdministrative(props) { } + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } + else { setGetCurrentSession_api("false"); setGetCurrentSession_message(res.data.message); @@ -2310,11 +2351,14 @@ function GestionAdministrative(props) { var myurl = process.env.REACT_APP_API_URL + "myclass/api/EmargementMail/"; axios.post(myurl, form).then(res => { - if (String(res.data.status) !== "false") { + if (String(res.data.status) === String("true")) { //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); setActionMassListEmargement_api("true"); setActionMassListEmargement_result(res.data.message); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setActionMassListEmargement_api("false"); @@ -2467,6 +2511,7 @@ function GestionAdministrative(props) { formData.append("token", stored_cookie); formData.append("session_id", mysession); + formData.append("class_internal_url", internal_url); //console.log("token = " + stored_cookie); fetch( @@ -2903,7 +2948,11 @@ function GestionAdministrative(props) { } + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } + else { setGetAttendee_api("false"); setGetAttendee_message(res.data.message); @@ -2964,6 +3013,10 @@ function GestionAdministrative(props) { setGetAttestation_Certif_api("true"); setGetAttestation_Certif_result(res.data.message); } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } else { setGetAttestation_Certif_api("false"); setGetAttestation_Certif_message(res.data.message); @@ -3003,6 +3056,10 @@ function GestionAdministrative(props) { seturlpreview_certif(mylocal.preview_url); + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setGetSpecificAttestation_Certif_api("false"); @@ -3055,12 +3112,15 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { - if (String(res.data.status) == "true") { + if (String(res.data.status) === String("true")) { //console.log(" In SendEvaluationEmail res.data.status = " + res.data.status); //console.log(" In SendEvaluationEmail res.data.message r_class = " + res.data.message); setSendEvaluationEmail_api("true"); setSendEvaluationEmail_result(res.data.message); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setSendEvaluationEmail_api("false"); @@ -3088,12 +3148,15 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { - if (String(res.data.status) == "true") { + if (String(res.data.status) === String("true")) { //console.log(" In SendEvaluationEmail res.data.status = " + res.data.status); //console.log(" In SendEvaluationEmail res.data.message r_class = " + res.data.message); setSendEvaluationEmail_api("true"); setSendEvaluationEmail_result(res.data.message); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setSendEvaluationEmail_api("false"); @@ -3123,12 +3186,15 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { - if (String(res.data.status) == "true") { + if (String(res.data.status) === String("true")) { //console.log(" In SendAttendeeAttestation res.data.status = " + res.data.status); //console.log(" In SendAttendeeAttestation res.data.message r_class = " + res.data.message); setSendAttendeeAttestation_api("true"); setSendAttendeeAttestation_result(res.data.message); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setSendAttendeeAttestation_api("false"); @@ -3532,7 +3598,7 @@ function GestionAdministrative(props) { //console.log(" In One_Create_Participant res.data.status = " + res.data.status); //console.log(" In One_Create_Participant res.data.message r_class = " + res.data.message); - if (String(res.data.status) === "true") { + if (String(res.data.status) === String("true")) { setOne_Create_Participant_api("true"); setOne_Create_Participant_result(res.data.message); alert(" Le participant a été correctement ajouté"); @@ -3544,6 +3610,9 @@ function GestionAdministrative(props) { GetListeEvaluation(mysession); submenu_inscrit(); + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); } else { setOne_Create_Participant_api("false"); @@ -3756,46 +3825,46 @@ function GestionAdministrative(props) { /> - -
Date Debut des inscriptions * - { - setone_SessionstartDateInscription(date); - setsessionChanged(true); - } - } - showTimeSelect={false} - //filterTime={filterPassedTime_start} - dateFormat="dd/MM/yyyy" - className="disabled_style enable_style" - locale='fr-FR' +
Date Debut des inscriptions * + { + setone_SessionstartDateInscription(date); + setsessionChanged(true); + } - /> -
+ } + showTimeSelect={false} + //filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="disabled_style enable_style" + locale='fr-FR' + + /> +
-
Date Fin des inscriptions * - { - setone_SessionendDateInscription(date); - setsessionChanged(true); - } - } - showTimeSelect={false} - //filterTime={filterPassedTime_end} - dateFormat="dd/MM/yyyy" - className="disabled_style enable_style" - /> -
+
Date Fin des inscriptions * + { + setone_SessionendDateInscription(date); + setsessionChanged(true); + } + } + showTimeSelect={false} + //filterTime={filterPassedTime_end} + dateFormat="dd/MM/yyyy" + className="disabled_style enable_style" + /> +
Présentiel* (0 = Non, 1 = Oui)
@@ -3941,7 +4010,7 @@ function GestionAdministrative(props) {
- +
Choisir un modèle d'attestation : @@ -4180,47 +4249,47 @@ function GestionAdministrative(props) { />
- -
Date Debut des inscriptions * - { - setSessionstartDateInscription(date); - setsessionChanged(true); - } - } - showTimeSelect={false} - //filterTime={filterPassedTime_start} - dateFormat="dd/MM/yyyy" - className="disabled_style" - locale='fr-FR' +
Date Debut des inscriptions * + { + setSessionstartDateInscription(date); + setsessionChanged(true); + } - /> -
+ } + showTimeSelect={false} + //filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy" + className="disabled_style" + locale='fr-FR' + + /> +
-
Date Fin des inscriptions * - { - setSessionendDateInscription(date); - setsessionChanged(true); - } - } - showTimeSelect={false} - //filterTime={filterPassedTime_end} - dateFormat="dd/MM/yyyy" - className="disabled_style" - /> -
- +
Date Fin des inscriptions * + { + setSessionendDateInscription(date); + setsessionChanged(true); + } + } + showTimeSelect={false} + //filterTime={filterPassedTime_end} + dateFormat="dd/MM/yyyy" + className="disabled_style" + /> +
+
Présentiel *(0 = Non, 1 = Oui)
{ @@ -1797,7 +1798,7 @@ const Recherche_new_v2 = () => { function getClassByMetier(my_liste_metier) { - if( NewSearchText && NewSearchText.length > 2){ + if (NewSearchText && NewSearchText.length > 2) { alert(" Réinitialiser les filtres pour utiliser cette fonctionalité"); return; } @@ -2528,19 +2529,24 @@ const Recherche_new_v2 = () => { } - function init_Filter_Change_url(){ + function init_Filter_Change_url() { history.push("/"); window.location.reload(); - /* window.scrollTo({ - top: 0, - behavior: "smooth", - });*/ + /* window.scrollTo({ + top: 0, + behavior: "smooth", + });*/ + + } + + function message_to_init_Filter_Change_url() { + alert(" Réinitialiser les filtres pour réactivier cette fonctionnalité") } - + return ( @@ -3288,16 +3294,16 @@ const Recherche_new_v2 = () => { {NewSearchText &&
-
+
Recherhe pour : "{NewSearchText}"
- -
-
- -
-
- Réinitaliser les filtres + +
+
+ +
+
+ Réinitaliser les filtres
@@ -3305,9 +3311,65 @@ const Recherche_new_v2 = () => {
+
+
+ +
+
+ Management
+
+ +
+ +
+
+
+ +
+
+ +
+
+ Informatique
+
+ +
+ +
+
+
+ +
+
+ +
+
+ Graphisme
+
+ +
+ +
+
+
+ +
+
+
+ + +
+
+ Afficher plus de métiers +
+ +
+
+
} + + {!NewSearchText &&
diff --git a/src/components/SignIn.js b/src/components/SignIn.js index 527bba9..fbc3e13 100644 --- a/src/components/SignIn.js +++ b/src/components/SignIn.js @@ -22,6 +22,9 @@ import Header from "./Header"; import { useLocation } from "react-router-dom"; import Visibility from '@mui/icons-material/Visibility'; import VisibilityOff from '@mui/icons-material/VisibilityOff'; +import 'react-tooltip/dist/react-tooltip.css' +import { Tooltip } from 'react-tooltip' + function SignIn() { const [isconnected, setisconnected] = useState(""); @@ -41,6 +44,7 @@ function SignIn() { const { obj, objid } = useParams(); const [menucompte, setmenucompte] = useState("partner"); const [currentpawdvisible, setcurrentpawdvisible] = useState(false); + const [typecompte, settypecompte] = useState(""); const { register, @@ -280,21 +284,15 @@ function SignIn() { form.append("email", mymail); - // controle de la cle secrete - // on verifie juste que la clé fait plus de 5 caractère - var cle_secrete = "" - if (document.getElementsByName("resetemailvalueclesecrete") && document.getElementsByName("resetemailvalueclesecrete")[0]) { - cle_secrete = document.getElementsByName("resetemailvalueclesecrete")[0].value; - if (cle_secrete.length < 5) { - alert("la clé secrete est incorrecte"); - return; - } - form.append("secrete", cle_secrete); + // Controle du type de compte + if( String(typecompte) !== "partner" && String(typecompte) !== "user"){ + alert("Le type de compte est inconnu"); + document.getElementsByName("is_user_or_pro")[0].style.backgroundColor = "orangered"; + return; } - - - + form.append("account_type", typecompte); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/InitUserPasswd/"; @@ -460,7 +458,7 @@ function SignIn() { + style={{ "float": "left", "textAlign": "center", "height": "3rem" }}>Organisme de formation
@@ -505,13 +503,16 @@ function SignIn() { Verifiez votre boite email.
}
- {String(initpasswd) !== String("true") && String(closepopup) !== String("1") && Mot de passe oublié} position="center" className="signin popup-reset-pwd">
+
Modifier le mot de passe
+
- +
- {String(menucompte) === String("partner") && -
+ +
Je ne suis pas un robot
diff --git a/src/styles/components/_signin.scss b/src/styles/components/_signin.scss index 6e10d36..5a3537d 100644 --- a/src/styles/components/_signin.scss +++ b/src/styles/components/_signin.scss @@ -1,6 +1,7 @@ .signin-content { @media only screen and (max-width: 600px) { - width: 16rem !important; + width: 17rem !important; + height: 20rem !important; .popup-reset-pwd-content { top: 10% !important; @@ -12,6 +13,8 @@ background: white !important; color: black !important; margin: 0px !important; + margin-left: auto; + margin-right: auto; } .text_pwd_crit { @@ -38,16 +41,18 @@ } .zone_mail { - width: 15rem; + width: 100%; font-size: small; border-radius: 0px; border-width: 2px; color: #3b3e40; + height: 2.5rem !important; } } @media only screen and (min-width: 601px) and (max-width: 991px) { - width: 20rem !important; + width: 21rem !important; + height: 20rem !important; .popup-reset-pwd-content { top: 30% !important; @@ -58,6 +63,8 @@ font-size: small !important; background: white !important; color: black !important; + margin-left: auto; + margin-right: auto; } .text_pwd_crit { @@ -84,16 +91,18 @@ } .zone_mail { - width: 15rem; + width: 100%; font-size: small; border-radius: 0px; border-width: 2px; color: #3b3e40; + height: 2.5rem !important; } } @media only screen and (min-width: 992px) and (max-width: 1199px) { width: 21rem !important; + height: 20rem !important; .popup-reset-pwd-content { top: 30% !important; @@ -104,6 +113,8 @@ font-size: small !important; background: white !important; color: black !important; + margin-left: auto; + margin-right: auto; } .text_pwd_crit { @@ -130,16 +141,18 @@ } .zone_mail { - width: 15rem; + width: 100%; font-size: small; border-radius: 0px; border-width: 2px; color: #3b3e40; + height: 2.5rem !important; } } @media only screen and (min-width: 1200px) { - width: 21rem !important; + width: 22rem !important; + height: 20rem !important; .popup-reset-pwd-content { top: 30% !important; @@ -151,6 +164,8 @@ background: white !important; color: black !important; padding: 0.5rem; + margin-left: auto; + margin-right: auto; } .text_pwd_crit { @@ -177,11 +192,12 @@ } .zone_mail { - width: 15rem; + width: 100%; font-size: small; border-radius: 0px; border-width: 2px; color: #3b3e40; + height: 2.5rem !important; } } } @@ -1167,6 +1183,7 @@ margin: 0.4rem !important; height: 1.8rem !important; } + .label_pwd_div { width: 100%; }