diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index fdeba5b..11d24cf 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -2449,6 +2449,7 @@ const DisplayPartnerSession = (props) => { const [selectionModel_insc, setSelectionModel_insc] = React.useState([]); const [rowss_insc, setRows_insc] = useState([]); const [rowss_preinsc, setRows_preinsc] = useState([]); + const [GetListePreinscrit_insc_api, setGetListePreinscrit_insc_api] = useState(); const [GetListePreinscrit_insc_meassage, setGetListePreinscrit_insc_meassage] = useState(); const [GetListePreinscrit_insc_result, setGetListePreinscrit_insc_result] = useState([]) diff --git a/src/components/Module_Selection_Evaluation_Apprenants.js b/src/components/Module_Selection_Evaluation_Apprenants.js index 08bcb99..0118241 100644 --- a/src/components/Module_Selection_Evaluation_Apprenants.js +++ b/src/components/Module_Selection_Evaluation_Apprenants.js @@ -83,6 +83,23 @@ const Module_Selection_Evaluation_Apprenants = (props) => { const [rowss, setRows] = useState([]); + var date_today_90j = new Date(); + date_today_90j.setDate(date_today_90j.getDate() + 90); + + + const [p_filtre1, setp_filtre1] = useState("Inscrit "); + const [p_filtre1_value, setp_filtre1_value] = useState(""); + + const [p_filtre2, setp_filtre2] = useState("Type de groupe"); + const [p_filtre2_value, setp_filtre2_value] = useState(""); + + const [p_filtre3, setp_filtre3] = useState(""); + const [p_filtre3_value, setp_filtre3_value] = useState(""); + + const [p_filtre4, setp_filtre4] = useState(""); + const [p_filtre4_value, setp_filtre4_value] = useState(""); + + function ExpandableCell_50({ value }) { const [expanded, setExpanded] = React.useState(false); @@ -112,7 +129,101 @@ const Module_Selection_Evaluation_Apprenants = (props) => { ); } + const columns_participants = [ + { field: '_id', headerName: '_id', hide: true, Width: 0 }, + { field: 'id', headerName: 'id', hide: true, Width: 0 }, + { field: 'email', headerName: 'email', flex: 1, hide: false, minWidth: 180, renderCell: (params) => , }, + { field: 'nom', headerName: 'nom', flex: 1, hide: false, minWidth: 180, renderCell: (params) => , }, + { field: 'prenom', headerName: 'prenom', flex: 1, hide: false, minWidth: 180, renderCell: (params) => , }, + { field: 'groupe', headerName: 'groupe', flex: 1, hide: false, minWidth: 180, renderCell: (params) => , }, + + { + field: "Detail", headerName: 'Voir detail', + renderCell: (cellValues) => { + return ( + + + + ); + } + }, + { + field: "delete", headerName: 'Supprimer', + renderCell: (cellValues) => { + return ( + + { + // handleClick_delete(event, cellValues); + }} + > + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, l'employé sera définitivement supprimé.
+ +
+
+
+ + +
+
+ +
+
+
+ )} +
+ + + ); + } + } + + ] + + + const [selectionModel_participants, setselectionModel_participants] = React.useState([]); + + const [selected_id, setselected_id] = React.useState(""); function Display_Colunm_text({ value }) { @@ -126,23 +237,558 @@ const Module_Selection_Evaluation_Apprenants = (props) => { const [isLoading, setLoading] = useState(); + const New_Option_Filter = [ + { "id": "user", "label": "Lié a la Formation (code externe) ", "value": "class_external_code" }, + { "id": "user_group", "label": "Lié a la Classe (code Classe) ", "value": "code_session" }, + { "id": "ty", "label": "Lié a l'UE (code UE) ", "value": "code_ue" }, + { "id": "", "label": "", "value": "" }, + { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres. + ] + + + const New_Option_type_user = [ + { "id": "user", "label": "Personnes Inscrites", "value": "user" }, + { "id": "user_group", "label": "Groupe ", "value": "user_group" }, + { "id": "", "label": "", "value": "" }, + + ] + + const New_Option_type_goupe = [ + { "id": "td", "label": "Groupe TD", "value": "td" }, + { "id": "tp", "label": "Groupe TP", "value": "tp" }, + { "id": "", "label": "", "value": "" }, + ] + + const [GetListePreinscrit_insc_api, setGetListePreinscrit_insc_api] = useState(); + const [GetListePreinscrit_insc_meassage, setGetListePreinscrit_insc_meassage] = useState(); + const [GetListePreinscrit_insc_result, setGetListePreinscrit_insc_result] = useState([]) + function GetListeInscrit() { + + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("session_id", props.session_id); + + + setLoading(true); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Accepted_Insription_From_Session_id_Reduice_Fields/"; + + fetch(myurl, + { + method: 'POST', + body: form, + }) + .then((data) => data.json()) + .then((data) => { + setLoading(false); + console.log(' GetListeInscrit : Success:', data['message'], "data['status'] = ", data['status']); + setGetListePreinscrit_insc_result(data['message']); + + if (String(data['status']) === String("true")) { + //console.log("erreur rrrr:" + data['status']) + setGetListePreinscrit_insc_api("true"); + // setnb_stagiaire_Inscrit(data['message'].length); + //console.log(" ### setnb_stagiaire_Inscrit = ", data['message'].length); + + } else if (String(data['status']) === String("Err_Connexion")) { + alert('Erreur: ' + data['message']); + history.push("/Connexion"); + } + else { + setGetListePreinscrit_insc_api("false"); + + } + + }).catch((error) => { + setLoading(false); + console.error('Error:', error); + setGetListePreinscrit_insc_api("false"); + }); + + } + + const myRef_head = useRef(null); + + + function get_attendee_list_data() { + if (String(p_filtre1_value) === "user") { + GetListeInscrit(); + } + } + + const [gridline_id, setgridline_id] = useState(""); + + const New_Option_PreInscription = [ + { "id": "inscr", "label": "Inscrire", "value": "inscr" }, + ] + const [actionmass_preinsc_val, setactionmass_preinsc_val] = useState(); + + function GetSelectedRows_PreInsc_Ids() { + + + var tab_tmp = [] + for (var i = 0; i < selectionModel_participants.length; i++) { + //console.log(" ### selectionModel_insc[i] = ", selectionModel_insc[i]); + var myid = parseInt(String(selectionModel_participants[i])); + //var line = JSON.parse(rowss[myid]); + tab_tmp.push(myid); + } + return tab_tmp; + + } + + + async function actionmass_preinsc_Traitemet() { + + var liste_preinscr_id = GetSelectedRows_PreInsc_Ids(); + + //console.log(" liste_preinscr_id = ", liste_preinscr_id); + + + + var tab_mongo_preins_ids = []; + + for (var i = 0; i < liste_preinscr_id.length; i++) { + + var line = GetListePreinscrit_insc_result[liste_preinscr_id[i]] + + + var line_json = JSON.parse(line) + //console.log(" line_json['prenom'] = ", line_json['prenom']); + //console.log(" line_json['_id'] = ", line_json['_id']); + tab_mongo_preins_ids.push(line_json['_id']) + + } + + if (String(actionmass_preinsc_val) === String("inscr")) { + Record_Inscrit_To_Evaluation(tab_mongo_preins_ids); + + } + } + + const [Record_Inscrit_To_Evaluation_api, setRecord_Inscrit_To_Evaluation_api] = useState(); + const [Record_Inscrit_To_Evaluation_message, setRecord_Inscrit_To_Evaluation_message] = useState(); + const [Record_Inscrit_To_Evaluation_result, setRecord_Inscrit_To_Evaluation_result] = useState(); + function Record_Inscrit_To_Evaluation(list_inscription_id) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("evaluation_id", props.evaluation_selected_id); + form.append("tab_inscription_id", list_inscription_id); + form.append("tab_group_inscription_id", ""); + + + setLoading(true); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Record_Participant_To_Evaluation/"; + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + setLoading(false); + //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); + //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); + setRecord_Inscrit_To_Evaluation_api("true"); + setRecord_Inscrit_To_Evaluation_result(res.data.message); + + setselectionModel_participants([]); + setactionmass_preinsc_val(""); + alert(res.data.message); + + + } else if (String(res.data.status) === String("Err_Connexion")) { + setLoading(false); + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setLoading(false); + setRecord_Inscrit_To_Evaluation_api("false"); + setRecord_Inscrit_To_Evaluation_message(res.data.message); + alert(res.data.message); + + } + + }).catch((error) => { + setLoading(false); + console.warn('Record_Inscrit_To_Evaluation : Not good man :( mysearchtext = ' + error); + setRecord_Inscrit_To_Evaluation_api("false"); + alert(" Impossible de faire les inscriptions "); + + }) + } + return (
{isLoading &&
} + - + +
+
Utilisez les filtres !
+
+
+ + + +
+ + + +
+ {p_filtre1 && New_Option_type_user && New_Option_type_user.length > 0 && + (data).value === String(p_filtre1_value))[0].label} + options={New_Option_type_user} + onChange={(event, value) => { + if (value && value.value) { + setp_filtre1_value(value.value); + } else { + setp_filtre1_value(""); + } + + }} + + renderInput={(params) => + } + /> + + } + +
+ + +
+ + {p_filtre1_value && String(p_filtre1_value) === "user_group" && +
+
+ + +
+
+ {p_filtre1_value && String(p_filtre1_value) === "user_group" && + + (data).value === String(p_filtre2_value))[0].label} + options={New_Option_type_goupe} + onChange={(event, value) => { + if (value && value.value) { + setp_filtre2_value(value.value); + } else { + setp_filtre2_value(""); + } + + }} + + renderInput={(params) => + } + /> + } +
+ +
+ } + + + +
+ +
+ +
+ +
+ + +
+ +
+ +
+
- Les critère de selection :
- - Formation : avec valeur par default
- - classe / session : Avec critères par default
- - type de groupe : [groupe TD, groupe TP, groupe Autre, etc] - - Incrit : Choisir par mis les types
-   + + +
+ +
+
+ +
+ +   + + { + setselectionModel_participants(newSelectionModel); + /*if (newSelectionModel.length === 1) + handleClick_edit_employee_From_Line(newSelectionModel);*/ + if (newSelectionModel.length !== 1) { + /* setsubmenu(); + setdisplay_detail_employe(); + setadd_One_Employee();*/ + } + }} + selectionModel={selectionModel_participants} + + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={GetListePreinscrit_insc_result.map((item, index) => ( + { + id: index, + _id: JSON.parse(item)._id, + code: JSON.parse(item).code, + email: JSON.parse(item).apprenant_email, + nom: JSON.parse(item).apprenant_nom, + prenom: JSON.parse(item).apprenant_prenom, + groupe: JSON.parse(item).groupe, + } + ))} + + columns={columns_participants} + pageSize={10} + className="datagridclass" + + onRowDoubleClick={(newSelectionModel) => { + setselected_id(newSelectionModel.row._id); + setgridline_id(newSelectionModel.row.id); + //handleClick_edit_evaluation_From_Line(newSelectionModel.row.id); + }} + + rowsPerPageOptions={[10]} + disableSelectionOnClick + components={{ + Toolbar: GridToolbar, + }} + //sx={datagridSx} + getCellClassName={(params) => { + + }} + getRowClassName={(params) => { + // Pour la gestion de la couleur de zone double cliquée + if (String(params.row.id) === String(gridline_id)) { + return 'line--statut--selected'; + } + else if (parseInt(String(params.row.id)) % 2 === 0) { + return 'line--statut--pair'; + } + else if (parseInt(String(params.row.id)) % 2 !== 0) { + return 'line--statut--impair'; + } + + + }} + getEstimatedRowHeight={() => 200} + getRowHeight={() => "auto"} + sx={{ + "& .MuiDataGrid-cellContent": { + minHeight: 50, + + } + }} + + /> + + + + {selectionModel_participants && selectionModel_participants.length >= 1 && +
+
+ +   + + { + if (value && value.value) { + if (String(value.value) === "inscr") { + setactionmass_preinsc_val(value.value); + } + else { + setactionmass_preinsc_val(""); + } + } + else { + setactionmass_preinsc_val(""); + } + + }} + + renderInput={(params) => + } + /> +   + + {actionmass_preinsc_val && String(actionmass_preinsc_val).length > 1 && + } +
+ +
+ +
} +
+ +
+ + +
+
+ +
+ +
+ + +
+
+
+
diff --git a/src/components/Notes_Evaluation.js b/src/components/Notes_Evaluation.js index cd9178f..5c0a098 100644 --- a/src/components/Notes_Evaluation.js +++ b/src/components/Notes_Evaluation.js @@ -109,6 +109,35 @@ const Notes_Evaluation = (props) => { ); } + function ExpandableCell_50_bg_hiligt({ value }) { + const [expanded, setExpanded] = React.useState(false); + + return ( + + ); + } + const columns_evalutions = [ { field: '_id', headerName: '_id', hide: true, Width: 0 }, @@ -207,6 +236,131 @@ const Notes_Evaluation = (props) => { ); } }, + { + field: "delete", headerName: 'Supprimer', + renderCell: (cellValues) => { + return ( + + + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, l'employé sera définitivement supprimé.
+ +
+
+
+ + +
+
+ +
+
+
+ )} +
+ + + ); + } + } + + ] + + function handleClick_delete_evaluation(event, cellValues) { + Delete_Given_Evaluation(cellValues.row._id); + } + + + + const [Delete_Given_Evaluation_api, setDelete_Given_Evaluation_api] = useState(); + const [Delete_Given_Evaluation_message, setDelete_Given_Evaluation_message] = useState(); + const [Delete_Given_Evaluation_result, setDelete_Given_Evaluation_result] = useState(); + function Delete_Given_Evaluation(evaluation_id) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("evaluation_id", evaluation_id); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_Evaluation_Planification/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Delete_Given_Evaluation res.data.status = " + res.data.status); + //console.log(" In Delete_Given_Evaluation res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setDelete_Given_Evaluation_api("true"); + setDelete_Given_Evaluation_result(res.data.message); + + Getall_Partner_Evaluation(); + + setdisplay_evaluation(""); + setevaluation_data_changed(""); + setevaluation_data_edit_mode(""); + setgridline_id(""); + alert(res.data.message); + + } + else { + setDelete_Given_Evaluation_api("false"); + setDelete_Given_Evaluation_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + + console.warn('Delete_Given_Evaluation : Not good man :( mysearchtext = ' + error); + setDelete_Given_Evaluation_api("false"); + alert(" Impossible de supprimer l'évaluation "); + }) + } + + + const columns_evalutions_participant = [ + { field: '_id', headerName: '_id', hide: true, Width: 0 }, + { field: 'id', headerName: 'id', hide: true, Width: 0 }, + + { field: 'nom', headerName: 'nom', flex: 1, hide: false, minWidth: 180, renderCell: (params) => , }, + { field: 'prenom', headerName: 'prenom', flex: 1, hide: false, minWidth: 180, renderCell: (params) => , }, + { field: 'email', headerName: 'email', flex: 1, hide: false, minWidth: 180, renderCell: (params) => , }, + { field: 'groupe', headerName: 'groupe', flex: 1, hide: false, minWidth: 180, renderCell: (params) => , }, + { field: 'note', headerName: 'Saisir Note', minWidth: 150, flex: 1, editable: true, renderCell: (params) => , }, + + + { field: "delete", headerName: 'Supprimer', renderCell: (cellValues) => { @@ -270,7 +424,56 @@ const Notes_Evaluation = (props) => { ] + const [Delete_List_Participant_From_Evaluation_api, setDelete_List_Participant_From_Evaluation_api] = useState(); + const [Delete_List_Participant_From_Evaluation_message, setDelete_List_Participant_From_Evaluation_message] = useState(); + const [Delete_List_Participant_From_Evaluation_result, setDelete_List_Participant_From_Evaluation_result] = useState(); + function Delete_List_Participant_From_Evaluation(local_tab_ids) { + + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("evaluation_id", selected_id); + form.append("tab_inscription_id", local_tab_ids); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_Participant_From_Evaluation/"; + setLoading(true); + + axios.post(myurl, form).then(res => { + //console.log(" In Delete_List_Participant_From_Evaluation res.data.status = " + res.data.status); + //console.log(" In Delete_List_Participant_From_Evaluation res.data.message r_class = " + res.data.message); + + setLoading(false); + + if (String(res.data.status) === String("true")) { + setDelete_List_Participant_From_Evaluation_api("true"); + setDelete_List_Participant_From_Evaluation_result(res.data.message); + + setselectionModel_evalutions_participant([]); + Getall_Evaluation_Participant_List(); + + alert(res.data.message) + } + else { + setDelete_List_Participant_From_Evaluation_api("false"); + setDelete_List_Participant_From_Evaluation_message(res.data.message); + alert(res.data.message); + + } + + }).catch((error) => { + setLoading(false); + console.warn('Delete_List_Participant_From_Evaluation : Not good man :( mysearchtext = ' + error); + setDelete_List_Participant_From_Evaluation_api("false"); + alert(" Impossible de supprimer les données"); + }) + } + + const [selectionModel_evalutions, setselectionModel_evalutions] = React.useState([]); + const [selectionModel_evalutions_participant, setselectionModel_evalutions_participant] = React.useState([]); const [selected_id, setselected_id] = React.useState(""); const [display_evaluation, setdisplay_evaluation] = React.useState(""); @@ -288,12 +491,17 @@ const Notes_Evaluation = (props) => { Get_Given_Evaluation_Data(line._id); + Get_List_UE_From_Class_Id(line.class_id); + + setdisplay_evaluation("1"); setadd_one_evaluation(""); setevaluation_data_changed(""); setevaluation_data_edit_mode(""); setsubmenu("detail_evaluation"); + //Getall_Evaluation_Participant_List(); + } @@ -359,6 +567,12 @@ const Notes_Evaluation = (props) => { setp_detail_class_id(""); } + if (mylocal_evaluation.class_internal_url) { + setp_detail_class_internal_url(mylocal_evaluation.class_internal_url); + } else { + setp_detail_class_internal_url(""); + } + if (mylocal_evaluation.class_eu_id) { setp_detail_class_eu_id(mylocal_evaluation.class_eu_id); @@ -551,6 +765,95 @@ const Notes_Evaluation = (props) => { } + const [New_Getall_Evaluation_Participant_List_result, setNew_Getall_Evaluation_Participant_List_result] = useState([]); + + const [Getall_Evaluation_Participant_List_api, setGetall_Evaluation_Participant_List_api] = useState(); + const [Getall_Evaluation_Participant_List_message, setGetall_Evaluation_Participant_List_message] = useState(); + const [Getall_Evaluation_Participant_List_result, setGetall_Evaluation_Participant_List_result] = useState([]); + function Getall_Evaluation_Participant_List(event) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("evaluation_id", selected_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Participant_To_Evaluation/"; + + + + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Evaluation_Participant_List res.data.status = " + res.data.status); + //console.log(" In Getall_Evaluation_Participant_List res.data.message r_class = " + res.data.message); + setGetall_Evaluation_Participant_List_api("true"); + setGetall_Evaluation_Participant_List_result(res.data.message); + setRows(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_nom = JSON.parse(x).nom; + var local_prenom = JSON.parse(x).prenom; + var local_email = JSON.parse(x).email; + var local_note = JSON.parse(x).note; + var local_inscription_id = JSON.parse(x).inscription_id; + var local_group_inscription_id = JSON.parse(x).group_inscription_id; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_nom, + "nom": local_nom, + "prenom": local_prenom, + "email": local_email, + "note": local_note, + "inscription_id": local_inscription_id, + "group_inscription_id": local_group_inscription_id, + + }; + new_data2.push(node); + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "nom": "", + "prenom": "", + "email": "", + "note": "", + "inscription_id": "", + "group_inscription_id": "", + }; + new_data2.push(node); + + if (new_data2.length > 0) + setNew_Getall_Evaluation_Participant_List_result(new_data2); + + } + else { + setGetall_Evaluation_Participant_List_api("false"); + setGetall_Evaluation_Participant_List_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( Getall_Evaluation_Participant_List = ', error); + setGetall_Evaluation_Participant_List_api("false"); + alert(" Impossible de recuperer la liste des inscrits à l'évaluation"); + //setmyApimyApiMessage("") + }) + } + const [New_Getall_Partner_Evaluation_result, setNew_Getall_Partner_Evaluation_result] = useState([]); const [Getall_Partner_Evaluation_api, setGetall_Partner_Evaluation_api] = useState(); @@ -640,6 +943,9 @@ const Notes_Evaluation = (props) => { const [gridline_id, setgridline_id] = useState(""); + + const [gridline_inscrit_id, setgridline_inscrit_id] = useState(""); + const [New_Getall_Partner_Class_Reduice_Fields_result, setNew_Getall_Partner_Class_Reduice_Fields_result] = useState([]); @@ -889,6 +1195,98 @@ const Notes_Evaluation = (props) => { }) } + + + const [New_Get_List_UE_From_Class_Id_result, setNew_Get_List_UE_From_Class_Id_result] = useState([]); + + const [Get_List_UE_From_Class_Id_api, setGet_List_UE_From_Class_Id_api] = useState(); + const [Get_List_UE_From_Class_Id_message, setGet_List_UE_From_Class_Id_message] = useState(); + const [Get_List_UE_From_Class_Id_result, setGet_List_UE_From_Class_Id_result] = useState(); + function Get_List_UE_From_Class_Id(local_class_id) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("class_id", local_class_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Unite_Enseignement_Of_Given_Class/"; + + setLoading(true); + + axios.post(myurl, form).then(res => { + + + setLoading(false); + if (String(res.data.status) === String("true")) { + //console.log(" In Get_List_UE_From_Class_Id res.data.status = " + res.data.status); + //console.log(" In Get_List_UE_From_Class_Id res.data.message r_class = " + res.data.message); + setGet_List_UE_From_Class_Id_api("true"); + setGet_List_UE_From_Class_Id_result(res.data.message); + + var new_data2 = []; + const new_data = res.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_titre = JSON.parse(x).titre; + + var local_class_id = JSON.parse(x).class_id; + var local_internal_url = JSON.parse(x).internal_url; + + + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code, + "code": local_code, + "titre": local_titre, + "class_id": local_class_id, + "internal_url": local_internal_url, + + }; + new_data2.push(node); + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "code": "", + "titre": "", + "class_id": "", + "internal_url": "", + + }; + new_data2.push(node); + + if (new_data2.length > 0) + setNew_Get_List_UE_From_Class_Id_result(new_data2); + } + else { + setGet_List_UE_From_Class_Id_api("false"); + setGet_List_UE_From_Class_Id_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + + setLoading(false); + console.warn('Not good man :( Get_List_UE_From_Class_Id = ', error); + setGet_List_UE_From_Class_Id_api("false"); + alert(" Impossible de recuperer la liste des UE de la formation"); + //setmyApimyApiMessage("") + }) + } + + const [New_Getall_Partner_Type_Evalution_List_result, setNew_Getall_Partner_Type_Evalution_List_result] = useState([]); const [Getall_Partner_Type_Evalution_List_api, setGetall_Partner_Type_Evalution_List_api] = useState(); @@ -1154,7 +1552,7 @@ const Notes_Evaluation = (props) => { var myurl = ""; - if (selected_id && String(selected_id).length > 5 && gridline_id) { + if (selected_id && String(selected_id).length > 5 ) { form.append("evaluation_id", selected_id); myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Evaluation_Planification/"; } else { @@ -1239,6 +1637,9 @@ const Notes_Evaluation = (props) => { const [p_detail_description, setp_detail_description] = React.useState(""); const [p_detail_comment, setp_detail_comment] = React.useState(""); const [p_detail_class_id, setp_detail_class_id] = React.useState(""); + + const [p_detail_class_internal_url, setp_detail_class_internal_url] = React.useState(""); + const [p_detail_class_eu_id, setp_detail_class_eu_id] = React.useState(""); const [p_detail_type_eval_id, setp_detail_type_eval_id] = React.useState(""); @@ -1338,6 +1739,15 @@ const Notes_Evaluation = (props) => { setadd_one_evaluation("1"); setsubmenu("detail_evaluation"); + if (document.getElementById('myRef')) { + // myRef.current.scrollIntoView({ behavior: "smooth" }); + var divh = document.getElementById('myRef').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + } @@ -1368,6 +1778,7 @@ const Notes_Evaluation = (props) => { await sleep(5); setsubmenu("apprenant"); inactive_active_menu_header("apprenant"); + Getall_Evaluation_Participant_List(); } @@ -1409,6 +1820,156 @@ const Notes_Evaluation = (props) => { } + function GetSelectedRows_Apprenant_Evaluation_Ids() { + + + var tab_tmp = [] + for (var i = 0; i < selectionModel_evalutions_participant.length; i++) { + //console.log(" ### selectionModel_insc[i] = ", selectionModel_insc[i]); + var myid = parseInt(String(selectionModel_evalutions_participant[i])); + //var line = JSON.parse(rowss[myid]); + tab_tmp.push(myid); + } + return tab_tmp; + + } + + async function actionmass_evaluation_apprenant_Traitemet() { + + var liste_apprenant_id = GetSelectedRows_Apprenant_Evaluation_Ids(); + + //console.log(" liste_preinscr_id = ", liste_preinscr_id); + + + + var tab_mongo_preins_ids = []; + + for (var i = 0; i < liste_apprenant_id.length; i++) { + + var line = Getall_Evaluation_Participant_List_result[liste_apprenant_id[i]] + + + var line_json = JSON.parse(line) + //console.log(" line_json['prenom'] = ", line_json['prenom']); + //console.log(" line_json['_id'] = ", line_json['_id']); + tab_mongo_preins_ids.push(line_json['_id']) + + } + + if (String(actionmass_eval_inscr_val) === String("delete_inscr")) { + Delete_List_Participant_From_Evaluation(tab_mongo_preins_ids); + + } + } + + const [actionmass_eval_inscr_val, setactionmass_eval_inscr_val] = useState(); + + + const New_Option_PreInscription = [ + { "id": "delete_inscr", "label": "Supprimer", "value": "delete_inscr" }, + ] + + + const [Record_Evaluation_Participants_Notes_api, setRecord_Evaluation_Participants_Notes_api] = useState(); + const [Record_Evaluation_Participants_Notes_message, setRecord_Evaluation_Participants_Notes_message] = useState(); + const [Record_Evaluation_Participants_Notes_result, setRecord_Evaluation_Participants_Notes_result] = useState([]); + function Record_Evaluation_Participants_Notes() { + var form = new FormData(); + + const new_partcipant_notes_JSON = JSON.stringify(New_Getall_Evaluation_Participant_List_result); + + // console.log(" Record_Evaluation_Participants_Notes New_Getall_TrainingParticipant_result = ", New_Getall_TrainingParticipant_result); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("evaluation_id", selected_id); + form.append("tab_participant_note", new_partcipant_notes_JSON); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Participant_Evaluation_Note/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + console.log(" In Record_Evaluation_Participants_Notes res.data.status = " + res.data.status); + console.log(" In Record_Evaluation_Participants_Notes res.data.message r_class = " + res.data.message); + + setLoading(false); + if (String(res.data.status) === String("true")) { + + Getall_Evaluation_Participant_List(); + setselectionModel_evalutions_participant([]) + alert(res.data.message); + + } + else { + setRecord_Evaluation_Participants_Notes_api("false"); + setRecord_Evaluation_Participants_Notes_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Record_Evaluation_Participants_Notes : Not good man :( Record_Evaluation_Participants_Notes = ' + error); + setRecord_Evaluation_Participants_Notes_api("false"); + alert(" Impossible de mettre à jour les données des participants "); + + }) + } + + function OnchangeCellDataGrid(params) { + + + // params = la nouvelle lignes + //console.log(" ### zzz params = ", params); + + var num_line = params.id; // ==> Id de la ligne changé + var colomn = params.field; // ==> colonne de la ligne changé + var new_value = params.value; // ==> la nouvelle valeur + + + + const updatedData = New_Getall_Evaluation_Participant_List_result.map((x) => { + + var localid = (x).id; + + + if (String(num_line) === String(localid) && colomn === "note") { + var tmp = {}; + tmp['id'] = (x).id; + tmp['_id'] = (x)._id; + tmp['nom'] = (x).nom; + tmp['prenom'] = (x).prenom; + tmp['email'] = (x).email; + tmp['groupe'] = (x).groupe; + tmp['note'] = new_value; + + return tmp; + } + + + var tmp = {}; + tmp['id'] = (x).id; + tmp['_id'] = (x)._id; + tmp['nom'] = (x).nom; + tmp['prenom'] = (x).prenom; + tmp['email'] = (x).email; + tmp['groupe'] = (x).groupe; + tmp['note'] = (x).note; + + return tmp; + + + }); + + //console.log(" ### updatedData = ", updatedData); + + setNew_Getall_Evaluation_Participant_List_result([]); + + setNew_Getall_Evaluation_Participant_List_result(updatedData); + + } + return (
{isLoading &&
@@ -1855,7 +2416,7 @@ const Notes_Evaluation = (props) => {
@@ -1937,23 +2498,7 @@ const Notes_Evaluation = (props) => {
-
Classe
- {New_Getall_Partner_Session_Reduice_Fields_result && New_Getall_Partner_Session_Reduice_Fields_result.length > 0 && (data)._id === String(p_detail_session_id))[0].label} - - />} - -
Formation
{New_Getall_Partner_Class_Reduice_Fields_result && New_Getall_Partner_Class_Reduice_Fields_result.length > 0 && {
+
Classe
+ {New_Getall_Partner_Session_Reduice_Fields_result && New_Getall_Partner_Session_Reduice_Fields_result.length > 0 && (data)._id === String(p_detail_session_id))[0].label} + + />} + +
Unite D'enseignement
{New_Getall_Partner_List_UE_result && New_Getall_Partner_List_UE_result.length > 0 && {
-
Classe
+
Formation bbb
+ {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) { + + Get_List_UE_From_Class_Id(value._id); + + setp_detail_class_id(value._id); + setp_detail_class_internal_url(value.internal_url); + setevaluation_data_changed("1"); + } else { + + Get_List_UE_From_Class_Id(""); + + setp_detail_class_id(""); + setp_detail_class_internal_url(""); + setevaluation_data_changed("1"); + } + + setp_detail_session_id(""); + setp_detail_class_eu_id(""); + }} + + renderInput={(params) => + } + /> + + } + +
+ + +
Classe bbb
{New_Getall_Partner_Session_Reduice_Fields_result && New_Getall_Partner_Session_Reduice_Fields_result.length > 0 && { id="detail_classe" className="disabled_style" //className="disabled_style enable_style" - options={New_Getall_Partner_Session_Reduice_Fields_result} + // options={New_Getall_Partner_Session_Reduice_Fields_result} + options={New_Getall_Partner_Session_Reduice_Fields_result.filter((data) => (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) { @@ -2253,40 +2861,9 @@ const Notes_Evaluation = (props) => {
-
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); - setevaluation_data_changed("1"); - } else { - setp_detail_class_id(""); - setevaluation_data_changed("1"); - } - }} - - renderInput={(params) => - } - /> - - } - -
-
Unite D'enseignement
+
Unite D'enseignement bbbb
{New_Getall_Partner_List_UE_result && New_Getall_Partner_List_UE_result.length > 0 && { id="detail_ue" className="disabled_style" //className="disabled_style enable_style" - options={New_Getall_Partner_List_UE_result} + //options={New_Getall_Partner_List_UE_result} + options={New_Get_List_UE_From_Class_Id_result.filter((data) => (data).class_id === String(p_detail_class_id))} value={New_Getall_Partner_List_UE_result.filter((data) => (data)._id === String(p_detail_class_eu_id))[0].label} onChange={(event, value) => { @@ -2652,7 +3230,53 @@ const Notes_Evaluation = (props) => {
-
Classe
+ + +
Formation aaaa
+ {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} + 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) { + Get_List_UE_From_Class_Id(value._id); + + setp_detail_class_id(value._id); + setp_detail_class_internal_url(value.internal_url); + setevaluation_data_changed("1"); + } else { + Get_List_UE_From_Class_Id(""); + + setp_detail_class_id(""); + setp_detail_class_internal_url(""); + setevaluation_data_changed("1"); + } + + // Quand on modifie la formation, la session et l'UE sont reinitialitées + setp_detail_session_id(""); + setp_detail_class_eu_id(""); + }} + + renderInput={(params) => + } + /> + + } + +
+ + +
Classe aaaa
{New_Getall_Partner_Session_Reduice_Fields_result && New_Getall_Partner_Session_Reduice_Fields_result.length > 0 && { id="detail_classe" className="disabled_style" //className="disabled_style enable_style" - options={New_Getall_Partner_Session_Reduice_Fields_result} + options={New_Getall_Partner_Session_Reduice_Fields_result.filter((data) => (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) { @@ -2684,41 +3308,8 @@ const Notes_Evaluation = (props) => {
-
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); - setevaluation_data_changed("1"); - } else { - setp_detail_class_id(""); - setevaluation_data_changed("1"); - } - }} - - renderInput={(params) => - } - /> - - } - -
- - -
Unite D'enseignement
- {New_Getall_Partner_List_UE_result && New_Getall_Partner_List_UE_result.length > 0 && +
Unite D'enseignement aaaa
+ {New_Get_List_UE_From_Class_Id_result && { id="detail_ue" className="disabled_style" //className="disabled_style enable_style" - options={New_Getall_Partner_List_UE_result} + options={New_Get_List_UE_From_Class_Id_result.filter((data) => (data).class_id === String(p_detail_class_id))} value={New_Getall_Partner_List_UE_result.filter((data) => (data)._id === String(p_detail_class_eu_id))[0].label} + // value={New_Get_List_UE_From_Class_Id_result.filter((data) => (data)._id === String(p_detail_class_eu_id))[0].label} + onChange={(event, value) => { if (value && value._id) { setp_detail_class_eu_id(value._id); @@ -3005,7 +3598,309 @@ const Notes_Evaluation = (props) => {
} {String(submenu) === "apprenant" &&
-

Liste des apprenants ou Groupes d'apprenants

+ +
+ +
+
+ + + + +
+ +   + + { + setselectionModel_evalutions_participant(newSelectionModel); + /*if (newSelectionModel.length === 1) + handleClick_edit_employee_From_Line(newSelectionModel);*/ + if (newSelectionModel.length !== 1) { + /* setsubmenu(); + setdisplay_detail_employe(); + setadd_One_Employee();*/ + } + }} + selectionModel={selectionModel_evalutions_participant} + + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={New_Getall_Evaluation_Participant_List_result.filter((tmp) => String(tmp._id) !== "").map((item, index) => ( + { + id: index, + _id: (item)._id, + nom: (item).nom, + prenom: (item).prenom, + email: (item).email, + groupe: (item).groupe, + note: (item).note, + + } + ))} + + columns={columns_evalutions_participant} + pageSize={10} + className="datagridclass" + + onRowDoubleClick={(newSelectionModel) => { + /* setselected_id(newSelectionModel.row._id); + + setgridline_id(newSelectionModel.row.id); + + handleClick_edit_evaluation_From_Line(newSelectionModel.row.id); + */ + + + }} + + rowsPerPageOptions={[10]} + disableSelectionOnClick + components={{ + Toolbar: GridToolbar, + }} + //sx={datagridSx} + getCellClassName={(params) => { + + + + }} + getRowClassName={(params) => { + // Pour la gestion de la couleur de zone double cliquée + if (String(params.row.id) === String(gridline_inscrit_id)) { + return 'line--statut--selected'; + } + else if (parseInt(String(params.row.id)) % 2 === 0) { + return 'line--statut--pair'; + } + else if (parseInt(String(params.row.id)) % 2 !== 0) { + return 'line--statut--impair'; + } + + + }} + getEstimatedRowHeight={() => 200} + getRowHeight={() => "auto"} + sx={{ + "& .MuiDataGrid-cellContent": { + minHeight: 50, + + } + }} + + /> + + {selectionModel_evalutions_participant && selectionModel_evalutions_participant.length >= 1 && +
+
+ +   + + { + if (value && value.value) { + if (String(value.value) === "delete_inscr") { + setactionmass_eval_inscr_val(value.value); + } + else { + setactionmass_eval_inscr_val(""); + } + } + else { + setactionmass_eval_inscr_val(""); + } + + }} + + renderInput={(params) => + } + /> +   + + {actionmass_eval_inscr_val && String(actionmass_eval_inscr_val).length > 1 && + } +
+ +
+ +
} +
+
+
+ + Mettre à jour les notes + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, les notes seront mises à jour. + + +
+
+
+ + +
+
+ +
+
+
+ )} +
+ + +
+ +
 
