diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index 920c9e4..c16b457 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -49,6 +49,11 @@ import { format } from 'date-fns' import moment from "moment"; import Select from 'react-select' import tick_ko from "../mysy_img/tick_KO.png"; +import InputAdornment from '@mui/material/InputAdornment'; +import { AiFillCloseCircle } from "react-icons/ai"; +import Visibility from '@mui/icons-material/Visibility'; +import VisibilityOff from '@mui/icons-material/VisibilityOff'; +import IconButton from '@mui/material/IconButton'; const DisplayPartnerSession = (props) => { const history = useHistory(); @@ -438,31 +443,26 @@ const DisplayPartnerSession = (props) => { // Recuperation des parametres - var filtre1 = selectedfilt1; - var filtre2 = selectedfilt2; - var filtre3 = selectedfilt3; + var filtre1 = p_filtre1; + var filtre2 = p_filtre2; + var filtre1_value = ""; var filtre2_value = ""; var filtre3_value = ""; // Recuperation des valeurs de filtres - if (selectedfilt1) { - filtre1_value = document.getElementsByName("filtre1")[0].value; + if (filtre1) { + filtre1_value = p_filtre1_value; form.append(filtre1, filtre1_value); } - if (selectedfilt2) { - filtre2_value = document.getElementsByName("filtre2")[0].value; + if (filtre2) { + filtre2_value = p_filtre2_value; form.append(filtre2, filtre2_value); } - if (selectedfilt3) { - filtre3_value = document.getElementsByName("filtre3")[0].value; - form.append(filtre3, filtre3_value); - } - - + const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); @@ -470,9 +470,10 @@ const DisplayPartnerSession = (props) => { // Verification s'il faut faire une recherche avec une option like. + //console.log(" p_filtre1 = ", p_filtre1, " filtre1_value = ", filtre1_value); - if (filtre1 && String(filtre1).length > "1") { - myurl = process.env.REACT_APP_API_URL + "myclass/api/GetAllValideSessionPartner_List_filter_like/"; + if (filtre1 && String(filtre1_value) !== "") { + myurl = process.env.REACT_APP_API_URL + "myclass/api/GetAllValideSessionPartner_List_filter_like/"; } @@ -806,11 +807,10 @@ const DisplayPartnerSession = (props) => { const stored_cookie = getCookie('tokenmysypart'); formData.append("token", stored_cookie); - formData.append("class_internal_url", selected_internal_url); //console.log("token = " + stored_cookie); fetch( - process.env.REACT_APP_API_URL + "myclass/api/Add_Update_SessionFormation_mass/", + process.env.REACT_APP_API_URL + "myclass/api/Add_Update_SessionFormation_mass_for_many_class/", { method: 'POST', body: formData, @@ -831,6 +831,7 @@ const DisplayPartnerSession = (props) => { setliste_sessions_file_change_api("true"); GetCurrentClass_trainingsession(); //clearSessionFields(); + Getall_TrainingSession(); alert(" Les sessions ont été correctement importées"); } @@ -3350,90 +3351,145 @@ const DisplayPartnerSession = (props) => { } + const [p_filtre1, setp_filtre1] = useState(); + const [p_filtre1_value, setp_filtre1_value] = useState(); + + const [p_filtre2, setp_filtre2] = useState(); + const [p_filtre2_value, setp_filtre2_value] = useState(); + + function clean_all_filters(){ + setp_filtre1(); + setp_filtre1_value(); + setp_filtre2(); + setp_filtre2_value(); + + Getall_TrainingSession(); + + } + return (