From 1aa902723948ca434db46876aaa6767ce0b84d41 Mon Sep 17 00:00:00 2001 From: cherif Date: Fri, 2 Aug 2024 12:08:03 +0200 Subject: [PATCH] 02/08/2024 - 12h --- src/components/DisplayPartnerSession.js | 4 +- .../DisplayPartnerUnite_Enseignement.js | 316 ++++++++++++++++-- src/components/Groupe_Apprenant.js | 224 ++++++++++++- src/components/Module_Editique.js | 26 +- .../Module_Session_Planification.js | 20 +- src/components/Partner_Commande.js | 3 +- 6 files changed, 547 insertions(+), 46 deletions(-) diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index cfd60d8..ab3ed54 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -4996,7 +4996,7 @@ const DisplayPartnerSession = (props) => { 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 r_class = " + res.data.message); //console.log(" In GetCurrentSession res.data.message len = " + String(res.data.message).length); setLoading(false); @@ -19873,8 +19873,6 @@ const DisplayPartnerSession = (props) => { /> - - } {String(submenu) === String("evaluation") && diff --git a/src/components/DisplayPartnerUnite_Enseignement.js b/src/components/DisplayPartnerUnite_Enseignement.js index e7e2db7..ae5689f 100644 --- a/src/components/DisplayPartnerUnite_Enseignement.js +++ b/src/components/DisplayPartnerUnite_Enseignement.js @@ -76,6 +76,23 @@ const DisplayPartnerUnite_Enseignement = (props) => { { field: 'id', headerName: 'id', hide: true }, { field: 'code', headerName: 'Code', flex: 1, hide: false, editable: false, renderCell: (params) => , }, { field: 'titre', headerName: 'Titre', flex: 1, hide: false, editable: false, renderCell: (params) => , }, + { field: 'bloc', headerName: 'Bloc', flex: 1, hide: true, editable: false, renderCell: (params) => , }, + + + { field: 'domain_id', headerName: 'Domaine', flex: 1, hide: false, editable: false, renderCell: (cellValues) => { + return ( +
+ {New_Get_List_Domaines_result && New_Get_List_Domaines_result.length > 0 && } +
+ + ); + } + }, + + { field: 'duration_concat', headerName: 'Durée', flex: 1, hide: false, editable: false, renderCell: (params) => , }, { field: 'duration', headerName: 'Durée', flex: 1, hide: true, editable: false }, { field: 'duration_unite', headerName: 'Unit.', flex: 1, hide: true, editable: false }, @@ -146,33 +163,33 @@ const DisplayPartnerUnite_Enseignement = (props) => { function ExpandableCell_50({ value }) { const [expanded, setExpanded] = React.useState(false); - + return ( - + ); - } - + } + function handleClick_delete(event, cellValues) { @@ -404,6 +421,18 @@ const DisplayPartnerUnite_Enseignement = (props) => { setp_detail_code(""); } + if (local_ue.domain_id) { + setp_detail_domaine(local_ue.domain_id); + } else { + setp_detail_domaine(""); + } + + if (local_ue.bloc) { + setp_detail_bloc(local_ue.bloc); + } else { + setp_detail_bloc(""); + } + if (local_ue.titre) { setp_detail_titre(local_ue.titre); } else { @@ -557,6 +586,16 @@ const DisplayPartnerUnite_Enseignement = (props) => { document.getElementsByName("unit_duree")[0].style.backgroundColor = "#ECEFF1"; } + + if (document.getElementsByName("domaine") && document.getElementsByName("domaine")[0]) { + document.getElementsByName("domaine")[0].disabled = true; + document.getElementsByName("domaine")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("bloc") && document.getElementsByName("bloc")[0]) { + document.getElementsByName("bloc")[0].disabled = true; + document.getElementsByName("bloc")[0].style.backgroundColor = "#ECEFF1"; + } } @@ -580,11 +619,22 @@ const DisplayPartnerUnite_Enseignement = (props) => { document.getElementsByName("description")[0].style.backgroundColor = "#FFFFFF"; } + if (document.getElementsByName("domaine") && document.getElementsByName("domaine")[0]) { + document.getElementsByName("domaine")[0].disabled = false; + document.getElementsByName("domaine")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("bloc") && document.getElementsByName("bloc")[0]) { + document.getElementsByName("bloc")[0].disabled = false; + document.getElementsByName("bloc")[0].style.backgroundColor = "#FFFFFF"; + } + } useEffect(() => { + Get_List_Domaines(); Getall_Parter_Unite_Enseignement(); @@ -613,6 +663,8 @@ const DisplayPartnerUnite_Enseignement = (props) => { setfield_objectif(""); setfield_programme(""); setfield_preprequis(""); + setp_detail_domaine(""); + setp_detail_bloc(""); } @@ -631,6 +683,9 @@ const DisplayPartnerUnite_Enseignement = (props) => { form.append("code", p_detail_code); form.append("titre", p_detail_titre); + form.append("domain_id", p_detail_domaine); + form.append("bloc", p_detail_bloc); + form.append("duration", p_detail_duration); form.append("duration_unite", p_detail_duration_unite); @@ -779,6 +834,11 @@ const DisplayPartnerUnite_Enseignement = (props) => { const [p_detail_code, setp_detail_code] = useState(""); const [p_detail_titre, setp_detail_titre] = useState(""); + const [p_detail_bloc, setp_detail_bloc] = useState(""); + + const [p_detail_domaine, setp_detail_domaine] = useState(""); + + const [p_detail_support, setp_detail_support] = useState(""); const [p_detail_duration, setp_detail_duration] = useState(""); const [p_detail_duration_unite, setp_detail_duration_unite] = useState(""); @@ -872,6 +932,86 @@ const DisplayPartnerUnite_Enseignement = (props) => { { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres. ] + const [New_Get_List_Domaines_result, setNew_Get_List_Domaines_result] = useState([]); + + const [Get_List_Domaines_api, setGet_List_Domaines_api] = useState(); + const [Get_List_Domaines_message, setGet_List_Domaines_message] = useState(); + const [Get_List_Domaines_result, setGet_List_Domaines_result] = useState(); + function Get_List_Domaines() { + 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_Class_domaine/"; + + fetch(myurl, + { + method: 'POST', + body: form, + }) + .then((data) => data.json()) + .then((data) => { + //console.log(' IN Get_List_Domaines Success:', data['message'], "data['status'] = ", data['status']); + + if (String(data['status']) === String("true")) { + setGet_List_Domaines_api("true"); + setGet_List_Domaines_result(data['message']); + + var new_data2 = []; + const new_data = data['message'].map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_code = JSON.parse(x).code; + var local_nom = JSON.parse(x).nom; + + + //--- + var node = { + "id": localid, + "_id": local_id, + "nom": local_nom, + "code": local_code, + "label": local_nom, + + + }; + new_data2.push(node); + }); + + var node = { + "id": "", + "_id": "", + "nom": "", + "code": "", + "label": "", + + + }; + new_data2.push(node); + + if (new_data2.length > 0) { + setNew_Get_List_Domaines_result(new_data2); + + // console.log(" ## new_data2 = ", new_data2); + // console.log(" ## New_Get_List_Domaines_result = ", New_Get_List_Domaines_result); + } else { + setNew_Get_List_Domaines_result([]) + } + } + else { + setGet_List_Domaines_api("false"); + setGet_List_Domaines_message(data['message']); + } + + }).catch((error) => { + console.error('Error Get_List_Domaines :', error); + setGet_List_Domaines_api("false"); + }); + } + return (
@@ -1243,6 +1383,9 @@ const DisplayPartnerUnite_Enseignement = (props) => { duration: JSON.parse(item).duration_concat, duration_unite: JSON.parse(item).duration_unite, + domain_id: JSON.parse(item).domain_id, + bloc: JSON.parse(item).bloc, + } ))} @@ -1330,7 +1473,7 @@ const DisplayPartnerUnite_Enseignement = (props) => { {/*** Affichage d'une UE */} {display_ue && String(display_ue) === "1" && String(add_one_ue) !== "1" &&
- +
Code
{ />
+
Bloc
+ setp_detail_bloc(e.target.value)} + + /> +
+ + {ue_data_edit_mode && String(ue_data_edit_mode) === "1" && + New_Get_List_Domaines_result && New_Get_List_Domaines_result.length > 0 &&
Domaine
+ (data)._id === String(p_detail_domaine))[0].label} + + onChange={(event, value) => { + if (value && value._id) { + setp_detail_domaine(value._id); + + } else { + setp_detail_domaine(""); + } + }} + + renderInput={(params) => + } + /> + +
} + + {ue_data_edit_mode && String(ue_data_edit_mode) !== "1" && + New_Get_List_Domaines_result && New_Get_List_Domaines_result.length > 0 &&
Domaine
+ (data)._id === String(p_detail_domaine))[0].label} + + + /> + +
} + + {ue_data_edit_mode && String(ue_data_edit_mode) !== "1" &&
Durée
{
-
+
Pré-requis (max 1000 caractères)
{
-
+
Objectif (max 1000 caractères)
{
Suivi & Evaluation :
- {parse(field_suivi_eval.replace(/(<([^>]+)>)/ig, ''))} - + {parse(field_suivi_eval.replace(/(<([^>]+)>)/ig, ''))} +

@@ -1815,6 +2024,49 @@ const DisplayPartnerUnite_Enseignement = (props) => { />
+
Bloc
+ setp_detail_bloc(e.target.value)} + + /> +
+ + {New_Get_List_Domaines_result && New_Get_List_Domaines_result.length > 0 &&
Domaine
+ (data)._id === String(p_detail_domaine))[0].label} + + onChange={(event, value) => { + if (value && value._id) { + setp_detail_domaine(value._id); + + } else { + setp_detail_domaine(""); + } + }} + + renderInput={(params) => + } + /> + +
}
Unité Durée
@@ -1940,7 +2192,7 @@ const DisplayPartnerUnite_Enseignement = (props) => {
-
+
Objectif (max 1000 caractères)
{
-
+
Programme (max 1000 caractères)
{ const history = useHistory(); const [submenu, setsubmenu] = useState(""); @@ -1773,6 +1775,25 @@ const Groupe_Apprenant = (props) => { { "id": "", "label": "", "value": "" }, ] + const [Dialog_GRP_AUTOMATIC_message, setDialog_GRP_AUTOMATIC_message] = React.useState(false); + const [Dialog_GRP_AUTOMATIC_open, setDialog_GRP_AUTOMATIC_open] = React.useState(false); + + + const Dialog_GRP_AUTOMATIC_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const Dialog_GRP_AUTOMATIC_handleClose_buton = () => { + + setDialog_GRP_AUTOMATIC_open(false); + }; + + + const New_Option_Groupe_By = [ + { "id": "0", "label": "Ordre Alphabétique (nom)", "value": "0" }, + { "id": "1", "label": "Aléatoire", "value": "2" }, + ] return (
@@ -1780,6 +1801,193 @@ const Groupe_Apprenant = (props) => {
} + {/*** Dialog GROUPE AUTOMATIC */} + + null} + + > + + Création automatique des groupes + + + + + +
Nombre de Groupe + { + + + } + } + + /> + +
+ +
Créer groupe par + { + + }} + + renderInput={(params) => + } + /> + + +
+ +
Formation
+ {New_Getall_Partner_Class_Reduice_Fields_result && New_Getall_Partner_Class_Reduice_Fields_result.length > 0 && + + (data)._id === String(p_detail_class_id))[0].label} + onChange={(event, value) => { + if (value && value._id) { + setp_detail_class_id(value._id); + setp_detail_class_internal_url(value.internal_url); + setgrp_apprenant_data_changed("1"); + } else { + + + setp_detail_class_id(""); + setp_detail_class_internal_url(""); + setgrp_apprenant_data_changed("1"); + } + + setp_detail_session_id(""); + + }} + + renderInput={(params) => + } + /> + + } + +
+ +
Classe
+ {New_Getall_Partner_Session_Reduice_Fields_result && New_Getall_Partner_Session_Reduice_Fields_result.length > 0 && + + (data).class_internal_url === String(p_detail_class_internal_url))} + value={New_Getall_Partner_Session_Reduice_Fields_result.filter((data) => (data)._id === String(p_detail_session_id))[0].label} + onChange={(event, value) => { + if (value && value._id) { + setp_detail_session_id(value._id); + setgrp_apprenant_data_changed("1"); + } else { + setp_detail_session_id(""); + setgrp_apprenant_data_changed("1"); + } + }} + + renderInput={(params) => + } + /> + + } + +
+ +
Type de Groupe
+ {New_Getall_Groupe_Apprenant_Type_result && New_Getall_Groupe_Apprenant_Type_result.length > 0 && + + (data).code === String(p_detail_type_groupe_code))[0].label} + + onChange={(event, value) => { + if (value && value.code) { + + setp_detail_type_groupe_code(value.code); + setgrp_apprenant_data_changed("1"); + } else { + + setp_detail_type_groupe_code(""); + setgrp_apprenant_data_changed("1"); + } + + }} + + renderInput={(params) => + } + /> + + } + + +
+ + +
+ + + + +
+
+ + +
+ +
+ +
+
+ +
+ + +
+ + {/*** Fin ajout GROUPE AUTOMATIC */} +

