1179 lines
52 KiB
JavaScript
1179 lines
52 KiB
JavaScript
import React, { useRef, useState, useEffect } from "react";
|
|
import TextField from '@mui/material/TextField';
|
|
import MenuItem from '@mui/material/MenuItem';
|
|
import 'react-confirm-alert/src/react-confirm-alert.css'; // Import css
|
|
import Button from '@mui/material/Button';
|
|
import axios from "axios";
|
|
import { getCookie, setCookie } from 'react-use-cookie';
|
|
import { useHistory } from "react-router-dom";
|
|
import CheckOut from "./CheckOut";
|
|
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
|
|
import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
|
|
import { Editor } from '@tinymce/tinymce-react';
|
|
import parse from 'html-react-parser';
|
|
import { FcViewDetails, FcDisapprove } from "react-icons/fc";
|
|
import 'react-tooltip/dist/react-tooltip.css'
|
|
import { Tooltip } from 'react-tooltip'
|
|
|
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
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";
|
|
import { IoAddCircleOutline, IoCloseCircleOutline } from "react-icons/io5";
|
|
import ToggleSwitch from "./ToggleSwitch";
|
|
import Link from '@mui/material/Link';
|
|
import { PiDotsThree } from "react-icons/pi";
|
|
|
|
const Partner_Domaine_Categorie_Metier = (props) => {
|
|
|
|
const history = useHistory();
|
|
const [submenu, setsubmenu] = useState("technique");
|
|
const [rowss, setRows] = useState([]);
|
|
const [selectionModel, setSelectionModel] = React.useState([]);
|
|
|
|
const [selectionModel_domaine, setselectionModel_domaine] = React.useState([]);
|
|
|
|
const [selectionModel_categorie, setselectionModel_categorie] = React.useState([]);
|
|
|
|
const [selectionModel_metier, setselectionModel_metier] = React.useState([]);
|
|
|
|
const [selected_domaine_id, setselected_domaine_id] = React.useState("");
|
|
const [selected_categorie_id, setselected_categorie_id] = React.useState("");
|
|
const [selected_metier_id, setselected_metier_id] = React.useState("");
|
|
|
|
|
|
const [isLoading, setLoading] = useState();
|
|
const myRef_head = useRef(null);
|
|
function ExpandableCell_50({ value }) {
|
|
const [expanded, setExpanded] = React.useState(false);
|
|
|
|
return (
|
|
<nav>
|
|
{value && <div style={{ paddingLeft: "5px", paddingRight: "15px", "display": "block", wordBreak: "break-all" }}>
|
|
|
|
{expanded ? value : String(value).slice(0, 50)}
|
|
{value.length > 50 && (
|
|
// eslint-disable-next-line jsx-a11y/anchor-is-valid
|
|
<Link
|
|
type="button"
|
|
component="button"
|
|
sx={{ fontSize: 'inherit' }}
|
|
onClick={() => setExpanded(!expanded)}
|
|
>
|
|
{expanded ? <nav> <PiDotsThree />Réduire</nav> : <nav> <PiDotsThree />Voir</nav>}
|
|
</Link>
|
|
)}
|
|
</div>}
|
|
|
|
{!value && <div style={{ paddingLeft: "5px", paddingRight: "15px", "display": "block", wordBreak: "break-all" }}>
|
|
|
|
</div>
|
|
}
|
|
</nav>
|
|
);
|
|
}
|
|
|
|
const columns_domaine = [
|
|
{ field: '_id', headerName: '_id', hide: true },
|
|
{ field: 'id', headerName: 'id', hide: true },
|
|
{ field: 'code', headerName: 'Code', hide: false, minWidth: 200, flex: 1, renderCell: (params) => <ExpandableCell_50 {...params} />, },
|
|
{ field: 'nom', headerName: 'Nom', hide: false, minWidth: 200, flex: 1, renderCell: (params) => <ExpandableCell_50 {...params} />, },
|
|
{ field: 'description', headerName: 'Description', hide: false, minWidth: 200, flex: 1, renderCell: (params) => <ExpandableCell_50 {...params} />, },
|
|
|
|
|
|
{
|
|
field: "delete", headerName: 'Supprimer',
|
|
renderCell: (cellValues) => {
|
|
return (
|
|
|
|
<Popup
|
|
trigger={<Button
|
|
>
|
|
<CiTrash />
|
|
|
|
</Button>}
|
|
modal
|
|
nested
|
|
position="center center"
|
|
>
|
|
{close => (
|
|
<div>
|
|
<button className="gest_close" onClick={close}>
|
|
×
|
|
</button>
|
|
<div className="gest_header"> MySy Information </div>
|
|
<div className="gest_content">
|
|
{' '}
|
|
|
|
En confirmant cette opération, le domaine sera <i><font color="red"> définitivement supprimé</font></i>. <br />
|
|
|
|
</div>
|
|
<div className="gest_actions">
|
|
<div style={{ "width": "45%", "float": "left" }}>
|
|
<button className="gest_bton_popup" onClick={(event) => {
|
|
// handleClick_delete_Type_Client(event, cellValues);
|
|
//console.log('modal closed ');
|
|
close();
|
|
}}> Valider </button>
|
|
|
|
</div>
|
|
<div style={{ "width": "45%", "float": "right" }}>
|
|
<button
|
|
className="gest_bton_popup"
|
|
onClick={() => {
|
|
//console.log('modal closed ');
|
|
close();
|
|
}}
|
|
>
|
|
Annuler
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</Popup>
|
|
|
|
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
const columns_categorie = [
|
|
{ field: '_id', headerName: '_id', hide: true },
|
|
{ field: 'id', headerName: 'id', hide: true },
|
|
{ field: 'code', headerName: 'Code', hide: false, minWidth: 200, flex: 1, renderCell: (params) => <ExpandableCell_50 {...params} />, },
|
|
{ field: 'nom', headerName: 'Nom', hide: false, minWidth: 200, flex: 1, renderCell: (params) => <ExpandableCell_50 {...params} />, },
|
|
{ field: 'description', headerName: 'Description', hide: false, minWidth: 200, flex: 1, renderCell: (params) => <ExpandableCell_50 {...params} />, },
|
|
|
|
|
|
{
|
|
field: "delete", headerName: 'Supprimer',
|
|
renderCell: (cellValues) => {
|
|
return (
|
|
|
|
<Popup
|
|
trigger={<Button
|
|
>
|
|
<CiTrash />
|
|
|
|
</Button>}
|
|
modal
|
|
nested
|
|
position="center center"
|
|
>
|
|
{close => (
|
|
<div>
|
|
<button className="gest_close" onClick={close}>
|
|
×
|
|
</button>
|
|
<div className="gest_header"> MySy Information </div>
|
|
<div className="gest_content">
|
|
{' '}
|
|
|
|
En confirmant cette opération, le domaine sera <i><font color="red"> définitivement supprimé</font></i>. <br />
|
|
|
|
</div>
|
|
<div className="gest_actions">
|
|
<div style={{ "width": "45%", "float": "left" }}>
|
|
<button className="gest_bton_popup" onClick={(event) => {
|
|
// handleClick_delete_Type_Client(event, cellValues);
|
|
//console.log('modal closed ');
|
|
close();
|
|
}}> Valider </button>
|
|
|
|
</div>
|
|
<div style={{ "width": "45%", "float": "right" }}>
|
|
<button
|
|
className="gest_bton_popup"
|
|
onClick={() => {
|
|
//console.log('modal closed ');
|
|
close();
|
|
}}
|
|
>
|
|
Annuler
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</Popup>
|
|
|
|
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
]
|
|
|
|
const columns_metier = [
|
|
{ field: '_id', headerName: '_id', hide: true },
|
|
{ field: 'id', headerName: 'id', hide: true },
|
|
{ field: 'code', headerName: 'Code', hide: false, minWidth: 200, flex: 1, renderCell: (params) => <ExpandableCell_50 {...params} />, },
|
|
{ field: 'nom', headerName: 'Nom', hide: false, minWidth: 200, flex: 1, renderCell: (params) => <ExpandableCell_50 {...params} />, },
|
|
{ field: 'description', headerName: 'Description', hide: false, minWidth: 200, flex: 1, renderCell: (params) => <ExpandableCell_50 {...params} />, },
|
|
|
|
|
|
{
|
|
field: "delete", headerName: 'Supprimer',
|
|
renderCell: (cellValues) => {
|
|
return (
|
|
|
|
<Popup
|
|
trigger={<Button
|
|
>
|
|
<CiTrash />
|
|
|
|
</Button>}
|
|
modal
|
|
nested
|
|
position="center center"
|
|
>
|
|
{close => (
|
|
<div>
|
|
<button className="gest_close" onClick={close}>
|
|
×
|
|
</button>
|
|
<div className="gest_header"> MySy Information </div>
|
|
<div className="gest_content">
|
|
{' '}
|
|
|
|
En confirmant cette opération, le domaine sera <i><font color="red"> définitivement supprimé</font></i>. <br />
|
|
|
|
</div>
|
|
<div className="gest_actions">
|
|
<div style={{ "width": "45%", "float": "left" }}>
|
|
<button className="gest_bton_popup" onClick={(event) => {
|
|
// handleClick_delete_Type_Client(event, cellValues);
|
|
//console.log('modal closed ');
|
|
close();
|
|
}}> Valider </button>
|
|
|
|
</div>
|
|
<div style={{ "width": "45%", "float": "right" }}>
|
|
<button
|
|
className="gest_bton_popup"
|
|
onClick={() => {
|
|
//console.log('modal closed ');
|
|
close();
|
|
}}
|
|
>
|
|
Annuler
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</Popup>
|
|
|
|
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
const [gridline_domaine_id, setgridline_domaine_id] = useState("");
|
|
const [gridline_categorie_id, setgridline_categorie_id] = useState("");
|
|
const [gridline_metier_id, setgridline_metier_id] = useState("");
|
|
|
|
const [p_detail_domaine_id, setp_detail_domaine_id] = useState("");
|
|
const [p_detail_domaine_code, setp_detail_domaine_code] = useState("");
|
|
const [p_detail_domaine_nom, setp_detail_domaine_nom] = useState("");
|
|
const [p_detail_domaine_description, setp_detail_domaine_description] = useState("");
|
|
|
|
|
|
|
|
const [p_detail_categorie_id, setp_detail_categorie_id] = useState("");
|
|
const [p_detail_categorie_code, setp_detail_categorie_code] = useState("");
|
|
const [p_detail_categorie_nom, setp_detail_categorie_nom] = useState("");
|
|
const [p_detail_categorie_description, setp_detail_categorie_description] = useState("");
|
|
const [p_detail_categorie_class_domaine_id, setp_detail_categorie_class_domaine_id] = useState("");
|
|
|
|
|
|
const [p_detail_metier_id, setp_detail_metier_id] = useState("");
|
|
const [p_detail_metier_code, setp_detail_metier_code] = useState("");
|
|
const [p_detail_metier_nom, setp_detail_metier_nom] = useState("");
|
|
const [p_detail_metier_description, setp_detail_metier_description] = useState("");
|
|
const [p_detail_metier_class_domaine_id, setp_detail_metier_class_domaine_id] = useState("");
|
|
|
|
const [domaine_data_edit_mode, setdomaine_data_edit_mode] = useState("");
|
|
const [domaine_data_changed, setdomaine_data_changed] = useState("");
|
|
|
|
|
|
const [categorie_data_edit_mode, setcategorie_data_edit_mode] = useState("");
|
|
const [categorie_data_changed, setcategorie_data_changed] = useState("");
|
|
|
|
|
|
const [metier_data_edit_mode, setmetier_data_edit_mode] = useState("");
|
|
const [metier_data_changed, setmetier_data_changed] = useState("");
|
|
|
|
|
|
const [display_detail_domaine, setdisplay_detail_domaine] = useState("");
|
|
const [display_detail_categorie, setdisplay_detail_categorie] = useState("");
|
|
const [display_detail_metier, setdisplay_detail_metier] = useState("");
|
|
|
|
function submenu_domaine() {
|
|
setsubmenu("domaine");
|
|
Getall_Partner_Class_Domaine();
|
|
submenu_color_management("domaine")
|
|
}
|
|
|
|
function submenu_categorie() {
|
|
setsubmenu("categorie");
|
|
Getall_Partner_Class_Categorie();
|
|
submenu_color_management("categorie")
|
|
}
|
|
|
|
|
|
function submenu_metier() {
|
|
setsubmenu("metier");
|
|
Getall_Partner_Class_Metier();
|
|
submenu_color_management("metier")
|
|
}
|
|
|
|
|
|
function submenu_color_management(current_menu) {
|
|
const list_sous_menu = ["domaine", "categorie", "metier",]
|
|
|
|
for (let i = 0; i < list_sous_menu.length; i++) {
|
|
|
|
var sous_menu = list_sous_menu[i];
|
|
if (String(sous_menu) !== current_menu) {
|
|
if (document.getElementById(sous_menu)) {
|
|
document.getElementById(sous_menu).style.backgroundColor = "#d8edfc";
|
|
document.getElementById(sous_menu).style.color = "black";
|
|
document.getElementById(sous_menu).style.fontWeight = "normal";
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if (document.getElementById(current_menu)) {
|
|
document.getElementById(current_menu).style.backgroundColor = "#104277";
|
|
document.getElementById(current_menu).style.color = "white";
|
|
document.getElementById(current_menu).style.fontWeight = "bold";
|
|
}
|
|
|
|
}
|
|
|
|
const myRef = useRef(null)
|
|
|
|
|
|
const [New_Getall_Partner_Class_Domaine_result, setNew_Getall_Partner_Class_Domaine_result] = useState([]);
|
|
|
|
const [Getall_Partner_Class_Domaine_api, setGetall_Partner_Class_Domaine_api] = useState();
|
|
const [Getall_Partner_Class_Domaine_message, setGetall_Partner_Class_Domaine_message] = useState();
|
|
const [Getall_Partner_Class_Domaine_result, setGetall_Partner_Class_Domaine_result] = useState([]);
|
|
function Getall_Partner_Class_Domaine(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_Class_domaine/";
|
|
|
|
setLoading(true);
|
|
axios.post(myurl, form).then(res => {
|
|
setLoading(false);
|
|
|
|
if (String(res.data.status) === String("true")) {
|
|
//console.log(" In Getall_Partner_Class_Domaine res.data.status = " + res.data.status);
|
|
//console.log(" In Getall_Partner_Class_Domaine res.data.message r_class = " + res.data.message);
|
|
setGetall_Partner_Class_Domaine_api("true");
|
|
setGetall_Partner_Class_Domaine_result(res.data.message);
|
|
|
|
var new_data2 = [];
|
|
const new_data = res.data.message.map((x) => {
|
|
|
|
//---
|
|
var localid = JSON.parse(x).id;
|
|
var local_id = JSON.parse(x)._id;
|
|
var local_code = JSON.parse(x).code;
|
|
var local_nom = JSON.parse(x).nom;
|
|
var local_description = JSON.parse(x).description;
|
|
|
|
|
|
|
|
//---
|
|
var node = {
|
|
"_id": local_id,
|
|
"id": localid,
|
|
"label": local_nom,
|
|
"code": local_code,
|
|
"description": local_description,
|
|
"nom": local_nom,
|
|
|
|
|
|
};
|
|
new_data2.push(node);
|
|
});
|
|
|
|
//---
|
|
var node = {
|
|
"_id": "",
|
|
"id": "",
|
|
"label": "",
|
|
"code": "",
|
|
"description": "",
|
|
"nom": "",
|
|
|
|
};
|
|
new_data2.push(node);
|
|
|
|
|
|
if (new_data2.length > 0)
|
|
setNew_Getall_Partner_Class_Domaine_result(new_data2);
|
|
|
|
|
|
}
|
|
else {
|
|
setGetall_Partner_Class_Domaine_api("false");
|
|
setGetall_Partner_Class_Domaine_message(res.data.message);
|
|
alert(res.data.message);
|
|
}
|
|
|
|
}).catch((error) => {
|
|
setLoading(false);
|
|
console.warn('Not good man :( Getall_Partner_Class_Domaine = ', error);
|
|
setGetall_Partner_Class_Domaine_api("false");
|
|
alert(" Impossible de recuperer la liste des domaines de formation ");
|
|
//setmyApimyApiMessage("")
|
|
})
|
|
}
|
|
|
|
|
|
const [New_Getall_Partner_Class_Categorie_result, setNew_Getall_Partner_Class_Categorie_result] = useState([]);
|
|
|
|
const [Getall_Partner_Class_Categorie_api, setGetall_Partner_Class_Categorie_api] = useState();
|
|
const [Getall_Partner_Class_Categorie_message, setGetall_Partner_Class_Categorie_message] = useState();
|
|
const [Getall_Partner_Class_Categorie_result, setGetall_Partner_Class_Categorie_result] = useState([]);
|
|
function Getall_Partner_Class_Categorie(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_Class_Categorie/";
|
|
|
|
setLoading(true);
|
|
axios.post(myurl, form).then(res => {
|
|
setLoading(false);
|
|
|
|
if (String(res.data.status) === String("true")) {
|
|
//console.log(" In Getall_Partner_Class_Categorie res.data.status = " + res.data.status);
|
|
//console.log(" In Getall_Partner_Class_Categorie res.data.message r_class = " + res.data.message);
|
|
setGetall_Partner_Class_Categorie_api("true");
|
|
setGetall_Partner_Class_Categorie_result(res.data.message);
|
|
|
|
var new_data2 = [];
|
|
const new_data = res.data.message.map((x) => {
|
|
|
|
//---
|
|
var localid = JSON.parse(x).id;
|
|
var local_id = JSON.parse(x)._id;
|
|
var local_code = JSON.parse(x).code;
|
|
var local_nom = JSON.parse(x).nom;
|
|
var local_description = JSON.parse(x).description;
|
|
|
|
|
|
|
|
//---
|
|
var node = {
|
|
"_id": local_id,
|
|
"id": localid,
|
|
"label": local_nom,
|
|
"code": local_code,
|
|
"description": local_description,
|
|
"nom": local_nom,
|
|
|
|
|
|
};
|
|
new_data2.push(node);
|
|
});
|
|
|
|
//---
|
|
var node = {
|
|
"_id": "",
|
|
"id": "",
|
|
"label": "",
|
|
"code": "",
|
|
"description": "",
|
|
"nom": "",
|
|
|
|
};
|
|
new_data2.push(node);
|
|
|
|
|
|
if (new_data2.length > 0)
|
|
setNew_Getall_Partner_Class_Categorie_result(new_data2);
|
|
|
|
|
|
}
|
|
else {
|
|
setGetall_Partner_Class_Categorie_api("false");
|
|
setGetall_Partner_Class_Categorie_message(res.data.message);
|
|
alert(res.data.message);
|
|
}
|
|
|
|
}).catch((error) => {
|
|
setLoading(false);
|
|
console.warn('Not good man :( Getall_Partner_Class_Categorie = ', error);
|
|
setGetall_Partner_Class_Categorie_api("false");
|
|
alert(" Impossible de recuperer la liste des domaines de formation ");
|
|
//setmyApimyApiMessage("")
|
|
})
|
|
}
|
|
|
|
|
|
const [New_Getall_Partner_Class_Metier_result, setNew_Getall_Partner_Class_Metier_result] = useState([]);
|
|
|
|
const [Getall_Partner_Class_Metier_api, setGetall_Partner_Class_Metier_api] = useState();
|
|
const [Getall_Partner_Class_Metier_message, setGetall_Partner_Class_Metier_message] = useState();
|
|
const [Getall_Partner_Class_Metier_result, setGetall_Partner_Class_Metier_result] = useState([]);
|
|
function Getall_Partner_Class_Metier(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_class_metier/";
|
|
|
|
setLoading(true);
|
|
axios.post(myurl, form).then(res => {
|
|
setLoading(false);
|
|
|
|
if (String(res.data.status) === String("true")) {
|
|
//console.log(" In Getall_Partner_Class_Metier res.data.status = " + res.data.status);
|
|
//console.log(" In Getall_Partner_Class_Metier res.data.message r_class = " + res.data.message);
|
|
setGetall_Partner_Class_Metier_api("true");
|
|
setGetall_Partner_Class_Metier_result(res.data.message);
|
|
|
|
var new_data2 = [];
|
|
const new_data = res.data.message.map((x) => {
|
|
|
|
//---
|
|
var localid = JSON.parse(x).id;
|
|
var local_id = JSON.parse(x)._id;
|
|
var local_code = JSON.parse(x).code;
|
|
var local_nom = JSON.parse(x).nom;
|
|
var local_description = JSON.parse(x).description;
|
|
|
|
|
|
|
|
//---
|
|
var node = {
|
|
"_id": local_id,
|
|
"id": localid,
|
|
"label": local_nom,
|
|
"code": local_code,
|
|
"description": local_description,
|
|
"nom": local_nom,
|
|
|
|
|
|
};
|
|
new_data2.push(node);
|
|
});
|
|
|
|
//---
|
|
var node = {
|
|
"_id": "",
|
|
"id": "",
|
|
"label": "",
|
|
"code": "",
|
|
"description": "",
|
|
"nom": "",
|
|
|
|
};
|
|
new_data2.push(node);
|
|
|
|
|
|
if (new_data2.length > 0)
|
|
setNew_Getall_Partner_Class_Metier_result(new_data2);
|
|
|
|
|
|
}
|
|
else {
|
|
setGetall_Partner_Class_Metier_api("false");
|
|
setGetall_Partner_Class_Metier_message(res.data.message);
|
|
alert(res.data.message);
|
|
}
|
|
|
|
}).catch((error) => {
|
|
setLoading(false);
|
|
console.warn('Not good man :( Getall_Partner_Class_Metier = ', error);
|
|
setGetall_Partner_Class_Metier_api("false");
|
|
alert(" Impossible de recuperer la liste des domaines de formation ");
|
|
//setmyApimyApiMessage("")
|
|
})
|
|
}
|
|
useEffect(() => {
|
|
|
|
Getall_Partner_Class_Domaine();
|
|
submenu_domaine();
|
|
if (document.getElementById('myRef_head')) {
|
|
var divh = document.getElementById('myRef_head').offsetTop;
|
|
window.scrollTo({
|
|
top: divh,
|
|
behavior: "smooth",
|
|
});
|
|
}
|
|
}, [])
|
|
|
|
|
|
return (
|
|
<div className="partner_domaine_categorie_metier">
|
|
{isLoading && <div className="loader-container">
|
|
<div className="mysy_spinner"> <img src={img_loading_spin} /> </div>
|
|
</div>}
|
|
|
|
<h3> Gestion Domaine, Categorie & Metier</h3>
|
|
|
|
<div className="div_row" ref={myRef_head} id="myRef_head" >
|
|
<Button variant="outlined" onClick={submenu_domaine} className="detail_class_submenu" id='domaine' name='domaine'>Domaines </Button>
|
|
<Button variant="outlined" onClick={submenu_categorie} className="detail_class_submenu" id='categorie' name='categorie'>Catégories </Button>
|
|
<Button variant="outlined" onClick={submenu_metier} className="detail_class_submenu" id='metier' name='metier'> Métiers </Button>
|
|
|
|
</div>
|
|
|
|
{/*** domaine */}
|
|
{String(submenu) === "domaine" && <div className="div_row" style={{ paddingRight: '10px' }}>
|
|
<h3> Gestion domaine</h3>
|
|
|
|
<div>
|
|
<div className="div_row" style={{ paddingRight: '10px' }}>
|
|
<div className="session_data">
|
|
<div style={{ "border": "None" }}>
|
|
<div style={{ height: 550, width: '100%', paddingRight: '5px' }}>
|
|
|
|
<Box
|
|
sx={{
|
|
height: 500,
|
|
width: '100%',
|
|
paddingRight: '1px',
|
|
|
|
|
|
|
|
"& .MuiDataGrid-columnHeaders": {
|
|
backgroundColor: "#c8cfd5",
|
|
color: "black",
|
|
fontSize: 14
|
|
},
|
|
|
|
'& .line--statut--selected': {
|
|
backgroundColor: '#FBF2EF',
|
|
color: 'black',
|
|
},
|
|
'& .line--statut--pair': {
|
|
backgroundColor: 'rgba(235, 235, 235, .7)',
|
|
color: 'black',
|
|
},
|
|
'& .line--statut--impair': {
|
|
backgroundColor: '#FFFFFF',
|
|
color: 'black',
|
|
},
|
|
|
|
}}
|
|
>
|
|
<DataGrid
|
|
checkboxSelection
|
|
onSelectionModelChange={(newSelectionModel) => {
|
|
setselectionModel_domaine(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_domaine}
|
|
disableSelectionOnClick
|
|
localeText={frFR.components.MuiDataGrid.defaultProps.localeText}
|
|
rows={Getall_Partner_Class_Domaine_result.map((item, index) => (
|
|
{
|
|
id: index,
|
|
_id: JSON.parse(item)._id,
|
|
code: JSON.parse(item).code,
|
|
nom: JSON.parse(item).nom,
|
|
description: JSON.parse(item).description,
|
|
|
|
|
|
}
|
|
))}
|
|
|
|
columns={columns_domaine}
|
|
pageSize={10}
|
|
className="datagridclass"
|
|
|
|
onRowDoubleClick={(newSelectionModel) => {
|
|
setgridline_domaine_id(newSelectionModel.row.id);
|
|
|
|
// handleClick_edit_config_From_Line(newSelectionModel.row.id);
|
|
|
|
}}
|
|
|
|
|
|
rowsPerPageOptions={[10]}
|
|
//disableSelectionOnClick
|
|
components={{
|
|
Toolbar: GridToolbar,
|
|
}}
|
|
//sx={datagridSx}
|
|
getCellClassName={(params) => {
|
|
|
|
|
|
|
|
}}
|
|
getRowClassName={(params) => {
|
|
|
|
|
|
// Pour la gestion de la couleur de zone double cliquée
|
|
if (String(params.row.id) === String(gridline_domaine_id)) {
|
|
return 'line--statut--selected';
|
|
}
|
|
else if (parseInt(String(params.row.id)) % 2 === 0) {
|
|
return 'line--statut--pair';
|
|
}
|
|
else if (parseInt(String(params.row.id)) % 2 !== 0) {
|
|
return 'line--statut--impair';
|
|
}
|
|
}}
|
|
|
|
|
|
/>
|
|
</Box>
|
|
<br />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<div className="div_row" style={{ "border": "None" }}>
|
|
|
|
|
|
</div>
|
|
<div className="div_row" ref={myRef} id="myRef"> </div>
|
|
</div>
|
|
|
|
|
|
|
|
{New_Getall_Partner_Class_Domaine_result && display_detail_domaine && String(display_detail_domaine) === "1" && <div className="div_row">
|
|
{domaine_data_edit_mode && String(domaine_data_edit_mode) === "1" &&
|
|
<div className="session_caract"> Code<br />
|
|
|
|
<Autocomplete
|
|
disablePortal
|
|
name="detail_domaine_code"
|
|
id="detail_domaine_code"
|
|
className="disabled_style"
|
|
value={New_Getall_Partner_Class_Domaine_result.filter((data) => (data)._id === String(p_detail_domaine_id))[0].label}
|
|
options={New_Getall_Partner_Class_Domaine_result}
|
|
onChange={(event, value) => {
|
|
|
|
if (value && value.value && value.value === "signature_digital") {
|
|
alert(" Vos droits d'accès ne vous permettent pas modifier la configuration : 'signature_digital'");
|
|
return;
|
|
}
|
|
if (value && value._id) {
|
|
setp_detail_domaine_id(value._id);
|
|
setdomaine_data_changed("1");
|
|
} else {
|
|
setp_detail_domaine_id("");
|
|
setdomaine_data_changed("1");
|
|
}
|
|
|
|
}}
|
|
|
|
renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
|
|
inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}
|
|
|
|
/>
|
|
}
|
|
/>
|
|
|
|
|
|
|
|
|
|
</div>}
|
|
{String(domaine_data_edit_mode) !== "1" &&
|
|
<div className="session_caract"> Nom <br />
|
|
<TextField
|
|
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
|
required
|
|
name="detail_domaine_nom"
|
|
id="detail_domaine_nom"
|
|
|
|
InputLabelProps={{
|
|
shrink: true,
|
|
}}
|
|
disabled={false}
|
|
className="disabled_style"
|
|
value={p_detail_domaine_nom}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>}
|
|
|
|
{String(domaine_data_edit_mode) === "1" && <div className="session_caract"> Nom<br />
|
|
<TextField
|
|
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
|
required
|
|
name="detail_domaine_nom"
|
|
id="detail_domaine_nom"
|
|
|
|
InputLabelProps={{
|
|
shrink: true,
|
|
}}
|
|
disabled={false}
|
|
className="disabled_style"
|
|
value={p_detail_domaine_nom}
|
|
onChange={(e) => {
|
|
|
|
setp_detail_domaine_nom(e.target.value);
|
|
setdomaine_data_changed("1");
|
|
|
|
}
|
|
}
|
|
/>
|
|
</div>}
|
|
|
|
|
|
|
|
<div>
|
|
<div className="div_row" style={{ "border": "None" }}>
|
|
|
|
</div>
|
|
{String(domaine_data_changed) === "1" && String(domaine_data_edit_mode) === "1" && <div className="div_row" style={{ "border": "None", "color": "orange", "textAlign": "center" }}>
|
|
/!\ Pensez à enregistrer les modifications
|
|
</div>}
|
|
<div className="div_row" style={{ "border": "None", "color": "orange", "textAlign": "center" }}>
|
|
|
|
{String(domaine_data_edit_mode) === "1" && String(domaine_data_changed) === "1" && <div className="div_row_gauche" style={{ "textAlign": 'left', 'marginLeft': '15px' }}>
|
|
|
|
<Button variant="contained" className="bton_enreg" onClick={"Update_One_Config_Data"}>Enregistrer les modifications
|
|
</Button>
|
|
|
|
</div>}
|
|
|
|
{String(domaine_data_edit_mode) === "1" && <div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }} >
|
|
<Button variant="contained" className="bton_annule" onClick={"Annule_Order_DetailFields"}>Annuler
|
|
</Button>
|
|
</div>}
|
|
</div>
|
|
|
|
|
|
{String(domaine_data_edit_mode) !== "1" && <div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }}>
|
|
|
|
<Button variant="contained" className="bton_edit" onClick={"Enable_Config_DetailFields"}>Editer
|
|
</Button>
|
|
|
|
</div>}
|
|
<div className="div_row" style={{ "border": "None" }}>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
</div>}
|
|
|
|
{/*** categorie */}
|
|
{String(submenu) === "categorie" && <div className="div_row" style={{ paddingRight: '10px' }}>
|
|
<h3> Gestion categorie</h3>
|
|
|
|
<div>
|
|
<div className="div_row" style={{ paddingRight: '10px' }}>
|
|
<div className="session_data">
|
|
<div style={{ "border": "None" }}>
|
|
<div style={{ height: 550, width: '100%', paddingRight: '5px' }}>
|
|
|
|
<Box
|
|
sx={{
|
|
height: 500,
|
|
width: '100%',
|
|
paddingRight: '1px',
|
|
|
|
|
|
|
|
"& .MuiDataGrid-columnHeaders": {
|
|
backgroundColor: "#c8cfd5",
|
|
color: "black",
|
|
fontSize: 14
|
|
},
|
|
|
|
'& .line--statut--selected': {
|
|
backgroundColor: '#FBF2EF',
|
|
color: 'black',
|
|
},
|
|
'& .line--statut--pair': {
|
|
backgroundColor: 'rgba(235, 235, 235, .7)',
|
|
color: 'black',
|
|
},
|
|
'& .line--statut--impair': {
|
|
backgroundColor: '#FFFFFF',
|
|
color: 'black',
|
|
},
|
|
|
|
}}
|
|
>
|
|
<DataGrid
|
|
checkboxSelection
|
|
onSelectionModelChange={(newSelectionModel) => {
|
|
setselectionModel_categorie(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_categorie}
|
|
disableSelectionOnClick
|
|
localeText={frFR.components.MuiDataGrid.defaultProps.localeText}
|
|
rows={Getall_Partner_Class_Categorie_result.map((item, index) => (
|
|
{
|
|
id: index,
|
|
_id: JSON.parse(item)._id,
|
|
code: JSON.parse(item).code,
|
|
nom: JSON.parse(item).nom,
|
|
description: JSON.parse(item).description,
|
|
|
|
|
|
}
|
|
))}
|
|
|
|
columns={columns_categorie}
|
|
pageSize={10}
|
|
className="datagridclass"
|
|
|
|
onRowDoubleClick={(newSelectionModel) => {
|
|
setgridline_categorie_id(newSelectionModel.row.id);
|
|
|
|
// handleClick_edit_config_From_Line(newSelectionModel.row.id);
|
|
|
|
}}
|
|
|
|
|
|
rowsPerPageOptions={[10]}
|
|
//disableSelectionOnClick
|
|
components={{
|
|
Toolbar: GridToolbar,
|
|
}}
|
|
//sx={datagridSx}
|
|
getCellClassName={(params) => {
|
|
|
|
|
|
|
|
}}
|
|
getRowClassName={(params) => {
|
|
|
|
|
|
// Pour la gestion de la couleur de zone double cliquée
|
|
if (String(params.row.id) === String(gridline_categorie_id)) {
|
|
return 'line--statut--selected';
|
|
}
|
|
else if (parseInt(String(params.row.id)) % 2 === 0) {
|
|
return 'line--statut--pair';
|
|
}
|
|
else if (parseInt(String(params.row.id)) % 2 !== 0) {
|
|
return 'line--statut--impair';
|
|
}
|
|
}}
|
|
|
|
|
|
/>
|
|
</Box>
|
|
<br />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<div className="div_row" style={{ "border": "None" }}>
|
|
|
|
|
|
</div>
|
|
<div className="div_row" ref={myRef} id="myRef"> </div>
|
|
</div>
|
|
|
|
|
|
|
|
{New_Getall_Partner_Class_Categorie_result && display_detail_categorie && String(display_detail_categorie) === "1" && <div className="div_row">
|
|
{categorie_data_edit_mode && String(categorie_data_edit_mode) === "1" &&
|
|
<div className="session_caract"> Code<br />
|
|
|
|
<Autocomplete
|
|
disablePortal
|
|
name="detail_categorie_code"
|
|
id="detail_categorie_code"
|
|
className="disabled_style"
|
|
value={New_Getall_Partner_Class_Categorie_result.filter((data) => (data)._id === String(p_detail_categorie_id))[0].label}
|
|
options={New_Getall_Partner_Class_Categorie_result}
|
|
onChange={(event, value) => {
|
|
|
|
if (value && value.value && value.value === "signature_digital") {
|
|
alert(" Vos droits d'accès ne vous permettent pas modifier la configuration : 'signature_digital'");
|
|
return;
|
|
}
|
|
if (value && value._id) {
|
|
setp_detail_categorie_id(value._id);
|
|
setcategorie_data_changed("1");
|
|
} else {
|
|
setp_detail_categorie_id("");
|
|
setcategorie_data_changed("1");
|
|
}
|
|
|
|
}}
|
|
|
|
renderInput={(params) => <TextField {...params} label="" placeholder="Choisir une option"
|
|
inputProps={{ ...params.inputProps, style: { fontSize: 12, height: "1.4rem" } }}
|
|
|
|
/>
|
|
}
|
|
/>
|
|
|
|
|
|
|
|
|
|
</div>}
|
|
{String(domaine_data_edit_mode) !== "1" &&
|
|
<div className="session_caract"> Nom <br />
|
|
<TextField
|
|
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
|
required
|
|
name="detail_categorie_nom"
|
|
id="detail_categorie_nom"
|
|
|
|
InputLabelProps={{
|
|
shrink: true,
|
|
}}
|
|
disabled={false}
|
|
className="disabled_style"
|
|
value={p_detail_categorie_nom}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>}
|
|
|
|
{String(categorie_data_edit_mode) === "1" && <div className="session_caract"> Nom<br />
|
|
<TextField
|
|
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
|
required
|
|
name="detail_categorie_nom"
|
|
id="detail_categorie_nom"
|
|
|
|
InputLabelProps={{
|
|
shrink: true,
|
|
}}
|
|
disabled={false}
|
|
className="disabled_style"
|
|
value={p_detail_categorie_nom}
|
|
onChange={(e) => {
|
|
|
|
setp_detail_categorie_nom(e.target.value);
|
|
setcategorie_data_changed("1");
|
|
|
|
}
|
|
}
|
|
/>
|
|
</div>}
|
|
|
|
|
|
|
|
<div>
|
|
<div className="div_row" style={{ "border": "None" }}>
|
|
|
|
</div>
|
|
{String(categorie_data_changed) === "1" && String(categorie_data_edit_mode) === "1" && <div className="div_row" style={{ "border": "None", "color": "orange", "textAlign": "center" }}>
|
|
/!\ Pensez à enregistrer les modifications
|
|
</div>}
|
|
<div className="div_row" style={{ "border": "None", "color": "orange", "textAlign": "center" }}>
|
|
|
|
{String(categorie_data_edit_mode) === "1" && String(categorie_data_changed) === "1" && <div className="div_row_gauche" style={{ "textAlign": 'left', 'marginLeft': '15px' }}>
|
|
|
|
<Button variant="contained" className="bton_enreg" onClick={"Update_One_Config_Data"}>Enregistrer les modifications
|
|
</Button>
|
|
|
|
</div>}
|
|
|
|
{String(categorie_data_edit_mode) === "1" && <div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }} >
|
|
<Button variant="contained" className="bton_annule" onClick={"Annule_Order_DetailFields"}>Annuler
|
|
</Button>
|
|
</div>}
|
|
</div>
|
|
|
|
|
|
{String(categorie_data_edit_mode) !== "1" && <div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }}>
|
|
|
|
<Button variant="contained" className="bton_edit" onClick={"Enable_Config_DetailFields"}>Editer
|
|
</Button>
|
|
|
|
</div>}
|
|
<div className="div_row" style={{ "border": "None" }}>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
</div>}
|
|
|
|
{/*** metier */}
|
|
{String(submenu) === "metier" && <div className="div_row" style={{ paddingRight: '10px' }}>
|
|
|
|
<h3> Gestion metier</h3>
|
|
|
|
</div>}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
|
|
export default Partner_Domaine_Categorie_Metier; |