recette2
cherif 2024-07-09 21:16:40 +02:00
parent 2f624a32f7
commit 6059d7abe2
3 changed files with 79 additions and 30 deletions

View File

@ -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 (
<div className="employes">
@ -7032,7 +7053,6 @@ const Employes = (props) => {
</div>
<div className="div_row" style={{ paddingRight: '10px' }}>
<div className="session_data">
<div style={{ "border": "None" }}>
@ -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) => {
<div className="div_row">
{String(selected_statistic_question_id) !== "" && <div className="div_row_gauche"> <Button onClick={Getall_Qry_Survey_Data} className="bton_enreg_dialog"> Afficher</Button> </div>}
<div className="div_row_droite" style={{ "textAlign": 'center' }}>
<Button onClick={Dialog_1_handleClose_buton_statistique} className="bton_annule_dialog" >Fermer</Button>
</div>
</div>
<div style={{ "height": "25rem" }}>
<Box style={{ "color": "black", "height": "30rem" }}>
<div style={{ "textAlign": "right", "float": "right", "width": "100%" }}>
Affichage : <nav className="mode_affichage" onClick={func_display_line_view}> <SsidChartIcon /> Ligne </nav>
<nav className="mode_affichage" onClick={func_display_bars_view}> <BarChartIcon /> Bar </nav>
</div>
{display_view && String(display_view) === "bars" && <Box style={{ "color": "black", "height": "30rem" }}>
&nbsp;
<div className="session_data" style={{ paddingLeft: "2rem" }}>
@ -10381,8 +10408,7 @@ 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 },
]}
@ -10392,19 +10418,14 @@ const Employes = (props) => {
/>}
</div>
</Box>
</Box>}
<br />
</div>
<div style={{ "height": "25rem" }}>
<Box style={{ "color": "black", "height": "30rem" }}>
{display_view && String(display_view) === "line" && <Box style={{ "color": "black", "height": "30rem" }}>
&nbsp;
<div className="session_data" style={{ paddingLeft: "2rem", height: '20rem' }}>
selected_statistic_question_type = {selected_statistic_question_type} <br/>
{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) => {
}
</div>
</Box>
</Box>}
<br />
</div>
</div>}
</div >

View File

@ -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) => <ExpandableCell_50 {...params} />, },
@ -2130,6 +2131,11 @@ const Partner_Config_Formulaires = (props) => {
setquestion_question(newSelectionModel.row.question);
setquestion_type(newSelectionModel.row.type);
setquestion_max_note(newSelectionModel.row.max_note);
if( newSelectionModel.row.is_statistic === "1"){
setstatistic_checked(true);
}else{
setstatistic_checked(false);
}
if (newSelectionModel.row.list_choix) {
var tmp_tab = []
@ -2139,7 +2145,7 @@ const Partner_Config_Formulaires = (props) => {
settab_qcm_choix(tmp_tab);
}
console.log(" ")
if (newSelectionModel.row.list_case_cocher) {
var tmp_tab_checkbox = []
for (let i = 0; i < newSelectionModel.row.list_case_cocher.length; i++) {

View File

@ -626,7 +626,12 @@
}
}
.mode_affichage {
width: 25%;
float: right;
cursor: pointer;
} }
@media only screen and (min-width: 601px) and (max-width: 991px) {
.okUpdateData {
@ -1228,7 +1233,12 @@
}
}
.mode_affichage {
width: 15%;
float: right;
cursor: pointer;
} }
@media only screen and (min-width: 992px) and (max-width: 1199px) {
.okUpdateData {
@ -1729,6 +1739,12 @@
}
.mode_affichage {
width: 12%;
float: right;
cursor: pointer;
}
}
@media only screen and (min-width: 1200px) {
@ -2323,7 +2339,12 @@
}
}
.mode_affichage {
width: 8%;
float: right;
cursor: pointer;
} }
.session_caract_Dialog_comment_2_lines {