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 moment from "moment";
import Select from 'react-select' import Select from 'react-select'
import tick_ko from "../mysy_img/tick_KO.png"; 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 DisplayPartnerSession = (props) => {
const history = useHistory(); const history = useHistory();
@ -438,31 +443,26 @@ const DisplayPartnerSession = (props) => {
// Recuperation des parametres // Recuperation des parametres
var filtre1 = selectedfilt1; var filtre1 = p_filtre1;
var filtre2 = selectedfilt2; var filtre2 = p_filtre2;
var filtre3 = selectedfilt3;
var filtre1_value = ""; var filtre1_value = "";
var filtre2_value = ""; var filtre2_value = "";
var filtre3_value = ""; var filtre3_value = "";
// Recuperation des valeurs de filtres // Recuperation des valeurs de filtres
if (selectedfilt1) { if (filtre1) {
filtre1_value = document.getElementsByName("filtre1")[0].value; filtre1_value = p_filtre1_value;
form.append(filtre1, filtre1_value); form.append(filtre1, filtre1_value);
} }
if (selectedfilt2) { if (filtre2) {
filtre2_value = document.getElementsByName("filtre2")[0].value; filtre2_value = p_filtre2_value;
form.append(filtre2, 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'); const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie); form.append("token", stored_cookie);
@ -470,9 +470,10 @@ const DisplayPartnerSession = (props) => {
// Verification s'il faut faire une recherche avec une option like. // 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/"; 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'); const stored_cookie = getCookie('tokenmysypart');
formData.append("token", stored_cookie); formData.append("token", stored_cookie);
formData.append("class_internal_url", selected_internal_url);
//console.log("token = " + stored_cookie); //console.log("token = " + stored_cookie);
fetch( 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', method: 'POST',
body: formData, body: formData,
@ -831,6 +831,7 @@ const DisplayPartnerSession = (props) => {
setliste_sessions_file_change_api("true"); setliste_sessions_file_change_api("true");
GetCurrentClass_trainingsession(); GetCurrentClass_trainingsession();
//clearSessionFields(); //clearSessionFields();
Getall_TrainingSession();
alert(" Les sessions ont été correctement importées"); 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 ( return (
<div className="displaypartnersession"> <div className="displaypartnersession">
<h2> Les sessions de formation </h2> <h3> Vos sessions de formation </h3>
<div className="titre1"> Utilisez les filtres !</div> <div className="titre1"> Utilisez les filtres !</div>
<div className="div_row"> <div className="div_row" style={{"marginBottom":"5px"}}>
<div className="div_row_gauche texte_area_filter" >
<TextField
name="filtre1"
label="Choisir un champ"
select
sx={{ m: 1, width: '100%' }}
value={p_filtre1}
onChange={(e) => {
setp_filtre1(e.target.value)
}}
>
<div className="div_row_gauche"> <MenuItem value="code_session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Code Session &nbsp;&nbsp;</MenuItem>
<Select options={filters} onChange={selectedFilter1} /> <MenuItem value="class_title" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Titre Formation &nbsp;</MenuItem>
</TextField>
</div> </div>
<div className="div_row_droite"> <div className="div_row_droite texte_area_filter" >
{!!selectedfilt1 && {!!p_filtre1 &&
<TextField
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
required
name="filtre1_value"
id="filtre1_value"
<div className="div_row"> 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>
{!!p_filtre1_value &&
<div className="div_row" style={{"marginBottom":"5px"}}>
<div className="div_row_gauche texte_area_filter">
<TextField
name="filtre2"
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 className="div_row_droite texte_area_filter" >
{!!p_filtre1 &&
<TextField <TextField
name="filtre1" sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
defaultValue="" required
variant="filled" name="filtre2_value"
size="small" id="filtre2_value"
style={{ "width": "100%" }}
placeholder="Entrez une valeur"
/>
&nbsp; <img src={tick_ko} alt="OK" className="tick_ok_ko" onClick={Clearselectedfilt1} />
</div>
}
</div>
</div>
{!!selectedfilt1 && InputLabelProps={{
<div className="div_row"> 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 className="div_row_gauche"> />}
<Select options={filters} onChange={selectedFilter2} />
</div> </div>
<div className="div_row_droite">
{!!selectedfilt2 &&
<div>
<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} />
</div>
}
</div>
</div> </div>
} }
{<div className="div_row" style={{ "border": "None", "color": "orange", "textAlign": "center" }}>
{!!selectedfilt2 && <div className="div_row_gauche" style={{ "textAlign": 'left', 'marginLeft': '15px' }}>
<div className="div_row"> <Button variant="contained" className="bton_enreg" onClick={Getall_TrainingSession}>Rechercher
</Button>
<div className="div_row_gauche"> </div>
<Select options={filters} onChange={selectedFilter3} />
</div>
<div className="div_row_droite">
{!!selectedfilt3 &&
<div>
<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} />
</div>
}
</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>
}
<div className="div_row"> </div>}
<Button onClick={Getall_TrainingSession} className="bton_envoyer">Rechercher </Button>
</div>
<br /> <br />
<div style={{ "textAlign": "left", "float": "left", "width": "100%" }} id="participant_menu_tab"> <div style={{ "textAlign": "left", "float": "left", "width": "100%" }} id="participant_menu_tab">

View File

@ -1697,7 +1697,28 @@
max-width: 3%; max-width: 3%;
cursor: pointer; cursor: pointer;
padding-top: 4px; 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;
}
} }