From dd228700f60277f4138adc92ba9bbfc0f04503e7 Mon Sep 17 00:00:00 2001 From: cherif Date: Sun, 7 Apr 2024 12:56:44 +0200 Subject: [PATCH] 07/04/2024 - 13h19 --- src/components/DisplayPartnerSession.js | 2 + .../DisplayPartnerTrainingsPagination.js | 2 +- .../Module_Evaluation_Positionnement.js | 178 +++++++++++------- src/components/SurveyDocument.js | 26 ++- 4 files changed, 133 insertions(+), 75 deletions(-) diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index f2f9ee3..27d850a 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -10013,6 +10013,8 @@ const DisplayPartnerSession = (props) => { /* Recuperation des evaluations */ const [selectionModel_evaluation, setSelectionModel_evaluation] = React.useState([]); 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([]) diff --git a/src/components/DisplayPartnerTrainingsPagination.js b/src/components/DisplayPartnerTrainingsPagination.js index eddadaa..077a67d 100644 --- a/src/components/DisplayPartnerTrainingsPagination.js +++ b/src/components/DisplayPartnerTrainingsPagination.js @@ -10,7 +10,7 @@ import { getCookie } from 'react-use-cookie'; import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid'; import excel_icone from "../mysy_img/excel_icone.png"; import Popup from 'reactjs-popup'; -import fileDownload from 'js-file-download' +import fileDownload from 'js-file-download'; import 'reactjs-popup/dist/index.css'; import { AiFillCloseCircle, } from "react-icons/ai"; import parse from 'html-react-parser' diff --git a/src/components/Module_Evaluation_Positionnement.js b/src/components/Module_Evaluation_Positionnement.js index 1bc0212..e6fb4c9 100644 --- a/src/components/Module_Evaluation_Positionnement.js +++ b/src/components/Module_Evaluation_Positionnement.js @@ -11,7 +11,7 @@ import CheckOut from "./CheckOut"; import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid'; import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css"; import 'react-tooltip/dist/react-tooltip.css' - +import fileDownload from 'js-file-download'; import Popup from 'reactjs-popup' import 'reactjs-popup/dist/index.css'; import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint } from "react-icons/fc"; @@ -40,74 +40,78 @@ const Module_Evaluation_Positionnement = (props) => { const [isLoading, setLoading] = useState(); + function ExpandableCell_50({ value }) { + const [expanded, setExpanded] = React.useState(false); + + return ( + + ); + } + + const columns_q_position = [ { field: 'id', headerName: 'id', hide: true }, { field: '_id', headerName: '_id', hide: true }, - { field: 'Form. Code', headerName: 'form_code', minwidth: 200, flex: 1, hideable: true, resizable: true, }, - { field: 'email', headerName: 'email', minwidth: 200, flex: 1, hideable: true, resizable: true, }, - { field: 'nom', headerName: 'nom', minwidth: 200, flex: 1, hide: false, editable: true, }, - { field: 'prenom', headerName: 'prenom', minwidth: 200, flex: 1, hide: false, editable: false, }, + { 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"; + return "Init."; else if (String(params.value) === "1") - return "Envoyé"; + return "Env."; else if (String(params.value) === "2") - return "Répondu"; + return "Rép."; else return " ?"; }, }, + { field: 'date_envoie', headerName: 'Date Envoi', width: 150, editable: false, valueFormatter: (params) => { - return String(params.value).substring(0, 16) + if (params.value) + return String(params.value).substring(0, 16) + else + return "" }, }, - {/* - field: "voir", headerName: 'voir', - renderCell: (cellValues) => { - 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 "" - - - ); - } - */ }, - - {/* - field: "envoyer", headerName: 'Envoyer', - renderCell: (cellValues) => { - return ( - - - - ); - } - */}, + }, + }, + ] @@ -413,6 +417,37 @@ const Module_Evaluation_Positionnement = (props) => { } + function Export_survey_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+"/pos/"; + + + 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); + } + + return (
@@ -615,8 +650,13 @@ const Module_Evaluation_Positionnement = (props) => {
+ Getall_Survey_Q_Positionnement_By_Session(); + }}>Actualiser la liste + +
+
@@ -652,8 +692,14 @@ const Module_Evaluation_Positionnement = (props) => { py: 1, }, - '& .line--attestion_envoye': { - backgroundColor: '#ccffcc', + '& .line--positionnement_envoye': { + backgroundColor: '#F9E79F', + color: 'black', + + }, + + '& .line--positionnement_repondu': { + backgroundColor: '#ABEBC6', color: 'black', fontWeight: '600', }, @@ -682,9 +728,9 @@ const Module_Evaluation_Positionnement = (props) => { nom: JSON.parse(item).nom, prenom: JSON.parse(item).prenom, status: JSON.parse(item).statut, - form_code: JSON.parse(item).formulaire.description, - - + form_code: JSON.parse(item).formulaire.code, + date_envoie: JSON.parse(item).date_envoi, + date_reponse: JSON.parse(item).date_reponse, } ))} @@ -696,8 +742,6 @@ const Module_Evaluation_Positionnement = (props) => { }} - - rowsPerPageOptions={[10]} disableSelectionOnClick components={{ @@ -706,25 +750,17 @@ const Module_Evaluation_Positionnement = (props) => { //sx={datagridSx} getCellClassName={(params) => { - // Pour la gestion de la couleur de zone double cliquée - if (String(params.row.id) === String(gridline_id)) { - return 'line--statut--selected'; - } - else 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'; - } }} getRowClassName={(params) => { - if (String(params.row.status) === "1") { + return 'line--positionnement_envoye'; + } - return 'line--attestion_envoye'; + if (String(params.row.status) === "2") { + return 'line--positionnement_repondu'; } // Pour la gestion de la couleur de zone double cliquée @@ -814,7 +850,7 @@ const Module_Evaluation_Positionnement = (props) => { {' '} {String(actionmass_q_position_val) === "resend" && - Confirmer l'envoi de en masse de {selectionModel_q_position.length} attestation(s) de formation. + Confirmer l'envoi de en masse de {selectionModel_q_position.length} questionnaire(s) de positionnement. }
diff --git a/src/components/SurveyDocument.js b/src/components/SurveyDocument.js index 24f5d8b..909360f 100644 --- a/src/components/SurveyDocument.js +++ b/src/components/SurveyDocument.js @@ -149,9 +149,27 @@ function SurveyDocument() { form.append("survey_id", survey_id); form.append("list_response", myJSON); + var is_empty_field = 0; + for (let i = 0; i < Object.keys(tab_variable).length; i++) { + + var key = Object.keys(tab_variable)[i]; + var val = tab_variable[key]; + + document.getElementsByName(key)[0].style.backgroundColor = "#FFFFFF"; + + if( String(val).length === 0 ){ + document.getElementsByName(key)[0].style.backgroundColor = "#F9E79F"; + is_empty_field = 1; + } + + } + + if( is_empty_field === 1 ){ + alert(" Le questionnaire n'est pas correctement rempli"); + return; + } - console.log(" form == ", form); var myurl = process.env.REACT_APP_API_URL + "myclass/api/Record_Survey_Data_No_Token/"; @@ -261,7 +279,8 @@ function SurveyDocument() { } {question.type && String(question.type) === "entier" && question.max_note && -
+
} {question.type && String(question.type) === "bool" && -
+