From 69aa43b7f08b5daadb30dbb2cb8ebc0db0d86ef8 Mon Sep 17 00:00:00 2001 From: cherif Date: Tue, 14 Nov 2023 12:34:34 +0100 Subject: [PATCH] 14/11/2023 - 12h --- src/components/AddClassManual.js | 217 ++++++--- src/components/DisplayPartnerSession.js | 459 ++++++++++++++---- .../DisplayPartnerTrainingsPagination.js | 205 ++++---- src/components/GestionAdministrative.js | 402 ++++++++++----- .../components/_displaypartnersession.scss | 7 - .../_displaypartnertrainingpagination.scss | 41 ++ 6 files changed, 940 insertions(+), 391 deletions(-) diff --git a/src/components/AddClassManual.js b/src/components/AddClassManual.js index 52159eb..b13ae5c 100644 --- a/src/components/AddClassManual.js +++ b/src/components/AddClassManual.js @@ -296,12 +296,48 @@ const AddClassManual = (props) => { }); } + const [Getall_Training_Employee_No_Filter_api, setGetall_Training_Employee_No_Filter_api] = useState(); + const [Getall_Training_Employee_No_Filter_message, setGetall_Training_Employee_No_Filter_message] = useState(); + const [Getall_Training_Employee_No_Filter_result, setGetall_Training_Employee_No_Filter_result] = useState(); + function Getall_Training_Employee_No_Filter(event) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Ressource_Humaine_no_filter/"; + + + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Training_Employee_No_Filter res.data.status = " + res.data.status); + //console.log(" In Getall_Training_Employee_No_Filter res.data.message r_class = " + res.data.message); + setGetall_Training_Employee_No_Filter_api("true"); + setGetall_Training_Employee_No_Filter_result(res.data.message); + } + else { + setGetall_Training_Employee_No_Filter_api("false"); + setGetall_Training_Employee_No_Filter_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( Getall_Training_Employee_No_Filter = ', error); + setGetall_Training_Employee_No_Filter_api("false"); + alert(" Impossible de recuperer la liste des employés"); + //setmyApimyApiMessage("") + }) + } useEffect(() => { - - Get_Partner_Object_Specific_Fields("myclass"); + Get_Partner_Object_Specific_Fields("myclass"); + Getall_Training_Employee_No_Filter(); setfield_description(""); setfield_objectif(""); @@ -326,7 +362,7 @@ const AddClassManual = (props) => { setdatamodification("0"); - + window.scrollTo({ top: 0, @@ -413,6 +449,18 @@ const AddClassManual = (props) => { document.getElementsByName("trainer")[0].value = mylocaltraining.trainer; + + if (mylocaltraining.formateur_id) { + setp_formateur_id(mylocaltraining.formateur_id); + setp_formateur_label(mylocaltraining.formateur_nom_prenom); + + } else { + setp_formateur_id(""); + setp_formateur_label(""); + + } + + setmydistance(mylocaltraining.presentiel.distantiel); setmypresence(mylocaltraining.presentiel.presentiel); @@ -528,7 +576,7 @@ const AddClassManual = (props) => { Gestion des champs spécifiques. ils commencent tous par 'my_' */ - //console.log(" #### props.rows_champs_specifics = ", props.rows_champs_specifics); + //console.log(" #### props.rows_champs_specifics = ", props.rows_champs_specifics); for (let i = 0; i < rows_champs_specifics.length; i++) { var field_name = JSON.parse(rows_champs_specifics[i]).field_name; @@ -771,9 +819,9 @@ const AddClassManual = (props) => { formData.append('description', description); formData.append('trainer', trainer); + formData.append('formateur_id', p_formateur_id); formData.append('presentiel', presentiel); formData.append('domaine', domaine); - formData.append('trainer', 'trainer'); formData.append('distantiel', distentiel); formData.append('price', price); formData.append('duration', duree); @@ -1402,6 +1450,10 @@ const AddClassManual = (props) => { // -- end champs specifiques + const [p_formateur_id, setp_formateur_id] = useState(""); + const [p_formateur_label, setp_formateur_label] = useState(""); + + return (
{isLoading &&
@@ -1483,6 +1535,52 @@ const AddClassManual = (props) => { className="disabled_style" />
+
+ { + setp_formateur_id(e.target.value); + DataUpdated(); + + } + } + > + {Getall_Training_Employee_No_Filter_result && + Getall_Training_Employee_No_Filter_result.map((myclient) => ( + + {JSON.parse(myclient).nom}  {JSON.parse(myclient).prenom} + + + ))} + +
+ + {String(datamodification) === "1" &&
+ + +
}
@@ -1836,60 +1934,61 @@ const AddClassManual = (props) => { - {String(datamodification) !== String("1") && String(editor_tochange) !== String("1") &&
+ {String(datamodification) !== String("1") && String(editor_tochange) !== String("1") && String(props.mytrainingclass.ref) !== "" && +
- } className="bton_suppr2"> SUPPRIMER LA FORMATION + } className="bton_suppr2"> SUPPRIMER LA FORMATION - } - modal - nested - position="center center" - > - {close => ( -
- -
MySy Information
-
- {' '} + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} - En confirmant cette opération, la formation sera définitivement supprimée.
- Avant, assurez-vous de n'avoir aucune session rattachée à la formation. - -
-
-
- + En confirmant cette opération, la formation sera définitivement supprimée.
+ Avant, assurez-vous de n'avoir aucune session rattachée à la formation.
-
- + }}> Valider + +
+
+ +
-
- )} - + )} + -
+
} - {(String(datamodification) === String("1") || String(editor_tochange) === String("1")) &&
+ {(String(datamodification) === String("1") || String(editor_tochange) === String("1")) && String(props.mytrainingclass.ref) !== "" &&
} @@ -1897,8 +1996,8 @@ const AddClassManual = (props) => {
} {String(props.ispending) !== String("0") &&
- - datamodification = {datamodification} + + datamodification = {datamodification} {String(datamodification) === String("1") &&
ENREGISTRER
@@ -1906,13 +2005,13 @@ const AddClassManual = (props) => { {String(datamodification) === String("0") &&
- MODIFICATION 2 + MODIFICATION
}
- +
@@ -2352,17 +2451,19 @@ const AddClassManual = (props) => { - {String(datamodification) !== String("1") && String(editor_tochange) !== String("1") &&
- + {String(datamodification) !== String("1") && String(editor_tochange) !== String("1") && + String(props.mytrainingclass.ref) !== "" &&
+ -
+
} - {(String(datamodification) === String("1") || String(editor_tochange) === String("1")) &&
- + {(String(datamodification) === String("1") || String(editor_tochange) === String("1")) && + String(props.mytrainingclass.ref) !== "" &&
+ -
} +
}
} @@ -2380,7 +2481,7 @@ const AddClassManual = (props) => {
- +
diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index 3645db7..52251d2 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -221,7 +221,7 @@ const DisplayPartnerSession = (props) => { ); } }, - + { field: "delete", headerName: 'Supprimer', renderCell: (cellValues) => { @@ -871,10 +871,49 @@ const DisplayPartnerSession = (props) => { }) } + + const [Getall_Training_Employee_No_Filter_api, setGetall_Training_Employee_No_Filter_api] = useState(); + const [Getall_Training_Employee_No_Filter_message, setGetall_Training_Employee_No_Filter_message] = useState(); + const [Getall_Training_Employee_No_Filter_result, setGetall_Training_Employee_No_Filter_result] = useState(); + function Getall_Training_Employee_No_Filter(event) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Ressource_Humaine_no_filter/"; + + + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Training_Employee_No_Filter res.data.status = " + res.data.status); + //console.log(" In Getall_Training_Employee_No_Filter res.data.message r_class = " + res.data.message); + setGetall_Training_Employee_No_Filter_api("true"); + setGetall_Training_Employee_No_Filter_result(res.data.message); + } + else { + setGetall_Training_Employee_No_Filter_api("false"); + setGetall_Training_Employee_No_Filter_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( Getall_Training_Employee_No_Filter = ', error); + setGetall_Training_Employee_No_Filter_api("false"); + alert(" Impossible de recuperer la liste des employés"); + //setmyApimyApiMessage("") + }) + } + useEffect(() => { Get_Partner_Object_Specific_Fields_stagiaire(); + Getall_Training_Employee_No_Filter(); GetCurrentPartnerClass(); Getall_TrainingSession(); @@ -1733,16 +1772,6 @@ const DisplayPartnerSession = (props) => { function DownloadAttendeeDetail_one(addendeeEmail) { - - var trainer = "" - if (document.getElementsByName("formateur")[0]) - trainer = document.getElementsByName("formateur")[0].value; - - if (trainer == "") { - alert(" Aucun formateur pour cette session "); - return; - } - if (addendeeEmail == "") { alert(" Aucun utilisateur choisi "); return; @@ -2141,11 +2170,16 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair function desableSessionFields() { setedit_session_form(false); - document.getElementsByName("myclass_title")[0].disabled = true; - document.getElementsByName("myclass_title")[0].style.backgroundColor = "#ECEFF1"; - document.getElementsByName("code_session")[0].disabled = true; - document.getElementsByName("code_session")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("myclass_title") && document.getElementsByName("myclass_title")[0]) { + document.getElementsByName("myclass_title")[0].disabled = true; + document.getElementsByName("myclass_title")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("code_session") && document.getElementsByName("code_session")[0]) { + document.getElementsByName("code_session")[0].disabled = true; + document.getElementsByName("code_session")[0].style.backgroundColor = "#ECEFF1"; + } if (document.getElementsByName("session_status")[0]) { document.getElementsByName("session_status")[0].disabled = true; @@ -2157,48 +2191,86 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair document.getElementsByName("session_etape")[0].style.backgroundColor = "#ECEFF1"; } - document.getElementsByName("sessiondatedebut")[0].disabled = true; - document.getElementsByName("sessiondatedebut")[0].style.backgroundColor = "#ECEFF1"; - document.getElementsByName("sessiondatefin")[0].disabled = true; - document.getElementsByName("sessiondatefin")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("sessiondatedebut")[0]) { + document.getElementsByName("sessiondatedebut")[0].disabled = true; + document.getElementsByName("sessiondatedebut")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("adresse")[0].disabled = true; - document.getElementsByName("adresse")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("sessiosessiondatefinn_etape")[0]) { + document.getElementsByName("sessiondatefin")[0].disabled = true; + document.getElementsByName("sessiondatefin")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("code_postal")[0].disabled = true; - document.getElementsByName("code_postal")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("adresse")[0]) { + document.getElementsByName("adresse")[0].disabled = true; + document.getElementsByName("adresse")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("ville")[0].disabled = true; - document.getElementsByName("ville")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("code_postal")[0]) { + document.getElementsByName("code_postal")[0].disabled = true; + document.getElementsByName("code_postal")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("pays")[0].disabled = true; - document.getElementsByName("pays")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("ville")[0]) { + document.getElementsByName("ville")[0].disabled = true; + document.getElementsByName("ville")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("formateur")[0].disabled = true; - document.getElementsByName("formateur")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("pays")[0]) { + document.getElementsByName("pays")[0].disabled = true; + document.getElementsByName("pays")[0].style.backgroundColor = "#ECEFF1"; + } + if (document.getElementsByName("formateur")[0]) { + document.getElementsByName("formateur")[0].disabled = true; + document.getElementsByName("formateur")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("nb_participant")[0].disabled = true; - document.getElementsByName("nb_participant")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("formateur_label")[0]) { + document.getElementsByName("formateur_label")[0].disabled = true; + document.getElementsByName("formateur_label")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("prix_session")[0].disabled = true; - document.getElementsByName("prix_session")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("formateur_id")[0]) { + document.getElementsByName("formateur_id")[0].disabled = true; + document.getElementsByName("formateur_id")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("session_ondemande")[0].disabled = true; - document.getElementsByName("session_ondemande")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("nb_participant")[0]) { + document.getElementsByName("nb_participant")[0].disabled = true; + document.getElementsByName("nb_participant")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("presentiel")[0].disabled = true; - document.getElementsByName("presentiel")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("prix_session")[0]) { + document.getElementsByName("prix_session")[0].disabled = true; + document.getElementsByName("prix_session")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("distantiel")[0].disabled = true; - document.getElementsByName("distantiel")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("session_ondemande")[0]) { + document.getElementsByName("session_ondemande")[0].disabled = true; + document.getElementsByName("session_ondemande")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("sessiondatedebutinscription")[0].disabled = true; - document.getElementsByName("sessiondatedebutinscription")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("presentiel")[0]) { + document.getElementsByName("presentiel")[0].disabled = true; + document.getElementsByName("presentiel")[0].style.backgroundColor = "#ECEFF1"; + } - document.getElementsByName("sessiondatefininscription")[0].disabled = true; - document.getElementsByName("sessiondatefininscription")[0].style.backgroundColor = "#ECEFF1"; + if (document.getElementsByName("distantiel")[0]) { + document.getElementsByName("distantiel")[0].disabled = true; + document.getElementsByName("distantiel")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("sessiondatedebutinscription")[0]) { + document.getElementsByName("sessiondatedebutinscription")[0].disabled = true; + document.getElementsByName("sessiondatedebutinscription")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("sessiondatefininscription")[0]) { + document.getElementsByName("sessiondatefininscription")[0].disabled = true; + document.getElementsByName("sessiondatefininscription")[0].style.backgroundColor = "#ECEFF1"; + } // Pour les champs spécifiques @@ -2238,50 +2310,88 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair document.getElementsByName("session_etape")[0].style.backgroundColor = "#FFFFFF"; } + if (document.getElementsByName("sessiondatedebut")[0]) { + document.getElementsByName("sessiondatedebut")[0].disabled = false; + document.getElementsByName("sessiondatedebut")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("sessiondatedebut")[0].disabled = false; - document.getElementsByName("sessiondatedebut")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("sessiondatefin")[0]) { + document.getElementsByName("sessiondatefin")[0].disabled = false; + document.getElementsByName("sessiondatefin")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("sessiondatefin")[0].disabled = false; - document.getElementsByName("sessiondatefin")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("adresse")[0]) { + document.getElementsByName("adresse")[0].disabled = false; + document.getElementsByName("adresse")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("adresse")[0].disabled = false; - document.getElementsByName("adresse")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("code_postal")[0]) { + document.getElementsByName("code_postal")[0].disabled = false; + document.getElementsByName("code_postal")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("code_postal")[0].disabled = false; - document.getElementsByName("code_postal")[0].style.backgroundColor = "#FFFFFF"; - - document.getElementsByName("ville")[0].disabled = false; - document.getElementsByName("ville")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("ville")[0]) { + document.getElementsByName("ville")[0].disabled = false; + document.getElementsByName("ville")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("pays")[0].disabled = false; - document.getElementsByName("pays")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("pays")[0]) { + document.getElementsByName("pays")[0].disabled = false; + document.getElementsByName("pays")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("formateur")[0].disabled = false; - document.getElementsByName("formateur")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("formateur")[0]) { + document.getElementsByName("formateur")[0].disabled = false; + document.getElementsByName("formateur")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("nb_participant")[0].disabled = false; - document.getElementsByName("nb_participant")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("formateur_label")[0]) { + document.getElementsByName("formateur_label")[0].disabled = false; + document.getElementsByName("formateur_label")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("prix_session")[0].disabled = false; - document.getElementsByName("prix_session")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("formateur_id")[0]) { + document.getElementsByName("formateur_id")[0].disabled = false; + document.getElementsByName("formateur_id")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("session_ondemande")[0].disabled = false; - document.getElementsByName("session_ondemande")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("nb_participant")[0]) { + document.getElementsByName("nb_participant")[0].disabled = false; + document.getElementsByName("nb_participant")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("presentiel")[0].disabled = false; - document.getElementsByName("presentiel")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("prix_session")[0]) { + document.getElementsByName("prix_session")[0].disabled = false; + document.getElementsByName("prix_session")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("distantiel")[0].disabled = false; - document.getElementsByName("distantiel")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("session_ondemande")[0]) { + document.getElementsByName("session_ondemande")[0].disabled = false; + document.getElementsByName("session_ondemande")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("sessiondatedebutinscription")[0].disabled = false; - document.getElementsByName("sessiondatedebutinscription")[0].style.backgroundColor = "#FFFFFF"; + if (document.getElementsByName("presentiel")[0]) { + document.getElementsByName("presentiel")[0].disabled = false; + document.getElementsByName("presentiel")[0].style.backgroundColor = "#FFFFFF"; + } - document.getElementsByName("sessiondatefininscription")[0].disabled = false; - document.getElementsByName("sessiondatefininscription")[0].style.backgroundColor = "#FFFFFF "; + + if (document.getElementsByName("distantiel")[0]) { + document.getElementsByName("distantiel")[0].disabled = false; + document.getElementsByName("distantiel")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("sessiondatedebutinscription")[0]) { + document.getElementsByName("sessiondatedebutinscription")[0].disabled = false; + document.getElementsByName("sessiondatedebutinscription")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("sessiondatefininscription")[0]) { + document.getElementsByName("sessiondatefininscription")[0].disabled = false; + document.getElementsByName("sessiondatefininscription")[0].style.backgroundColor = "#FFFFFF "; + } // Pour les champs spécifiques for (let i = 0; i < rows_champs_specifics.length; i++) { @@ -2367,6 +2477,8 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair setp_ville(); setp_pays(); setp_formateur(); + setp_formateur_id(); + setp_formateur_label(); setp_lms_class_code(); setp_nb_participant(); setp_prix_session(); @@ -2433,6 +2545,7 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair setp_one_ville(); setp_one_pays(); setp_one_formateur(); + setp_one_formateur_id(); setp_one_lms_class_code(); setp_one_nb_participant(); setp_one_prix_session(); @@ -2582,9 +2695,7 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair if (document.getElementById("code_session") && document.getElementById("code_session").value != "") code_session = document.getElementById("code_session").value; - var formateur = ""; - if (document.getElementById("formateur") && document.getElementById("formateur").value != "") - formateur = document.getElementById("formateur").value; + @@ -2610,7 +2721,8 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair form.append("pays", ""); form.append("code_session", code_session); - form.append("formateur", formateur); + + form.append("formateur_id", p_formateur_id); form.append("date_debut_inscription", format(SessionstartDateInscription, 'dd/MM/yyyy kk:mm:ss')); form.append("date_fin_inscription", format(SessionendDateInscription, 'dd/MM/yyyy kk:mm:ss')); @@ -2804,12 +2916,10 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair if (document.getElementById("one_code_session") && document.getElementById("one_code_session").value != "") code_session = document.getElementById("one_code_session").value; - var formateur = ""; + /*var formateur = ""; if (document.getElementById("one_formateur") && document.getElementById("one_formateur").value != "") formateur = document.getElementById("one_formateur").value; - - - +*/ //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); const stored_cookie = getCookie('tokenmysypart'); @@ -2827,7 +2937,8 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair form.append("code_postal", p_one_code_postal); form.append("ville", p_one_ville); form.append("pays", p_one_pays); - form.append("formateur", p_one_formateur); + //form.append("formateur", p_one_formateur); + form.append("formateur_id", p_one_formateur_id); form.append("session_status", p_one_session_status); form.append("date_debut_inscription", format(one_SessionstartDateInscription, 'dd/MM/yyyy kk:mm:ss')); @@ -3127,11 +3238,20 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair setp_pays(mylocaltraining.pays); } - document.getElementsByName("formateur")[0].value = ""; - if (mylocaltraining.formateur) { - setp_formateur(mylocaltraining.formateur); + + + + if (mylocaltraining.formateur_id) { + setp_formateur_id(mylocaltraining.formateur_id); + setp_formateur_label(mylocaltraining.formateur_nom_prenom); + + } else { + setp_formateur_id(""); + setp_formateur_label(""); + } + if (mylocaltraining.lms_class_code) { setis_lms_class_code(mylocaltraining.lms_class_code); @@ -3231,6 +3351,8 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair const [p_ville, setp_ville] = useState(""); const [p_pays, setp_pays] = useState(""); const [p_formateur, setp_formateur] = useState(""); + const [p_formateur_id, setp_formateur_id] = useState(""); + const [p_formateur_label, setp_formateur_label] = useState(""); const [p_lms_class_code, setp_lms_class_code] = useState(""); const [p_nb_participant, setp_nb_participant] = useState(""); const [p_prix_session, setp_prix_session] = useState(""); @@ -3244,6 +3366,7 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair const [p_one_ville, setp_one_ville] = useState(""); const [p_one_pays, setp_one_pays] = useState(""); const [p_one_formateur, setp_one_formateur] = useState(""); + const [p_one_formateur_id, setp_one_formateur_id] = useState(""); const [p_one_lms_class_code, setp_one_lms_class_code] = useState(""); const [p_one_nb_participant, setp_one_nb_participant] = useState(""); const [p_one_prix_session, setp_one_prix_session] = useState(""); @@ -3721,15 +3844,6 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair function DownloadAttendeeDetail(event) { - var trainer = "" - if (document.getElementsByName("formateur")[0]) - trainer = document.getElementsByName("formateur")[0].value; - - if (trainer == "") { - alert(" Aucun formateur pour cette session "); - return; - } - const stored_cookie = getCookie('tokenmysypart'); var nom_fiche_detaillee = "Fiche_Detaillee.pdf"; @@ -5184,6 +5298,63 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair + const [Get_Class_Data_api, setGet_Class_Data_api] = useState(); + const [Get_Class_Data_message, setGet_Class_Data_message] = useState(); + const [Get_Class_Data_result, setGet_Class_Data_result] = useState(); + function Get_Class_Data(local_internal_url) { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("internal_url", local_internal_url); + + + //console.log("### form = ", form); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_Class_From_Internal_Url/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + //console.log(" In Get_Class_Data res.data.status = " + res.data.status); + //console.log(" In Get_Class_Data res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + + + setGet_Class_Data_api("true"); + setGet_Class_Data_message(res.data.message); + + if (JSON.parse(res.data.message).price) { + setp_one_prix_session(String(JSON.parse(res.data.message).price)); + + } + + if (JSON.parse(res.data.message).formateur_id) { + + setp_one_formateur_id(JSON.parse(res.data.message).formateur_id); + + } + + + } + else { + setGet_Class_Data_api("false"); + setGet_Class_Data_message(res.data.message); + + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + + console.warn('Get_Class_Data : Not good man :( Get_Class_Data = ' + error); + setGet_Class_Data_api("false"); + alert(" Impossible de récuperer les données de la formation "); + }) + + + } + function Delete_file_1_name() { setfile_1_name(); } @@ -5860,13 +6031,12 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair className="datagridclass" onRowDoubleClick={(newSelectionModel) => { - alert(" ok"); - console.log(" ### newSelectionModel.row = ", newSelectionModel.row); - handleClick_edit_session_From_Line(newSelectionModel.row.id); - + + handleClick_edit_session_From_Line(newSelectionModel.row.id); + }} - + rowsPerPageOptions={[10]} disableSelectionOnClick @@ -6538,7 +6708,7 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair />
-
Formateur
+ {/*
Formateur
setp_formateur(e.target.value)} /> -
+
*/} + + {!edit_session_form &&
Formateur
+ + +
} + + {edit_session_form &&
Formateur
+ { + setp_formateur_id(e.target.value); + IssessionChanged(); + + } + } + + > + {Getall_Training_Employee_No_Filter_result && + Getall_Training_Employee_No_Filter_result.map((myclient) => ( + + {JSON.parse(myclient).nom}  {JSON.parse(myclient).prenom} + + + ))} + + +
} @@ -6600,9 +6821,6 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair
- - -
{!fields1desabled &&
Choisir un modèle d'attestation : @@ -6759,9 +6977,10 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair className="disabled_style enable_style" value={p_one_myclass_title} onChange={(e) => { - console.log(" e.target = ", e.target); + setone_selected_internal_url(e.target.value); setp_one_myclass_title(e.target.value) + Get_Class_Data(e.target.value); }} > @@ -7055,7 +7274,7 @@ Update du 22/10/2023 - Gestion des champs spécifiques ajoutés par le partenair -
Formateur
+ {/*
Formateur
setp_one_formateur(e.target.value)} /> +
*/} + +
Formateur
+ { + setp_one_formateur_id(e.target.value); + + } + } + > + {Getall_Training_Employee_No_Filter_result && + Getall_Training_Employee_No_Filter_result.map((myclient) => ( + + {JSON.parse(myclient).nom}  {JSON.parse(myclient).prenom} + + + ))} +
diff --git a/src/components/DisplayPartnerTrainingsPagination.js b/src/components/DisplayPartnerTrainingsPagination.js index 920992e..1fd3409 100644 --- a/src/components/DisplayPartnerTrainingsPagination.js +++ b/src/components/DisplayPartnerTrainingsPagination.js @@ -778,7 +778,7 @@ const DistplayPartnerTraningsPage = (props) => { //console.log('Success:', result['message'], "result['status'] = ", result['status']); if (String(result['status']) === String("true")) { - alert(String(result['message'])) + alert(String(result['message'])) } }) @@ -1464,18 +1464,6 @@ const DistplayPartnerTraningsPage = (props) => {
 

- - - {!createtraining &&
- - - -
} -
{String(myApiResponse) === "False" &&
@@ -1483,107 +1471,122 @@ const DistplayPartnerTraningsPage = (props) => {
} - {String(myApiResponse) === "True" &&
-   + {String(myApiResponse) === "True" && +
+   + {!createtraining &&
- Formation   + ajout session + - }} - > - { - setSelectionModel(newSelectionModel); - //console.log("ch selected--" + newSelectionModel); - }} - selectionModel={selectionModel} - localeText={frFR.components.MuiDataGrid.defaultProps.localeText} - rows={rowss.map((item, index) => ( +
} +
+
+ ]+)>)/ig, '')), - domain: JSON.parse(item).domaine, - metier: JSON.parse(item).metier, - url: JSON.parse(item).url, - price: JSON.parse(item).price, - description: parse((JSON.parse(item).description).replace(/(<([^>]+)>)/ig, '')), - published: JSON.parse(item).published, - lms_class_code: JSON.parse(item).lms_class_code, - } - ))} + }} + > + { + setSelectionModel(newSelectionModel); + //console.log("ch selected--" + newSelectionModel); + }} + selectionModel={selectionModel} + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={rowss.map((item, index) => ( + + { + id: index, + _id: JSON.parse(item)._id, + internal_url: JSON.parse(item).internal_url, + zone_diffusion: JSON.parse(item).zone_diffusion_str, + external_code: JSON.parse(item).external_code, + title: parse((JSON.parse(item).title).replace(/(<([^>]+)>)/ig, '')), + domain: JSON.parse(item).domaine, + metier: JSON.parse(item).metier, + url: JSON.parse(item).url, + price: JSON.parse(item).price, + description: parse((JSON.parse(item).description).replace(/(<([^>]+)>)/ig, '')), + published: JSON.parse(item).published, + lms_class_code: JSON.parse(item).lms_class_code, + } + ))} - columns={columns} - pageSize={10} - className="datagridclass" + columns={columns} + pageSize={10} + className="datagridclass" - onRowDoubleClick={(newSelectionModel) => { - setreftrainingtoupdate(newSelectionModel.row.internal_url); - setexternalcodetraining_toupdate(newSelectionModel.row.external_code); - setupdatetraining(true); + onRowDoubleClick={(newSelectionModel) => { + Closecreatetraining(); + closeTrainingForm(); - } - } + setreftrainingtoupdate(newSelectionModel.row.internal_url); + setexternalcodetraining_toupdate(newSelectionModel.row.external_code); + setupdatetraining(true); - rowsPerPageOptions={[10]} - //disableSelectionOnClick - components={{ - Toolbar: GridToolbar, - }} - sx={datagridSx} - getCellClassName={(params) => { - if (params.field === 'published' && String(params.value) === "1") { - return 'cell--published'; - } + } + } - if (params.field === "published" && String(params.value) !== "1") { - return 'cell--unpublished' - } + rowsPerPageOptions={[10]} + //disableSelectionOnClick + components={{ + Toolbar: GridToolbar, + }} + sx={datagridSx} + getCellClassName={(params) => { + if (params.field === 'published' && String(params.value) === "1") { + return 'cell--published'; + } - }} - getRowClassName={(params) => { - if (String(params.row.published) === "1") { - return 'line--published'; - } + if (params.field === "published" && String(params.value) !== "1") { + return 'cell--unpublished' + } - if (String(params.row.published) !== "1") { - return 'line--unpublished'; - } - }} + }} + getRowClassName={(params) => { + if (String(params.row.published) === "1") { + return 'line--published'; + } - /> - + if (String(params.row.published) !== "1") { + return 'line--unpublished'; + } + }} + /> + +
+
-
} +
}

