From f7844e1d9ad3d4f204cf199dc9e34dd49b2751a1 Mon Sep 17 00:00:00 2001 From: cherif Date: Thu, 23 May 2024 18:59:38 +0200 Subject: [PATCH] dsf --- src/components/DisplayPartnerSession.js | 2 +- .../Module_Session_Planification.js | 2 +- src/components/Notes_Evaluation.js | 139 ++++++++++++++++-- 3 files changed, 130 insertions(+), 13 deletions(-) diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index 11d24cf..95cb0e4 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -12197,7 +12197,7 @@ const DisplayPartnerSession = (props) => { } - {String(Dialog_seq_ressource_1_selected_type_ressource) === "ressource_materielle" &&
Ressource Materiel + {String(Dialog_seq_ressource_1_selected_type_ressource) === "ressource_materielle" &&
Ressource Materielle { } - {String(Dialog_seq_ressource_1_selected_type_ressource) === "ressource_materielle" &&
Ressource Materiel + {String(Dialog_seq_ressource_1_selected_type_ressource) === "ressource_materielle" &&
Ressource Materielle { { field: 'statut', headerName: 'statut', minWidth: 200, flex: 1, renderCell: (params) => , }, + + { field: 'eval_date_heure_debut', headerName: 'Début', flex: 1, hide: false, minWidth: 180, renderCell: (params) => , }, + { field: 'eval_date_heure_fin', headerName: 'Fin', flex: 1, hide: false, minWidth: 180, renderCell: (params) => , }, + + { field: "Detail", headerName: 'Voir detail', renderCell: (cellValues) => { @@ -1026,8 +1031,6 @@ const Notes_Evaluation = (props) => { var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Evaluation_Planification_No_Filter/"; - - axios.post(myurl, form).then(res => { if (String(res.data.status) === String("true")) { @@ -1048,6 +1051,8 @@ const Notes_Evaluation = (props) => { var local_class_id = JSON.parse(x).class_id; var local_class_eu_id = JSON.parse(x).class_eu_id; var local_type_eval_id = JSON.parse(x).type_eval_id; + var local_eval_date_heure_debut = JSON.parse(x).eval_date_heure_debut; + var local_eval_date_heure_fin = JSON.parse(x).eval_date_heure_fin; @@ -1059,8 +1064,10 @@ const Notes_Evaluation = (props) => { "code": local_code, "titre": local_titre, "class_id": local_class_id, - "local_class_eu_id": local_class_eu_id, - "local_type_eval_id": local_type_eval_id, + "class_eu_id": local_class_eu_id, + "type_eval_id": local_type_eval_id, + "eval_date_heure_debut": local_eval_date_heure_debut, + "eval_date_heure_fin": local_eval_date_heure_fin, }; new_data2.push(node); @@ -1074,8 +1081,10 @@ const Notes_Evaluation = (props) => { "code": "", "titre": "", "class_id": "", - "local_class_eu_id": "", - "local_type_eval_id": "", + "class_eu_id": "", + "type_eval_id": "", + "eval_date_heure_debut": "", + "eval_date_heure_fin": "", }; new_data2.push(node); @@ -2473,6 +2482,70 @@ const Notes_Evaluation = (props) => { // -- Debut gestion des ressources + + const [Get_Ressource_Avabilities_avability_check, setGet_Ressource_Avabilities_avability_check] = useState(""); + + const [Get_Ressource_Avabilities_api, setGet_Ressource_Avabilities_api] = useState(); + const [Get_Ressource_Avabilities_message, setGet_Ressource_Avabilities_message] = useState(); + const [Get_Ressource_Avabilities_result, setGet_Ressource_Avabilities_result] = useState([]); + function Get_Ressource_Avabilities(local_related_collection_recid) { + + var form = new FormData(); + + var line = New_Getall_Partner_Evaluation_result.filter((data) => (data)._id === String(selected_id)) + + var event_start = String(line[0].eval_date_heure_debut); + var event_end = String(line[0].eval_date_heure_fin); + + + //var event_start = format(String(line[0].eval_date_heure_debut), 'dd/MM/yyyy HH:mm'); + //var event_end = format(String(line[0].eval_date_heure_fin), 'dd/MM/yyyy HH:mm'); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("related_collection", Dialog_seq_ressource_1_selected_type_ressource); + form.append("related_collection_recid", local_related_collection_recid); + form.append("event_start", String(event_start)); + form.append("event_end", String(event_end)); + + //console.log(" ### form = ", form) + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Is_Ressource_Available/"; + + setLoading(true); + + + axios.post(myurl, form).then(res => { + + setLoading(false); + if (String(res.data.status) === String("true")) { + /*console.log(" In Get_Ressource_Avabilities res.data.status = " + res.data.status); + console.log(" In Get_Ressource_Avabilities res.data.message r_class = " + res.data.message); + console.log(" In Get_Ressource_Avabilities res.data.avability_check r_class = " + res.data.avability_check); +*/ + + setGet_Ressource_Avabilities_api("true"); + setGet_Ressource_Avabilities_result(res.data.message); + setGet_Ressource_Avabilities_avability_check(res.data.avability_check); + + } + else { + setGet_Ressource_Avabilities_api("false"); + setGet_Ressource_Avabilities_message(res.data.message); + alert(res.data.message) + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_Ressource_Avabilities = ', error); + setGet_Ressource_Avabilities_api("false"); + alert("Impossible de récuperer la liste des ressources de la sequence") + //setmyApimyApiMessage("") + }) + } + + const [Getall_List_note_evaluation_Ressource_api, setGetall_List_note_evaluation_Ressource_api] = useState(); const [Getall_List_note_evaluation_Ressource_message, setGetall_List_note_evaluation_Ressource_message] = useState(); const [Getall_List_note_evaluation_Ressource_result, setGetall_List_note_evaluation_Ressource_result] = useState([]); @@ -2518,6 +2591,7 @@ const Notes_Evaluation = (props) => { const [selectionModel_ressource, setselectionModel_ressource] = React.useState([]); function submenu_add_one_Ressource() { + setGet_Ressource_Avabilities_avability_check(""); setDialog_seq_ressource_1_open(true); } @@ -2829,11 +2903,13 @@ const Notes_Evaluation = (props) => { options={New_Option_Type_Ressource} onChange={(event, value) => { + setGet_Ressource_Avabilities_avability_check(""); if (value && value.value) { setDialog_seq_ressource_1_selected_type_ressource(value.value); } + }} renderInput={(params) => @@ -2857,7 +2933,10 @@ const Notes_Evaluation = (props) => { onChange={(event, value) => { if (value && value._id) { setDialog_seq_ressource_1_selected_ressource_id(value._id); - + Get_Ressource_Avabilities(value._id); + }else{ + Get_Ressource_Avabilities_avability_check(""); + setDialog_seq_ressource_1_selected_ressource_id(""); } }} @@ -2865,13 +2944,30 @@ const Notes_Evaluation = (props) => { } /> + {Get_Ressource_Avabilities_avability_check && String(Get_Ressource_Avabilities_avability_check) === "0" && + + } + {Get_Ressource_Avabilities_avability_check && String(Get_Ressource_Avabilities_avability_check) === "1" && +
+ + + + + +
+ }
} - {String(Dialog_seq_ressource_1_selected_type_ressource) === "ressource_materielle" &&
Ressource Materiel + {String(Dialog_seq_ressource_1_selected_type_ressource) === "ressource_materielle" &&
Ressource Materielle { onChange={(event, value) => { if (value && value._id) { setDialog_seq_ressource_1_selected_ressource_id(value._id); - - + Get_Ressource_Avabilities(value._id); + }else{ + Get_Ressource_Avabilities_avability_check(""); + setDialog_seq_ressource_1_selected_ressource_id(""); } }} renderInput={(params) => } /> + {Get_Ressource_Avabilities_avability_check && String(Get_Ressource_Avabilities_avability_check) === "0" && + + } + {Get_Ressource_Avabilities_avability_check && String(Get_Ressource_Avabilities_avability_check) === "1" && +
+ + + + + +
+ }
} @@ -3314,6 +3429,8 @@ const Notes_Evaluation = (props) => { type_eval_id: JSON.parse(item).type_eval_id, statut: JSON.parse(item).statut, session_id: JSON.parse(item).session_id, + eval_date_heure_debut: JSON.parse(item).eval_date_heure_debut, + eval_date_heure_fin: JSON.parse(item).eval_date_heure_fin, }