From 211326c417bb9f27411364c8ce7f902d1d0e606d Mon Sep 17 00:00:00 2001 From: cherif Date: Sun, 11 Aug 2024 12:13:02 +0200 Subject: [PATCH] ssqd --- src/components/Groupe_Apprenant.js | 29 +- .../Module_Session_Planification.js | 914 +++++++++++++----- src/components/Partner.js | 2 +- 3 files changed, 673 insertions(+), 272 deletions(-) diff --git a/src/components/Groupe_Apprenant.js b/src/components/Groupe_Apprenant.js index 4945c1c..346be32 100644 --- a/src/components/Groupe_Apprenant.js +++ b/src/components/Groupe_Apprenant.js @@ -839,16 +839,24 @@ const Groupe_Apprenant = (props) => { // Cette fontion desactive tous les menu header et reactive just le menu_header concerné function inactive_active_menu_header(current_menu_header) { - const list_menu_header_names = ['detail_evaluation', 'apprenant', 'piece_jointe', 'selection',] + + + + const list_menu_header_names = ['detail_groupe', 'apprenant', 'piece_jointe', 'selection',] for (let i = 0; i < list_menu_header_names.length; i++) { if (document.getElementsByName(String(list_menu_header_names[i])) && document.getElementsByName(String(list_menu_header_names[i]))[0]) { document.getElementsByName(String(list_menu_header_names[i]))[0].style.fontWeight = "400"; + document.getElementsByName(String(list_menu_header_names[i]))[0].style.backgroundColor = "#d8edfc"; + document.getElementsByName(String(list_menu_header_names[i]))[0].style.color = "#3b3e40"; + } } if (document.getElementsByName(String(current_menu_header)) && document.getElementsByName(String(current_menu_header))[0]) { document.getElementsByName(String(current_menu_header))[0].style.fontWeight = "700"; + document.getElementsByName(String(current_menu_header))[0].style.backgroundColor = "#104277"; + document.getElementsByName(String(current_menu_header))[0].style.color = "white"; } } @@ -1483,6 +1491,7 @@ const Groupe_Apprenant = (props) => { setgrp_apprenant_data_edit_mode(""); clear_DetailFieds(); + handleClick_edit_evaluation_From_Line(gridline_id); if (selected_id && String(selected_id).length > 5) { Disable_Grp_Apprenant_DetailFields(); @@ -1545,7 +1554,7 @@ const Groupe_Apprenant = (props) => { setadd_one_grp_apprenant(""); setgrp_apprenant_data_changed(""); setgrp_apprenant_data_edit_mode(""); - setsubmenu("detail_groupe"); + submenu_detail(); //Getall_Evaluation_Participant_List(); @@ -2091,7 +2100,7 @@ const Groupe_Apprenant = (props) => { function GetSelectedRowsApprenantGrp() { - ///alert(" les lignes slected sont : " + selectionModel + " nb item = " + selectionModel.length); zzzzz + ///alert(" les lignes slected sont : " + selectionModel + " nb item = " + selectionModel.length); //const selectedRowsData = selectionModel.map((id) => rowss.find((row) => row.id === id)); //console.log(rowss[0]); var tab_tmp = [] @@ -2138,7 +2147,7 @@ const Groupe_Apprenant = (props) => { return ( -
+
{isLoading &&
} @@ -2170,7 +2179,7 @@ const Groupe_Apprenant = (props) => { classes={{ paper: classes.dialog }} - className="groupe_apprenant_dialog mysy_MuiPaper-root" + className="groupe_apprenant_dialog" > @@ -3068,7 +3077,7 @@ const Groupe_Apprenant = (props) => {
 
{selected_id && String(selected_id).length > 5 &&
- + @@ -3391,10 +3400,10 @@ const Groupe_Apprenant = (props) => {
Code couleur   -
@@ -3629,10 +3638,10 @@ const Groupe_Apprenant = (props) => {
Code couleur   -
diff --git a/src/components/Module_Session_Planification.js b/src/components/Module_Session_Planification.js index d847d9b..e943032 100644 --- a/src/components/Module_Session_Planification.js +++ b/src/components/Module_Session_Planification.js @@ -155,6 +155,7 @@ const Module_Session_Planification = (props) => { const columns_sequence = [ { field: 'id', headerName: 'id', hide: true }, { field: '_id', headerName: '_id', hide: true }, + { field: 'type', headerName: 'type', hide: true }, { field: 'grp_apprenant_id', headerName: 'grp_apprenant_id', hide: true }, { field: 'ue_id', headerName: 'ue_id', hide: true }, { field: 'unite_enseignement_planif_id', headerName: 'unite_enseignement_planif_id', hide: true }, @@ -232,6 +233,14 @@ const Module_Session_Planification = (props) => { setsequence_startDate(date_du); setsequence_endDate(date_au); + setsubmenu_seq_dialog("dialog_detail"); + + + setselectionModel_sequence([]); + Getall_List_Sequence_Ressource(cellValues.row._id); + + setp_detail_event_type(cellValues.row.type); + setp_detail_sequence_agenda(cellValues.row.agenda); setp_detail_sequence_objectif(cellValues.row.objectif); setp_detail_sequence_comment(cellValues.row.commentaire); @@ -487,7 +496,7 @@ const Module_Session_Planification = (props) => { const [display_detail_sequence, setdisplay_detail_sequence] = useState(); - const [selected_sequence_id, setselected_sequence_id] = useState(); + const [selected_sequence_id, setselected_sequence_id] = useState(""); const [tab_selected_sequence_id, settab_selected_sequence_id] = useState([]); @@ -567,7 +576,7 @@ const Module_Session_Planification = (props) => { setDialog_seq_ressource_1_selected_ressource_id(""); setDialog_seq_ressource_1_selected_ressource_poste(""); setdisplay_detail_sequence(); - setselected_sequence_id(); + setselected_sequence_id(""); setupdate_sequence(); //setgridline_id(''); setsequence_gridline_id(""); @@ -631,7 +640,7 @@ const Module_Session_Planification = (props) => { setDialog_seq_ressource_1_selected_ressource_id(""); setDialog_seq_ressource_1_selected_ressource_poste(""); setdisplay_detail_sequence(); - setselected_sequence_id(); + setselected_sequence_id(""); setupdate_sequence(); setAdd_One_Sequence_Session_mass(); @@ -961,7 +970,7 @@ const Module_Session_Planification = (props) => { //console.log(" form == ", form); - var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Session_Sequence/"; + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Session_Sequence_Return_New_Seq_Data/"; setLoading(true); axios.post(myurl, form).then(res => { @@ -971,11 +980,20 @@ const Module_Session_Planification = (props) => { setLoading(false); if (String(res.data.status) === String("true")) { setAdd_One_Sequence_Session_api("true"); - setAdd_One_Sequence_Session_result(res.data.message); + setAdd_One_Sequence_Session_result(res.data.new_sequence_data); Getall_Sequence_Of_Session(selected_session_id); - setp_detail_sequence_title(""); + if (res.data.new_sequence_data.length > 0) { + var mylocal_sequence_data = JSON.parse(res.data.new_sequence_data); + + if (mylocal_sequence_data._id) + setselected_sequence_id(mylocal_sequence_data._id); + else + setselected_sequence_id(""); + } + + /*setp_detail_sequence_title(""); setp_detail_sequence_comment(""); setp_detail_sequence_agenda(""); @@ -983,12 +1001,13 @@ const Module_Session_Planification = (props) => { setsequence_startDate(); setsequence_endDate(); + */ alert(res.data.message); - Close_Dialog_Detail_seq_open(); - Dialog_DIALOG_AGENDA_handleClose_buton(); + //Close_Dialog_Detail_seq_open(); + // Dialog_DIALOG_AGENDA_handleClose_buton(); } else { @@ -1287,7 +1306,7 @@ const Module_Session_Planification = (props) => { //--- var node = { - "_id": localid, + "_id": local_id, "id": localid, "title": local_title, "start": local_start, @@ -1305,7 +1324,7 @@ const Module_Session_Planification = (props) => { if (new_data2.length > 0) { setGetall_Sequence_Of_Session_result_planning_view(new_data2); - console.log(" ### new_data2 = ", new_data2); + // console.log(" ### new_data2 = ", new_data2); } @@ -1501,6 +1520,7 @@ const Module_Session_Planification = (props) => { //setp_detail_event_id(""); setp_detail_sequence_event_type_semaine_objectif(""); setp_detail_sequence_event_type_semaine_comment(""); + setDialog_EVENT_SEMAINE_TYPE_open(true); }; @@ -1781,11 +1801,21 @@ const Module_Session_Planification = (props) => { setsequence_startDate(arg.event.start) setsequence_endDate(arg.event.end) setp_detail_event_id(arg.event.id); + setsubmenu_seq_dialog("dialog_detail"); + + setGetall_List_Sequence_Ressource_result([]); + setselectionModel_sequence([]); + //console.log(" ### arg.event.extendedProps = ", arg.event.extendedProps); - //console.log(" ### arg.event.extendedProps = ", arg.event.extendedProps ); + //console.log(" ### arg.event.extendedProps._id = ", arg.event.extendedProps._id); - //console.log(" ### arg.event.extendedProps.local_type = ", arg.event.extendedProps.local_type ); + if (arg.event.extendedProps._id) { + setselected_sequence_id(arg.event.extendedProps._id); + Getall_List_Sequence_Ressource(arg.event.extendedProps._id); + } + else + setselected_sequence_id(""); if (arg.event.extendedProps.local_comment) { setp_detail_sequence_comment(arg.event.extendedProps.local_comment); @@ -1862,6 +1892,8 @@ const Module_Session_Planification = (props) => { } + + setDialog_DIALOG_AGENDA_open(true); } @@ -2002,7 +2034,7 @@ const Module_Session_Planification = (props) => { form.append("_id", selected_sequence_id); - console.log(" form == ", form); + //console.log(" form == ", form); var myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Session_Sequence/"; @@ -2212,8 +2244,13 @@ const Module_Session_Planification = (props) => { setsequence_endDate(info.end) setp_detail_sequence_agenda(""); setp_detail_event_id(""); + setselected_sequence_id(""); setp_detail_sequence_objectif(""); setp_detail_sequence_comment(""); + setsubmenu_seq_dialog("dialog_detail"); + + setGetall_List_Sequence_Ressource_result([]); + setselectionModel_sequence([]); setDialog_DIALOG_AGENDA_open(true); }; @@ -2692,6 +2729,7 @@ const Module_Session_Planification = (props) => {
} + {String(submenu_seq_dialog) === "dialog_ressource" &&
@@ -2940,6 +2978,42 @@ const Module_Session_Planification = (props) => {
} + zzz2 + +
+ + + + + +
{String(submenu_seq_dialog) !== "dialog_ressource" &&
Unité d'enseignement @@ -3195,6 +3269,8 @@ const Module_Session_Planification = (props) => {
} + + @@ -3214,18 +3290,18 @@ const Module_Session_Planification = (props) => { - - + autoFocus + onClick={Close_Dialog_Detail_seq_open} + color="primary" + className={classes.customizedButton} + > + + } - {String(submenu_seq_dialog) === "dialog_ressource" && + {String(submenu_seq_dialog) === "dialog_ressource" && { - - } @@ -4132,10 +4206,26 @@ const Module_Session_Planification = (props) => { open={Dialog_DIALOG_AGENDA_open} // onClose={Dialog_DIALOG_AGENDA_handleClose} - className="module_agenda" + static onClose={() => null} + PaperProps={{ + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + //top: '5rem' + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + className="module_agenda mysy_MuiPaper-root" > MySy Information @@ -4143,319 +4233,607 @@ const Module_Session_Planification = (props) => { {Dialog_DIALOG_AGENDA_message} + zzz1 -
+ selected_sequence_id la = {selected_sequence_id}
+ submenu_seq_dialog = {submenu_seq_dialog}
- + {
+ + + + {String(selected_sequence_id).length <= 3 && + } + + {String(selected_sequence_id).length > 3 && + } +
} - -
- - -
Unité d'enseignement - - - {New_Getall_Class_List_UE_result && New_Getall_Class_List_UE_result.length > 0 && - (data)._id === String(p_detail_sequence_ue_id))[0].label} - options={New_Getall_Class_List_UE_result} - onChange={(event, value) => { - seteu_planif_line_insdispo(""); - setp_detail_sequence_ue_planif_line_id(""); - if (value && value._id) { - setp_detail_sequence_ue_id(value._id); - Get_List_Given_UE_Planif_lines(value._id); - } else { - setp_detail_sequence_ue_id(""); - setNew_Get_List_Given_UE_Planif_lines_result([]); - } - - }} - - renderInput={(params) => - } - />} -
- - - - - {New_Get_List_Given_UE_Planif_lines_result && New_Get_List_Given_UE_Planif_lines_result.length > 1 && - p_detail_sequence_ue_id && String(p_detail_sequence_ue_id).length > 2 && -
Planification - (data)._id === String(p_detail_sequence_ue_planif_line_id))[0].label} - options={New_Get_List_Given_UE_Planif_lines_result} - onChange={(event, value) => { - if (value && value._id) { - setp_detail_sequence_ue_planif_line_id(value._id); - if (value.in_use === "1") { - alert(" Cette ligne est deja planifiée"); - seteu_planif_line_insdispo("1"); - } else { - seteu_planif_line_insdispo(""); - } - //Get_List_Given_UE_Planif_lines(value._id); - } else { - setp_detail_sequence_ue_planif_line_id(""); - // setNew_Get_List_Given_UE_Planif_lines_result([]); + setDialog_seq_ressource_1_selected_type_ressource(""); + setGet_Ressource_Avabilities_avability_check(""); + setDialog_seq_ressource_1_selected_ressource_id(""); } + setGet_Ressource_Avabilities_avability_check(""); }} renderInput={(params) => } /> - {eu_planif_line_insdispo === "1" && - - } -
- } + } + + {New_Getall_Training_Employee_No_Filter_result && New_Getall_Training_Employee_No_Filter_result.length > 1 && + String(Dialog_seq_ressource_1_selected_type_ressource) === "ressource_humaine" &&
Ressource Humaine + + (data)._id === String(Dialog_seq_ressource_1_selected_ressource_id))[0].label} + onChange={(event, value) => { + if (value && value._id) { + setDialog_seq_ressource_1_selected_ressource_id(value._id); + //console.log(" ### check_ressource_avabilities = ", check_ressource_avabilities) + if (check_ressource_avabilities === "1") { + // On ne fait le controle de disponibilité que si on une sequence precise. pas quand c'est en masse. + Get_Ressource_Avabilities(value._id); + } + } else { + setGet_Ressource_Avabilities_avability_check(""); + setDialog_seq_ressource_1_selected_ressource_id(""); + } + }} + renderInput={(params) => + } + /> + {check_ressource_avabilities === "1" && Get_Ressource_Avabilities_avability_check && String(Get_Ressource_Avabilities_avability_check) === "0" && + + } - +
+ } -
Titre - 1 && + String(Dialog_seq_ressource_1_selected_type_ressource) === "ressource_materielle" &&
Ressource Materielle - name="event_dialog_title" - id="event_dialog_title" + (data)._id === String(Dialog_seq_ressource_1_selected_ressource_id))[0].label} + + onChange={(event, value) => { + if (value && value._id) { + setDialog_seq_ressource_1_selected_ressource_id(value._id); + if (check_ressource_avabilities === "1") { + // On ne fait le controle de disponibilité que si on une sequence precise. pas quand c'est en masse. + Get_Ressource_Avabilities(value._id); + } + + } else { + setGet_Ressource_Avabilities_avability_check(""); + setDialog_seq_ressource_1_selected_ressource_id(""); + } + }} + + renderInput={(params) => + } + /> + + {check_ressource_avabilities === "1" && Get_Ressource_Avabilities_avability_check && String(Get_Ressource_Avabilities_avability_check) === "0" && + + } + + {check_ressource_avabilities === "1" && Get_Ressource_Avabilities_avability_check && String(Get_Ressource_Avabilities_avability_check) === "1" && + + } +
+ } - fullWidth +
Poste + { - if (String(p_detail_sequence_session_id) === "") - setp_detail_sequence_title(e.target.value); - } - } + name="event_dialog_title" + id="event_dialog_title" - /> + fullWidth -
+ value={Dialog_seq_ressource_1_selected_ressource_poste} + onChange={(e) => { -
Debut - { + setDialog_seq_ressource_1_selected_ressource_poste(e.target.value); + } + } - return setsequence_startDate(date); - } - } + /> - className="disabled_style session_caract_Dialog_DatePicker" - style={{ width: "99%" }} - locale='fr-FR' - showTimeSelect - timeFormat="HH:mm" - timeIntervals={15} - dateFormat="dd/MM/yyyy HH:mm" - is24Hour - - /> - -
- -
Fin - { - - return setsequence_endDate(date); - } - } +
- className="disabled_style session_caract_Dialog_DatePicker" - style={{ width: "99%" }} - locale='fr-FR' - showTimeSelect - timeFormat="HH:mm" - timeIntervals={15} - dateFormat="dd/MM/yyyy HH:mm" - is24Hour + {Dialog_seq_ressource_1_selected_ressource_id &&
+
- /> +   +
-
+
-
Agenda - Ajout Ress. - fullWidth +
+
} - value={p_detail_sequence_agenda} - onChange={(e) => { - setp_detail_sequence_agenda(e.target.value); - } - } - multiline - minRows={2} - maxRows={2} - rows={2} - /> -
+ {Getall_List_Sequence_Ressource_result && Getall_List_Sequence_Ressource_result.length > 0 &&
-
Objectif - +   + + { + setselectionModel_sequence(newSelectionModel); - value={p_detail_sequence_objectif} - onChange={(e) => { + }} + //selectionModel={selectionModel_sequence} - setp_detail_sequence_objectif(e.target.value); - } - } - multiline - minRows={2} - maxRows={2} - rows={2} + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={Getall_List_Sequence_Ressource_result.map((item, index) => ( + { + id: index, + _id: JSON.parse(item)._id, + related_target_collection_id: JSON.parse(item).related_target_collection_id, + related_target_collection: JSON.parse(item).related_target_collection, + type_ressource: JSON.parse(item).related_target_collection_object, + related_target_collection_object: JSON.parse(item).related_target_collection_object, + related_target_collection_id_nom: JSON.parse(item).related_target_collection_id_nom, + poste: JSON.parse(item).poste, + } + ))} - /> + columns={columns_sequence_ressources_affectation} + pageSize={10} + className="datagridclass" -
+ onRowDoubleClick={(newSelectionModel) => { -
Commentaire - { - setp_detail_sequence_comment(e.target.value); - } - } - multiline - minRows={2} - maxRows={2} - rows={2} + rowsPerPageOptions={[10]} + disableSelectionOnClick + components={{ + Toolbar: GridToolbar, + }} + sx={datagridSx} - /> -
+ /> + +
+ +
+ + + } + + {Getall_List_Sequence_Ressource_result && Getall_List_Sequence_Ressource_result.length <= 0 &&
+ Aucune ressource. +
} + + + + + } + + + + {String(submenu_seq_dialog) !== "dialog_ressource" &&
+ + +
+ + + + + +
+ + +
Unité d'enseignement + + + {New_Getall_Class_List_UE_result && New_Getall_Class_List_UE_result.length > 0 && + (data)._id === String(p_detail_sequence_ue_id))[0].label} + options={New_Getall_Class_List_UE_result} + onChange={(event, value) => { + seteu_planif_line_insdispo(""); + setp_detail_sequence_ue_planif_line_id(""); + if (value && value._id) { + setp_detail_sequence_ue_id(value._id); + Get_List_Given_UE_Planif_lines(value._id); + } else { + setp_detail_sequence_ue_id(""); + setNew_Get_List_Given_UE_Planif_lines_result([]); + } + + }} + + renderInput={(params) => + } + />} +
+ + + + + {New_Get_List_Given_UE_Planif_lines_result && New_Get_List_Given_UE_Planif_lines_result.length > 1 && + p_detail_sequence_ue_id && String(p_detail_sequence_ue_id).length > 2 && +
Planification + (data)._id === String(p_detail_sequence_ue_planif_line_id))[0].label} + options={New_Get_List_Given_UE_Planif_lines_result} + onChange={(event, value) => { + if (value && value._id) { + setp_detail_sequence_ue_planif_line_id(value._id); + if (value.in_use === "1") { + alert(" Cette ligne est deja planifiée"); + seteu_planif_line_insdispo("1"); + } else { + seteu_planif_line_insdispo(""); + } + //Get_List_Given_UE_Planif_lines(value._id); + } else { + setp_detail_sequence_ue_planif_line_id(""); + // setNew_Get_List_Given_UE_Planif_lines_result([]); + } + + }} + + renderInput={(params) => + } + /> + + {eu_planif_line_insdispo === "1" && + + } + +
+ } + + + + + +
Groupe apprenants + + {New_Getall_Class_List_UE_result && New_Getall_Class_List_UE_result.length > 0 && (data)._id === String(p_detail_sequence_groupe_apprenant_id))[0].label} + options={New_Getall_Partner_Groupe_Inscrit_result} + onChange={(event, value) => { + if (value && value._id) { + setp_detail_sequence_groupe_apprenant_id(value._id); + } else { + setp_detail_sequence_groupe_apprenant_id(""); + } + + + }} + + renderInput={(params) => + } + />} + +
+ + +
Titre + { + if (String(p_detail_sequence_session_id) === "") + setp_detail_sequence_title(e.target.value); + } + } + + /> + +
+ +
Debut + { + + return setsequence_startDate(date); + } + } + + className="disabled_style session_caract_Dialog_DatePicker" + style={{ width: "99%" }} + locale='fr-FR' + showTimeSelect + timeFormat="HH:mm" + timeIntervals={15} + dateFormat="dd/MM/yyyy HH:mm" + is24Hour + + /> + +
+ +
Fin + { + + return setsequence_endDate(date); + } + } + + + className="disabled_style session_caract_Dialog_DatePicker" + style={{ width: "99%" }} + locale='fr-FR' + showTimeSelect + timeFormat="HH:mm" + timeIntervals={15} + dateFormat="dd/MM/yyyy HH:mm" + is24Hour + + /> + +
+ +
Agenda + { + + setp_detail_sequence_agenda(e.target.value); + } + } + multiline + minRows={2} + maxRows={2} + rows={2} + + /> + +
+ +
Objectif + { + + setp_detail_sequence_objectif(e.target.value); + } + } + multiline + minRows={2} + maxRows={2} + rows={2} + + /> + +
+ +
Commentaire + { + + setp_detail_sequence_comment(e.target.value); + } + } + multiline + minRows={2} + maxRows={2} + rows={2} + + /> + +
+ + +
} - -
- {String(p_detail_sequence_session_id) === "" &&
- {p_detail_event_id && String(p_detail_event_id) !== "" && } - {(!p_detail_event_id || String(p_detail_event_id) === "") && } + {String(submenu_seq_dialog) !== "dialog_ressource" && + + +
+ {String(p_detail_sequence_session_id) === "" &&
+ {p_detail_event_id && String(p_detail_event_id) !== "" && } + {(!p_detail_event_id || String(p_detail_event_id) === "") && } -
} -
- +
} +
+ +
-
- + + + + + } - - - - {String(p_detail_sequence_session_id) === "" && p_detail_event_id && String(p_detail_event_id) !== "" && + {String(submenu_seq_dialog) !== "dialog_ressource" && String(p_detail_sequence_session_id) === "" && p_detail_event_id && String(p_detail_event_id) !== "" &&
@@ -4518,6 +4896,19 @@ const Module_Session_Planification = (props) => { } + {String(submenu_seq_dialog) === "dialog_ressource" && + + + + + + } + @@ -4584,6 +4975,7 @@ const Module_Session_Planification = (props) => { grp_apprenant_id: JSON.parse(item).grp_apprenant_id, ue_id: JSON.parse(item).ue_id, unite_enseignement_planif_id: JSON.parse(item).unite_enseignement_planif_id, + type: JSON.parse(item).type, } ))} diff --git a/src/components/Partner.js b/src/components/Partner.js index 4138577..b6451ec 100644 --- a/src/components/Partner.js +++ b/src/components/Partner.js @@ -1954,7 +1954,7 @@ const Partner = (props) => { {String(menu) === "groupe_apprenant" &&
- +zzzz