01/10/2023 - 23h

recette2
cherif 2023-10-01 22:25:26 +02:00
parent f99fe83c1b
commit b347197233
4 changed files with 3084 additions and 5 deletions

View File

@ -49,6 +49,7 @@ import Employes from "./Employes";
import Materiels from "./Materiels";
import Partner_Commande from "./Partner_Commande";
import Config_Documents from "./Config_Document";
import Factures_Client from "./Partner_Facture";
import Dialog from '@mui/material/Dialog';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
@ -300,7 +301,7 @@ const Partner = (props) => {
var list_menu = ['creation', 'infopartner', 'statistique', 'abonnement', 'affichage', 'ordervalide',
'mes_sessions', 'setuplms', 'facture', 'pricing', 'mes_clients', 'mes_devis', 'mes_cmd',
'mes_stagiaires', 'mes_employes', 'mon_materiel', 'config_document']
'mes_stagiaires', 'mes_employes', 'mon_materiel', 'config_document', 'factures_client']
if (action && list_menu.includes(action)) {
@ -362,6 +363,18 @@ const Partner = (props) => {
}
}
function mes_factures_client_func(event) {
//var security_retval = check_user_acces_right("facture_client", "read");
//if (security_retval === 1) {
setmenu("factures_client");
setapiexcelimportmessage();
setformation_file_name();
history.push("/Partner/factures_client");
/*} else {
Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour acceder à la gestion des documents");
}*/
}
function DisplayStat(event) {
var security_retval = check_user_acces_right("formation", "read");
@ -1019,8 +1032,8 @@ const Partner = (props) => {
<div>
<hr className="my_hr" />
{String(menu) !== "mes_facture" && <div className="sousmenu" onClick={"mes_factures_func"}>&nbsp;&nbsp;<FcKindle className="icone_menu" />&nbsp;MES FACTURES</div>}
{String(menu) === "mes_facture" && <div className="sousmenu_selected" onClick={"mes_factures_func"}> &nbsp;&nbsp; <FcCollect FcKindle="icone_menu" />&nbsp;MES FACTURES</div>}
{String(menu) !== "factures_client" && <div className="sousmenu" onClick={mes_factures_client_func}>&nbsp;&nbsp;<FcKindle className="icone_menu" />&nbsp;MES FACTURES</div>}
{String(menu) === "factures_client" && <div className="sousmenu_selected" onClick={mes_factures_client_func}> &nbsp;&nbsp; <FcCollect FcKindle="icone_menu" />&nbsp;MES FACTURES</div>}
</div>
@ -1248,6 +1261,12 @@ const Partner = (props) => {
</div>
}
{String(menu) === "factures_client" &&
<div className="div_droite">
<Factures_Client />
</div>
}
{String(menu) === "mon_materiel" &&
<div className="div_droite">
@ -1257,7 +1276,7 @@ const Partner = (props) => {
{String(menu) === "mes_cmd" &&
<div className="div_droite">
<Partner_Commande conntected_employee_id={conntected_employee_id}/>
<Partner_Commande conntected_employee_id={conntected_employee_id} />
</div>
}

View File

@ -0,0 +1,669 @@
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, sliderClasses } 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';
import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
const Partner_Facture = (props) => {
const history = useHistory();
const [submenu, setsubmenu] = useState("");
const [rowss, setRows] = useState([]);
const [selectionModel, setSelectionModel] = React.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 columns = [
{ field: '_id', headerName: '_id', hide: true },
{ field: 'id', headerName: 'id', hide: true },
{ field: 'order_header_ref_interne', headerName: 'Reference', width: 100, hide: false, editable: false },
{ field: 'order_header_type', headerName: 'Type', width: 100, hide: false, editable: false },
{
field: 'order_header_status', headerName: 'Statut', width: 100, hide: false, editable: false,
valueFormatter: (params) => {
if (String(params.value) === "-1")
return "Annulé";
else if (String(params.value) === "0")
return "Brouillon";
else if (String(params.value) === "1")
return "En cours";
else if (String(params.value) === "2")
return "Traité";
else if (String(params.value) === "3")
return "Facturé";
else
return "?";
},
},
{ field: 'order_header_client_id', headerName: 'Client_Id', width: 150, hide: true, editable: false },
{ field: 'order_header_client_nom', headerName: 'Nom Client', width: 150, hideable: false, flex: 1 },
{ field: 'order_header_vendeur_id', headerName: 'Vendeur Id', width: 150, hide: true, editable: false },
{ field: 'order_header_vendeur_nom_prenom', headerName: 'Vendeur', width: 150, hideable: false, flex: 1, editable: false },
{ field: 'order_header_date_cmd', headerName: 'Date', width: 150, hide: false, editable: false },
{ field: 'order_header_date_expiration', headerName: 'Date Expiration', width: 150, hide: false, editable: false },
/* {
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}>
&times;
</button>
<div className="gest_header"> MySy Information </div>
<div className="gest_content">
{' '}
En confirmant cette opération, le document 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>
);
}
}
]
const [isLoading, setLoading] = useState();
const [Get_List_Partner_Clients_api, setGet_List_Partner_Clients_api] = useState();
const [Get_List_Partner_Clients_message, setGet_List_Partner_Clients_message] = useState();
const [Get_List_Partner_Clients_result, setGet_List_Partner_Clients_result] = useState();
function Get_List_Partner_Clients(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_Partner_List_Partner_Client/";
axios.post(myurl, form).then(res => {
//console.log(" In Get_List_Partner_Clients res.data.status = " + res.data.status);
//console.log(" In Get_List_Partner_Clients res.data.message r_class = " + res.data.message);
if (String(res.data.status) === String("true")) {
setGet_List_Partner_Clients_api("true");
setGet_List_Partner_Clients_result(res.data.message);
}
else if (String(res.data.status) === String("Err_Connexion")) {
alert('Erreur: ' + res.data.message);
history.push("/Connexion");
}
else {
setGet_List_Partner_Clients_api("false");
setGet_List_Partner_Clients_message(res.data.message);
alert('Erreur: ' + res.data.message);
}
}).catch((error) => {
console.warn('Not good man :( Get_List_Partner_Clients = ', error);
setGet_List_Partner_Clients_api("false");
alert('Erreur: Impossible de recuperer la liste des clients');
//setmyApimyApiMessage("")
})
}
const [Getall_Parter_Invoice_No_Filter_api, setGetall_Parter_Invoice_No_Filter_api] = useState();
const [Getall_Parter_Invoice_No_Filter_message, setGetall_Parter_Invoice_No_Filter_message] = useState();
const [Getall_Parter_Invoice_No_Filter_result, setGetall_Parter_Invoice_No_Filter_result] = useState();
function Getall_Parter_Invoice_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_Invoice_no_filter/";
axios.post(myurl, form).then(res => {
if (String(res.data.status) === String("true")) {
//console.log(" In Getall_Parter_Invoice_No_Filter res.data.status = " + res.data.status);
//console.log(" In Getall_Parter_Invoice_No_Filter res.data.message r_class = " + res.data.message);
setGetall_Parter_Invoice_No_Filter_api("true");
setGetall_Parter_Invoice_No_Filter_result(res.data.message);
setRows(res.data.message);
}
else {
setGetall_Parter_Invoice_No_Filter_api("false");
setGetall_Parter_Invoice_No_Filter_message(res.data.message);
alert(res.data.message);
}
}).catch((error) => {
console.warn('Not good man :( Getall_Parter_Invoice_No_Filter = ', error);
setGetall_Parter_Invoice_No_Filter_api("false");
alert(" Impossible de recuperer la liste des factures");
//setmyApimyApiMessage("")
})
}
const myRef_head = useRef(null);
useEffect(() => {
Get_List_Partner_Clients();
Getall_Parter_Invoice_No_Filter();
if (myRef_head)
myRef_head.current.scrollIntoView({ behavior: "smooth" });
}, [])
return (
<div className="partner_facture">
{isLoading && <div className="loader-container">
<div className="mysy_spinner"> <img src={img_loading_spin} /> </div>
</div>}
<h3> Vos Factures </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="ref_interne" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Ref. Interne &nbsp;</MenuItem>
<MenuItem value="ref_externe" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Ref. Externe (chez le client) &nbsp;</MenuItem>
<MenuItem value="client_nom" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Nom Client &nbsp;</MenuItem>
<MenuItem value="formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Formation (code externe) &nbsp;</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">
&nbsp; <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">
&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">
<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="ref_interne" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Ref. Interne &nbsp;</MenuItem>
<MenuItem value="ref_externe" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Ref. Externe (chez le client) &nbsp;</MenuItem>
<MenuItem value="client_nom" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Nom Client &nbsp;</MenuItem>
<MenuItem value="formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Formation (code externe) &nbsp;</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">
&nbsp; <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">
&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">
<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="ref_interne" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Ref. Interne &nbsp;</MenuItem>
<MenuItem value="ref_externe" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Ref. Externe (chez le client) &nbsp;</MenuItem>
<MenuItem value="client_nom" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Nom Client &nbsp;</MenuItem>
<MenuItem value="formation" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Lié a la Formation (code externe) &nbsp;</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">
&nbsp; <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">
&nbsp; <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_Parter_Orders_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">
<div className="session_data">
<div style={{ "border": "None" }}>
<div style={{ height: 550, width: '100%', paddingRight: '1px' }}>
&nbsp;
<Box
sx={{
height: 500,
width: '100%',
paddingRight: '1px',
// Gestion des cellule "statut"
'& .cell--status--encours': {
backgroundColor: '#E6F7C8',
color: '#1a3e72',
fontWeight: 'light',
},
'& .cell--status--traite': {
backgroundColor: '#E6CEAA',
color: '#F9E79F',
fontWeight: 'light',
},
/*"& .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) {
clean_order_detail_fields();
setsubmenu();
setdisplay_detail_order();
}*/
}}
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 === "order_header_status"
if (params.field === "order_header_status" && String(params.value) == "0") {
return 'cell--status--brouillon';
}
if (params.field === "order_header_status" && String(params.value) == "1") {
return 'cell--status--encours';
}
if (params.field === "order_header_status" && String(params.value) == "2") {
return 'cell--status--traite';
}
if (params.field === "order_header_status" && String(params.value) == "3") {
return 'cell--status--facture';
}
}}
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>
</div>
)
}
export default Partner_Facture;

File diff suppressed because it is too large Load Diff

View File

@ -79,5 +79,6 @@
@import "./components/partner_commande";
@import "./components/config_document";
@import 'react-big-calendar/lib/sass/styles';
@import 'react-big-calendar/lib/addons/dragAndDrop/styles'; // if using DnD
@import 'react-big-calendar/lib/addons/dragAndDrop/styles';
@import "./components/partner_facture";