14/08/23 - 16h30
parent
9cd828ce3b
commit
9f1e13e4ff
|
@ -7,7 +7,7 @@ import Button from '@mui/material/Button';
|
|||
import Select from 'react-select'
|
||||
import { getCookie } from 'react-use-cookie';
|
||||
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
|
||||
import Footer from "./Fotter";
|
||||
import Footer from "./Fotter";
|
||||
import tick_ko from "../mysy_img/tick_KO.png";
|
||||
import Popup from 'reactjs-popup';
|
||||
import 'reactjs-popup/dist/index.css';
|
||||
|
@ -20,6 +20,8 @@ import { CiCoffeeBean, CiDesktop, CiFileOff } from "react-icons/ci";
|
|||
import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
|
||||
|
||||
import { LuScreenShare, LuScreenShareOff } from "react-icons/lu";
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
import InputAdornment from '@mui/material/InputAdornment';
|
||||
|
||||
const DistplayPartnerTraningsPage = (props) => {
|
||||
|
||||
|
@ -121,9 +123,9 @@ const DistplayPartnerTraningsPage = (props) => {
|
|||
var form = new FormData();
|
||||
|
||||
// Recuperation des parametres
|
||||
var filtre1 = selectedfilt1;
|
||||
var filtre2 = selectedfilt2;
|
||||
var filtre3 = selectedfilt3;
|
||||
var filtre1 = p_filtre1;
|
||||
var filtre2 = p_filtre2;
|
||||
var filtre3 = p_filtre3;
|
||||
|
||||
var filtre1_value = "";
|
||||
var filtre2_value = "";
|
||||
|
@ -131,18 +133,18 @@ const DistplayPartnerTraningsPage = (props) => {
|
|||
|
||||
// Recuperation des valeurs de filtres
|
||||
|
||||
if (selectedfilt1) {
|
||||
filtre1_value = document.getElementsByName("filtre1")[0].value;
|
||||
if (p_filtre1_value) {
|
||||
filtre1_value = p_filtre1_value;
|
||||
form.append(filtre1, filtre1_value);
|
||||
}
|
||||
|
||||
if (selectedfilt2) {
|
||||
filtre2_value = document.getElementsByName("filtre2")[0].value;
|
||||
if (p_filtre2_value) {
|
||||
filtre2_value = p_filtre2_value;
|
||||
form.append(filtre2, filtre2_value);
|
||||
}
|
||||
|
||||
if (selectedfilt3) {
|
||||
filtre3_value = document.getElementsByName("filtre3")[0].value;
|
||||
if (p_filtre3_value) {
|
||||
filtre3_value = p_filtre3_value;
|
||||
form.append(filtre3, filtre3_value);
|
||||
}
|
||||
|
||||
|
@ -156,7 +158,43 @@ const DistplayPartnerTraningsPage = (props) => {
|
|||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/find_partner_class_like/";
|
||||
|
||||
//alert(" laaa");
|
||||
fetch(myurl,
|
||||
{
|
||||
method: 'POST',
|
||||
body: form,
|
||||
})
|
||||
.then((data) => data.json())
|
||||
.then((data) => {
|
||||
//console.log('Success:', data['message'], "data['status'] = ", data['status']);
|
||||
setTableData(data['message']);
|
||||
setRows(data['message']);
|
||||
if (String(data['status']) === String("false")) {
|
||||
//console.log("erreur rrrr:" + data['status'])
|
||||
setmyApiResponse("False");
|
||||
|
||||
}
|
||||
else {
|
||||
setmyApiResponse("True");
|
||||
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.error('Error:', error);
|
||||
setmyApiResponse("false");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function GetAllClass_new_no_filter(event) {
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
|
||||
//form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
form.append("token", stored_cookie);
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/find_partner_class_like/";
|
||||
fetch(myurl,
|
||||
{
|
||||
method: 'POST',
|
||||
|
@ -715,6 +753,28 @@ const DistplayPartnerTraningsPage = (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();
|
||||
|
||||
const [p_filtre3, setp_filtre3] = useState();
|
||||
const [p_filtre3_value, setp_filtre3_value] = useState();
|
||||
|
||||
function clean_all_filters() {
|
||||
setp_filtre1();
|
||||
setp_filtre1_value();
|
||||
setp_filtre2();
|
||||
setp_filtre2_value();
|
||||
|
||||
setp_filtre3();
|
||||
setp_filtre3_value();
|
||||
|
||||
GetAllClass_new_no_filter();
|
||||
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
|
||||
|
@ -740,101 +800,190 @@ const DistplayPartnerTraningsPage = (props) => {
|
|||
</div>
|
||||
}
|
||||
|
||||
<div className="titre1"> Utilisez les filtres !</div>
|
||||
<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)
|
||||
}}
|
||||
>
|
||||
<MenuItem value="external_code" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Code externe formation </MenuItem>
|
||||
<MenuItem value="title" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Titre Formation </MenuItem>
|
||||
<MenuItem value="certif" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Certifiée </MenuItem>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
</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"
|
||||
|
||||
<div className="titre1"> Utilisez les filtres !</div>
|
||||
|
||||
<div className="parter_div_filtrer_row">
|
||||
|
||||
<div className="parter_div_filtrer_row_gauche">
|
||||
<Select options={filters} onChange={selectedFilter1} />
|
||||
</div>
|
||||
<div className="parter_div_filtrer_row_droite">
|
||||
{!!selectedfilt1 &&
|
||||
|
||||
<div> <TextField
|
||||
name="filtre1"
|
||||
defaultValue=""
|
||||
variant="filled"
|
||||
size="small"
|
||||
className='myTextField'
|
||||
placeholder="Entrez une valeur"
|
||||
/> <img src={tick_ko} alt="OK" className="tick_ok_ko" onClick={Clearselectedfilt1} />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!!selectedfilt1 &&
|
||||
<div className="parter_div_filtrer_row">
|
||||
|
||||
<div className="parter_div_filtrer_row_gauche">
|
||||
<Select options={filters} onChange={selectedFilter2} />
|
||||
</div>
|
||||
<div className="parter_div_filtrer_row_droite">
|
||||
{!!selectedfilt2 &&
|
||||
<div>
|
||||
<TextField
|
||||
name="filtre2"
|
||||
defaultValue=""
|
||||
variant="filled"
|
||||
size="small"
|
||||
className='myTextField'
|
||||
placeholder="Entrez une valeur"
|
||||
/> <img src={tick_ko} alt="OK" className="tick_ok_ko" onClick={CancelFiltre2} />
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
{!!selectedfilt2 &&
|
||||
<div className="parter_div_filtrer_row">
|
||||
|
||||
<div className="parter_div_filtrer_row_gauche">
|
||||
<Select options={filters} onChange={selectedFilter3} />
|
||||
</div>
|
||||
<div className="parter_div_filtrer_row_droite">
|
||||
{!!selectedfilt3 &&
|
||||
<div>
|
||||
<TextField
|
||||
name="filtre3"
|
||||
defaultValue=""
|
||||
variant="filled"
|
||||
size="small"
|
||||
className='myTextField'
|
||||
placeholder="Entrez une valeur"
|
||||
/> <img src={tick_ko} alt="OK" className="tick_ok_ko" onClick={CancelFiltre3} />
|
||||
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
<div className="parter_div_filtrer_row">
|
||||
<Button variant="contained" onClick={GetAllClass_new} className="bton_rechercher">Rechercher </Button>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
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>
|
||||
|
||||
|
||||
{myApiResponse === "False" && <div className='koUpdateData'>
|
||||
</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="external_code" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Code externe formation </MenuItem>
|
||||
<MenuItem value="title" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Titre Formation </MenuItem>
|
||||
<MenuItem value="certif" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Certifiée </MenuItem>
|
||||
|
||||
</TextField>
|
||||
</div>
|
||||
<div className="div_row_droite texte_area_filter" >
|
||||
{!!p_filtre1 &&
|
||||
<TextField
|
||||
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>
|
||||
}
|
||||
|
||||
{!!p_filtre2_value &&
|
||||
<div className="div_row" style={{ "marginBottom": "5px" }}>
|
||||
<div className="div_row_gauche texte_area_filter">
|
||||
<TextField
|
||||
name="filtre3"
|
||||
label="Choisir un champ"
|
||||
select
|
||||
sx={{ m: 1, width: '100%' }}
|
||||
options={filters}
|
||||
value={p_filtre3}
|
||||
onChange={(e) => {
|
||||
setp_filtre3(e.target.value)
|
||||
}}
|
||||
>
|
||||
|
||||
<MenuItem value="external_code" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Code externe formation </MenuItem>
|
||||
<MenuItem value="title" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Titre Formation </MenuItem>
|
||||
<MenuItem value="certif" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Certifiée </MenuItem>
|
||||
|
||||
</TextField>
|
||||
</div>
|
||||
<div className="div_row_droite texte_area_filter" >
|
||||
{!!p_filtre2 &&
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
required
|
||||
name="filtre3_value"
|
||||
id="filtre3_value"
|
||||
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
disabled={false}
|
||||
className="disabled_style"
|
||||
value={p_filtre3_value}
|
||||
onChange={(e) => setp_filtre3_value(e.target.value)}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
<AiFillCloseCircle
|
||||
style={{ 'cursor': "pointer", "color": "orangered" }}
|
||||
onClick={(e) => {
|
||||
setp_filtre3();
|
||||
setp_filtre3_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={GetAllClass_new}>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>}
|
||||
|
||||
<div className="div_row"> </div>
|
||||
<div>
|
||||
{String(myApiResponse) === "False" && <div className='koUpdateData'>
|
||||
Impossible de traiter la demande
|
||||
</div>}
|
||||
{myApiResponse === "True" &&
|
||||
{String(myApiResponse) === "True" &&
|
||||
<div style={{ height: 700, width: '100%' }}>
|
||||
<DataGrid
|
||||
checkboxSelection
|
||||
|
|
Loading…
Reference in New Issue