diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index 115c0cc..cfa0360 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -4612,7 +4612,7 @@ const DisplayPartnerSession = (props) => { Actif   } - {!edit_session_form && String(p_session_status) === "1" &&
Statut a *
+ {!edit_session_form && String(p_session_status) === "1" &&
Statut *
{ />
} - {!edit_session_form && String(p_session_status) === "0" &&
Statut a *
+ {!edit_session_form && String(p_session_status) === "0" &&
Statut *
{ { field: 'domaine', headerName: 'Domaine', width: datagrid_columns_size_model2, align: "center", hide: true, hideable: true, }, { field: 'date_debut', headerName: 'Du', width: datagrid_columns_size_model1, hideable: true, }, { field: 'date_fin', headerName: 'Au', width: datagrid_columns_size_model1, hideable: true, }, - { + /* { field: "Detail", headerName: 'Voir detail', renderCell: (cellValues) => { return ( @@ -139,7 +139,7 @@ const DisplayPartnerStagiaires = (props) => { ); } - }, + },*/ { field: "Imprimer", headerName: 'Imprimer detail', renderCell: (cellValues) => { @@ -231,6 +231,7 @@ const DisplayPartnerStagiaires = (props) => { const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); + //console.log(" ### Getall_TrainingParticipant form = ", form) var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Statgaire_List_Partner_with_filter/"; @@ -238,8 +239,8 @@ const DisplayPartnerStagiaires = (props) => { axios.post(myurl, form).then(res => { if (String(res.data.status) === String("true")) { - console.log(" In Getall_TrainingParticipant res.data.status = " + res.data.status); - console.log(" In Getall_TrainingParticipant res.data.message r_class = " + res.data.message); + //console.log(" In Getall_TrainingParticipant res.data.status = " + res.data.status); + //console.log(" In Getall_TrainingParticipant res.data.message r_class = " + res.data.message); setGetall_TrainingParticipant_api("true"); setGetall_TrainingParticipant_result(res.data.message); setRows(res.data.message); @@ -247,11 +248,13 @@ const DisplayPartnerStagiaires = (props) => { else { setGetall_TrainingParticipant_api("false"); setGetall_TrainingParticipant_message(res.data.message); + alert(res.data.message); } }).catch((error) => { console.warn('Not good man :( Getall_TrainingParticipant = ', error); setGetall_TrainingParticipant_api("false"); + alert(" Impossible de recuperer la liste des stagiaires") //setmyApimyApiMessage("") }) } @@ -330,10 +333,14 @@ const DisplayPartnerStagiaires = (props) => { GetAttendee_Data(participant_email, session_id, internal_url); - // Recuperation de l'image de profiel + // Recuperation de l'image de profil getStagiaireImages(internal_url, session_id, participant_email); + // Recuperation des informations de la session + GetCurrentSession(session_id, internal_url); + + } const datagridSx = { @@ -476,11 +483,19 @@ const DisplayPartnerStagiaires = (props) => { const [print_detail_insc, setprint_detail_insc] = React.useState(); function Print_Detail_Inscription(event, cellValues) { - setprint_detail_insc("1") + setprint_detail_insc("1"); - var email = cellValues.row.email; - setselectedattendeeemail(email); - DownloadAttendeeDetail(); + var code_session = cellValues.row.code_session; + + var session_id = cellValues.row.session_id; + + var internal_url = cellValues.row.class_internal_url; + + var participant_email = cellValues.row.email; + + + + DownloadAttendeeDetail(session_id, participant_email, internal_url ); } function clearDetailAttendeFields() { @@ -787,23 +802,14 @@ const DisplayPartnerStagiaires = (props) => { const [userimgclassprofilchanged, setuserimgclassprofilchanged] = useState(""); - function DownloadAttendeeDetail(event) { + function DownloadAttendeeDetail(local_session_id, local_email, local_internal_url) { - 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"; - var url = process.env.REACT_APP_API_URL + "myclass/api/PrintAttendeeDetail_perSession/" + stored_cookie + "/" + selected_code_session + "/" + selectedattendeeemail + "/" + selected_internal_url; + var url = process.env.REACT_APP_API_URL + "myclass/api/PrintAttendeeDetail_perSession/" + stored_cookie + "/" + local_session_id + "/" + local_email + "/" + local_internal_url; axios.get(url, { responseType: 'blob', },) @@ -1101,24 +1107,11 @@ const DisplayPartnerStagiaires = (props) => { const [attendee_lms_login, setattendee_lms_login] = useState(); - function submenu_preinscrit() { - setsubmenu("preinscrit"); - - if (document.getElementById("preinscrit")) { - document.getElementById("preinscrit").style.backgroundColor = "#104277"; - document.getElementById("preinscrit").style.color = "white"; - } - - if (document.getElementById("detail_session")) { - document.getElementById("detail_session").style.backgroundColor = "red"; - document.getElementById("detail_session").style.color = "black"; - } - - if (document.getElementById("inscrit")) { - document.getElementById("inscrit").style.backgroundColor = "#d8edfc"; - document.getElementById("inscrit").style.color = "black"; - } + function submenu_sessions() { + setsubmenu("sessions"); + setdisplay_detail_stagiaire(); + desableSessionFields(); } const [SendEvaluationEmail_api, setSendEvaluationEmail_api] = useState(); @@ -1448,6 +1441,8 @@ const DisplayPartnerStagiaires = (props) => { const [rowss_preinsc, setRows_preinsc] = useState([]); + + useEffect(() => { Getall_TrainingParticipant(); Getall_TrainingSession(); @@ -1458,18 +1453,7 @@ const DisplayPartnerStagiaires = (props) => { setdatagrid_columns_size_model2(10); } - const listener = event => { - console.log(" event ", event); - if (event.key === "Enter" || event.code === "NumpadEnter") { - console.log(" event 22", event); - event.preventDefault(); - console.log(" event 33 event.keyCode", event.keyCode); - Getall_TrainingParticipant(); - console.log(" event 44 event.keyCode", event.keyCode); - - } - }; - document.addEventListener("keydown", listener); + }, []) @@ -1532,7 +1516,34 @@ const DisplayPartnerStagiaires = (props) => { const [p_one_detail_client_rattachement_nom, setp_one_detail_client_rattachement_nom] = useState(); const [p_one_detail_client_rattachement_id, setp_one_detail_client_rattachement_id] = useState(); + //---- + const [p_myclass_title, setp_myclass_title] = useState(""); + const [p_code_session, setp_code_session] = useState(""); + const [p_adresse, setp_adresse] = useState(""); + const [p_code_postal, setp_code_postal] = useState(""); + const [p_ville, setp_ville] = useState(""); + const [p_pays, setp_pays] = useState(""); + const [p_formateur, setp_formateur] = 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(""); + + const [p_session_ondemande, setp_session_ondemande] = useState("0"); + const [p_session_ondemande_label, setp_session_ondemande_label] = useState(""); + + const [p_session_distance, setp_session_distance] = useState("0"); + const [p_session_distance_label, setp_session_distance_label] = useState(""); + + const [p_session_presentiel, setp_session_presentiel] = useState("0"); + const [p_session_presentiel_label, setp_session_presentiel_label] = useState(""); + + const [p_session_status, setp_session_status] = useState(); + const [p_session_status_label, setp_session_status_label] = useState(); + + + const [p_session_etape, setp_session_etape] = useState(); + const [p_session_etape_label, setp_session_etape_label] = useState(); // Cette fonction remplit la zone detail de la personne inscrite const [GetAttendee_api, setGetAttendee_api] = useState(); @@ -1710,7 +1721,7 @@ const DisplayPartnerStagiaires = (props) => { disableAttendeeDetailFields(); - }else{ + } else { alert("Aucune donnée récuperée "); } @@ -2136,6 +2147,447 @@ const DisplayPartnerStagiaires = (props) => { setp_one_formation(event.target.value); } + const [SessionendDateInscription, setSessionendDateInscription] = useState(); + + function clearSessionFields() { + + if (document.getElementsByName("sessiondatedebut")[0]) + document.getElementsByName("code_session")[0].value = ""; + + if (document.getElementsByName("sessiondatedebut")[0]) + document.getElementsByName("sessiondatedebut")[0].value = ""; + + if (document.getElementsByName("sessiondatefin")[0]) + document.getElementsByName("sessiondatefin")[0].value = ""; + + if (document.getElementsByName("session_status")[0]) + document.getElementsByName("session_status")[0].value = ""; + + if (document.getElementsByName("session_etape")[0]) + document.getElementsByName("session_etape")[0].value = ""; + + + + if (document.getElementsByName("adresse")[0]) + document.getElementsByName("adresse")[0].value = ""; + + if (document.getElementsByName("code_postal")[0]) + document.getElementsByName("code_postal")[0].value = ""; + + if (document.getElementsByName("ville")[0]) + document.getElementsByName("ville")[0].value = ""; + + + if (document.getElementsByName("pays")[0]) + document.getElementsByName("pays")[0].value = ""; + + if (document.getElementsByName("nb_participant")[0]) + document.getElementsByName("nb_participant")[0].value = ""; + + if (document.getElementsByName("prix_session")[0]) + document.getElementsByName("prix_session")[0].value = ""; + + if (document.getElementsByName("presentiel")[0]) + document.getElementsByName("presentiel")[0].value = ""; + + if (document.getElementsByName("session_ondemande")[0]) + document.getElementsByName("session_ondemande")[0].value = ""; + + if (document.getElementsByName("distantiel")[0]) + document.getElementsByName("distantiel")[0].value = ""; + + if (document.getElementsByName("sessiondatedebutinscription")[0]) + document.getElementsByName("sessiondatedebutinscription")[0].value = ""; + + if (document.getElementsByName("sessiondatefininscription")[0]) + document.getElementsByName("sessiondatefininscription")[0].value = ""; + + setSessionstartDateInscription(); + setSessionendDateInscription(); + setSessionendDate(); + setSessionstartDate(); + + setfield_contenu_ftion(); + + + setp_myclass_title(); + setp_code_session(); + setp_adresse(); + setp_ville(); + setp_pays(); + setp_formateur(); + setp_lms_class_code(); + setp_nb_participant(); + setp_prix_session(); + setp_session_etape_label(); + setp_session_etape(); + setp_session_status_label(); + setp_session_status(); + setp_session_presentiel_label(); + setp_session_presentiel(); + setp_session_distance_label(); + setp_session_distance(); + setp_session_ondemande_label(); + setp_session_ondemande(); + + + + } + + let [sessionStatus, setsessionStatus] = useState(false); + const [selectedCertif, setselectedCertif] = useState(); + const [GetCurrentSession_id, setGetCurrentSession_id] = useState(); + + const [urlpreview_certif, seturlpreview_certif] = useState(); + + const [GetSpecificAttestation_Certif_api, setGetSpecificAttestation_Certif_api] = useState(); + const [GetSpecificAttestation_Certif_message, setGetSpecificAttestation_Certif_message] = useState(); + const [GetSpecificAttestation_Certif_result, setGetSpecificAttestation_Certif_result] = useState(); + function GetSpecificAttestation_Certif(nom) { + clean_old_messages(); + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("nom", nom); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetSpecificPartnerAttestation_Certificat/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === "true") { + //console.log(" In GetSpecificAttestation_Certif res.data.status = " + res.data.status); + //console.log(" In GetSpecificAttestation_Certif res.data.message r_class = " + res.data.message); + setGetSpecificAttestation_Certif_api("true"); + setGetSpecificAttestation_Certif_result(res.data.message); + + var mylocal = JSON.parse(res.data.message); + //console.log(" #### (mylocal.preview_url = ", mylocal.preview_url); + 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"); + setGetSpecificAttestation_Certif_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetSpecificAttestation_Certif = ', error); + setGetSpecificAttestation_Certif_api("false"); + + }) + } + + + const [GetCurrentSession_api, setGetCurrentSession_api] = useState(); + const [GetCurrentSession_message, setGetCurrentSession_message] = useState(); + const [GetCurrentSession_result, setGetCurrentSession_result] = useState(); + function GetCurrentSession(local_session_id, local_selected_internal_url) { + + clean_old_messages(); + clearSessionFields(); + + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("class_internal_url", local_selected_internal_url); + form.append("session_id", local_session_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetSessionFormation/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === "true") { + console.log(" In GetCurrentSession res.data.status = " + res.data.status); + console.log(" In GetCurrentSession res.data.message r_class = " + res.data.message); + console.log(" In GetCurrentSession res.data.message len = " + String(res.data.message).length); + + setGetCurrentSession_api("true"); + if (String(res.data.message).length > 0) { + setGetCurrentSession_result(res.data.message); + var mylocaltraining = JSON.parse(res.data.message); + + if (mylocaltraining._id) { + setGetCurrentSession_id(mylocaltraining._id); + } + + if (mylocaltraining.session_status) { + setp_session_status(mylocaltraining.session_status); + if (String(mylocaltraining.session_status) === "1") + setp_session_status_label("Actif"); + else + setp_session_status_label("Inactif"); + } + + if (mylocaltraining.session_etape) { + setp_session_etape(mylocaltraining.session_etape); + if (String(mylocaltraining.session_etape) === "0") + setp_session_etape_label("Projet"); + else if (String(mylocaltraining.session_etape) === "1") + setp_session_etape_label("Planification"); + else if (String(mylocaltraining.session_etape) === "2") + setp_session_etape_label("Planifiée"); + else if (String(mylocaltraining.session_etape) === "3") + setp_session_etape_label("Terminée"); + else if (String(mylocaltraining.session_etape) === "4") + setp_session_etape_label("Facturée"); + else if (String(mylocaltraining.session_etape) === "-1") + setp_session_etape_label("Annulée"); + + } else { + + + setp_session_etape_label("Projet"); + setp_session_etape("0"); + } + + + + if (mylocaltraining.date_debut) { + //var date_du = new Date(moment(mylocaltraining.date_debut, "DD/MM/YYYY HH:mm:ss")); + setSessionstartDate(String(mylocaltraining.date_debut).substring(0, 10)); + } + + if (mylocaltraining.date_fin) { + + setSessionendDate(String(mylocaltraining.date_fin).substring(0, 10)); + } + + if (mylocaltraining.date_debut_inscription) { + + setSessionstartDateInscription(String(mylocaltraining.date_debut_inscription).substring(0, 10)); + + } + + if (mylocaltraining.date_fin_inscription) { + + setSessionendDateInscription(String(mylocaltraining.date_fin_inscription).substring(0, 10)); + } + + if (mylocaltraining.attestation_certif) { + setselectedCertif(mylocaltraining.attestation_certif); + GetSpecificAttestation_Certif(mylocaltraining.attestation_certif); + + } + + + if (mylocaltraining.myclass[0].title) + setp_myclass_title(mylocaltraining.myclass[0].title); + + + + if (mylocaltraining.code_session) + setp_code_session(mylocaltraining.code_session); + + + if (mylocaltraining.nb_participant) + setp_nb_participant(mylocaltraining.nb_participant); + + + if (mylocaltraining.prix_session) + setp_prix_session(mylocaltraining.prix_session); + + if (mylocaltraining.distantiel) { + setp_session_distance(mylocaltraining.distantiel); + if (String(mylocaltraining.distantiel) === "1") + setp_session_distance_label("Oui"); + else + setp_session_distance_label("Non") + } + + + if (mylocaltraining.session_ondemande) { + setp_session_ondemande(mylocaltraining.session_ondemande); + if (String(mylocaltraining.session_ondemande) === "1") + setp_session_ondemande_label("Oui"); + else + setp_session_ondemande_label("Non") + + } + + if (mylocaltraining.presentiel) { + setp_session_presentiel(mylocaltraining.presentiel); + if (String(mylocaltraining.presentiel) === "1") + setp_session_presentiel_label("Oui"); + else + setp_session_presentiel_label("Non") + } + + if (mylocaltraining.contenu_ftion) + setfield_contenu_ftion(mylocaltraining.contenu_ftion); + + + + + if (mylocaltraining.adresse) + setp_adresse(mylocaltraining.adresse); + + + if (mylocaltraining.ville) { + setp_ville(mylocaltraining.ville); + } + + + if (mylocaltraining.ville) { + setp_pays(mylocaltraining.pays); + } + + + if (mylocaltraining.formateur) { + setp_formateur(mylocaltraining.formateur); + } + + + if (mylocaltraining.lms_class_code) { + + setis_lms_class_code(mylocaltraining.lms_class_code); + } + + + if (mylocaltraining.code_postal) + setp_code_postal(mylocaltraining.code_postal); + + + if (String(mylocaltraining.session_status) === "true") + setsessionStatus(true); + else if (String(mylocaltraining.session_status) === "false") + setsessionStatus(false); + + + if (myRef.current) { + myRef.current.scrollIntoView({ behavior: "smooth" }); + } + } + + } 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); + alert("Erreur : " + res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetCurrentSession = ', error); + setGetCurrentSession_api("false"); + + }) + } + + + function desableSessionFields() { + + if (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")[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; + document.getElementsByName("session_status")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("session_etape")[0]) { + document.getElementsByName("session_etape")[0].disabled = true; + document.getElementsByName("session_etape")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("sessiondatedebut")[0]) { + document.getElementsByName("sessiondatedebut")[0].disabled = true; + document.getElementsByName("sessiondatedebut")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("sessiondatefin")[0]) { + document.getElementsByName("sessiondatefin")[0].disabled = true; + document.getElementsByName("sessiondatefin")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("adresse")[0]) { + document.getElementsByName("adresse")[0].disabled = true; + document.getElementsByName("adresse")[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"; + } + + if (document.getElementsByName("ville")[0]) { + document.getElementsByName("ville")[0].disabled = true; + document.getElementsByName("ville")[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"; + } + + + if (document.getElementsByName("lms_class_code")[0]) { + document.getElementsByName("lms_class_code")[0].disabled = true; + document.getElementsByName("lms_class_code")[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"; + } + + if (document.getElementsByName("prix_session")[0]) { + document.getElementsByName("prix_session")[0].disabled = true; + document.getElementsByName("prix_session")[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"; + } + + if (document.getElementsByName("presentiel")[0]) { + document.getElementsByName("presentiel")[0].disabled = true; + document.getElementsByName("presentiel")[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"; + } + + setfields1desabled(true); + + } return (
{
 
- - +
@@ -3763,6 +4214,359 @@ const DisplayPartnerStagiaires = (props) => {
} + + {String(submenu) === "sessions" && selected_code_session &&
+ +
+
Formation
+ + + +
+
Code Session
+ +
+ + +
Session à la demande*
+ + +
+ +
Statut *
+ +
+ +
Etape *
+ + + +
+ +
+ Date Debut + + + +
+ +
Date Fin + + + +
+ +
Date Debut des inscriptions * + + + +
+ + +
Date Fin des inscriptions * + + + +
+ +
Présentiel *
+ + +
+ +
A distance*
+ + +
+ +
Adresse
+ +
+
Code postal
+ +
+
Ville
+ +
+ +
Pays
+ +
+ +
Formateur
+ +
+ +
Code Formation LMS + (le code créé dans le LMS) + +
+ + +
Nombre participants *
+ +
+ +
Prix session
+ +
+ + +
+ +
} + + +
diff --git a/src/components/Employes.js b/src/components/Employes.js index 1a19a08..f005f3b 100644 --- a/src/components/Employes.js +++ b/src/components/Employes.js @@ -45,6 +45,9 @@ const Employes = (props) => { const [rowss, setRows] = useState([]); const [selectionModel, setSelectionModel] = React.useState([]); + const [rows_affectations, setrows_affectations] = useState([]); + const [selectionModel_affectations, setSelectionModel_affectations] = React.useState([]); + const [p_filtre1, setp_filtre1] = useState(); const [p_filtre1_value, setp_filtre1_value] = useState(); @@ -93,24 +96,24 @@ const Employes = (props) => { { field: 'profil', headerName: 'profil', width: 150, hide: false, editable: true }, { field: 'fonction', headerName: 'Fonction', width: 150, hide: false, editable: true }, - { - field: "Detail", headerName: 'Voir detail', - renderCell: (cellValues) => { - return ( - - - - ); - } - }, + /* { + field: "Detail", headerName: 'Voir detail', + renderCell: (cellValues) => { + return ( + + + + ); + } + },*/ { field: "delete", headerName: 'Supprimer', renderCell: (cellValues) => { @@ -174,6 +177,16 @@ const Employes = (props) => { ] + const columns_employee_affectation = [ + { field: '_id', headerName: '_id', hide: true }, + { field: 'id', headerName: 'id', hide: true }, + { field: 'poste', headerName: 'Poste', width: 150, hideable: false, }, + { field: 'date_du', headerName: 'Du', width: 150, hide: false, editable: true }, + { field: 'date_au', headerName: 'Au', width: 150, hide: false, editable: true }, + { field: 'target_related_collection', headerName: 'Type', width: 150, hide: false, editable: true }, + { field: 'target_related_collection_id', headerName: 'Type ID', width: 150, hide: false, editable: true }, + + ] function clean_all_filters() { setp_filtre1(); setp_filtre1_value(); @@ -223,6 +236,8 @@ const Employes = (props) => { const [selected_employe_email, setselected_employe_email] = useState(""); function handleClick_edit_session_From_Line(selected_row_id) { + submenu_detail_employe(); + var line = JSON.parse(rowss[selected_row_id]); //console.log("### line = ", line); @@ -238,6 +253,8 @@ const Employes = (props) => { if (myRef.current) { myRef.current.scrollIntoView({ behavior: "smooth" }); } + + Getall_Employee_Affectation(employe_id); } @@ -565,11 +582,13 @@ const Employes = (props) => { 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("") }) } @@ -645,6 +664,45 @@ const Employes = (props) => { } + const [Getall_Employee_Affectation_api, setGetall_Employee_Affectation_api] = useState(); + const [Getall_Employee_Affectation_message, setGetall_Employee_Affectation_message] = useState(); + const [Getall_Employee_Affectation_result, setGetall_Employee_Affectation_result] = useState(); + function Getall_Employee_Affectation(local_employe_id) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("rh_id", local_employe_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Ressource_Humaine_Affectation/"; + + + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Employee_Affectation res.data.status = " + res.data.status); + //console.log(" In Getall_Employee_Affectation res.data.message r_class = " + res.data.message); + setGetall_Employee_Affectation_api("true"); + setGetall_Employee_Affectation_result(res.data.message); + setrows_affectations(res.data.message); + } + else { + setGetall_Employee_Affectation_api("false"); + setGetall_Employee_Affectation_message(res.data.message); + alert(res.data.message) + } + + }).catch((error) => { + console.warn('Not good man :( Getall_Employee_Affectation = ', error); + setGetall_Employee_Affectation_api("false"); + alert(" Impossible de recuperer les affectations de l'employé"); + //setmyApimyApiMessage("") + }) + } + function disable_Employee_DetailFields() { setemployee_data_edit_mode("0"); @@ -1381,6 +1439,96 @@ const Employes = (props) => { hiddenFileInput_session.current.click(); } + + const sleep = (milliseconds) => { + return new Promise(resolve => setTimeout(resolve, milliseconds)) + } + + async function submenu_detail_employe() { + setsubmenu("detail_employe"); + + await sleep(5); + /*if (!edit_session_form) { + desableSessionFields(); + }*/ + + if (document.getElementById("detail_employe")) { + document.getElementById("detail_employe").style.backgroundColor = "#104277"; + document.getElementById("detail_employe").style.color = "white"; + } + + if (document.getElementById("droit_acces")) { + document.getElementById("droit_acces").style.backgroundColor = "#d8edfc"; + document.getElementById("droit_acces").style.color = "black"; + } + + if (document.getElementById("affectation")) { + document.getElementById("affectation").style.backgroundColor = "#d8edfc"; + document.getElementById("affectation").style.color = "black"; + } + + //console.log(" ### employee_data_edit_mode = ", employee_data_edit_mode); + if (String(employee_data_edit_mode) !== "1") + disable_Employee_DetailFields(); + + } + + + async function submenu_affectation() { + setsubmenu("affectation"); + + await sleep(5); + /*if (!edit_session_form) { + desableSessionFields(); + }*/ + + if (document.getElementById("affectation")) { + document.getElementById("affectation").style.backgroundColor = "#104277"; + document.getElementById("affectation").style.color = "white"; + } + + if (document.getElementById("detail_employe")) { + document.getElementById("detail_employe").style.backgroundColor = "#d8edfc"; + document.getElementById("detail_employe").style.color = "black"; + } + + if (document.getElementById("droit_acces")) { + document.getElementById("droit_acces").style.backgroundColor = "#d8edfc"; + document.getElementById("droit_acces").style.color = "black"; + } + + + } + + + + async function submenu_droit_acces() { + setsubmenu("droit_acces"); + + await sleep(5); + /*if (!edit_session_form) { + desableSessionFields(); + }*/ + + if (document.getElementById("droit_acces")) { + document.getElementById("droit_acces").style.backgroundColor = "#104277"; + document.getElementById("droit_acces").style.color = "white"; + } + + if (document.getElementById("detail_employe")) { + document.getElementById("detail_employe").style.backgroundColor = "#d8edfc"; + document.getElementById("detail_employe").style.color = "black"; + } + + if (document.getElementById("affectation")) { + document.getElementById("affectation").style.backgroundColor = "#d8edfc"; + document.getElementById("affectation").style.color = "black"; + } + + + } + + return (
{ > Email   Nom   - + @@ -1899,9 +2047,10 @@ const Employes = (props) => {
 
- - - + + + +
@@ -1909,7 +2058,7 @@ const Employes = (props) => { - {String(display_detail_employe) === "1" && String(add_One_Employee) !== "1" &&
+ {String(submenu) === "detail_employe" && String(add_One_Employee) !== "1" &&
@@ -2445,7 +2594,7 @@ const Employes = (props) => { - {String(display_detail_employe) !== "1" && String(add_One_Employee) === "1" &&
+ {String(submenu) === "detail_employe" && String(add_One_Employee) === "1" &&
@@ -2853,9 +3002,150 @@ const Employes = (props) => { -
+ {String(submenu) === "affectation" &&
-
+
+
+ +
+   + + { + setSelectionModel_affectations(newSelectionModel); + /*if (newSelectionModel.length === 1) + handleClick_edit_session_From_Line(newSelectionModel); + if (newSelectionModel.length === 0) { + setdisplay_detail_employe(); + setadd_One_Employee(); + }*/ + }} + selectionModel={selectionModel_affectations} + + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={rows_affectations.map((item, index) => ( + { + id: index, + _id: JSON.parse(item)._id, + poste: JSON.parse(item).poste, + date_du: JSON.parse(item).date_du, + date_au: JSON.parse(item).date_au, + target_related_collection: JSON.parse(item).target_related_collection, + target_related_collection_id: JSON.parse(item).target_related_collection_id, + + + } + ))} + + columns={columns_employee_affectation} + pageSize={10} + className="datagridclass" + + rowsPerPageOptions={[10]} + //disableSelectionOnClick + components={{ + Toolbar: GridToolbar, + }} + //sx={datagridSx} + getCellClassName={(params) => { + //field === 'distantiel' + if (params.field === 'distantiel' && String(params.value) === "1") { + return 'cell--distantiel'; + } + if (params.field === "presentiel" && String(params.value) == "1") { + return 'cell--presentiel'; + } + + + //field === "statut" + if (params.field === "status" && String(params.value) == "0") { + return 'cell--statut--preinscrit'; + } + + if (params.field === "status" && String(params.value) == "1") { + return 'cell--statut--inscrit'; + } + + if (params.field === "status" && String(params.value) == "-1") { + return 'cell--statut--annule'; + } + + }} + getRowClassName={(params) => { + + if (String(params.row.status) === "-1") { + return 'line--statut--annule'; + } + if (String(params.row.status) === "0") { + return 'line--statut--preinscrit'; + } + if (String(params.row.status) === "1") { + return 'line--statut--inscrit'; + } + }} + + + /> + +
+ +
+ +
+ +
+
} + + {String(submenu) === "droit_acces" &&
+ +
} +
); diff --git a/src/components/Partner_Client.js b/src/components/Partner_Client.js index 718d64c..f689fce 100644 --- a/src/components/Partner_Client.js +++ b/src/components/Partner_Client.js @@ -61,8 +61,9 @@ const Partner_Client = (props) => { { field: 'id', headerName: 'id', hide: true }, { field: 'email', headerName: 'email', width: 100, hideable: false, flex: 1 }, { field: 'nom', headerName: 'nom', width: 100, hide: false, editable: true, flex: 1 }, + - { + /*{ field: "update", headerName: 'Modifier', renderCell: (cellValues) => { return ( @@ -75,7 +76,7 @@ const Partner_Client = (props) => { ); } - }, + },*/ { field: "delete", headerName: 'Supprimer', renderCell: (cellValues) => {