@@ -1608,10 +1611,10 @@ const DistplayPartnerTraningsPage = (props) => { Action    Publier   Dépublier   - Dupliquer   + Dupliquer   Supprimer   - + {actionmass_ftion_val &&
+ +
Formateur
{ + setp_detail_one_formateur(e.target.value); + } + } - /> + > + {Getall_Training_Employee_No_Filter_result && + Getall_Training_Employee_No_Filter_result.map((myclient) => ( + + {JSON.parse(myclient).nom}  {JSON.parse(myclient).prenom} + + + ))} +
-
Nombre participants *
-
Formateur
+ + + {fields1desabled &&
Formateur
-
+
} + + {!fields1desabled &&
Formateur
+ { + setp_detail_formateur_id(e.target.value); + IssessionChanged(); + + } + } + + > + {Getall_Training_Employee_No_Filter_result && + Getall_Training_Employee_No_Filter_result.map((myclient) => ( + + {JSON.parse(myclient).nom}  {JSON.parse(myclient).prenom} + + + ))} + + +
} diff --git a/src/styles/components/_displaypartnersession.scss b/src/styles/components/_displaypartnersession.scss index 10e66a0..5aa5744 100644 --- a/src/styles/components/_displaypartnersession.scss +++ b/src/styles/components/_displaypartnersession.scss @@ -217,8 +217,6 @@ border-radius: 10px; margin-top: 10px; margin-bottom: 10px; - - } .session_caract { @@ -776,7 +774,6 @@ margin-top: 10px; margin-bottom: 10px; - } .session_caract { @@ -1363,8 +1360,6 @@ border-radius: 10px; margin-top: 10px; margin-bottom: 10px; - - } .session_caract { @@ -1845,8 +1840,6 @@ border-radius: 10px; margin-top: 10px; margin-bottom: 10px; - - } .session_caract { diff --git a/src/styles/components/_displaypartnertrainingpagination.scss b/src/styles/components/_displaypartnertrainingpagination.scss index 8720b45..31127e0 100644 --- a/src/styles/components/_displaypartnertrainingpagination.scss +++ b/src/styles/components/_displaypartnertrainingpagination.scss @@ -460,6 +460,16 @@ width: 8%; } + .session_data { + float: left; + width: 100%; + box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.5); + border-radius: 10px; + margin-top: 10px; + margin-bottom: 10px; + } + } @media only screen and (min-width: 601px) and (max-width: 991px) { @@ -881,6 +891,17 @@ width: 8%; } + .session_data { + float: left; + width: 100%; + box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.5); + border-radius: 10px; + margin-top: 10px; + margin-bottom: 10px; + + } + } @media only screen and (min-width: 992px) and (max-width: 1199px) { @@ -1303,6 +1324,16 @@ width: 8%; } + .session_data { + float: left; + width: 100%; + box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.5); + border-radius: 10px; + margin-top: 10px; + margin-bottom: 10px; + } + } @media only screen and (min-width: 1200px) { @@ -1721,6 +1752,16 @@ width: 10%; } + .session_data { + float: left; + width: 100%; + box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.5); + border-radius: 10px; + margin-top: 10px; + margin-bottom: 10px; + } + } // end media