import React, { useRef, useState, useEffect } from "react"; import TextField from '@mui/material/TextField'; import MenuItem from '@mui/material/MenuItem'; import 'react-confirm-alert/src/react-confirm-alert.css'; // Import css import Button from '@mui/material/Button'; import axios from "axios"; import { getCookie, setCookie } from 'react-use-cookie'; import { useHistory } from "react-router-dom"; import CheckOut from "./CheckOut"; import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid'; import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css"; import { Editor } from '@tinymce/tinymce-react'; import parse from 'html-react-parser'; import { FcViewDetails, FcDisapprove } from "react-icons/fc"; import 'react-tooltip/dist/react-tooltip.css' import { Tooltip } from 'react-tooltip' import add_plus from "../mysy_img/plus.png"; import excel_icone from "../mysy_img/excel_icone.png"; import participants from "../mysy_img/participants.png"; import fileDownload from 'js-file-download' import Popup from 'reactjs-popup'; import 'reactjs-popup/dist/index.css'; import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint } from "react-icons/fc"; import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import { format } from 'date-fns' import moment from "moment"; import InputAdornment from '@mui/material/InputAdornment'; import { AiFillCloseCircle } from "react-icons/ai"; import Box from '@mui/material/Box'; import { Typography, LinearProgress, sliderClasses } from '@mui/material'; import styled from 'styled-components'; import { CiTrash } from "react-icons/ci"; import { MdAddCircleOutline, MdRemoveCircleOutline } from "react-icons/md"; import Dialog from '@mui/material/Dialog'; import DialogActions from '@mui/material/DialogActions'; import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogTitle from '@mui/material/DialogTitle'; import { TransitionProps } from '@mui/material/transitions'; import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif"; const Partner_Configuration_Technique = (props) => { const history = useHistory(); const [submenu, setsubmenu] = useState(""); const [rowss, setRows] = useState([]); const [selectionModel, setSelectionModel] = React.useState([]); const [rows_order_lines, setrows_order_lines] = useState([]); const [selectionModel_order_lines, setselectionModel_order_lines] = React.useState([]); var date_today_90j = new Date(); date_today_90j.setDate(date_today_90j.getDate() + 90); const [p_filtre1, setp_filtre1] = useState(); const [p_filtre1_value, setp_filtre1_value] = useState(); const [p_filtre2, setp_filtre2] = useState(); const [p_filtre2_value, setp_filtre2_value] = useState(); const [p_filtre3, setp_filtre3] = useState(); const [p_filtre3_value, setp_filtre3_value] = useState(); const [p_filtre4, setp_filtre4] = useState(); const [p_filtre4_value, setp_filtre4_value] = useState(); const [isLoading, setLoading] = useState(); const columns = [ { field: '_id', headerName: '_id', hide: true }, { field: 'id', headerName: 'id', hide: true }, { field: 'config_name', headerName: 'Nom Configuration', flex: 1, hide: false, editable: false }, { field: 'config_value', headerName: 'Valeur config', flex: 1, hide: false, editable: false }, { field: "delete", headerName: 'Supprimer', renderCell: (cellValues) => { return ( { // handleClick_delete(event, cellValues); }} > } modal nested position="center center" > {close => (
MySy Information
{' '} En confirmant cette opération, le document sera définitivement supprimé.
)}
); } } ] const myRef = useRef(null) useEffect(() => { Getall_Parter_config_Points(); if (myRef_head) myRef_head.current.scrollIntoView({ behavior: "smooth" }); }, []) const [Getall_Parter_config_Points_api, setGetall_Parter_config_Points_api] = useState(); const [Getall_Parter_config_Points_message, setGetall_Parter_config_Points_message] = useState(); const [Getall_Parter_config_Points_result, setGetall_Parter_config_Points_result] = useState(); function Getall_Parter_config_Points(event) { var form = new FormData(); const stored_cookie = getCookie('tokenmysypart'); form.append("token", stored_cookie); var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Partner_Basic_Setup/"; axios.post(myurl, form).then(res => { if (String(res.data.status) === String("true")) { //console.log(" In Getall_Parter_config_Points res.data.status = " + res.data.status); //console.log(" In Getall_Parter_config_Points res.data.message r_class = " + res.data.message); setGetall_Parter_config_Points_api("true"); setGetall_Parter_config_Points_result(res.data.message); setRows(res.data.message); } else { setGetall_Parter_config_Points_api("false"); setGetall_Parter_config_Points_message(res.data.message); alert(res.data.message); } }).catch((error) => { console.warn('Not good man :( Getall_Parter_config_Points = ', error); setGetall_Parter_config_Points_api("false"); alert(" Impossible de recuperer la liste des points de configuration"); //setmyApimyApiMessage("") }) } const [display_detail_config, setdisplay_detail_config] = React.useState(); function handleClick_edit_config_From_Line(selected_row_id) { //submenu_detail_employe(); var line = JSON.parse(rowss[selected_row_id]); setdisplay_detail_config("1"); //console.log("### line = ", line); var invoice_id = line._id; setselected_id(invoice_id); var local_config_name = line.config_name; setp_detail_config_point(local_config_name); var local_config_value = line.config_value; setp_detail_config_valeur(local_config_value); if (myRef) { myRef.current.scrollIntoView({ behavior: "smooth" }); } } const myRef_head = useRef(null); const [selected_id, setselected_id] = useState(""); const [Dialog_1_message, setDialog_1_message] = React.useState(false); const [Dialog_1_open, setDialog_1_open] = React.useState(false); function Dialog_1_handle_change_participant_session(message) { setDialog_1_message(message); setDialog_1_open(true); } const Dialog_1_handleClose = () => { //alert(" Utiliser le bouton 'fermer' "); //setOpen(false); }; const Dialog_1_handleClose_buton = () => { setDialog_1_open(false); }; const [p_detail_config_valeur, setp_detail_config_valeur] = useState(""); const [Config_data_changed, setConfig_data_changed] = useState(""); const [p_detail_config_point, setp_detail_config_point] = useState(""); const [config_data_edit_mode, setconfig_data_edit_mode] = useState(""); return (
{isLoading &&
} MySy Information {Dialog_1_message}

Votre configuration technique

Utilisez les filtres !
{ setp_filtre1(e.target.value); }} > Nom du point de configuration  
{p_filtre1 && { setp_filtre1_value(e.target.value); }} InputProps={{ endAdornment: ( { setp_filtre1_value(""); }} /> ), }} /> }
{p_filtre1 &&
  { setp_filtre2("1"); setp_filtre2_value(""); }} />
} {p_filtre1 &&
  { setp_filtre1(); setp_filtre1_value(); }} />
}

  { setSelectionModel(newSelectionModel); if (newSelectionModel.length === 1) handleClick_edit_config_From_Line(newSelectionModel); if (newSelectionModel.length !== 1) { setp_detail_config_valeur(); setp_detail_config_point(); setConfig_data_changed(); setconfig_data_edit_mode(); setdisplay_detail_config(); } }} selectionModel={selectionModel} localeText={frFR.components.MuiDataGrid.defaultProps.localeText} rows={rowss.map((item, index) => ( { id: index, _id: JSON.parse(item)._id, config_name: JSON.parse(item).config_name, config_value: JSON.parse(item).config_value, } ))} columns={columns} pageSize={10} className="datagridclass" rowsPerPageOptions={[10]} //disableSelectionOnClick components={{ Toolbar: GridToolbar, }} //sx={datagridSx} getCellClassName={(params) => { //field === "order_header_status" if (params.field === "order_header_status" && String(params.value) == "0") { return 'cell--status--brouillon'; } if (params.field === "order_header_status" && String(params.value) == "1") { return 'cell--status--encours'; } if (params.field === "order_header_status" && String(params.value) == "2") { return 'cell--status--traite'; } if (params.field === "order_header_status" && String(params.value) == "3") { return 'cell--status--facture'; } }} getRowClassName={(params) => { if (String(params.row.status) === "-1") { return 'line--statut--annule'; } if (String(params.row.status) === "0") { return 'line--statut--preinscrit'; } if (String(params.row.status) === "1") { return 'line--statut--inscrit'; } }} />
 
{String(display_detail_config) === "1" &&
{String(config_data_edit_mode) === "1" &&
Point de configuration
{ setp_detail_config_point(e.target.value); setConfig_data_changed("1"); } } > Brouillon    En cours   Traité   Annulé  
} {String(config_data_edit_mode) !== "1" &&
Point de configuration
} {String(config_data_edit_mode) === "1" &&
Valeur de configuration
{ setp_detail_config_valeur(e.target.value); setConfig_data_changed("1"); } } />
} {String(config_data_edit_mode) !== "1" &&
Valeur de configuration
}
 
{String(Config_data_changed) === "1" && String(config_data_edit_mode) === "1" &&
/!\ Pensez à enregistrer les modifications
}
{String(config_data_edit_mode) === "1" && String(Config_data_changed) === "1" &&
} {String(config_data_edit_mode) === "1" &&
}
{String(config_data_edit_mode) !== "1" &&
}
 
}
) } export default Partner_Configuration_Technique;