Les groupes d'apprenants

@@ -2213,6 +2421,18 @@ const Groupe_Apprenant = (props) => {
+ + + +   +
- -
Classe
{New_Getall_Partner_Session_Reduice_Fields_result && New_Getall_Partner_Session_Reduice_Fields_result.length > 0 && @@ -2993,7 +3211,7 @@ const Groupe_Apprenant = (props) => { }}>Actualiser la liste
diff --git a/src/components/Module_Editique.js b/src/components/Module_Editique.js index 376ba7d..989a426 100644 --- a/src/components/Module_Editique.js +++ b/src/components/Module_Editique.js @@ -421,6 +421,9 @@ const Module_Editique = (props) => { } + + + useEffect(() => { Getall_Partner_Digital_Sign_Status(); @@ -477,6 +480,11 @@ const Module_Editique = (props) => { const [selected_session_id, setselected_session_id] = useState(""); const [selected_internal_url, setselected_internal_url] = useState(); + const [local_nb_valide_inscription_entreprise, setlocal_nb_valide_inscription_entreprise] = useState(""); + const [local_nb_valide_inscription_individuelle, setlocal_nb_valide_inscription_individuelle] = useState(); + const [local_selected_session_invoiced_statut, setlocal_selected_session_invoiced_statut] = useState(); + + const [selected_convention_id, setselected_convention_id] = useState(""); const [selected_convention_type, setselected_convention_type] = useState(""); @@ -914,6 +922,19 @@ const Module_Editique = (props) => { setsession_date_debut(mylocaltraining.date_debut); } + if (mylocaltraining.nb_valide_inscription_entreprise) { + setlocal_nb_valide_inscription_entreprise(mylocaltraining.nb_valide_inscription_entreprise); + } else { + setlocal_nb_valide_inscription_entreprise(""); + } + + if (mylocaltraining.nb_valide_inscription_individuelle) { + setlocal_nb_valide_inscription_individuelle(mylocaltraining.nb_valide_inscription_individuelle); + } else { + setlocal_nb_valide_inscription_individuelle(""); + } + + } @@ -1527,7 +1548,7 @@ const Module_Editique = (props) => { } /> - +
@@ -2566,8 +2587,9 @@ const Module_Editique = (props) => {
} + {String(props.selected_session_invoiced_statut) !== "1" && String(props.selected_session_invoiced_statut) !== "2" && - String(props.nb_valide_inscription_entreprise) === "0" && String(props.nb_valide_inscription_individuelle) === "0" &&
+ String(local_nb_valide_inscription_entreprise) === "0" && String(local_nb_valide_inscription_individuelle) === "0" &&
{ null} > @@ -2232,9 +2234,11 @@ const Module_Session_Planification = (props) => { null} > @@ -2426,9 +2430,11 @@ const Module_Session_Planification = (props) => { null} > @@ -2717,8 +2723,10 @@ const Module_Session_Planification = (props) => { null} > {Dialog_seq_CREATION_SEMAINE_TYPE_message} @@ -3105,9 +3113,11 @@ const Module_Session_Planification = (props) => { null} > diff --git a/src/components/Partner_Commande.js b/src/components/Partner_Commande.js index 66bf2ea..a861762 100644 --- a/src/components/Partner_Commande.js +++ b/src/components/Partner_Commande.js @@ -4966,7 +4966,8 @@ const Partner_Commande = (props) => { //onClose={Dialog_Order_handleClose} className="partner_commande" static - onClose={() => null}> + onClose={() => null} + > {Dialog_1_message}