From e56dc69c76db7eb5440186424197f6aeebc3adeb Mon Sep 17 00:00:00 2001 From: cherif Date: Sun, 15 Oct 2023 22:44:40 +0200 Subject: [PATCH] 15/10/2023 - 22h40 --- src/components/AddClassManual.js | 46 +- src/components/AddPartnerClient.js | 2 +- src/components/DisplayPartnerSession.js | 400 ++++++++++++++---- src/components/DisplayPartnerStagiaires.js | 382 ++++++++++++----- .../DisplayPartnerTrainingsPagination.js | 85 +++- src/components/GestionAdministrative.js | 87 ++-- src/components/Partner.js | 2 +- src/components/PartnerClient_Activite.js | 162 ++++++- src/components/Partner_Commande.js | 127 ++++-- src/styles/components/_addclassmanual.scss | 32 ++ src/styles/components/_addpartnerclient.scss | 6 +- .../components/_displaypartnersession.scss | 123 ++++-- .../components/_displaypartnerstagiaire.scss | 80 ++++ src/styles/components/_partner.scss | 10 +- .../components/_partner_client_activite.scss | 175 ++++---- src/styles/components/_partnerclient.scss | 6 +- 16 files changed, 1258 insertions(+), 467 deletions(-) diff --git a/src/components/AddClassManual.js b/src/components/AddClassManual.js index e3544b2..71a22a1 100644 --- a/src/components/AddClassManual.js +++ b/src/components/AddClassManual.js @@ -27,6 +27,7 @@ import { Tooltip } from 'react-tooltip' import Popup from 'reactjs-popup'; import 'reactjs-popup/dist/index.css'; import GestionAdministrative from "./GestionAdministrative"; +import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif"; const AddClassManual = (props) => { const history = useHistory(); @@ -555,6 +556,8 @@ const AddClassManual = (props) => { function RecordTraining(event) { + + var code = document.getElementsByName("external_code")[0].value; if (code.length < 1) { @@ -657,25 +660,37 @@ const AddClassManual = (props) => { // Verification si il y a plus de 3 mot clés separés par des ";" mots_cle = mots_cle.replace(/(<([^>]+)>)/ig, ''); - mots_cle = mots_cle.replace(" ", ''); + mots_cle = mots_cle.replaceAll(" ", ''); + mots_cle = mots_cle.replaceAll(",", ";"); - var local_mot_cle = ""; - if (mots_cle.endsWith(";")) { - local_mot_cle = mots_cle.substring(0, mots_cle.length - 1); - } else { - local_mot_cle = mots_cle; + var words = mots_cle.split(';'); + + var traited_list_mot_cle = [] + for (let i = 0; i < words.length; i++) { + //console.log(" ### alanlyse du mot "+String(words[i])) + if (words[i] && String(words[i]).length > 2 && String(words[i]).length < 50) + traited_list_mot_cle.push(String(words[i])); + else if (words[i] && (String(words[i]).length < 2 || String(words[i]).length > 50) ) { + alert(" Chaque mot clé doit faire entre 2 et 50 caractères. Le mot '"+String(words[i])+"' est incorrecte"); + return; + } + } - //console.log(" ## local_mot_cle = ", local_mot_cle); - var words = local_mot_cle.split(';'); - //console.log(" ## words = ", words); + //console.log(" ## traited_list_mot_cle = ", traited_list_mot_cle); - if (words.length > 3) { + if (traited_list_mot_cle.length > 3) { alert(" Il a plus de 3 mots clés. le max autorisé est 3"); return; } + var list_mot_cle_string = traited_list_mot_cle.toString().replaceAll(",", ";"); + + //console.log(" ## list_mot_cle_string = ", list_mot_cle_string); + + //return; + var myurl = ""; @@ -717,7 +732,7 @@ const AddClassManual = (props) => { formData.append('url', url); formData.append('lms_class_code', lms_class_code); formData.append('class_inscription_url', class_inscription_url); - formData.append('mots_cle', mots_cle); + formData.append('mots_cle', list_mot_cle_string); formData.append('plus_produit', plus_produit); formData.append('internal_url', displayedinternalurl); formData.append('zone_diffusion', ""); @@ -736,6 +751,7 @@ const AddClassManual = (props) => { //console.log(" domaine = "+domaine); + setLoading(true); fetch( myurl, @@ -747,6 +763,7 @@ const AddClassManual = (props) => { .then((response) => response.json()) .then((result) => { //console.log('Success:', result['message'], "result['status'] = ", result['status']); + setLoading(false); setimportmessage(result['message']); setmyApiResponse(result['status']); setdatamodification("0"); @@ -769,6 +786,7 @@ const AddClassManual = (props) => { } }) .catch((error) => { + setLoading(false); console.error('Error:', error); setmyApiResponse("false"); }); @@ -1165,8 +1183,14 @@ const AddClassManual = (props) => { props.closeTrainingForm(); } + + const [isLoading, setLoading] = useState(); + return (
+ {isLoading &&
+
+
} {String(props.mytrainingclass.ref).trim() !== "" &&
diff --git a/src/components/AddPartnerClient.js b/src/components/AddPartnerClient.js index 07824de..2a18c91 100644 --- a/src/components/AddPartnerClient.js +++ b/src/components/AddPartnerClient.js @@ -2861,7 +2861,7 @@ const AddParnerClient = (props) => { {String(submenu).trim() === "submenu_activite" &&
- < PartnerClientActivite email={p_client_email} /> + < PartnerClientActivite email={p_client_email} conntected_employee_id={props.conntected_employee_id} />
} diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index ce85921..0a62767 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -860,6 +860,12 @@ const DisplayPartnerSession = (props) => { setdatagrid_columns_size_model2(50); } + window.scrollTo({ + top: 0, + behavior: "smooth", + }); + + }, []) @@ -1134,6 +1140,7 @@ const DisplayPartnerSession = (props) => { return; } + setLoading(true); var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetAllClassStagiaire/"; fetch(myurl, @@ -1143,6 +1150,7 @@ const DisplayPartnerSession = (props) => { }) .then((data) => data.json()) .then((data) => { + setLoading(false); //console.log(' GetListeInscrit : Success:', data['message'], "data['status'] = ", data['status']); setGetListePreinscrit_insc_result(data['message']); setRows_insc(data['message']); @@ -1162,6 +1170,7 @@ const DisplayPartnerSession = (props) => { } }).catch((error) => { + setLoading(false); console.error('Error:', error); setGetListePreinscrit_insc_api("false"); }); @@ -1316,7 +1325,7 @@ const DisplayPartnerSession = (props) => { } - + setLoading(true); var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetAllClassStagiaire/"; fetch(myurl, @@ -1326,6 +1335,7 @@ const DisplayPartnerSession = (props) => { }) .then((data) => data.json()) .then((data) => { + setLoading(false); //console.log('GetListePreinscrit:', data['message'], "data['status'] = ", data['status']); setGetListePreinscrit_result(data['message']); setRows_preinsc(data['message']); @@ -1348,6 +1358,7 @@ const DisplayPartnerSession = (props) => { } }).catch((error) => { + setLoading(false); console.error('Error:', error); setGetListePreinscrit_api("false"); alert(" Impossible de recuperer la liste des préinscriptions"); @@ -2034,8 +2045,6 @@ const DisplayPartnerSession = (props) => { document.getElementsByName("formateur")[0].disabled = true; document.getElementsByName("formateur")[0].style.backgroundColor = "#ECEFF1"; - document.getElementsByName("lms_class_code")[0].disabled = true; - document.getElementsByName("lms_class_code")[0].style.backgroundColor = "#ECEFF1"; document.getElementsByName("nb_participant")[0].disabled = true; document.getElementsByName("nb_participant")[0].style.backgroundColor = "#ECEFF1"; @@ -2100,8 +2109,6 @@ const DisplayPartnerSession = (props) => { document.getElementsByName("pays")[0].disabled = false; document.getElementsByName("pays")[0].style.backgroundColor = "#FFFFFF"; - document.getElementsByName("lms_class_code")[0].disabled = false; - document.getElementsByName("lms_class_code")[0].style.backgroundColor = "#FFFFFF"; document.getElementsByName("formateur")[0].disabled = false; document.getElementsByName("formateur")[0].style.backgroundColor = "#FFFFFF"; @@ -2276,8 +2283,8 @@ const DisplayPartnerSession = (props) => { setp_one_session_status_label(); setp_one_session_etape(); setp_one_session_etape_label(); - - + + } const [is_lms_class_code, setis_lms_class_code] = useState(); @@ -2387,14 +2394,6 @@ const DisplayPartnerSession = (props) => { formateur = document.getElementById("formateur").value; - var lms_class_code = ""; - if (document.getElementById("lms_class_code") && document.getElementById("lms_class_code").value != "") { - lms_class_code = document.getElementById("lms_class_code").value; - - } - - - //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); const stored_cookie = getCookie('tokenmysypart'); @@ -2419,7 +2418,7 @@ const DisplayPartnerSession = (props) => { form.append("code_session", code_session); form.append("formateur", formateur); - form.append("lms_class_code", lms_class_code); + 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')); form.append("attestation_certif", selectedCertif); @@ -2584,11 +2583,7 @@ const DisplayPartnerSession = (props) => { formateur = document.getElementById("one_formateur").value; - var lms_class_code = ""; - if (document.getElementById("one_lms_class_code") && document.getElementById("one_lms_class_code").value != "") { - lms_class_code = document.getElementById("one_lms_class_code").value; - } //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); const stored_cookie = getCookie('tokenmysypart'); @@ -2607,7 +2602,7 @@ const DisplayPartnerSession = (props) => { form.append("ville", p_one_ville); form.append("pays", p_one_pays); form.append("formateur", p_one_formateur); - form.append("lms_class_code", p_one_lms_class_code); + form.append("session_status", p_one_session_status); form.append("date_debut_inscription", format(one_SessionstartDateInscription, 'dd/MM/yyyy kk:mm:ss')); form.append("date_fin_inscription", format(one_SessionendDateInscription, 'dd/MM/yyyy kk:mm:ss')); @@ -2639,7 +2634,7 @@ const DisplayPartnerSession = (props) => { setone_CreateSessionFormation_result(res.data.message); setsessionChanged(false); Getall_TrainingSession(); - + One_clearSessionFields(); setaddOneSession(); @@ -2647,7 +2642,7 @@ const DisplayPartnerSession = (props) => { setdisplay_detail_insc(); setselected_code_session(); setsubmenu(); - + alert(res.data.message); //GetCurrentSession(p_one_code_session, one_selected_internal_url); @@ -2880,7 +2875,6 @@ const DisplayPartnerSession = (props) => { setp_formateur(mylocaltraining.formateur); } - document.getElementsByName("lms_class_code")[0].value = ""; if (mylocaltraining.lms_class_code) { setis_lms_class_code(mylocaltraining.lms_class_code); @@ -3521,8 +3515,10 @@ const DisplayPartnerSession = (props) => { var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetAttendeeDetail_perSession/"; + setLoading(true); axios.post(myurl, form).then(res => { + setLoading(false); 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); @@ -3560,6 +3556,9 @@ const DisplayPartnerSession = (props) => { document.getElementsByName("detail_opco")[0].value = ""; if (mylocalattendee.opco) setp_detail_opco(mylocalattendee.opco); + else { + setp_detail_opco("") + } document.getElementsByName("detail_client_rattachement")[0].value = ""; @@ -3567,60 +3566,93 @@ const DisplayPartnerSession = (props) => { setp_detail_client_rattachement_id(mylocalattendee.client_rattachement_id); setp_detail_client_rattachement_nom(mylocalattendee.client_rattachement_nom); + } else { + setp_detail_client_rattachement_id(""); + setp_detail_client_rattachement_nom(""); } document.getElementsByName("detail_nom")[0].value = ""; if (mylocalattendee.nom) setp_detail_nom(mylocalattendee.nom); + else { + setp_detail_nom("") + } document.getElementsByName("detail_prenom")[0].value = ""; if (mylocalattendee.prenom) setp_detail_prenom(mylocalattendee.prenom); + else { + setp_detail_prenom("") + } document.getElementsByName("detail_mail")[0].value = ""; if (mylocalattendee.email) { setp_detail_mail(mylocalattendee.email); setattendee_lms_login(mylocalattendee.email); } + else { + setp_detail_mail(""); + setattendee_lms_login("") + } document.getElementsByName("detail_tel")[0].value = ""; if (mylocalattendee.telephone) { setp_detail_tel(mylocalattendee.telephone); } + else { + setp_detail_tel("") + } document.getElementsByName("detail_adresse")[0].value = ""; if (mylocalattendee.adresse) { setp_detail_adresse(mylocalattendee.adresse); } + else { + setp_detail_adresse("") + } document.getElementsByName("detail_code_postal")[0].value = ""; if (mylocalattendee.code_postal) { setp_detail_code_postal(mylocalattendee.code_postal); } + else { + setp_detail_code_postal("") + } document.getElementsByName("detail_ville")[0].value = ""; if (mylocalattendee.ville) { setp_detail_ville(mylocalattendee.ville); } + else { + setp_detail_ville("") + } document.getElementsByName("detail_cout")[0].value = ""; if (mylocalattendee.price) { setp_detail_cout(mylocalattendee.price); } + else { + setp_detail_cout("") + } document.getElementsByName("detail_mode_fin")[0].value = ""; if (mylocalattendee.modefinancement) { setp_detail_mode_fin(mylocalattendee.modefinancement); } + else { + setp_detail_mode_fin("") + } document.getElementsByName("detail_employeur")[0].value = ""; if (mylocalattendee.employeur) { setp_detail_employeur(mylocalattendee.employeur); + } else { + setp_detail_employeur("") } document.getElementsByName("date_evaluation")[0].value = ""; @@ -3684,6 +3716,7 @@ const DisplayPartnerSession = (props) => { } }).catch((error) => { + setLoading(false); console.warn('Not good man :( GetAttendee = ', error); setGetAttendee_api("false"); alert(" Impossible de recuperer les données du participant"); @@ -4127,6 +4160,7 @@ const DisplayPartnerSession = (props) => { function AnnuleAttendeeDetailFields() { + clearDetailAttendeFields(); GetAttendee_Data(selectedattendeeemail, selected_session_id); disableAttendeeDetailFields(); setparticipant_data_changed(); @@ -4164,6 +4198,23 @@ const DisplayPartnerSession = (props) => { } + if (document.getElementsByName("detail_mode_fin")[0]) { + document.getElementsByName("detail_mode_fin")[0].disabled = true; + document.getElementsByName("detail_mode_fin")[0].style.backgroundColor = "#ECEFF1"; + } + + + if (document.getElementsByName("detail_employeur")[0]) { + document.getElementsByName("detail_employeur")[0].disabled = true; + document.getElementsByName("detail_employeur")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_cout")[0]) { + document.getElementsByName("detail_cout")[0].disabled = true; + document.getElementsByName("detail_cout")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_prenom")[0]) { document.getElementsByName("detail_prenom")[0].disabled = true; document.getElementsByName("detail_prenom")[0].style.backgroundColor = "#ECEFF1"; @@ -4276,6 +4327,15 @@ const DisplayPartnerSession = (props) => { document.getElementsByName("detail_opco")[0].disabled = false; document.getElementsByName("detail_opco")[0].style.backgroundColor = "#FFFFFF"; + document.getElementsByName("detail_cout")[0].disabled = false; + document.getElementsByName("detail_cout")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("detail_employeur")[0].disabled = false; + document.getElementsByName("detail_employeur")[0].style.backgroundColor = "#FFFFFF"; + + document.getElementsByName("detail_mode_fin")[0].disabled = false; + document.getElementsByName("detail_mode_fin")[0].style.backgroundColor = "#FFFFFF"; + document.getElementsByName("detail_prenom")[0].disabled = false; document.getElementsByName("detail_prenom")[0].style.backgroundColor = "#FFFFFF"; @@ -4721,6 +4781,114 @@ const DisplayPartnerSession = (props) => { // -- end gestion pièces jointes + // Action en mass + + const [actionmass_ftion_val, setactionmass_ftion_val] = useState(); + const actionmass_ftion = (event) => { + const value = event.target.value; + + + if (String(value) === "supprimer" || String(value) === "depublier" || String(value) === "desactiver") { + setactionmass_ftion_val(value); + } + else { + setactionmass_ftion_val(); + } + } + + async function actionmass_ftion_Traitemet() { + + + var liste_session = GetSelectedRowsSession(); + + //console.log(" liste_formation = ", liste_formation); + //console.log(" actionmass_ftion_val = ", actionmass_ftion_val); + + if (String(actionmass_ftion_val) === String("supprimer")) { + + console.log(" ### liste session : ", liste_session) + Delete_LIST_Session_Formation(liste_session); + + } + + else if (String(actionmass_ftion_val) === String("publier")) { + + } + + else if (String(actionmass_ftion_val) === String("desactiver")) { + + } + + } + + function GetSelectedRowsSession() { + ///alert(" les lignes slected sont : " + selectionModel + " nb item = " + selectionModel.length); + //const selectedRowsData = selectionModel.map((id) => rowss.find((row) => row.id === id)); + //console.log(rowss[0]); + var tab_tmp = [] + for (var i = 0; i < selectionModel.length; i++) { + var myid = parseInt(String(selectionModel[i])); + var line = JSON.parse(rowss[myid]); + tab_tmp.push(line._id); + //console.log(rowss[myid]['external_code']); + } + setselectedtraining(tab_tmp); + return tab_tmp; + + } + + const [Delete_LIST_Session_Formation_api, setDelete_LIST_Session_Formation_api] = useState(); + const [Delete_LIST_Session_Formation_message, setDelete_LIST_Session_Formation_message] = useState(); + const [Delete_LIST_Session_Formation_result, setDelete_LIST_Session_Formation_result] = useState(); + function Delete_LIST_Session_Formation(local_liste_session) { + + setSendInscriptionCancell_api(); + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + console.log(" #### local_liste_session = ", local_liste_session) + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("list_session_id", local_liste_session); + + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_List_SessionFormation/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Delete_LIST_Session_Formation res.data.status = " + res.data.status); + //console.log(" In Delete_LIST_Session_Formation res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setDelete_LIST_Session_Formation_api("true"); + setDelete_LIST_Session_Formation_result(res.data.message); + setSelectionModel([]); + setaddOneParticipant(); + setdisplay_detail_insc(); + setselected_code_session(); + setsubmenu(); + Getall_TrainingSession(); + + alert(res.data.message); + } + else { + setDelete_LIST_Session_Formation_api("false"); + setDelete_LIST_Session_Formation_message(res.data.message); + alert(res.data.message); + + } + + }).catch((error) => { + + console.warn('Delete_LIST_Session_Formation : Not good man :( mysearchtext = ' + error); + setDelete_LIST_Session_Formation_api("false"); + alert(" Impossible de supprimer la liste des sessions de formation"); + }) + } + + // -- end action en mass + return (
@@ -5115,6 +5283,83 @@ const DisplayPartnerSession = (props) => {
+
+ + {selectionModel && selectionModel.length > 1 &&
+ +   + + Action    + Supprimer   + + + + + {actionmass_ftion_val && + } + +
} +
@@ -5648,23 +5893,7 @@ const DisplayPartnerSession = (props) => { /> -
Code Formation LMS - (le code créé dans le LMS) - setp_lms_class_code(e.target.value)} - /> -
Nombre participants *
@@ -6137,23 +6366,7 @@ const DisplayPartnerSession = (props) => { />
-
Code Formation LMS - (le code créé dans le LMS) - setp_one_lms_class_code(e.target.value)} - /> -
Nombre participants *
@@ -7440,14 +7653,54 @@ const DisplayPartnerSession = (props) => { } } /> -
+ + +
+
+   +
+ {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" &&
+ + + +
+ + +
+ +
} + + +

- Pièces jointes + Pièces jointes
@@ -7636,39 +7889,8 @@ const DisplayPartnerSession = (props) => {
 
- {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" &&
- - - -
- - -
- -
} -

diff --git a/src/components/DisplayPartnerStagiaires.js b/src/components/DisplayPartnerStagiaires.js index 3875724..8ee3b0f 100644 --- a/src/components/DisplayPartnerStagiaires.js +++ b/src/components/DisplayPartnerStagiaires.js @@ -244,7 +244,7 @@ const DisplayPartnerStagiaires = (props) => { } - {cellValues.row.status && String(cellValues.row.status) === "-1" && + {/*cellValues.row.status && String(cellValues.row.status) === "-1" && { )} - } - - {cellValues.row.status && String(cellValues.row.status) === "2" && - - Finaliser Préins. - - } - modal - nested - position="center center" - > - {close => ( -
- -
MySy Information
-
- {' '} - - En confirmant cette opération, vous allez finaliser la préinscription du stagiaire.
-
-
-
-
- - -
-
- -
-
-
- )} -
- } @@ -463,7 +414,7 @@ const DisplayPartnerStagiaires = (props) => { var email = cellValues.row.email; var inscription_id = cellValues.row._id; - + Refuse_Inscritpion_with_Motif(email, inscription_id, motif_refus); } @@ -474,7 +425,7 @@ const DisplayPartnerStagiaires = (props) => { function Refuse_Inscritpion_with_Motif(local_email, local_inscription_id, motif) { var form = new FormData(); - + const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); @@ -495,7 +446,7 @@ const DisplayPartnerStagiaires = (props) => { setRefuse_Inscritpion_with_Motif_result(res.data.message); Getall_TrainingParticipant(); alert(res.data.message); - + } else if (String(res.data.status) === String("Err_Connexion")) { setLoading(false); @@ -521,7 +472,7 @@ const DisplayPartnerStagiaires = (props) => { - + function handleClick_accept(event, cellValues) { var email = cellValues.row.email; @@ -535,7 +486,7 @@ const DisplayPartnerStagiaires = (props) => { function Accept_Inscritpion(local_email, local_inscription_id) { var form = new FormData(); - + const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); form.append("inscription_id", local_inscription_id); @@ -554,7 +505,7 @@ const DisplayPartnerStagiaires = (props) => { setAccept_Inscritpion_result(res.data.message); Getall_TrainingParticipant(); alert(res.data.message); - + } else if (String(res.data.status) === String("Err_Connexion")) { setLoading(false); @@ -611,11 +562,11 @@ const DisplayPartnerStagiaires = (props) => { var myurl = process.env.REACT_APP_API_URL + "myclass/api/DeleteAttendeeInscription/"; - + setLoading(true); axios.post(myurl, form).then(res => { //console.log(" In DeleteStagiaireData res.data.status = " + res.data.status); //console.log(" In DeleteStagiaireData res.data.message r_class = " + res.data.message); - + setLoading(false); if (String(res.data.status) === String("true")) { setDeleteStagiaireData_api("true"); setDeleteStagiaireData_result(res.data.message); @@ -632,7 +583,7 @@ const DisplayPartnerStagiaires = (props) => { } }).catch((error) => { - + setLoading(false); console.warn('DeleteStagiaireData : Not good man :( mysearchtext = ' + error); setDeleteStagiaireData_api("false"); alert(" Impossible de supprimer le stagaire"); @@ -714,9 +665,10 @@ const DisplayPartnerStagiaires = (props) => { var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Statgaire_List_Partner_with_filter/"; - + setLoading(true); axios.post(myurl, form).then(res => { + setLoading(false); 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); @@ -731,6 +683,7 @@ const DisplayPartnerStagiaires = (props) => { } }).catch((error) => { + setLoading(false); console.warn('Not good man :( Getall_TrainingParticipant = ', error); setGetall_TrainingParticipant_api("false"); alert(" Impossible de recuperer la liste des stagiaires") @@ -751,9 +704,9 @@ const DisplayPartnerStagiaires = (props) => { var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Statgaire_List_Partner_with_filter/"; - + setLoading(true); axios.post(myurl, form).then(res => { - + setLoading(false); 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); @@ -767,6 +720,7 @@ const DisplayPartnerStagiaires = (props) => { } }).catch((error) => { + setLoading(false); console.warn('Not good man :( Getall_TrainingParticipant = ', error); setGetall_TrainingParticipant_api("false"); //setmyApimyApiMessage("") @@ -780,6 +734,7 @@ const DisplayPartnerStagiaires = (props) => { function handleClick_edit_session_From_Line(selected_row_id) { + var line = JSON.parse(rowss[selected_row_id]); @@ -1153,6 +1108,7 @@ const DisplayPartnerStagiaires = (props) => { formData.append("email", local_mail); formData.append("class_internal_url", selected_internal_url); //console.log("token = " + stored_cookie); + setLoading(true); fetch( process.env.REACT_APP_API_URL + "myclass/api/LMS_Credential_Sending_mail/", @@ -1163,6 +1119,7 @@ const DisplayPartnerStagiaires = (props) => { ) .then((response) => response.json()) .then((result) => { + setLoading(false); if (String(result['status']) === String("true")) { //console.log('Success:', result['message']); setResend_LMS_Credentials_result(result['message']); @@ -1180,6 +1137,7 @@ const DisplayPartnerStagiaires = (props) => { }) .catch((error) => { + setLoading(false); console.error('Error:', error); setResend_LMS_Credentials_api("false"); }); @@ -1379,7 +1337,7 @@ const DisplayPartnerStagiaires = (props) => { function AnnuleAttendeeDetailFields() { - GetAttendee_Data(selected_participant_email, selected_code_session, selected_internal_url); + GetAttendee_Data(selected_participant_email, selected_session_id, selected_internal_url); disableAttendeeDetailFields(); setparticipant_data_changed(); setparticipant_data_edit_mode(); @@ -1953,7 +1911,10 @@ const DisplayPartnerStagiaires = (props) => { setdatagrid_columns_size_model2(10); } - + window.scrollTo({ + top: 0, + behavior: "smooth", + }); }, []) @@ -2054,6 +2015,7 @@ const DisplayPartnerStagiaires = (props) => { setparticipant_data_changed(); setparticipant_data_edit_mode(); clean_old_messages(); + clearDetailAttendeFields(); var form = new FormData(); const stored_cookie = getCookie('tokenmysypart'); @@ -2063,8 +2025,9 @@ const DisplayPartnerStagiaires = (props) => { form.append("internal_url", internal_url); var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetAttendeeDetail_perSession/"; - + setLoading(true); axios.post(myurl, form).then(res => { + setLoading(false); if (String(res.data.status) === "true") { //console.log(" In GetAttendee res.data.status = " + res.data.status); @@ -2075,7 +2038,6 @@ const DisplayPartnerStagiaires = (props) => { if (res.data.message) { var mylocalattendee = JSON.parse(res.data.message); - if (mylocalattendee.inscription_validation_date) { var date_du = new Date(moment(mylocalattendee.inscription_validation_date, "DD/MM/YYYY HH:mm:ss")); setdetailuser_date_inscription(date_du); @@ -2228,6 +2190,7 @@ const DisplayPartnerStagiaires = (props) => { } } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); history.push("/Connexion"); } @@ -2239,6 +2202,7 @@ const DisplayPartnerStagiaires = (props) => { } }).catch((error) => { + setLoading(false); console.warn('Not good man :( GetAttendee = ', error); setGetAttendee_api("false"); alert(" Impossible de recuperer les données du participant"); @@ -2421,12 +2385,12 @@ const DisplayPartnerStagiaires = (props) => { //console.log(" #### form = ", form); var myurl = process.env.REACT_APP_API_URL + "myclass/api/AddStagiairetoClass/"; - + setLoading(true); axios.post(myurl, form).then(res => { //console.log(" In One_Create_Participant res.data.status = " + res.data.status); //console.log(" In One_Create_Participant res.data.message r_class = " + res.data.message); - + setLoading(false); if (String(res.data.status) === String("true")) { setOne_Create_Participant_api("true"); setOne_Create_Participant_result(res.data.message); @@ -2457,6 +2421,7 @@ const DisplayPartnerStagiaires = (props) => { }).catch((error) => { + setLoading(false); console.warn('One_Create_Participant : Not good man :( = ' + error); setOne_Create_Participant_api("false"); alert(" Impossible d'ajouter le participant") @@ -2517,11 +2482,12 @@ const DisplayPartnerStagiaires = (props) => { //console.log(" form == ", form); var myurl = process.env.REACT_APP_API_URL + "myclass/api/UpdateStagiairetoClass/"; - + setLoading(true); 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); + setLoading(false); if (String(res.data.status) === String("true")) { setUpdateStagiaireData_api("true"); setUpdateStagiaireData_result(res.data.message); @@ -2552,7 +2518,7 @@ const DisplayPartnerStagiaires = (props) => { } }).catch((error) => { - + setLoading(false); console.warn('UpdateStagiaireData : Not good man :( mysearchtext = ' + error); setUpdateStagiaireData_api("false"); alert(" Impossible de mettre à jour le participant"); @@ -2635,9 +2601,9 @@ const DisplayPartnerStagiaires = (props) => { form.append("token", stored_cookie); var myurl = process.env.REACT_APP_API_URL + "myclass/api/get_partner_class/"; - + setLoading(true); axios.post(myurl, form).then(res => { - + setLoading(false); if (String(res.data.status) === String("true")) { //console.log(" In GetCurrentPartnerClass res.data.status = " + res.data.status); //console.log(" In GetCurrentPartnerClass res.data.message r_class = " + res.data.message); @@ -2655,6 +2621,7 @@ const DisplayPartnerStagiaires = (props) => { } }).catch((error) => { + setLoading(false); console.warn('Not good man :( mysearchtext = ', error); setGetCurrentPartnerClass_api("false"); //setmyApimyApiMessage("") @@ -2820,10 +2787,11 @@ const DisplayPartnerStagiaires = (props) => { form.append("session_id", local_session_id); var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetSessionFormation/"; - + setLoading(true); axios.post(myurl, form).then(res => { if (String(res.data.status) === "true") { + setLoading(false); //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); @@ -2991,17 +2959,20 @@ const DisplayPartnerStagiaires = (props) => { } } else if (String(res.data.status) === String("Err_Connexion")) { + setLoading(false); alert('Erreur: ' + res.data.message); history.push("/Connexion"); } else { + setLoading(false); setGetCurrentSession_api("false"); setGetCurrentSession_message(res.data.message); alert("Erreur : " + res.data.message); } }).catch((error) => { + setLoading(false); console.warn('Not good man :( GetCurrentSession = ', error); setGetCurrentSession_api("false"); @@ -3135,12 +3106,14 @@ const DisplayPartnerStagiaires = (props) => { var url = process.env.REACT_APP_API_URL + "myclass/api/Get_Stored_Downloaded_File/" + token + "/" + file_name; - + setLoading(true); axios.get(url, { responseType: 'blob', },) .then((res) => { + setLoading(false); fileDownload(res.data, nom_fiche_detaillee); setDownload_one_attached_document_api("true"); }).catch((error) => { + setLoading(false); console.error('Error:', error); setDownload_one_attached_document_api("false"); @@ -3304,7 +3277,7 @@ const DisplayPartnerStagiaires = (props) => { //formData.append("class_internal_url", internal_url); //console.log("token = " + stored_cookie); - + setLoading(true); fetch( process.env.REACT_APP_API_URL + "myclass/api/Store_User_Downloaded_File/", { @@ -3315,6 +3288,7 @@ const DisplayPartnerStagiaires = (props) => { .then((response) => response.json()) .then((result) => { + setLoading(false); //console.log(" ## result['status'] = ", result['status']) if (String(result['status']) === String("true")) { //console.log('Success:', result['message']); @@ -3335,6 +3309,7 @@ const DisplayPartnerStagiaires = (props) => { }) .catch((error) => { + setLoading(false); console.error(' Record_All_PJ Error:', error); setRecord_All_PJ_api("false"); }); @@ -3365,7 +3340,7 @@ const DisplayPartnerStagiaires = (props) => { var url = process.env.REACT_APP_API_URL + "myclass/api/Delete_Stored_Downloaded_File/"; - + setLoading(true); fetch( process.env.REACT_APP_API_URL + "myclass/api/Delete_Stored_Downloaded_File/", { @@ -3375,7 +3350,7 @@ const DisplayPartnerStagiaires = (props) => { ) .then((response) => response.json()) .then((result) => { - + setLoading(false); //console.log(" ## result['status'] = ", result['status']) if (String(result['status']) === String("true")) { //console.log('Success:', result['message']); @@ -3392,6 +3367,7 @@ const DisplayPartnerStagiaires = (props) => { }) .catch((error) => { + setLoading(false); console.error(' Record_All_PJ Error:', error); setDelete_one_attached_document_api("false"); alert(" Impossible de supprimer le document") @@ -3419,7 +3395,7 @@ const DisplayPartnerStagiaires = (props) => { //formData.append("class_internal_url", internal_url); //console.log("token = " + stored_cookie); - + setLoading(true); fetch( process.env.REACT_APP_API_URL + "myclass/api/Get_List_object_owner_collection_Stored_Files/", @@ -3430,6 +3406,7 @@ const DisplayPartnerStagiaires = (props) => { ) .then((response) => response.json()) .then((result) => { + setLoading(false); //console.log(" ## result['status'] = ", result['status']) if (String(result['status']) === String("true")) { @@ -3445,6 +3422,7 @@ const DisplayPartnerStagiaires = (props) => { }) .catch((error) => { + setLoading(false); console.error(' Get_List_Of_All_PJ Error:', error); setGet_List_Of_All_PJ_api("false"); }); @@ -3465,6 +3443,110 @@ const DisplayPartnerStagiaires = (props) => { // -- end gestion pièces jointes + // Action en mass + + const [actionmass_ftion_val, setactionmass_ftion_val] = useState(); + const actionmass_ftion = (event) => { + const value = event.target.value; + + + if (String(value) === "supprimer" || String(value) === "depublier" || String(value) === "desactiver") { + setactionmass_ftion_val(value); + } + else { + setactionmass_ftion_val(); + } + } + + async function actionmass_ftion_Traitemet() { + + + var liste_session = GetSelectedRowsSession(); + + //console.log(" liste_formation = ", liste_formation); + //console.log(" actionmass_ftion_val = ", actionmass_ftion_val); + + if (String(actionmass_ftion_val) === String("supprimer")) { + console.log(" ### liste session : ", liste_session) + Delete_LIST_Stagiaires(liste_session); + + } + + else if (String(actionmass_ftion_val) === String("publier")) { + + } + + else if (String(actionmass_ftion_val) === String("desactiver")) { + + } + + } + + const [selectedtraining, setselectedtraining] = useState([]) + function GetSelectedRowsSession() { + ///alert(" les lignes slected sont : " + selectionModel + " nb item = " + selectionModel.length); + //const selectedRowsData = selectionModel.map((id) => rowss.find((row) => row.id === id)); + //console.log(rowss[0]); + var tab_tmp = [] + for (var i = 0; i < selectionModel.length; i++) { + var myid = parseInt(String(selectionModel[i])); + var line = JSON.parse(rowss[myid]); + tab_tmp.push(line._id); + //console.log(rowss[myid]['external_code']); + } + setselectedtraining(tab_tmp); + return tab_tmp; + + } + + const [Delete_LIST_Stagiaires_api, setDelete_LIST_Stagiaires_api] = useState(); + const [Delete_LIST_Stagiaires_message, setDelete_LIST_Stagiaires_message] = useState(); + const [Delete_LIST_Stagiaires_result, setDelete_LIST_Stagiaires_result] = useState(); + function Delete_LIST_Stagiaires(local_liste_class) { + + + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + // console.log(" #### local_liste_class = ", local_liste_class) + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("list_inscription_id", local_liste_class); + + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_List_AttendeeInscription/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Delete_LIST_Stagiaires res.data.status = " + res.data.status); + //console.log(" In Delete_LIST_Stagiaires res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setDelete_LIST_Stagiaires_api("true"); + setDelete_LIST_Stagiaires_result(res.data.message); + setSelectionModel([]); + Getall_TrainingParticipant(); + alert(res.data.message); + } + else { + setDelete_LIST_Stagiaires_api("false"); + setDelete_LIST_Stagiaires_message(res.data.message); + alert(res.data.message); + + } + + }).catch((error) => { + + console.warn('Delete_LIST_Stagiaires : Not good man :( mysearchtext = ' + error); + setDelete_LIST_Stagiaires_api("false"); + alert(" Impossible de supprimer la liste des stagiaires"); + }) + } + + // -- end action en mass + + return (
{isLoading &&
@@ -3965,6 +4047,83 @@ const DisplayPartnerStagiaires = (props) => {
+
+ + {selectionModel && selectionModel.length > 1 &&
+ +   + + Action    + Supprimer   + + + {actionmass_ftion_val && + } + +
} +
+ +
@@ -4820,6 +4979,37 @@ const DisplayPartnerStagiaires = (props) => { />
+
+ {String(participant_data_changed) === "1" && String(participant_data_edit_mode) === "1" &&
+ /!\ Pensez à enregistrer les modifications +
} + + +
+ + {String(participant_data_changed) === "1" && String(participant_data_edit_mode) === "1" &&
+ + + +
} + + {String(participant_data_edit_mode) === "1" &&
+ +
} +
+ + + {String(participant_data_edit_mode) !== "1" &&
+ + + + +
} +
+

@@ -4961,6 +5151,9 @@ const DisplayPartnerStagiaires = (props) => {
} + + + {is_lms_class_code &&
@@ -5014,35 +5207,8 @@ const DisplayPartnerStagiaires = (props) => {
 
- {String(participant_data_changed) === "1" && String(participant_data_edit_mode) === "1" &&
- /!\ Pensez à enregistrer les modifications -
} -
- - {String(participant_data_changed) === "1" && String(participant_data_edit_mode) === "1" &&
- - - -
} - - {String(participant_data_edit_mode) === "1" &&
- -
} -
- - - {String(participant_data_edit_mode) !== "1" &&
- - - - -
} -

diff --git a/src/components/DisplayPartnerTrainingsPagination.js b/src/components/DisplayPartnerTrainingsPagination.js index 885dbc3..d8a354c 100644 --- a/src/components/DisplayPartnerTrainingsPagination.js +++ b/src/components/DisplayPartnerTrainingsPagination.js @@ -108,7 +108,7 @@ const DistplayPartnerTraningsPage = (props) => { }) .then((data) => data.json()) .then((data) => { - console.log('GetAllClass_WOfilter : Success:', data['message'], "data['status'] = ", data['status']); + //console.log('GetAllClass_WOfilter : Success:', data['message'], "data['status'] = ", data['status']); setTableData(data['message']); setRows(data['message']); @@ -580,6 +580,22 @@ const DistplayPartnerTraningsPage = (props) => { } + function GetSelectedRowsTraining_id_values() { + ///alert(" les lignes slected sont : " + selectionModel + " nb item = " + selectionModel.length); + //const selectedRowsData = selectionModel.map((id) => rowss.find((row) => row.id === id)); + //console.log(rowss[0]); + var tab_tmp = [] + for (var i = 0; i < selectionModel.length; i++) { + var myid = parseInt(String(selectionModel[i])); + var line = JSON.parse(rowss[myid]); + tab_tmp.push(line._id); + //console.log(rowss[myid]['external_code']); + } + setselectedtraining(tab_tmp); + return tab_tmp; + + } + // Fonction de verification de la validité d'un token. function isValidToken() { @@ -740,6 +756,7 @@ const DistplayPartnerTraningsPage = (props) => { } var liste_formation = GetSelectedRowsTraining(); + var liste_formation_ids_values = GetSelectedRowsTraining_id_values(); @@ -755,7 +772,7 @@ const DistplayPartnerTraningsPage = (props) => { } else if (String(actionenmasse) === String("supprimer")) { - Disable_class(liste_formation); + Disable_class(liste_formation_ids_values); GetAllClass_WOfilter(); } @@ -955,7 +972,8 @@ const DistplayPartnerTraningsPage = (props) => { const value = event.target.value; - if (String(value) === "publier" || String(value) === "depublier" || String(value) === "desactiver") { + if (String(value) === "publier" || String(value) === "depublier" || + String(value) === "desactiver" || String(value) === "supprimer") { setactionmass_ftion_val(value); } else { @@ -982,8 +1000,9 @@ const DistplayPartnerTraningsPage = (props) => { var liste_formation = GetSelectedRowsTraining(); + var liste_formation_ids_values = GetSelectedRowsTraining_id_values(); - //console.log(" liste_formation = ", liste_formation); + //console.log(" liste_formation_ids_values = ", liste_formation_ids_values); //console.log(" actionmass_ftion_val = ", actionmass_ftion_val); if (String(actionmass_ftion_val) === String("depublier")) { @@ -1005,6 +1024,12 @@ const DistplayPartnerTraningsPage = (props) => { window.location.reload(); } + else if (String(actionmass_ftion_val) === String("supprimer")) { + Delete_LIST_Formations(liste_formation_ids_values); + GetAllClass_WOfilter(); + //window.location.reload(); + } + } const sleep = (milliseconds) => { @@ -1012,6 +1037,53 @@ const DistplayPartnerTraningsPage = (props) => { } + const [Delete_LIST_Formations_api, setDelete_LIST_Formations_api] = useState(); + const [Delete_LIST_Formations_message, setDelete_LIST_Formations_message] = useState(); + const [Delete_LIST_Formations_result, setDelete_LIST_Formations_result] = useState(); + function Delete_LIST_Formations(local_liste_class) { + + + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + // console.log(" #### local_liste_class = ", local_liste_class) + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("list_class_id", local_liste_class); + + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/delete_list_Class/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Delete_LIST_Formations res.data.status = " + res.data.status); + //console.log(" In Delete_LIST_Formations res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setDelete_LIST_Formations_api("true"); + setDelete_LIST_Formations_result(res.data.message); + setSelectionModel([]); + GetAllClass_new(); + + alert(res.data.message); + } + else { + setDelete_LIST_Formations_api("false"); + setDelete_LIST_Formations_message(res.data.message); + alert(res.data.message); + + } + + }).catch((error) => { + + console.warn('Delete_LIST_Formations : Not good man :( mysearchtext = ' + error); + setDelete_LIST_Formations_api("false"); + alert(" Impossible de supprimer la liste des sessions de formation"); + }) + } + + return (
@@ -1394,7 +1466,7 @@ const DistplayPartnerTraningsPage = (props) => { Action    Publier   Dépublier   - {/*Désactiver  */} + Supprimer   @@ -1420,7 +1492,8 @@ const DistplayPartnerTraningsPage = (props) => {
{' '} - Confirmer l'action {actionmass_ftion_val} en masse. + Confirmer l'action {actionmass_ftion_val} en masse pour {selectionModel.length} lignes. +
diff --git a/src/components/GestionAdministrative.js b/src/components/GestionAdministrative.js index 80ec90f..454bb1f 100644 --- a/src/components/GestionAdministrative.js +++ b/src/components/GestionAdministrative.js @@ -973,11 +973,11 @@ function GestionAdministrative(props) { form.append("client_rattachement_id", p_detail_client_rattachement_id); var myurl = process.env.REACT_APP_API_URL + "myclass/api/UpdateStagiairetoClass/"; - +setLoading(true); 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); - + setLoading(false); if (String(res.data.status) === String("true")) { setUpdateStagiaireData_api("true"); setUpdateStagiaireData_result(res.data.message); @@ -997,7 +997,7 @@ function GestionAdministrative(props) { } }).catch((error) => { - + setLoading(false); console.warn('UpdateStagiaireData : Not good man :( mysearchtext = ' + error); setUpdateStagiaireData_api("false"); setretval_ch("-1"); @@ -1140,10 +1140,11 @@ function GestionAdministrative(props) { const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); + setLoading(true); var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetAllValideSessionFormation_List/"; axios.post(myurl, form).then(res => { - + setLoading(false); if (String(res.data.status) === String("true")) { //console.log(" In GetCurrentClass_trainingsession res.data.status = " + res.data.status); //console.log(" In GetCurrentClass_trainingsession res.data.message r_class = " + res.data.message); @@ -1156,6 +1157,7 @@ function GestionAdministrative(props) { } }).catch((error) => { + setLoading(false); console.warn('Not good man :( GetCurrentClass_trainingsession = ', error); setGetCurrentClass_trainingsession_api("false"); //setmyApimyApiMessage("") @@ -1191,11 +1193,12 @@ function GestionAdministrative(props) { form.append("session_id", mysession); form.append("email", email); + setLoading(true); var myurl = process.env.REACT_APP_API_URL + "myclass/api/CancelAttendeeInscription/"; axios.post(myurl, form).then(res => { - + setLoading(false); if (String(res.data.status) === String("true")) { //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); @@ -1220,6 +1223,7 @@ function GestionAdministrative(props) { }).catch((error) => { + setLoading(false); console.warn('SendInscriptionCancell : Not good man :( mysearchtext = ' + error); setSendInscriptionCancell_api("false"); @@ -1247,9 +1251,9 @@ function GestionAdministrative(props) { var myurl = process.env.REACT_APP_API_URL + "myclass/api/SendInscriptionConfirmation/"; - + setLoading(true); axios.post(myurl, form).then(res => { - + setLoading(false); if (String(res.data.status) === String("true")) { //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); @@ -1267,7 +1271,7 @@ function GestionAdministrative(props) { } }).catch((error) => { - + setLoading(false); console.warn('SendInscriptionConfirmation : Not good man :( mysearchtext = ' + error); setSendInscriptionConfirmation_api("false"); @@ -1873,12 +1877,6 @@ function GestionAdministrative(props) { formateur = document.getElementById("formateur").value; - var lms_class_code = ""; - if (document.getElementById("lms_class_code") && document.getElementById("lms_class_code").value != "") { - lms_class_code = document.getElementById("lms_class_code").value; - - } - //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); @@ -1899,7 +1897,7 @@ function GestionAdministrative(props) { form.append("ville", ville); form.append("code_session", code_session); form.append("formateur", formateur); - form.append("lms_class_code", lms_class_code); + if (sessionStatus) form.append("session_status", "1"); else @@ -2094,13 +2092,6 @@ function GestionAdministrative(props) { formateur = document.getElementById("one_formateur").value; - var lms_class_code = ""; - if (document.getElementById("one_lms_class_code") && document.getElementById("one_lms_class_code").value != "") { - lms_class_code = document.getElementById("one_lms_class_code").value; - - } - - //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); const stored_cookie = getCookie('tokenmysypart'); @@ -2119,7 +2110,7 @@ function GestionAdministrative(props) { form.append("ville", ville); form.append("code_session", code_session); form.append("formateur", formateur); - form.append("lms_class_code", lms_class_code); + if (sessionStatus) form.append("session_status", "1"); else @@ -2205,13 +2196,16 @@ function GestionAdministrative(props) { var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetSessionFormation/"; + setLoading(true); axios.post(myurl, form).then(res => { - + setLoading(false); 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); + setLoading(false); + setGetCurrentSession_api("true"); if (String(res.data.message).length > 0) { setGetCurrentSession_result(res.data.message); @@ -2356,9 +2350,8 @@ function GestionAdministrative(props) { document.getElementsByName("formateur")[0].value = mylocaltraining.formateur; } - document.getElementsByName("lms_class_code")[0].value = ""; + if (mylocaltraining.lms_class_code) { - document.getElementsByName("lms_class_code")[0].value = mylocaltraining.lms_class_code; setis_lms_class_code(mylocaltraining.lms_class_code); } @@ -2388,6 +2381,7 @@ function GestionAdministrative(props) { } }).catch((error) => { + setLoading(false); console.warn('Not good man :( GetCurrentSession = ', error); setGetCurrentSession_api("false"); alert(" Impossible de recuperer les données de la session") @@ -2553,8 +2547,6 @@ function GestionAdministrative(props) { document.getElementsByName("formateur")[0].disabled = true; document.getElementsByName("formateur")[0].style.backgroundColor = "#ECEFF1"; - document.getElementsByName("lms_class_code")[0].disabled = true; - document.getElementsByName("lms_class_code")[0].style.backgroundColor = "#ECEFF1"; document.getElementsByName("nb_participant")[0].disabled = true; document.getElementsByName("nb_participant")[0].style.backgroundColor = "#ECEFF1"; @@ -2606,8 +2598,6 @@ function GestionAdministrative(props) { document.getElementsByName("ville")[0].disabled = false; document.getElementsByName("ville")[0].style.backgroundColor = "#FFFFFF"; - document.getElementsByName("lms_class_code")[0].disabled = false; - document.getElementsByName("lms_class_code")[0].style.backgroundColor = "#FFFFFF"; document.getElementsByName("formateur")[0].disabled = false; document.getElementsByName("formateur")[0].style.backgroundColor = "#FFFFFF"; @@ -5334,22 +5324,7 @@ function GestionAdministrative(props) { />
-
Code Formation LMS - (le code créé dans le LMS) - -
+
Nombre participants *
@@ -5906,22 +5881,7 @@ function GestionAdministrative(props) { />
-
Code Formation LMS - (le code créé dans le LMS) - -
+
Nombre participants *
@@ -7314,7 +7274,8 @@ function GestionAdministrative(props) { />
-
+ +
 
diff --git a/src/components/Partner.js b/src/components/Partner.js index 2f2f193..1b384e3 100644 --- a/src/components/Partner.js +++ b/src/components/Partner.js @@ -1330,7 +1330,7 @@ const Partner = (props) => { {String(menu) === "mes_clients" &&
- +
} diff --git a/src/components/PartnerClient_Activite.js b/src/components/PartnerClient_Activite.js index a36a907..c270d1c 100644 --- a/src/components/PartnerClient_Activite.js +++ b/src/components/PartnerClient_Activite.js @@ -173,6 +173,10 @@ const PartnerClientActivite = (props) => { const [p_activite_type, setp_activite_type] = useState(""); const [p_activite_status, setp_activite_status] = useState(""); const [p_activite_status_label, setp_activite_status_label] = useState(""); + const [p_activite_employee_assigned_id, setp_activite_employee_assigned_id] = useState(props.conntected_employee_id); + const [p_activite_employee_assigned_nom_prenom, setp_activite_employee_assigned_nom_prenom] = useState(); + + const [p_activite_employee_assigned, setp_activite_employee_assigned] = useState(props.conntected_employee_id); // Recuperation des activités du client d'un partner @@ -220,10 +224,48 @@ const PartnerClientActivite = (props) => { useEffect(() => { + Getall_Training_Employee_No_Filter(); Get_List_Activite_Of_client_Part(); }, []); + 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("") + }) + } + const filterPassedTime_start = (time) => { const currentDate = new Date(); const selectedDate = new Date(time); @@ -251,6 +293,10 @@ const PartnerClientActivite = (props) => { form.append("type", p_activite_type); form.append("status", p_activite_status); + if (p_activite_employee_assigned_id) + form.append("employee_assigned_to_id", p_activite_employee_assigned_id); + + // Controle d'integrité des infos var activite_description = "" @@ -378,6 +424,9 @@ const PartnerClientActivite = (props) => { if (one_activite_status) form.append("status", one_activite_status); + if (p_activite_employee_assigned_id) + form.append("employee_assigned_to_id", p_activite_employee_assigned_id); + var myurl = ""; @@ -482,6 +531,12 @@ const PartnerClientActivite = (props) => { setp_activite_deadline(""); + if (mylocalclient_activite.employee_assigned_to_id) { + setp_activite_employee_assigned_nom_prenom(mylocalclient_activite.employee_assigned_to_nom_prenom); + setp_activite_employee_assigned_id(mylocalclient_activite.employee_assigned_to_id); + } + + if (mylocalclient_activite.type) setp_activite_type(mylocalclient_activite.type); else @@ -563,6 +618,12 @@ const PartnerClientActivite = (props) => { document.getElementsByName("activite_status")[0].style.backgroundColor = "#ECEFF1"; } + if (document.getElementsByName("activite_assigned_to")[0]) { + document.getElementsByName("activite_assigned_to")[0].disabled = true; + document.getElementsByName("activite_assigned_to")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("activite_detail")[0]) { document.getElementsByName("activite_detail")[0].disabled = true; document.getElementsByName("activite_detail")[0].style.backgroundColor = "#ECEFF1"; @@ -592,6 +653,12 @@ const PartnerClientActivite = (props) => { document.getElementsByName("activite_status")[0].style.backgroundColor = "#FFFFFF"; } + if (document.getElementsByName("activite_assigned_to")) { + document.getElementsByName("activite_assigned_to")[0].disabled = false; + document.getElementsByName("activite_assigned_to")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("activite_detail")) { document.getElementsByName("activite_detail")[0].disabled = false; document.getElementsByName("activite_detail")[0].style.backgroundColor = "#FFFFFF"; @@ -731,7 +798,7 @@ const PartnerClientActivite = (props) => {
} {String(showactivite_detail) === "1" &&
-
Description
+
Description
{ value={p_activite_type} onChange={(e) => setp_activite_type(e.target.value)} > {type_activite_list.map((option) => ( - + {option.label}  
))} @@ -866,6 +934,52 @@ const PartnerClientActivite = (props) => {
} + + {String(formedit_mode_activite) === "1" &&
Assigné d à (employé)
+ + { + setp_activite_employee_assigned_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} + + + ))} + +
} + + {String(formedit_mode_activite) !== "1" &&
Assigné à (employé)
+ + + +
} + +
Détail
{ />
+ + + + + +
 
@@ -920,12 +1040,12 @@ const PartnerClientActivite = (props) => { setone_activite_description(e.target.value)} @@ -971,7 +1091,7 @@ const PartnerClientActivite = (props) => { value={one_activite_type} onChange={(e) => setone_activite_type(e.target.value)} > {type_activite_list.map((option) => ( - + {option.label}  
))} @@ -1000,6 +1120,34 @@ const PartnerClientActivite = (props) => {
+
Assigné à (employé)
+ { + setp_activite_employee_assigned_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}
+ +
+ ))} +
+
+
Détail
{ />
+ + + +
 
diff --git a/src/components/Partner_Commande.js b/src/components/Partner_Commande.js index c08a247..5de4721 100644 --- a/src/components/Partner_Commande.js +++ b/src/components/Partner_Commande.js @@ -334,13 +334,13 @@ const Partner_Commande = (props) => { Getall_Parter_Orders_No_Filter(); - if ( document.getElementById('myRef_head')) { + if (document.getElementById('myRef_head')) { var divh = document.getElementById('myRef_head').offsetTop; - window.scrollTo({ - top: divh, - behavior: "smooth", - }); - } + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } alert(res.data.message); } else { @@ -533,14 +533,14 @@ const Partner_Commande = (props) => { GetCurrentPartnerClass(); Get_Given_Partner_Config_Point_Taux_TVA(); - if ( document.getElementById('myRef_head')) { + if (document.getElementById('myRef_head')) { var divh = document.getElementById('myRef_head').offsetTop; - window.scrollTo({ - top: divh, - behavior: "smooth", - }); - } - + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + }, []) @@ -750,7 +750,7 @@ const Partner_Commande = (props) => { behavior: "smooth", }); - + } @@ -1190,8 +1190,10 @@ const Partner_Commande = (props) => { if (mylocalclient) { - if (mylocalclient.email) + if (mylocalclient.email){ setp_detail_header_email_client(mylocalclient.email); + //console.log(" ### mylocalclient.email = ", mylocalclient.email); + } } } else if (String(res.data.status) === String("Err_Connexion")) { @@ -1919,13 +1921,13 @@ const Partner_Commande = (props) => { Display_Detail_Order_data(selected_id); alert(" La mise à jour du " + String(p_detail_header_type) + " été correctement faite."); - if ( document.getElementById('myRef_head')) { + if (document.getElementById('myRef_head')) { var divh = document.getElementById('myRef_head').offsetTop; - window.scrollTo({ - top: divh, - behavior: "smooth", - }); - } + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } } else { @@ -2021,6 +2023,35 @@ const Partner_Commande = (props) => { form.append("order_line_montant_toutes_taxes", p_add_line_item_total_amount_ttc); + // Controle des champs obligatoires + if( !p_add_line_item || String(p_add_line_item).length < 2){ + alert(" Vous devez choisir un article "); + return; + } + + console.log(" ### p_add_line_item = ", p_add_line_item); + + if (!p_add_line_item_qty || parseFloat(String(p_add_line_item_qty)) <= 0){ + alert(" La quantité choisie est incorrecte "); + return; + } + + if (!p_add_line_item_price || parseFloat(String(p_add_line_item_price)) < 0){ + alert(" Le prix unitaire est incorrecte "); + return; + } + + if( String(p_add_line_item_type_reduction) === "percent" && + ( parseFloat(String(p_add_line_item_reduction_value)) < 0 || parseFloat(String(p_add_line_item_reduction_value)) > 100 ) ){ + alert(" Pour une reduction de type 'pourcentage', la valeur doit être comprise entre 0 et 100 "); + return; + } + + if( String(p_add_line_item_type_reduction) === "fixe" && + ( parseFloat(String(p_add_line_item_reduction_value)) < 0 || parseFloat(String(p_add_line_item_reduction_value)) > parseFloat(String(p_add_line_item_price)) ) ){ + alert(" Pour une reduction de type 'fixe', la valeur ne doit pas excéder le prix unitaire de l'article "); + return; + } //onsole.log("### form = ", form); @@ -2038,7 +2069,8 @@ const Partner_Commande = (props) => { clean_article_detail_fields(); Display_Detail_Order_data(selected_id); - alert(" La mise à jour été correctement faite."); + alert(" L'article a été correctement ajouté / mis à jour."); + setDialog_Detail_Article_open(false); //myRef_head.current.scrollIntoView({ behavior: "smooth" }); @@ -2062,7 +2094,7 @@ const Partner_Commande = (props) => { const Update_Dialog_Detail_Article_open = () => { Add_Update_One_Order_Line_Data(); - setDialog_Detail_Article_open(false); + }; @@ -2151,7 +2183,14 @@ const Partner_Commande = (props) => { form.append("order_header_email_client", p_detail_header_email_client); + + if( !p_add_cmd_header_client_id || String(p_add_cmd_header_client_id).length < 2 ){ + alert(" Vous devez choisir un client"); + return; + } //console.log("### form = ", form); + + var myurl = "" if (String(p_add_cmd_header_order_type) === "devis") { @@ -2180,13 +2219,13 @@ const Partner_Commande = (props) => { alert(" La commande à jour été correctement ajoutée."); } - if ( document.getElementById('myRef_head')) { + if (document.getElementById('myRef_head')) { var divh = document.getElementById('myRef_head').offsetTop; - window.scrollTo({ - top: divh, - behavior: "smooth", - }); - } + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } } else { @@ -2637,13 +2676,13 @@ const Partner_Commande = (props) => { Getall_Parter_Orders_No_Filter(); Display_Detail_Order_data(selected_id); - if ( document.getElementById('myRef_head')) { + if (document.getElementById('myRef_head')) { var divh = document.getElementById('myRef_head').offsetTop; - window.scrollTo({ - top: divh, - behavior: "smooth", - }); - } + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } alert(res.data.message); @@ -2694,13 +2733,13 @@ const Partner_Commande = (props) => { Getall_Parter_Orders_No_Filter(); Display_Detail_Order_data(selected_id); - if ( document.getElementById('myRef_head')) { + if (document.getElementById('myRef_head')) { var divh = document.getElementById('myRef_head').offsetTop; - window.scrollTo({ - top: divh, - behavior: "smooth", - }); - } + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } alert(res.data.message); @@ -2819,6 +2858,7 @@ const Partner_Commande = (props) => { {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Article { {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Quantité { {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Prix Unitaire {
Client