From 2f624a32f7a5ee5220a25ea583c973e94d6d8640 Mon Sep 17 00:00:00 2001 From: cherif Date: Tue, 9 Jul 2024 15:17:55 +0200 Subject: [PATCH] sss --- src/components/DisplayPartnerSession.js | 3 +- src/components/Employes.js | 681 +++++++++++++++++++++++- 2 files changed, 681 insertions(+), 3 deletions(-) diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index ee1590f..aeac579 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -445,7 +445,8 @@ const DisplayPartnerSession = (props) => {
{New_civilite && New_civilite.length > 0 && cellValues.row.civilite && } diff --git a/src/components/Employes.js b/src/components/Employes.js index e5803b9..ad6aaf6 100644 --- a/src/components/Employes.js +++ b/src/components/Employes.js @@ -54,6 +54,9 @@ import Link from '@mui/material/Link'; import { PiDotsThree } from "react-icons/pi"; import { IoAddCircleOutline, IoCloseCircleOutline } from "react-icons/io5"; 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'; const Employes = (props) => { const history = useHistory(); @@ -104,6 +107,14 @@ const Employes = (props) => { date_today_90j.setDate(date_today_90j.getDate() + 90); + var date_today_30j = new Date(); + date_today_30j.setDate(date_today_30j.getDate() + 30); + + + var date_today_minus_180j = new Date(); + date_today_minus_180j.setDate(date_today_minus_180j.getDate() - 180); + + const [p_filtre1, setp_filtre1] = useState(""); const [p_filtre1_value, setp_filtre1_value] = useState(""); @@ -3099,6 +3110,14 @@ const Employes = (props) => { document.getElementById("evaluation").style.backgroundColor = "#d8edfc"; document.getElementById("evaluation").style.color = "black"; } + + + if (document.getElementById("statistiques")) { + document.getElementById("statistiques").style.backgroundColor = "#d8edfc"; + document.getElementById("statistiques").style.color = "black"; + } + + //console.log(" ### employee_data_edit_mode = ", employee_data_edit_mode); if (String(employee_data_edit_mode) !== "1") disable_Employee_DetailFields(); @@ -3156,6 +3175,13 @@ const Employes = (props) => { document.getElementById("evaluation").style.backgroundColor = "#d8edfc"; document.getElementById("evaluation").style.color = "black"; } + + + if (document.getElementById("statistiques")) { + document.getElementById("statistiques").style.backgroundColor = "#d8edfc"; + document.getElementById("statistiques").style.color = "black"; + } + } async function submenu_contrat() { @@ -3199,6 +3225,11 @@ const Employes = (props) => { document.getElementById("evaluation").style.color = "black"; } + if (document.getElementById("statistiques")) { + document.getElementById("statistiques").style.backgroundColor = "#d8edfc"; + document.getElementById("statistiques").style.color = "black"; + } + } @@ -3243,6 +3274,65 @@ const Employes = (props) => { document.getElementById("piece_jointe").style.color = "black"; } + if (document.getElementById("statistiques")) { + document.getElementById("statistiques").style.backgroundColor = "#d8edfc"; + document.getElementById("statistiques").style.color = "black"; + } + + + } + + + async function submenu_statistiques() { + setsubmenu("statistiques"); + + await sleep(5); + + if (document.getElementById("statistiques")) { + document.getElementById("statistiques").style.backgroundColor = "#104277"; + document.getElementById("statistiques").style.color = "white"; + } + + + if (document.getElementById("evaluation")) { + document.getElementById("evaluation").style.backgroundColor = "#d8edfc"; + document.getElementById("evaluation").style.color = "black"; + } + + if (document.getElementById("contrat")) { + document.getElementById("contrat").style.backgroundColor = "#d8edfc"; + document.getElementById("contrat").style.color = "black"; + } + + if (document.getElementById("affectation")) { + document.getElementById("affectation").style.backgroundColor = "#d8edfc"; + document.getElementById("affectation").style.color = "black"; + } + + if (document.getElementById("detail_employe")) { + document.getElementById("detail_employe").style.backgroundColor = "#d8edfc"; + document.getElementById("detail_employe").style.color = "black"; + } + + if (document.getElementById("droit_acces")) { + document.getElementById("droit_acces").style.backgroundColor = "#d8edfc"; + document.getElementById("droit_acces").style.color = "black"; + } + + + if (document.getElementById("competence")) { + document.getElementById("competence").style.backgroundColor = "#d8edfc"; + document.getElementById("competence").style.color = "black"; + } + + + if (document.getElementById("piece_jointe")) { + document.getElementById("piece_jointe").style.backgroundColor = "#d8edfc"; + document.getElementById("piece_jointe").style.color = "black"; + } + + Getall_Employee_Statistic_Question_List(); + } @@ -3289,6 +3379,14 @@ const Employes = (props) => { document.getElementById("evaluation").style.color = "black"; } + + if (document.getElementById("statistiques")) { + document.getElementById("statistiques").style.backgroundColor = "#d8edfc"; + document.getElementById("statistiques").style.color = "black"; + } + + + setSelectionModel_affectations([]); setdisplay_affectation("0"); setAdd_new_affectation(""); @@ -3332,6 +3430,13 @@ const Employes = (props) => { document.getElementById("droit_acces").style.color = "black"; } + + if (document.getElementById("statistiques")) { + document.getElementById("statistiques").style.backgroundColor = "#d8edfc"; + document.getElementById("statistiques").style.color = "black"; + } + + Getall_Partner_Competence_List(); } @@ -3376,6 +3481,11 @@ const Employes = (props) => { document.getElementById("evaluation").style.color = "black"; } + if (document.getElementById("statistiques")) { + document.getElementById("statistiques").style.backgroundColor = "#d8edfc"; + document.getElementById("statistiques").style.color = "black"; + } + } @@ -3510,6 +3620,87 @@ const Employes = (props) => { }) } + + + const [New_Getall_Employee_Statistic_Question_List_result, setNew_Getall_Employee_Statistic_Question_List_result] = useState([]); + + const [Getall_Employee_Statistic_Question_List_api, setGetall_Employee_Statistic_Question_List_api] = useState(); + const [Getall_Employee_Statistic_Question_List_message, setGetall_Employee_Statistic_Question_List_message] = useState(); + const [Getall_Employee_Statistic_Question_List_result, setGetall_Employee_Statistic_Question_List_result] = useState([]); + function Getall_Employee_Statistic_Question_List(event) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("related_collection", "ressource_humaine"); + form.append("related_collection_id", selected_id); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Entity_Question_List_With_Stat_For_Given_related_collection_id/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + setLoading(false); + + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Employee_Statistic_Question_List res.data.status = " + res.data.status); + //console.log(" In Getall_Employee_Statistic_Question_List res.data.message r_class = " + res.data.message); + setGetall_Employee_Statistic_Question_List_api("true"); + setGetall_Employee_Statistic_Question_List_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).question_id; + var local_question_id = JSON.parse(x).question_id; + var local_question_question = JSON.parse(x).question_question; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "question_id": local_question_id, + "label": local_question_question, + "question_question": local_question_question, + }; + new_data2.push(node); + }); + + //--- + var node = { + "_id": "", + "id": "", + "question_id": "", + "label": "", + "question_question": "", + }; + + new_data2.push(node); + + + if (new_data2.length > 0) + setNew_Getall_Employee_Statistic_Question_List_result(new_data2); + + } + else { + setGetall_Employee_Statistic_Question_List_api("false"); + setGetall_Employee_Statistic_Question_List_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Getall_Employee_Statistic_Question_List = ', error); + setGetall_Employee_Statistic_Question_List_api("false"); + alert(" Impossible de recuperer la liste des questions "); + //setmyApimyApiMessage("") + }) + } + const New_Option_Oui_Non = [ { value: '1', @@ -5414,6 +5605,128 @@ const Employes = (props) => { }) } + const [Dialog_1_open_statistique, setDialog_1_open_statistique] = React.useState(false); + const [Dialog_1_message_statistique, setDialog_1_message_statistique] = React.useState("Gestion Statistique"); + + const Dialog_1_handleClose_buton_statistique = () => { + setDialog_1_open_statistique(false); + + }; + + const [selected_statistic_question_id, setselected_statistic_question_id] = 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')); + + + const [Getall_Qry_Survey_Data_result_JSON, setGetall_Qry_Survey_Data_result_JSON] = useState([]); + const [Getall_Qry_Survey_Data_api, setGetall_Qry_Survey_Data_api] = useState(); + const [Getall_Qry_Survey_Data_message, setGetall_Qry_Survey_Data_message] = useState(); + const [Getall_Qry_Survey_Data_result, setGetall_Qry_Survey_Data_result] = useState([]); + function Getall_Qry_Survey_Data(event) { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + + var date_from = ""; + if (p_filter_date_from) { + date_from = p_filter_date_from; + + } + + var date_to = ""; + if (p_filter_date_to) { + date_to = p_filter_date_to; + + } + + + form.append("token", stored_cookie); + form.append("periode_start_date", date_from); + form.append("periode_end_date", date_to); + form.append("related_collection", "ressource_humaine"); + form.append("related_collection_id", selected_id); + form.append("question_id", selected_statistic_question_id); + + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + setLoading(false); + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Qry_Survey_Data res.data.status = " + res.data.status); + //console.log(" In Getall_Qry_Survey_Data res.data.message r_class = " + res.data.message); + + var jsonObj = JSON.parse('[' + res.data.message + ']'); + + var jsonObj0 = jsonObj[0] + + var new_data2 = []; + const new_data = jsonObj0.map((x) => { + var month_year = (x).month_year; + var label = (x).label; + var value = (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, + "count": count, + "nb_question_response": parseInt(String(nb_question_response)), + "somme_question_response": parseFloat(String(somme_question_response)), + "moyenne_question_response": parseFloat(String(moyenne_question_response)), + + }; + new_data2.push(node); + }); + + setGetall_Qry_Survey_Data_result_JSON(new_data2); + //setGetall_Qry_Survey_Data_result_JSON(JSON.parse('[' + res.data.message + ']')); + + + + setGetall_Qry_Survey_Data_api("true"); + setGetall_Qry_Survey_Data_result(res.data.message); + + + } + else { + setGetall_Qry_Survey_Data_api("false"); + setGetall_Qry_Survey_Data_message(res.data.message); + alert(res.data.message) + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Getall_Qry_Survey_Data = ', error); + setGetall_Qry_Survey_Data_api("false"); + alert("Impossible de récuperer les données demandées") + //setmyApimyApiMessage("") + }) + } + + + + const otherSetting = { + height: 300, + yAxis: [{ label: 'rainfall (mm)' }], + grid: { horizontal: true }, + sx: { + [`& .${axisClasses.left} .${axisClasses.label}`]: { + transform: 'translateX(-10px)', + }, + }, + }; + + + const valueFormatter = (value) => `${value}`; return (
@@ -5422,6 +5735,192 @@ const Employes = (props) => {
} + {/*** GESTION STATISTIQUE */} + + + MySy Information + + + +
Choisir une question + + {New_Getall_Employee_Statistic_Question_List_result && New_Getall_Employee_Statistic_Question_List_result.length > 0 && + + (data)._id === String(selected_statistic_question_id))[0].label} + + onChange={(event, value) => { + + if (value && value._id) { + setselected_statistic_question_id(value.question_id); + } else { + setselected_statistic_question_id(""); + } + }} + + renderInput={(params) => + } + />} + + + {selected_statistic_question_id && String(selected_statistic_question_id) !== "d" &&
+
+ Date Debut + { + setp_filter_date_from(format(date, 'dd/MM/yyyy')); + + } + } + showTimeSelect={false} + dateFormat="dd/MM/yyyy" + className="disabled_style session_caract_Dialog_DatePicker" + locale='fr-FR' + + /> + +
+ +
+ Date Fin + { + setp_filter_date_to(format(date, 'dd/MM/yyyy')); + + } + } + showTimeSelect={false} + dateFormat="dd/MM/yyyy" + className="disabled_style session_caract_Dialog_DatePicker" + /> + +
+ +
+ + +
} + + +
+ +
+ + +   + +
+ + {Getall_Qry_Survey_Data_result_JSON && Getall_Qry_Survey_Data_result_JSON.length > 0 && + Getall_Qry_Survey_Data_result_JSON && + + context.location === 'tick' + ? `${month.slice(0, 2)}` + "\n" + `${month.slice(3, 7)}` + : `${month}`, + }]} + 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 }, + + + ]} + {...otherSetting} + margin={{ right: 15, left: 100 }} + + />} +
+ +
+ +
+
+ +
+ + +   + +
+ + {Getall_Qry_Survey_Data_result_JSON && Getall_Qry_Survey_Data_result_JSON.length > 0 && + Getall_Qry_Survey_Data_result_JSON && + + + + context.location === 'tick' + ? `${month.slice(0, 2)}` + " \n" + `${month.slice(3, 7)}` + : `${month}`, + }]} + 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()), }, + ]} + + margin={{ right: 15, left: 100 }} + /> + + + + } +
+ +
+ +
+
+ +
+ + + +
+ {String(selected_statistic_question_id) !== "" &&
} + +
+ +
+
+ +
+ + +
+ + {/*** FIN GESTION STATISTIQUE */} + + {/*** GESTION COMPETENCES */} { - +
@@ -9537,7 +10036,7 @@ const Employes = (props) => { } - {String(submenu) === "competence" &&
+ {String(submenu) === "competence" &&
@@ -9627,6 +10126,8 @@ const Employes = (props) => {
+ +
Evaluation par les apprenants
Evaluation
@@ -9761,9 +10262,185 @@ const Employes = (props) => {
} + {String(submenu) === "statistiques" &&
+
+ + + + + + + + +
+ + + +
+ Choisir une question + {New_Getall_Employee_Statistic_Question_List_result && New_Getall_Employee_Statistic_Question_List_result.length > 0 && + + (data)._id === String(selected_statistic_question_id))[0].label} + + onChange={(event, value) => { + + if (value && value._id) { + setselected_statistic_question_id(value.question_id); + } else { + setselected_statistic_question_id(""); + } + }} + + renderInput={(params) => + } + />} + + {selected_statistic_question_id && String(selected_statistic_question_id) !== "d" &&
+
+ Date Debut + { + setp_filter_date_from(format(date, 'dd/MM/yyyy')); + + } + } + showTimeSelect={false} + dateFormat="dd/MM/yyyy" + className="disabled_style session_caract_Dialog_DatePicker" + locale='fr-FR' + + /> + +
+ +
+ Date Fin + { + setp_filter_date_to(format(date, 'dd/MM/yyyy')); + + } + } + showTimeSelect={false} + dateFormat="dd/MM/yyyy" + className="disabled_style session_caract_Dialog_DatePicker" + /> + +
+ +
+ + +
} +
+
+ {String(selected_statistic_question_id) !== "" &&
} + +
+ +
+
+ +
+ + +   + +
+ + {Getall_Qry_Survey_Data_result_JSON && Getall_Qry_Survey_Data_result_JSON.length > 0 && + Getall_Qry_Survey_Data_result_JSON && + + context.location === 'tick' + ? `${month.slice(0, 2)}` + "\n" + `${month.slice(3, 7)}` + : `${month}`, + }]} + 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 }, + + + ]} + {...otherSetting} + margin={{ right: 15, left: 100 }} + + />} +
+ +
+ +
+
+ + +
+ + +   + +
+ + {Getall_Qry_Survey_Data_result_JSON && Getall_Qry_Survey_Data_result_JSON.length > 0 && + Getall_Qry_Survey_Data_result_JSON && + + + + context.location === 'tick' + ? `${month.slice(0, 2)}` + " \n" + `${month.slice(3, 7)}` + : `${month}`, + }]} + 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()), }, + ]} + + margin={{ right: 15, left: 100 }} + /> + + + + } +
+ +
+ +
+
+ +
}
+ ); }