import React, { useRef, useState, useEffect } from "react";
import TextField from '@mui/material/TextField';
import MenuItem from '@mui/material/MenuItem';
import 'react-confirm-alert/src/react-confirm-alert.css'; // Import css
import Button from '@mui/material/Button';
import axios from "axios";
import { getCookie, setCookie } from 'react-use-cookie';
import { useHistory } from "react-router-dom";
import { DataGrid, frFR } from '@mui/x-data-grid';
import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
import 'react-tooltip/dist/react-tooltip.css'
import { Tooltip } from 'react-tooltip'
import fileDownload from 'js-file-download';
import Popup from 'reactjs-popup';
import 'reactjs-popup/dist/index.css';
import {  FcAcceptDatabase} from "react-icons/fc";
import "react-datepicker/dist/react-datepicker.css";
import InputAdornment from '@mui/material/InputAdornment';
import { AiFillCloseCircle } from "react-icons/ai";
import Box from '@mui/material/Box';
import { CiTrash } from "react-icons/ci";
import { MdAddCircleOutline, MdRemoveCircleOutline } from "react-icons/md";
import Dialog from '@mui/material/Dialog';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogContentText from '@mui/material/DialogContentText';
import DialogTitle from '@mui/material/DialogTitle';
import { Fab } from "@material-ui/core";
import { IoMdAddCircle, IoIosRemoveCircleOutline } from "react-icons/io";
import { AiTwotoneSave } from "react-icons/ai";
import Autocomplete from '@mui/material/Autocomplete';
import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
import { gridClasses } from '@mui/x-data-grid';
import Link from '@mui/material/Link';
import { PiDotsThree } from "react-icons/pi";
import { IoAddCircleOutline, IoCloseCircleOutline } from "react-icons/io5";
import AttachFileIcon from '@mui/icons-material/AttachFile';
import Module_Alert_Confirmation from "./Module_Alert_Confirmation";
import Module_Historique_Action from "./Module_Historique_Action";
import { makeStyles } from "@material-ui/core/styles";
import CancelPresentationIcon from '@mui/icons-material/CancelPresentation';
import { IconButton } from '@material-ui/core';
import Paper from '@material-ui/core/Paper';
import Draggable from 'react-draggable';
import {
    GridToolbarContainer, GridToolbarExport, GridToolbarColumnsButton,
    GridToolbarFilterButton, GridToolbarDensitySelector, GridToolbarExportContainer, useGridApiContext,
    gridFilteredSortedRowIdsSelector,
    gridVisibleColumnFieldsSelector,


} from '@mui/x-data-grid';
import * as XLSX from 'xlsx';


function PaperComponent(props) {
    return (
        <Draggable
            handle="#draggable-dialog-title"
            cancel={'[class*="MuiDialogContent-root"]'}
        >
            <Paper {...props} />
        </Draggable>
    );
}


const useStyles = makeStyles((theme) => ({

    dialog: {
        position: 'absolute',
        // left: 10,
        top: 400
    },

    paper: {
        overflowY: 'unset',
    },
    customizedButton: {
        position: 'absolute',
        left: '95%',
        top: '-9%',
        backgroundColor: 'lightgray',
        color: 'gray',
    },
}));


