diff --git a/src/components/Module_Session_Evaluation.js b/src/components/Module_Session_Evaluation.js index 4e97786..1ca51c0 100644 --- a/src/components/Module_Session_Evaluation.js +++ b/src/components/Module_Session_Evaluation.js @@ -964,7 +964,7 @@ const Module_Session_Evaluation = (props) => { //console.log(" ### actionmass_evaluation = ", value); - if (String(value) === "demande evaluation") { + if (String(value) === "demande evaluation" || String(value.value) === "export_evaluation") { setactionmass_eval_val(value); //console.log(" ### LAAA = ", value); } @@ -1010,7 +1010,10 @@ const Module_Session_Evaluation = (props) => { } //SendEvaluationEmail_Many_Ids(tab_ids_inscription); - Send_Survey_By_Email_For_Ids(tab_ids_survey); + if (String(actionmass_eval_formateur) === "demande evaluation") + Send_Survey_By_Email_For_Ids(tab_ids_survey); + else if (String(actionmass_eval_formateur) === "export_evaluation") + Export_Selected_Survey_PDF(tab_ids_survey); } @@ -1031,7 +1034,10 @@ const Module_Session_Evaluation = (props) => { //SendEvaluationEmail_Many_Ids(tab_ids_inscription); - Send_Survey_By_Email_For_Ids(tab_ids_inscription); + if (String(actionmass_eval_val) === "demande evaluation") + Send_Survey_By_Email_For_Ids(tab_ids_inscription); + else if (String(actionmass_eval_val) === "export_evaluation") + Export_Selected_Survey_PDF(tab_ids_inscription); } @@ -1061,8 +1067,11 @@ const Module_Session_Evaluation = (props) => { } - //SendEvaluationEmail_Many_Ids(tab_ids_inscription); - Send_Survey_By_Email_For_Ids(tab_ids_inscription); + //SendEvaluationEmail_Many_Ids(tab_ids_inscription); setactionmass_eval_val + if (String(actionmass_eval_froid) === "demande evaluation") + Send_Survey_By_Email_For_Ids(tab_ids_inscription); + else if (String(actionmass_eval_froid) === "export_evaluation") + Export_Selected_Survey_PDF(tab_ids_inscription); } @@ -1148,6 +1157,7 @@ const Module_Session_Evaluation = (props) => { const New_Option_Evaluation_Masse = [ { "id": "demande evaluation", "label": "Envoyer demande Evaluation", "value": "demande evaluation" }, + { "id": "export_evaluation", "label": "Export Evaluation (PDF) ", "value": "export_evaluation" }, ] useEffect(() => { @@ -1285,6 +1295,44 @@ const Module_Session_Evaluation = (props) => { } + function Export_Selected_Survey_PDF(tab_ids_survey) { + const stored_cookie = getCookie('tokenmysypart'); + + + + if (tab_ids_survey.length <= 0) { + alert(" Aucune ligne selectionnée "); + return; + } + var nom_fichier_cmd = "export_evaluation.zip"; + + var url = process.env.REACT_APP_API_URL + "myclass/api/Export_To_Excel_Survey_with_filter_Tab_Survey_Id/" + stored_cookie + "/" + tab_ids_survey.toString(); + + + setLoading(true); + axios.get(url, { responseType: 'blob', },) + .then((res) => { + setLoading(false); + //console.log(" In Export_Dashbord_to_CSV res.data = " + res.data); + if (String(res.data) === String("false")) { + alert("Impossible d'exporter les réponses (2) "); + } else { + fileDownload(res.data, nom_fichier_cmd) + + } + }).catch((error) => { + setLoading(false); + console.error('Error:', error); + alert(" Impossible d'exporter les réponses ") + + }); + + + setLoading(false); + } + + + const [Dialog_1_message, setDialog_1_message] = React.useState(false); const [Dialog_LIST_HOT_EVALUATION_QUESTION_open, setDialog_LIST_HOT_EVALUATION_QUESTION_open] = React.useState(false); @@ -1747,6 +1795,10 @@ const Module_Session_Evaluation = (props) => { setSelectionModel_evaluation(newSelectionModel_evaluation); //console.log("ch selected--" + newSelectionModel_evaluation); + if( selectionModel_evaluation.length <= 0 ){ + setactionmass_eval_val(""); + } + }} selectionModel={selectionModel_evaluation} @@ -1811,7 +1863,7 @@ const Module_Session_Evaluation = (props) => { /> - {selectionModel_evaluation && String(selectionModel_evaluation) !== "" && selectionModel_evaluation.length >= 0 && + {selectionModel_evaluation && String(selectionModel_evaluation) !== "" && selectionModel_evaluation.length > 0 &&
@@ -1826,10 +1878,8 @@ const Module_Session_Evaluation = (props) => { options={New_Option_Evaluation_Masse} onChange={(event, value) => { if (value && value.value) { - if (String(value.value) === "demande evaluation") { - + if (String(value.value) === "demande evaluation" || String(value.value) === "export_evaluation") { setactionmass_eval_val(value.value); - } else { setactionmass_eval_val(""); @@ -1868,8 +1918,14 @@ const Module_Session_Evaluation = (props) => {
MySy Information
{' '} + {actionmass_eval_val && String(actionmass_eval_val) === "demande evaluation" && } + + {actionmass_eval_val && String(actionmass_eval_val) === "export_evaluation" && } - Confirmer l'action {actionmass_eval_val} en masse.
@@ -2035,6 +2091,10 @@ const Module_Session_Evaluation = (props) => { setSelectionModel_evaluation_cold(newSelectionModel_evaluation); //console.log("ch selected--" + newSelectionModel_evaluation); + if( selectionModel_evaluation_cold.length <= 0 ){ + setactionmass_eval_froid(""); + } + }} selectionModel={selectionModel_evaluation_cold} @@ -2099,7 +2159,7 @@ const Module_Session_Evaluation = (props) => { /> - {selectionModel_evaluation_cold && selectionModel_evaluation_cold.length >= 0 && + {selectionModel_evaluation_cold && selectionModel_evaluation_cold.length > 0 &&
  @@ -2113,7 +2173,7 @@ const Module_Session_Evaluation = (props) => { options={New_Option_Evaluation_Masse} onChange={(event, value) => { if (value && value.value) { - if (String(value.value) === "demande evaluation") { + if (String(value.value) === "demande evaluation" || String(value.value) === "export_evaluation") { setactionmass_eval_froid(value.value); @@ -2133,7 +2193,7 @@ const Module_Session_Evaluation = (props) => { } /> - {actionmass_eval_froid && String(actionmass_eval_froid) !== "" && String(actionmass_eval_froid).length > 1 && + {actionmass_eval_froid && String(actionmass_eval_froid) !== "" && String(selectionModel_evaluation_cold).length > 0 && selectionModel_evaluation_cold.length > 0 && @@ -2154,7 +2214,16 @@ const Module_Session_Evaluation = (props) => {
{' '} - Confirmer l'action {actionmass_eval_froid} en masse. + + + {actionmass_eval_froid && String(actionmass_eval_froid) === "demande evaluation" && } + + {actionmass_eval_froid && String(actionmass_eval_froid) === "export_evaluation" && } +
@@ -2320,6 +2389,10 @@ const Module_Session_Evaluation = (props) => { setselectionModel_evaluation_formateur(newSelectionModel_evaluation); //console.log("ch selected--" + newSelectionModel_evaluation); + if( selectionModel_evaluation_formateur.length <= 0 ){ + setactionmass_eval_formateur(""); + } + }} selectionModel={selectionModel_evaluation_formateur} @@ -2384,7 +2457,7 @@ const Module_Session_Evaluation = (props) => { /> - {selectionModel_evaluation_formateur && selectionModel_evaluation_formateur.length >= 0 && + {selectionModel_evaluation_formateur && selectionModel_evaluation_formateur.length > 0 &&
  @@ -2398,7 +2471,7 @@ const Module_Session_Evaluation = (props) => { options={New_Option_Evaluation_Masse} onChange={(event, value) => { if (value && value.value) { - if (String(value.value) === "demande evaluation") { + if (String(value.value) === "demande evaluation" || String(value.value) === "export_evaluation") { setactionmass_eval_formateur(value.value); @@ -2418,9 +2491,9 @@ const Module_Session_Evaluation = (props) => { } /> + - {actionmass_eval_formateur && String(actionmass_eval_formateur) !== "" && String(actionmass_eval_formateur).length > 1 && - selectionModel_evaluation_formateur.length > 0 && + {actionmass_eval_formateur && String(actionmass_eval_formateur) !== "" && selectionModel_evaluation_formateur.length > 0 && Traiter @@ -2440,7 +2513,15 @@ const Module_Session_Evaluation = (props) => {
{' '} - Confirmer l'action {actionmass_eval_formateur} en masse. + + {actionmass_eval_formateur && String(actionmass_eval_formateur) === "demande evaluation" && } + + {actionmass_eval_formateur && String(actionmass_eval_formateur) === "export_evaluation" && } +