+ +
+
+ +
+ +
+ + +
+
+
} @@ -3017,8 +3912,9 @@ const Notes_Evaluation = (props) => { {String(submenu) === "selection" &&
- +
} diff --git a/src/components/UpdateAttendeeList.js b/src/components/UpdateAttendeeList.js index 4293d0e..b05580b 100644 --- a/src/components/UpdateAttendeeList.js +++ b/src/components/UpdateAttendeeList.js @@ -248,7 +248,7 @@ function UpdateAttendeeList() { // params = la nouvelle lignes - console.log(" ### zzz params = ", params); + //console.log(" ### zzz params = ", params); var num_line = params.id; // ==> Id de la ligne changé var colomn = params.field; // ==> colonne de la ligne changé @@ -344,7 +344,7 @@ function UpdateAttendeeList() { const new_attende_dat_JSON = JSON.stringify(New_Getall_TrainingParticipant_result); - console.log(" Record_New_Attendee_Data New_Getall_TrainingParticipant_result = ", New_Getall_TrainingParticipant_result); + // console.log(" Record_New_Attendee_Data New_Getall_TrainingParticipant_result = ", New_Getall_TrainingParticipant_result); const stored_cookie = getCookie('tokenmysypart'); form.append("client_id", client_id); @@ -512,8 +512,6 @@ function UpdateAttendeeList() {
- -