diff --git a/src/components/Module_Session_Evaluation.js b/src/components/Module_Session_Evaluation.js index 33f34e7..bda51e6 100644 --- a/src/components/Module_Session_Evaluation.js +++ b/src/components/Module_Session_Evaluation.js @@ -167,6 +167,51 @@ const Module_Session_Evaluation = (props) => { ] + + const columns_list_evaluation_cold = [ + { field: 'id', headerName: 'id', hide: true }, + { field: '_id', headerName: '_id', hide: true }, + { field: 'form_code', headerName: 'Form. Code', hide: true, minwidth: 200, flex: 1, hideable: true, resizable: true, renderCell: (params) => , }, + { field: 'email', headerName: 'email', minwidth: 300, flex: 1, hideable: true, resizable: true, renderCell: (params) => , }, + { field: 'nom', headerName: 'nom', minwidth: 300, flex: 1, hide: false, editable: true, renderCell: (params) => , }, + { field: 'prenom', headerName: 'prenom', minwidth: 300, flex: 1, hide: false, editable: false, renderCell: (params) => , }, + { + field: 'status', headerName: 'Statut', width: 100, editable: false, flex: true, + valueFormatter: (params) => { + if (String(params.value) === "0") + return "Init."; + else if (String(params.value) === "1") + return "Env."; + else if (String(params.value) === "2") + return "Rép."; + else + return " ?"; + }, + }, + + { + field: 'date_envoie', headerName: 'Date Envoi', width: 150, editable: false, + valueFormatter: (params) => { + if (params.value) + return String(params.value).substring(0, 16) + else + return "" + + }, + }, + { + field: 'date_reponse', headerName: 'Date Réponse', width: 150, editable: false, + valueFormatter: (params) => { + if (params.value) + return String(params.value).substring(0, 16) + else + return "" + + }, + }, + + ] + const [selected_code_session, setselected_code_session] = useState(); const [selected_session_id, setselected_session_id] = useState(props.related_collection_recid); const [selected_internal_url, setselected_internal_url] = useState(); @@ -486,69 +531,178 @@ const Module_Session_Evaluation = (props) => { const [rowss_evaluation, setRows_evaluation] = useState([]); - const [GetListePreinscrit_evaluation_api, setGetListePreinscrit_evaluation_api] = useState(); - const [GetListePreinscrit_evaluation_meassage, setGetListePreinscrit_evaluation_meassage] = useState(); - const [GetListePreinscrit_evaluation_result, setGetListePreinscrit_evaluation_result] = useState([]) - function GetListeEvaluation(localsessionid) { - - return; + const [selectionModel_evaluation_cold, setSelectionModel_evaluation_cold] = React.useState([]); + const [rowss_evaluation_cold, setRows_evaluation_cold] = useState([]); + /**** Les évaluations a froid */ + const [New_Getall_Partner_Formulaires_cold_evaluation_with_Filter, setNew_Getall_Partner_Formulaires_cold_evaluation_with_Filter] = useState([]); + + const [Getall_Partner_Formulaires_cold_evaluation_with_Filter_api, setGetall_Partner_Formulaires_cold_evaluation_with_Filter_api] = useState(); + const [Getall_Partner_Formulaires_cold_evaluation_with_Filter_message, setGetall_Partner_Formulaires_cold_evaluation_with_Filter_message] = useState(); + const [Getall_Partner_Formulaires_cold_evaluation_with_Filter_result, setGetall_Partner_Formulaires_cold_evaluation_with_Filter_result] = useState([]); + function Getall_Partner_Formulaires_cold_evaluation_with_Filter(event) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("type", "cold_eval"); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Formulaire_with_filter/"; + + + + setLoading(true); + axios.post(myurl, form).then(res => { + setLoading(false); + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Partner_Formulaires_cold_evaluation_with_Filter res.data.status = " + res.data.status); + //console.log(" In Getall_Partner_Formulaires_cold_evaluation_with_Filter res.data.message r_class = " + res.data.message); + setGetall_Partner_Formulaires_cold_evaluation_with_Filter_api("true"); + setGetall_Partner_Formulaires_cold_evaluation_with_Filter_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_code = JSON.parse(x).code; + var local_nom = JSON.parse(x).nom; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_code + " " + local_nom, + "nom": local_nom, + "code": local_code, + }; + new_data2.push(node); + }); + + var node = { + "_id": "", + "id": "", + "label": "", + "nom": "", + "code": "", + + }; + new_data2.push(node); + + if (new_data2.length > 0) + setNew_Getall_Partner_Formulaires_cold_evaluation_with_Filter(new_data2); + } + else { + setGetall_Partner_Formulaires_cold_evaluation_with_Filter_api("false"); + setGetall_Partner_Formulaires_cold_evaluation_with_Filter_message(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Getall_Partner_Formulaires_cold_evaluation_with_Filter = ', error); + setGetall_Partner_Formulaires_cold_evaluation_with_Filter_api("false"); + //setmyApimyApiMessage("") + }) + } + + const [Getall_Survey_cold_evaluation_By_Session_api, setGetall_Survey_cold_evaluation_By_Session_api] = useState(); + const [Getall_Survey_cold_evaluation_By_Session_message, setGetall_Survey_cold_evaluation_By_Session_message] = useState(); + const [Getall_Survey_cold_evaluation_By_Session_result, setGetall_Survey_cold_evaluation_By_Session_result] = useState([]); + function Getall_Survey_cold_evaluation_By_Session(event) { + + setSelectionModel_evaluation([]) + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("session_id", selected_session_id); + form.append("formulaire_type", "cold_eval"); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Survey_with_filter/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + + setLoading(false); + + if (String(res.data.status) === String("true")) { + // console.log(" In Getall_Survey_cold_evaluation_By_Session res.data.status = " + res.data.status); + console.log(" In Getall_Survey_cold_evaluation_By_Session res.data.message r_class = " + res.data.message); + setGetall_Survey_cold_evaluation_By_Session_api("true"); + setGetall_Survey_cold_evaluation_By_Session_result(res.data.message); + setRows_evaluation_cold(res.data.message); + + } + else { + setGetall_Survey_cold_evaluation_By_Session_api("false"); + setGetall_Survey_cold_evaluation_By_Session_message(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Getall_Survey_cold_evaluation_By_Session = ', error); + setGetall_Survey_cold_evaluation_By_Session_api("false"); + //setmyApimyApiMessage("") + }) + } + + + const [Create_List_Survey_cold_eval_For_Session_For_Inscrit_api, setCreate_List_Survey_cold_eval_For_Session_For_Inscrit_api] = useState(); + const [Create_List_Survey_cold_eval_For_Session_For_Inscrit_message, setCreate_List_Survey_cold_eval_For_Session_For_Inscrit_message] = useState(); + const [Create_List_Survey_cold_eval_For_Session_For_Inscrit_result, setCreate_List_Survey_cold_eval_For_Session_For_Inscrit_result] = useState(); + function Create_List_Survey_cold_eval_For_Session_For_Inscrit() { var form = new FormData(); //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); - form.append("session_id", localsessionid); + form.append("session_id", selected_session_id); + form.append("formulaire_id", selected_formulaire_id); + form.append("survey_type", "cold_eval"); + form.append("sending_date", date_cold_eval_sending); - /* - /!\ : Cette fonction a besoin d'un token actif - */ + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Init_Survey_Tab_For_All_Session_Inscrit/"; - if (String(stored_cookie) === String("")) { - alert(" La session n'est plus valide "); - history.push("/Connexion"); - return; - } - - var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetListEvaluation_Session/"; setLoading(true); - fetch(myurl, - { - method: 'POST', - body: form, - }) - .then((data) => data.json()) - .then((data) => { - setLoading(false); - //console.log('GetListeEvaluation -- Success:', data['message'], "data['status'] = ", data['status']); - setGetListePreinscrit_evaluation_result(data['message']); - setRows_evaluation(data['message']); - if (String(data['status']) === String("Err_Connexion")) { - alert('Erreur: ' + data['message']); - history.push("/Connexion"); - } - else if (String(data['status']) === String("true")) { - setGetListePreinscrit_evaluation_api("true"); + axios.post(myurl, form).then(res => { - } else { - //console.log("GetListeEvaluation rrrr:" + data['status']) - setGetListePreinscrit_evaluation_api("false"); + setLoading(false); + if (String(res.data.status) === String("true")) { + //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); + //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); + setCreate_List_Survey_cold_eval_For_Session_For_Inscrit_api("true"); + setCreate_List_Survey_cold_eval_For_Session_For_Inscrit_result(res.data.message); + Getall_Survey_cold_evaluation_By_Session(); + alert(res.data.message); - } + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setCreate_List_Survey_cold_eval_For_Session_For_Inscrit_api("false"); + setCreate_List_Survey_cold_eval_For_Session_For_Inscrit_message(res.data.message); + alert(res.data.message); + } - }).catch((error) => { - setLoading(false); - console.error('Error:', error); - setGetListePreinscrit_evaluation_api("false"); - alert(" Impossible de récuperer les données pour les avis ") - }); + }).catch((error) => { + setLoading(false); + console.warn('Create_List_Survey_cold_eval_For_Session_For_Inscrit : Not good man :( mysearchtext = ' + error); + setCreate_List_Survey_cold_eval_For_Session_For_Inscrit_api("false"); + alert(" Impossible d'initialiser la liste des enquête de positionnement "); + }) } - const [actionmass_eval_val, setactionmass_eval_val] = useState(); const actionmass_evaluation = (event) => { const value = event.target.value; @@ -678,6 +832,7 @@ const Module_Session_Evaluation = (props) => { Getall_Training_Materiel_No_Filter(); Getall_Survey_hot_evaluation_By_Session(); + Getall_Survey_cold_evaluation_By_Session(); setSessionendDate(props.SessionendDate); setSessionstartDate(props.SessionstartDate); @@ -736,6 +891,38 @@ const Module_Session_Evaluation = (props) => { } + + function Export_survey_cold_eval_datatab_class() { + const stored_cookie = getCookie('tokenmysypart'); + + var nom_fichier_cmd = "export_reponses.xlsx"; + + var url = process.env.REACT_APP_API_URL + "myclass/api/Export_To_Excel_Survey_with_filter/" + stored_cookie + "/" + selected_session_id + "/cold_eval/"; + + + 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); @@ -748,8 +935,26 @@ const Module_Session_Evaluation = (props) => { setDialog_LIST_HOT_EVALUATION_QUESTION_open(false); }; + const [selected_formulaire_id, setselected_formulaire_id] = useState(); + + + const [Dialog_LIST_COLD_EVALUATION_QUESTION_open, setDialog_LIST_COLD_EVALUATION_QUESTION_open] = React.useState(false); + const Dialog_LIST_COLD_EVALUATION_QUESTION_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const Dialog_LIST_COLD_EVALUATION_QUESTION_handleClose_buton = () => { + setDialog_LIST_COLD_EVALUATION_QUESTION_open(false); + }; + + var date_today_90j = new Date(); + date_today_90j.setDate(date_today_90j.getDate() + 90); + const [date_cold_eval_sending, setdate_cold_eval_sending] = useState(date_today_90j.toLocaleDateString('fr-FR')); + + return (
@@ -840,15 +1045,116 @@ const Module_Session_Evaluation = (props) => { -

Module evaluation

+ + {/* Dialog pour gerer les LIST_COLD_EVALUATION_QUESTION */} + + + MySy Information + + + {Dialog_1_message} + + + +
Choisir un questionnaire d'évaluation à froid + { + if (value && value._id) { + + setselected_formulaire_id(value._id); + + } else { + setselected_formulaire_id(""); + } + }} + + renderInput={(params) => + } + /> + +
+ +
Envoyer le + { + setdate_cold_eval_sending(format(date, 'dd/MM/yyyy')); + } + } + + className="disabled_style session_caract_Dialog_DatePicker" + style={{ width: "99%" }} + locale='fr-FR' + showTimeSelect={false} + dateFormat="dd/MM/yyyy" + + /> + +
+ +
+ + +
+
+ + +
+ + + +
+ +
+
+ +
+ +
+ {/* FIN Dialog pour gerer les LIST_COLD_EVALUATION_QUESTION */} +
-
+
+
Evaluation à Chaud
Initialiser la demande + } modal nested @@ -1124,6 +1430,293 @@ const Module_Session_Evaluation = (props) => {
+ +
 
+
+ + +
+
Evaluation à froid
+ +
+
+ {date_cold_eval_sending && } +
+ +
+ Initialisation + } + modal + nested + position="center center" + + > + + {close => ( +
+ +
MySy Information
+
+ {' '} + + + Confirmez la (ré)initialisation de la demande.
+ /!\ Si une demande d'évaluation existe pour cette session, elle sera supprimée et récréée +
+ + +
+
+
+ + +
+
+ +
+
+
+ )} +
+ + + + + + + +
+
+
+ +
+ + + { + setSelectionModel_evaluation_cold(newSelectionModel_evaluation); + //console.log("ch selected--" + newSelectionModel_evaluation); + + }} + + selectionModel={selectionModel_evaluation_cold} + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={rowss_evaluation_cold.map((item, index) => ( + { + id: index, + _id: JSON.parse(item)._id, + email: JSON.parse(item).email, + nom: JSON.parse(item).nom, + prenom: JSON.parse(item).prenom, + status: JSON.parse(item).statut, + form_code: JSON.parse(item).formulaire.code, + date_envoie: JSON.parse(item).date_envoi, + date_reponse: JSON.parse(item).date_reponse, + + } + ))} + + columns={columns_list_evaluation_cold} + pageSize={10} + className="datagridclass" + + rowsPerPageOptions={[10]} + disableSelectionOnClick + components={{ + Toolbar: GridToolbar, + }} + + getRowClassName={(params) => { + + if (String(params.row.status) === "1") { + return 'line--positionnement_envoye'; + } + + if (String(params.row.status) === "2") { + return 'line--positionnement_repondu'; + } + + // Pour la gestion de la couleur de zone double cliquée + + if (parseInt(String(params.row.id)) % 2 === 0) { + return 'line--statut--pair'; + } + else if (parseInt(String(params.row.id)) % 2 !== 0) { + return 'line--statut--impair'; + } + + }} + getEstimatedRowHeight={() => 200} + getRowHeight={() => "auto"} + sx={{ + "& .MuiDataGrid-cellContent": { + minHeight: 50, + + }, + [`& .${gridClasses.cell}`]: { + py: 1, + }, + }} + + /> + + + {selectionModel_evaluation_cold && selectionModel_evaluation_cold.length >= 1 && +
+
+
+   + + + { + if (value && value.value) { + if (String(value.value) === "demande evaluation") { + + setactionmass_eval_val(value.value); + + } + else { + setactionmass_eval_val(""); + } + + } + else { + setactionmass_eval_val(""); + } + + }} + + renderInput={(params) => + } + /> + + + {actionmass_eval_val && String(actionmass_eval_val).length > 1 && + + Traiter + + } + modal + nested + position="center center" + > + + {close => ( +
+ +
MySy Information
+
+ {' '} + + Confirmer l'action {actionmass_eval_val} en masse. +
+
+
+ + +
+
+ +
+
+
+ )} +
+ } +
+ + +
+ } + +
+ + + + +
+ + +
+
); } diff --git a/src/components/Partner_Config_Formulaires.js b/src/components/Partner_Config_Formulaires.js index 8bed781..4463e7d 100644 --- a/src/components/Partner_Config_Formulaires.js +++ b/src/components/Partner_Config_Formulaires.js @@ -745,7 +745,7 @@ const Partner_Config_Formulaires = (props) => { const New_Option_type_Formulaire = [ { "id": "pos", "label": "Q. Positionnement", "value": "pos" }, { "id": "hot_eval", "label": "Eval. Chaud ", "value": "hot_eval" }, - { "id": "cool_eval", "label": "Eval. Froid", "value": "cool_eval" }, + { "id": "cold_eval", "label": "Eval. Froid", "value": "cold_eval" }, { "id": "", "label": "", "value": "" }, ] diff --git a/src/components/SurveyDocument.js b/src/components/SurveyDocument.js index 9705026..b0145e3 100644 --- a/src/components/SurveyDocument.js +++ b/src/components/SurveyDocument.js @@ -315,7 +315,7 @@ function SurveyDocument() { Questionnaire d'évaluation
} - {String(JSON.parse(get_Given_Survey_Data_result).survey_type) === "cool_eval" &&
+ {String(JSON.parse(get_Given_Survey_Data_result).survey_type) === "cold_eval" &&
Questionnaire d'évaluation
} diff --git a/src/styles/components/_displaypartnersession.scss b/src/styles/components/_displaypartnersession.scss index 355ce25..8e99455 100644 --- a/src/styles/components/_displaypartnersession.scss +++ b/src/styles/components/_displaypartnersession.scss @@ -2648,6 +2648,8 @@ top: -13px; } + + .img_class_logo_mini { display: block; width: 112px;