813 lines
37 KiB
JavaScript
813 lines
37 KiB
JavaScript
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 CheckOut from "./CheckOut";
|
|
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
|
|
import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
|
|
import { Editor } from '@tinymce/tinymce-react';
|
|
import parse from 'html-react-parser';
|
|
import { FcViewDetails, FcDisapprove } from "react-icons/fc";
|
|
import 'react-tooltip/dist/react-tooltip.css'
|
|
import { Tooltip } from 'react-tooltip'
|
|
import add_plus from "../mysy_img/plus.png";
|
|
import excel_icone from "../mysy_img/excel_icone.png";
|
|
import participants from "../mysy_img/participants.png";
|
|
import fileDownload from 'js-file-download'
|
|
import Popup from 'reactjs-popup';
|
|
import 'reactjs-popup/dist/index.css';
|
|
import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint } from "react-icons/fc";
|
|
import DatePicker from "react-datepicker";
|
|
import "react-datepicker/dist/react-datepicker.css";
|
|
import { format } from 'date-fns'
|
|
import moment from "moment";
|
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
import { AiFillCloseCircle } from "react-icons/ai";
|
|
import Box from '@mui/material/Box';
|
|
import { Typography, LinearProgress } from '@mui/material';
|
|
import styled from 'styled-components';
|
|
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 { TransitionProps } from '@mui/material/transitions';
|
|
|
|
|
|
const Partner_Commande = (props) => {
|
|
|
|
const history = useHistory();
|
|
const [submenu, setsubmenu] = useState("");
|
|
const [rowss, setRows] = useState([]);
|
|
const [selectionModel, setSelectionModel] = React.useState([]);
|
|
|
|
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 columns = [
|
|
{ field: '_id', headerName: '_id', hide: true },
|
|
{ field: 'id', headerName: 'id', hide: true },
|
|
{ field: 'order_header_ref_interne', headerName: 'Reference', width: 150, hide: false, editable: true },
|
|
{ field: 'order_header_type', headerName: 'Type', width: 150, hide: false, editable: true },
|
|
{ field: 'order_header_status', headerName: 'Statut', width: 150, hide: false, editable: true },
|
|
{ field: 'order_header_client_id', headerName: 'Client_Id', width: 150, hideable: false, },
|
|
{ field: 'order_header_client_nom', headerName: 'Nom Client', width: 150, hideable: false, },
|
|
{ field: 'order_header_vendeur_id', headerName: 'Vendeur Id', width: 150, hideable: false, },
|
|
{ field: 'order_header_vendeur_nom_prenom', headerName: 'Vendeur', width: 150, hideable: false, },
|
|
{ field: 'order_header_date_cmd', headerName: 'Date', width: 150, hide: false, editable: true },
|
|
{ field: 'order_header_date_expiration', headerName: 'Date Expiration', width: 150, hide: false, editable: true },
|
|
|
|
|
|
/* {
|
|
field: "Detail", headerName: 'Voir detail',
|
|
renderCell: (cellValues) => {
|
|
return (
|
|
|
|
<Button
|
|
|
|
onClick={(event) => {
|
|
Display_Detail_Employe(event, cellValues);
|
|
}}
|
|
>
|
|
<FcViewDetails />
|
|
|
|
</Button>
|
|
|
|
);
|
|
}
|
|
},*/
|
|
{
|
|
field: "delete", headerName: 'Supprimer',
|
|
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}>
|
|
×
|
|
</button>
|
|
<div className="gest_header"> MySy Information </div>
|
|
<div className="gest_content">
|
|
{' '}
|
|
|
|
En confirmant cette opération, l'employé 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) => {
|
|
//handleClick_delete(event, cellValues);
|
|
//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>
|
|
|
|
|
|
);
|
|
}
|
|
}
|
|
|
|
]
|
|
|
|
function clean_all_filters() {
|
|
setp_filtre1();
|
|
setp_filtre1_value();
|
|
|
|
setp_filtre2();
|
|
setp_filtre2_value();
|
|
|
|
setp_filtre3();
|
|
setp_filtre3_value();
|
|
|
|
setp_filtre4();
|
|
setp_filtre4_value();
|
|
}
|
|
|
|
const myRef = useRef(null)
|
|
|
|
const [Dialog_1_message, setDialog_1_message] = React.useState(false);
|
|
const [Dialog_1_open, setDialog_1_open] = React.useState(false);
|
|
function Dialog_1_handle_change_participant_session(message) {
|
|
setDialog_1_message(message);
|
|
setDialog_1_open(true);
|
|
}
|
|
|
|
const Dialog_1_handleClose = () => {
|
|
//alert(" Utiliser le bouton 'fermer' ");
|
|
//setOpen(false);
|
|
};
|
|
|
|
const Dialog_1_handleClose_buton = () => {
|
|
setDialog_1_open(false);
|
|
};
|
|
|
|
useEffect(() => {
|
|
|
|
Getall_Parter_Orders_No_Filter();
|
|
}, [])
|
|
|
|
const [Getall_Parter_Orders_No_Filter_api, setGetall_Parter_Orders_No_Filter_api] = useState();
|
|
const [Getall_Parter_Orders_No_Filter_message, setGetall_Parter_Orders_No_Filter_message] = useState();
|
|
const [Getall_Parter_Orders_No_Filter_result, setGetall_Parter_Orders_No_Filter_result] = useState();
|
|
function Getall_Parter_Orders_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_Partner_Order_no_filter/";
|
|
|
|
axios.post(myurl, form).then(res => {
|
|
|
|
if (String(res.data.status) === String("true")) {
|
|
//console.log(" In Getall_Parter_Orders_No_Filter res.data.status = " + res.data.status);
|
|
//console.log(" In Getall_Parter_Orders_No_Filter res.data.message r_class = " + res.data.message);
|
|
setGetall_Parter_Orders_No_Filter_api("true");
|
|
setGetall_Parter_Orders_No_Filter_result(res.data.message);
|
|
setRows(res.data.message);
|
|
}
|
|
else {
|
|
setGetall_Parter_Orders_No_Filter_api("false");
|
|
setGetall_Parter_Orders_No_Filter_message(res.data.message);
|
|
alert(res.data.message);
|
|
}
|
|
|
|
}).catch((error) => {
|
|
console.warn('Not good man :( Getall_Parter_Orders_No_Filter = ', error);
|
|
setGetall_Parter_Orders_No_Filter_api("false");
|
|
alert(" Impossible de recuperer la liste des commandes et devis");
|
|
//setmyApimyApiMessage("")
|
|
})
|
|
}
|
|
|
|
|
|
const [session_file_name, setsession_file_name] = useState();
|
|
const [liste_sessions_file_change_api, setliste_sessions_file_change_api] = useState();
|
|
const [liste_sessions_file_change_result, setliste_sessions_file_change_result] = useState();
|
|
const [liste_sessions_file_change_message, setliste_sessions_file_change_message] = useState();
|
|
const liste_sessions_file_change = 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 > 1000000) {
|
|
alert("Le fichier ne doit pas depasser un 1 Méga octets");
|
|
return;
|
|
}
|
|
|
|
setsession_file_name(event.target.files[0].name);
|
|
|
|
const formData = new FormData();
|
|
formData.append('File', fileUploaded);
|
|
//formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA');
|
|
const stored_cookie = getCookie('tokenmysypart');
|
|
|
|
formData.append("token", stored_cookie);
|
|
//console.log("token = " + stored_cookie);
|
|
|
|
fetch(
|
|
// ici a modifier process.env.REACT_APP_API_URL + "myclass/api/Add_Ressource_Humaine_mass/",
|
|
{
|
|
method: 'POST',
|
|
body: formData,
|
|
}
|
|
)
|
|
.then((response) => response.json())
|
|
.then((result) => {
|
|
|
|
//console.log(" ## result['status'] = ", result['status'])
|
|
if (String(result['status']) === String("Err_Connexion")) {
|
|
alert('Erreur: ' + result['message']);
|
|
history.push("/Connexion");
|
|
}
|
|
|
|
else if (String(result['status']) === String("true")) {
|
|
//console.log('Success:', result['message']);
|
|
setliste_sessions_file_change_result(result['message']);
|
|
setliste_sessions_file_change_api("true");
|
|
|
|
//Getall_Training_Employee();
|
|
alert(" Les employés ont été correctement importés");
|
|
|
|
}
|
|
|
|
else {
|
|
setliste_sessions_file_change_message(result['message']);
|
|
setliste_sessions_file_change_api("false");
|
|
alert('Erreur: ' + result['message']);
|
|
|
|
}
|
|
|
|
|
|
})
|
|
.catch((error) => {
|
|
console.error('Error:', error);
|
|
setliste_sessions_file_change_api("false");
|
|
alert(" Impossible d'importer les employés ");
|
|
});
|
|
}
|
|
|
|
const myRef_head = useRef(null);
|
|
const [selected_id, setselected_id] = useState("");
|
|
const [order_internal_ref, setorder_internal_ref] = useState("");
|
|
function handleClick_edit_order_From_Line(selected_row_id) {
|
|
|
|
//submenu_detail_employe();
|
|
|
|
var line = JSON.parse(rowss[selected_row_id]);
|
|
|
|
//console.log("### line = ", line);
|
|
var order_id = line._id;
|
|
setselected_id(order_id);
|
|
|
|
var order_ref = line.order_header_ref_interne;
|
|
setorder_internal_ref(order_ref);
|
|
|
|
//console.log(" ### employe_id = ", employe_id);
|
|
/* Display_Detail_Employe(employe_id);
|
|
|
|
if (myRef.current) {
|
|
myRef.current.scrollIntoView({ behavior: "smooth" });
|
|
}
|
|
|
|
Getall_Employee_Affectation(employe_id);
|
|
*/
|
|
}
|
|
|
|
const hiddenFileInput_session = React.useRef(null);
|
|
|
|
function submenu_import_order() {
|
|
setsession_file_name();
|
|
setliste_sessions_file_change_api();
|
|
hiddenFileInput_session.current.click();
|
|
}
|
|
|
|
|
|
return (
|
|
|
|
<div className="partner_commande">
|
|
|
|
<Dialog
|
|
open={Dialog_1_open}
|
|
onClose={Dialog_1_handleClose}
|
|
|
|
>
|
|
|
|
<DialogTitle>MySy Information</DialogTitle>
|
|
<DialogContent>
|
|
<DialogContentText>
|
|
{Dialog_1_message}
|
|
</DialogContentText>
|
|
|
|
</DialogContent>
|
|
|
|
<DialogActions>
|
|
<Button onClick={Dialog_1_handleClose_buton}>OK</Button>
|
|
|
|
</DialogActions>
|
|
</Dialog>
|
|
|
|
<h3> Vos Commandes et Devis </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" >
|
|
<TextField
|
|
name="filtre1"
|
|
label="Choisir un champ"
|
|
select
|
|
sx={{ m: 1, width: '100%' }}
|
|
value={p_filtre1}
|
|
onChange={(e) => {
|
|
setp_filtre1(e.target.value);
|
|
|
|
}}
|
|
>
|
|
<MenuItem value="email" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Email </MenuItem>
|
|
<MenuItem value="nom" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Nom </MenuItem>
|
|
<MenuItem value="formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Formation (code externe) </MenuItem>
|
|
<MenuItem value="session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Session (code session) </MenuItem>
|
|
|
|
|
|
</TextField>
|
|
</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 id="my-tooltip01" style={{ "fontSize": "12px" }} />
|
|
<a data-tooltip-id="my-tooltip01" data-tooltip-content="Ajouter une nouvelle ligne de filtre">
|
|
<MdAddCircleOutline onClick={(e) => {
|
|
setp_filtre2("1");
|
|
setp_filtre2_value("");
|
|
}} />
|
|
</a>
|
|
</div>}
|
|
{p_filtre1 && <div className='filter_bton_add'>
|
|
<Tooltip id="my-tooltip02" style={{ "fontSize": "12px" }} />
|
|
<a data-tooltip-id="my-tooltip02" data-tooltip-content="Supprimer cette ligne de filtre">
|
|
<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">
|
|
<TextField
|
|
name="filtre2"
|
|
label="Choisir un champ"
|
|
select
|
|
sx={{ m: 1, width: '100%' }}
|
|
|
|
value={p_filtre2}
|
|
onChange={(e) => {
|
|
setp_filtre2(e.target.value);
|
|
|
|
}}
|
|
>
|
|
<MenuItem value="email" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Email </MenuItem>
|
|
<MenuItem value="nom" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Nom </MenuItem>
|
|
<MenuItem value="formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Formation (code externe) </MenuItem>
|
|
<MenuItem value="session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Session (code session) </MenuItem>
|
|
|
|
|
|
</TextField>
|
|
</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 id="my-tooltip03" style={{ "fontSize": "12px" }} />
|
|
<a data-tooltip-id="my-tooltip03" data-tooltip-content="Ajouter une nouvelle ligne de filtre">
|
|
<MdAddCircleOutline
|
|
onClick={(e) => {
|
|
setp_filtre3("1");
|
|
setp_filtre3_value("");
|
|
}}
|
|
/>
|
|
</a>
|
|
</div>}
|
|
|
|
{String(p_filtre2).length > 2 && <div className='filter_bton_add'>
|
|
<Tooltip id="my-tooltip04" style={{ "fontSize": "12px" }} />
|
|
<a data-tooltip-id="my-tooltip04" data-tooltip-content="Supprimer cette ligne de filtre">
|
|
<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">
|
|
<TextField
|
|
name="filtre3"
|
|
label="Choisir un champ"
|
|
select
|
|
sx={{ m: 1, width: '100%' }}
|
|
|
|
value={p_filtre3}
|
|
onChange={(e) => {
|
|
setp_filtre3(e.target.value)
|
|
}}
|
|
>
|
|
<MenuItem value="email" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Email </MenuItem>
|
|
<MenuItem value="nom" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Nom </MenuItem>
|
|
<MenuItem value="formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Formation (code externe) </MenuItem>
|
|
<MenuItem value="session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Session (code session) </MenuItem>
|
|
|
|
|
|
</TextField>
|
|
</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 id="my-tooltip03" style={{ "fontSize": "12px" }} />
|
|
<a data-tooltip-id="my-tooltip03" data-tooltip-content="Ajouter une nouvelle ligne de filtre">
|
|
<MdAddCircleOutline
|
|
onClick={(e) => {
|
|
setp_filtre4("1");
|
|
setp_filtre4_value("");
|
|
}}
|
|
/>
|
|
</a>
|
|
</div>}
|
|
|
|
{String(p_filtre3).length > 2 && <div className='filter_bton_add'>
|
|
<Tooltip id="my-tooltip05" style={{ "fontSize": "12px" }} />
|
|
<a data-tooltip-id="my-tooltip05" data-tooltip-content="Supprimer cette ligne de filtre">
|
|
<MdRemoveCircleOutline onClick={(e) => {
|
|
setp_filtre3();
|
|
setp_filtre3_value();
|
|
}} />
|
|
</a>
|
|
</div>}
|
|
</div>
|
|
}
|
|
|
|
|
|
<div className="div_row" ref={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_Training_Employee"}>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">
|
|
<div className="session_data">
|
|
<div style={{ "border": "None" }}>
|
|
|
|
<div style={{ height: 550, width: '100%', paddingRight: '1px' }}>
|
|
|
|
<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-virtualScrollerRenderZone": {
|
|
"& .MuiDataGrid-row": {
|
|
"&:nth-child(2n)": { backgroundColor: "rgba(235, 235, 235, .7)" }
|
|
}
|
|
},*/
|
|
"& .MuiDataGrid-columnHeaders": {
|
|
backgroundColor: "#c8cfd5",
|
|
color: "black",
|
|
fontSize: 14
|
|
},
|
|
|
|
}}
|
|
>
|
|
<DataGrid
|
|
checkboxSelection
|
|
onSelectionModelChange={(newSelectionModel) => {
|
|
setSelectionModel(newSelectionModel);
|
|
if (newSelectionModel.length === 1)
|
|
handleClick_edit_order_From_Line(newSelectionModel);
|
|
if (newSelectionModel.length !== 1) {
|
|
setsubmenu();
|
|
//setdisplay_detail_employe();
|
|
//setadd_One_Employee();
|
|
}
|
|
}}
|
|
selectionModel={selectionModel}
|
|
|
|
localeText={frFR.components.MuiDataGrid.defaultProps.localeText}
|
|
rows={rowss.map((item, index) => (
|
|
{
|
|
id: index,
|
|
_id: JSON.parse(item)._id,
|
|
order_header_ref_interne: JSON.parse(item).order_header_ref_interne,
|
|
order_header_type: JSON.parse(item).order_header_type,
|
|
order_header_status: JSON.parse(item).order_header_status,
|
|
order_header_client_id: JSON.parse(item).order_header_client_id,
|
|
order_header_client_nom: JSON.parse(item).order_header_client_nom,
|
|
order_header_vendeur_id: JSON.parse(item).order_header_vendeur_id,
|
|
order_header_vendeur_nom_prenom: JSON.parse(item).order_header_vendeur_nom_prenom,
|
|
order_header_date_cmd: JSON.parse(item).order_header_date_cmd,
|
|
order_header_date_expiration: JSON.parse(item).order_header_date_expiration,
|
|
|
|
}
|
|
))}
|
|
|
|
columns={columns}
|
|
pageSize={10}
|
|
className="datagridclass"
|
|
|
|
rowsPerPageOptions={[10]}
|
|
//disableSelectionOnClick
|
|
components={{
|
|
Toolbar: GridToolbar,
|
|
}}
|
|
//sx={datagridSx}
|
|
getCellClassName={(params) => {
|
|
//field === 'distantiel'
|
|
if (params.field === 'distantiel' && String(params.value) === "1") {
|
|
return 'cell--distantiel';
|
|
}
|
|
if (params.field === "presentiel" && String(params.value) == "1") {
|
|
return 'cell--presentiel';
|
|
}
|
|
|
|
|
|
//field === "statut"
|
|
if (params.field === "status" && String(params.value) == "0") {
|
|
return 'cell--statut--preinscrit';
|
|
}
|
|
|
|
if (params.field === "status" && String(params.value) == "1") {
|
|
return 'cell--statut--inscrit';
|
|
}
|
|
|
|
if (params.field === "status" && String(params.value) == "-1") {
|
|
return 'cell--statut--annule';
|
|
}
|
|
|
|
}}
|
|
getRowClassName={(params) => {
|
|
|
|
if (String(params.row.status) === "-1") {
|
|
return 'line--statut--annule';
|
|
}
|
|
if (String(params.row.status) === "0") {
|
|
return 'line--statut--preinscrit';
|
|
}
|
|
if (String(params.row.status) === "1") {
|
|
return 'line--statut--inscrit';
|
|
}
|
|
}}
|
|
|
|
|
|
/>
|
|
</Box>
|
|
<br />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="div_row" style={{ "border": "None" }}>
|
|
|
|
<div className="div_row_gauche div_row_gauche_etendu" style={{ "textAlign": "left", "paddingLeft": "5px" }}>
|
|
|
|
<Button variant="outlined" onClick={submenu_import_order} className="detail_class_submenu bton_import_excel"
|
|
id='menu_import_participant' name='menu_import_participant'>Importer des commande / devis Excel
|
|
<img src={excel_icone} alt="ajout csv" className="icon_excel" />
|
|
</Button>
|
|
|
|
|
|
<Button variant="outlined" onClick={"submenu_add_one_employee"}
|
|
className="detail_class_submenu bton_add_session"
|
|
id='menu_import_participant' name='menu_import_participant'>Ajout 1 Commande
|
|
<img src={add_plus} alt="ajout session" className="icon_plus" />
|
|
</Button>
|
|
|
|
<Button variant="outlined" onClick={"submenu_add_one_employee"}
|
|
className="detail_class_submenu bton_add_session"
|
|
id='menu_import_participant' name='menu_import_participant'>Ajout 1 Devis
|
|
<img src={add_plus} alt="ajout session" className="icon_plus" />
|
|
</Button>
|
|
|
|
<br />
|
|
{session_file_name && <nav><i>{session_file_name}</i></nav>}
|
|
{String(liste_sessions_file_change_api) === String("true") && <nav className="okUpdateData"> Les commandes/devis ont été correctement importés</nav>}
|
|
{String(liste_sessions_file_change_api) === String("false") && <nav className="koUpdateData"> {liste_sessions_file_change_message} </nav>}
|
|
|
|
<input type="file"
|
|
accept=".csv"
|
|
ref={hiddenFileInput_session}
|
|
style={{ display: 'none' }}
|
|
name="liste_sessions_file"
|
|
onChange={liste_sessions_file_change}
|
|
/>
|
|
|
|
<a href='/sample/template_import_employes.csv' download>Télécharger un fichier modèle</a>
|
|
</div>
|
|
</div>
|
|
<div className="div_row"> </div>
|
|
<div className="div_row">
|
|
<Button variant="outlined" ref={myRef} onClick={"submenu_detail_employe"} className="detail_class_submenu" id='detail_employe' name='detail_employe'>Détail employé</Button>
|
|
<Button variant="outlined" onClick={"submenu_droit_acces"} className="detail_class_submenu" id='droit_acces' name='droit_acces'>Droits d'acces </Button>
|
|
<Button variant="outlined" onClick={"submenu_affectation"} className="detail_class_submenu" id='affectation' name='affectation'>Affectation </Button>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
)
|
|
}
|
|
|
|
|
|
export default Partner_Commande; |