From a920814520e8935f83082376bf03b6bfeed7d5df Mon Sep 17 00:00:00 2001 From: cherif Date: Thu, 8 May 2025 14:07:42 +0200 Subject: [PATCH] 08/05/2025 - 14h --- src/components/Jurys.js | 101 ++- .../Module_Session_Notes_Classement.js | 698 +++++++++++++++++- 2 files changed, 776 insertions(+), 23 deletions(-) diff --git a/src/components/Jurys.js b/src/components/Jurys.js index d51b580..15d5e22 100644 --- a/src/components/Jurys.js +++ b/src/components/Jurys.js @@ -724,8 +724,70 @@ const Jury = (props) => { }, []) + + + const [GetCurrentSession_api, setGetCurrentSession_api] = useState(); + const [GetCurrentSession_message, setGetCurrentSession_message] = useState(); + const [GetCurrentSession_result, setGetCurrentSession_result] = useState([]); + function GetCurrentSession(local_session_id) { + + + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("session_id", local_session_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_SessionFormation_From_Id/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + + if (String(res.data.status) === "true") { + //console.log(" In GetCurrentSession res.data.status = " + res.data.status); + //console.log(" In GetCurrentSession res.data.message r_class = " + res.data.message); + //console.log(" In GetCurrentSession res.data.message len = " + String(res.data.message).length); + + setLoading(false); + setGetCurrentSession_api("true"); + if (String(res.data.message).length > 0) { + setGetCurrentSession_result(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); + setGetCurrentSession_api("false"); + setGetCurrentSession_message(res.data.message); + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( GetCurrentSession = ', error); + setGetCurrentSession_api("false"); + alert(" Impossible de récuperer les données de la session "); + + + }) + } + + const myRef_head = useRef(null); const myRef = useRef(null) + const myRef_note_classemment = useRef(null) + + + const sleep = (milliseconds) => { return new Promise(resolve => setTimeout(resolve, milliseconds)) } @@ -1920,6 +1982,8 @@ const Jury = (props) => { const [p_detail_linked_collection, setp_detail_linked_collection] = useState(""); const [p_detail_linked_collection_recid, setp_detail_linked_collection_recid] = useState(""); + const [seance_linked_class_id, setseance_linked_class_id] = useState(""); + const [startDate, setStartDate] = useState(new Date()); const [endDate, setendDate] = useState(new Date()); @@ -2089,7 +2153,7 @@ const Jury = (props) => { 'justified': String(JSON.parse(obj).justified), 'linked_collection': String(local_linked_collection), - 'linked_collection_recid':String(local_linked_collection_recid), + 'linked_collection_recid': String(local_linked_collection_recid), } tab_event.push(local_val); @@ -2302,7 +2366,7 @@ const Jury = (props) => { }) } - const [display_view, setdisplay_view] = useState("planning"); + const [display_view, setdisplay_view] = useState("list"); function func_display_planning_view() { setdisplay_view("planning"); } @@ -2347,6 +2411,10 @@ const Jury = (props) => { var local_code_session = JSON.parse(x).code_session; var local_invoiced_statut = JSON.parse(x).invoiced_statut; + var local_class_id = "" + if( JSON.parse(x).class_id) + local_class_id = JSON.parse(x).class_id; + //--- @@ -2358,6 +2426,7 @@ const Jury = (props) => { "titre": local_title_session, "code_session": local_code_session, "invoiced_statut": local_invoiced_statut, + "class_id": local_class_id, }; new_data2.push(node); @@ -2373,6 +2442,7 @@ const Jury = (props) => { "titre": "", "code_session": "", "invoiced_statut": "", + "class_id": "", }; new_data2.push(node); @@ -2588,7 +2658,7 @@ const Jury = (props) => { onChange={(event, value) => { if (value && value._id) { setp_detail_linked_collection_recid(value._id); - }else{ + } else { setp_detail_linked_collection_recid(""); } @@ -2638,7 +2708,7 @@ const Jury = (props) => { - +
Titre { onRowDoubleClick={(newSelectionModel) => { setp_detail_linked_collection_recid(newSelectionModel.row.event_linked_collection_recid); setsubmenu_detail_seance("notes_classement"); - + GetCurrentSession(newSelectionModel.row.event_linked_collection_recid); + + if (document.getElementById('myRef_note_classemment')) { + var divh = document.getElementById('myRef_note_classemment').offsetTop; + + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + }} rowsPerPageOptions={[10]} @@ -4374,15 +4454,16 @@ const Jury = (props) => {
} - - {String(submenu_detail_seance) === String("notes_classement") &&
+
 
+ {String(submenu_detail_seance) === String("notes_classement") && GetCurrentSession_result.length > 0 && + +
- - -
} diff --git a/src/components/Module_Session_Notes_Classement.js b/src/components/Module_Session_Notes_Classement.js index faec0ff..5b80468 100644 --- a/src/components/Module_Session_Notes_Classement.js +++ b/src/components/Module_Session_Notes_Classement.js @@ -8,18 +8,12 @@ import { getCookie, setCookie } from 'react-use-cookie'; import { useHistory } from "react-router-dom"; import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid'; import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css"; - import 'react-tooltip/dist/react-tooltip.css' - import 'reactjs-popup/dist/index.css'; - - import "react-datepicker/dist/react-datepicker.css"; - import 'moment/locale/fr'; - import Box from '@mui/material/Box'; - +import { Tooltip } from 'react-tooltip' import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif"; import Autocomplete from '@mui/material/Autocomplete'; @@ -30,9 +24,9 @@ import { PiDotsThree } from "react-icons/pi"; import { makeStyles } from "@material-ui/core/styles"; import Paper from '@material-ui/core/Paper'; import Draggable from 'react-draggable'; - - - +import InputAdornment from '@mui/material/InputAdornment'; +import { AiFillCloseCircle } from "react-icons/ai"; +import { MdAddCircleOutline, MdRemoveCircleOutline } from "react-icons/md"; import Module_Alert_Confirmation from "./Module_Alert_Confirmation"; function PaperComponent(props) { @@ -177,8 +171,8 @@ const Module_Session_Notes_Classement = (props) => { { field: 'seuil_validation', headerName: 'Seuil val.', minwidth: 100, flex: 1, hide: false, editable: false, renderCell: (params) => , }, { field: 'ue_coefficient', headerName: 'Coeff.', minwidth: 100, flex: 1, hide: false, editable: false, renderCell: (params) => , }, { field: 'credit', headerName: 'Credit.', minwidth: 100, flex: 1, hide: false, editable: false, renderCell: (params) => , }, - - + + { field: 'ue_validation', headerName: 'Validé', minwidth: 100, flex: 1, hide: false, editable: false, @@ -206,7 +200,7 @@ const Module_Session_Notes_Classement = (props) => { { field: 'regle_calcul', headerName: 'regle_calcul', hide: true }, ] - + const myRef_head = useRef(null); const [New_Getall_Session_Detail_Final_Note_Classement_result, setNew_Getall_Session_Detail_Final_Note_Classement_result] = useState([]); @@ -222,6 +216,36 @@ const Module_Session_Notes_Classement = (props) => { form.append("token", stored_cookie); form.append("tab_session_id", props.related_collection_recid); + // Recuperation des parametres + var filtre1 = p_filtre1; + var filtre2 = p_filtre2; + + + var filtre1_value = ""; + var filtre2_value = ""; + + // Recuperation des valeurs de filtres + + if (p_filtre1_value && String(p_filtre1) === "ue_id") { + filtre1_value = p_filtre1_value; + form.append("tab_ue_id", filtre1_value); + } + else if (p_filtre1_value && String(p_filtre1) === "inscrit_id") { + filtre1_value = p_filtre1_value; + form.append("tab_inscrit_id", filtre1_value); + } + + + + if (p_filtre2_value && String(p_filtre2) === "ue_id") { + filtre2_value = p_filtre2_value; + form.append("tab_ue_id", filtre2_value); + } + else if (p_filtre2_value && String(p_filtre2) === "inscrit_id") { + filtre2_value = p_filtre2_value; + form.append("tab_inscrit_id", filtre2_value); + } + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Evaluation_Final_Note_Classement_Detail_With_Filter"; @@ -328,6 +352,9 @@ const Module_Session_Notes_Classement = (props) => { } + + + const [Calcul_Note_Classement_Session_api, setCalcul_Note_Classement_Session_api] = useState(); const [Calcul_Note_Classement_Session_message, setCalcul_Note_Classement_Session_message] = useState(); const [Calcul_Note_Classement_Session_result, setCalcul_Note_Classement_Session_result] = useState([]); @@ -398,6 +425,37 @@ const Module_Session_Notes_Classement = (props) => { form.append("tab_session_id", props.related_collection_recid); + // Recuperation des parametres + var filtre1 = p_filtre1; + var filtre2 = p_filtre2; + + + var filtre1_value = ""; + var filtre2_value = ""; + + // Recuperation des valeurs de filtres + + if (p_filtre1_value && String(p_filtre1) === "ue_id") { + filtre1_value = p_filtre1_value; + form.append("tab_ue_id", filtre1_value); + } + else if (p_filtre1_value && String(p_filtre1) === "inscrit_id") { + filtre1_value = p_filtre1_value; + form.append("tab_inscrit_id", filtre1_value); + } + + + if (p_filtre2_value && String(p_filtre2) === "ue_id") { + filtre2_value = p_filtre2_value; + form.append("tab_ue_id", filtre2_value); + } + else if (p_filtre2_value && String(p_filtre2) === "inscrit_id") { + filtre2_value = p_filtre2_value; + form.append("tab_inscrit_id", filtre2_value); + } + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Evaluation_UE_Note_Classement_With_Filter"; axios.post(myurl, form).then(res => { @@ -525,6 +583,7 @@ const Module_Session_Notes_Classement = (props) => { + const [New_Getall_Session_Final_Note_Classement_result, setNew_Getall_Session_Final_Note_Classement_result] = useState([]); const [Getall_Session_Final_Note_Classement_api, setGetall_Session_Final_Note_Classement_api] = useState(); @@ -540,6 +599,8 @@ const Module_Session_Notes_Classement = (props) => { form.append("session_id", props.related_collection_recid); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Evaluation_Inscriptio_Note_Classement_With_Filter"; axios.post(myurl, form).then(res => { @@ -635,11 +696,240 @@ const Module_Session_Notes_Classement = (props) => { Getall_Session_Detail_Final_Note_Classement(); Getall_Session_UE_Final_Note_Classement(); Getall_Session_Final_Note_Classement(); + Getall_Class_List_UE(); + + GetListeInscrit(props.related_collection_recid); }, []) + const [nb_stagiaire_Inscrit, setnb_stagiaire_Inscrit] = useState("0"); + const [rowss_insc, setRows_insc] = useState([]); + const [New_GetListeInscrit_result, setNew_GetListeInscrit_result] = useState([]); + + const [GetListeInscrit_insc_api, setGetListeInscrit_insc_api] = useState(); + const [GetListeInscrit_insc_meassage, setGetListeInscrit_insc_meassage] = useState(); + const [GetListeInscrit_insc_result, setGetListeInscrit_insc_result] = useState([]) + function GetListeInscrit(localsessionid) { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("session_id", localsessionid); + form.append("status", "1"); + + /* + + /!\ : Cette fonction a besoin d'un token actif + */ + + if (String(stored_cookie) === String("")) { + alert(" La session n'est plus valide "); + history.push("/Connexion"); + return; + } + + setLoading(true); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetAllClassStagiaire/"; + + fetch(myurl, + { + method: 'POST', + body: form, + }) + .then((data) => data.json()) + .then((data) => { + setLoading(false); + //console.log(' GetListeInscrit : Success:', data['message'], "data['status'] = ", data['status']); + setGetListeInscrit_insc_result(data['message']); + + if (String(data['status']) === String("true")) { + + //console.log("erreur rrrr:" + data['status']) + setGetListeInscrit_insc_api("true"); + setnb_stagiaire_Inscrit(data['message'].length); + //console.log(" ### setnb_stagiaire_Inscrit = ", data['message'].length); + + + var new_data2 = []; + const new_data = data['message'].map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var email = JSON.parse(x).email; + var civilite = JSON.parse(x).civilite; + var prenom = JSON.parse(x).prenom; + var nom = JSON.parse(x).nom; + + var label = JSON.parse(x).nom + " " + JSON.parse(x).prenom; + + + + //--- + var node = { + "_id": local_id, + "id": localid, + "email": email, + "civilite": civilite, + "prenom": prenom, + "nom": nom, + "label": label, + + + }; + new_data2.push(node); + }); + + + //--- + var node = { + "_id": "", + "id": "", + "email": "", + "civilite": "", + "prenom": "", + "label": "", + + }; + new_data2.push(node); + + if (new_data2.length > 0) + setNew_GetListeInscrit_result(new_data2); + else + setNew_GetListeInscrit_result([]) + + //console.log(" ## new_data2 = ", new_data2) + + } else if (String(data['status']) === String("Err_Connexion")) { + alert('Erreur: ' + data['message']); + history.push("/Connexion"); + } + else { + setGetListeInscrit_insc_api("false"); + + } + + }).catch((error) => { + setLoading(false); + console.error('Error:', error); + setGetListeInscrit_insc_api("false"); + }); + + } + + + const [New_Getall_Class_List_UE_result, setNew_Getall_Class_List_UE_result] = useState([]); + + const [Getall_Class_List_UE_api, setGetall_Class_List_UE_api] = useState(); + const [Getall_Class_List_UE_message, setGetall_Class_List_UE_message] = useState(); + const [Getall_Class_List_UE_result, setGetall_Class_List_UE_result] = useState([]); + function Getall_Class_List_UE(event) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + + if (props.session_class_id) + form.append("class_id", props.session_class_id); + + else { + setdisplay_alert_mysy("1"); + setalert_message(" Paramètres incomplets"); + setalert_type("error"); + + return; + } + + + 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 Getall_Class_List_UE res.data.status = " + res.data.status); + // console.log(" In Getall_Class_List_UE res.data.message r_class = " + res.data.message); + setGetall_Class_List_UE_api("true"); + setGetall_Class_List_UE_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_credit = JSON.parse(x).credit; + var local_pres_dist_hyp = JSON.parse(x).pres_dist_hyp; + var local_is_noted = JSON.parse(x).is_noted; + var local_coefficient = JSON.parse(x).coefficient; + var local_seuil_validation = JSON.parse(x).seuil_validation; + + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code, + "code": local_code, + "titre": local_titre, + "credit": local_credit, + "pres_dist_hyp": local_pres_dist_hyp, + "is_noted": local_is_noted, + "coefficient": local_coefficient, + "seuil_validation": local_seuil_validation, + + }; + new_data2.push(node); + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "code": "", + "titre": "", + "credit": "", + "pres_dist_hyp": "", + "is_noted": "", + "coefficient": "", + "seuil_validation": "", + + }; + new_data2.push(node); + + if (new_data2.length > 0) + setNew_Getall_Class_List_UE_result(new_data2); + } + else { + setGetall_Class_List_UE_api("false"); + setGetall_Class_List_UE_message(res.data.message); + //alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + + setLoading(false); + console.warn('Not good man :( Getall_Class_List_UE = ', error); + setGetall_Class_List_UE_api("false"); + alert(" Impossible de recuperer la liste des UE de la formation"); + //setmyApimyApiMessage("") + }) + } + const [gridline_session_inscrit_id, setgridline_session_inscrit_id] = useState(""); const [selectionModel_note_Session_classement, setselectionModel_note_Session_classement] = React.useState([]); @@ -666,6 +956,69 @@ const Module_Session_Notes_Classement = (props) => { } + + const [p_filtre1, setp_filtre1] = useState(""); + const [p_filtre1_value, setp_filtre1_value] = useState(""); + + const [p_filtre2, setp_filtre2] = useState(""); + 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 clean_all_filters() { + setgridline_id(''); + setp_filtre1(""); + setp_filtre1_value(""); + + setp_filtre2(""); + setp_filtre2_value(""); + + setp_filtre3(""); + setp_filtre3_value(""); + + setp_filtre4(""); + setp_filtre4_value(""); + + // Annule_Add_One_Jury_DetailFields(); + + // Getall_Partner_Jury(); + + } + + const New_Option_Filter = [ + { "id": "ue_id", "label": "Code UE", "value": "ue_id" }, + { "id": "inscrit_id", "label": "Apprenant ", "value": "inscrit_id" }, + { "id": "", "label": "", "value": "" }, + { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres. + ] + + function clean_all_filters() { + + setp_filtre1(""); + setp_filtre1_value(""); + + setp_filtre2(""); + setp_filtre2_value(""); + + setp_filtre3(""); + setp_filtre3_value(""); + + setp_filtre4(""); + setp_filtre4_value(""); + + Getall_Session_Detail_Final_Note_Classement(); + Getall_Session_UE_Final_Note_Classement(); + Getall_Session_Final_Note_Classement(); + Getall_Class_List_UE(); + + } + + + return (
@@ -684,6 +1037,8 @@ const Module_Session_Notes_Classement = (props) => { } {/*** FIN Affichage des messages d'alerte*/} + +
@@ -873,6 +1228,323 @@ const Module_Session_Notes_Classement = (props) => {
+ {/***** On n'affiche les filtre que si necessaire */} +
+ +
+
+ + {New_Option_Filter && New_Option_Filter.length > 0 && (data).value === String(p_filtre1))[0].label} + options={New_Option_Filter} + onChange={(event, value) => { + if (value && value.value) { + setp_filtre1(value.value); + + } + + }} + + renderInput={(params) => + } + />} + + +
+ + + +
+ {p_filtre1 && String(p_filtre1) === "ue_id" && New_Getall_Class_List_UE_result.length > 0 && + + (data)._id === String(p_filtre1_value))[0].label} + options={New_Getall_Class_List_UE_result} + onChange={(event, value) => { + if (value && value._id) { + setp_filtre1_value(value._id); + } + }} + + renderInput={(params) => + } + /> + + } + + {p_filtre1 && String(p_filtre1) === "inscrit_id" && New_GetListeInscrit_result.length > 0 && + + (data)._id === String(p_filtre1_value))[0].label} + options={New_GetListeInscrit_result} + onChange={(event, value) => { + if (value && value._id) { + setp_filtre1_value(value._id); + } + }} + + renderInput={(params) => + } + /> + + } + +
+ {p_filtre1 && } + {p_filtre1 && } + + +
+ + {p_filtre2 && +
+
+ + {New_Option_Filter && New_Option_Filter.length > 0 && (data).value === String(p_filtre2))[0].label} + options={New_Option_Filter} + onChange={(event, value) => { + if (value && value.value) { + setp_filtre2(value.value); + + } + + }} + + renderInput={(params) => + } + />} + +
+
+ {String(p_filtre2).length > 2 && String(p_filtre2) === "ue_id" && New_Getall_Class_List_UE_result.length > 0 && + (data)._id === String(p_filtre1_value))[0].label} + options={New_Getall_Class_List_UE_result} + onChange={(event, value) => { + if (value && value._id) { + setp_filtre2_value(value._id); + } + }} + + renderInput={(params) => + } + /> + } + + {String(p_filtre2).length > 2 && String(p_filtre2) === "inscrit_id" && New_GetListeInscrit_result.length > 0 && + (data)._id === String(p_filtre1_value))[0].label} + options={New_GetListeInscrit_result} + onChange={(event, value) => { + if (value && value._id) { + setp_filtre2_value(value._id); + } + }} + + renderInput={(params) => + } + /> + } +
+ + {String(p_filtre2).length > 2 && } + + {String(p_filtre2).length > 2 && } + +
+ } + + + {p_filtre3 && +
+
+ + {New_Option_Filter && New_Option_Filter.length > 0 && (data).value === String(p_filtre3))[0].label} + options={New_Option_Filter} + onChange={(event, value) => { + if (value && value.value) { + setp_filtre3(value.value); + + } + + }} + + renderInput={(params) => + } + />} + + +
+
+ {String(p_filtre3).length > 2 && + setp_filtre3_value(e.target.value)} + InputProps={{ + endAdornment: ( + + { + setp_filtre3_value(""); + }} /> + + ), + }} + + />} +
+ + {String(p_filtre2).length > 2 && } + + {String(p_filtre3).length > 2 && } +
+ } + + +
+ +
+ +
+ +
+ + +
+ +
+ +
+
+ + {/******* End filtre */} +