const Equipe_Team = (props) => {

    const classes = useStyles();
    const history = useHistory();
    const [submenu, setsubmenu] = useState("");
    const [rowss, setRows] = useState([]);
    const [selectionModel, setSelectionModel] = React.useState([]);
    const [isLoading, setLoading] = useState();

    var date_today_90j = new Date();
    date_today_90j.setDate(date_today_90j.getDate() + 90);


    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("");

    const [p_filtre4, setp_filtre4] = useState("");
    const [p_filtre4_value, setp_filtre4_value] = useState("");

    const [selected_id, setselected_id] = React.useState("");
    const [gridline_id, setgridline_id] = useState("");

    function ExpandableCell_50({ value }) {
        const [expanded, setExpanded] = React.useState(false);

        return (
            <nav>
                {value && <div style={{ paddingLeft: "5px", paddingRight: "15px", "display": "block", wordBreak: "break-all" }}>

                    {expanded ? value : value.slice(0, 50)}&nbsp;
                    {value.length > 50 && (
                        // eslint-disable-next-line jsx-a11y/anchor-is-valid
                        <Link
                            type="button"
                            component="button"
                            sx={{ fontSize: 'inherit' }}
                            onClick={() => setExpanded(!expanded)}
                        >
                            {expanded ? <nav>  <PiDotsThree />Réduire</nav> : <nav> <PiDotsThree />Voir</nav>}
                        </Link>
                    )}
                </div>}

                {value && <div style={{ paddingLeft: "5px", paddingRight: "15px", "display": "block", wordBreak: "break-all" }}>
                    &nbsp;
                </div>
                }
            </nav>
        );
    }

    function ExpandableCell_50_bg_hiligt({ value }) {
        const [expanded, setExpanded] = React.useState(false);

        return (
            <nav>
                {value && <div style={{
                    paddingLeft: "5px", paddingRight: "15px", "display": "block", wordBreak: "break-all", color: '#0000FF',
                    "textAlign": "center"
                }}>

                    {expanded ? value : value.slice(0, 50)}&nbsp;
                    {value.length > 50 && (
                        // eslint-disable-next-line jsx-a11y/anchor-is-valid
                        <Link
                            type="button"
                            component="button"
                            sx={{ fontSize: 'inherit' }}
                            onClick={() => setExpanded(!expanded)}
                        >
                            {expanded ? <nav>  <PiDotsThree />Réduire</nav> : <nav> <PiDotsThree />Voir</nav>}
                        </Link>
                    )}
                </div>}

                {value && <div style={{ paddingLeft: "5px", paddingRight: "15px", "display": "block", wordBreak: "break-all", color: '#0000FF' }}>
                    &nbsp;
                </div>
                }
            </nav>
        );
    }

    const columns_equipe = [
        { field: '_id', headerName: '_id', hide: true, Width: 0, disableExport: true, },
        { field: 'id', headerName: 'id', hide: true, Width: 0, disableExport: true, },
        { field: 'chef_equipe_id', headerName: 'chef_equipe_id', hide: true, Width: 0, disableExport: true, },

        { field: 'code', headerName: 'Code', flex: 1, hide: false, minWidth: 180, renderCell: (params) => <ExpandableCell_50 {...params} />, },
        { field: 'description', headerName: 'Description', flex: 1, hide: false, minWidth: 180, renderCell: (params) => <ExpandableCell_50 {...params} />, },
        { field: 'email_equipe', headerName: 'Mail Diff.', flex: 1, hide: false, minWidth: 180, renderCell: (params) => <ExpandableCell_50 {...params} />, },
        { field: 'chef_equipe_nom_prenom', headerName: 'Responsable', flex: 1, hide: false, minWidth: 180, renderCell: (params) => <ExpandableCell_50 {...params} />, },
        { field: 'nb_membre', headerName: 'Nb membres', flex: 1, hide: false, minWidth: 180, renderCell: (params) => <ExpandableCell_50 {...params} />, },

        {
            field: "delete", headerName: 'Supprimer', disableExport: true,
            renderCell: (cellValues) => {
                return (
                    <nav>
                        {String(cellValues.row.nb_membre) !== "0" && <Button onClick={(e) => {
                            alert(" Vous devez supprimer les membres avant de supprimer le groupe");
                        }}>
                            <CiTrash />

                        </Button>}

                        {String(cellValues.row.nb_membre) === "0" &&
                            <Popup
                                trigger={<Button


                                >
                                    <CiTrash />

                                </Button>}
                                modal
                                nested
                                position="center center"
                            >
                                {close => (
                                    <div>
                                        <button className="gest_close" onClick={close}>
                                            &times;
                                        </button>
                                        <div className="gest_header"> MySy Information </div>
                                        <div className="gest_content">
                                            {' '}

                                            En confirmant cette opération, l'équipe sera <i><font color="red"> définitivement supprimé</font></i>. <br />

                                        </div>
                                        <div className="gest_actions">
                                            <div style={{ "width": "45%", "float": "left" }}>
                                                <button className="gest_bton_popup" onClick={(event) => {

                                                    Delete_Given_Equipe(cellValues.row._id);
                                                    //console.log('modal closed ');
                                                    close();
                                                }}> Valider </button>

                                            </div>
                                            <div style={{ "width": "45%", "float": "right" }}>
                                                <button
                                                    className="gest_bton_popup"
                                                    onClick={() => {
                                                        //console.log('modal closed ');
                                                        close();
                                                    }}
                                                >
                                                    Annuler
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                )}
                            </Popup>}

                    </nav>
                );
            }
        }

    ]

    const columns_equipe_membre = [
        { field: '_id', headerName: '_id', hide: true, Width: 0, disableExport: true, },
        { field: 'id', headerName: 'id', hide: true, Width: 0, disableExport: true, },
        {
            field: 'leader', headerName: 'Leader', hide: false, Width: 100,
            renderCell: (cellValues) => {
                return (
                    <div style={{ paddingLeft: "5px", paddingRight: "15px", "display": "block", wordBreak: "break-all" }}>
                        {cellValues.row.leader && String(cellValues.row.leader) === "1" && "Oui"}
                        {cellValues.row.leader && String(cellValues.row.leader) !== "1" && ""}
                    </div>

                );
            }
        },
        {
            field: 'civilite', headerName: 'Civilite', hide: false, Width: 100,
            valueFormatter: (params) => {
                if (params.value)
                    return String(params.value)[0].toUpperCase() + String(params.value).slice(1);
                else
                    return ""

            },
        },
        { field: 'nom', headerName: 'Nom', flex: 1, hide: false, minWidth: 180, renderCell: (params) => <ExpandableCell_50 {...params} />, },
        { field: 'prenom', headerName: 'Prenom', flex: 1, hide: false, minWidth: 180, renderCell: (params) => <ExpandableCell_50 {...params} />, },
        { field: 'email', headerName: 'Email', flex: 1, hide: false, minWidth: 180, renderCell: (params) => <ExpandableCell_50 {...params} />, },
        { field: 'role', headerName: 'Rôle', flex: 1, hide: false, minWidth: 180, renderCell: (params) => <ExpandableCell_50 {...params} />, },

        {
            field: "delete", headerName: 'Supprimer', disableExport: true,
            renderCell: (cellValues) => {
                return (

                    <Popup
                        trigger={<Button

                            onClick={(event) => {

                                // handleClick_delete(event, cellValues);
                            }}
                        >
                            <CiTrash />

                        </Button>}
                        modal
                        nested
                        position="center center"
                    >
                        {close => (
                            <div>
                                <button className="gest_close" onClick={close}>
                                    &times;
                                </button>
                                <div className="gest_header"> MySy Information </div>
                                <div className="gest_content">
                                    {' '}

                                    En confirmant cette opération, la personne sera <i><font color="red"> supprimée de l'équipe </font></i>. <br />



                                </div>
                                <div className="gest_actions">
                                    <div style={{ "width": "45%", "float": "left" }}>
                                        <button className="gest_bton_popup" onClick={(event) => {
                                            var tab = []
                                            tab.push(String(cellValues.row._id));
                                            Delete_List_Membre_From_Equipe(tab);
                                            close();
                                        }}> Valider </button>

                                    </div>
                                    <div style={{ "width": "45%", "float": "right" }}>
                                        <button
                                            className="gest_bton_popup"
                                            onClick={() => {
                                                //console.log('modal closed ');
                                                close();
                                            }}
                                        >
                                            Annuler
                                        </button>
                                    </div>
                                </div>
                            </div>
                        )}
                    </Popup>


                );
            }
        }

    ]

    const [selectionModel_columns_equipe, setselectionModel_columns_equipe] = React.useState([]);
    const [selectionModel_columns_equipe_membre, setselectionModel_columns_equipe_membre] = React.useState([]);

    const [New_Getall_Training_Employee_No_Filter_result, setNew_Getall_Training_Employee_No_Filter_result] = useState([]);

    const [Getall_Training_Employee_No_Filter_api, setGetall_Training_Employee_No_Filter_api] = useState();
    const [Getall_Training_Employee_No_Filter_message, setGetall_Training_Employee_No_Filter_message] = useState();
    const [Getall_Training_Employee_No_Filter_result, setGetall_Training_Employee_No_Filter_result] = useState([]);
    function Getall_Training_Employee_No_Filter(event) {

        var form = new FormData();


        const stored_cookie = getCookie('tokenmysypart');
        form.append("token", stored_cookie);

        var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Ressource_Humaine_no_filter/";



        axios.post(myurl, form).then(res => {

            setLoading(true);

            if (String(res.data.status) === String("true")) {
                setLoading(false);
                //console.log(" In Getall_Training_Employee_No_Filter  res.data.status = " + res.data.status);
                //console.log(" In Getall_Training_Employee_No_Filter  res.data.message r_class = " + res.data.message);
                setGetall_Training_Employee_No_Filter_api("true");
                setGetall_Training_Employee_No_Filter_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)._id;
                    var local_nom = JSON.parse(x).nom;
                    var local_prenom = JSON.parse(x).prenom;
                    var local_ismanager = JSON.parse(x).ismanager;


                    //---
                    var node = {
                        "_id": local_id,
                        "id": localid,
                        "label": local_nom + " " + local_prenom,
                        "nom": local_nom,
                        "prenom": local_prenom,
                        "ismanager": local_ismanager
                    };
                    new_data2.push(node);
                });

                //---
                var node = {
                    "_id": "",
                    "id": "",
                    "label": "",
                    "nom": "",
                    "prenom": "",
                    "ismanager": ""

                };
                new_data2.push(node);

                if (new_data2.length > 0)
                    setNew_Getall_Training_Employee_No_Filter_result(new_data2);

            }
            else {
                setGetall_Training_Employee_No_Filter_api("false");
                setGetall_Training_Employee_No_Filter_message(res.data.message);
                // alert(res.data.message);
                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("error");

            }

        }).catch((error) => {
            setLoading(false);
            console.warn('Not good man :( Getall_Training_Employee_No_Filter = ', error);
            setGetall_Training_Employee_No_Filter_api("false");
            alert(" Impossible de recuperer la liste des employés");
            //setmyApimyApiMessage("")
        })
    }

    const [Delete_Given_Equipe_api, setDelete_Given_Equipe_api] = useState();
    const [Delete_Given_Equipe_message, setDelete_Given_Equipe_message] = useState();
    const [Delete_Given_Equipe_result, setDelete_Given_Equipe_result] = useState();
    function Delete_Given_Equipe(local_grp_id) {

        var form = new FormData();

        const stored_cookie = getCookie('tokenmysypart');
        form.append("token", stored_cookie);
        form.append("_id", local_grp_id);


        var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_Equipe_Team/";

        axios.post(myurl, form).then(res => {
            //console.log(" In Delete_Given_Equipe  res.data.status = " + res.data.status);
            //console.log(" In Delete_Given_Equipe  res.data.message r_class = " + res.data.message);

            if (String(res.data.status) === String("true")) {
                setDelete_Given_Equipe_api("true");
                setDelete_Given_Equipe_result(res.data.message);

                Getall_Partner_Equipe_Team();
                setdisplay_equipe("");
                setequipe_data_changed("");
                setequipe_data_edit_mode("");
                setadd_one_equipe("");


                setselected_id("");
                setgridline_id("");

                setsubmenu("");

                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("success");

            }
            else {
                setDelete_Given_Equipe_api("false");
                setDelete_Given_Equipe_message(res.data.message);
                // alert(res.data.message);
                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("error");
            }

        }).catch((error) => {

            console.warn('Delete_Given_Equipe : Not good man :( mysearchtext = ' + error);
            setDelete_Given_Equipe_api("false");
            alert(" Impossible de supprimer le groupe ");
        })
    }


    function GetSelectedRows_Equipe_Membres_Ids() {


        var tab_tmp = []
        for (var i = 0; i < selectionModel_columns_equipe_membre.length; i++) {
            //console.log(" ### selectionModel_insc[i] = ", selectionModel_insc[i]);
            var myid = parseInt(String(selectionModel_columns_equipe_membre[i]));
            //var line = JSON.parse(rowss[myid]);
            tab_tmp.push(myid);
        }
        return tab_tmp;

    }

    async function actionmass_equipe_membre_Traitemet() {

        var liste_membre_id = GetSelectedRows_Equipe_Membres_Ids();
        var tab_mongo_members_ids = [];

        for (var i = 0; i < liste_membre_id.length; i++) {

            var line = New_Getall_Equipe_Members[liste_membre_id[i]]


            var line_json = line;
            //console.log(" line_json['prenom'] = ", line_json['prenom']);
            //console.log(" line_json['_id'] = ", line_json['_id']);
            tab_mongo_members_ids.push(line_json['_id'])

        }

        if (String(actionmass_equipe_membre_val) === String("delete_equipe_membre")) {
            Delete_List_Membre_From_Equipe(tab_mongo_members_ids);

        }
    }


    const [New_Getall_Partner_Equipe_Team_result, setNew_Getall_Partner_Equipe_Team_result] = useState([]);

    const [Getall_Partner_Equipe_Team_api, setGetall_Partner_Equipe_Team_api] = useState();
    const [Getall_Partner_Equipe_Team_message, setGetall_Partner_Equipe_Team_message] = useState();
    const [Getall_Partner_Equipe_Team_result, setGetall_Partner_Equipe_Team_result] = useState([]);
    function Getall_Partner_Equipe_Team(event) {

        var form = new FormData();


        const stored_cookie = getCookie('tokenmysypart');
        form.append("token", stored_cookie);

        var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Equipe_Team/";

        axios.post(myurl, form).then(res => {

            if (String(res.data.status) === String("true")) {
                //console.log(" In Getall_Partner_Equipe_Team  res.data.status = " + res.data.status);
                //console.log(" In Getall_Partner_Equipe_Team  res.data.message r_class = " + res.data.message);
                setGetall_Partner_Equipe_Team_api("true");
                setGetall_Partner_Equipe_Team_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)._id;
                    var local_code = JSON.parse(x).code;
                    var local_description = JSON.parse(x).description;
                    var local_email_equipe = JSON.parse(x).email_equipe;
                    var local_chef_equipe_id = JSON.parse(x).chef_equipe_id;
                    var local_chef_equipe_nom_prenom = JSON.parse(x).chef_equipe_nom_prenom;
                    var local_nb_membre = JSON.parse(x).nb_membre;


                    //---
                    var node = {
                        "_id": local_id,
                        "id": localid,
                        "label": local_code,
                        "code": local_code,
                        "description": local_description,
                        "email_equipe": local_email_equipe,
                        "chef_equipe_id": local_chef_equipe_id,
                        "chef_equipe_nom_prenom": local_chef_equipe_nom_prenom,
                        "nb_membre": local_nb_membre,
                    };
                    new_data2.push(node);
                });

                //---
                var node = {
                    "_id": "",
                    "_id": "",
                    "id": "",
                    "label": "",
                    "code": "",
                    "description": "",
                    "email_equipe": "",
                    "chef_equipe_id": "",
                    "chef_equipe_nom_prenom": "",
                    "nb_membre": "",

                };
                new_data2.push(node);

                if (new_data2.length > 0)
                    setNew_Getall_Partner_Equipe_Team_result(new_data2);

            }
            else {
                setGetall_Partner_Equipe_Team_api("false");
                setGetall_Partner_Equipe_Team_message(res.data.message);
                // alert(res.data.message);
                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("error");
            }

        }).catch((error) => {
            console.warn('Not good man :( Getall_Partner_Equipe_Team = ', error);
            setGetall_Partner_Equipe_Team_api("false");
            alert(" Impossible de recuperer la liste des groupes d'inscrits");
            //setmyApimyApiMessage("")
        })
    }

    const New_Option = [
        { "id": "2", "label": "Supprimer", "value": "supprimer" },
    ]

    const [actionmass_ftion_val, setactionmass_ftion_val] = useState();
    const actionmass_ftion = (event) => {
        const value = event.target.value;


        if (String(value) === "supprimer") {
            setactionmass_ftion_val(value);
        }
        else {
            setactionmass_ftion_val();
        }
    }

    const New_Option_equipe_membre = [
        { "id": "delete_equipe_membre", "label": "Supprimer les membres", "value": "delete_equipe_membre" },
        { "id": "", "label": "", "value": "" },
    ]

    const [history_securite_read, sethistory_securite_read] = useState("");

    useEffect(() => {
        Getall_Training_Employee_No_Filter();
        Getall_Partner_Equipe_Team();

        sethistory_securite_read(props.check_user_acces_right("historique", "read"))

        window.scrollTo({
            top: 0,
            behavior: "smooth",
        });

    }, [])


    const myRef_head = useRef(null);
    const myRef = useRef(null)
    const sleep = (milliseconds) => {
        return new Promise(resolve => setTimeout(resolve, milliseconds))
    }

    const New_Option_Filter = [
        { "id": "code", "label": "Code Equipe  ", "value": "code" },
        { "id": "description", "label": "Description ", "value": "description" },
        { "id": "membre", "label": "Nom / Prenom membre ", "value": "membre" },
        { "id": "", "label": "", "value": "" },
        { "id": "1", "label": "", "value": "1" }, // Cette ligne pour couvrir l'ajout d'une ligne de filter. C'est fait expres.
    ]


    async function Disable_Equipe_DetailFields() {
        await sleep(5);
        setequipe_data_edit_mode("0");

        var liste_champs = ['detail_code', 'detail_description', 'detail_email_diffusion', 'detail_responsable']


        for (let i = 0; i < liste_champs.length; i++) {

            if (document.getElementsByName(String(liste_champs[i])) && document.getElementsByName(String(liste_champs[i]))[0]) {
                document.getElementsByName(String(liste_champs[i]))[0].disabled = true;
                document.getElementsByName(String(liste_champs[i]))[0].style.backgroundColor = "#ECEFF1";

            }
        }

    }



    function handleClick_edit_equipe_From_Line(selected_row_id) {

        var line = New_Getall_Partner_Equipe_Team_result[selected_row_id];

        setselected_id(line._id);
        setgridline_id(selected_row_id);


        Get_Given_Equipe_Data(line._id);

        setdisplay_equipe("1");
        setadd_one_equipe("");
        setequipe_data_changed("");
        setequipe_data_edit_mode("");
        submenu_detail();

        //Getall_Evaluation_Participant_List();

    }


    const [New_Employee_Not_Member, setNew_Employee_Not_Member] = useState([]);

    const [New_List_Equipe_Members_Id, setNew_List_Equipe_Members_Id] = useState([]);
    const [New_Getall_Equipe_Members, setNew_Getall_Equipe_Members] = useState([]);

    const [Get_Given_Equipe_Data_api, setGet_Given_Equipe_Data_api] = useState();
    const [Get_Given_Equipe_Data_message, setGet_Given_Equipe_Data_message] = useState();
    const [Get_Given_Equipe_Data_result, setGet_Given_Equipe_Data_result] = useState([]);
    function Get_Given_Equipe_Data(equipe_id) {
        setequipe_data_changed("");
        setequipe_data_edit_mode("");


        var form = new FormData();

        const stored_cookie = getCookie('tokenmysypart');
        form.append("token", stored_cookie);
        form.append("_id", equipe_id);


        var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Equipe_Team_With_Members/";

        setLoading(true);
        axios.post(myurl, form).then(res => {

            if (String(res.data.status) === "true") {
                setLoading(false);
                //console.log(" In Get_Given_Equipe_Data  res.data.status = " + res.data.status);
                //console.log(" In Get_Given_Equipe_Data  res.data.message r_class = " + res.data.message);
                setGet_Given_Equipe_Data_api("true");
                setGet_Given_Equipe_Data_result(res.data.message);

                if (res.data.message.length > 0) {
                    var mylocal_groupe = JSON.parse(res.data.message);

                    if (mylocal_groupe.code)
                        setp_detail_code(mylocal_groupe.code);
                    else
                        setp_detail_code("");

                    if (mylocal_groupe.email_equipe) {
                        setp_detail_email_equipe(mylocal_groupe.email_equipe);
                    } else {
                        setp_detail_email_equipe("");
                    }


                    if (mylocal_groupe.description) {
                        setp_detail_description(mylocal_groupe.description);
                    } else {
                        setp_detail_description("");
                    }

                    if (mylocal_groupe.chef_equipe_id) {
                        setp_detail_chef_equipe_id(mylocal_groupe.chef_equipe_id);
                    } else {
                        setp_detail_chef_equipe_id("");
                    }

                    var new_data2 = [];
                    const new_data = res.data.message.map((x) => {

                        //---
                        var tab_employe_not_member = [];

                        var local_equipe_membres = JSON.parse(x).list_membre;
                        setNew_Getall_Equipe_Members(local_equipe_membres);

                        var local_all_Training_Employee = New_Getall_Training_Employee_No_Filter_result;

                        for (var i = 0; i < local_all_Training_Employee.length; i++) {

                            var is_member = "0";

                            for (var x = 0; x < local_equipe_membres.length; x++) {
                                if (local_all_Training_Employee[i]._id === local_equipe_membres[x].rh_id) {
                                    is_member = "1"
                                }
                            }

                            if (is_member === "0") {
                                //   console.log(" NOT MEMBER = ", local_all_Training_Employee[i]);
                                tab_employe_not_member.push(local_all_Training_Employee[i]);
                            }


                        }

                        setNew_Employee_Not_Member(tab_employe_not_member);

                    });


                    if (document.getElementById('myRef')) {
                        var divh = document.getElementById('myRef').offsetTop;
                        window.scrollTo({
                            top: divh,
                            behavior: "smooth",
                        });
                    }

                    Disable_Equipe_DetailFields();
                } else {
                    alert(" Aucune donnée recuperée");
                }


            } else if (String(res.data.status) === String("Err_Connexion")) {
                alert('Erreur: ' + res.data.message);
                history.push("/Connexion");
            }

            else {
                setLoading(false);
                setGet_Given_Equipe_Data_api("false");
                setGet_Given_Equipe_Data_message(res.data.message);
                // alert(res.data.message);
                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("error");
            }

        }).catch((error) => {
            console.warn('Not good man :( Get_Given_Equipe_Data = ', error);
            setGet_Given_Equipe_Data_api("false");
            alert(" Impossible de recuperer les données du groupe");
            //setmyApimyApiMessage("")
        })
    }


    function clean_all_filters() {
        setgridline_id('');
        setp_filtre1("");
        setp_filtre1_value("");

        setp_filtre2("");
        setp_filtre2_value("");

        setp_filtre3("");
        setp_filtre3_value("");

        setp_filtre4("");
        setp_filtre4_value("");

        Annule_Add_One_Equipe_DetailFields();
        
        Getall_Partner_Equipe_Team();
        
    }



    const [Add_Update_Equipe_Data_api, setAdd_Update_Equipe_Data_api] = useState();
    const [Add_Update_Equipe_Data_message, setAdd_Update_Equipe_Data_message] = useState();
    const [Add_Update_Equipe_Data_result, setAdd_Update_Equipe_Data_result] = useState([]);
    function Add_Update_Equipe_Data() {
        var form = new FormData();
        //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");


        const stored_cookie = getCookie('tokenmysypart');
        form.append("token", stored_cookie);

        form.append("code", p_detail_code);
        form.append("description", p_detail_description);
        form.append("email_equipe", p_detail_email_equipe);
        form.append("chef_equipe_id", p_detail_chef_equipe_id);


        var myurl = "";

        if (selected_id && String(selected_id).length > 5) {
            form.append("_id", selected_id);
            myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Equipe_Team/";
        } else {
            myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Equipe_Team/";
        }



        setLoading(true);
        axios.post(myurl, form).then(res => {
            //console.log(" In Add_Update_Equipe_Data  res.data.status = " + res.data.status);
            //console.log(" In Add_Update_Equipe_Data  res.data.message r_class = " + res.data.message);

            setLoading(false);

            if (String(res.data.status) === String("true")) {
                setAdd_Update_Equipe_Data_api("true");
                setAdd_Update_Equipe_Data_result(res.data.message);
                Disable_Equipe_DetailFields();
                setequipe_data_changed("");
                setequipe_data_edit_mode("");
                clear_DetailFieds();

                if (selected_id && String(selected_id).length > 5) {
                    handleClick_edit_equipe_From_Line(gridline_id);
                    Disable_Equipe_DetailFields();
                    setequipe_data_changed("");
                    setequipe_data_edit_mode("");

                    setdisplay_equipe('1');
                    if (document.getElementById('myRef')) {
                        // myRef.current.scrollIntoView({ behavior: "smooth" });
                        var divh = document.getElementById('myRef').offsetTop;
                        window.scrollTo({
                            top: divh,
                            behavior: "smooth",
                        });
                    }

                } else {
                    Disable_Equipe_DetailFields();
                    setequipe_data_changed("");
                    setequipe_data_edit_mode("");
                    setdisplay_equipe("");
                    setadd_one_equipe("");
                    setsubmenu("");


                    window.scrollTo({
                        top: 0,
                        behavior: "smooth",
                    });

                }


                Getall_Partner_Equipe_Team();


                // alert(res.data.message);
                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("success");



            }
            else {
                setAdd_Update_Equipe_Data_api("false");
                setAdd_Update_Equipe_Data_message(res.data.message);
                // alert(res.data.message);
                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("error");
            }

        }).catch((error) => {
            setLoading(false);

            console.log('UpdateStagiaireData : Not good man :( Add_Update_Equipe_Data = ' + error);
            setAdd_Update_Equipe_Data_api("false");
            alert(" Impossible d'ajouter ou  mettre à jour le groupe");

        })
    }


    const [Add_Member_To_Equipe_api, setAdd_Member_To_Equipe_api] = useState();
    const [Add_Member_To_Equipe_message, setAdd_Member_To_Equipe_message] = useState();
    const [Add_Member_To_Equipe_result, setAdd_Member_To_Equipe_result] = useState([]);
    function Add_Member_To_Equipe() {

        var tab_rh_ids = [];
        for (var i = 0; i < tab_selected_users.length; i++) {

            var local_rh_id = tab_selected_users[i]._id;
            tab_rh_ids.push(local_rh_id);
        }


        var form = new FormData();


        const stored_cookie = getCookie('tokenmysypart');
        form.append("token", stored_cookie);
        form.append("_id", selected_id);
        form.append("tab_ressource_humaine_ids", tab_rh_ids);
        form.append("role", p_detail_member_role);

        Dialog_Equipe_Membre_handleClose_buton();


        var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Update_Equipe_Team_Membres/";

        setLoading(true);
        axios.post(myurl, form).then(res => {
            //console.log(" In Add_Member_To_Equipe  res.data.status = " + res.data.status);
            //console.log(" In Add_Member_To_Equipe  res.data.message r_class = " + res.data.message);

            setLoading(false);

            if (String(res.data.status) === String("true")) {
                setAdd_Member_To_Equipe_api("true");
                setAdd_Member_To_Equipe_result(res.data.message);
                Disable_Equipe_DetailFields();
                setequipe_data_changed("");
                setequipe_data_edit_mode("");
                clear_DetailFieds();

                Get_Given_Equipe_Data(selected_id);

                // alert(res.data.message);
                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("success");



            }
            else {
                setAdd_Member_To_Equipe_api("false");
                setAdd_Member_To_Equipe_message(res.data.message);
                // alert(res.data.message);
                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("error");
            }

        }).catch((error) => {
            setLoading(false);

            console.log('UpdateStagiaireData : Not good man :( Add_Member_To_Equipe = ' + error);
            setAdd_Member_To_Equipe_api("false");
            alert(" Impossible d'ajouter les membre ou  mettre à jour le groupe");

        })
    }


    async function submenu_detail() {
        await sleep(5);
        setsubmenu("detail_equipe");
        inactive_active_menu_header("detail_equipe");


        if (String(equipe_data_edit_mode) !== "1") {
            Disable_Equipe_DetailFields();
        }

    }

    async function submenu_membres() {
        await sleep(5);
        setsubmenu("membre");
        inactive_active_menu_header("membre");


        if (String(equipe_data_edit_mode) !== "1") {
            Disable_Equipe_DetailFields();
        }

    }

    async function submenu_piece_jointe() {
        await sleep(5);
        setsubmenu("piece_jointe");
        inactive_active_menu_header("piece_jointe");

        // Refresh affichage des pièces jointes
        Get_List_Of_All_PJ(props.client_id);


        if (String(equipe_data_edit_mode) !== "1") {
            Disable_Equipe_DetailFields();
        }

    }

    async function submenu_historique() {
        await sleep(5);
        setsubmenu("historique");
        inactive_active_menu_header("historique");

        if (String(equipe_data_edit_mode) !== "1") {
            Disable_Equipe_DetailFields();
        }

    }

    // Cette fontion desactive tous les menu header et reactive just le menu_header concerné
    function inactive_active_menu_header(current_menu_header) {


        const list_menu_header_names = ['detail_equipe', 'membre', 'piece_jointe', 'historique']
        for (let i = 0; i < list_menu_header_names.length; i++) {
            if (document.getElementsByName(String(list_menu_header_names[i])) && document.getElementsByName(String(list_menu_header_names[i]))[0]) {
                document.getElementsByName(String(list_menu_header_names[i]))[0].style.fontWeight = "400";
                document.getElementsByName(String(list_menu_header_names[i]))[0].style.backgroundColor = "#d8edfc";
                document.getElementsByName(String(list_menu_header_names[i]))[0].style.color = "#3b3e40";

            }
        }


        if (document.getElementsByName(String(current_menu_header)) && document.getElementsByName(String(current_menu_header))[0]) {
            document.getElementsByName(String(current_menu_header))[0].style.fontWeight = "700";
            document.getElementsByName(String(current_menu_header))[0].style.backgroundColor = "#107758";
            document.getElementsByName(String(current_menu_header))[0].style.color = "white";
        }
    }



    // DEBUT  EXPORT EXCEL DATAGRID 

    function CustomToolbar(props) {


        return (
            <GridToolbarContainer {...props}>

                <GridToolbarColumnsButton />
                <GridToolbarFilterButton />
                <GridToolbarDensitySelector
                    slotProps={{ tooltip: { title: 'Change density' } }}
                />
                <Box sx={{ flexGrow: 1 }} />
                <ExportButton data_colums={props.data_colums} />


            </GridToolbarContainer>
        );
    }

    function getExcelData(apiRef) {
        // Select rows and columns
        const filteredSortedRowIds = gridFilteredSortedRowIdsSelector(apiRef);
        const visibleColumnsField = gridVisibleColumnFieldsSelector(apiRef);

        // Format the data. Here we only keep the value
        const data = filteredSortedRowIds.map((id) => {
            const row = {};
            visibleColumnsField.forEach((field) => {
                row[field] = apiRef.current.getCellParams(id, field).value;
            });
            return row;
        });

        return data;
    }


    function ExportButton(props) {
        return (
            <GridToolbarExportContainer {...props}>
                <ExportMenuItem data_colums={props.data_colums} />
            </GridToolbarExportContainer>
        );
    }

    function handleExport(apiRef, data_colums) {
        const data = getExcelData(apiRef);
        const visibleColumnsField = gridVisibleColumnFieldsSelector(apiRef);


        const local_config = {
            keys: visibleColumnsField,

            columnNames: data_colums.filter((mydata) => (mydata).disableExport !== true).map(function (mydata) {
                if (mydata.headerName && visibleColumnsField.includes(mydata.field)) {
                    if (mydata.headerName) {
                        return mydata.headerName;
                    }
                }

            }),

            fileName: 'data_' + String(new Date().toJSON().slice(0, 10)).replaceAll("-", "_") + '.xlsx',
            sheetName: 'Export_' + String(new Date().toJSON().slice(0, 10)).replaceAll("-", "_"),
        };

        local_config.columnNames = local_config.columnNames.filter(function (element) {
            return element !== undefined;
        });


        const rows = data.map((row) => {
            const mRow = {};
            for (const key of local_config.keys) {
                mRow[key] = row[key];
            }
            return mRow;
        });

        const worksheet = XLSX.utils.json_to_sheet(rows);
        XLSX.utils.sheet_add_aoa(worksheet, [[...local_config.columnNames]], {
            origin: 'A1',
        });

        const workbook = XLSX.utils.book_new();
        XLSX.utils.book_append_sheet(workbook, worksheet, local_config.sheetName);
        XLSX.writeFile(workbook, local_config.fileName, { compression: true });
    }

    function ExportMenuItem(props) {
        const apiRef = useGridApiContext();
        const { hideMenu } = props;

        return (
            <MenuItem
                onClick={() => {
                    handleExport(apiRef, props.data_colums);
                    // Hide the export menu after the export
                    hideMenu?.();
                }}
            >
                Export Excel
            </MenuItem>
        );
    }

    // FIN EXPORT EXCEL DATAGRID 


    const [display_alert_mysy, setdisplay_alert_mysy] = useState("");
    const [alert_message, setalert_message] = useState("");
    const [alert_type, setalert_type] = useState("");

    function clear_alert_message() {
        setalert_message("");
    }
    function clear_alert_type() {
        setalert_type("");
    }

    function clear_display_alert_mysy() {
        setdisplay_alert_mysy("");
    }

    function Ajout_1_equipe() {

        clear_DetailFieds();

        setdisplay_equipe("");
        setequipe_data_changed("");
        setequipe_data_edit_mode("");

        setselected_id("");
        setgridline_id("");
        setadd_one_equipe("1");
        setsubmenu("detail_equipe");

        if (document.getElementById('myRef')) {
            // myRef.current.scrollIntoView({ behavior: "smooth" });
            var divh = document.getElementById('myRef').offsetTop;
            window.scrollTo({
                top: divh,
                behavior: "smooth",
            });
        }

    }


    function Annule_Add_One_Equipe_DetailFields() {
        setdisplay_equipe("");
        setequipe_data_changed("");
        setequipe_data_edit_mode("");
        setadd_one_equipe("");


        setselected_id("");
        setgridline_id("");

        setsubmenu("");

    }

    function Annule_Equipe_DetailFields() {
        Get_Given_Equipe_Data(selected_id);
        setequipe_data_changed("");
        setequipe_data_edit_mode("");
    }


    function Enable_Equipe_DetailFields() {
        setequipe_data_edit_mode("1");

        var liste_champs = ['detail_code', 'detail_description', 'detail_email_diffusion', 'detail_responsable']

        for (let i = 0; i < liste_champs.length; i++) {
            if (document.getElementsByName(String(liste_champs[i])) && document.getElementsByName(String(liste_champs[i]))[0]) {
                document.getElementsByName(String(liste_champs[i]))[0].disabled = false;
                document.getElementsByName(String(liste_champs[i]))[0].style.backgroundColor = "#FFFFFF";

            }
        }
    }





    const [p_detail_code, setp_detail_code] = React.useState("");
    const [p_detail_description, setp_detail_description] = React.useState("");
    const [p_detail_email_equipe, setp_detail_email_equipe] = React.useState("");
    const [p_detail_chef_equipe_id, setp_detail_chef_equipe_id] = React.useState("");

    const [display_equipe, setdisplay_equipe] = React.useState("");
    const [equipe_data_changed, setequipe_data_changed] = React.useState("");
    const [equipe_data_edit_mode, setequipe_data_edit_mode] = useState("");
    const [add_one_equipe, setadd_one_equipe] = React.useState("");


    function clear_DetailFieds() {
        setp_detail_code("");
        setp_detail_description("");
        setp_detail_email_equipe("");
        setp_detail_chef_equipe_id("");

    }


    const [p_detail_member_role, setp_detail_member_role] = React.useState("");

    const [gridline_equipe_member_id, setgridline_equipe_member_id] = useState("");

    const [Getall_Partner_Equipe_With_Filter_api, setGetall_Partner_Equipe_With_Filter_api] = useState();
    const [Getall_Partner_Equipe_With_Filter_message, setGetall_Partner_Equipe_With_Filter_message] = useState();
    const [Getall_Partner_Equipe_With_Filter_result, setGetall_Partner_Equipe_With_Filter_result] = useState();
    function Getall_Partner_Equipe_With_Filter(event) {

        var form = new FormData();


        // Recuperation des parametres
        var filtre1 = p_filtre1;
        var filtre2 = p_filtre2;
        var filtre3 = p_filtre3;
        var filtre4 = p_filtre4;

        var filtre1_value = "";
        var filtre2_value = "";
        var filtre3_value = "";
        var filtre4_value = "";
        // Recuperation des valeurs de filtres

        if (p_filtre1_value) {
            filtre1_value = p_filtre1_value;
            form.append(filtre1, filtre1_value);
        }

        if (p_filtre2_value) {
            filtre2_value = p_filtre2_value;
            form.append(filtre2, filtre2_value);
        }

        if (p_filtre3_value) {
            filtre3_value = p_filtre3_value;
            form.append(filtre3, p_filtre3_value);
        }

        if (p_filtre4_value) {
            filtre4_value = p_filtre4_value;
            form.append(filtre4, p_filtre4_value);
        }


        const stored_cookie = getCookie('tokenmysypart');
        form.append("token", stored_cookie);

        var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Equipe_Team_With_Filter/";

        Annule_Add_One_Equipe_DetailFields();

        axios.post(myurl, form).then(res => {

            if (String(res.data.status) === String("true")) {
                //console.log(" In Getall_Partner_Equipe_With_Filter  res.data.status = " + res.data.status);
                //console.log(" In Getall_Partner_Equipe_With_Filter  res.data.message r_class = " + res.data.message);
                setGetall_Partner_Equipe_With_Filter_api("true");
                setGetall_Partner_Equipe_With_Filter_result(res.data.message);

                setGetall_Partner_Equipe_Team_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)._id;
                    var local_code = JSON.parse(x).code;
                    var local_description = JSON.parse(x).description;
                    var local_email_equipe = JSON.parse(x).email_equipe;
                    var local_chef_equipe_id = JSON.parse(x).chef_equipe_id;
                    var local_chef_equipe_nom_prenom = JSON.parse(x).chef_equipe_nom_prenom;
                    var local_nb_membre = JSON.parse(x).nb_membre;


                    //---
                    var node = {
                        "_id": local_id,
                        "id": localid,
                        "label": local_code,
                        "code": local_code,
                        "description": local_description,
                        "email_equipe": local_email_equipe,
                        "chef_equipe_id": local_chef_equipe_id,
                        "chef_equipe_nom_prenom": local_chef_equipe_nom_prenom,
                        "nb_membre": local_nb_membre,
                    };
                    new_data2.push(node);
                });

                //---
                var node = {
                    "_id": "",
                    "_id": "",
                    "id": "",
                    "label": "",
                    "code": "",
                    "description": "",
                    "email_equipe": "",
                    "chef_equipe_id": "",
                    "chef_equipe_nom_prenom": "",
                    "nb_membre": "",

                };
                new_data2.push(node);

                if (new_data2.length > 0)
                    setNew_Getall_Partner_Equipe_Team_result(new_data2);

            }
            else {
                setGetall_Partner_Equipe_With_Filter_api("false");
                setGetall_Partner_Equipe_With_Filter_message(res.data.message);
            }

        }).catch((error) => {
            console.warn('Not good man :( Getall_Partner_Equipe_With_Filter = ', error);
            setGetall_Partner_Equipe_With_Filter_api("false");
            //setmyApimyApiMessage("")
        })
    }



    // -- Gestion pièces jointes 

    const [Download_one_attached_document_api, setDownload_one_attached_document_api] = useState();
    const [Download_one_attached_document_result, setDownload_one_attached_document_result] = useState();
    const [Download_one_attached_document_message, setDownload_one_attached_document_message] = useState();
    const Download_one_attached_document = (event) => {
        const stored_cookie = getCookie('tokenmysypart');


        var nom_fiche_detaillee = "Fiche_Detaillee.pdf";
        var token = stored_cookie;
        var file_name = event.target.id;


        var url = process.env.REACT_APP_API_URL + "myclass/api/Get_Stored_Downloaded_File/" + token + "/" + file_name;
        setLoading(true);

        axios.get(url, { responseType: 'blob', },)
            .then((res) => {
                setLoading(false);
                fileDownload(res.data, nom_fiche_detaillee);
                setDownload_one_attached_document_api("true");
            }).catch((error) => {
                setLoading(false);
                console.error('Error:', error);
                setDownload_one_attached_document_api("false");

            });
    }


    const editorRef_competence = useRef(null);
    const [editorRef_competence_limite, seteditorRef_competence_limite] = useState(800);


    const [file_1_name, setfile_1_name] = useState();

    const [sessions_file_change_1_api, setsessions_file_change_1_api] = useState();
    const [sessions_file_change_1_result, setsessions_file_change_1_result] = useState();
    const [sessions_file_change_1_message, setsessions_file_change_1_message] = useState();
    const sessions_file_change_1 = event => {

        const fileUploaded = event.target.files[0];
        let file_size = event.target.files[0].size;
        let file_type = event.target.files[0].type;




        console.log("file_size =  ", file_size, " file_type = ", file_type);
        if (file_size > 10000000) {
            alert("Le fichier ne doit pas depasser un 1 Méga octets");
            //  console.log("Le fichier ne doit pas depasser un 1 Méga octets");
            return;
        }

        setfile_1_name(event.target.files[0]);
        const formData = new FormData();
        formData.append('File', fileUploaded);
        //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA');
        const stored_cookie = getCookie('tokenmysypart');

        //formData.append("token", stored_cookie);
        //formData.append("class_internal_url", internal_url);
        //console.log("token = " + stored_cookie);

        return;

    };


    const [file_2_name, setfile_2_name] = useState();

    const [sessions_file_change_2_api, setsessions_file_change_2_api] = useState();
    const [sessions_file_change_2_result, setsessions_file_change_2_result] = useState();
    const [sessions_file_change_2_message, setsessions_file_change_2_message] = useState();
    const sessions_file_change_2 = event => {

        const fileUploaded = event.target.files[0];
        let file_size = event.target.files[0].size;
        let file_type = event.target.files[0].type;




        console.log("file_size =  ", file_size, " file_type = ", file_type);
        if (file_size > 10000000) {
            alert("Le fichier ne doit pas depasser un 1 Méga octets");
            console.log("Le fichier ne doit pas depasser un 1 Méga octets");
            return;
        }

        setfile_2_name(event.target.files[0]);
        const formData = new FormData();
        formData.append('File', fileUploaded);
        //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA');
        const stored_cookie = getCookie('tokenmysypart');

        //formData.append("token", stored_cookie);
        //formData.append("class_internal_url", internal_url);
        //console.log("token = " + stored_cookie);

        return;

    };

    const [Record_All_PJ_api, setRecord_All_PJ_api] = useState();
    const [Record_All_PJ_result, setRecord_All_PJ_result] = useState();
    const [Record_All_PJ_message, setRecord_All_PJ_message] = useState();
    function Record_All_PJ() {

        if (!p_detail_one_file_to_download_type_name) {
            alert(" Vous devez donner un nom à la pièce jointe");
            return;
        }

        if (file_1_name && file_1_name.name) {

            const formData = new FormData();
            formData.append('File', file_1_name);
            //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA');
            const stored_cookie = getCookie('tokenmysypart');

            formData.append("token", stored_cookie);
            formData.append("file_business_object", p_detail_one_file_to_download_type_name);
            formData.append("file_name", file_1_name.name);
            formData.append("status", "0");
            formData.append("object_owner_collection", "groupe_inscription");
            formData.append("object_owner_id", selected_id);
            formData.append("type_document", "");

            //formData.append("class_internal_url", internal_url);
            //console.log("token = " + stored_cookie);


            fetch(
                process.env.REACT_APP_API_URL + "myclass/api/Store_User_Downloaded_File/",
                {
                    method: 'POST',
                    body: formData,
                }
            )
                .then((response) => response.json())
                .then((result) => {

                    //console.log(" ## result['status'] = ", result['status'])
                    if (String(result['status']) === String("true")) {
                        //console.log('Success:', result['message']);
                        setRecord_All_PJ_result(result['message']);
                        setRecord_All_PJ_api("true");

                        Get_List_Of_All_PJ(props.client_id);
                        setfile_1_name();
                        setp_detail_one_file_to_download_type_name();
                        //GetCurrentClass_trainingsession();
                        alert(" La pièce jointe " + file_1_name.name + " a été bien enregistrée")

                    }
                    else {
                        setRecord_All_PJ_message(result['message']);
                        setRecord_All_PJ_api("false");
                    }

                })
                .catch((error) => {
                    console.error(' Record_All_PJ Error:', error);
                    setRecord_All_PJ_api("false");
                });

        }



    }


    const [Delete_one_attached_document_api, setDelete_one_attached_document_api] = useState();
    const [Delete_one_attached_document_result, setDelete_one_attached_document_result] = useState();
    const [Delete_one_attached_document_message, setDelete_one_attached_document_message] = useState();
    const Delete_one_attached_document = (event) => {
        const stored_cookie = getCookie('tokenmysypart');

        var formData = new FormData();
        var nom_fiche_detaillee = "Fiche_Detaillee.pdf";
        var file_name = event.target.id;


        formData.append("token", stored_cookie);
        formData.append("file_name", file_name);

        var url = process.env.REACT_APP_API_URL + "myclass/api/Delete_Stored_Downloaded_File/";


        fetch(
            process.env.REACT_APP_API_URL + "myclass/api/Delete_Stored_Downloaded_File/",
            {
                method: 'POST',
                body: formData,
            }
        )
            .then((response) => response.json())
            .then((result) => {

                //console.log(" ## result['status'] = ", result['status'])
                if (String(result['status']) === String("true")) {
                    //console.log('Success:', result['message']);
                    setDelete_one_attached_document_result(result['message']);
                    setDelete_one_attached_document_api("true");
                    Get_List_Of_All_PJ(props.client_id);
                    alert(result['message'])

                }
                else {
                    setDelete_one_attached_document_message(result['message']);
                    setDelete_one_attached_document_api("false");
                }

            })
            .catch((error) => {
                console.error(' Record_All_PJ Error:', error);
                setDelete_one_attached_document_api("false");
                alert(" Impossible de supprimer le document")

            });


    }

    const [Get_List_Of_All_PJ_api, setGet_List_Of_All_PJ_api] = useState();
    const [Get_List_Of_All_PJ_result, setGet_List_Of_All_PJ_result] = useState();
    const [Get_List_Of_All_PJ_message, setGet_List_Of_All_PJ_message] = useState();
    function Get_List_Of_All_PJ(local_employee_id) {

        const formData = new FormData();

        //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA');
        const stored_cookie = getCookie('tokenmysypart');

        formData.append("token", stored_cookie);
        formData.append("object_owner_collection", "groupe_inscription");
        formData.append("object_owner_id", selected_id);


        //formData.append("class_internal_url", internal_url);
        //console.log("token = " + stored_cookie);


        fetch(
            process.env.REACT_APP_API_URL + "myclass/api/Get_List_object_owner_collection_Stored_Files/",
            {
                method: 'POST',
                body: formData,
            }
        )
            .then((response) => response.json())
            .then((result) => {

                //console.log(" ## result['status'] = ", result['status'])
                if (String(result['status']) === String("true")) {
                    //console.log('Message :', result['message']);
                    setGet_List_Of_All_PJ_result(result['message']);
                    setGet_List_Of_All_PJ_api("true");

                }
                else {
                    setGet_List_Of_All_PJ_message(result['message']);
                    setGet_List_Of_All_PJ_api("false");
                }

            })
            .catch((error) => {
                console.error(' Get_List_Of_All_PJ Error:', error);
                setGet_List_Of_All_PJ_api("false");
            });

    }



    function Delete_file_1_name() {
        setfile_1_name();
    }

    function Delete_file_2_name() {
        setfile_2_name();
    }

    const [p_detail_one_file_to_download_type_name, setp_detail_one_file_to_download_type_name] = useState();

    // -- end gestion pièces jointes


    const [actionmass_equipe_membre_val, setactionmass_equipe_membre_val] = useState("");
    const [Dialog_Equipe_Membre_message, setDialog_Equipe_Membre_message] = React.useState(false);
    const [Dialog_Equipe_Membre_open, setDialog_Equipe_Membre_open] = React.useState(false);


    const Dialog_Equipe_Membre_handleClose = () => {
        //alert(" Utiliser le bouton 'fermer' ");
        //setOpen(false);
    };

    const Dialog_Equipe_Membre_handleClose_buton = () => {

        setDialog_Equipe_Membre_open(false);
        settab_selected_users([]);
        setp_detail_member_role("");


    };

    const fixedVal = [];
    const [tab_selected_users, settab_selected_users] = useState([...fixedVal]);


    const [Delete_List_Membre_From_Equipe_api, setDelete_List_Membre_From_Equipe_api] = useState();
    const [Delete_List_Membre_From_Equipe_message, setDelete_List_Membre_From_Equipe_message] = useState();
    const [Delete_List_Membre_From_Equipe_result, setDelete_List_Membre_From_Equipe_result] = useState();
    function Delete_List_Membre_From_Equipe(local_tab_ids) {


        var form = new FormData();

        const stored_cookie = getCookie('tokenmysypart');
        form.append("token", stored_cookie);
        form.append("equipe_id", selected_id);
        form.append("tab_ids", local_tab_ids);


        var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_Equipe_Team_Membre/";
        setLoading(true);

        axios.post(myurl, form).then(res => {
            //console.log(" In Delete_List_Membre_From_Equipe  res.data.status = " + res.data.status);
            //console.log(" In Delete_List_Membre_From_Equipe  res.data.message r_class = " + res.data.message);

            setLoading(false);

            if (String(res.data.status) === String("true")) {
                setDelete_List_Membre_From_Equipe_api("true");
                setDelete_List_Membre_From_Equipe_result(res.data.message);

                var line = New_Getall_Partner_Equipe_Team_result[gridline_id];
                Get_Given_Equipe_Data(line._id);

                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("success");
                submenu_membres()
            }
            else {
                setDelete_List_Membre_From_Equipe_api("false");
                setDelete_List_Membre_From_Equipe_message(res.data.message);
                // alert(res.data.message);
                setdisplay_alert_mysy("1");
                setalert_message(res.data.message);
                setalert_type("error");

            }

        }).catch((error) => {
            setLoading(false);
            console.warn('Delete_List_Membre_From_Equipe : Not good man :( mysearchtext = ' + error);
            setDelete_List_Membre_From_Equipe_api("false");
            alert(" Impossible de supprimer les membres");
        })
    }



    return (
        <div className="equipe_team">
            {isLoading && <div className="loader-container">
                <div className="mysy_spinner">  <img src={img_loading_spin} />  </div>
            </div>}

            {/***  Affichage des messages d'alerte*/}
            {display_alert_mysy && String(display_alert_mysy) === "1" &&
                <Module_Alert_Confirmation alert_message={alert_message}
                    alert_type={alert_type}
                    clear_alert_message={clear_alert_message}
                    clear_alert_type={clear_alert_type}
                    clear_display_alert_mysy={clear_display_alert_mysy}
                />
            }
            {/*** FIN Affichage des messages d'alerte*/}

            {/*** Dialog Gestion membre */}

            <Dialog
                open={Dialog_Equipe_Membre_open}
                // onClose={Dialog_Equipe_Membre_handleClose}

                className="displaypartnersession"
                static
                onClose={() => null}

                PaperProps={{


                    className: classes.paper, // Apply the paper style
                    style: {
                        overflowY: 'unset',
                        position: 'absolute',
                        top: '5rem',
                        margin: "2px",
                    },
                }}
                hideBackdrop={true}
                disableScrollLock
                classes={{
                    paper: classes.dialog
                }}

                PaperComponent={PaperComponent}
                aria-labelledby="draggable-dialog-title"
            >

                <DialogTitle style={{ cursor: 'move', fontFamily: "DM Sans" }} id="draggable-dialog-title">  Ajout membre </DialogTitle>
                <DialogContent className="DialogContent_width">
                    <DialogContentText>

                    </DialogContentText>



                    <div className="session_caract_Dialog" >  <b>Nouveau membre  </b> <br />
                        {New_Employee_Not_Member && New_Employee_Not_Member.length > 0 &&
                            <Autocomplete
                                disablePortal

                                name="filtre1_value"
                                id="filtre1_value"
                                className="disabled_style remove_border_bottom"
                                //options={New_Getall_Training_Employee_No_Filter_result}

                                options={New_Employee_Not_Member}
                                //value={selected_employee_id}
                                value={tab_selected_users}
                                multiple


                                onChange={(event, value) => {

                                    settab_selected_users([
                                        ...fixedVal,
                                        ...value.filter((i) => fixedVal.indexOf(i) === -1),
                                    ]);


                                }}

                                renderInput={(params) => <TextField {...params} label="Choisir  " />
                                }
                            />
                        }

                    </div>

                    <div className="div_row_dialog">
                        <div className="session_caract_Dialog" >  Rôle <br />
                            <TextField
                                //  autoFocus
                                margin="dense"
                                id="secrete_key"
                                className="disabled_style remove_border_bottom"
                                value={p_detail_member_role}
                                onChange={(e) => {
                                    setp_detail_member_role(e.target.value);

                                }
                                }
                            />
                        </div>
                    </div>


                </DialogContent>


                <DialogActions>
                    <div className="div_row">
                        <div className="div_row_gauche">

                            <Button onClick={Add_Member_To_Equipe} className="bton_enreg_dialog">Ajouter</Button>
                        </div>

                        <div className="div_row_droite" style={{ "textAlign": 'center' }}>
                            <Button onClick={Dialog_Equipe_Membre_handleClose_buton} className="bton_annule_dialog" >Fermer</Button>
                        </div>



                    </div>
                    <IconButton
                        autoFocus
                        onClick={Dialog_Equipe_Membre_handleClose_buton}
                        color="primary"
                        className={classes.customizedButton}
                    >
                        <CancelPresentationIcon />
                    </IconButton>

                </DialogActions>

            </Dialog>

            {/*** Fin ajout  Dialog Gestion membre */}




            <h3 style={{ fontFamily: 'DM Sans' }}> Gestion des équipes </h3>

            <div className="div_row">
                <div className="titre1">  Utilisez les filtres !</div>
                <div className="div_row" style={{ "marginBottom": "5px" }}>
                    <div className="div_row_gauche texte_area_filter" >

                        {New_Option_Filter && New_Option_Filter.length > 0 && <Autocomplete
                            disablePortal
                            name="filtre1"
                            id="filtre1"
                            className="disabled_style"
                            value={New_Option_Filter.filter((data) => (data).value === String(p_filtre1))[0].label}
                            options={New_Option_Filter}
                            onChange={(event, value) => {
                                if (value && value.value) {
                                    setp_filtre1(value.value);

                                }

                            }}

                            renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
                                inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}

                            />
                            }
                        />}


                    </div>



                    <div className="div_row_droite texte_area_filter_value" >
                        {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_value("");
                                                }} />
                                        </InputAdornment>
                                    ),
                                }}

                            />

                        }
                    </div>
                    {p_filtre1 && <div className='filter_bton_add'>
                        <Tooltip className="tooltip_css" id="my-tooltip01" style={{ "fontSize": "12px" }} />
                        <a data-tooltip-id="my-tooltip01" data-tooltip-html="Ajouter une nouvelle ligne de filtre">
                            &nbsp; <MdAddCircleOutline onClick={(e) => {
                                setp_filtre2("1");
                                setp_filtre2_value("");
                            }} />
                        </a>
                    </div>}
                    {p_filtre1 && <div className='filter_bton_add'>
                        <Tooltip className="tooltip_css" id="my-tooltip02" style={{ "fontSize": "12px" }} />
                        <a data-tooltip-id="my-tooltip02" data-tooltip-html="Supprimer cette ligne de filtre">
                            &nbsp; <MdRemoveCircleOutline onClick={(e) => {
                                setp_filtre1("");
                                setp_filtre1_value("");
                            }}
                            />
                        </a>
                    </div>}


                </div>

                {p_filtre2 &&
                    <div className="div_row" style={{ "marginBottom": "5px" }}>
                        <div className="div_row_gauche texte_area_filter">

                            {New_Option_Filter && New_Option_Filter.length > 0 && <Autocomplete
                                disablePortal
                                name="filtre2"
                                id="filtre2"
                                className="disabled_style"
                                value={New_Option_Filter.filter((data) => (data).value === String(p_filtre2))[0].label}
                                options={New_Option_Filter}
                                onChange={(event, value) => {
                                    if (value && value.value) {
                                        setp_filtre2(value.value);

                                    }

                                }}

                                renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
                                    inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}

                                />
                                }
                            />}

                        </div>
                        <div className="div_row_droite texte_area_filter_value" style={{ "marginTop": "0.5rem" }}>
                            {String(p_filtre2).length > 2 &&
                                <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_value("");
                                                    }} />
                                            </InputAdornment>
                                        ),
                                    }}

                                />}
                        </div>

                        {String(p_filtre2).length > 2 && <div className='filter_bton_add' >
                            <Tooltip className="tooltip_css" id="my-tooltip03" style={{ "fontSize": "12px" }} />
                            <a data-tooltip-id="my-tooltip03" data-tooltip-html="Ajouter une nouvelle ligne de filtre">
                                &nbsp; <MdAddCircleOutline
                                    onClick={(e) => {
                                        setp_filtre3("1");
                                        setp_filtre3_value("");
                                    }}
                                />
                            </a>
                        </div>}

                        {String(p_filtre2).length > 2 && <div className='filter_bton_add'>
                            <Tooltip className="tooltip_css" id="my-tooltip04" style={{ "fontSize": "12px" }} />
                            <a data-tooltip-id="my-tooltip04" data-tooltip-html="Supprimer cette ligne de filtre">
                                &nbsp; <MdRemoveCircleOutline
                                    onClick={(e) => {
                                        setp_filtre2("");
                                        setp_filtre2_value("");
                                    }}
                                />
                            </a>
                        </div>}

                    </div>
                }


                {p_filtre3 &&
                    <div className="div_row" style={{ "marginBottom": "5px" }}>
                        <div className="div_row_gauche texte_area_filter">

                            {New_Option_Filter && New_Option_Filter.length > 0 && <Autocomplete
                                disablePortal
                                name="filtre3"
                                id="filtre3"
                                className="disabled_style"
                                value={New_Option_Filter.filter((data) => (data).value === String(p_filtre3))[0].label}
                                options={New_Option_Filter}
                                onChange={(event, value) => {
                                    if (value && value.value) {
                                        setp_filtre3(value.value);

                                    }

                                }}

                                renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
                                    inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}

                                />
                                }
                            />}


                        </div>
                        <div className="div_row_droite texte_area_filter_value" style={{ "marginTop": "0.5rem" }}>
                            {String(p_filtre3).length > 2 &&
                                <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_value("");
                                                    }} />
                                            </InputAdornment>
                                        ),
                                    }}

                                />}
                        </div>

                        {String(p_filtre2).length > 2 && <div className='filter_bton_add' >
                            <Tooltip className="tooltip_css" id="my-tooltip03" style={{ "fontSize": "12px" }} />
                            <a data-tooltip-id="my-tooltip03" data-tooltip-html="Ajouter une nouvelle ligne de filtre">
                                &nbsp; <MdAddCircleOutline
                                    onClick={(e) => {
                                        setp_filtre4("1");
                                        setp_filtre4_value("");
                                    }}
                                />
                            </a>
                        </div>}

                        {String(p_filtre3).length > 2 && <div className='filter_bton_add'>
                            <Tooltip className="tooltip_css" id="my-tooltip05" style={{ "fontSize": "12px" }} />
                            <a data-tooltip-id="my-tooltip05" data-tooltip-html="Supprimer cette ligne de filtre">
                                &nbsp; <MdRemoveCircleOutline onClick={(e) => {
                                    setp_filtre3("");
                                    setp_filtre3_value("");
                                }} />
                            </a>
                        </div>}
                    </div>
                }


                <div className="div_row" ref={myRef_head} id="myRef_head" 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_Partner_Equipe_With_Filter}>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>

                <br />
            </div>

            <div className="div_row" style={{ paddingRight: '10px' }}>

                <div className="session_data">
                    <div style={{ "border": "None" }}>

                        <div style={{ height: 550, width: '100%', paddingRight: '5px' }}>

                            &nbsp;
                            <Box
                                sx={{
                                    height: 500,
                                    width: '100%',
                                    paddingRight: '1px',

                                    // Gestion des cellule a distance ou presentiel
                                    '& .cell--distantiel': {
                                        backgroundColor: '#AFE1AF',
                                        color: 'black',
                                    },

                                    '& .cell--presentiel': {
                                        backgroundColor: '#AFE1AF',
                                        color: 'black',
                                    },


                                    // gestion couleur des lignes avec le statut d'inscription
                                    '& .line--statut--annule': {
                                        backgroundColor: '#D8D8D8',
                                        color: 'white',
                                    },

                                    '& .line--statut--inscrit': {
                                        backgroundColor: '#CEF6D8',
                                        color: 'black',
                                    },
                                    '& .line--statut--preinscrit': {
                                        backgroundColor: '#F7F2E0',
                                        color: 'black',
                                    },

                                    "& .MuiDataGrid-columnHeaders": {
                                        backgroundColor: "#c8cfd5",
                                        color: "black",
                                        fontSize: 14
                                    },

                                    '& .line--statut--selected': {
                                        backgroundColor: '#FBF2EF',
                                        color: 'black',
                                    },
                                    '& .line--statut--pair': {
                                        backgroundColor: 'rgba(235, 235, 235, .7)',
                                        color: 'black',
                                    },
                                    '& .line--statut--impair': {
                                        backgroundColor: '#FFFFFF',
                                        color: 'black',
                                    },
                                    [`& .${gridClasses.cell}`]: {
                                        py: 1,
                                    },


                                }}
                            >
                                <DataGrid
                                    checkboxSelection

                                    components={{
                                        Toolbar: CustomToolbar
                                    }}
                                    componentsProps={{ toolbar: { data_colums: columns_equipe } }}

                                    onSelectionModelChange={(newSelectionModel) => {
                                        setselectionModel_columns_equipe(newSelectionModel);
                                        /*if (newSelectionModel.length === 1)
                                            handleClick_edit_employee_From_Line(newSelectionModel);*/
                                        if (newSelectionModel.length !== 1) {
                                            /*  setsubmenu();
                                              setdisplay_detail_employe();
                                              setadd_One_Employee();*/
                                        }
                                    }}
                                    selectionModel={selectionModel_columns_equipe}

                                    localeText={frFR.components.MuiDataGrid.defaultProps.localeText}
                                    rows={Getall_Partner_Equipe_Team_result.map((item, index) => (
                                        {
                                            id: index,
                                            _id: JSON.parse(item)._id,
                                            chef_equipe_id: JSON.parse(item).chef_equipe_id,
                                            code: JSON.parse(item).code,
                                            email_equipe: JSON.parse(item).email_equipe,
                                            description: JSON.parse(item).description,
                                            chef_equipe_nom_prenom: JSON.parse(item).chef_equipe_nom_prenom,
                                            nb_membre: JSON.parse(item).nb_membre,

                                        }
                                    ))}

                                    columns={columns_equipe}
                                    pageSize={10}
                                    className="datagridclass"

                                    onRowDoubleClick={(newSelectionModel) => {
                                        setselected_id(newSelectionModel.row._id);
                                        setgridline_id(newSelectionModel.row.id);

                                        setselectionModel_columns_equipe_membre([]);
                                        setactionmass_equipe_membre_val("");

                                        handleClick_edit_equipe_From_Line(newSelectionModel.row.id);


                                    }}

                                    rowsPerPageOptions={[10]}
                                    disableSelectionOnClick
                                    /*     components={{
                                             Toolbar: GridToolbar,
                                         }}*/
                                    //sx={datagridSx}
                                    getCellClassName={(params) => {



                                    }}
                                    getRowClassName={(params) => {
                                        // Pour la gestion de la couleur de zone double cliquée
                                        if (String(params.row.id) === String(gridline_id)) {
                                            return 'line--statut--selected';
                                        }
                                        else if (parseInt(String(params.row.id)) % 2 === 0) {
                                            return 'line--statut--pair';
                                        }
                                        else if (parseInt(String(params.row.id)) % 2 !== 0) {
                                            return 'line--statut--impair';
                                        }


                                    }}
                                    getEstimatedRowHeight={() => 200}
                                    getRowHeight={() => "auto"}
                                    sx={{
                                        "& .MuiDataGrid-cellContent": {
                                            minHeight: 50,

                                        }
                                    }}

                                />
                            </Box>
                            <br />

                        </div>

                        <div className="div_row">

                            {selectionModel_columns_equipe && selectionModel_columns_equipe.length >= 1 && <div className="block_en_mass">
                                <nav >Traitement en masse </nav>
                                &nbsp;
                                <Autocomplete
                                    disablePortal
                                    id="combo-box-demo"
                                    className="block_en_mass_select"
                                    fullWidth
                                    options={New_Option}
                                    onChange={(event, value) => {
                                        if (value && value.value) {
                                            if (String(value.value) === "supprimer"
                                                || String(value.value) === "dupliquer" || String(value.value) === "exporter"
                                                || String(value.value) === "inscrire") {
                                                setactionmass_ftion_val(value.value);
                                            }
                                            else {
                                                setactionmass_ftion_val();
                                            }

                                        }

                                    }}

                                    renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
                                        inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}

                                    />
                                    }
                                />



                                {actionmass_ftion_val && <nav className='block_en_mass_bton_action'>
                                    <Popup
                                        trigger={<Button className="bton_enreg" style={{ "width": "90%" }}>

                                            <FcAcceptDatabase /> Traiter

                                        </Button>}
                                        modal
                                        nested
                                        position="center center"

                                    >

                                        {close => (
                                            <div>
                                                <button className="gest_close" onClick={close}>
                                                    &times;
                                                </button>
                                                <div className="gest_header"> MySy Information - {actionmass_ftion_val} </div>
                                                <div className="gest_content">
                                                    {' '}
                                                    {String(actionmass_ftion_val) === "supprimer" &&
                                                        <font color="red"> Confirmer la suppression de {selectionModel_columns_equipe.length} membre(s) .
                                                        </font>}




                                                </div>
                                                <div className="gest_actions">
                                                    <div style={{ "width": "45%", "float": "left" }}>
                                                        <button className="gest_bton_popup" onClick={(event) => {
                                                            //   actionmass_ftion_Traitemet();
                                                            close();
                                                        }}> Valider </button>

                                                    </div>
                                                    <div style={{ "width": "45%", "float": "right" }}>
                                                        <button
                                                            className="gest_bton_popup"
                                                            onClick={() => {
                                                                //console.log('modal closed ');
                                                                close();
                                                            }}
                                                        >
                                                            Annuler
                                                        </button>
                                                    </div>
                                                </div>
                                            </div>
                                        )}
                                    </Popup>
                                </nav>
                                }

                            </div>}
                        </div>
                    </div>
                </div>

                <div className="div_row" style={{ "border": "None" }} id="bton_gestion_grp" name="bton_gestion_grp">

                    <div className="div_row_gauche div_row_gauche_etendu" style={{ "textAlign": "left", "paddingLeft": "5px" }}>

                        &nbsp;

                        <Button variant="outlined" onClick={Ajout_1_equipe}
                            className="detail_class_submenu bton_add_session"
                            id='menu_import_participant' name='menu_import_participant'>Ajout 1 Equipe &nbsp;
                            <IoAddCircleOutline style={{ "fontSize": "x-large", "color": "green" }} />
                        </Button>

                    </div>
                </div>

            </div>

            <div className="div_row" ref={myRef} id="myRef"> &nbsp; </div>

            {selected_id && String(selected_id).length > 5 && <div className="div_row">
                <Button variant="outlined" onClick={submenu_detail} className="detail_class_submenu" id='detail_equipe' name='detail_equipe'>Détail équipe</Button>
                <Button variant="outlined" onClick={submenu_membres} className="detail_class_submenu" id='membres' name='membres'>Membres </Button>
                <Button variant="outlined" onClick={submenu_piece_jointe} className="detail_class_submenu" id='piece_jointe' name='piece_jointe'>Pièces Jointes  </Button>
                {String(history_securite_read) === "1" && <Button variant="outlined" onClick={submenu_historique} className="detail_class_submenu" id='historique' name='historique'>Historique   </Button>}

            </div>}


            {String(submenu) === "detail_equipe" && <div>

                {String(display_equipe) === "1" && String(add_one_equipe) !== "1" && <div className="div_row session_data">

                    <nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600", "paddingTop": "10px", "paddingLeft": "5px" }}> Détail Groupe </nav>

                    {String(equipe_data_edit_mode) !== "1" && <div>

                        <div>
                            <div className="session_caract"> <b> Code </b> <br />
                                <TextField
                                    sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
                                    required
                                    name="detail_code"
                                    id="detail_code"

                                    InputLabelProps={{
                                        shrink: true,
                                    }}
                                    disabled={false}
                                    className="disabled_style"
                                    value={p_detail_code}

                                />

                            </div>



                            <div className="session_caract"> Description  <br />
                                <TextField
                                    sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
                                    required
                                    name="detail_description"
                                    id="detail_description"

                                    InputLabelProps={{
                                        shrink: true,
                                    }}
                                    disabled={false}
                                    className="disabled_style"
                                    value={p_detail_description}

                                />

                            </div>

                            <div className="session_caract"> Email Diffusion  <br />
                                <TextField
                                    sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
                                    required
                                    name="detail_email_diffusion"
                                    id="detail_email_diffusion"

                                    InputLabelProps={{
                                        shrink: true,
                                    }}
                                    disabled={false}
                                    className="disabled_style"
                                    value={p_detail_email_equipe}

                                />

                            </div>

                            <div className="session_caract"> <b> Responsable  </b> <br />
                                {New_Getall_Training_Employee_No_Filter_result && New_Getall_Training_Employee_No_Filter_result.length > 0 &&

                                    <TextField
                                        sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
                                        required
                                        name="detail_responsable"
                                        id="detail_responsable"

                                        InputLabelProps={{
                                            shrink: true,
                                        }}
                                        disabled={false}
                                        className="disabled_style"
                                        value={New_Getall_Training_Employee_No_Filter_result.filter((data) => (data)._id === String(p_detail_chef_equipe_id))[0].label}

                                    />
                                }

                            </div>



                            <div className="div_row" style={{ "border": "None" }}>
                                &nbsp;
                            </div>
                        </div>



                    </div>}


                    {String(equipe_data_edit_mode) === "1" && <div>

                        <div>
                            <div className="session_caract"> <b> Code </b> <br />
                                <TextField
                                    sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
                                    required
                                    name="detail_code"
                                    id="detail_code"

                                    InputLabelProps={{
                                        shrink: true,
                                    }}
                                    disabled={false}
                                    className="disabled_style"
                                    value={p_detail_code}
                                    onChange={(e) => {
                                        setp_detail_code(e.target.value);
                                        setequipe_data_changed("1");

                                    }
                                    }
                                />

                            </div>



                            <div className="session_caract"> Description  <br />
                                <TextField
                                    sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
                                    required
                                    name="detail_description"
                                    id="detail_description"

                                    InputLabelProps={{
                                        shrink: true,
                                    }}
                                    disabled={false}
                                    className="disabled_style"
                                    value={p_detail_description}
                                    onChange={(e) => {
                                        setp_detail_description(e.target.value);
                                        setequipe_data_changed("1");

                                    }
                                    }
                                />

                            </div>
                            <div className="session_caract"> Email Diffusion  <br />
                                <TextField
                                    sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
                                    required
                                    name="detail_email_diffusion"
                                    id="detail_email_diffusion"

                                    InputLabelProps={{
                                        shrink: true,
                                    }}
                                    disabled={false}
                                    className="disabled_style"
                                    value={p_detail_email_equipe}
                                    onChange={(e) => {
                                        setp_detail_email_equipe(e.target.value);
                                        setequipe_data_changed("1");

                                    }
                                    }

                                />

                            </div>

                            <div className="session_caract"> <b> Responsable  </b> <br />
                                {New_Getall_Training_Employee_No_Filter_result && New_Getall_Training_Employee_No_Filter_result.length > 0 &&

                                    <Autocomplete
                                        disablePortal
                                        name="detail_responsable"
                                        id="detail_responsable"
                                        className="disabled_style"
                                        //className="disabled_style enable_style"
                                        options={New_Getall_Training_Employee_No_Filter_result}
                                        value={New_Getall_Training_Employee_No_Filter_result.filter((data) => (data)._id === String(p_detail_chef_equipe_id))[0].label}
                                        onChange={(event, value) => {
                                            if (value && value._id) {
                                                setp_detail_chef_equipe_id(value._id);
                                            } else {
                                                setp_detail_chef_equipe_id("");
                                            }

                                            setequipe_data_changed("1");

                                        }}

                                        renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
                                            inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}

                                        />
                                        }
                                    />

                                }

                            </div>


                            <div className="div_row" style={{ "border": "None" }}>
                                &nbsp;
                            </div>

                        </div>
                        <div className="div_row" style={{ "border": "None" }}>
                            &nbsp;
                        </div>
                    </div>}

                    <div className="div_row" style={{ "border": "None" }}>
                        &nbsp;
                    </div>
                    <div className="div_row" style={{ "border": "None" }}>
                        {String(equipe_data_changed) === "1" && String(equipe_data_edit_mode) === "1" && <div className="div_row" style={{ "border": "None", "color": "orange", "textAlign": "center" }}>
                            /!\ Pensez à enregistrer les modifications
                        </div>}


                        <div className="div_row" style={{ "border": "None", "color": "orange", "textAlign": "center" }}>

                            {String(equipe_data_edit_mode) === "1" && <div className="div_row_gauche" style={{ "textAlign": 'left', 'marginLeft': '15px' }}>

                                <Button variant="contained" className="bton_enreg" onClick={Add_Update_Equipe_Data}>Enregistrer les modifications
                                </Button>

                            </div>}

                            {String(equipe_data_edit_mode) === "1" && <div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }} >
                                <Button variant="contained" className="bton_annule" onClick={Annule_Equipe_DetailFields}>Annuler
                                </Button>
                            </div>}
                        </div>


                        {String(equipe_data_edit_mode) !== "1" && <div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }}>

                            <Button variant="contained" className="bton_edit" onClick={Enable_Equipe_DetailFields}>Editer
                            </Button>

                        </div>}
                        <div className="div_row" style={{ "border": "None" }}>
                            &nbsp;
                        </div>
                    </div>
                </div>}

                {String(add_one_equipe) === "1" && String(display_equipe) !== "1" && <div className="div_row session_data">
                    <nav style={{ "border": "None", "fontSize": "22px", "fontWeight": "600", "paddingTop": "10px", "paddingLeft": "5px" }}>  Ajouter une nouvelle équipe </nav>

                    <div>

                        <div>
                            <div className="session_caract"> <b> Code </b> <br />
                                <TextField
                                    sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
                                    required
                                    name="detail_code"
                                    id="detail_code"

                                    InputLabelProps={{
                                        shrink: true,
                                    }}
                                    disabled={false}
                                    className="disabled_style"
                                    value={p_detail_code}
                                    onChange={(e) => {
                                        setp_detail_code(e.target.value);

                                    }
                                    }
                                />

                            </div>



                            <div className="session_caract"> Description  <br />
                                <TextField
                                    sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
                                    required
                                    name="detail_description"
                                    id="detail_description"

                                    InputLabelProps={{
                                        shrink: true,
                                    }}
                                    disabled={false}
                                    className="disabled_style"
                                    value={p_detail_description}
                                    onChange={(e) => {
                                        setp_detail_description(e.target.value);

                                    }
                                    }
                                />

                            </div>

                            <div className="session_caract"> Email Diffusion  <br />
                                <TextField
                                    sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
                                    required
                                    name="detail_email_diffusion"
                                    id="detail_email_diffusion"

                                    InputLabelProps={{
                                        shrink: true,
                                    }}
                                    disabled={false}
                                    className="disabled_style"
                                    value={p_detail_email_equipe}
                                    onChange={(e) => {
                                        setp_detail_email_equipe(e.target.value);

                                    }
                                    }
                                />

                            </div>

                            <div className="session_caract"> <b> Responsable  </b> <br />
                                {New_Getall_Training_Employee_No_Filter_result && New_Getall_Training_Employee_No_Filter_result.length > 0 &&

                                    <Autocomplete
                                        disablePortal
                                        name="detail_responsable"
                                        id="detail_responsable"
                                        className="disabled_style"
                                        //className="disabled_style enable_style"
                                        options={New_Getall_Training_Employee_No_Filter_result}
                                        value={New_Getall_Training_Employee_No_Filter_result.filter((data) => (data)._id === String(p_detail_chef_equipe_id))[0].label}
                                        onChange={(event, value) => {
                                            if (value && value._id) {
                                                setp_detail_chef_equipe_id(value._id);
                                            } else {
                                                setp_detail_chef_equipe_id("");
                                            }

                                        }}

                                        renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
                                            inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}

                                        />
                                        }
                                    />

                                }

                            </div>

                            <div className="div_row" style={{ "border": "None" }}>
                                &nbsp;
                            </div>

                        </div>

                    </div>

                    <div className="div_row" style={{ "border": "None" }}>
                        &nbsp;
                    </div>
                    <div className="div_row" style={{ "border": "None" }}>

                        <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={Add_Update_Equipe_Data}>Enregistrer
                                </Button>

                            </div>

                            <div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }} >
                                <Button variant="contained" className="bton_annule" onClick={Annule_Add_One_Equipe_DetailFields} >Annuler
                                </Button>
                            </div>
                        </div>

                        <div className="div_row" style={{ "border": "None" }}>
                            &nbsp;
                        </div>
                    </div>

                </div>}

            </div>}

            {String(submenu) === "membre" && <div className="div_row ">

                <div className="div_row" style={{ paddingRight: '10px' }}>
                    <div className="session_data">
                        <div style={{ "border": "None" }}>

                            <nav style={{ "border": "None", "fontSize": "20px", "paddingTop": "5px", "paddingLeft": "5px" }}> Membres d'équipe </nav>

                            <div style={{ height: 650, width: '100%', paddingRight: '5px' }}>

                                &nbsp;
                                <Box
                                    sx={{
                                        height: 500,
                                        width: '100%',
                                        paddingRight: '1px',



                                        '& .cell--note': {
                                            backgroundColor: '#AFE1AF',
                                            color: 'red',
                                        },

                                        "& .MuiDataGrid-columnHeaders": {
                                            backgroundColor: "#c8cfd5",
                                            color: "black",
                                            fontSize: 14
                                        },

                                        '& .line--statut--selected': {
                                            backgroundColor: '#FBF2EF',
                                            color: 'black',
                                        },
                                        '& .line--statut--pair': {
                                            backgroundColor: 'rgba(235, 235, 235, .7)',
                                            color: 'black',
                                        },
                                        '& .line--statut--impair': {
                                            backgroundColor: '#FFFFFF',
                                            color: 'black',
                                        },

                                        '& .line--statut--noted_changed': {
                                            backgroundColor: '#F8F6B3',
                                            fontStyle: 'italic',
                                        },

                                        [`& .${gridClasses.cell}`]: {
                                            py: 1,
                                        },


                                    }}
                                >
                                    <DataGrid
                                        //onCellEditCommit={OnchangeCellDataGrid}
                                        components={{
                                            Toolbar: CustomToolbar
                                        }}
                                        componentsProps={{ toolbar: { data_colums: columns_equipe_membre } }}

                                        checkboxSelection
                                        onSelectionModelChange={(newSelectionModel) => {
                                            setselectionModel_columns_equipe_membre(newSelectionModel);
                                            /*if (newSelectionModel.length === 1)
                                                handleClick_edit_employee_From_Line(newSelectionModel);*/
                                            if (newSelectionModel.length !== 1) {
                                                /*  setsubmenu();
                                                  setdisplay_detail_employe();
                                                  setadd_One_Employee();*/
                                            }
                                        }}
                                        selectionModel={selectionModel_columns_equipe_membre}

                                        localeText={frFR.components.MuiDataGrid.defaultProps.localeText}
                                        rows={New_Getall_Equipe_Members.map((item, index) => (
                                            {
                                                id: index,
                                                _id: (item)._id,
                                                nom: (item).nom,
                                                prenom: (item).prenom,
                                                email: (item).email,
                                                comment: (item).comment,
                                                civilite: (item).civilite,
                                                leader: (item).leader,
                                                role: (item).role,

                                            }
                                        ))}

                                        columns={columns_equipe_membre}
                                        pageSize={10}
                                        className="datagridclass"

                                        onRowDoubleClick={(newSelectionModel) => {
                                            /* setselected_id(newSelectionModel.row._id);
                
                                             setgridline_id(newSelectionModel.row.id);
                
                                             handleClick_edit_evaluation_From_Line(newSelectionModel.row.id);
                                             */


                                        }}

                                        rowsPerPageOptions={[10]}
                                        disableSelectionOnClick
                                        /* components={{
                                             Toolbar: GridToolbar,
                                         }}*/
                                        //sx={datagridSx}
                                        getCellClassName={(params) => {

                                            // Traitement de la cellule 'notes' 
                                            if (String(params.field) === "note") {
                                                return 'cell--note';
                                            }

                                        }}

                                        getRowClassName={(params) => {
                                            // Pour la gestion de la couleur de zone double cliquée


                                            if (String(params.row.id) === String(gridline_equipe_member_id)) {
                                                return 'line--statut--selected';
                                            }
                                            else if (parseInt(String(params.row.id)) % 2 === 0) {
                                                return 'line--statut--pair';
                                            }
                                            else if (parseInt(String(params.row.id)) % 2 !== 0) {
                                                return 'line--statut--impair';
                                            }


                                        }}
                                        getEstimatedRowHeight={() => 200}
                                        getRowHeight={() => "auto"}
                                        sx={{
                                            "& .MuiDataGrid-cellContent": {
                                                minHeight: 50,

                                            }
                                        }}

                                    />
                                </Box>
                                {selectionModel_columns_equipe_membre && selectionModel_columns_equipe_membre.length >= 1 &&
                                    <div className="div_row" style={{ "border": "none", "marginLeft": "10px" }}>
                                        <div className="block_en_mass">
                                            <nav className='traitement_mass'>Traitement en masse</nav>
                                            &nbsp;

                                            <Autocomplete
                                                disablePortal
                                                id="combo-box-demo"
                                                className="block_en_mass_select"
                                                fullWidth
                                                options={New_Option_equipe_membre}
                                                onChange={(event, value) => {
                                                    if (value && value.value) {
                                                        if (String(value.value) === "delete_equipe_membre") {
                                                            setactionmass_equipe_membre_val(value.value);
                                                        }
                                                        else {
                                                            setactionmass_equipe_membre_val("");
                                                        }
                                                    }
                                                    else {
                                                        setactionmass_equipe_membre_val("");
                                                    }

                                                }}

                                                renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
                                                    inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}

                                                />
                                                }
                                            />
                                            &nbsp;


                                            {actionmass_equipe_membre_val && String(actionmass_equipe_membre_val).length > 1 && <nav className='block_en_mass_bton_action'>
                                                <Popup
                                                    trigger={<Button className="bton_enreg" style={{ "width": "90%" }}>
                                                        <FcAcceptDatabase /> Traiter

                                                    </Button>}
                                                    modal
                                                    nested
                                                    position="center center"
                                                >

                                                    {close => (
                                                        <div>
                                                            <button className="gest_close" onClick={close}>
                                                                &times;
                                                            </button>
                                                            <div className="gest_header"> MySy Information </div>
                                                            <div className="gest_content">
                                                                {' '}
                                                                {String(actionmass_equipe_membre_val) === "delete_equipe_membre" &&
                                                                    <font>  Confirmer la <b> supprression des membres </b> en masse pour {selectionModel_columns_equipe_membre.length} ligne(s).
                                                                    </font>}


                                                            </div>
                                                            <div className="gest_actions">
                                                                <div style={{ "width": "45%", "float": "left" }}>
                                                                    <button className="gest_bton_popup" onClick={(event) => {
                                                                        actionmass_equipe_membre_Traitemet();
                                                                        close();
                                                                    }}> Valider </button>

                                                                </div>
                                                                <div style={{ "width": "45%", "float": "right" }}>
                                                                    <button
                                                                        className="gest_bton_popup"
                                                                        onClick={() => {
                                                                            //console.log('modal closed ');
                                                                            close();
                                                                        }}
                                                                    >
                                                                        Annuler
                                                                    </button>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    )}
                                                </Popup>
                                            </nav>
                                            }
                                            <br />

                                        </div>

                                    </div>}
                                <br />


                            </div>



                            <div className="div_row"> &nbsp; </div>

                            <div className="div_row" style={{ "border": "None" }} id="bton_gestion_grp" name="bton_gestion_grp">

                                <div className="div_row_gauche div_row_gauche_etendu" style={{ "textAlign": "left", "paddingLeft": "5px" }}>

                                    &nbsp;

                                    <Button variant="outlined" onClick={(event) => {
                                        setDialog_Equipe_Membre_open(true);
                                    }}

                                        className="detail_class_submenu bton_add_session"
                                        id='menu_import_participant' name='menu_import_participant'>Ajout Membre(s) &nbsp;
                                        <IoAddCircleOutline style={{ "fontSize": "x-large", "color": "green" }} />
                                    </Button>

                                </div>
                            </div>

                        </div>
                    </div>


                </div>


            </div>}


            {String(submenu) === "piece_jointe" && <div className="div_row ">
                <div className="div_row session_data">
                    <div className="div_row" style={{ "padding": "5px", 'paddingTop': '15px' }}>

                        <div style={{ "fontSize": "12px" }}>
                            <label htmlFor="upload-photo">
                                <input
                                    style={{ display: "none" }}
                                    id="upload-photo"
                                    name="upload-photo"
                                    type="file"
                                    onChange={sessions_file_change_1}
                                />

                                <Fab
                                    color="secondary"
                                    size="small"
                                    component="span"
                                    aria-label="add"
                                    variant="extended"
                                >
                                    <IoMdAddCircle /> <nav style={{ "fontSize": "12px" }}> Ajouter un fichier </nav>
                                </Fab>

                            </label>
                        </div>
                        {file_1_name && file_1_name.name &&
                            <nav style={{ "fontSize": "12px" }}>
                                <div className="session_caract">Nom du fichier <br />
                                    <TextField
                                        name="file_to_download_type_name"
                                        id="file_to_download_type_name"

                                        InputLabelProps={{
                                            shrink: true,
                                        }}

                                        disabled={false}
                                        className="disabled_style enable_style"
                                        value={p_detail_one_file_to_download_type_name}
                                        onChange={(e) => {
                                            setp_detail_one_file_to_download_type_name(e.target.value);

                                        }}
                                    />

                                </div>
                                <br />
                                <br />
                                Fichier : {file_1_name.name} <br /> <font style={{ "cursor": "pointer" }}
                                    onClick={Delete_file_1_name}>  Supprimer <IoIosRemoveCircleOutline />  </font>
                            </nav>}

                        {Record_All_PJ_api && String(Record_All_PJ_api) === "true" && <div className="okUpdateData"> Pièce jointe enregistrée </div>}

                        {Record_All_PJ_api && String(Record_All_PJ_api) === "false" && <div className="koUpdateData"> {Record_All_PJ_message} </div>}


                    </div>



                    {file_1_name && file_1_name.name && <div className="div_row">

                        <div className="div_row_gauche">
                            <Button variant="contained" onClick={Record_All_PJ}
                                startIcon={<AiTwotoneSave />} className="bton_enreg">ENREGISTRER LA PIECE</Button>
                        </div>



                    </div>}

                    {Get_List_Of_All_PJ_result && <div className="div_row" style={{ "padding": "5px" }}>
                        <div className="div_row">
                            <b> Liste des pièces jointes </b> <br />
                            <div className="div_row">
                                {Get_List_Of_All_PJ_result && Get_List_Of_All_PJ_result.map((val) => (
                                    <div className="div_row_list_pj"  >
                                        <nav name={(JSON.parse(val).file_name)}
                                            id={(JSON.parse(val).file_name)}> <i> <AttachFileIcon />{(JSON.parse(val).file_business_object)} </i> <br /><font style={{ "color": "green", "cursor": "pointer" }}
                                                name={(JSON.parse(val).file_name)}
                                                id={(JSON.parse(val).file_name)} onClick={Download_one_attached_document}>  Télécharger &nbsp;</font></nav>

                                        <Popup
                                            trigger={
                                                <nav style={{ "color": "red", "cursor": "pointer" }}  > Supprimer</nav>


                                            }
                                            modal
                                            nested
                                            position="center center"
                                        >
                                            {close => (
                                                <div>
                                                    <button className="gest_close" onClick={close}>
                                                        &times;
                                                    </button>
                                                    <div className="gest_header"> MySy Information </div>
                                                    <div className="gest_content">
                                                        {' '}

                                                        En confirmant cette opération, la pièce jointe sera <i><font color="red"> définitivement supprimée</font></i>. <br />


                                                    </div>
                                                    <div className="gest_actions">
                                                        <div style={{ "width": "45%", "float": "left" }}>
                                                            <button className="gest_bton_popup" onClick={(event) => {

                                                                Delete_one_attached_document(event);
                                                                close();
                                                            }}
                                                                name={(JSON.parse(val).file_name)} id={(JSON.parse(val).file_name)}
                                                            > Valider </button>

                                                        </div>
                                                        <div style={{ "width": "45%", "float": "right" }}>
                                                            <button
                                                                className="gest_bton_popup"
                                                                onClick={() => {
                                                                    //console.log('modal closed ');
                                                                    close();
                                                                }}
                                                            >
                                                                Annuler
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>
                                            )}
                                        </Popup>

                                    </div>
                                ))}
                            </div>
                        </div>
                    </div>}
                </div>
                <div className="div_row" style={{ "border": "None" }}>
                    &nbsp;
                </div>
            </div>}


            {String(submenu) === "historique" && <div className="div_row ">
                <Module_Historique_Action related_collection="equipe_team"
                    related_collection_recid={selected_id}
                    read_access={props.read_access}
                    write_access={props.write_access} />
            </div>}


        </div >
    );
}


export default Equipe_Team;
