25/04/2024 - 19h
parent
7cf222f74b
commit
60494e4bcb
File diff suppressed because it is too large
Load Diff
|
@ -4,6 +4,8 @@
|
|||
"private": true,
|
||||
"dependencies": {
|
||||
"@dr.pogodin/react-global-state": "^0.6.5",
|
||||
"@emotion/react": "^11.11.4",
|
||||
"@emotion/styled": "^11.11.5",
|
||||
"@fortawesome/fontawesome": "^1.1.8",
|
||||
"@fortawesome/fontawesome-free-solid": "^5.0.13",
|
||||
"@fortawesome/fontawesome-svg-core": "^6.1.1",
|
||||
|
@ -22,9 +24,10 @@
|
|||
"@material-ui/core": "^4.12.4",
|
||||
"@mui/icons-material": "^5.4.2",
|
||||
"@mui/lab": "^5.0.0-alpha.140",
|
||||
"@mui/material": "^5.14.5",
|
||||
"@mui/material": "^5.15.15",
|
||||
"@mui/styles": "^5.14.5",
|
||||
"@mui/x-data-grid": "^5.5.1",
|
||||
"@mui/x-charts": "^7.3.0",
|
||||
"@mui/x-data-grid": "^5.17.26",
|
||||
"@mui/x-date-pickers": "^5.0.0",
|
||||
"@mui/x-date-pickers-pro": "^5.0.0",
|
||||
"@mui/x-tree-view": "^6.17.0",
|
||||
|
|
|
@ -0,0 +1,923 @@
|
|||
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 "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
|
||||
import 'react-tooltip/dist/react-tooltip.css'
|
||||
import { Tooltip } from 'react-tooltip'
|
||||
import 'reactjs-popup/dist/index.css';
|
||||
import DatePicker from "react-datepicker";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import { format } from 'date-fns'
|
||||
import moment from "moment";
|
||||
import Box from '@mui/material/Box';
|
||||
import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
|
||||
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
|
||||
import { tokens } from "./../theme";
|
||||
import { MdOutlineAddchart, } from "react-icons/md";
|
||||
import {
|
||||
useTheme,
|
||||
} from "@mui/material";
|
||||
import Autocomplete from '@mui/material/Autocomplete';
|
||||
|
||||
|
||||
import { BarChart } from '@mui/x-charts';
|
||||
|
||||
import { TbColumns2, TbColumns1 } from "react-icons/tb";
|
||||
import { axisClasses } from '@mui/x-charts';
|
||||
import { pieArcLabelClasses } from '@mui/x-charts/PieChart';
|
||||
import Stack from '@mui/material/Stack';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { PieChart } from '@mui/x-charts/PieChart';
|
||||
|
||||
const pieParams = { height: 200, margin: { right: 5 } };
|
||||
const palette = ['red', 'blue', 'green'];
|
||||
|
||||
const Dashbord_Factures = (props) => {
|
||||
|
||||
|
||||
|
||||
const history = useHistory();
|
||||
const [isLoading, setLoading] = useState();
|
||||
|
||||
const theme = useTheme();
|
||||
const colors = tokens(theme.palette.mode);
|
||||
|
||||
const [isMySyDashboard, setisMySyDashboard] = useState(false);
|
||||
|
||||
var date_today_90j = new Date();
|
||||
date_today_90j.setDate(date_today_90j.getDate() - 90);
|
||||
const [selectionModel, setSelectionModel] = React.useState([]);
|
||||
const [p_filter_date_from, setp_filter_date_from] = useState(date_today_90j.toLocaleDateString('fr-FR'));
|
||||
const [p_filter_date_to, setp_filter_date_to] = useState(new Date().toLocaleDateString('fr-FR'));
|
||||
|
||||
|
||||
const [filter_value, setfilter_value] = useState("d");
|
||||
|
||||
const [filter_type_tache, setfilter_type_tache] = useState("");
|
||||
|
||||
const [tdb_title, settdb_title] = useState();
|
||||
|
||||
|
||||
const [display_nb_column, setdisplay_nb_column] = useState("1");
|
||||
const [display_column_size, setdisplay_column_size] = useState("100%");
|
||||
|
||||
const [dashbord_internal_code, setdashbord_internal_code] = useState("");
|
||||
const [gridline_id, setgridline_id] = useState("");
|
||||
|
||||
|
||||
const [Getall_Qry_Invoice_Data_result_JSON, setGetall_Qry_Invoice_Data_result_JSON] = useState([]);
|
||||
const [Getall_Qry_Invoice_Data_api, setGetall_Qry_Invoice_Data_api] = useState();
|
||||
const [Getall_Qry_Invoice_Data_message, setGetall_Qry_Invoice_Data_message] = useState();
|
||||
const [Getall_Qry_Invoice_Data_result, setGetall_Qry_Invoice_Data_result] = useState([]);
|
||||
function Getall_Qry_Invoice_Data(event) {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
|
||||
}
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("periode_start_date", date_from);
|
||||
form.append("periode_end_date", date_to);
|
||||
form.append("filter_value", filter_value);
|
||||
form.append("filter_client_id", p_detail_partner_client_id);
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_List_Factures_Data_By_Periode/";
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Getall_Qry_Invoice_Data res.data.status = " + res.data.status);
|
||||
//console.log(" In Getall_Qry_Invoice_Data res.data.message r_class = " + res.data.message);
|
||||
|
||||
setGetall_Qry_Invoice_Data_result_JSON(JSON.parse('[' + res.data.message + ']'));
|
||||
|
||||
var jsonObj = JSON.parse('[' + res.data.message + ']');
|
||||
|
||||
//console.log("jsonObj = ", jsonObj)
|
||||
|
||||
setGetall_Qry_Invoice_Data_api("true");
|
||||
setGetall_Qry_Invoice_Data_result(res.data.message);
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setGetall_Qry_Invoice_Data_api("false");
|
||||
setGetall_Qry_Invoice_Data_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Getall_Qry_Invoice_Data = ', error);
|
||||
setGetall_Qry_Invoice_Data_api("false");
|
||||
alert("Impossible de récuperer les données demandées")
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_result_JSON, setGetall_Qry_Invoice_Data_Group_By_Client_result_JSON] = useState([]);
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_api, setGetall_Qry_Invoice_Data_Group_By_Client_api] = useState();
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_message, setGetall_Qry_Invoice_Data_Group_By_Client_message] = useState();
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_result, setGetall_Qry_Invoice_Data_Group_By_Client_result] = useState([]);
|
||||
function Getall_Qry_Invoice_Data_Group_By_Client(event) {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
|
||||
}
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("periode_start_date", date_from);
|
||||
form.append("periode_end_date", date_to);
|
||||
form.append("filter_value", filter_value);
|
||||
form.append("filter_client_id", p_detail_partner_client_id);
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_List_Factures_Data_By_Client_Periode/";
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Getall_Qry_Invoice_Data_Group_By_Client res.data.status = " + res.data.status);
|
||||
//console.log(" In Getall_Qry_Invoice_Data_Group_By_Client res.data.message r_class = " + res.data.message);
|
||||
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_result_JSON(JSON.parse('[' + res.data.message + ']'));
|
||||
|
||||
var jsonObj = JSON.parse('[' + res.data.message + ']');
|
||||
|
||||
console.log("jsonObj Group by Client = ", jsonObj)
|
||||
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_api("true");
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_result(res.data.message);
|
||||
|
||||
var local_total = 0;
|
||||
const new_data = res.data.message.map((x) => {
|
||||
var local_value = JSON.parse(x).value;
|
||||
local_total = local_total + parseFloat(String(local_value));
|
||||
|
||||
});
|
||||
|
||||
settotal(parseFloat(String(local_total)));
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_api("false");
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Getall_Qry_Invoice_Data_Group_By_Client = ', error);
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_api("false");
|
||||
alert("Impossible de récuperer les données demandées")
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
const [Getall_Qry_Quotation_Data_result_JSON, setGetall_Qry_Quotation_Data_result_JSON] = useState([]);
|
||||
const [Getall_Qry_Quotation_Data_api, setGetall_Qry_Quotation_Data_api] = useState();
|
||||
const [Getall_Qry_Quotation_Data_message, setGetall_Qry_Quotation_Data_message] = useState();
|
||||
const [Getall_Qry_Quotation_Data_result, setGetall_Qry_Quotation_Data_result] = useState([]);
|
||||
function Getall_Qry_Quotation_Data(event) {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
|
||||
}
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("periode_start_date", date_from);
|
||||
form.append("periode_end_date", date_to);
|
||||
form.append("filter_value", filter_value);
|
||||
form.append("filter_client_id", p_detail_partner_client_id);
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_List_Quotation_Data_By_Periode/";
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Getall_Qry_Quotation_Data res.data.status = " + res.data.status);
|
||||
//console.log(" In Getall_Qry_Quotation_Data res.data.message r_class = " + res.data.message);
|
||||
|
||||
setGetall_Qry_Quotation_Data_result_JSON(JSON.parse('[' + res.data.message + ']'));
|
||||
|
||||
var jsonObj = JSON.parse('[' + res.data.message + ']');
|
||||
|
||||
//console.log("Getall_Qry_Quotation_Data_result_JSON jsonObj = ", jsonObj)
|
||||
|
||||
setGetall_Qry_Quotation_Data_api("true");
|
||||
setGetall_Qry_Quotation_Data_result(res.data.message);
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setGetall_Qry_Quotation_Data_api("false");
|
||||
setGetall_Qry_Quotation_Data_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Getall_Qry_Quotation_Data = ', error);
|
||||
setGetall_Qry_Quotation_Data_api("false");
|
||||
alert("Impossible de récuperer les données demandées")
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
Getall_Qry_Invoice_Data();
|
||||
Get_List_Partner_Clients();
|
||||
Getall_Qry_Invoice_Data_Group_By_Client();
|
||||
Getall_Qry_Quotation_Data();
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: "smooth",
|
||||
});
|
||||
|
||||
}, [])
|
||||
|
||||
|
||||
const chartSetting = {
|
||||
yAxis: [
|
||||
{
|
||||
label: " Chiffre d'affaire (€) ",
|
||||
},
|
||||
],
|
||||
width: 1000,
|
||||
height: 400,
|
||||
sx: {
|
||||
[`.${axisClasses.left} .${axisClasses.label}`]: {
|
||||
transform: 'translate(-20px, 0)',
|
||||
},
|
||||
},
|
||||
margin: 100,
|
||||
};
|
||||
|
||||
const valueFormatter_CA = (value) => `${value}€`;
|
||||
|
||||
const valueFormatter_count = (value) => `${value} Fact`;
|
||||
|
||||
|
||||
const data = [
|
||||
{ label: 'Group A', value: 400, color: '#0088FE' },
|
||||
{ label: 'Group B', value: 300, color: '#00C49F' },
|
||||
{ label: 'Group C', value: 300, color: '#FFBB28' },
|
||||
{ label: 'Group D', value: 200, color: '#FF8042' },
|
||||
];
|
||||
|
||||
|
||||
const data22 = [
|
||||
{
|
||||
"label": "Client 1",
|
||||
"value": 4367,
|
||||
"count": 4,
|
||||
"Client_id": "65f05b37c544f77525a30645",
|
||||
"Client_nom": "Client 1",
|
||||
"Client_raison_sociale": "RS Client 1"
|
||||
},
|
||||
{
|
||||
"label": "Client 2",
|
||||
"value": 1281,
|
||||
"count": 4,
|
||||
"Client_id": "65f05b71c544f77525a30647",
|
||||
"Client_nom": "Client 2",
|
||||
"Client_raison_sociale": "RS Client 2"
|
||||
},
|
||||
{
|
||||
"label": "part nom2",
|
||||
"value": 34,
|
||||
"count": 3,
|
||||
"Client_id": "65f4469bb14f05ccc461b595",
|
||||
"Client_nom": "part nom2",
|
||||
"Client_raison_sociale": "part nom2"
|
||||
}
|
||||
];
|
||||
|
||||
// const TOTAL22 = data22.map((item) => item.value).reduce((a, b) => a + b, 0);
|
||||
|
||||
|
||||
const [total, settotal] = useState(1);
|
||||
|
||||
const getArcLabel22 = (params) => {
|
||||
const percent = params.value / parseFloat(String(total));
|
||||
return `${(percent * 100).toFixed(0)}%`;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const sizing = {
|
||||
|
||||
width: 600,
|
||||
height: 600,
|
||||
// legend: { hidden: false },
|
||||
};
|
||||
const TOTAL = data.map((item) => item.value).reduce((a, b) => a + b, 0);
|
||||
|
||||
const getArcLabel = (params) => {
|
||||
const percent = params.value / TOTAL;
|
||||
return `${(percent * 100).toFixed(0)}%`;
|
||||
};
|
||||
|
||||
|
||||
const [tbd_title_value, settbd_title_value] = useState();
|
||||
|
||||
const [New_Get_List_Partner_Clients_result, setNew_Get_List_Partner_Clients_result] = 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);
|
||||
|
||||
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_raison_sociale = JSON.parse(x).raison_sociale;
|
||||
var local_cond_paiement_id = JSON.parse(x).invoice_condition_paiement_id;
|
||||
|
||||
//---
|
||||
var node = {
|
||||
"_id": local_id,
|
||||
"id": localid,
|
||||
"label": local_nom,
|
||||
"nom": local_nom,
|
||||
"raison_sociale": local_raison_sociale,
|
||||
"invoice_condition_paiement_id": local_cond_paiement_id,
|
||||
|
||||
};
|
||||
new_data2.push(node);
|
||||
});
|
||||
|
||||
if (new_data2.length > 0)
|
||||
setNew_Get_List_Partner_Clients_result(new_data2);
|
||||
|
||||
var node = {
|
||||
"_id": "",
|
||||
"id": "",
|
||||
"label": "",
|
||||
"nom": "",
|
||||
"raison_sociale": "",
|
||||
"invoice_condition_paiement_id": "",
|
||||
|
||||
};
|
||||
new_data2.push(node);
|
||||
|
||||
}
|
||||
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 [p_detail_partner_client_id, setp_detail_partner_client_id] = useState("");
|
||||
const [p_detail_partner_client_nom, setp_detail_partner_client_nom] = useState("");
|
||||
|
||||
|
||||
const [Add_To_User_TBD_api, setAdd_To_User_TBD_api] = useState();
|
||||
const [Add_To_User_TBD_message, setAdd_To_User_TBD_message] = useState();
|
||||
const [Add_To_User_TBD_result, setAdd_To_User_TBD_result] = useState();
|
||||
function Add_To_User_TBD(local_dashbord_internal_code) {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
//console.log(" ### dashbord_internal_code = ", local_dashbord_internal_code);
|
||||
|
||||
//var tdb_title = "default";
|
||||
var filter_val = "";
|
||||
|
||||
|
||||
/*if (document.getElementsByName("tdb_title")[0]) {
|
||||
tdb_title = document.getElementsByName("tdb_title")[0].value;
|
||||
}
|
||||
*/
|
||||
if (document.getElementsByName("filtre11")[0]) {
|
||||
filter_val = document.getElementsByName("filtre11")[0].value;
|
||||
}
|
||||
|
||||
// Si filter_val = "d", alors on va recuperer l'interval de date
|
||||
if (String(filter_val) === "d") {
|
||||
var date_from = p_filter_date_from;
|
||||
var date_to = p_filter_date_to;
|
||||
|
||||
|
||||
filter_val = "{'session_start_date':'" + String(date_from) + "' , 'session_end_date':'" + String(date_to) + "'}";
|
||||
} else {
|
||||
filter_val = "{'periode':'" + String(filter_val) + "'}"
|
||||
}
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("dashbord_internal_code", local_dashbord_internal_code);
|
||||
form.append("default_filter", filter_val);
|
||||
form.append("title", tbd_title_value);
|
||||
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_To_User_Dashbord/";
|
||||
|
||||
//console.log(" ## myurl = ", myurl);
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Add_To_User_TBD res.data.status = " + res.data.status);
|
||||
//console.log(" In Add_To_User_TBD res.data.message r_class = " + res.data.message);
|
||||
|
||||
setAdd_To_User_TBD_api("true");
|
||||
setAdd_To_User_TBD_result(res.data.message);
|
||||
settdb_title();
|
||||
alert(res.data.message)
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setAdd_To_User_TBD_api("false");
|
||||
setAdd_To_User_TBD_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Add_To_User_TBD = ', error);
|
||||
setAdd_To_User_TBD_api("false");
|
||||
alert("Impossible d'ajouter le tableau de bord");
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className="dashbord_session">
|
||||
{isLoading && <div className="loader-container">
|
||||
<div className="mysy_spinner"> <img src={img_loading_spin} /> </div>
|
||||
</div>}
|
||||
|
||||
<h3> Tableaux de bord des Commandes et Factures </h3>
|
||||
<div className="div_row"> </div>
|
||||
|
||||
|
||||
<div className="div_row" style={{ "textAlign": "right", "paddingRight": "20px" }}> Affichage
|
||||
<Tooltip className="tooltip_css" id="my_tooltip_1_col" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my_tooltip_1_col" data-tooltip-html="Affichage sur une colonne">
|
||||
<TbColumns1 style={{ "cursor": "pointer" }} onClick={(e) => {
|
||||
setdisplay_nb_column("1");
|
||||
setdisplay_column_size("100%");
|
||||
|
||||
}} />
|
||||
</a>
|
||||
<Tooltip className="tooltip_css" id="my_tooltip_2_col" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my_tooltip_2_col" data-tooltip-html="Affichage sur deux colonnes">
|
||||
<TbColumns2 style={{ "cursor": "pointer" }} onClick={(e) => {
|
||||
setdisplay_nb_column("2");
|
||||
setdisplay_column_size("50%");
|
||||
|
||||
}} />
|
||||
</a> </div>
|
||||
|
||||
<div className="div_row">
|
||||
<div className="" style={{ "width": "30%" }}>
|
||||
Filtre <br />
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
required
|
||||
name="filtre11"
|
||||
id="filtre11"
|
||||
select
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
disabled={false}
|
||||
className="disabled_style"
|
||||
value={filter_value}
|
||||
onChange={(e) => {
|
||||
setfilter_value(e.target.value);
|
||||
}
|
||||
}
|
||||
|
||||
>
|
||||
<MenuItem value="m0" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Mois en cours </MenuItem>
|
||||
<MenuItem value="m1" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Mois précédant </MenuItem>
|
||||
<MenuItem value="d" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Choisir des dates </MenuItem>
|
||||
</TextField>
|
||||
</div>
|
||||
|
||||
{filter_value && String(filter_value) === "d" && <div>
|
||||
<div className="session_caract">
|
||||
Date Debut
|
||||
<DatePicker
|
||||
name="one_sessiondatedebut"
|
||||
id="one_sessiondatedebut"
|
||||
|
||||
selected={new Date(moment(p_filter_date_from, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
setp_filter_date_from(format(date, 'dd/MM/yyyy'));
|
||||
|
||||
}
|
||||
}
|
||||
showTimeSelect={false}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
className="disabled_style session_caract_Dialog_DatePicker"
|
||||
locale='fr-FR'
|
||||
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="session_caract">
|
||||
Date Fin
|
||||
<DatePicker
|
||||
name="one_sessiondatefin"
|
||||
id="one_sessiondatefin"
|
||||
selected={new Date(moment(p_filter_date_to, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
setp_filter_date_to(format(date, 'dd/MM/yyyy'));
|
||||
|
||||
}
|
||||
}
|
||||
showTimeSelect={false}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
className="disabled_style enable_style"
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div className="" style={{ "width": "30%" }}>
|
||||
Client <br />
|
||||
|
||||
{New_Get_List_Partner_Clients_result && New_Get_List_Partner_Clients_result.length > 0 &&
|
||||
|
||||
<Autocomplete
|
||||
disablePortal
|
||||
id="dialog_opport_ref_client"
|
||||
Name="dialog_opport_ref_client"
|
||||
|
||||
className="disabled_style"
|
||||
|
||||
options={New_Get_List_Partner_Clients_result}
|
||||
value={New_Get_List_Partner_Clients_result.filter((data) => (data)._id === String(p_detail_partner_client_id))[0].label}
|
||||
|
||||
onChange={(event, value) => {
|
||||
if (value && value._id) {
|
||||
|
||||
setp_detail_partner_client_id(value._id);
|
||||
|
||||
setp_detail_partner_client_nom(value.label);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
setp_detail_partner_client_id("");
|
||||
setp_detail_partner_client_nom("");
|
||||
}
|
||||
|
||||
Getall_Qry_Invoice_Data();
|
||||
|
||||
}}
|
||||
|
||||
renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
|
||||
inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}
|
||||
|
||||
/>
|
||||
}
|
||||
/>}
|
||||
</div>
|
||||
|
||||
</div>}
|
||||
<br />
|
||||
|
||||
<Button variant="contained" className="bton_enreg" onClick={(e) => {
|
||||
Getall_Qry_Invoice_Data();
|
||||
Getall_Qry_Invoice_Data_Group_By_Client();
|
||||
Getall_Qry_Quotation_Data();
|
||||
|
||||
}}> Afficher
|
||||
</Button><br />
|
||||
</div>
|
||||
|
||||
<div style={{ "float": "left", "width": "100%", "paddingRight": "5px" }}>
|
||||
|
||||
<div style={{ "float": "left", "width": String(display_column_size), "height": "42rem", "float": "left", "paddingRight": "5px" }} >
|
||||
<div className="titre1" style={{ "float": "left", "cursor": "none" }}>
|
||||
<nav style={{ "width": "90%", "float": "left", "textAlign": "center" }}> TBD Factures & Commandes </nav>
|
||||
<Tooltip className="tooltip_css" id="my-tooltip01" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my-tooltip01" data-tooltip-html="Ajouter à ma liste de TBD">
|
||||
<nav style={{ "width": "9%", "float": "right", "textAlign": "right", "cursor": "pointer" }}>
|
||||
<MdOutlineAddchart style={{ "cursor": "pointer", }} onClick={(e) => settdb_title("1")} />
|
||||
</nav>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{tdb_title && String(tdb_title) === "1" && <nav> Donnez un titre <TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
required
|
||||
name="tdb_title"
|
||||
id="tdb_title"
|
||||
text
|
||||
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
onChange={(e) => {
|
||||
settbd_title_value(e.target.value);
|
||||
}
|
||||
}
|
||||
disabled={false}
|
||||
className="disabled_style"
|
||||
|
||||
|
||||
/>
|
||||
<nav style={{ "textAlign": "center" }}> <button onClick={(event) => {
|
||||
setdashbord_internal_code("FACTURE_01")
|
||||
Add_To_User_TBD("tbd_facture_01");
|
||||
|
||||
}}> Ajouter </button> <button onClick={(e) => settdb_title("0")}> Fermer </button>
|
||||
</nav>
|
||||
|
||||
</nav>}
|
||||
|
||||
<Box style={{ "color": "black", "height": "30rem" }}>
|
||||
|
||||
|
||||
<div className="session_data" style={{ paddingLeft: "2rem" }}>
|
||||
|
||||
|
||||
{p_detail_partner_client_nom && String(p_detail_partner_client_nom) !== "" && " Client : " + { p_detail_partner_client_nom }}
|
||||
|
||||
{Getall_Qry_Invoice_Data_result_JSON && Getall_Qry_Invoice_Data_result_JSON.length > 0 &&
|
||||
Getall_Qry_Invoice_Data_result_JSON[0].data &&
|
||||
<BarChart
|
||||
|
||||
|
||||
dataset={Getall_Qry_Invoice_Data_result_JSON[0].data }
|
||||
xAxis={[{ scaleType: 'band', dataKey: 'month_year', tickPlacement: 'middle' }]}
|
||||
series={[
|
||||
{ dataKey: 'TotalAmount', label: 'CA', valueFormatter_CA },
|
||||
{ dataKey: 'count', label: 'Count', valueFormatter_count },
|
||||
|
||||
]}
|
||||
{...chartSetting}
|
||||
margin={{ right: 15, left: 100 }}
|
||||
|
||||
/>}
|
||||
</div>
|
||||
|
||||
</Box>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="div_row"> </div>
|
||||
|
||||
<div style={{ "float": "left", "width": "100%", "paddingRight": "5px" }}>
|
||||
|
||||
<div style={{ "float": "left", "width": String(display_column_size), "height": "42rem", "float": "left", "paddingRight": "5px" }} >
|
||||
<div className="titre1" style={{ "float": "left", "cursor": "none" }}>
|
||||
<nav style={{ "width": "90%", "float": "left", "textAlign": "center" }}> TBD Repartition CA par client </nav>
|
||||
<Tooltip className="tooltip_css" id="my-tooltip01" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my-tooltip01" data-tooltip-html="Ajouter à ma liste de TBD">
|
||||
<nav style={{ "width": "9%", "float": "right", "textAlign": "right", "cursor": "pointer" }}>
|
||||
<MdOutlineAddchart style={{ "cursor": "pointer", }} onClick={(e) => settdb_title("2")} />
|
||||
</nav>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{tdb_title && String(tdb_title) === "2" && <nav> Donnez un titre <TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
required
|
||||
name="tdb_title"
|
||||
id="tdb_title"
|
||||
text
|
||||
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
disabled={false}
|
||||
className="disabled_style"
|
||||
onChange={(e) => {
|
||||
settbd_title_value(e.target.value);
|
||||
}
|
||||
}
|
||||
|
||||
/>
|
||||
<nav style={{ "textAlign": "center" }}> <button onClick={(event) => {
|
||||
setdashbord_internal_code("FACTURE_02")
|
||||
Add_To_User_TBD("tbd_facture_02");
|
||||
|
||||
}}> Ajouter </button> <button onClick={(e) => settdb_title("0")}> Fermer </button>
|
||||
</nav>
|
||||
|
||||
</nav>}
|
||||
|
||||
<Box style={{ "color": "black", "height": "30rem" }}>
|
||||
|
||||
|
||||
{Getall_Qry_Invoice_Data_Group_By_Client_result_JSON && Getall_Qry_Invoice_Data_Group_By_Client_result_JSON.length > 0 &&
|
||||
Getall_Qry_Invoice_Data_Group_By_Client_result_JSON &&
|
||||
<div className="session_data">
|
||||
|
||||
<PieChart
|
||||
|
||||
series={[
|
||||
{
|
||||
data: Getall_Qry_Invoice_Data_Group_By_Client_result_JSON.map((d) => ({ label: d.label, id: d.label, value: d.value })),
|
||||
valueFormatter: (v, { dataIndex }) => {
|
||||
const { rank } = Getall_Qry_Invoice_Data_Group_By_Client_result_JSON[dataIndex];
|
||||
return ` ${v.value} €`;
|
||||
},
|
||||
arcLabel: getArcLabel22,
|
||||
cx: 250,
|
||||
cy: 200,
|
||||
innerRadius: 30,
|
||||
outerRadius: 150,
|
||||
},
|
||||
]}
|
||||
sx={{
|
||||
[`& .${pieArcLabelClasses.root}`]: {
|
||||
fill: 'white',
|
||||
fontSize: 12,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
}}
|
||||
width={800}
|
||||
height={400}
|
||||
|
||||
/>
|
||||
|
||||
</div>}
|
||||
|
||||
</Box>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="div_row"> </div>
|
||||
|
||||
|
||||
<div style={{ "float": "left", "width": "100%", "paddingRight": "5px" }}>
|
||||
|
||||
<div style={{ "float": "left", "width": String(display_column_size), "height": "42rem", "float": "left", "paddingRight": "5px" }} >
|
||||
<div className="titre1" style={{ "float": "left", "cursor": "none" }}>
|
||||
<nav style={{ "width": "90%", "float": "left", "textAlign": "center" }}> TBD Devis </nav>
|
||||
<Tooltip className="tooltip_css" id="my-tooltip01" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my-tooltip01" data-tooltip-html="Ajouter à ma liste de TBD">
|
||||
<nav style={{ "width": "9%", "float": "right", "textAlign": "right", "cursor": "pointer" }}>
|
||||
<MdOutlineAddchart style={{ "cursor": "pointer", }} onClick={(e) => settdb_title("3")} />
|
||||
</nav>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{tdb_title && String(tdb_title) === "3" && <nav> Donnez un titre <TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
required
|
||||
name="tdb_title"
|
||||
id="tdb_title"
|
||||
text
|
||||
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
onChange={(e) => {
|
||||
settbd_title_value(e.target.value);
|
||||
}
|
||||
}
|
||||
disabled={false}
|
||||
className="disabled_style"
|
||||
|
||||
|
||||
/>
|
||||
<nav style={{ "textAlign": "center" }}> <button onClick={(event) => {
|
||||
setdashbord_internal_code("FACTURE_03")
|
||||
Add_To_User_TBD("tbd_facture_03");
|
||||
|
||||
}}> Ajouter </button> <button onClick={(e) => settdb_title("0")}> Fermer </button>
|
||||
</nav>
|
||||
|
||||
</nav>}
|
||||
|
||||
<Box style={{ "color": "black", "height": "30rem" }}>
|
||||
|
||||
|
||||
<div className="session_data" style={{ paddingLeft: "2rem" }}>
|
||||
|
||||
|
||||
|
||||
{p_detail_partner_client_nom && String(p_detail_partner_client_nom) !== "" && " Client : " + { p_detail_partner_client_nom }}
|
||||
|
||||
{Getall_Qry_Quotation_Data_result_JSON && Getall_Qry_Quotation_Data_result_JSON.length > 0 &&
|
||||
Getall_Qry_Quotation_Data_result_JSON[0].data &&
|
||||
<BarChart
|
||||
|
||||
|
||||
dataset={Getall_Qry_Quotation_Data_result_JSON[0].data}
|
||||
xAxis={[{ scaleType: 'band', dataKey: 'month_year', tickPlacement: 'middle' }]}
|
||||
series={[
|
||||
{ dataKey: 'nb_devis_gagne', label: 'Gagné', color: '#41B06E' },
|
||||
{ dataKey: 'nb_devis_perdu', label: 'Perdu', color: '#FA7070'},
|
||||
|
||||
]}
|
||||
{...chartSetting}
|
||||
margin={{ right: 15, left: 100 }}
|
||||
|
||||
|
||||
/>}
|
||||
</div>
|
||||
|
||||
</Box>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="div_row"> </div>
|
||||
</div>)
|
||||
|
||||
}
|
||||
|
||||
|
||||
export default Dashbord_Factures;
|
|
@ -0,0 +1,655 @@
|
|||
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 "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
|
||||
import 'react-tooltip/dist/react-tooltip.css'
|
||||
import { Tooltip } from 'react-tooltip'
|
||||
import 'reactjs-popup/dist/index.css';
|
||||
import DatePicker from "react-datepicker";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import { format } from 'date-fns'
|
||||
import moment from "moment";
|
||||
import Box from '@mui/material/Box';
|
||||
import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
|
||||
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
|
||||
import { tokens } from "../theme";
|
||||
import { MdOutlineAddchart, } from "react-icons/md";
|
||||
import {
|
||||
useTheme,
|
||||
} from "@mui/material";
|
||||
import Autocomplete from '@mui/material/Autocomplete';
|
||||
import Popup from 'reactjs-popup';
|
||||
import 'reactjs-popup/dist/index.css';
|
||||
import { RiFileExcel2Line } from "react-icons/ri";
|
||||
import { BarChart } from '@mui/x-charts';
|
||||
import { MdDeleteForever } from "react-icons/md";
|
||||
import { TbColumns2, TbColumns1 } from "react-icons/tb";
|
||||
import { axisClasses } from '@mui/x-charts';
|
||||
import { pieArcLabelClasses } from '@mui/x-charts/PieChart';
|
||||
import Stack from '@mui/material/Stack';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { PieChart } from '@mui/x-charts/PieChart';
|
||||
import fileDownload from 'js-file-download'
|
||||
const pieParams = { height: 200, margin: { right: 5 } };
|
||||
const palette = ['red', 'blue', 'green'];
|
||||
|
||||
const Dashbord_Factures_Devis_Par_Periode = (props) => {
|
||||
const history = useHistory();
|
||||
const [isLoading, setLoading] = useState();
|
||||
|
||||
const theme = useTheme();
|
||||
const colors = tokens(theme.palette.mode);
|
||||
|
||||
const [isMySyDashboard, setisMySyDashboard] = useState(false);
|
||||
|
||||
var date_today_90j = new Date();
|
||||
date_today_90j.setDate(date_today_90j.getDate() - 90);
|
||||
const [selectionModel, setSelectionModel] = React.useState([]);
|
||||
const [p_filter_date_from, setp_filter_date_from] = useState(date_today_90j.toLocaleDateString('fr-FR'));
|
||||
const [p_filter_date_to, setp_filter_date_to] = useState(new Date().toLocaleDateString('fr-FR'));
|
||||
|
||||
|
||||
const [filter_value, setfilter_value] = useState("d");
|
||||
|
||||
const [filter_type_tache, setfilter_type_tache] = useState("");
|
||||
|
||||
const [tdb_title, settdb_title] = useState();
|
||||
|
||||
const [display_nb_column, setdisplay_nb_column] = useState("1");
|
||||
const [display_column_size, setdisplay_column_size] = useState("100%");
|
||||
|
||||
const [dashbord_internal_code, setdashbord_internal_code] = useState("");
|
||||
const [gridline_id, setgridline_id] = useState("");
|
||||
|
||||
const [user_dashbord_id, setuser_dashbord_id] = useState(props.user_dashbord_id);
|
||||
|
||||
const [Remove_From_User_TBD_api, setRemove_From_User_TBD_api] = useState();
|
||||
const [Remove_From_User_TBD_message, setRemove_From_User_TBD_message] = useState();
|
||||
const [Remove_From_User_TBD_result, setRemove_From_User_TBD_result] = useState();
|
||||
function Remove_From_User_TBD() {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("user_dashbord_id", user_dashbord_id);
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_To_User_Dashbord/";
|
||||
|
||||
//console.log(" ## myurl = ", myurl);
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Remove_From_User_TBD res.data.status = " + res.data.status);
|
||||
//console.log(" In Remove_From_User_TBD res.data.message r_class = " + res.data.message);
|
||||
|
||||
setRemove_From_User_TBD_api("true");
|
||||
setRemove_From_User_TBD_result(res.data.message);
|
||||
// Getall_Qry_Formation_Session();
|
||||
alert(res.data.message);
|
||||
window.location.reload();
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setRemove_From_User_TBD_api("false");
|
||||
setRemove_From_User_TBD_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Remove_From_User_TBD = ', error);
|
||||
setRemove_From_User_TBD_api("false");
|
||||
alert("Impossible de supprimer le tableau de bord de votre liste");
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const [Getall_Qry_Invoice_Data_result_JSON, setGetall_Qry_Invoice_Data_result_JSON] = useState([]);
|
||||
const [Getall_Qry_Invoice_Data_api, setGetall_Qry_Invoice_Data_api] = useState();
|
||||
const [Getall_Qry_Invoice_Data_message, setGetall_Qry_Invoice_Data_message] = useState();
|
||||
const [Getall_Qry_Invoice_Data_result, setGetall_Qry_Invoice_Data_result] = useState([]);
|
||||
function Getall_Qry_Invoice_Data(event) {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
|
||||
}
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("periode_start_date", date_from);
|
||||
form.append("periode_end_date", date_to);
|
||||
form.append("filter_value", filter_value);
|
||||
form.append("filter_client_id", p_detail_partner_client_id);
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_List_Factures_Data_By_Periode/";
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Getall_Qry_Invoice_Data res.data.status = " + res.data.status);
|
||||
//console.log(" In Getall_Qry_Invoice_Data res.data.message r_class = " + res.data.message);
|
||||
|
||||
setGetall_Qry_Invoice_Data_result_JSON(JSON.parse('[' + res.data.message + ']'));
|
||||
|
||||
var jsonObj = JSON.parse('[' + res.data.message + ']');
|
||||
|
||||
//console.log("jsonObj = ", jsonObj)
|
||||
|
||||
setGetall_Qry_Invoice_Data_api("true");
|
||||
setGetall_Qry_Invoice_Data_result(res.data.message);
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setGetall_Qry_Invoice_Data_api("false");
|
||||
setGetall_Qry_Invoice_Data_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Getall_Qry_Invoice_Data = ', error);
|
||||
setGetall_Qry_Invoice_Data_api("false");
|
||||
alert("Impossible de récuperer les données demandées")
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const chartSetting = {
|
||||
yAxis: [
|
||||
{
|
||||
label: "Chiffre d'affaire (€)",
|
||||
},
|
||||
],
|
||||
width: 600,
|
||||
height: 400,
|
||||
sx: {
|
||||
[`.${axisClasses.left} .${axisClasses.label}`]: {
|
||||
transform: 'translate(-20px, 0)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const valueFormatter_CA = (value) => `${value}€`;
|
||||
|
||||
const valueFormatter_count = (value) => `${value} Fact`;
|
||||
|
||||
const [Getall_Qry_Quotation_Data_result_JSON, setGetall_Qry_Quotation_Data_result_JSON] = useState([]);
|
||||
const [Getall_Qry_Quotation_Data_api, setGetall_Qry_Quotation_Data_api] = useState();
|
||||
const [Getall_Qry_Quotation_Data_message, setGetall_Qry_Quotation_Data_message] = useState();
|
||||
const [Getall_Qry_Quotation_Data_result, setGetall_Qry_Quotation_Data_result] = useState([]);
|
||||
function Getall_Qry_Quotation_Data(event) {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
|
||||
}
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("periode_start_date", date_from);
|
||||
form.append("periode_end_date", date_to);
|
||||
form.append("filter_value", filter_value);
|
||||
form.append("filter_client_id", p_detail_partner_client_id);
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_List_Quotation_Data_By_Periode/";
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Getall_Qry_Quotation_Data res.data.status = " + res.data.status);
|
||||
//console.log(" In Getall_Qry_Quotation_Data res.data.message r_class = " + res.data.message);
|
||||
|
||||
setGetall_Qry_Quotation_Data_result_JSON(JSON.parse('[' + res.data.message + ']'));
|
||||
|
||||
var jsonObj = JSON.parse('[' + res.data.message + ']');
|
||||
|
||||
//console.log("Getall_Qry_Quotation_Data_result_JSON jsonObj = ", jsonObj)
|
||||
|
||||
setGetall_Qry_Quotation_Data_api("true");
|
||||
setGetall_Qry_Quotation_Data_result(res.data.message);
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setGetall_Qry_Quotation_Data_api("false");
|
||||
setGetall_Qry_Quotation_Data_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Getall_Qry_Quotation_Data = ', error);
|
||||
setGetall_Qry_Quotation_Data_api("false");
|
||||
alert("Impossible de récuperer les données demandées")
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function Export_Dashbord_to_CSV(local_dashbord_internal_id) {
|
||||
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
date_from = date_from.replaceAll('/', "-")
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
date_to = date_to.replaceAll('/', "-")
|
||||
}
|
||||
|
||||
|
||||
var local_client_id = "";
|
||||
if (!p_detail_partner_client_id || String(p_detail_partner_client_id) === "") {
|
||||
local_client_id = "-"
|
||||
} else {
|
||||
local_client_id = p_detail_partner_client_id;
|
||||
}
|
||||
|
||||
console.log(" #### p_detail_partner_client_id = ", p_detail_partner_client_id, " ### local_client_id = ", local_client_id)
|
||||
var nom_fichier_cmd_excel = "export_excel.xlsx";
|
||||
//console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- local_dashbord_internal_id = ", local_dashbord_internal_id);
|
||||
|
||||
var url = process.env.REACT_APP_API_URL + "myclass/api/TBD_FACTURE_01_Export_Dashbord_To_Excel/" + stored_cookie + "/" + local_dashbord_internal_id + "/" + date_from + "/" + date_to + "/" + local_client_id + "/";
|
||||
|
||||
//console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url);
|
||||
|
||||
console.log(" #### url = ", url)
|
||||
|
||||
setLoading(true);
|
||||
axios.get(url, { responseType: 'blob', },)
|
||||
.then((res) => {
|
||||
setLoading(false);
|
||||
//console.log(" In Export_Dashbord_to_CSV res.data = " + res.data);
|
||||
if (String(res.data) === String("false")) {
|
||||
alert("Impossible d'exporter les données (2) ");
|
||||
} else {
|
||||
fileDownload(res.data, nom_fichier_cmd_excel)
|
||||
|
||||
}
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.error('Error:', error);
|
||||
alert(" Impossible d'exporter les données ")
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Get_List_Partner_Clients();
|
||||
Getall_Qry_Quotation_Data();
|
||||
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: "smooth",
|
||||
});
|
||||
|
||||
}, [])
|
||||
|
||||
const [New_Get_List_Partner_Clients_result, setNew_Get_List_Partner_Clients_result] = 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);
|
||||
|
||||
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_raison_sociale = JSON.parse(x).raison_sociale;
|
||||
var local_cond_paiement_id = JSON.parse(x).invoice_condition_paiement_id;
|
||||
|
||||
//---
|
||||
var node = {
|
||||
"_id": local_id,
|
||||
"id": localid,
|
||||
"label": local_nom,
|
||||
"nom": local_nom,
|
||||
"raison_sociale": local_raison_sociale,
|
||||
"invoice_condition_paiement_id": local_cond_paiement_id,
|
||||
|
||||
};
|
||||
new_data2.push(node);
|
||||
});
|
||||
|
||||
if (new_data2.length > 0)
|
||||
setNew_Get_List_Partner_Clients_result(new_data2);
|
||||
|
||||
var node = {
|
||||
"_id": "",
|
||||
"id": "",
|
||||
"label": "",
|
||||
"nom": "",
|
||||
"raison_sociale": "",
|
||||
"invoice_condition_paiement_id": "",
|
||||
|
||||
};
|
||||
new_data2.push(node);
|
||||
|
||||
}
|
||||
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 [p_detail_partner_client_id, setp_detail_partner_client_id] = useState("");
|
||||
const [p_detail_partner_client_nom, setp_detail_partner_client_nom] = useState("");
|
||||
|
||||
return (
|
||||
<div className="dashbord_session">
|
||||
{isLoading && <div className="loader-container">
|
||||
<div className="mysy_spinner"> <img src={img_loading_spin} /> </div>
|
||||
</div>}
|
||||
|
||||
|
||||
<div style={{ "height": "40rem" }}>
|
||||
|
||||
<div className="div_row">
|
||||
<div className="" style={{ "width": "30%" }}>
|
||||
Filtre <br />
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
required
|
||||
name="filtre11"
|
||||
id="filtre11"
|
||||
select
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
disabled={false}
|
||||
className="disabled_style"
|
||||
value={filter_value}
|
||||
onChange={(e) => {
|
||||
setfilter_value(e.target.value);
|
||||
}
|
||||
}
|
||||
|
||||
>
|
||||
<MenuItem value="m0" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Mois en cours </MenuItem>
|
||||
<MenuItem value="m1" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Mois précédant </MenuItem>
|
||||
<MenuItem value="d" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Choisir des dates </MenuItem>
|
||||
</TextField>
|
||||
</div>
|
||||
|
||||
{filter_value && String(filter_value) === "d" && <div>
|
||||
<div className="session_caract">
|
||||
Date Debut
|
||||
<DatePicker
|
||||
name="one_sessiondatedebut"
|
||||
id="one_sessiondatedebut"
|
||||
|
||||
selected={new Date(moment(p_filter_date_from, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
setp_filter_date_from(format(date, 'dd/MM/yyyy'));
|
||||
|
||||
}
|
||||
}
|
||||
showTimeSelect={false}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
className="disabled_style session_caract_Dialog_DatePicker"
|
||||
locale='fr-FR'
|
||||
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="session_caract">
|
||||
Date Fin
|
||||
<DatePicker
|
||||
name="one_sessiondatefin"
|
||||
id="one_sessiondatefin"
|
||||
selected={new Date(moment(p_filter_date_to, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
setp_filter_date_to(format(date, 'dd/MM/yyyy'));
|
||||
|
||||
}
|
||||
}
|
||||
showTimeSelect={false}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
className="disabled_style enable_style"
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div className="" style={{ "width": "30%" }}>
|
||||
Client <br />
|
||||
|
||||
{New_Get_List_Partner_Clients_result && New_Get_List_Partner_Clients_result.length > 0 &&
|
||||
|
||||
<Autocomplete
|
||||
disablePortal
|
||||
id="dialog_opport_ref_client"
|
||||
Name="dialog_opport_ref_client"
|
||||
|
||||
className="disabled_style"
|
||||
|
||||
options={New_Get_List_Partner_Clients_result}
|
||||
value={New_Get_List_Partner_Clients_result.filter((data) => (data)._id === String(p_detail_partner_client_id))[0].label}
|
||||
|
||||
onChange={(event, value) => {
|
||||
if (value && value._id) {
|
||||
|
||||
setp_detail_partner_client_id(value._id);
|
||||
setp_detail_partner_client_nom(value.label);
|
||||
|
||||
// console.log(" ### setp_detail_partner_client_id = ", p_detail_partner_client_id );
|
||||
|
||||
|
||||
} else {
|
||||
setp_detail_partner_client_id("");
|
||||
setp_detail_partner_client_nom("");
|
||||
}
|
||||
|
||||
Getall_Qry_Invoice_Data();
|
||||
|
||||
}}
|
||||
|
||||
renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
|
||||
inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}
|
||||
|
||||
/>
|
||||
}
|
||||
/>}
|
||||
</div>
|
||||
|
||||
</div>}
|
||||
<br />
|
||||
|
||||
<Button variant="contained" className="bton_enreg" onClick={(e) => {
|
||||
Getall_Qry_Quotation_Data();
|
||||
|
||||
}}> Afficher
|
||||
</Button><br />
|
||||
</div>
|
||||
|
||||
|
||||
<div className="titre1" style={{ "float": "left", "cursor": "none" }}>
|
||||
<nav style={{ "width": "80%", "float": "left", "textAlign": "center" }}> TBD : {props.user_dashbord_title} - Du : {props.user_dashbord_filter_start} au : {props.user_dashbord_filter_end}</nav>
|
||||
<Tooltip className="tooltip_css" id="my-tooltip02" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my-tooltip02" data-tooltip-html="Supprimer de ma liste de TBD">
|
||||
<Popup
|
||||
trigger={
|
||||
<nav style={{ "width": "9%", "float": "right", "textAlign": "right", "cursor": "pointer" }}>
|
||||
<MdDeleteForever style={{ "cursor": "pointer", }} />
|
||||
</nav>
|
||||
}
|
||||
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, le tableau sera supprimé de votre tableau de bord global.<br />
|
||||
Vous pourrez le rajouter à nouveau si besoin. <br />
|
||||
|
||||
</div>
|
||||
<div className="gest_actions">
|
||||
<div style={{ "width": "45%", "float": "left" }}>
|
||||
<button className="gest_bton_popup" onClick={(event) => {
|
||||
Remove_From_User_TBD();
|
||||
//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>
|
||||
</a>
|
||||
|
||||
<Tooltip className="tooltip_css" id="my-tooltip03" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my-tooltip03" data-tooltip-html="Export Csv/Excel">
|
||||
<nav style={{ "width": "9%", "float": "right", "textAlign": "right", "cursor": "pointer" }}>
|
||||
<RiFileExcel2Line style={{ "cursor": "pointer", }} onClick={(event) => {
|
||||
Export_Dashbord_to_CSV(props.user_dashbord_id);
|
||||
|
||||
}} />
|
||||
</nav>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<Box style={{ "color": "black", "height": "30rem" }}>
|
||||
|
||||
|
||||
<div className="session_data">
|
||||
|
||||
|
||||
{p_detail_partner_client_nom && String(p_detail_partner_client_nom) !== "" && " Client : " + p_detail_partner_client_nom}
|
||||
|
||||
{Getall_Qry_Quotation_Data_result_JSON && Getall_Qry_Quotation_Data_result_JSON.length > 0 &&
|
||||
Getall_Qry_Quotation_Data_result_JSON[0].data &&
|
||||
<BarChart
|
||||
|
||||
|
||||
dataset={Getall_Qry_Quotation_Data_result_JSON[0].data}
|
||||
xAxis={[{ scaleType: 'band', dataKey: 'month_year', tickPlacement: 'middle' }]}
|
||||
series={[
|
||||
{ dataKey: 'nb_devis_gagne', label: 'Gagné', color: '#41B06E' },
|
||||
{ dataKey: 'nb_devis_perdu', label: 'Perdu', color: '#FA7070' },
|
||||
|
||||
]}
|
||||
{...chartSetting}
|
||||
margin={{ right: 15, left: 100 }}
|
||||
|
||||
|
||||
/>}
|
||||
</div>
|
||||
|
||||
</Box>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
</div>)
|
||||
|
||||
}
|
||||
|
||||
|
||||
export default Dashbord_Factures_Devis_Par_Periode;
|
|
@ -0,0 +1,685 @@
|
|||
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 "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
|
||||
import 'react-tooltip/dist/react-tooltip.css'
|
||||
import { Tooltip } from 'react-tooltip'
|
||||
import 'reactjs-popup/dist/index.css';
|
||||
import DatePicker from "react-datepicker";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import { format } from 'date-fns'
|
||||
import moment from "moment";
|
||||
import Box from '@mui/material/Box';
|
||||
import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
|
||||
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
|
||||
import { tokens } from "../theme";
|
||||
import { MdOutlineAddchart, } from "react-icons/md";
|
||||
import {
|
||||
useTheme,
|
||||
} from "@mui/material";
|
||||
import Autocomplete from '@mui/material/Autocomplete';
|
||||
import Popup from 'reactjs-popup';
|
||||
import 'reactjs-popup/dist/index.css';
|
||||
import { RiFileExcel2Line } from "react-icons/ri";
|
||||
import { BarChart } from '@mui/x-charts';
|
||||
import { MdDeleteForever } from "react-icons/md";
|
||||
import { TbColumns2, TbColumns1 } from "react-icons/tb";
|
||||
import { axisClasses } from '@mui/x-charts';
|
||||
import { pieArcLabelClasses } from '@mui/x-charts/PieChart';
|
||||
import Stack from '@mui/material/Stack';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { PieChart } from '@mui/x-charts/PieChart';
|
||||
import fileDownload from 'js-file-download'
|
||||
|
||||
|
||||
const Dashbord_Factures_Par_Client = (props) => {
|
||||
const history = useHistory();
|
||||
const [isLoading, setLoading] = useState();
|
||||
|
||||
const theme = useTheme();
|
||||
const colors = tokens(theme.palette.mode);
|
||||
|
||||
const [isMySyDashboard, setisMySyDashboard] = useState(false);
|
||||
|
||||
var date_today_90j = new Date();
|
||||
date_today_90j.setDate(date_today_90j.getDate() - 90);
|
||||
const [selectionModel, setSelectionModel] = React.useState([]);
|
||||
const [p_filter_date_from, setp_filter_date_from] = useState(date_today_90j.toLocaleDateString('fr-FR'));
|
||||
const [p_filter_date_to, setp_filter_date_to] = useState(new Date().toLocaleDateString('fr-FR'));
|
||||
|
||||
|
||||
const [filter_value, setfilter_value] = useState("d");
|
||||
|
||||
const [filter_type_tache, setfilter_type_tache] = useState("");
|
||||
|
||||
const [tdb_title, settdb_title] = useState();
|
||||
|
||||
const [display_nb_column, setdisplay_nb_column] = useState("1");
|
||||
const [display_column_size, setdisplay_column_size] = useState("100%");
|
||||
|
||||
const [dashbord_internal_code, setdashbord_internal_code] = useState("");
|
||||
const [gridline_id, setgridline_id] = useState("");
|
||||
|
||||
const [user_dashbord_id, setuser_dashbord_id] = useState(props.user_dashbord_id);
|
||||
|
||||
const [Remove_From_User_TBD_api, setRemove_From_User_TBD_api] = useState();
|
||||
const [Remove_From_User_TBD_message, setRemove_From_User_TBD_message] = useState();
|
||||
const [Remove_From_User_TBD_result, setRemove_From_User_TBD_result] = useState();
|
||||
function Remove_From_User_TBD() {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("user_dashbord_id", user_dashbord_id);
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_To_User_Dashbord/";
|
||||
|
||||
//console.log(" ## myurl = ", myurl);
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Remove_From_User_TBD res.data.status = " + res.data.status);
|
||||
//console.log(" In Remove_From_User_TBD res.data.message r_class = " + res.data.message);
|
||||
|
||||
setRemove_From_User_TBD_api("true");
|
||||
setRemove_From_User_TBD_result(res.data.message);
|
||||
// Getall_Qry_Formation_Session();
|
||||
alert(res.data.message);
|
||||
window.location.reload();
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setRemove_From_User_TBD_api("false");
|
||||
setRemove_From_User_TBD_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Remove_From_User_TBD = ', error);
|
||||
setRemove_From_User_TBD_api("false");
|
||||
alert("Impossible de supprimer le tableau de bord de votre liste");
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const [Getall_Qry_Invoice_Data_result_JSON, setGetall_Qry_Invoice_Data_result_JSON] = useState([]);
|
||||
const [Getall_Qry_Invoice_Data_api, setGetall_Qry_Invoice_Data_api] = useState();
|
||||
const [Getall_Qry_Invoice_Data_message, setGetall_Qry_Invoice_Data_message] = useState();
|
||||
const [Getall_Qry_Invoice_Data_result, setGetall_Qry_Invoice_Data_result] = useState([]);
|
||||
function Getall_Qry_Invoice_Data(event) {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
|
||||
}
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("periode_start_date", date_from);
|
||||
form.append("periode_end_date", date_to);
|
||||
form.append("filter_value", filter_value);
|
||||
form.append("filter_client_id", p_detail_partner_client_id);
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_List_Factures_Data_By_Periode/";
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Getall_Qry_Invoice_Data res.data.status = " + res.data.status);
|
||||
//console.log(" In Getall_Qry_Invoice_Data res.data.message r_class = " + res.data.message);
|
||||
|
||||
setGetall_Qry_Invoice_Data_result_JSON(JSON.parse('[' + res.data.message + ']'));
|
||||
|
||||
var jsonObj = JSON.parse('[' + res.data.message + ']');
|
||||
|
||||
//console.log("jsonObj = ", jsonObj)
|
||||
|
||||
setGetall_Qry_Invoice_Data_api("true");
|
||||
setGetall_Qry_Invoice_Data_result(res.data.message);
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setGetall_Qry_Invoice_Data_api("false");
|
||||
setGetall_Qry_Invoice_Data_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Getall_Qry_Invoice_Data = ', error);
|
||||
setGetall_Qry_Invoice_Data_api("false");
|
||||
alert("Impossible de récuperer les données demandées")
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const chartSetting = {
|
||||
yAxis: [
|
||||
{
|
||||
label: "Chiffre d'affaire (€)",
|
||||
},
|
||||
],
|
||||
width: 600,
|
||||
height: 400,
|
||||
sx: {
|
||||
[`.${axisClasses.left} .${axisClasses.label}`]: {
|
||||
transform: 'translate(5px, 0)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const valueFormatter_CA = (value) => `${value}€`;
|
||||
|
||||
const valueFormatter_count = (value) => `${value} Fact`;
|
||||
|
||||
const [total, settotal] = useState(1);
|
||||
|
||||
const getArcLabel22 = (params) => {
|
||||
const percent = params.value / parseFloat(String(total));
|
||||
return `${(percent * 100).toFixed(0)}%`;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const sizing = {
|
||||
margin: { right: 10, left: 10 },
|
||||
width: 400,
|
||||
height: 400,
|
||||
legend: { hidden: false },
|
||||
};
|
||||
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_result_JSON, setGetall_Qry_Invoice_Data_Group_By_Client_result_JSON] = useState([]);
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_api, setGetall_Qry_Invoice_Data_Group_By_Client_api] = useState();
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_message, setGetall_Qry_Invoice_Data_Group_By_Client_message] = useState();
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_result, setGetall_Qry_Invoice_Data_Group_By_Client_result] = useState([]);
|
||||
function Getall_Qry_Invoice_Data_Group_By_Client(event) {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
|
||||
}
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("periode_start_date", date_from);
|
||||
form.append("periode_end_date", date_to);
|
||||
form.append("filter_value", filter_value);
|
||||
form.append("filter_client_id", p_detail_partner_client_id);
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_List_Factures_Data_By_Client_Periode/";
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
console.log(" In Getall_Qry_Invoice_Data_Group_By_Client res.data.status = " + res.data.status);
|
||||
console.log(" In Getall_Qry_Invoice_Data_Group_By_Client res.data.message r_class = " + res.data.message);
|
||||
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_result_JSON(JSON.parse('[' + res.data.message + ']'));
|
||||
|
||||
var jsonObj = JSON.parse('[' + res.data.message + ']');
|
||||
|
||||
console.log("jsonObj Group by Client = ", jsonObj)
|
||||
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_api("true");
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_result(res.data.message);
|
||||
var local_total = 0;
|
||||
const new_data = res.data.message.map((x) => {
|
||||
var local_value = JSON.parse(x).value;
|
||||
local_total = local_total + parseFloat(String(local_value));
|
||||
|
||||
});
|
||||
|
||||
settotal(parseFloat(String(local_total)));
|
||||
|
||||
}
|
||||
else {
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_api("false");
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Getall_Qry_Invoice_Data_Group_By_Client = ', error);
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_api("false");
|
||||
alert("Impossible de récuperer les données demandées")
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Get_List_Partner_Clients();
|
||||
Getall_Qry_Invoice_Data_Group_By_Client();
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: "smooth",
|
||||
});
|
||||
|
||||
}, [])
|
||||
|
||||
const [New_Get_List_Partner_Clients_result, setNew_Get_List_Partner_Clients_result] = 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);
|
||||
|
||||
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_raison_sociale = JSON.parse(x).raison_sociale;
|
||||
var local_cond_paiement_id = JSON.parse(x).invoice_condition_paiement_id;
|
||||
|
||||
//---
|
||||
var node = {
|
||||
"_id": local_id,
|
||||
"id": localid,
|
||||
"label": local_nom,
|
||||
"nom": local_nom,
|
||||
"raison_sociale": local_raison_sociale,
|
||||
"invoice_condition_paiement_id": local_cond_paiement_id,
|
||||
|
||||
};
|
||||
new_data2.push(node);
|
||||
});
|
||||
|
||||
if (new_data2.length > 0)
|
||||
setNew_Get_List_Partner_Clients_result(new_data2);
|
||||
|
||||
var node = {
|
||||
"_id": "",
|
||||
"id": "",
|
||||
"label": "",
|
||||
"nom": "",
|
||||
"raison_sociale": "",
|
||||
"invoice_condition_paiement_id": "",
|
||||
|
||||
};
|
||||
new_data2.push(node);
|
||||
|
||||
}
|
||||
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("")
|
||||
})
|
||||
}
|
||||
|
||||
function Export_Dashbord_to_CSV(local_dashbord_internal_id) {
|
||||
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
date_from = date_from.replaceAll('/', "-")
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
date_to = date_to.replaceAll('/', "-")
|
||||
}
|
||||
|
||||
var local_client_id = "";
|
||||
if (!p_detail_partner_client_id || String(p_detail_partner_client_id) === "") {
|
||||
local_client_id = "-"
|
||||
} else {
|
||||
local_client_id = p_detail_partner_client_id;
|
||||
}
|
||||
|
||||
var nom_fichier_cmd_excel = "export_excel.xlsx";
|
||||
//console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- local_dashbord_internal_id = ", local_dashbord_internal_id);
|
||||
|
||||
var url = process.env.REACT_APP_API_URL + "myclass/api/TBD_FACTURE_01_Export_Dashbord_To_Excel/" + stored_cookie + "/" + local_dashbord_internal_id + "/" + date_from + "/" + date_to + "/" + local_client_id + "/";
|
||||
|
||||
//console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url);
|
||||
console.log(" ### url zzz = ", url);
|
||||
|
||||
setLoading(true);
|
||||
axios.get(url, { responseType: 'blob', },)
|
||||
.then((res) => {
|
||||
setLoading(false);
|
||||
//console.log(" In Export_Dashbord_to_CSV res.data = " + res.data);
|
||||
if (String(res.data) === String("false")) {
|
||||
alert("Impossible d'exporter les données (2) ");
|
||||
} else {
|
||||
fileDownload(res.data, nom_fichier_cmd_excel)
|
||||
|
||||
}
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.error('Error:', error);
|
||||
alert(" Impossible d'exporter les données ")
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
const [p_detail_partner_client_id, setp_detail_partner_client_id] = useState("");
|
||||
const [p_detail_partner_client_nom, setp_detail_partner_client_nom] = useState("");
|
||||
|
||||
return (
|
||||
<div className="dashbord_session">
|
||||
{isLoading && <div className="loader-container">
|
||||
<div className="mysy_spinner"> <img src={img_loading_spin} /> </div>
|
||||
</div>}
|
||||
|
||||
|
||||
<div style={{ "height": "40rem" }}>
|
||||
|
||||
<div className="div_row">
|
||||
<div className="" style={{ "width": "30%" }}>
|
||||
Filtre <br />
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
required
|
||||
name="filtre11"
|
||||
id="filtre11"
|
||||
select
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
disabled={false}
|
||||
className="disabled_style"
|
||||
value={filter_value}
|
||||
onChange={(e) => {
|
||||
setfilter_value(e.target.value);
|
||||
}
|
||||
}
|
||||
|
||||
>
|
||||
<MenuItem value="m0" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Mois en cours </MenuItem>
|
||||
<MenuItem value="m1" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Mois précédant </MenuItem>
|
||||
<MenuItem value="d" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Choisir des dates </MenuItem>
|
||||
</TextField>
|
||||
</div>
|
||||
|
||||
{filter_value && String(filter_value) === "d" && <div>
|
||||
<div className="session_caract">
|
||||
Date Debut
|
||||
<DatePicker
|
||||
name="one_sessiondatedebut"
|
||||
id="one_sessiondatedebut"
|
||||
|
||||
selected={new Date(moment(p_filter_date_from, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
setp_filter_date_from(format(date, 'dd/MM/yyyy'));
|
||||
|
||||
}
|
||||
}
|
||||
showTimeSelect={false}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
className="disabled_style session_caract_Dialog_DatePicker"
|
||||
locale='fr-FR'
|
||||
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="session_caract">
|
||||
Date Fin
|
||||
<DatePicker
|
||||
name="one_sessiondatefin"
|
||||
id="one_sessiondatefin"
|
||||
selected={new Date(moment(p_filter_date_to, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
setp_filter_date_to(format(date, 'dd/MM/yyyy'));
|
||||
|
||||
}
|
||||
}
|
||||
showTimeSelect={false}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
className="disabled_style enable_style"
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div className="" style={{ "width": "30%" }}>
|
||||
Client <br />
|
||||
|
||||
{New_Get_List_Partner_Clients_result && New_Get_List_Partner_Clients_result.length > 0 &&
|
||||
|
||||
<Autocomplete
|
||||
disablePortal
|
||||
id="dialog_opport_ref_client"
|
||||
Name="dialog_opport_ref_client"
|
||||
|
||||
className="disabled_style"
|
||||
|
||||
options={New_Get_List_Partner_Clients_result}
|
||||
value={New_Get_List_Partner_Clients_result.filter((data) => (data)._id === String(p_detail_partner_client_id))[0].label}
|
||||
|
||||
onChange={(event, value) => {
|
||||
if (value && value._id) {
|
||||
|
||||
setp_detail_partner_client_id(value._id);
|
||||
|
||||
setp_detail_partner_client_nom(value.label);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
setp_detail_partner_client_id("");
|
||||
setp_detail_partner_client_nom("");
|
||||
}
|
||||
|
||||
Getall_Qry_Invoice_Data();
|
||||
|
||||
}}
|
||||
|
||||
renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
|
||||
inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}
|
||||
|
||||
/>
|
||||
}
|
||||
/>}
|
||||
</div>
|
||||
|
||||
</div>}
|
||||
<br />
|
||||
|
||||
<Button variant="contained" className="bton_enreg" onClick={(e) => {
|
||||
|
||||
Getall_Qry_Invoice_Data_Group_By_Client();
|
||||
|
||||
}}> Afficher
|
||||
</Button><br />
|
||||
</div>
|
||||
|
||||
|
||||
<div className="titre1" style={{ "float": "left", "cursor": "none" }}>
|
||||
<nav style={{ "width": "80%", "float": "left", "textAlign": "center" }}> TBD : {props.user_dashbord_title} - Du : {props.user_dashbord_filter_start} au : {props.user_dashbord_filter_end}</nav>
|
||||
<Tooltip className="tooltip_css" id="my-tooltip02" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my-tooltip02" data-tooltip-html="Supprimer de ma liste de TBD">
|
||||
<Popup
|
||||
trigger={
|
||||
<nav style={{ "width": "9%", "float": "right", "textAlign": "right", "cursor": "pointer" }}>
|
||||
<MdDeleteForever style={{ "cursor": "pointer", }} />
|
||||
</nav>
|
||||
}
|
||||
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, le tableau sera supprimé de votre tableau de bord global.<br />
|
||||
Vous pourrez le rajouter à nouveau si besoin. <br />
|
||||
|
||||
</div>
|
||||
<div className="gest_actions">
|
||||
<div style={{ "width": "45%", "float": "left" }}>
|
||||
<button className="gest_bton_popup" onClick={(event) => {
|
||||
Remove_From_User_TBD();
|
||||
//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>
|
||||
</a>
|
||||
|
||||
<Tooltip className="tooltip_css" id="my-tooltip03" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my-tooltip03" data-tooltip-html="Export Csv/Excel">
|
||||
<nav style={{ "width": "9%", "float": "right", "textAlign": "right", "cursor": "pointer" }}>
|
||||
<RiFileExcel2Line style={{ "cursor": "pointer", }} onClick={(event) => {
|
||||
Export_Dashbord_to_CSV(props.user_dashbord_id);
|
||||
|
||||
}} />
|
||||
</nav>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div style={{ "float": "left", "width": "100%", "paddingRight": "5px" }}>
|
||||
|
||||
<div style={{ "float": "left", "width": String(display_column_size), "height": "42rem", "float": "left", "paddingRight": "5px" }} >
|
||||
|
||||
<Box style={{ "color": "black", "height": "30rem" }}>
|
||||
|
||||
|
||||
{Getall_Qry_Invoice_Data_Group_By_Client_result_JSON && Getall_Qry_Invoice_Data_Group_By_Client_result_JSON.length > 0 &&
|
||||
Getall_Qry_Invoice_Data_Group_By_Client_result_JSON &&
|
||||
<div className="session_data">
|
||||
|
||||
<PieChart
|
||||
series={[
|
||||
{
|
||||
|
||||
data: Getall_Qry_Invoice_Data_Group_By_Client_result_JSON.map((d) => ({ label: d.label, id: d.label, value: d.value })),
|
||||
valueFormatter: (v, { dataIndex }) => {
|
||||
const { rank } = Getall_Qry_Invoice_Data_Group_By_Client_result_JSON[dataIndex];
|
||||
return ` ${v.value} €`;
|
||||
},
|
||||
|
||||
arcLabel: getArcLabel22,
|
||||
cx: 250,
|
||||
cy: 200,
|
||||
innerRadius: 30,
|
||||
outerRadius: 150,
|
||||
},
|
||||
]}
|
||||
sx={{
|
||||
[`& .${pieArcLabelClasses.root}`]: {
|
||||
fill: 'white',
|
||||
fontSize: 12,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
}}
|
||||
width={800}
|
||||
height={400}
|
||||
|
||||
/>
|
||||
|
||||
</div>}
|
||||
|
||||
</Box>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
</div>)
|
||||
|
||||
}
|
||||
|
||||
|
||||
export default Dashbord_Factures_Par_Client;
|
|
@ -0,0 +1,653 @@
|
|||
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 "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
|
||||
import 'react-tooltip/dist/react-tooltip.css'
|
||||
import { Tooltip } from 'react-tooltip'
|
||||
import 'reactjs-popup/dist/index.css';
|
||||
import DatePicker from "react-datepicker";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import { format } from 'date-fns'
|
||||
import moment from "moment";
|
||||
import Box from '@mui/material/Box';
|
||||
import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
|
||||
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
|
||||
import { tokens } from "./../theme";
|
||||
import { MdOutlineAddchart, } from "react-icons/md";
|
||||
import {
|
||||
useTheme,
|
||||
} from "@mui/material";
|
||||
import Autocomplete from '@mui/material/Autocomplete';
|
||||
import Popup from 'reactjs-popup';
|
||||
import 'reactjs-popup/dist/index.css';
|
||||
import { RiFileExcel2Line } from "react-icons/ri";
|
||||
import { BarChart } from '@mui/x-charts';
|
||||
import { MdDeleteForever } from "react-icons/md";
|
||||
import { TbColumns2, TbColumns1 } from "react-icons/tb";
|
||||
import { axisClasses } from '@mui/x-charts';
|
||||
import { pieArcLabelClasses } from '@mui/x-charts/PieChart';
|
||||
import Stack from '@mui/material/Stack';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { PieChart } from '@mui/x-charts/PieChart';
|
||||
import fileDownload from 'js-file-download'
|
||||
const pieParams = { height: 200, margin: { right: 5 } };
|
||||
const palette = ['red', 'blue', 'green'];
|
||||
|
||||
const Dashbord_Factures_Par_Periode = (props) => {
|
||||
const history = useHistory();
|
||||
const [isLoading, setLoading] = useState();
|
||||
|
||||
const theme = useTheme();
|
||||
const colors = tokens(theme.palette.mode);
|
||||
|
||||
const [isMySyDashboard, setisMySyDashboard] = useState(false);
|
||||
|
||||
var date_today_90j = new Date();
|
||||
date_today_90j.setDate(date_today_90j.getDate() - 90);
|
||||
const [selectionModel, setSelectionModel] = React.useState([]);
|
||||
const [p_filter_date_from, setp_filter_date_from] = useState(date_today_90j.toLocaleDateString('fr-FR'));
|
||||
const [p_filter_date_to, setp_filter_date_to] = useState(new Date().toLocaleDateString('fr-FR'));
|
||||
|
||||
|
||||
const [filter_value, setfilter_value] = useState("d");
|
||||
|
||||
const [filter_type_tache, setfilter_type_tache] = useState("");
|
||||
|
||||
const [tdb_title, settdb_title] = useState();
|
||||
|
||||
const [display_nb_column, setdisplay_nb_column] = useState("1");
|
||||
const [display_column_size, setdisplay_column_size] = useState("100%");
|
||||
|
||||
const [dashbord_internal_code, setdashbord_internal_code] = useState("");
|
||||
const [gridline_id, setgridline_id] = useState("");
|
||||
|
||||
const [user_dashbord_id, setuser_dashbord_id] = useState(props.user_dashbord_id);
|
||||
|
||||
const [Remove_From_User_TBD_api, setRemove_From_User_TBD_api] = useState();
|
||||
const [Remove_From_User_TBD_message, setRemove_From_User_TBD_message] = useState();
|
||||
const [Remove_From_User_TBD_result, setRemove_From_User_TBD_result] = useState();
|
||||
function Remove_From_User_TBD() {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("user_dashbord_id", user_dashbord_id);
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_To_User_Dashbord/";
|
||||
|
||||
//console.log(" ## myurl = ", myurl);
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Remove_From_User_TBD res.data.status = " + res.data.status);
|
||||
//console.log(" In Remove_From_User_TBD res.data.message r_class = " + res.data.message);
|
||||
|
||||
setRemove_From_User_TBD_api("true");
|
||||
setRemove_From_User_TBD_result(res.data.message);
|
||||
// Getall_Qry_Formation_Session();
|
||||
alert(res.data.message);
|
||||
window.location.reload();
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setRemove_From_User_TBD_api("false");
|
||||
setRemove_From_User_TBD_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Remove_From_User_TBD = ', error);
|
||||
setRemove_From_User_TBD_api("false");
|
||||
alert("Impossible de supprimer le tableau de bord de votre liste");
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const [Getall_Qry_Invoice_Data_result_JSON, setGetall_Qry_Invoice_Data_result_JSON] = useState([]);
|
||||
const [Getall_Qry_Invoice_Data_api, setGetall_Qry_Invoice_Data_api] = useState();
|
||||
const [Getall_Qry_Invoice_Data_message, setGetall_Qry_Invoice_Data_message] = useState();
|
||||
const [Getall_Qry_Invoice_Data_result, setGetall_Qry_Invoice_Data_result] = useState([]);
|
||||
function Getall_Qry_Invoice_Data(event) {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
|
||||
}
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("periode_start_date", date_from);
|
||||
form.append("periode_end_date", date_to);
|
||||
form.append("filter_value", filter_value);
|
||||
form.append("filter_client_id", p_detail_partner_client_id);
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_List_Factures_Data_By_Periode/";
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Getall_Qry_Invoice_Data res.data.status = " + res.data.status);
|
||||
//console.log(" In Getall_Qry_Invoice_Data res.data.message r_class = " + res.data.message);
|
||||
|
||||
setGetall_Qry_Invoice_Data_result_JSON(JSON.parse('[' + res.data.message + ']'));
|
||||
|
||||
var jsonObj = JSON.parse('[' + res.data.message + ']');
|
||||
|
||||
//console.log("jsonObj = ", jsonObj)
|
||||
|
||||
setGetall_Qry_Invoice_Data_api("true");
|
||||
setGetall_Qry_Invoice_Data_result(res.data.message);
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setGetall_Qry_Invoice_Data_api("false");
|
||||
setGetall_Qry_Invoice_Data_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Getall_Qry_Invoice_Data = ', error);
|
||||
setGetall_Qry_Invoice_Data_api("false");
|
||||
alert("Impossible de récuperer les données demandées")
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const chartSetting = {
|
||||
yAxis: [
|
||||
{
|
||||
label: "Chiffre d'affaire (€)",
|
||||
},
|
||||
],
|
||||
width: 600,
|
||||
height: 400,
|
||||
sx: {
|
||||
[`.${axisClasses.left} .${axisClasses.label}`]: {
|
||||
transform: 'translate(-20px, 0)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const valueFormatter_CA = (value) => `${value}€`;
|
||||
|
||||
const valueFormatter_count = (value) => `${value} Fact`;
|
||||
|
||||
|
||||
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_result_JSON, setGetall_Qry_Invoice_Data_Group_By_Client_result_JSON] = useState([]);
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_api, setGetall_Qry_Invoice_Data_Group_By_Client_api] = useState();
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_message, setGetall_Qry_Invoice_Data_Group_By_Client_message] = useState();
|
||||
const [Getall_Qry_Invoice_Data_Group_By_Client_result, setGetall_Qry_Invoice_Data_Group_By_Client_result] = useState([]);
|
||||
function Getall_Qry_Invoice_Data_Group_By_Client(event) {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
|
||||
}
|
||||
|
||||
|
||||
form.append("token", stored_cookie);
|
||||
form.append("periode_start_date", date_from);
|
||||
form.append("periode_end_date", date_to);
|
||||
form.append("filter_value", filter_value);
|
||||
form.append("filter_client_id", p_detail_partner_client_id);
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Qery_List_Factures_Data_By_Client_Periode/";
|
||||
|
||||
setLoading(true);
|
||||
axios.post(myurl, form).then(res => {
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
console.log(" In Getall_Qry_Invoice_Data_Group_By_Client res.data.status = " + res.data.status);
|
||||
console.log(" In Getall_Qry_Invoice_Data_Group_By_Client res.data.message r_class = " + res.data.message);
|
||||
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_result_JSON(JSON.parse('[' + res.data.message + ']'));
|
||||
|
||||
var jsonObj = JSON.parse('[' + res.data.message + ']');
|
||||
|
||||
console.log("jsonObj Group by Client = ", jsonObj)
|
||||
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_api("true");
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_result(res.data.message);
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_api("false");
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_message(res.data.message);
|
||||
alert(res.data.message)
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Getall_Qry_Invoice_Data_Group_By_Client = ', error);
|
||||
setGetall_Qry_Invoice_Data_Group_By_Client_api("false");
|
||||
alert("Impossible de récuperer les données demandées")
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function Export_Dashbord_to_CSV(local_dashbord_internal_id) {
|
||||
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var date_from = "";
|
||||
if (p_filter_date_from) {
|
||||
date_from = p_filter_date_from;
|
||||
date_from = date_from.replaceAll('/', "-")
|
||||
|
||||
}
|
||||
|
||||
var date_to = "";
|
||||
if (p_filter_date_to) {
|
||||
date_to = p_filter_date_to;
|
||||
date_to = date_to.replaceAll('/', "-")
|
||||
}
|
||||
|
||||
|
||||
var local_client_id = "";
|
||||
if( !p_detail_partner_client_id || String(p_detail_partner_client_id) === ""){
|
||||
local_client_id = "-"
|
||||
}else{
|
||||
local_client_id = p_detail_partner_client_id;
|
||||
}
|
||||
|
||||
console.log(" #### p_detail_partner_client_id = ", p_detail_partner_client_id, " ### local_client_id = ", local_client_id)
|
||||
var nom_fichier_cmd_excel = "export_excel.xlsx";
|
||||
//console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- local_dashbord_internal_id = ", local_dashbord_internal_id);
|
||||
|
||||
var url = process.env.REACT_APP_API_URL + "myclass/api/TBD_FACTURE_01_Export_Dashbord_To_Excel/" + stored_cookie + "/" + local_dashbord_internal_id+"/"+date_from+"/"+date_to+"/"+local_client_id+"/";
|
||||
|
||||
//console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url);
|
||||
|
||||
console.log(" #### url = ", url)
|
||||
|
||||
setLoading(true);
|
||||
axios.get(url, { responseType: 'blob', },)
|
||||
.then((res) => {
|
||||
setLoading(false);
|
||||
//console.log(" In Export_Dashbord_to_CSV res.data = " + res.data);
|
||||
if (String(res.data) === String("false")) {
|
||||
alert("Impossible d'exporter les données (2) ");
|
||||
} else {
|
||||
fileDownload(res.data, nom_fichier_cmd_excel)
|
||||
|
||||
}
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.error('Error:', error);
|
||||
alert(" Impossible d'exporter les données ")
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
Getall_Qry_Invoice_Data();
|
||||
Get_List_Partner_Clients();
|
||||
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: "smooth",
|
||||
});
|
||||
|
||||
}, [])
|
||||
|
||||
const [New_Get_List_Partner_Clients_result, setNew_Get_List_Partner_Clients_result] = 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);
|
||||
|
||||
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_raison_sociale = JSON.parse(x).raison_sociale;
|
||||
var local_cond_paiement_id = JSON.parse(x).invoice_condition_paiement_id;
|
||||
|
||||
//---
|
||||
var node = {
|
||||
"_id": local_id,
|
||||
"id": localid,
|
||||
"label": local_nom,
|
||||
"nom": local_nom,
|
||||
"raison_sociale": local_raison_sociale,
|
||||
"invoice_condition_paiement_id": local_cond_paiement_id,
|
||||
|
||||
};
|
||||
new_data2.push(node);
|
||||
});
|
||||
|
||||
if (new_data2.length > 0)
|
||||
setNew_Get_List_Partner_Clients_result(new_data2);
|
||||
|
||||
var node = {
|
||||
"_id": "",
|
||||
"id": "",
|
||||
"label": "",
|
||||
"nom": "",
|
||||
"raison_sociale": "",
|
||||
"invoice_condition_paiement_id": "",
|
||||
|
||||
};
|
||||
new_data2.push(node);
|
||||
|
||||
}
|
||||
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 [p_detail_partner_client_id, setp_detail_partner_client_id] = useState("");
|
||||
const [p_detail_partner_client_nom, setp_detail_partner_client_nom] = useState("");
|
||||
|
||||
return (
|
||||
<div className="dashbord_session">
|
||||
{isLoading && <div className="loader-container">
|
||||
<div className="mysy_spinner"> <img src={img_loading_spin} /> </div>
|
||||
</div>}
|
||||
|
||||
|
||||
<div style={{ "height": "40rem" }}>
|
||||
|
||||
<div className="div_row">
|
||||
<div className="" style={{ "width": "30%" }}>
|
||||
Filtre <br />
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
required
|
||||
name="filtre11"
|
||||
id="filtre11"
|
||||
select
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
disabled={false}
|
||||
className="disabled_style"
|
||||
value={filter_value}
|
||||
onChange={(e) => {
|
||||
setfilter_value(e.target.value);
|
||||
}
|
||||
}
|
||||
|
||||
>
|
||||
<MenuItem value="m0" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Mois en cours </MenuItem>
|
||||
<MenuItem value="m1" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Mois précédant </MenuItem>
|
||||
<MenuItem value="d" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Choisir des dates </MenuItem>
|
||||
</TextField>
|
||||
</div>
|
||||
|
||||
{filter_value && String(filter_value) === "d" && <div>
|
||||
<div className="session_caract">
|
||||
Date Debut
|
||||
<DatePicker
|
||||
name="one_sessiondatedebut"
|
||||
id="one_sessiondatedebut"
|
||||
|
||||
selected={new Date(moment(p_filter_date_from, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
setp_filter_date_from(format(date, 'dd/MM/yyyy'));
|
||||
|
||||
}
|
||||
}
|
||||
showTimeSelect={false}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
className="disabled_style session_caract_Dialog_DatePicker"
|
||||
locale='fr-FR'
|
||||
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="session_caract">
|
||||
Date Fin
|
||||
<DatePicker
|
||||
name="one_sessiondatefin"
|
||||
id="one_sessiondatefin"
|
||||
selected={new Date(moment(p_filter_date_to, "DD/MM/YYYY"))}
|
||||
onChange={(date) => {
|
||||
setp_filter_date_to(format(date, 'dd/MM/yyyy'));
|
||||
|
||||
}
|
||||
}
|
||||
showTimeSelect={false}
|
||||
dateFormat="dd/MM/yyyy"
|
||||
className="disabled_style enable_style"
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div className="" style={{ "width": "30%" }}>
|
||||
Client <br />
|
||||
|
||||
{New_Get_List_Partner_Clients_result && New_Get_List_Partner_Clients_result.length > 0 &&
|
||||
|
||||
<Autocomplete
|
||||
disablePortal
|
||||
id="dialog_opport_ref_client"
|
||||
Name="dialog_opport_ref_client"
|
||||
|
||||
className="disabled_style"
|
||||
|
||||
options={New_Get_List_Partner_Clients_result}
|
||||
value={New_Get_List_Partner_Clients_result.filter((data) => (data)._id === String(p_detail_partner_client_id))[0].label}
|
||||
|
||||
onChange={(event, value) => {
|
||||
if (value && value._id) {
|
||||
|
||||
setp_detail_partner_client_id(value._id);
|
||||
setp_detail_partner_client_nom(value.label);
|
||||
|
||||
// console.log(" ### setp_detail_partner_client_id = ", p_detail_partner_client_id );
|
||||
|
||||
|
||||
} else {
|
||||
setp_detail_partner_client_id("");
|
||||
setp_detail_partner_client_nom("");
|
||||
}
|
||||
|
||||
Getall_Qry_Invoice_Data();
|
||||
|
||||
}}
|
||||
|
||||
renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
|
||||
inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}
|
||||
|
||||
/>
|
||||
}
|
||||
/>}
|
||||
</div>
|
||||
|
||||
</div>}
|
||||
<br />
|
||||
|
||||
<Button variant="contained" className="bton_enreg" onClick={(e) => {
|
||||
Getall_Qry_Invoice_Data();
|
||||
//Getall_Qry_Invoice_Data_Group_By_Client();
|
||||
|
||||
}}> Afficher
|
||||
</Button><br />
|
||||
</div>
|
||||
|
||||
|
||||
<div className="titre1" style={{ "float": "left", "cursor": "none" }}>
|
||||
<nav style={{ "width": "80%", "float": "left", "textAlign": "center" }}> TBD : {props.user_dashbord_title} - Du : {props.user_dashbord_filter_start} au : {props.user_dashbord_filter_end}</nav>
|
||||
<Tooltip className="tooltip_css" id="my-tooltip02" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my-tooltip02" data-tooltip-html="Supprimer de ma liste de TBD">
|
||||
<Popup
|
||||
trigger={
|
||||
<nav style={{ "width": "9%", "float": "right", "textAlign": "right", "cursor": "pointer" }}>
|
||||
<MdDeleteForever style={{ "cursor": "pointer", }} />
|
||||
</nav>
|
||||
}
|
||||
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, le tableau sera supprimé de votre tableau de bord global.<br />
|
||||
Vous pourrez le rajouter à nouveau si besoin. <br />
|
||||
|
||||
</div>
|
||||
<div className="gest_actions">
|
||||
<div style={{ "width": "45%", "float": "left" }}>
|
||||
<button className="gest_bton_popup" onClick={(event) => {
|
||||
Remove_From_User_TBD();
|
||||
//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>
|
||||
</a>
|
||||
|
||||
<Tooltip className="tooltip_css" id="my-tooltip03" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my-tooltip03" data-tooltip-html="Export Csv/Excel">
|
||||
<nav style={{ "width": "9%", "float": "right", "textAlign": "right", "cursor": "pointer" }}>
|
||||
<RiFileExcel2Line style={{ "cursor": "pointer", }} onClick={(event) => {
|
||||
Export_Dashbord_to_CSV(props.user_dashbord_id);
|
||||
|
||||
}} />
|
||||
</nav>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<Box style={{ "color": "black", "height": "30rem" }}>
|
||||
|
||||
|
||||
<div className="session_data">
|
||||
|
||||
|
||||
{p_detail_partner_client_nom && String(p_detail_partner_client_nom) !== "" && " Client : " + p_detail_partner_client_nom }
|
||||
|
||||
{Getall_Qry_Invoice_Data_result_JSON && Getall_Qry_Invoice_Data_result_JSON.length > 0 &&
|
||||
Getall_Qry_Invoice_Data_result_JSON[0].data &&
|
||||
<BarChart
|
||||
|
||||
|
||||
dataset={Getall_Qry_Invoice_Data_result_JSON[0].data}
|
||||
xAxis={[{ scaleType: 'band', dataKey: 'month_year', tickPlacement: 'middle' }]}
|
||||
series={[
|
||||
{ dataKey: 'TotalAmount', label: 'CA', valueFormatter_CA },
|
||||
{ dataKey: 'count', label: 'Count', valueFormatter_count },
|
||||
|
||||
]}
|
||||
{...chartSetting}
|
||||
margin={{right: 15, left: 100}}
|
||||
|
||||
/>}
|
||||
</div>
|
||||
|
||||
</Box>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
</div>)
|
||||
|
||||
}
|
||||
|
||||
|
||||
export default Dashbord_Factures_Par_Periode;
|
|
@ -25,6 +25,9 @@ import Dashbord_Formation_Evol_Session from "./Dashbord_Formation_Evol_Session";
|
|||
import Dashbord_Ressources_Humaines_Tache_by_rhid from "./Dashbord_Ressources_Humaines_Tache_by_rhid";
|
||||
import Dashbord_Ressources_Humaines_Tache_Couts from "./Dashbord_Ressources_Humaines_Tache_Couts";
|
||||
import Dashbord_Inscriptions_all_inscriptions from "./Dashbord_Inscription_All_Inscription";
|
||||
import Dashbord_Factures_Par_Periode from "./Dashbord_Factures_Par_Periode";
|
||||
import Dashbord_Factures_Par_Client from "./Dashbord_Factures_Par_Client";
|
||||
import Dashbord_Factures_Devis_Par_Periode from "./Dashbord_Factures_Devis_Par_Periode";
|
||||
|
||||
import { TbColumns2, TbColumns1 } from "react-icons/tb";
|
||||
|
||||
|
@ -119,6 +122,7 @@ const Mon_Tableau_De_Bord = (props) => {
|
|||
}} />
|
||||
</a> </div>
|
||||
|
||||
{/* Gestion des TBD des sessions et formations */}
|
||||
{display_nb_column && <div>
|
||||
{Get_Connected_User_Dashbord_result &&
|
||||
Get_Connected_User_Dashbord_result.map((step) => (
|
||||
|
@ -165,6 +169,8 @@ const Mon_Tableau_De_Bord = (props) => {
|
|||
))}
|
||||
</div>}
|
||||
|
||||
|
||||
{/* Gestion des TBD des ressources humaines */}
|
||||
{display_nb_column && <div>
|
||||
{Get_Connected_User_Dashbord_result &&
|
||||
Get_Connected_User_Dashbord_result.map((step) => (
|
||||
|
@ -211,7 +217,47 @@ const Mon_Tableau_De_Bord = (props) => {
|
|||
))}
|
||||
</div>}
|
||||
|
||||
{!Get_Connected_User_Dashbord_result || Get_Connected_User_Dashbord_result.length <= 0 && <div>
|
||||
|
||||
{/* Gestion des TBD des factures */}
|
||||
{display_nb_column && <div>
|
||||
{Get_Connected_User_Dashbord_result &&
|
||||
Get_Connected_User_Dashbord_result.map((step) => (
|
||||
|
||||
<div className="div_row" style={{ "width": String(display_column_size), "float": "left", "paddingRight": "2px" }}>
|
||||
|
||||
{String(JSON.parse(step).dashbord_internal_code) === "tbd_facture_01" &&
|
||||
|
||||
<Dashbord_Factures_Par_Periode user_dashbord_id={String(JSON.parse(step)._id)}
|
||||
user_dashbord_title={String(JSON.parse(step).title)}
|
||||
user_dashbord_filter_start={String(JSON.parse(step).start_date)}
|
||||
user_dashbord_filter_end={String(JSON.parse(step).end_date)} />
|
||||
}
|
||||
|
||||
{String(JSON.parse(step).dashbord_internal_code) === "tbd_facture_02" &&
|
||||
|
||||
<Dashbord_Factures_Par_Client user_dashbord_id={String(JSON.parse(step)._id)}
|
||||
user_dashbord_title={String(JSON.parse(step).title)}
|
||||
user_dashbord_filter_start={String(JSON.parse(step).start_date)}
|
||||
user_dashbord_filter_end={String(JSON.parse(step).end_date)} />
|
||||
}
|
||||
|
||||
{String(JSON.parse(step).dashbord_internal_code) === "tbd_facture_03" &&
|
||||
|
||||
<Dashbord_Factures_Devis_Par_Periode user_dashbord_id={String(JSON.parse(step)._id)}
|
||||
user_dashbord_title={String(JSON.parse(step).title)}
|
||||
user_dashbord_filter_start={String(JSON.parse(step).start_date)}
|
||||
user_dashbord_filter_end={String(JSON.parse(step).end_date)} />
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
))}
|
||||
</div>}
|
||||
|
||||
{String(Get_Connected_User_Dashbord_api) === "true" && (!Get_Connected_User_Dashbord_result || Get_Connected_User_Dashbord_result.length <= 0) && <div>
|
||||
|
||||
|
||||
<div className="div_row">
|
||||
|
|
|
@ -58,6 +58,7 @@ import Partner_Configuration_Jours_Travail from "./Partner_Config_Jours_Travail"
|
|||
import Dashbord_Session from "./Dashbord_Session";
|
||||
import Dashbord_Ressources_Humaines from "./Dashbord_Ressources_Humaines";
|
||||
import Dashbord_Inscriptions from "./Dashbord_Inscription";
|
||||
import Dashbord_Factures from "./Dashbord_Factures";
|
||||
import Materiel_Salle from "./Materiel_Salle";
|
||||
import CRM_Opportunite from "./Crm_Opportunite";
|
||||
import Partner_Config_Formulaires from "./Partner_Config_Formulaires";
|
||||
|
@ -410,7 +411,7 @@ const Partner = (props) => {
|
|||
'mes_stagiaires', 'mes_employes', 'mon_materiel', 'config_document', 'factures_client', "setuplms", "config_technique",
|
||||
"config_champ_specific", "module_agenda", "config_session_steps", "config_jours_heures", "dashbord_formation",
|
||||
"dashbord_session", "mon_tableau_de_bord", "prix_achat", "mes_apprenants", "dashbord_ressources_humaines",
|
||||
"dashbord_inscriptions", "mes_salles", "mes_opportunites", "config_formulaires"]
|
||||
"dashbord_inscriptions", "mes_salles", "mes_opportunites", "config_formulaires", "dashbord_factures"]
|
||||
|
||||
|
||||
if (action && list_menu.includes(action)) {
|
||||
|
@ -923,6 +924,21 @@ const Partner = (props) => {
|
|||
}
|
||||
}
|
||||
|
||||
function config_dashbord_factures_func(event) {
|
||||
var security_retval = check_user_acces_right("dashbord", "read");
|
||||
|
||||
if (security_retval === 1) {
|
||||
setmenu("dashbord_factures");
|
||||
setapiexcelimportmessage();
|
||||
setformation_file_name();
|
||||
document.body.style.backgroundColor = "#ffffff";
|
||||
history.push("/Partner/dashbord_factures");
|
||||
inactive_active_menu_header("my_tbd");
|
||||
} else {
|
||||
Dialog_1_handle_acces_insuffisant("Vos droits ne sont pas suffisants pour acceder à la gestion du matériel pédagogique");
|
||||
}
|
||||
}
|
||||
|
||||
function DiplaytrainingList(event) {
|
||||
|
||||
inactive_active_menu_header("my_class");
|
||||
|
@ -1653,6 +1669,9 @@ const Partner = (props) => {
|
|||
{String(menu) !== "dashbord_inscriptions" && <MenuItem onClick={config_dashbord_inscriptions_func} className="sousmenu" icon={<FcFinePrint className="icone_menu" />}> INSCRIPTIONS </MenuItem>}
|
||||
{String(menu) === "dashbord_inscriptions" && <MenuItem onClick={config_dashbord_inscriptions_func} className="sousmenu_selected" icon={<FcFinePrint className="icone_menu" />}> INSCRIPTIONS </MenuItem>}
|
||||
|
||||
{String(menu) !== "dashbord_factures" && <MenuItem onClick={config_dashbord_factures_func} className="sousmenu" icon={<FcFinePrint className="icone_menu" />}> FACTURES </MenuItem>}
|
||||
{String(menu) === "dashbord_factures" && <MenuItem onClick={config_dashbord_factures_func} className="sousmenu_selected" icon={<FcFinePrint className="icone_menu" />}> FACTURES </MenuItem>}
|
||||
|
||||
|
||||
</SubMenu>
|
||||
|
||||
|
@ -1695,134 +1714,6 @@ const Partner = (props) => {
|
|||
|
||||
</div>
|
||||
|
||||
|
||||
{/* <div>
|
||||
<div class="separator"> Mes partenaires </div>
|
||||
|
||||
<div>
|
||||
<hr className="my_hr" />
|
||||
{String(menu) !== "mes_clients" && <div className="sousmenu" onClick={mes_clients_func}><FcBusinesswoman className="icone_menu" />CLIENTS / FINANCEURS</div>}
|
||||
{String(menu) === "mes_clients" && <div className="sousmenu_selected" onClick={mes_clients_func}> <FcBusinesswoman className="icone_menu" />CLIENTS / FINANCEURS</div>}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<hr className="my_hr" />
|
||||
{String(menu) !== "mes_opportunites" && <div className="sousmenu" onClick={Display_mes_opportunites_func}><MdAddShoppingCart className="icone_menu" />OPPORTUNITES</div>}
|
||||
{String(menu) === "mes_opportunites" && <div className="sousmenu_selected" onClick={Display_mes_opportunites_func}><MdAddShoppingCart className="icone_menu" />OPPORTUNITES</div>}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<hr className="my_hr" />
|
||||
{String(menu) !== "pricing" && <div className="sousmenu" onClick={pricing_func} ><FcCurrencyExchange className="icone_menu" />MES PRIX CLIENT</div>}
|
||||
{String(menu) === "pricing" && <div className="sousmenu_selected" onClick={pricing_func} ><FcCurrencyExchange className="icone_menu" />MES PRIX CLIENT</div>}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<hr className="my_hr" />
|
||||
{String(menu) !== "mes_cmd" && <div className="sousmenu" onClick={mes_cmd_func}><FcCollect className="icone_menu" />MES COMMANDES & DEVIS</div>}
|
||||
{String(menu) === "mes_cmd" && <div className="sousmenu_selected" onClick={mes_cmd_func}><FcCollect className="icone_menu" />MES COMMANDES & DEVIS</div>}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<hr className="my_hr" />
|
||||
{String(menu) !== "factures_client" && <div className="sousmenu" onClick={mes_factures_client_func}><FcKindle className="icone_menu" />MES FACTURES</div>}
|
||||
{String(menu) === "factures_client" && <div className="sousmenu_selected" onClick={mes_factures_client_func}> <FcCollect FcKindle="icone_menu" />MES FACTURES</div>}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<hr className="my_hr" />
|
||||
{String(menu) !== "prix_achat" && <div className="sousmenu" onClick={prix_achat_func}><BiPurchaseTag className="icone_menu" />MES PRIX ACHAT</div>}
|
||||
{String(menu) === "prix_achat" && <div className="sousmenu_selected" onClick={prix_achat_func}> <BiPurchaseTag FcKindle="icone_menu" />MES PRIX ACHAT</div>}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="separator"> Espace E-Learning </div>
|
||||
|
||||
|
||||
{String(has_partner_lms_url) === "1" && <div className="sousmenu" onClick={(e) => {
|
||||
e.preventDefault();
|
||||
window.open(
|
||||
partner_lms_url,
|
||||
'_blank'
|
||||
);
|
||||
}}><FcVideoCall className="icone_menu" />MON HEBERGEMENT </div>}
|
||||
|
||||
{String(has_partner_lms_url) === "1" && <div>
|
||||
<hr className="my_hr" />
|
||||
{String(menu) !== "statistique" && <div className="sousmenu" onClick={DisplaySetUpLMS}><FcServices className="icone_menu" />CONFIGURATION</div>}
|
||||
{String(menu) === "statistique" && <div className="sousmenu_hebergement_lms" onClick={DisplaySetUpLMS}> <FcServices className="icone_menu" />CONFIGURATION</div>}
|
||||
</div>}
|
||||
|
||||
<div class="separator"> Configuration </div>
|
||||
<div className="sousmenu" >
|
||||
<Dropdown title="Configuration Technique "
|
||||
|
||||
>
|
||||
<Dropdown.Item >
|
||||
{String(menu) !== "config_document" && <div className="sousmenu" onClick={config_document_func}> <FcFinePrint className="icone_menu" /> MES DOCUMENTS</div>}
|
||||
{String(menu) === "config_document" && <div className="sousmenu_selected" onClick={config_document_func}> <FcFinePrint className="icone_menu" /> MES DOCUMENTS</div>}
|
||||
</Dropdown.Item>
|
||||
|
||||
<Dropdown.Item>
|
||||
{String(menu) !== "config_champ_specific" && <div className="sousmenu" onClick={config_specfic_fields_func}> <FcFinePrint className="icone_menu" /> CHAMP SPECIFIQUE</div>}
|
||||
{String(menu) === "config_champ_specific" && <div className="sousmenu_selected" onClick={config_specfic_fields_func}> <FcFinePrint className="icone_menu" /> CHAMP SPECIFIQUE</div>}
|
||||
</Dropdown.Item>
|
||||
<Dropdown.Item>
|
||||
{String(menu) !== "config_technique" && <div className="sousmenu" onClick={config_technique_func}> <FcFinePrint className="icone_menu" /> TECHNIQUE</div>}
|
||||
{String(menu) === "config_technique" && <div className="sousmenu_selected" onClick={config_technique_func}> <FcFinePrint className="icone_menu" /> TECHNIQUE</div>}
|
||||
|
||||
</Dropdown.Item>
|
||||
|
||||
<Dropdown.Item>
|
||||
{String(menu) !== "config_session_steps" && <div className="sousmenu" onClick={config_session_steps_func}> <FcFinePrint className="icone_menu" /> SESSION ETAPE</div>}
|
||||
{String(menu) === "config_session_steps" && <div className="sousmenu_selected" onClick={config_session_steps_func}> <FcFinePrint className="icone_menu" /> SESSION ETAPE</div>}
|
||||
|
||||
</Dropdown.Item>
|
||||
|
||||
<Dropdown.Item>
|
||||
{String(menu) !== "config_jours_heures" && <div className="sousmenu" onClick={config_jours_travaille_func}> <FcFinePrint className="icone_menu" /> JOURS & HEURES</div>}
|
||||
{String(menu) === "config_jours_heures" && <div className="sousmenu_selected" onClick={config_jours_travaille_func}> <FcFinePrint className="icone_menu" /> JOURS & HEURES</div>}
|
||||
|
||||
</Dropdown.Item>
|
||||
|
||||
<Dropdown.Item>
|
||||
{String(menu) !== "config_formulaires" && <div className="sousmenu" onClick={config_formulaires_func}> <FcFinePrint className="icone_menu" /> FORMULAIRES</div>}
|
||||
{String(menu) === "config_formulaires" && <div className="sousmenu_selected" onClick={config_formulaires_func}> <FcFinePrint className="icone_menu" /> FORMULAIRES</div>}
|
||||
|
||||
</Dropdown.Item>
|
||||
|
||||
|
||||
|
||||
</Dropdown>
|
||||
</div>
|
||||
|
||||
<div className="sousmenu" >
|
||||
<Dropdown title="Tableaux de bord " >
|
||||
<Dropdown.Item >
|
||||
{String(menu) !== "dashbord_formation" && <div className="sousmenu" onClick={config_dashbord_formation_func}> <FcFinePrint className="icone_menu" /> FORMATION</div>}
|
||||
{String(menu) === "dashbord_formation" && <div className="sousmenu_selected" onClick={config_dashbord_formation_func}> <FcFinePrint className="icone_menu" /> FORMATION</div>}
|
||||
</Dropdown.Item>
|
||||
|
||||
<Dropdown.Item>
|
||||
{String(menu) !== "dashbord_session" && <div className="sousmenu" onClick={config_dashbord_session_func}> <FcFinePrint className="icone_menu" /> SESSION</div>}
|
||||
{String(menu) === "dashbord_session" && <div className="sousmenu_selected" onClick={config_dashbord_session_func}> <FcFinePrint className="icone_menu" /> SESSION</div>}
|
||||
</Dropdown.Item>
|
||||
|
||||
<Dropdown.Item>
|
||||
{String(menu) !== "dashbord_ressources_humaines" && <div className="sousmenu" onClick={config_dashbord_ressources_humaines_func}> <FcFinePrint className="icone_menu" /> RES. HUMAINES</div>}
|
||||
{String(menu) === "dashbord_ressources_humaines" && <div className="sousmenu_selected" onClick={config_dashbord_ressources_humaines_func}> <FcFinePrint className="icone_menu" /> RES. HUMAINES</div>}
|
||||
</Dropdown.Item>
|
||||
|
||||
<Dropdown.Item>
|
||||
{String(menu) !== "dashbord_inscriptions" && <div className="sousmenu" onClick={config_dashbord_inscriptions_func}> <FcFinePrint className="icone_menu" /> INSCRIPTIONS</div>}
|
||||
{String(menu) === "dashbord_inscriptions" && <div className="sousmenu_selected" onClick={config_dashbord_inscriptions_func}> <FcFinePrint className="icone_menu" /> INSCRIPTIONS</div>}
|
||||
</Dropdown.Item>
|
||||
|
||||
|
||||
</Dropdown>
|
||||
</div>
|
||||
|
||||
</div>*/}
|
||||
</ThemeProvider>
|
||||
</div>
|
||||
|
||||
|
@ -2190,11 +2081,15 @@ const Partner = (props) => {
|
|||
}
|
||||
|
||||
{String(menu) === "dashbord_inscriptions" && <div className="div_droite">
|
||||
|
||||
<Dashbord_Inscriptions conntected_employee_id={conntected_employee_id} read_access={check_user_acces_right("dashbord", "read")} write_access={check_user_acces_right("dashbord", "write")} />
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
{String(menu) === "dashbord_factures" && <div className="div_droite">
|
||||
<Dashbord_Factures conntected_employee_id={conntected_employee_id} read_access={check_user_acces_right("dashbord", "read")} write_access={check_user_acces_right("dashbord", "write")} />
|
||||
</div>
|
||||
}
|
||||
{String(menu) === "mon_tableau_de_bord" && <div className="div_droite">
|
||||
|
||||
<Mon_Tableau_De_Bord conntected_employee_id={conntected_employee_id} read_access={check_user_acces_right("dashbord", "read")} write_access={check_user_acces_right("dashbord", "write")} />
|
||||
|
|
|
@ -2608,8 +2608,10 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.MuiMenu-paper {
|
||||
max-width: 30% !important;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue