diff --git a/src/components/Employes.js b/src/components/Employes.js index ad6aaf6..4519145 100644 --- a/src/components/Employes.js +++ b/src/components/Employes.js @@ -57,6 +57,9 @@ import Rating from '@mui/material/Rating'; import { BarChart } from '@mui/x-charts'; import { axisClasses } from '@mui/x-charts'; import { LineChart } from '@mui/x-charts/LineChart'; +import BarChartIcon from '@mui/icons-material/BarChart'; +import SsidChartIcon from '@mui/icons-material/SsidChart'; + const Employes = (props) => { const history = useHistory(); @@ -3657,6 +3660,7 @@ const Employes = (props) => { var local_id = JSON.parse(x).question_id; var local_question_id = JSON.parse(x).question_id; var local_question_question = JSON.parse(x).question_question; + var local_question_type = JSON.parse(x).question_type; //--- @@ -3666,6 +3670,7 @@ const Employes = (props) => { "question_id": local_question_id, "label": local_question_question, "question_question": local_question_question, + "question_type": local_question_type, }; new_data2.push(node); }); @@ -5614,6 +5619,7 @@ const Employes = (props) => { }; const [selected_statistic_question_id, setselected_statistic_question_id] = useState(""); + const [selected_statistic_question_type, setselected_statistic_question_type] = useState(""); const [p_filter_date_from, setp_filter_date_from] = useState(date_today_minus_180j.toLocaleDateString('fr-FR')); const [p_filter_date_to, setp_filter_date_to] = useState(date_today_30j.toLocaleDateString('fr-FR')); @@ -5663,21 +5669,26 @@ const Employes = (props) => { var jsonObj0 = jsonObj[0] + //console.log(" ### jsonObj0 = ", jsonObj0); + var new_data2 = []; const new_data = jsonObj0.map((x) => { var month_year = (x).month_year; + var type_question = (x).type_question; var label = (x).label; - var value = (x).value; + var value = parseFloat((x).value); var count = (x).count; var nb_question_response = parseFloat((x).nb_question_response); var somme_question_response = parseFloat((x).somme_question_response); var moyenne_question_response = parseFloat((x).moyenne_question_response); + //--- var node = { "month_year": month_year, "label": label, - "value": value, + "type_question": type_question, + "value": parseFloat(String(value)), "count": count, "nb_question_response": parseInt(String(nb_question_response)), "somme_question_response": parseFloat(String(somme_question_response)), @@ -5690,7 +5701,7 @@ const Employes = (props) => { setGetall_Qry_Survey_Data_result_JSON(new_data2); //setGetall_Qry_Survey_Data_result_JSON(JSON.parse('[' + res.data.message + ']')); - + //console.log(" ### new_data2 = ", new_data2); setGetall_Qry_Survey_Data_api("true"); setGetall_Qry_Survey_Data_result(res.data.message); @@ -5725,9 +5736,19 @@ const Employes = (props) => { }, }; - const valueFormatter = (value) => `${value}`; + const [display_view, setdisplay_view] = useState("line"); + function func_display_line_view() { + setdisplay_view("line"); + } + + function func_display_bars_view() { + setdisplay_view("bars"); + } + + + return (
@@ -7032,7 +7053,6 @@ const Employes = (props) => {
-
@@ -10275,7 +10295,7 @@ const Employes = (props) => {
- +
Choisir une question @@ -10293,10 +10313,13 @@ const Employes = (props) => { onChange={(event, value) => { + if (value && value._id) { setselected_statistic_question_id(value.question_id); + setselected_statistic_question_type(value.question_type); } else { setselected_statistic_question_id(""); + setselected_statistic_question_type(""); } }} @@ -10355,14 +10378,18 @@ const Employes = (props) => {
{String(selected_statistic_question_id) !== "" &&
} -
- -
+
- +
+ Affichage : + +
+ + + {display_view && String(display_view) === "bars" &&  
@@ -10381,9 +10408,8 @@ const Employes = (props) => { }]} series={[ { dataKey: 'nb_question_response', label: 'NB', valueFormatter }, - { dataKey: 'somme_question_response', label: 'Somme', color: '#FA7070', valueFormatter }, - { dataKey: 'moyenne_question_response', label: 'Moyenne', color: '#FA7070', valueFormatter }, - + { dataKey: 'value', label: `${selected_statistic_question_type}` , color: '#FA7070', valueFormatter }, + ]} {...otherSetting} @@ -10392,19 +10418,14 @@ const Employes = (props) => { />}
-
+
} -
-
- - -
- - + {display_view && String(display_view) === "line" &&  
+ selected_statistic_question_type = {selected_statistic_question_type}
{Getall_Qry_Survey_Data_result_JSON && Getall_Qry_Survey_Data_result_JSON.length > 0 && Getall_Qry_Survey_Data_result_JSON && @@ -10420,8 +10441,7 @@ const Employes = (props) => { }]} series={[ { dataKey: 'nb_question_response', label: 'NB', valueFormatter: (value) => (value == null ? 'NaN' : value.toString()), }, - { dataKey: 'somme_question_response', label: 'Somme', color: '#FA7070', valueFormatter: (value) => (value == null ? 'NaN' : value.toString()), }, - { dataKey: 'moyenne_question_response', label: 'Moyenne', color: '#FA7070', valueFormatter: (value) => (value == null ? 'NaN' : value.toString()), }, + { dataKey: 'value', label: `${selected_statistic_question_type}`, color: '#FA7070', valueFormatter: (value) => (value == null ? 'NaN' : value.toString()), }, ]} margin={{ right: 15, left: 100 }} @@ -10432,11 +10452,13 @@ const Employes = (props) => { }
-
+
}
+ +
}
diff --git a/src/components/Partner_Config_Formulaires.js b/src/components/Partner_Config_Formulaires.js index 94d68a7..ef3030d 100644 --- a/src/components/Partner_Config_Formulaires.js +++ b/src/components/Partner_Config_Formulaires.js @@ -182,6 +182,7 @@ const Partner_Config_Formulaires = (props) => { const columns_question = [ { field: '_id', headerName: '_id', hide: true }, { field: 'id', headerName: 'id', hide: true }, + { field: 'list_choix', headerName: 'Liste Choix', hide: true }, { field: 'list_case_cocher', headerName: 'Liste C.A.C', hide: true }, { field: 'question', headerName: 'Question', flex: 1, hide: false, editable: false, renderCell: (params) => , }, @@ -1463,7 +1464,7 @@ const Partner_Config_Formulaires = (props) => { - +