From de6101e1147fb2ea66b7b60325301101b624b853 Mon Sep 17 00:00:00 2001 From: cherif Date: Mon, 21 Aug 2023 20:42:34 +0200 Subject: [PATCH] 21/08/23 - 21h --- src/components/DisplayPartnerSession.js | 1151 +++++++++++++++----- src/components/DisplayPartnerStagiaires.js | 15 +- src/components/GestionAdministrative.js | 179 ++- 3 files changed, 1039 insertions(+), 306 deletions(-) diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index 44a1966..c9353f2 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -32,7 +32,11 @@ import { Typography, LinearProgress } from '@mui/material'; import styled from 'styled-components'; import { CiTrash } from "react-icons/ci"; import { MdAddCircleOutline, MdRemoveCircleOutline } from "react-icons/md"; - +import Dialog from '@mui/material/Dialog'; +import DialogActions from '@mui/material/DialogActions'; +import DialogContent from '@mui/material/DialogContent'; +import DialogContentText from '@mui/material/DialogContentText'; +import DialogTitle from '@mui/material/DialogTitle'; const DisplayPartnerSession = (props) => { const history = useHistory(); @@ -658,13 +662,48 @@ const DisplayPartnerSession = (props) => { GetListeInscrit(line._id, line.class_internal_url); } + const [Get_List_Partner_Clients_api, setGet_List_Partner_Clients_api] = useState(); + const [Get_List_Partner_Clients_message, setGet_List_Partner_Clients_message] = useState(); + const [Get_List_Partner_Clients_result, setGet_List_Partner_Clients_result] = useState(); + function Get_List_Partner_Clients(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_Partner_List_Partner_Client/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Get_List_Partner_Clients res.data.status = " + res.data.status); + //console.log(" In Get_List_Partner_Clients res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setGet_List_Partner_Clients_api("true"); + setGet_List_Partner_Clients_result(res.data.message); + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setGet_List_Partner_Clients_api("false"); + setGet_List_Partner_Clients_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( Get_List_Partner_Clients = ', error); + setGet_List_Partner_Clients_api("false"); + //setmyApimyApiMessage("") + }) + } useEffect(() => { GetCurrentPartnerClass(); Getall_TrainingSession(); GetAttestation_Certif(); - + Get_List_Partner_Clients(); let windowWidth = window.innerWidth; if (windowWidth < 1001) { setdatagrid_columns_size_model2(10); @@ -1498,13 +1537,11 @@ const DisplayPartnerSession = (props) => { const [UpdateStagiaireData_api, setUpdateStagiaireData_api] = useState(); const [UpdateStagiaireData_message, setUpdateStagiaireData_message] = useState(); const [UpdateStagiaireData_result, setUpdateStagiaireData_result] = useState(); - function UpdateStagiaireData(nom, prenom, email, status, price, opco, modefinancement, employeur, comment, _id) { - - setSendInscriptionCancell_api(); + function Update_One_StagiaireData() { var form = new FormData(); //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); - if (selected_code_session.length <= 0) { + if (p_detail_session_class.length <= 0) { alert(" Vous devez choisir une session"); return; } @@ -1512,55 +1549,80 @@ const DisplayPartnerSession = (props) => { form.append("token", stored_cookie); form.append("class_internal_url", selected_internal_url); form.append("session_id", selected_session_id); - form.append("nom", nom); - form.append("prenom", prenom); - form.append("email", email); - form.append("employeur", employeur); - form.append("status", status); - form.append("price", price); - form.append("opco", opco); - form.append("modefinancement", modefinancement); - form.append("comment", comment); - form.append("_id", _id); + form.append("nom", p_detail_nom); + form.append("prenom", p_detail_prenom); + form.append("email", p_detail_mail); + + if (p_detail_employeur) + form.append("employeur", p_detail_employeur); + else + form.append("employeur", ""); + + form.append("status", p_detail_status_inscrit); + + if (p_detail_cout) + form.append("price", p_detail_cout); + else + form.append("price", ""); + + if (p_detail_mode_fin) + form.append("modefinancement", p_detail_mode_fin); + else + form.append("modefinancement", ""); + + + if (p_detail_opco) + form.append("opco", p_detail_opco); + else + form.append("opco", ""); + + form.append("_id", selected_inscription_id); + if (p_detail_client_rattachement_nom) + form.append("client_rattachement_id", p_detail_client_rattachement_nom); + else + form.append("client_rattachement_id", ""); + + console.log(" form == ", form); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/UpdateStagiairetoClass/"; - console.log(" form = ", form); - axios.post(myurl, form).then(res => { - //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); - //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); + console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); + console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); if (String(res.data.status) === String("true")) { setUpdateStagiaireData_api("true"); setUpdateStagiaireData_result(res.data.message); - GetListePreinscrit(selected_session_id, selected_internal_url); - GetListeInscrit(selected_session_id, selected_internal_url); - - setretval_ch("1"); - alert(" La mise à jour été correctement faite."); + setparticipant_data_changed(); Getall_TrainingSession(); + disableAttendeeDetailFields(); + setparticipant_data_changed(); + setparticipant_data_edit_mode(); + GetAttendee_Data(p_detail_mail, selected_session_id); + alert(" La mise à jour été correctement faite."); + + + //myRef_head.current.scrollIntoView({ behavior: "smooth" }); + } else { setUpdateStagiaireData_api("false"); setUpdateStagiaireData_message(res.data.message); - setretval_ch("-1"); alert(res.data.message); - } }).catch((error) => { console.warn('UpdateStagiaireData : Not good man :( mysearchtext = ' + error); setUpdateStagiaireData_api("false"); - setretval_ch("-1"); alert(" Impossible de mettre à jour le participant"); }) } - const [SendInscriptionCancell_api, setSendInscriptionCancell_api] = useState(); const [SendInscriptionCancell_message, setSendInscriptionCancell_message] = useState(); const [SendInscriptionCancell_result, setSendInscriptionCancell_result] = useState(); @@ -2874,6 +2936,65 @@ const DisplayPartnerSession = (props) => { UpdateStagiaireData(nom, prenom, email, status, montant, opco, modefinancement, employeur, "", _id); } + + function UpdateStagiaireData(nom, prenom, email, status, price, opco, modefinancement, employeur, comment, object_id) { + + setSendInscriptionCancell_api(); + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("class_internal_url", selected_internal_url); + form.append("session_id", selected_session_id); + form.append("nom", nom); + form.append("prenom", prenom); + form.append("email", email); + form.append("employeur", employeur); + form.append("status", status); + form.append("price", price); + form.append("opco", opco); + form.append("modefinancement", modefinancement); + form.append("comment", comment); + form.append("_id", object_id); + + form.append("client_rattachement_id", p_detail_client_rattachement_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/UpdateStagiairetoClass/"; + + axios.post(myurl, form).then(res => { + //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); + //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setUpdateStagiaireData_api("true"); + setUpdateStagiaireData_result(res.data.message); + GetListePreinscrit(selected_session_id); + GetListeInscrit(selected_session_id); + + setretval_ch("1"); + alert(" La mise à jour été correctement faite.") + } + else { + setUpdateStagiaireData_api("false"); + setUpdateStagiaireData_message(res.data.message); + setretval_ch("-1"); + alert(res.data.message); + + } + + }).catch((error) => { + + console.warn('UpdateStagiaireData : Not good man :( mysearchtext = ' + error); + setUpdateStagiaireData_api("false"); + setretval_ch("-1"); + alert(" Impossible d'ajouter le participant") + + }) + } + + function handleClick_update_data(event, cellValues) { @@ -2971,7 +3092,7 @@ const DisplayPartnerSession = (props) => { } - + const [selected_inscription_id, setselected_inscription_id] = useState(""); function Display_Detail_Inscription(event, cellValues) { clearDetailAttendeFields(); setdisplay_detail_insc("1") @@ -2980,6 +3101,8 @@ const DisplayPartnerSession = (props) => { var nom = cellValues.row.nom; var email = cellValues.row.email; setselectedattendeeemail(email); + + setselected_inscription_id(cellValues.row._id); var prenom = cellValues.row.prenom; GetAttendee_Data(email, selected_session_id); getStagiaireImages(selected_internal_url, selected_session_id, email,); @@ -3080,7 +3203,7 @@ const DisplayPartnerSession = (props) => { const [GetAttendee_api, setGetAttendee_api] = useState(); const [GetAttendee_message, setGetAttendee_message] = useState(); const [GetAttendee_result, setGetAttendee_result] = useState(); - function GetAttendee_Data(attendee_email, session_id) { + function GetAttendee_Data(attendee_email, session_id, ) { clean_old_messages(); var form = new FormData(); @@ -3095,10 +3218,11 @@ const DisplayPartnerSession = (props) => { axios.post(myurl, form).then(res => { if (String(res.data.status) === "true") { - //console.log(" In GetAttendee res.data.status = " + res.data.status); - //console.log(" In GetAttendee res.data.message r_class = " + res.data.message); + console.log(" In GetAttendee res.data.status = " + res.data.status); + console.log(" In GetAttendee res.data.message r_class = " + res.data.message); setGetAttendee_api("true"); setGetAttendee_result(res.data.message); + var mylocalattendee = JSON.parse(res.data.message); @@ -3108,58 +3232,89 @@ const DisplayPartnerSession = (props) => { } + document.getElementsByName("detail_session")[0].value = ""; + if (mylocalattendee.code_session) + setp_detail_session_class(mylocalattendee.code_session); + + if (mylocalattendee.session_id) + setp_detail_session_class_id(mylocalattendee.session_id); + + + document.getElementsByName("detail_status_inscript")[0].value = ""; + if (mylocalattendee.status) { + setp_detail_status_inscrit(mylocalattendee.status); + if (String(mylocalattendee.status) === "1") + setp_detail_status_inscrit_label("Inscrit"); + else if (String(mylocalattendee.status) === "0") + setp_detail_status_inscrit_label("Preinsc."); + else if (String(mylocalattendee.status) === "-1") + setp_detail_status_inscrit_label("Annulé"); + } + + document.getElementsByName("detail_opco")[0].value = ""; + if (mylocalattendee.opco) + setp_detail_opco(mylocalattendee.opco); + + + document.getElementsByName("detail_client_rattachement")[0].value = ""; + if (mylocalattendee.client_rattachement_id) { + setp_detail_client_rattachement_id(mylocalattendee.client_rattachement_id); + setp_detail_client_rattachement_nom(mylocalattendee.client_rattachement_nom); + + } + document.getElementsByName("detail_nom")[0].value = ""; if (mylocalattendee.nom) - document.getElementsByName("detail_nom")[0].value = mylocalattendee.nom; + setp_detail_nom(mylocalattendee.nom); document.getElementsByName("detail_prenom")[0].value = ""; if (mylocalattendee.prenom) - document.getElementsByName("detail_prenom")[0].value = mylocalattendee.prenom; + setp_detail_prenom(mylocalattendee.prenom); document.getElementsByName("detail_mail")[0].value = ""; if (mylocalattendee.email) { - document.getElementsByName("detail_mail")[0].value = mylocalattendee.email; + setp_detail_mail(mylocalattendee.email); setattendee_lms_login(mylocalattendee.email); } document.getElementsByName("detail_tel")[0].value = ""; if (mylocalattendee.telephone) { - document.getElementsByName("detail_tel")[0].value = mylocalattendee.telephone; + setp_detail_tel(mylocalattendee.telephone); } document.getElementsByName("detail_adresse")[0].value = ""; if (mylocalattendee.adresse) { - document.getElementsByName("detail_adresse")[0].value = mylocalattendee.adresse; + setp_detail_adresse(mylocalattendee.adresse); } document.getElementsByName("detail_code_postal")[0].value = ""; if (mylocalattendee.code_postal) { - document.getElementsByName("detail_code_postal")[0].value = mylocalattendee.code_postal; + setp_detail_code_postal(mylocalattendee.code_postal); } document.getElementsByName("detail_ville")[0].value = ""; if (mylocalattendee.ville) { - document.getElementsByName("detail_ville")[0].value = mylocalattendee.ville; + setp_detail_ville(mylocalattendee.ville); } document.getElementsByName("detail_cout")[0].value = ""; if (mylocalattendee.price) { - document.getElementsByName("detail_cout")[0].value = mylocalattendee.price; + setp_detail_cout(mylocalattendee.price); } document.getElementsByName("detail_mode_fin")[0].value = ""; if (mylocalattendee.modefinancement) { - document.getElementsByName("detail_mode_fin")[0].value = mylocalattendee.modefinancement; + setp_detail_mode_fin(mylocalattendee.modefinancement); } document.getElementsByName("detail_employeur")[0].value = ""; if (mylocalattendee.employeur) { - document.getElementsByName("detail_employeur")[0].value = mylocalattendee.employeur; + setp_detail_employeur(mylocalattendee.employeur); } document.getElementsByName("date_evaluation")[0].value = ""; @@ -3169,7 +3324,7 @@ const DisplayPartnerSession = (props) => { setdetailuser_date_evaluation(date_eval); } - document.getElementsByName("date_evaluation")[0].value = ""; + document.getElementsByName("certif_date")[0].value = ""; if (mylocalattendee.certification_send_date) { //alert(" certification_send_date = ", mylocalattendee.certification_send_date); @@ -3181,7 +3336,7 @@ const DisplayPartnerSession = (props) => { document.getElementsByName("note_eval")[0].value = ""; if (mylocalattendee.eval_note) { - document.getElementsByName("note_eval")[0].value = mylocalattendee.eval_note; + setp_note_eval(mylocalattendee.eval_note); } @@ -3194,7 +3349,7 @@ const DisplayPartnerSession = (props) => { setattendee_lms_pwd("xxxxxx"); } - desableAttendeeDetailFields(); + var myelement; if (document.getElementById('ajout_participant')) { @@ -3205,6 +3360,10 @@ const DisplayPartnerSession = (props) => { myelement.scrollIntoView({ behavior: 'smooth' }); } + disableAttendeeDetailFields(); + + + } else if (String(res.data.status) === String("Err_Connexion")) { alert('Erreur: ' + res.data.message); @@ -3214,11 +3373,13 @@ const DisplayPartnerSession = (props) => { else { setGetAttendee_api("false"); setGetAttendee_message(res.data.message); + alert(res.data.message); } }).catch((error) => { console.warn('Not good man :( GetAttendee = ', error); setGetAttendee_api("false"); + alert(" Impossible de recuperer les données du participant"); //setmyApimyApiMessage("") }) } @@ -3645,9 +3806,225 @@ const DisplayPartnerSession = (props) => { const myRef = useRef(null) + let [participant_data_changed, setparticipant_data_changed] = useState(); + let [participant_data_edit_mode, setparticipant_data_edit_mode] = useState(); + + function AnnuleAttendeeDetailFields() { + + GetAttendee_Data(selectedattendeeemail, selected_session_id); + disableAttendeeDetailFields(); + setparticipant_data_changed(); + setparticipant_data_edit_mode(); + } + + function disableAttendeeDetailFields() { + setparticipant_data_edit_mode("0"); + + + document.getElementsByName("detail_session_class")[0].disabled = true; + document.getElementsByName("detail_session_class")[0].style.backgroundColor = "#ECEFF1"; + + + document.getElementsByName("detail_client_rattachement")[0].disabled = true; + document.getElementsByName("detail_client_rattachement")[0].style.backgroundColor = "#ECEFF1"; + + document.getElementsByName("detail_nom")[0].disabled = true; + document.getElementsByName("detail_nom")[0].style.backgroundColor = "#ECEFF1"; + + document.getElementsByName("detail_status_inscript")[0].disabled = true; + document.getElementsByName("detail_status_inscript")[0].style.backgroundColor = "#ECEFF1"; + + document.getElementsByName("detail_opco")[0].disabled = true; + document.getElementsByName("detail_opco")[0].style.backgroundColor = "#ECEFF1"; + + + document.getElementsByName("detail_prenom")[0].disabled = true; + document.getElementsByName("detail_prenom")[0].style.backgroundColor = "#ECEFF1"; + + + document.getElementsByName("detail_mail")[0].disabled = true; + document.getElementsByName("detail_mail")[0].style.backgroundColor = "#ECEFF1"; + + + document.getElementsByName("detail_tel")[0].disabled = true; + document.getElementsByName("detail_tel")[0].style.backgroundColor = "#ECEFF1"; + + + document.getElementsByName("detail_adresse")[0].disabled = true; + document.getElementsByName("detail_adresse")[0].style.backgroundColor = "#ECEFF1"; + + document.getElementsByName("detail_code_postal")[0].disabled = true; + document.getElementsByName("detail_code_postal")[0].style.backgroundColor = "#ECEFF1"; + + document.getElementsByName("detail_ville")[0].disabled = true; + document.getElementsByName("detail_ville")[0].style.backgroundColor = "#ECEFF1"; + + document.getElementsByName("detail_cout")[0].disabled = true; + document.getElementsByName("detail_cout")[0].style.backgroundColor = "#ECEFF1"; + + + document.getElementsByName("detail_mode_fin")[0].disabled = true; + document.getElementsByName("detail_mode_fin")[0].style.backgroundColor = "#ECEFF1"; + + document.getElementsByName("detail_employeur")[0].disabled = true; + document.getElementsByName("detail_employeur")[0].style.backgroundColor = "#ECEFF1"; + + document.getElementsByName("date_evaluation")[0].disabled = true; + document.getElementsByName("date_evaluation")[0].style.backgroundColor = "#ECEFF1"; + + document.getElementsByName("certif_date")[0].disabled = true; + document.getElementsByName("certif_date")[0].style.backgroundColor = "#ECEFF1"; + + document.getElementsByName("note_eval")[0].disabled = true; + document.getElementsByName("note_eval")[0].style.backgroundColor = "#ECEFF1"; + + + document.getElementsByName("date_evaluation")[0].disabled = true; + document.getElementsByName("date_evaluation")[0].style.backgroundColor = "#ECEFF1"; + + + document.getElementsByName("detail_incr_date")[0].disabled = true; + document.getElementsByName("detail_incr_date")[0].style.backgroundColor = "#ECEFF1"; + + + document.getElementsByName("certif_date")[0].disabled = true; + document.getElementsByName("certif_date")[0].style.backgroundColor = "#ECEFF1"; + + } + + function EnableAttendeeDetailFields() { + setparticipant_data_edit_mode("1"); + + document.getElementsByName("detail_session_class")[0].disabled = false; + document.getElementsByName("detail_session_class")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("detail_client_rattachement")[0].disabled = false; + document.getElementsByName("detail_client_rattachement")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("detail_nom")[0].disabled = false; + document.getElementsByName("detail_nom")[0].style.backgroundColor = "#FFFFFF"; + + + + document.getElementsByName("detail_status_inscript")[0].disabled = false; + document.getElementsByName("detail_status_inscript")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("detail_opco")[0].disabled = false; + document.getElementsByName("detail_opco")[0].style.backgroundColor = "#FFFFFF"; + + + document.getElementsByName("detail_prenom")[0].disabled = false; + document.getElementsByName("detail_prenom")[0].style.backgroundColor = "#FFFFFF"; + + + document.getElementsByName("detail_mail")[0].disabled = false; + document.getElementsByName("detail_mail")[0].style.backgroundColor = "#FFFFFF"; + + + document.getElementsByName("detail_tel")[0].disabled = false; + document.getElementsByName("detail_tel")[0].style.backgroundColor = "#FFFFFF"; + + + document.getElementsByName("detail_adresse")[0].disabled = false; + document.getElementsByName("detail_adresse")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("detail_code_postal")[0].disabled = false; + document.getElementsByName("detail_code_postal")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("detail_ville")[0].disabled = false; + document.getElementsByName("detail_ville")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("detail_cout")[0].disabled = false; + document.getElementsByName("detail_cout")[0].style.backgroundColor = "#FFFFFF"; + + + document.getElementsByName("detail_mode_fin")[0].disabled = false; + document.getElementsByName("detail_mode_fin")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("detail_employeur")[0].disabled = false; + document.getElementsByName("detail_employeur")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("date_evaluation")[0].disabled = false; + document.getElementsByName("date_evaluation")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("certif_date")[0].disabled = false; + document.getElementsByName("certif_date")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("note_eval")[0].disabled = false; + document.getElementsByName("note_eval")[0].style.backgroundColor = "#FFFFFF"; + + + document.getElementsByName("date_evaluation")[0].disabled = false; + document.getElementsByName("date_evaluation")[0].style.backgroundColor = "#FFFFFF"; + + + document.getElementsByName("detail_incr_date")[0].disabled = false; + document.getElementsByName("detail_incr_date")[0].style.backgroundColor = "#FFFFFF"; + + + document.getElementsByName("certif_date")[0].disabled = false; + document.getElementsByName("certif_date")[0].style.backgroundColor = "#FFFFFF"; + } + + const [p_detail_nom, setp_detail_nom] = useState(); + const [p_detail_prenom, setp_detail_prenom] = useState(); + const [p_detail_mail, setp_detail_mail] = useState(); + const [p_detail_tel, setp_detail_tel] = useState(); + const [p_detail_adresse, setp_detail_adresse] = useState(); + const [p_detail_code_postal, setp_detail_code_postal] = useState(); + const [p_detail_ville, setp_detail_ville] = useState(); + const [p_detail_cout, setp_detail_cout] = useState(); + const [p_detail_mode_fin, setp_detail_mode_fin] = useState(); + const [p_detail_employeur, setp_detail_employeur] = useState(); + const [p_date_evaluation, setp_date_evaluation] = useState(); + const [p_note_eval, setp_note_eval] = useState(); + const [p_detail_session_class, setp_detail_session_class] = useState(); + const [p_detail_session_class_id, setp_detail_session_class_id] = useState(); + const [p_detail_status_inscrit, setp_detail_status_inscrit] = useState(); + const [p_detail_status_inscrit_label, setp_detail_status_inscrit_label] = useState(); + const [p_detail_opco, setp_detail_opco] = useState(); + const [p_detail_client_rattachement_nom, setp_detail_client_rattachement_nom] = useState(); + const [p_detail_client_rattachement_id, setp_detail_client_rattachement_id] = useState(); + + + const [Dialog_1_message, setDialog_1_message] = React.useState(false); + const [Dialog_1_open, setDialog_1_open] = React.useState(false); + function Dialog_1_handle_change_participant_session(message) { + setDialog_1_message(message); + setDialog_1_open(true); + } + + const Dialog_1_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const Dialog_1_handleClose_buton = () => { + setDialog_1_open(false); + }; + + return (
+ + + MySy Information + + + {Dialog_1_message} + + + + + + + + +

Vos sessions de formation

Utilisez les filtres !
@@ -4651,21 +5028,21 @@ const DisplayPartnerSession = (props) => {
- {!sessionChanged && selected_code_session && fields1desabled && + {!sessionChanged && selected_session_id && fields1desabled && } - {edit_session_form && selected_code_session && + {edit_session_form && selected_session_id && }
- {!sessionChanged && selected_code_session && fields1desabled && + {!sessionChanged && selected_session_id && fields1desabled && } - {((sessionChanged && selected_code_session) || !fields1desabled) && + {((sessionChanged && selected_session_id) || !fields1desabled) && } @@ -5809,6 +6186,7 @@ const DisplayPartnerSession = (props) => { {String(Resend_LMS_Credentials_api) === "false" &&
{Resend_LMS_Credentials_message}
} +
@@ -5866,233 +6244,496 @@ const DisplayPartnerSession = (props) => {
+
+ {String(participant_data_edit_mode) !== "1" &&
Session
+ Nom
- -
- -
Prenom
- -
- -
Email
- -
- -
Téléphone
- -
+ InputLabelProps={{ + shrink: true, + }} + disabled={false} + className="disabled_style" + value={p_detail_session_class} -
Adresse
- - InputLabelProps={{ - shrink: true, - }} - disabled={false} - className="disabled_style" - - /> -
-
Code postal
- -
-
Ville
- -
+
} -
- Date Inscription - Session
+ { + setp_detail_session_class(e.target.value); + setparticipant_data_changed("1"); + setp_detail_session_class_id(e.target.value); + Dialog_1_handle_change_participant_session(" Attention, vous allez modifier la session d'affectation du participant"); + } + } - dateFormat="dd/MM/yyyy" - className="disabled_style" - locale='fr-FR' + > + {Getall_TrainingSession_result && + Getall_TrainingSession_result.map((mysession) => ( + + {JSON.parse(mysession).code_session}   - /> -
+ + ))} + +
} -
Cout
- -
+ {String(participant_data_edit_mode) === "1" &&
Client
+ { + //setp_detail_client_rattachement_id(e.target.value); + setp_detail_client_rattachement_nom(e.target.value); + setparticipant_data_changed("1"); + Dialog_1_handle_change_participant_session(" Attention, vous allez modifier le client de rattachement du participant"); + } + } + + > + {Get_List_Partner_Clients_result && + Get_List_Partner_Clients_result.map((myclient) => ( + + {JSON.parse(myclient).nom}   + + + ))} + +
} + + {String(participant_data_edit_mode) !== "1" &&
Client
+ + +
} + + {String(participant_data_edit_mode) !== "1" &&
Statut
+ + +
} + + {String(participant_data_edit_mode) === "1" &&
Statut
+ { + setp_detail_status_inscrit(e.target.value); + setparticipant_data_changed("1"); + } + } + + > + Inscrit    + Preinscrit   + Annule   + +
} +
Nom
+ Mode Financement
- { + setp_detail_nom(e.target.value); + setparticipant_data_changed("1"); + } + } - InputLabelProps={{ - shrink: true, - }} - disabled={false} - className="disabled_style" + /> +
- /> -
+
Prenom
+ { + setp_detail_prenom(e.target.value); + setparticipant_data_changed("1"); + } + } + /> +
+ +
Email
+ { + setp_detail_mail(e.target.value); + setparticipant_data_changed("1"); + } + } + /> +
+ +
Téléphone
+ { + setp_detail_tel(e.target.value); + setparticipant_data_changed("1"); + } + } + /> +
-
Employeur
- Adresse
+ { + setp_detail_adresse(e.target.value); + setparticipant_data_changed("1"); + } + } + /> +
+
Code postal
+ { + + setp_detail_code_postal(e.target.value); + setparticipant_data_changed("1"); + } + } + /> +
+
Ville
+ { + setp_detail_ville(e.target.value); + setparticipant_data_changed("1"); + } + } + className="disabled_style" + + /> +
+ + +
+ Date Inscription + +
+ + +
Cout
+ { + setp_detail_cout(e.target.value); + setparticipant_data_changed("1"); + } + } + /> +
+ +
Opco
+ { + setp_detail_opco(e.target.value); + setparticipant_data_changed("1"); + }} + /> +
+ + +
Mode Financement
+ { + setp_detail_mode_fin(e.target.value); + setparticipant_data_changed("1"); + } + } + /> +
+ + +
Employeur
+ { + setp_detail_employeur(e.target.value); + setparticipant_data_changed("1"); + } + } + /> +
+ {is_lms_class_code &&
+
+
+
+
+ Acces LMS + +
+
+
login LMS
+ +
+ +
Mot de passe LMS
+ +
+
+ + + +
+
+
} + + +
+   +
+ {String(participant_data_changed) === "1" && String(participant_data_edit_mode) === "1" &&
+ /!\ Pensez à enregistrer les modifications +
} + + +
+ + {String(participant_data_edit_mode) === "1" &&
+ + + +
} + + {String(participant_data_edit_mode) === "1" &&
+ +
} +
+ + + {String(participant_data_edit_mode) !== "1" &&
+ +
+   +
+ +
+ + +
+ +
} - InputLabelProps={{ - shrink: true, - }} - disabled={false} - className="disabled_style" - /> -
- {is_lms_class_code &&

-
- Acces LMS - -
-
-
login LMS
- -
- -
Mot de passe LMS
- -
-
- - - -
-
-
} -
-
diff --git a/src/components/DisplayPartnerStagiaires.js b/src/components/DisplayPartnerStagiaires.js index afe6f52..bafefe2 100644 --- a/src/components/DisplayPartnerStagiaires.js +++ b/src/components/DisplayPartnerStagiaires.js @@ -900,9 +900,6 @@ const DisplayPartnerStagiaires = (props) => { document.getElementsByName("certif_date")[0].style.backgroundColor = "#ECEFF1"; } - - - function EnableAttendeeDetailFields() { setparticipant_data_edit_mode("1"); @@ -1575,11 +1572,13 @@ const DisplayPartnerStagiaires = (props) => { else { setGetAttendee_api("false"); setGetAttendee_message(res.data.message); + alert( res.data.message); } }).catch((error) => { console.warn('Not good man :( GetAttendee = ', error); setGetAttendee_api("false"); + alert(" Impossible de recuperer les données du participant"); //setmyApimyApiMessage("") }) } @@ -2827,13 +2826,12 @@ const DisplayPartnerStagiaires = (props) => {
} - {String(participant_data_edit_mode) === "1" &&
Session
{
} - - {String(participant_data_edit_mode) !== "1" &&
Statut
{
-
Cout
+
Opco
{

+
Evaluation diff --git a/src/components/GestionAdministrative.js b/src/components/GestionAdministrative.js index 29e1c44..ffa5cdb 100644 --- a/src/components/GestionAdministrative.js +++ b/src/components/GestionAdministrative.js @@ -1052,7 +1052,7 @@ function GestionAdministrative(props) { form.append("class_internal_url", internal_url); const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); - + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetAllValideSessionFormation_List/"; axios.post(myurl, form).then(res => { @@ -1426,10 +1426,6 @@ function GestionAdministrative(props) { const [selectedsession_date_au, setselectedsession_date_au] = useState(new Date()); function handleChangeSession(event) { - /* - - /!\ : Cette fonction a besoin d'un token actif - */ //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); const stored_cookie = getCookie('tokenmysypart'); @@ -1440,13 +1436,13 @@ function GestionAdministrative(props) { } setselected_session_id(event.target.value); - - const div1 = document.getElementById("muysy_code_session"); + + const div1 = document.getElementById("mysy_code_session"); const code_session = div1.getAttribute('mysy_code_session'); setselected_code_session(code_session); - + setreduction_session("0"); setsessionChanged(false); @@ -1519,6 +1515,102 @@ function GestionAdministrative(props) { submenu_inscrit(); }; + + function handleChangeSession_v2(event) { + + + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + const stored_cookie = getCookie('tokenmysypart'); + if (String(stored_cookie) === String("")) { + alert(" La session n'est plus valide "); + history.push("/Connexion"); + return; + } + + setselected_session_id(event.target.value); + + + const div1 = document.getElementById("mysy_code_session"); + const code_session = div1.getAttribute('mysy_code_session'); + setselected_code_session(code_session); + + + + + setreduction_session("0"); + setsessionChanged(false); + clearSessionFields(); + setselectedCertif(); + seturlpreview_certif(); + setdisplay_detail_insc(); + setCreateSessionFormation_api(); + setSendInscriptionConfirmation_api(); + setreduction_session("0"); + + + var tab_date = []; + + setp_detail_session_class(event.target.value); + setmysession(event.target.value); + GetListePreinscrit(event.target.value); + GetListeInscrit(event.target.value); + GetListeEmargement(event.target.value); + GetListeEvaluation(event.target.value); + + var el = document.getElementById('session_liste_v2'); + var text = el.innerText; + + setallmysession_info(text); + + // Recuperation de l'adresse + const words_adresse = text.split(' à'); + + if (words_adresse.length === 2) { + var regex = /^[0-9]{2}[\/][0-9]{2}[\/][0-9]{4}$/g; + const words = text.split(' '); + //Iterate array + words.forEach( + function (date) { + + if (regex.test(date)) + //console.log(date + " => "+regex.test(date)); + tab_date.push(date) + }); + + //alert("words_adresse[1] = "+words_adresse[1].trim()); + const words_adresse2 = String(words_adresse[1]).trim().split(' '); + //console.log("words_adresse2 = ",words_adresse2); + var taille = words_adresse2.length; + var CP = words_adresse2[words_adresse2.length - 1] + var ville = words_adresse2[words_adresse2.length - 2] + + var local_adress = "" + var i = 0; + while (i < words_adresse2.length - 2) { + local_adress = local_adress + " " + words_adresse2[i] + i = i + 1; + + } + //console.log(" CP = ",CP+" ville = ",ville+" local_adress = ",local_adress); + document.getElementsByName("adresse")[0].value = local_adress; + document.getElementsByName("ville")[0].value = ville; + document.getElementsByName("code_postal")[0].value = CP; + + } + + if (tab_date.length === 2) { + var date_du = new Date(moment(tab_date[0], "DD/MM/YYYY")).setHours(8, 0, 0); + var date_au = new Date(moment(tab_date[1], "DD/MM/YYYY")).setHours(18, 0, 0); + setSessionstartDate(date_du); + setSessionendDate(date_au) + } + + GetCurrentSession(event.target.value); + + submenu_inscrit(); + }; + + const [CreateListEmargement_api, setCreateListEmargement_api] = useState(); const [CreateListEmargement_message, setCreateListEmargement_message] = useState(); const [CreateListEmargement_result, setCreateListEmargement_result] = useState(); @@ -4821,54 +4913,30 @@ function GestionAdministrative(props) { {String(addOneSession) !== "1" &&

- {/*--- - Choisir une session v 2
+ + Choisir une session
{GetCurrentClass_trainingsession_result && GetCurrentClass_trainingsession_result.map((session) => ( - - {(JSON.parse(session).code_session) && (JSON.parse(session).code_session) + " - "} - {(JSON.parse(session).session_ondemande) === "1" && " A la Demande - "} - {(!JSON.parse(session).session_ondemande || JSON.parse(session).session_ondemande === "0") && - (JSON.parse(session).date_debut).substring(0, 10) + " au " + (JSON.parse(session).date_fin).substring(0, 10)} - - - {/*(JSON.parse(session).date_debut).substring(0, 10)} au {(JSON.parse(session).date_fin).substring(0, 10) * /} - - {(JSON.parse(session).distantiel) === "1" && " A Distance - "} - {(JSON.parse(session).presentiel) === "1" && (JSON.parse(session).adresse) && " En Présentiel - " + (JSON.parse(session).adresse)} - {(JSON.parse(session).presentiel) === "1" && (!JSON.parse(session).adresse) && " En Présentiel - "} - {(JSON.parse(session).code_postal) && " " + (JSON.parse(session).code_postal)} - - - ))} - - ---*/} - Choisir une session
- + + + + {GetCurrentClass_trainingsession_result && + GetCurrentClass_trainingsession_result.map((session) => ( + + + ))} + */}