13/08/23 - 21h30

recette2
cherif 2023-08-13 21:43:34 +02:00
parent 581bac5874
commit b43fcf3f8c
2 changed files with 162 additions and 85 deletions

View File

@ -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,30 +443,25 @@ 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,8 +470,9 @@ 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") {
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 (
<div className="displaypartnersession">
<h2> Les sessions de formation </h2>
<h3> Vos sessions de formation </h3>
<div className="titre1"> Utilisez les filtres !</div>
<div className="div_row">
<div className="div_row_gauche">
<Select options={filters} onChange={selectedFilter1} />
</div>
<div className="div_row_droite">
{!!selectedfilt1 &&
<div className="div_row">
<div className="div_row" style={{"marginBottom":"5px"}}>
<div className="div_row_gauche texte_area_filter" >
<TextField
name="filtre1"
defaultValue=""
variant="filled"
size="small"
style={{ "width": "100%" }}
placeholder="Entrez une valeur"
/>
&nbsp; <img src={tick_ko} alt="OK" className="tick_ok_ko" onClick={Clearselectedfilt1} />
label="Choisir un champ"
select
sx={{ m: 1, width: '100%' }}
value={p_filtre1}
onChange={(e) => {
setp_filtre1(e.target.value)
}}
>
<MenuItem value="code_session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Code Session &nbsp;&nbsp;</MenuItem>
<MenuItem value="class_title" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Titre Formation &nbsp;</MenuItem>
</TextField>
</div>
}
<div className="div_row_droite texte_area_filter" >
{!!p_filtre1 &&
<TextField
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
required
name="filtre1_value"
id="filtre1_value"
InputLabelProps={{
shrink: true,
}}
disabled={false}
className="disabled_style"
value={p_filtre1_value}
onChange={(e) => {setp_filtre1_value(e.target.value); }}
InputProps={{
endAdornment: (
<InputAdornment position="end">
<AiFillCloseCircle
style={{ 'cursor': "pointer", "color": "orangered" }}
onClick={(e) => {
setp_filtre1();
setp_filtre1_value();
}} />
</InputAdornment>
),
}}
/>}
</div>
</div>
{!!selectedfilt1 &&
<div className="div_row">
<div className="div_row_gauche">
<Select options={filters} onChange={selectedFilter2} />
</div>
<div className="div_row_droite">
{!!selectedfilt2 &&
<div>
{!!p_filtre1_value &&
<div className="div_row" style={{"marginBottom":"5px"}}>
<div className="div_row_gauche texte_area_filter">
<TextField
name="filtre2"
defaultValue=""
variant="filled"
size="small"
className='myTextField'
placeholder="Entrez une valeur"
/> &nbsp; <img src={tick_ko} alt="OK" className="tick_ok_ko" onClick={CancelFiltre2} />
label="Choisir un champ"
select
sx={{ m: 1, width: '100%' }}
options={filters}
value={p_filtre2}
onChange={(e) => {
setp_filtre2(e.target.value)
}}
>
<MenuItem value="code_session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Code Session &nbsp;&nbsp;</MenuItem>
<MenuItem value="class_title" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Titre Formation &nbsp;</MenuItem>
</TextField>
</div>
}
</div>
</div>
}
{!!selectedfilt2 &&
<div className="div_row">
<div className="div_row_gauche">
<Select options={filters} onChange={selectedFilter3} />
</div>
<div className="div_row_droite">
{!!selectedfilt3 &&
<div>
<div className="div_row_droite texte_area_filter" >
{!!p_filtre1 &&
<TextField
name="filtre3"
defaultValue=""
variant="filled"
size="small"
className='myTextField'
placeholder="Entrez une valeur"
/>&nbsp; <img src={tick_ko} alt="OK" className="tick_ok_ko" onClick={CancelFiltre3} />
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
required
name="filtre2_value"
id="filtre2_value"
InputLabelProps={{
shrink: true,
}}
disabled={false}
className="disabled_style"
value={p_filtre2_value}
onChange={(e) => setp_filtre2_value(e.target.value)}
InputProps={{
endAdornment: (
<InputAdornment position="end">
<AiFillCloseCircle
style={{ 'cursor': "pointer", "color": "orangered" }}
onClick={(e) => {
setp_filtre2();
setp_filtre2_value();
}} />
</InputAdornment>
),
}}
/>}
</div>
</div>
}
{<div className="div_row" style={{ "border": "None", "color": "orange", "textAlign": "center" }}>
<div className="div_row_gauche" style={{ "textAlign": 'left', 'marginLeft': '15px' }}>
<Button variant="contained" className="bton_enreg" onClick={Getall_TrainingSession}>Rechercher
</Button>
</div>
<div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }}>
<Button variant="contained" className="bton_annule" onClick={clean_all_filters}>Annuler
</Button>
</div>
}
<div className="div_row">
<Button onClick={Getall_TrainingSession} className="bton_envoyer">Rechercher </Button>
</div>
</div>}
<br />
<div style={{ "textAlign": "left", "float": "left", "width": "100%" }} id="participant_menu_tab">

View File

@ -1699,6 +1699,27 @@
padding-top: 4px;
}
.texte_area {
float: left;
width: 47% !important;
font-size: x-small !important;
font-family: "verdana", "Quicksand", "Signika", sans-serif;
margin: 0.4rem !important;
margin-top: 0px !important;
margin-bottom: 1.5rem !important;
}
.texte_area_filter {
float: left;
width: 47% !important;
font-size: x-small !important;
font-family: "verdana", "Quicksand", "Signika", sans-serif;
margin: 0.4rem !important;
margin-top: 0px !important;
margin-bottom: 2px !important;
}
}