diff --git a/src/components/Module_Evaluation_Positionnement.js b/src/components/Module_Evaluation_Positionnement.js
index f1c2a1d..9cfb89d 100644
--- a/src/components/Module_Evaluation_Positionnement.js
+++ b/src/components/Module_Evaluation_Positionnement.js
@@ -381,6 +381,7 @@ const Module_Evaluation_Positionnement = (props) => {
const New_Option_q_position_Masse = [
{ "id": "resend", "label": "(R)envoyer", "value": "resend" },
+ { "id": "print", "label": "Export (PDF) ", "value": "print" },
]
const [actionmass_q_position_val, setactionmass_q_position_val] = useState();
@@ -404,12 +405,29 @@ const Module_Evaluation_Positionnement = (props) => {
}
- console.log(" ### tab_ids_survey === ", tab_ids_survey);
+ // console.log(" ### tab_ids_survey === ", tab_ids_survey);
Send_Survey_By_Email_For_Ids(tab_ids_survey);
}
+ else if (String(actionmass_q_position_val) === String("print")) {
+ var tab_ids_survey = []
+ for (var i = 0; i < selectionModel_q_position.length; i++) {
+ var myid = parseInt(String(selectionModel_q_position[i]));
+ var line = JSON.parse(Getall_Survey_Q_Positionnement_By_Session_result[myid]);
+ var line_id = JSON.parse(Getall_Survey_Q_Positionnement_By_Session_result[myid])._id;
+
+ tab_ids_survey.push(line_id);
+ }
+
+
+ // console.log(" ### tab_ids_survey === ", tab_ids_survey);
+
+ Export_Selected_Survey_PDF(tab_ids_survey);
+
+ }
+
}
@@ -441,6 +459,7 @@ const Module_Evaluation_Positionnement = (props) => {
setSend_Survey_By_Email_For_Ids_result(res.data.message);
Getall_Survey_Q_Positionnement_By_Session();
+ setactionmass_q_position_val("");
setselectionModel_q_position([]);
// alert(res.data.message)
setdisplay_alert_mysy("1");
@@ -502,6 +521,56 @@ const Module_Evaluation_Positionnement = (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 ");
+ setdisplay_alert_mysy("1");
+ setalert_message("Aucune ligne selectionnée ");
+ setalert_type("error");
+ return;
+ }
+ var nom_fichier_cmd = "Q_Position.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()+"/Positionnement";
+
+
+ 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) ");
+ setdisplay_alert_mysy("1");
+ setalert_message("Impossible d'exporter les réponses (2) ");
+ setalert_type("error");
+ } else {
+ fileDownload(res.data, nom_fichier_cmd);
+ setactionmass_q_position_val("");
+ setselectionModel_q_position([]);
+
+ }
+ }).catch((error) => {
+ setLoading(false);
+ console.error('Error:', error);
+ // alert(" Impossible d'exporter les réponses ")
+ setdisplay_alert_mysy("1");
+ setalert_message("Impossible d'exporter les réponse ");
+ setalert_type("error");
+
+ });
+
+
+ setLoading(false);
+ }
+
+
+
+
const [display_alert_mysy, setdisplay_alert_mysy] = useState("");
const [alert_message, setalert_message] = useState("");
const [alert_type, setalert_type] = useState("");
@@ -919,7 +988,8 @@ const Module_Evaluation_Positionnement = (props) => {
options={New_Option_q_position_Masse}
onChange={(event, value) => {
if (value && value.value) {
- if (String(value.value) === "reinit" || String(value.value) === "resend") {
+ if (String(value.value) === "reinit" || String(value.value) === "resend"
+ || String(value.value) === "print") {
setactionmass_q_position_val(value.value);
@@ -963,6 +1033,11 @@ const Module_Evaluation_Positionnement = (props) => {
Confirmer l'envoi de en masse de {selectionModel_q_position.length} questionnaire(s) de positionnement.
}
+
+ {actionmass_q_position_val && String(actionmass_q_position_val) === "print" && }
+
diff --git a/src/components/Module_Session_Evaluation.js b/src/components/Module_Session_Evaluation.js
index a74e111..a649d34 100644
--- a/src/components/Module_Session_Evaluation.js
+++ b/src/components/Module_Session_Evaluation.js
@@ -1011,7 +1011,7 @@ const Module_Session_Evaluation = (props) => {
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);
+ Export_Selected_Survey_PDF(tab_ids_survey, "Evaluation formateur", "formateur");
}
@@ -1035,7 +1035,7 @@ const Module_Session_Evaluation = (props) => {
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);
+ Export_Selected_Survey_PDF(tab_ids_inscription, "Evaluation à chaud", "chaud");
}
@@ -1069,7 +1069,7 @@ const Module_Session_Evaluation = (props) => {
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);
+ Export_Selected_Survey_PDF(tab_ids_inscription, "Evaluation à froid", "froid");
}
@@ -1293,7 +1293,7 @@ const Module_Session_Evaluation = (props) => {
}
- function Export_Selected_Survey_PDF(tab_ids_survey) {
+ function Export_Selected_Survey_PDF(tab_ids_survey, type_export, used_datagrid) {
const stored_cookie = getCookie('tokenmysypart');
@@ -1304,7 +1304,7 @@ const Module_Session_Evaluation = (props) => {
}
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();
+ 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() + "/" + String(type_export);
setLoading(true);
@@ -1315,7 +1315,18 @@ const Module_Session_Evaluation = (props) => {
if (String(res.data) === String("false")) {
alert("Impossible d'exporter les réponses (2) ");
} else {
- fileDownload(res.data, nom_fichier_cmd)
+ fileDownload(res.data, nom_fichier_cmd);
+
+ if (used_datagrid === "formateur") {
+ setselectionModel_evaluation_formateur([]);
+ setactionmass_eval_formateur("");
+ } else if (used_datagrid === "chaud") {
+ setSelectionModel_evaluation([]);
+ setactionmass_eval_val("");
+ } else if (used_datagrid === "froid") {
+ setactionmass_eval_froid("");
+ setSelectionModel_evaluation_cold([]);
+ }
}
}).catch((error) => {
@@ -1793,7 +1804,7 @@ const Module_Session_Evaluation = (props) => {
setSelectionModel_evaluation(newSelectionModel_evaluation);
//console.log("ch selected--" + newSelectionModel_evaluation);
- if( selectionModel_evaluation.length <= 0 ){
+ if (selectionModel_evaluation.length <= 0) {
setactionmass_eval_val("");
}
@@ -2089,7 +2100,7 @@ const Module_Session_Evaluation = (props) => {
setSelectionModel_evaluation_cold(newSelectionModel_evaluation);
//console.log("ch selected--" + newSelectionModel_evaluation);
- if( selectionModel_evaluation_cold.length <= 0 ){
+ if (selectionModel_evaluation_cold.length <= 0) {
setactionmass_eval_froid("");
}
@@ -2387,7 +2398,7 @@ const Module_Session_Evaluation = (props) => {
setselectionModel_evaluation_formateur(newSelectionModel_evaluation);
//console.log("ch selected--" + newSelectionModel_evaluation);
- if( selectionModel_evaluation_formateur.length <= 0 ){
+ if (selectionModel_evaluation_formateur.length <= 0) {
setactionmass_eval_formateur("");
}
@@ -2489,7 +2500,7 @@ const Module_Session_Evaluation = (props) => {
}
/>
-
+
{actionmass_eval_formateur && String(actionmass_eval_formateur) !== "" && selectionModel_evaluation_formateur.length > 0 &&