From 820874c5ecf9b556a8a2b724e117896705ab8114 Mon Sep 17 00:00:00 2001 From: cherif Date: Fri, 24 May 2024 18:39:00 +0200 Subject: [PATCH] sds --- src/components/Module_Session_Evaluation.js | 54 +++- .../Module_Session_Planification.js | 265 +++++++++++++----- src/components/Notes_Evaluation.js | 39 ++- 3 files changed, 261 insertions(+), 97 deletions(-) diff --git a/src/components/Module_Session_Evaluation.js b/src/components/Module_Session_Evaluation.js index 34e0467..80fdf41 100644 --- a/src/components/Module_Session_Evaluation.js +++ b/src/components/Module_Session_Evaluation.js @@ -703,6 +703,7 @@ const Module_Session_Evaluation = (props) => { }) } + const [actionmass_eval_froid, setactionmass_eval_froid] = useState(); const [actionmass_eval_val, setactionmass_eval_val] = useState(); const actionmass_evaluation = (event) => { @@ -754,6 +755,36 @@ const Module_Session_Evaluation = (props) => { } + function GetSelectedRows_Evaluation_Ids_cold() { + + var tab_tmp = [] + for (var i = 0; i < selectionModel_evaluation_cold.length; i++) { + var myid = parseInt(String(selectionModel_evaluation_cold[i])); + //var line = JSON.parse(rowss[myid]); + tab_tmp.push(myid); + } + return tab_tmp; + + } + async function actionmass_Evaluation_Traitemet_cold() { + var liste_formation = GetSelectedRows_Evaluation_Ids_cold(); + + + var tab_ids_inscription = [] + for (var i = 0; i < selectionModel_evaluation_cold.length; i++) { + var myid = parseInt(String(selectionModel_evaluation_cold[i])); + var line = JSON.parse(rowss_evaluation_cold[myid]); + var line_id = JSON.parse(rowss_evaluation_cold[myid])._id; + + tab_ids_inscription.push(line_id); + } + + + //SendEvaluationEmail_Many_Ids(tab_ids_inscription); + Send_Survey_By_Email_For_Ids(tab_ids_inscription); + + } + const [Send_Survey_By_Email_For_Ids_api, setSend_Survey_By_Email_For_Ids_api] = useState(); const [Send_Survey_By_Email_For_Ids_message, setSend_Survey_By_Email_For_Ids_message] = useState(); const [Send_Survey_By_Email_For_Ids_result, setSend_Survey_By_Email_For_Ids_result] = useState(); @@ -779,10 +810,17 @@ const Module_Session_Evaluation = (props) => { //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); setSend_Survey_By_Email_For_Ids_api("true"); setSend_Survey_By_Email_For_Ids_result(res.data.message); + Getall_Survey_hot_evaluation_By_Session(); + Getall_Survey_cold_evaluation_By_Session(); + setSelectionModel_evaluation([]); + setSelectionModel_evaluation_cold([]); + setactionmass_eval_val(""); + setactionmass_eval_froid(""); + alert(res.data.message); } else if (String(res.data.status) === String("Err_Connexion")) { @@ -1327,7 +1365,7 @@ const Module_Session_Evaluation = (props) => { /> - {selectionModel_evaluation && selectionModel_evaluation.length >= 1 && + {selectionModel_evaluation && String(selectionModel_evaluation) !== "" && selectionModel_evaluation.length >= 0 &&
@@ -1620,7 +1658,7 @@ const Module_Session_Evaluation = (props) => { /> - {selectionModel_evaluation_cold && selectionModel_evaluation_cold.length >= 1 && + {selectionModel_evaluation_cold && selectionModel_evaluation_cold.length >= 0 &&
  @@ -1636,16 +1674,16 @@ const Module_Session_Evaluation = (props) => { if (value && value.value) { if (String(value.value) === "demande evaluation") { - setactionmass_eval_val(value.value); + setactionmass_eval_froid(value.value); } else { - setactionmass_eval_val(""); + setactionmass_eval_froid(""); } } else { - setactionmass_eval_val(""); + setactionmass_eval_froid(""); } }} @@ -1655,7 +1693,7 @@ const Module_Session_Evaluation = (props) => { /> - {actionmass_eval_val && String(actionmass_eval_val).length > 1 && + {actionmass_Evaluation_Traitemet_cold && String(actionmass_Evaluation_Traitemet_cold) !== "" && String(actionmass_eval_froid).length > 1 && Traiter @@ -1675,12 +1713,12 @@ const Module_Session_Evaluation = (props) => {
{' '} - Confirmer l'action {actionmass_eval_val} en masse. + Confirmer l'action {actionmass_eval_froid} en masse.
diff --git a/src/components/Module_Session_Planification.js b/src/components/Module_Session_Planification.js index e9bd461..b127a03 100644 --- a/src/components/Module_Session_Planification.js +++ b/src/components/Module_Session_Planification.js @@ -22,7 +22,7 @@ import 'reactjs-popup/dist/index.css'; import { FcSearch } from "react-icons/fc"; import { FcAlarmClock, FcMultipleSmartphones, FcWorkflow } from "react-icons/fc"; import DatePicker from "react-datepicker"; -import "react-datepicker/dist/react-datepicker.css"; +import "react-datepicker/dist/react-datepicker.css"; import { format } from 'date-fns' import moment from "moment"; import 'moment/locale/fr'; @@ -628,7 +628,7 @@ const Module_Session_Planification = (props) => { } - + const [Dialog_seq_choix_model_emargement_message, setDialog_seq_choix_model_emargement_message] = React.useState(false); const [Dialog_seq_choix_model_emargement_open, setDialog_seq_choix_model_emargement_open] = React.useState(false); @@ -845,7 +845,7 @@ const Module_Session_Planification = (props) => { alert(res.data.message); Close_Dialog_Detail_seq_open(); Dialog_DIALOG_AGENDA_handleClose_buton(); - + } else { setAdd_One_Sequence_Session_api("false"); @@ -1478,6 +1478,7 @@ const Module_Session_Planification = (props) => { function submenu_add_one_Ressource() { + setGet_Ressource_Avabilities_avability_check(""); setDialog_seq_ressource_1_open(true); } @@ -1534,6 +1535,7 @@ const Module_Session_Planification = (props) => { }; const Dialog_seq_ressource_1_handleClose_buton = () => { + setGet_Ressource_Avabilities_avability_check(""); setDialog_seq_ressource_1_open(false); }; @@ -1806,7 +1808,7 @@ const Module_Session_Planification = (props) => { setDialog_seq_planif_periode_type(""); alert(res.data.message); - + Close_Dialog_Detail_seq_open(); Dialog_seq_CREATION_SEMAINE_TYPE_handleClose_buton(); Dialog_EVENT_SEMAINE_TYPE_handleClose_buton(); @@ -1858,12 +1860,12 @@ const Module_Session_Planification = (props) => { setLoading(true); - + axios.post(myurl, form).then(res => { //console.log(" In Add_Automatic_Sequence_Session_From_Month_Model res.data.status = " + res.data.status); //console.log(" In Add_Automatic_Sequence_Session_From_Month_Model res.data.message r_class = " + res.data.message); - setLoading(false); + setLoading(false); if (String(res.data.status) === String("true")) { setAdd_Automatic_Sequence_Session_From_Month_Model_api("true"); setAdd_Automatic_Sequence_Session_From_Month_Model_result(res.data.message); @@ -1888,7 +1890,7 @@ const Module_Session_Planification = (props) => { Dialog_EVENT_SEMAINE_TYPE_handleClose_buton(); Dialog_seq_CREATION_SEMAINE_TYPE_handleClose_buton(); - + } else { @@ -1955,7 +1957,71 @@ const Module_Session_Planification = (props) => { //setOpen(false); }; - + 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 event_start = String(selected_sequence_startDate); + var event_end = String(selected_sequence_endDate); + + + + //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) + + //return; + + 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("") + }) + } + + return (
@@ -2169,7 +2235,7 @@ const Module_Session_Planification = (props) => { > - Ajout ressource + Ajout ressource : {selected_sequence_startDate} au {selected_sequence_endDate} {Dialog_seq_ressource_1_message} @@ -2186,10 +2252,15 @@ const Module_Session_Planification = (props) => { options={New_Option_Type_Ressource} onChange={(event, value) => { if (value && value.value) { - setDialog_seq_ressource_1_selected_type_ressource(value.value); + + }else{ + 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) => @@ -2213,14 +2284,34 @@ const Module_Session_Planification = (props) => { onChange={(event, value) => { if (value && value._id) { setDialog_seq_ressource_1_selected_ressource_id(value._id); - + Get_Ressource_Avabilities(value._id); + } else { + setGet_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" && + + }
@@ -2238,9 +2329,12 @@ const Module_Session_Planification = (props) => { onChange={(event, value) => { if (value && value._id) { - setDialog_seq_ressource_1_selected_ressource_id(value._id); - + setDialog_seq_ressource_1_selected_ressource_id(value._id); + Get_Ressource_Avabilities(value._id); + } else { + setGet_Ressource_Avabilities_avability_check(""); + setDialog_seq_ressource_1_selected_ressource_id(""); } }} @@ -2248,7 +2342,24 @@ const Module_Session_Planification = (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" && + + }
} @@ -2300,9 +2411,9 @@ const Module_Session_Planification = (props) => { {/*** Fin ajout ressource */} - {/**** Dialogue pour EVENT SEMAINE TYPE */} + {/**** Dialogue pour EVENT SEMAINE TYPE */} - {
- - - { String(p_detail_sequence_session_id) === "" &&
+ + + {String(p_detail_sequence_session_id) === "" &&
{p_detail_sequence_event_type_semaine_id && String(p_detail_sequence_event_type_semaine_id) !== "" && } {(!p_detail_sequence_event_type_semaine_id || String(p_detail_sequence_event_type_semaine_id) === "") && } @@ -2623,74 +2734,74 @@ const Module_Session_Planification = (props) => {
- {Dialog_seq_planif_periode_type && String(Dialog_seq_planif_periode_type) === "mois" && - } - //plugins={[timeGridPlugin]} + select={handleSelect_event_type_semaine} + headerToolbar={{ + start: "today prev next", + center: "title", + end: "dayGridMonth,timeGridWeek,timeGridDay", + }} + //eventContent={(info) => } + //plugins={[timeGridPlugin]} - plugins={[daygridPlugin, timeGridPlugin, interactionPlugin]} - views={["dayGridMonth", "dayGridWeek", "dayGridDay"]} - slotMinTime={Partner_Debut_Journee} - slotMaxTime={Partner_Fin_Journee} - scrollTime='08:00' - displayEventEnd={true} - eventContent={renderEventContent_event_type_semaine} - eventClick={handleEventClick_event_type_semaine} - />} + plugins={[daygridPlugin, timeGridPlugin, interactionPlugin]} + views={["dayGridMonth", "dayGridWeek", "dayGridDay"]} + slotMinTime={Partner_Debut_Journee} + slotMaxTime={Partner_Fin_Journee} + scrollTime='08:00' + displayEventEnd={true} + eventContent={renderEventContent_event_type_semaine} + eventClick={handleEventClick_event_type_semaine} + />} {Dialog_seq_planif_periode_type && String(Dialog_seq_planif_periode_type) === "semaine" && - - } - //plugins={[timeGridPlugin]} + } + //plugins={[timeGridPlugin]} - plugins={[timeGridPlugin, daygridPlugin, interactionPlugin]} - views={["dayGridMonth", "dayGridWeek", "dayGridDay"]} - slotMinTime={Partner_Debut_Journee} - slotMaxTime={Partner_Fin_Journee} - scrollTime='08:00' - displayEventEnd={true} - eventContent={renderEventContent_event_type_semaine} - eventClick={handleEventClick_event_type_semaine} - />} + plugins={[timeGridPlugin, daygridPlugin, interactionPlugin]} + views={["dayGridMonth", "dayGridWeek", "dayGridDay"]} + slotMinTime={Partner_Debut_Journee} + slotMaxTime={Partner_Fin_Journee} + scrollTime='08:00' + displayEventEnd={true} + eventContent={renderEventContent_event_type_semaine} + eventClick={handleEventClick_event_type_semaine} + />}
@@ -2992,7 +3103,7 @@ const Module_Session_Planification = (props) => { MySy Information - {Dialog_DIALOG_AGENDA_message} + {Dialog_DIALOG_AGENDA_message}
@@ -3182,7 +3293,7 @@ const Module_Session_Planification = (props) => {
- { String(p_detail_sequence_session_id) === "" &&
+ {String(p_detail_sequence_session_id) === "" &&
{p_detail_event_id && String(p_detail_event_id) !== "" && } {(!p_detail_event_id || String(p_detail_event_id) === "") && } @@ -3502,7 +3613,7 @@ const Module_Session_Planification = (props) => {  
- + { selectable //events={events} events={Getall_Sequence_Of_Session_result_planning_view} - initialDate = {SessionstartDate} + initialDate={SessionstartDate} select={handleSelect} headerToolbar={{ start: "today prev next", diff --git a/src/components/Notes_Evaluation.js b/src/components/Notes_Evaluation.js index 3acdc24..6a6b387 100644 --- a/src/components/Notes_Evaluation.js +++ b/src/components/Notes_Evaluation.js @@ -2093,7 +2093,7 @@ const Notes_Evaluation = (props) => { // 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é @@ -2483,6 +2483,11 @@ const Notes_Evaluation = (props) => { // -- Debut gestion des ressources + + const [event_start_date, setevent_start_date] = useState(""); + const [event_end_date, setevent_end_date] = useState(""); + + const [Get_Ressource_Avabilities_avability_check, setGet_Ressource_Avabilities_avability_check] = useState(""); const [Get_Ressource_Avabilities_api, setGet_Ressource_Avabilities_api] = useState(); @@ -2495,7 +2500,10 @@ const Notes_Evaluation = (props) => { var line = New_Getall_Partner_Evaluation_result.filter((data) => (data)._id === String(selected_id)) var event_start = String(line[0].eval_date_heure_debut); + setevent_start_date(String(line[0].eval_date_heure_debut)); + var event_end = String(line[0].eval_date_heure_fin); + setevent_end_date(String(line[0].eval_date_heure_fin)); //var event_start = format(String(line[0].eval_date_heure_debut), 'dd/MM/yyyy HH:mm'); @@ -2591,6 +2599,9 @@ const Notes_Evaluation = (props) => { const [selectionModel_ressource, setselectionModel_ressource] = React.useState([]); function submenu_add_one_Ressource() { + setevent_start_date(""); + setevent_end_date(""); + setGet_Ressource_Avabilities_avability_check(""); setDialog_seq_ressource_1_open(true); } @@ -2611,6 +2622,10 @@ const Notes_Evaluation = (props) => { }; const Dialog_seq_ressource_1_handleClose_buton = () => { + + setevent_start_date(""); + setevent_end_date(""); + setDialog_seq_ressource_1_open(false); }; @@ -2908,7 +2923,7 @@ const Notes_Evaluation = (props) => { setDialog_seq_ressource_1_selected_type_ressource(value.value); } - + setGet_Ressource_Avabilities_avability_check(""); }} @@ -2934,7 +2949,7 @@ const Notes_Evaluation = (props) => { if (value && value._id) { setDialog_seq_ressource_1_selected_ressource_id(value._id); Get_Ressource_Avabilities(value._id); - }else{ + } else { Get_Ressource_Avabilities_avability_check(""); setDialog_seq_ressource_1_selected_ressource_id(""); } @@ -2945,20 +2960,20 @@ 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" && -
+ } @@ -2980,7 +2995,7 @@ const Notes_Evaluation = (props) => { if (value && value._id) { setDialog_seq_ressource_1_selected_ressource_id(value._id); Get_Ressource_Avabilities(value._id); - }else{ + } else { Get_Ressource_Avabilities_avability_check(""); setDialog_seq_ressource_1_selected_ressource_id(""); } @@ -2990,20 +3005,20 @@ 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" && -