From 40d3405351c7e930bec202060290bd8d8a4a129d Mon Sep 17 00:00:00 2001 From: cherif Date: Mon, 27 May 2024 17:00:10 +0200 Subject: [PATCH] qsdsq --- src/components/DisplayPartnerStagiaires.js | 390 ++++++++++++++++++--- 1 file changed, 341 insertions(+), 49 deletions(-) diff --git a/src/components/DisplayPartnerStagiaires.js b/src/components/DisplayPartnerStagiaires.js index dda993f..d8c5b8e 100644 --- a/src/components/DisplayPartnerStagiaires.js +++ b/src/components/DisplayPartnerStagiaires.js @@ -1042,6 +1042,9 @@ const DisplayPartnerStagiaires = (props) => { const [selected_session_id, setselected_session_id] = useState(); const [selected_code_session, setselected_code_session] = useState(); const [selected_internal_url, setselected_internal_url] = useState(); + + const [selected_class_id, setselected_class_id] = useState(); + const [selected_class_title, setselected_class_title] = useState(); const [selected_participant_email, setselected_participant_email] = useState(); @@ -2004,7 +2007,7 @@ const DisplayPartnerStagiaires = (props) => { } function submenu_unite_enseignement() { - + setsubmenu("ue"); setdisplay_detail_stagiaire(); setdisplay_detail_absence(); @@ -2505,6 +2508,106 @@ const DisplayPartnerStagiaires = (props) => { + const [New_Get_Inscrit_List_Evaluation_Par_UE_result, setNew_Get_Inscrit_List_Evaluation_Par_UE_result] = useState([]); + const [tab_inscrit_evaluation_ue_id, settab_inscrit_evaluation_ue_id] = useState([]); + + const [Get_Inscrit_List_Evaluation_Par_UE_api, setGet_Inscrit_List_Evaluation_Par_UE_api] = useState(); + const [Get_Inscrit_List_Evaluation_Par_UE_message, setGet_Inscrit_List_Evaluation_Par_UE_message] = useState(); + const [Get_Inscrit_List_Evaluation_Par_UE_result, setGet_Inscrit_List_Evaluation_Par_UE_result] = useState(); + function Get_Inscrit_List_Evaluation_Par_UE(local_inscription_id) { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("inscription_id", local_inscription_id); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Inscrit_List_EU_Type_Evaluation/"; + + setLoading(true); + + axios.post(myurl, form).then(res => { + + setLoading(false); + + if (String(res.data.status) === String("true")) { + //console.log(" In Get_Inscrit_List_Evaluation_Par_UE res.data.status = " + res.data.status); + //console.log(" In Get_Inscrit_List_Evaluation_Par_UE res.data.message r_class = " + res.data.message); + setGet_Inscrit_List_Evaluation_Par_UE_api("true"); + setGet_Inscrit_List_Evaluation_Par_UE_result(res.data.message); + + var new_data2 = []; + + var tab_tmp = [] + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_class_id = JSON.parse(x).class_id; + var local_class_eu_id = JSON.parse(x).class_eu_id; + var local_class_eu_code = JSON.parse(x).class_eu_code; + var local_type_eval__id = JSON.parse(x).type_eval__id; + var local_type_eval_code = JSON.parse(x).type_eval_code; + var local_type_eval_nom = JSON.parse(x).type_eval_nom; + + tab_tmp.push(local_type_eval__id); + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_class_eu_code + " - " + local_type_eval_code, + "class_id": local_class_id, + "class_eu_id": local_class_eu_id, + "class_eu_code": local_class_eu_code, + "type_eval__id": local_type_eval__id, + "type_eval_code": local_type_eval_code, + "type_eval_nom": local_type_eval_nom, + }; + new_data2.push(node); + + + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "class_id": "", + "class_eu_id": "", + "class_eu_code": "", + "type_eval__id": "", + "type_eval_code": "", + "type_eval_nom": "", + }; + new_data2.push(node); + + + if (new_data2.length > 0) { + setNew_Get_Inscrit_List_Evaluation_Par_UE_result(new_data2); + settab_inscrit_evaluation_ue_id(tab_tmp) + + } + + + } + else { + setGet_Inscrit_List_Evaluation_Par_UE_api("false"); + setGet_Inscrit_List_Evaluation_Par_UE_message(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_Inscrit_List_Evaluation_Par_UE = ', error); + setGet_Inscrit_List_Evaluation_Par_UE_api("false"); + //setmyApimyApiMessage("") + }) + } + + + const [nb_stagiaire_Inscrit, setnb_stagiaire_Inscrit] = useState("0"); const hiddenFileInput_session = React.useRef(null); const [Edite_session, setEdite_session] = useState(); @@ -2607,6 +2710,100 @@ const DisplayPartnerStagiaires = (props) => { } + + const [New_Getall_Class_List_Evalution_result, setNew_Getall_Class_List_Evalution_result] = useState([]); + + const [Getall_Class_List_Evalution_api, setGetall_Class_List_Evalution_api] = useState(); + const [Getall_Class_List_Evalution_message, setGetall_Class_List_Evalution_message] = useState(); + const [Getall_Class_List_Evalution_result, setGetall_Class_List_Evalution_result] = useState([]); + function Getall_Class_List_Evalution(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_Class_Evaluation/"; + + setLoading(true); + + axios.post(myurl, form).then(res => { + + + setLoading(false); + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Class_List_Evalution res.data.status = " + res.data.status); + //console.log(" In Getall_Class_List_Evalution res.data.message r_class = " + res.data.message); + setGetall_Class_List_Evalution_api("true"); + setGetall_Class_List_Evalution_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_class_id = JSON.parse(x).class_id; + var local_class_ue_id = JSON.parse(x).class_ue_id; + var local_class_ue_code = JSON.parse(x).class_ue_code; + var local_type_evaluation_id = JSON.parse(x).type_evaluation_id; + var local_type_evaluation_code = JSON.parse(x).type_evaluation_code; + var local_max_note = JSON.parse(x).max_note; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_type_evaluation_code + "-" + local_class_ue_code, + "class_id": local_class_id, + "class_ue_id": local_class_ue_id, + "class_ue_code": local_class_ue_code, + "type_evaluation_id": local_type_evaluation_id, + "type_evaluation_code": local_type_evaluation_code, + "max_note": local_max_note, + + + }; + new_data2.push(node); + }); + + //--- + var node = { + "_id": "", + "id": "", + "label": "", + "class_id": "", + "class_ue_id": "", + "class_ue_code": "", + "type_evaluation_id": "", + "type_evaluation_code": "", + "max_note": "", + + }; + new_data2.push(node); + + if (new_data2.length > 0) + setNew_Getall_Class_List_Evalution_result(new_data2); + } + else { + setGetall_Class_List_Evalution_api("false"); + setGetall_Class_List_Evalution_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + + setLoading(false); + console.warn('Not good man :( Getall_Class_List_Evalution = ', error); + setGetall_Class_List_Evalution_api("false"); + alert(" Impossible de recuperer la liste des évaluations de la formatio"); + //setmyApimyApiMessage("") + }) + } + + useEffect(() => { Getall_TrainingParticipant(); Getall_TrainingSession(); @@ -5853,6 +6050,9 @@ const DisplayPartnerStagiaires = (props) => { const icon = ; const checkedIcon = ; + const [ueChanged, setueChanged] = useState(""); + + return (
{isLoading &&
@@ -7351,7 +7551,12 @@ const DisplayPartnerStagiaires = (props) => { onRowDoubleClick={(newSelectionModel) => { ///setuserimgclassprofil(""); - Get_List_UE_From_Class_Id(newSelectionModel.row.class_id); // zzzzz + Get_List_UE_From_Class_Id(newSelectionModel.row.class_id); + + Getall_Class_List_Evalution(newSelectionModel.row.class_id); + + setselected_internal_url(newSelectionModel.row.class_internal_url); + setselected_class_id(newSelectionModel.row.class_id); setselected_row_data_json_age(''); setgridline_id(newSelectionModel.row.id); @@ -7370,6 +7575,7 @@ const DisplayPartnerStagiaires = (props) => { } Get_Inscrit_List_UE(newSelectionModel.row._id); + Get_Inscrit_List_Evaluation_Par_UE(newSelectionModel.row._id); setselected_row_data_json(JSON.parse(rowss[newSelectionModel.row.id])); setDialog_stagiaire_open(true); @@ -9902,60 +10108,146 @@ const DisplayPartnerStagiaires = (props) => { {String(props.formation_initiale) === "1" && String(submenu) === "ue" && String(addOneParticipant) !== "1" &&

Gestion des UE d'un inscrit

+
- -
Unite D'enseignement
- {New_Get_List_UE_From_Class_Id_result && New_Get_List_UE_From_Class_Id_result.length > 0 && +
Unite D'enseignement
+ {New_Get_List_UE_From_Class_Id_result && New_Get_List_UE_From_Class_Id_result.length > 0 && - option.label} + option.label} - //className="disabled_style enable_style" - //options={New_Getall_Partner_List_UE_result} - options={New_Get_List_UE_From_Class_Id_result} - defaultValue={New_Get_List_UE_From_Class_Id_result.filter((data) => { - if (tab_inscrit_ue_id.includes(String(data._id))) { - - return data; + //className="disabled_style enable_style" + //options={New_Getall_Partner_List_UE_result} + options={New_Get_List_UE_From_Class_Id_result} + defaultValue={New_Get_List_UE_From_Class_Id_result.filter((data) => { + if (tab_inscrit_ue_id.includes(String(data._id))) { + + return data; + } + })} + //defaultValue={[New_Get_List_UE_From_Class_Id_result[0], New_Get_List_UE_From_Class_Id_result[2],]} + renderOption={(props, option, { selected }) => ( +
  • + + {option.label} +
  • + )} + // style={{ width: 500 }} + + onChange={(event, value) => { + setueChanged("1"); + console.log(" ### value = ", value); + + + + }} + + renderInput={(params) => } - })} - //defaultValue={[New_Get_List_UE_From_Class_Id_result[0], New_Get_List_UE_From_Class_Id_result[2],]} - renderOption={(props, option, { selected }) => ( -
  • - - {option.label} -
  • - )} - // style={{ width: 500 }} - - onChange={(event, value) => { - - console.log(" ### value = ", value); - - - - }} - - renderInput={(params) => - } - /> - } + } + +
    + + +
    Evaluation
    + {New_Getall_Class_List_Evalution_result && New_Getall_Class_List_Evalution_result.length > 0 && + + option.label} + + + //className="disabled_style enable_style" + //options={New_Getall_Partner_List_UE_result} + options={New_Getall_Class_List_Evalution_result} + defaultValue={New_Getall_Class_List_Evalution_result.filter((data) => { + if (tab_inscrit_evaluation_ue_id.includes(String(data.type_evaluation_id))) { + + return data; + } + })} + + renderOption={(props, option, { selected }) => ( +
  • + + {option.label} +
  • + )} + // style={{ width: 500 }} + + onChange={(event, value) => { + setueChanged("1"); + console.log(" ### value = ", value); + + + + }} + + renderInput={(params) => + } + /> + + } + +
    + +
    +
    + {ueChanged && String(ueChanged) === "1" &&
    + /!\ Pensez à enregistrer les modifications +
    } + + {
    + + + + {ueChanged && String(ueChanged) === "1" &&
    + +
    + +
    + + +
    + +
    + +
    } + +
    } +