import React, { useRef, useState, useEffect } from "react";
import TextField from '@mui/material/TextField';
import Checkbox from '@mui/material/Checkbox';
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 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 Box from '@mui/material/Box';
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 FullCalendar from "@fullcalendar/react";
import daygridPlugin from "@fullcalendar/daygrid";
//import interactionPlugin from "@fullcalendar/interaction";
//import timeGridPlugin from "@fullcalendar/timegrid";
import ToggleSwitch from "./ToggleSwitch";
import ToggleSwitch_v2_mysy from "./ToggleSwitch_v2_mysy";
import ToggleSwitch_v3_mysy from "./ToggleSwitch_v3_mysy";
import Autocomplete from '@mui/material/Autocomplete';
import FullCalendar, { formatDate } from "@fullcalendar/react";
import dayGridPlugin from "@fullcalendar/daygrid";
import timeGridPlugin from "@fullcalendar/timegrid";
import interactionPlugin from "@fullcalendar/interaction";
import { FcSearch } from "react-icons/fc";
import { Fab } from "@material-ui/core";
import {
ListItem,
ListItemText,
useTheme,
} from "@mui/material";
import SettingsSuggestIcon from '@mui/icons-material/SettingsSuggest';
import { MdFlashAuto } from "react-icons/md";
import { ImWarning } from "react-icons/im";
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
import { TreeView } from '@mui/x-tree-view/TreeView';
import { TreeItem } from '@mui/x-tree-view/TreeItem';
import { IoMdAddCircle, IoIosRemoveCircleOutline } from "react-icons/io";
import { FcViewDetails, FcDisapprove, FcInfo } from "react-icons/fc";
import { convertNwSeToNeSw } from "google-map-react";
import { makeStyles } from "@material-ui/core/styles";
import Paper from '@material-ui/core/Paper';
import Draggable from 'react-draggable';
import { IconButton } from '@material-ui/core';
import AutoFixHighOutlinedIcon from '@mui/icons-material/AutoFixHighOutlined';
import CancelPresentationIcon from '@mui/icons-material/CancelPresentation';
import Module_Alert_Confirmation from "./Module_Alert_Confirmation";
function PaperComponent(props) {
return (
);
}
const useStyles = makeStyles((theme) => ({
dialog: {
position: 'absolute',
// left: 10,
top: 400
},
paper: {
overflowY: 'unset',
},
customizedButton: {
position: 'absolute',
left: '98%',
top: '-3%',
backgroundColor: 'lightgray',
color: 'gray',
},
}));
const Module_Editique = (props) => {
const classes = useStyles();
const myconntected_employee_id = props.conntected_employee_id;
const [selected_employee_id, setselected_employee_id] = useState(props.conntected_employee_id);
const [selected_session_invoiced_statut, setselected_session_invoiced_statut] = useState("");
const history = useHistory();
const [isLoading, setLoading] = 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 [expanded, setExpanded] = React.useState([]);
const [selected, setSelected] = React.useState([]);
const handleToggle = (event, nodeIds) => {
setExpanded(nodeIds);
};
const handleSelect = (event, nodeIds) => {
setSelected(nodeIds);
};
const [expanded_nom_traite, setExpanded_nom_traite] = React.useState([]);
const [selected_nom_traite, setSelected_nom_traite] = React.useState([]);
const handleToggle_nom_traite = (event, nodeIds) => {
setExpanded_nom_traite(nodeIds);
};
const handleSelect_nom_traite = (event, nodeIds) => {
setSelected_nom_traite(nodeIds);
};
const [tab_handleExpandClick_id, settab_handleExpandClick_id] = React.useState([]);
//settab_handleExpandClick_id(['0', '1', '2', '3', '4', '20'])
const handleExpandClick = () => {
setdisplay_audit_data("0");
setExpanded((oldExpanded) =>
oldExpanded.length === 0 ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] : [],
);
};
const [Invoice_Session_Formation_api, setInvoice_Session_Formation_api] = useState();
const [Invoice_Session_Formation_message, setInvoice_Session_Formation_message] = useState();
const [Invoice_Session_Formation_result, setInvoice_Session_Formation_result] = useState([]);
function Invoice_Session_Formation(event) {
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("session_id", selected_session_id);
form.append("tab_inscription_ids", "all");
//var myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Facture_From_Session_By_Email/";
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Invoice_Inscrption_With_Split_Session_By_Inscription_Id/";
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
if (String(res.data.status) === String("true")) {
//console.log(" In Invoice_Session_Formation res.data.status = " + res.data.status);
//console.log(" In Invoice_Session_Formation res.data.message r_class = " + res.data.message);
setInvoice_Session_Formation_api("true");
setInvoice_Session_Formation_result(res.data.message);
Getall_Editable_Document_By_Partner_By_Collection();
props.GetListeInscrit(props.related_collection_recid, props.internal_url);
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("success");
}
else {
setInvoice_Session_Formation_api("false");
setInvoice_Session_Formation_message(res.data.message);
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("error");
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Invoice_Session_Formation = ', error);
setInvoice_Session_Formation_api("false");
alert(" Impossible lancer la facturation de la session");
})
}
const [Getall_Editable_Document_By_Partner_By_Collection_api, setGetall_Editable_Document_By_Partner_By_Collection_api] = useState();
const [Getall_Editable_Document_By_Partner_By_Collection_message, setGetall_Editable_Document_By_Partner_By_Collection_message] = useState();
const [Getall_Editable_Document_By_Partner_By_Collection_result, setGetall_Editable_Document_By_Partner_By_Collection_result] = useState([]);
function Getall_Editable_Document_By_Partner_By_Collection(event) {
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("related_collection", props.related_collection);
form.append("related_collection_recid", props.related_collection_recid);
form.append("session_id", props.related_collection_recid);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Editable_Document_By_Partner_By_Collection/";
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
if (String(res.data.status) === String("true")) {
//console.log(" In Getall_Editable_Document_By_Partner_By_Collection res.data.status = " + res.data.status);
// console.log(" In Getall_Editable_Document_By_Partner_By_Collection res.data.message r_class = " + res.data.message);
setGetall_Editable_Document_By_Partner_By_Collection_api("true");
setGetall_Editable_Document_By_Partner_By_Collection_result(res.data.message);
}
else {
setGetall_Editable_Document_By_Partner_By_Collection_api("false");
setGetall_Editable_Document_By_Partner_By_Collection_message(res.data.message);
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Getall_Editable_Document_By_Partner_By_Collection = ', error);
setGetall_Editable_Document_By_Partner_By_Collection_api("false");
//setmyApimyApiMessage("")
})
}
const [partner_digital_signature_status, setpartner_digital_signature_status] = useState("0");
const [local_partner_digital_signature_status, setlocal_partner_digital_signature_status] = useState(false);
const [Getall_Partner_Digital_Sign_Status_api, setGetall_Partner_Digital_Sign_Status_api] = useState();
const [Getall_Partner_Digital_Sign_Status_message, setGetall_Partner_Digital_Sign_Status_message] = useState();
const [Getall_Partner_Digital_Sign_Status_result, setGetall_Partner_Digital_Sign_Status_result] = useState([]);
function Getall_Partner_Digital_Sign_Status(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/Is_Partnair_Has_Digital_Signature/";
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
if (String(res.data.status) === String("true")) {
//console.log(" In Getall_Partner_Digital_Sign_Status res.data.status = " + res.data.status);
//console.log(" In Getall_Partner_Digital_Sign_Status res.data.message r_class = " + res.data.message);
setGetall_Partner_Digital_Sign_Status_api("true");
setGetall_Partner_Digital_Sign_Status_result(res.data.message);
if (JSON.parse(res.data.message).config_name && JSON.parse(res.data.message).config_value) {
if (String(JSON.parse(res.data.message).config_name) === "signature_digital" &&
String(JSON.parse(res.data.message).config_value) === "1") {
setpartner_digital_signature_status("1");
setlocal_partner_digital_signature_status(true);
}
}
}
else {
setGetall_Partner_Digital_Sign_Status_api("false");
setGetall_Partner_Digital_Sign_Status_message(res.data.message);
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Getall_Partner_Digital_Sign_Status = ', error);
setGetall_Partner_Digital_Sign_Status_api("false");
//setmyApimyApiMessage("")
})
}
const [Get_Given_Session_List_Automatic_Traitement_api, setGet_Given_Session_List_Automatic_Traitement_api] = useState();
const [Get_Given_Session_List_Automatic_Traitement_message, setGet_Given_Session_List_Automatic_Traitement_message] = useState();
const [Get_Given_Session_List_Automatic_Traitement_result, setGet_Given_Session_List_Automatic_Traitement_result] = useState([]);
function Get_Given_Session_List_Automatic_Traitement(local_selected_session_id) {
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("session_id", local_selected_session_id);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_SessionFormation_List_Automatic_Traitement_From/";
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
if (String(res.data.status) === String("true")) {
//console.log(" In Get_Given_Session_List_Automatic_Traitement res.data.status = " + res.data.status);
//console.log(" In Get_Given_Session_List_Automatic_Traitement res.data.message r_class = " + res.data.message);
setGet_Given_Session_List_Automatic_Traitement_api("true");
setGet_Given_Session_List_Automatic_Traitement_result(JSON.parse(res.data.message));
}
else {
setGet_Given_Session_List_Automatic_Traitement_api("false");
setGet_Given_Session_List_Automatic_Traitement_message(res.data.message);
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Get_Given_Session_List_Automatic_Traitement = ', error);
setGet_Given_Session_List_Automatic_Traitement_api("false");
//setmyApimyApiMessage("")
})
}
const [Getall_Session_Document_Status_api, setGetall_Session_Document_Status_api] = useState();
const [Getall_Session_Document_Status_message, setGetall_Session_Document_Status_message] = useState();
const [Getall_Session_Document_Status_result, setGetall_Session_Document_Status_result] = useState([]);
function Getall_Session_Document_Status(event) {
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("session_id", props.related_collection_recid);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Session_Action_Status_By_Document/";
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
if (String(res.data.status) === String("true")) {
//console.log(" In Getall_Session_Document_Status res.data.status = " + res.data.status);
console.log(" In Getall_Session_Document_Status res.data.message r_class = " + res.data.message);
setGetall_Session_Document_Status_api("true");
setGetall_Session_Document_Status_result(res.data.message);
}
else {
setGetall_Session_Document_Status_api("false");
setGetall_Session_Document_Status_message(res.data.message);
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Getall_Session_Document_Status = ', error);
setGetall_Session_Document_Status_api("false");
//setmyApimyApiMessage("")
})
}
const [Action_Server_api, setAction_Server_api] = useState();
const [Action_Server_message, setAction_Server_message] = useState();
const [Action_Server_result, setAction_Server_result] = useState([]);
function Action_Server(api_name) {
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("related_collection", props.related_collection);
form.append("related_collection_recid", props.related_collection_recid);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Action_Server_" + String(api_name) + "/";
return;
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
if (String(res.data.status) === String("true")) {
//console.log(" In Action_Server res.data.status = " + res.data.status);
//console.log(" In Action_Server res.data.message r_class = " + res.data.message);
setAction_Server_api("true");
setAction_Server_result(res.data.message);
}
else {
setAction_Server_api("false");
setAction_Server_message(res.data.message);
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Action_Server = ', error);
setAction_Server_api("false");
//setmyApimyApiMessage("")
})
}
var date_today_90j = new Date();
date_today_90j.setDate(date_today_90j.getDate() + 90);
const [is_session_invoiced, setis_session_invoiced] = useState("0");
const [session_date_debut, setsession_date_debut] = useState(date_today_90j.toLocaleDateString('fr-FR'));
const [Getall_Audit_Document_By_Partner_By_Collection_api, setGetall_Audit_Document_By_Partner_By_Collection_api] = useState();
const [Getall_Audit_Document_By_Partner_By_Collection_message, setGetall_Audit_Document_By_Partner_By_Collection_message] = useState();
const [Getall_Audit_Document_By_Partner_By_Collection_result, setGetall_Audit_Document_By_Partner_By_Collection_result] = useState([]);
function Getall_Audit_Document_By_Partner_By_Collection(event) {
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("session_id", props.related_collection_recid);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Audit_Session_Action_Inscrit/";
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
if (String(res.data.status) === String("true")) {
//console.log(" In Getall_Editable_Document_By_Partner_By_Collection res.data.status = " + res.data.status);
//console.log(" In Getall_Editable_Document_By_Partner_By_Collection res.data.message r_class = " + res.data.message);
setGetall_Audit_Document_By_Partner_By_Collection_api("true");
setGetall_Audit_Document_By_Partner_By_Collection_result(JSON.parse(res.data.message));
}
else {
setGetall_Audit_Document_By_Partner_By_Collection_api("false");
setGetall_Audit_Document_By_Partner_By_Collection_message(res.data.message);
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Getall_Editable_Document_By_Partner_By_Collection = ', error);
setGetall_Audit_Document_By_Partner_By_Collection_api("false");
//setmyApimyApiMessage("")
})
}
const [read_access_automatic_document_setup, setread_access_automatic_document_setup] = useState("");
const [write_access_automatic_document_setup, setwrite_access_automatic_document_setup] = useState("");
useEffect(() => {
setread_access_automatic_document_setup(props.check_user_acces_right("automatic_document_setup", "read"));
setwrite_access_automatic_document_setup(props.check_user_acces_right("automatic_document_setup", "write"));
Getall_Partner_Digital_Sign_Status();
setselected_session_id(props.related_collection_recid);
Getall_Editable_Document_By_Partner_By_Collection();
Getall_Audit_Document_By_Partner_By_Collection();
Get_related_collection_Data();
Get_Given_Session_List_Automatic_Traitement(props.related_collection_recid);
}, [])
function Close_Dialog_Detail_Event_open() {
setDialog_1_open(false);
}
const [tab_convention_pieces_jointes_result, settab_convention_pieces_jointes_result] = useState([]);
const [Dialog_convention_message, setDialog_convention_message] = React.useState(false);
const [Dialog_convention_open, setDialog_convention_open] = React.useState(false);
function Dialog_convention_handle_change_participant_session(message) {
setDialog_convention_message(message);
setDialog_convention_open(true);
}
const Dialog_convention_handleClose = () => {
//alert(" Utiliser le bouton 'fermer' ");
//setOpen(false);
};
const Dialog_convention_handleClose_buton = () => {
setDialog_convention_open(false);
setselected_convention_id();
setselected_convention_type("");
setselected_convention_email_destinataire_prod();
setselected_convention_email_test();
setactionmass_ftion_val();
settab_convention_pieces_jointes_result([])
setaction_server_to_run("");
setaction_server_type_doc("");
setaction_server_nom_doc("");
setaction_server_ref_interne_doc("");
setaction_server_type_doc_ref_interne("");
};
const [selected_session_id, setselected_session_id] = useState("");
const [selected_internal_url, setselected_internal_url] = useState();
const [local_nb_valide_inscription_entreprise, setlocal_nb_valide_inscription_entreprise] = useState("");
const [local_nb_valide_inscription_individuelle, setlocal_nb_valide_inscription_individuelle] = useState();
const [local_selected_session_invoiced_statut, setlocal_selected_session_invoiced_statut] = useState();
const [selected_convention_id, setselected_convention_id] = useState("");
const [selected_convention_type, setselected_convention_type] = useState("");
const [selected_convention_email_destinataire_prod, setselected_convention_email_destinataire_prod] = useState("");
const [selected_convention_email_test, setselected_convention_email_test] = useState("");
const [actionmass_ftion_val, setactionmass_ftion_val] = useState();
function Download_Session_Conventions_PDF() {
const stored_cookie = getCookie('tokenmysypart');
var nom_fichier_cmd = "Convention.zip";
if (!selected_convention_id || String(selected_convention_id).trim() === "") {
alert(" Vous devez choisir un modèle de document ");
return;
}
var url = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Convention_From_Session_By_PDF/" + stored_cookie + "/" + selected_session_id + "/" + selected_convention_id;
if (String(selected_convention_id) === "default_pdf") {
// Il s'agit d'envoyer les convention par defaut de type mail
url = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Default_Convention_From_Session_By_PDF/" + stored_cookie + "/" + selected_session_id + "/" + selected_convention_id;
}
//console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_session_id = ", selected_session_id, " --- selected_convention_id =", selected_convention_id);
setLoading(true);
axios.get(url, { responseType: 'blob', },)
.then((res) => {
setLoading(false);
//console.log(" In Download_Stagiaire_Conventions_PDF res.data = " + res.data);
if (String(res.data) === String("false")) {
alert("Impossible de télécharger la convention (2) ");
} else {
fileDownload(res.data, nom_fichier_cmd);
Getall_Editable_Document_By_Partner_By_Collection();
}
}).catch((error) => {
setLoading(false);
console.error('Error:', error);
alert(" Impossible de télécharger la convention ")
});
}
function Download_Session_Convocation_PDF() {
const stored_cookie = getCookie('tokenmysypart');
var nom_fichier_cmd = "Convocation.zip";
if (String(selected_convention_id).trim() === "") {
alert(" Vous devez choisir un modèle de document ");
return;
}
var url = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Convocation_From_Session_By_PDF/" + stored_cookie + "/" + selected_session_id + "/" + selected_convention_id;
if (String(selected_convention_id) === "default_pdf") {
// Il s'agit d'envoyer les convention par defaut de type mail
url = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Default_Convocation_From_Session_By_PDF/" + stored_cookie + "/" + selected_session_id + "/" + selected_convention_id;
}
//console.log(" ### url = ", url);
//console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_session_id = ", selected_session_id, " --- selected_convention_id =", selected_convention_id);
setLoading(true);
axios.get(url, { responseType: 'blob', },)
.then((res) => {
setLoading(false);
//console.log(" In Download_Stagiaire_Conventions_PDF res.data = " + res.data);
if (String(res.data) === String("false")) {
alert("Impossible de télécharger la convocation (2) ");
} else {
fileDownload(res.data, nom_fichier_cmd);
Getall_Editable_Document_By_Partner_By_Collection();
}
}).catch((error) => {
setLoading(false);
console.error('Error:', error);
alert(" Impossible de télécharger la convocation ")
});
}
const [New_Get_List_Stagiaire_Conventions_result, setNew_Get_List_Stagiaire_Conventions_result] = useState([]);
const [Get_List_Stagiaire_Conventions_api, setGet_List_Stagiaire_Conventions_api] = useState();
const [Get_List_Stagiaire_Conventions_message, setGet_List_Stagiaire_Conventions_message] = useState();
const [Get_List_Stagiaire_Conventions_result, setGet_List_Stagiaire_Conventions_result] = useState();
function Get_List_Stagiaire_Conventions(ref_interne, nom, type_doc, courrier_template_type_document_ref_interne) {
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("type_doc", type_doc);
form.append("courrier_template_type_document_ref_interne", courrier_template_type_document_ref_interne);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Conventions_Stagiaire_With_Filter/";
setLoading(true);
axios.post(myurl, form).then(res => {
//console.log(" In Get_List_Stagiaire_Conventions res.data.status = " + res.data.status);
//console.log(" In Get_List_Stagiaire_Conventions res.data.message r_class = " + res.data.message);
setLoading(false);
if (String(res.data.status) === String("true")) {
setGet_List_Stagiaire_Conventions_api("true");
setGet_List_Stagiaire_Conventions_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_ref_interne = JSON.parse(x).ref_interne;
var local_nom = JSON.parse(x).nom;
var local_sujet = JSON.parse(x).sujet;
var local_type_doc = JSON.parse(x).type_doc;
var local_cible = JSON.parse(x).cible;
var local_joint_pdf = JSON.parse(x).joint_pdf;
//---
var node = {
"_id": local_id,
"id": localid,
"label": local_nom,
"ref_interne": local_ref_interne,
"nom": local_nom,
"sujet": local_sujet,
"type_doc": local_type_doc,
"cible": local_cible,
"joint_pdf": local_joint_pdf,
};
new_data2.push(node);
});
if (new_data2.length > 0)
setNew_Get_List_Stagiaire_Conventions_result(new_data2);
}
else {
setGet_List_Stagiaire_Conventions_api("false");
setGet_List_Stagiaire_Conventions_message(res.data.message);
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("error");
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Get_List_Stagiaire_Conventions = ', error);
setGet_List_Stagiaire_Conventions_api("false");
alert("Impossible de récupérer les modèles de convention");
//setmyApimyApiMessage("")
})
}
const [New_Get_List_Stagiaire_Convocations_result, setNew_Get_List_Stagiaire_Convocations_result] = useState([]);
const [Get_List_Stagiaire_Convocations_api, setGet_List_Stagiaire_Convocations_api] = useState();
const [Get_List_Stagiaire_Convocations_message, setGet_List_Stagiaire_Convocations_message] = useState();
const [Get_List_Stagiaire_Convocations_result, setGet_List_Stagiaire_Convocations_result] = useState();
function Get_List_Stagiaire_Convocations(ref_interne, nom, type_doc, courrier_template_type_document_ref_interne) {
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("type_doc", type_doc);
form.append("courrier_template_type_document_ref_interne", courrier_template_type_document_ref_interne);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Convocations_Stagiaire_With_Filter/";
setLoading(true);
axios.post(myurl, form).then(res => {
//console.log(" In Get_List_Stagiaire_Convocations res.data.status = " + res.data.status);
//console.log(" In Get_List_Stagiaire_Convocations res.data.message r_class = " + res.data.message);
setLoading(false);
if (String(res.data.status) === String("true")) {
setGet_List_Stagiaire_Convocations_api("true");
setGet_List_Stagiaire_Convocations_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_ref_interne = JSON.parse(x).ref_interne;
var local_nom = JSON.parse(x).nom;
var local_sujet = JSON.parse(x).sujet;
var local_type_doc = JSON.parse(x).type_doc;
var local_cible = JSON.parse(x).cible;
var local_joint_pdf = JSON.parse(x).joint_pdf;
//---
var node = {
"_id": local_id,
"id": localid,
"label": local_nom,
"ref_interne": local_ref_interne,
"nom": local_nom,
"sujet": local_sujet,
"type_doc": local_type_doc,
"cible": local_cible,
"joint_pdf": local_joint_pdf,
};
new_data2.push(node);
});
if (new_data2.length > 0)
setNew_Get_List_Stagiaire_Convocations_result(new_data2);
}
else {
setGet_List_Stagiaire_Convocations_api("false");
setGet_List_Stagiaire_Convocations_message(res.data.message);
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("error");
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Get_List_Stagiaire_Convocations = ', error);
setGet_List_Stagiaire_Convocations_api("false");
alert("Impossible de récupérer les modèles de convocations");
//setmyApimyApiMessage("")
})
}
const [sessions_file_change_1_convention_api, setsessions_file_change_1_convention_api] = useState();
const [sessions_file_change_1_convention_result, setsessions_file_change_1_convention_result] = useState();
const [sessions_file_change_1_convention_message, setsessions_file_change_1_convention_message] = useState();
const sessions_file_change_1_convention = event => {
const fileUploaded = event.target.files[0];
let file_size = event.target.files[0].size;
let file_type = event.target.files[0].type;
if (file_type !== "application/pdf") {
alert("Le fichier n'est pas de type PDF");
return;
}
if (file_size > 10000000) {
alert("Le fichier ne doit pas depasser un 1 Méga octets");
console.log("Le fichier ne doit pas depasser un 1 Méga octets");
return;
}
//var new_node = {'name':event.target.files[0].name, 'type':event.target.files[0].type}
var new_tmp = [];
if (tab_convention_pieces_jointes_result && tab_convention_pieces_jointes_result.length > 0) {
tab_convention_pieces_jointes_result.map((x) => {
new_tmp.push(x);
});
}
new_tmp.push(event.target.files[0])
settab_convention_pieces_jointes_result(new_tmp);
//console.log(" tab_convention_pieces_jointes_result = ", tab_convention_pieces_jointes_result)
return;
};
const [Send_Stagiaire_Conventions_By_Email_Test_api, setSend_Stagiaire_Conventions_By_Email_Test_api] = useState();
const [Send_Stagiaire_Conventions_By_Email_Test_message, setSend_Stagiaire_Conventions_By_Email_Test_message] = useState();
const [Send_Stagiaire_Conventions_By_Email_Test_result, setSend_Stagiaire_Conventions_By_Email_Test_result] = useState();
function Send_Stagiaire_Conventions_By_Email_Test(event) {
var form = new FormData();
if (String(selected_convention_id).trim() === "") {
alert(" Vous devez choisir un document");
return;
}
form.append("class_internal_url", selected_internal_url);
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("session_id", selected_session_id);
form.append("courrier_template_id", selected_convention_id);
form.append("email_test", selected_convention_email_test);
form.append("email_production", "");
// pièce jointe
form.append("file_business_object", "");
var list_files = new FormData();
for (let i = 0; i < tab_convention_pieces_jointes_result.length; i++) {
form.append('File', tab_convention_pieces_jointes_result[i]);
}
//form.append("File", list_files);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Convention_From_Session_By_Email/";
if (String(selected_convention_id) === "default_mail") {
// Il s'agit d'envoyer les convention par defaut de type mail
myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Default_Convention_From_Session_By_Email/";
}
setLoading(true);
fetch(
myurl,
{
method: 'POST',
body: form,
}
)
.then((response) => response.json())
.then((result) => {
setLoading(false);
// console.log(" In Send_Stagiaire_Conventions_By_Email_Test res.data.status = " + result['status']);
//console.log(" In Send_Stagiaire_Conventions_By_Email_Test res.data.message r_class = " + result['message']);
if (String(result['status']) === String("true")) {
setSend_Stagiaire_Conventions_By_Email_Test_api("true");
setSend_Stagiaire_Conventions_By_Email_Test_result(result['message']);
// alert(result['message']);
setdisplay_alert_mysy("1");
setalert_message(result['message']);
setalert_type("success");
Dialog_convention_handleClose_buton()
}
else {
setSend_Stagiaire_Conventions_By_Email_Test_api("false");
setSend_Stagiaire_Conventions_By_Email_Test_message(result['message']);
// alert(result['message']);
setdisplay_alert_mysy("1");
setalert_message(result['message']);
setalert_type("error");
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Send_Stagiaire_Conventions_By_Email_Test = ', error);
setSend_Stagiaire_Conventions_By_Email_Test_api("false");
alert("Impossible d'envoyer l'email de test ");
//setmyApimyApiMessage("")
})
}
/*
Recuperation des autres données nécessaires à partir du : related_collection, related_collection_recid
*/
function Get_related_collection_Data() {
if (props.related_collection === "session_formation") {
// Recuperation des données de la session
GetCurrentSession(props.related_collection_recid);
}
}
const [GetCurrentSession_api, setGetCurrentSession_api] = useState();
const [GetCurrentSession_message, setGetCurrentSession_message] = useState();
const [GetCurrentSession_result, setGetCurrentSession_result] = useState([]);
function GetCurrentSession(local_session_id) {
var form = new FormData();
//form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("session_id", local_session_id);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_SessionFormation_From_Id/";
setLoading(true);
axios.post(myurl, form).then(res => {
if (String(res.data.status) === "true") {
//console.log(" In GetCurrentSession res.data.status = " + res.data.status);
//console.log(" In GetCurrentSession res.data.message r_class = " + res.data.message);
//console.log(" In GetCurrentSession res.data.message len = " + String(res.data.message).length);
setLoading(false);
setGetCurrentSession_api("true");
if (String(res.data.message).length > 0) {
setGetCurrentSession_result(res.data.message);
var mylocaltraining = JSON.parse(res.data.message);
if (mylocaltraining.class_internal_url) {
setselected_internal_url(mylocaltraining.class_internal_url);
}
if (mylocaltraining.invoiced_statut) {
setis_session_invoiced(mylocaltraining.invoiced_statut);
}
if (mylocaltraining.date_debut) {
setsession_date_debut(mylocaltraining.date_debut);
}
if (mylocaltraining.nb_valide_inscription_entreprise) {
setlocal_nb_valide_inscription_entreprise(mylocaltraining.nb_valide_inscription_entreprise);
} else {
setlocal_nb_valide_inscription_entreprise("");
}
if (mylocaltraining.nb_valide_inscription_individuelle) {
setlocal_nb_valide_inscription_individuelle(mylocaltraining.nb_valide_inscription_individuelle);
} else {
setlocal_nb_valide_inscription_individuelle("");
}
}
} else if (String(res.data.status) === String("Err_Connexion")) {
setLoading(false);
alert('Erreur: ' + res.data.message);
history.push("/Connexion");
}
else {
setLoading(false);
setGetCurrentSession_api("false");
setGetCurrentSession_message(res.data.message);
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("error");
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( GetCurrentSession = ', error);
setGetCurrentSession_api("false");
alert(" Impossible de récuperer les données de la session ");
})
}
const [Get_Convention_List_Of_All_PJ_result, setGet_Convention_List_Of_All_PJ_result] = useState([]);
function Delete_Convention_Attached_Doc(event) {
var doc_to_del_name = event.target.id;
const myArray = tab_convention_pieces_jointes_result;
let new_myArray = myArray.filter(file => file.name !== String(doc_to_del_name));
//console.log(" new_myArray = ", new_myArray);
var new_tab = []
for (let i = 0; i < new_myArray.length; i++) {
new_tab.push(new_myArray[i]);
}
settab_convention_pieces_jointes_result(new_tab);
}
const [display_audit_data, setdisplay_audit_data] = useState("0");
const [Send_Stagiaire_Conventions_By_Email_api, setSend_Stagiaire_Conventions_By_Email_api] = useState();
const [Send_Stagiaire_Conventions_By_Email_message, setSend_Stagiaire_Conventions_By_Email_message] = useState();
const [Send_Stagiaire_Conventions_By_Email_result, setSend_Stagiaire_Conventions_By_Email_result] = useState();
function Send_Stagiaire_Conventions_By_Email(event) {
var form = new FormData();
if (String(selected_convention_id).trim() === "") {
alert(" Vous devez choisir un document");
return;
}
form.append("class_internal_url", selected_internal_url);
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("session_id", selected_session_id);
form.append("courrier_template_id", selected_convention_id);
form.append("email_test", selected_convention_email_test);
form.append("email_production", selected_convention_email_destinataire_prod);
if (local_partner_digital_signature_status === true) {
form.append("request_digital_signature", "1");
} else {
form.append("request_digital_signature", "0");
}
// pièce jointe
form.append("file_business_object", "");
var list_files = new FormData();
for (let i = 0; i < tab_convention_pieces_jointes_result.length; i++) {
form.append('File', tab_convention_pieces_jointes_result[i]);
}
//form.append("File", list_files);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Convention_From_Session_By_Email/";
if (String(selected_convention_id) === "default_mail") {
// Il s'agit d'envoyer les convention par defaut de type mail
myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Default_Convention_From_Session_By_Email/";
}
//console.log(" ### myurl = ", myurl);
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
//console.log(" In Send_Stagiaire_Conventions_By_Email res.data.status = " + res.data.status);
//console.log(" In Send_Stagiaire_Conventions_By_Email res.data.message r_class = " + res.data.message);
if (String(res.data.status) === String("true")) {
setSend_Stagiaire_Conventions_By_Email_api("true");
setSend_Stagiaire_Conventions_By_Email_result(res.data.message);
Getall_Editable_Document_By_Partner_By_Collection();
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("success");
Dialog_convention_handleClose_buton()
}
else {
setSend_Stagiaire_Conventions_By_Email_api("false");
setSend_Stagiaire_Conventions_By_Email_message(res.data.message);
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("error");
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Send_Stagiaire_Conventions_By_Email = ', error);
setSend_Stagiaire_Conventions_By_Email_api("false");
alert("Impossible d'envoyer la convention par email");
//setmyApimyApiMessage("")
})
}
const [Send_Stagiaire_Convocations_By_Email_api, setSend_Stagiaire_Convocations_By_Email_api] = useState();
const [Send_Stagiaire_Convocations_By_Email_message, setSend_Stagiaire_Convocations_By_Email_message] = useState();
const [Send_Stagiaire_Convocations_By_Email_result, setSend_Stagiaire_Convocations_By_Email_result] = useState();
function Send_Stagiaire_Convocations_By_Email(event) {
var form = new FormData();
if (String(selected_convention_id).trim() === "") {
alert(" Vous devez choisir un document");
return;
}
form.append("class_internal_url", selected_internal_url);
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("session_id", selected_session_id);
form.append("courrier_template_id", selected_convention_id);
form.append("email_test", selected_convention_email_test);
form.append("email_production", selected_convention_email_destinataire_prod);
// pièce jointe
form.append("file_business_object", "");
var list_files = new FormData();
for (let i = 0; i < tab_convention_pieces_jointes_result.length; i++) {
form.append('File', tab_convention_pieces_jointes_result[i]);
}
//form.append("File", list_files);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Convocation_From_Session_By_Email/";
if (String(selected_convention_id) === "default_mail") {
// Il s'agit d'envoyer les convention par defaut de type mail
myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Default_Convocation_From_Session_By_Email/";
}
//console.log(" ### myurl = ", myurl);
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
//console.log(" In Send_Stagiaire_Convocations_By_Email res.data.status = " + res.data.status);
//console.log(" In Send_Stagiaire_Convocations_By_Email res.data.message r_class = " + res.data.message);
if (String(res.data.status) === String("true")) {
setSend_Stagiaire_Convocations_By_Email_api("true");
setSend_Stagiaire_Convocations_By_Email_result(res.data.message);
Getall_Editable_Document_By_Partner_By_Collection();
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("success");
Dialog_convention_handleClose_buton()
}
else {
setSend_Stagiaire_Convocations_By_Email_api("false");
setSend_Stagiaire_Convocations_By_Email_message(res.data.message);
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("error");
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Send_Stagiaire_Convocations_By_Email = ', error);
setSend_Stagiaire_Convocations_By_Email_api("false");
alert("Impossible d'envoyer la convocation par email");
//setmyApimyApiMessage("")
})
}
const [Update_Session_Automatic_Doc_Setup_api, setUpdate_Session_Automatic_Doc_Setup_api] = useState();
const [Update_Session_Automatic_Doc_Setup_message, setUpdate_Session_Automatic_Doc_Setup_message] = useState();
const [Update_Session_Automatic_Doc_Setup_result, setUpdate_Session_Automatic_Doc_Setup_result] = useState([]);
function Update_Session_Automatic_Doc_Setup(event) {
var form = new FormData();
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("_id", selected_session_id);
form.append("nb_jour_action", p_doc_automatic_setup_nb_jour);
form.append("action_target_date", p_doc_automatic_setup_action_target_date);
form.append("actif", p_doc_automatic_setup_actif);
// form.append("courrier_template_type_document_id", p_doc_automatic_setup_courrier_template_type_document_id);
form.append("courrier_template_type_document_ref_interne", p_doc_automatic_setup_courrier_template_type_document_ref_interne);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_SessionFormation_Doc_Automatic_Setup/";
setLoading(true);
axios.post(myurl, form).then(res => {
setLoading(false);
if (String(res.data.status) === String("true")) {
//console.log(" In Update_Session_Automatic_Doc_Setup res.data.status = " + res.data.status);
//console.log(" In Update_Session_Automatic_Doc_Setup res.data.message r_class = " + res.data.message);
setUpdate_Session_Automatic_Doc_Setup_api("true");
setUpdate_Session_Automatic_Doc_Setup_result(res.data.message);
Dialog_Config_Doc_Automation_handleClose_buton();
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("success");
Get_Given_Session_List_Automatic_Traitement(props.related_collection_recid);
}
else {
setUpdate_Session_Automatic_Doc_Setup_api("false");
setUpdate_Session_Automatic_Doc_Setup_message(res.data.message);
// alert(res.data.message);
setdisplay_alert_mysy("1");
setalert_message(res.data.message);
setalert_type("error");
}
}).catch((error) => {
setLoading(false);
console.warn('Not good man :( Update_Session_Automatic_Doc_Setup = ', error);
setUpdate_Session_Automatic_Doc_Setup_api("false");
alert(" Impossible de modifier le parametrage du document");
})
}
const [action_server_to_run, setaction_server_to_run] = useState("");
const [action_server_type_doc, setaction_server_type_doc] = useState("");
const [action_server_nom_doc, setaction_server_nom_doc] = useState("");
const [action_server_ref_interne_doc, setaction_server_ref_interne_doc] = useState("");
const [action_server_type_doc_ref_interne, setaction_server_type_doc_ref_interne] = useState("");
const [Dialog_EMARGEMENT_FORMATION_open, setDialog_EMARGEMENT_FORMATION_open] = React.useState(false);
const Dialog_EMARGEMENT_FORMATION_handleClose = () => {
//alert(" Utiliser le bouton 'fermer' ");
//setOpen(false);
};
const Dialog_EMARGEMENT_FORMATION_handleClose_buton = () => {
setDialog_EMARGEMENT_FORMATION_open(false);
};
const [Dialog_ATTESTATION_FORMATION_open, setDialog_ATTESTATION_FORMATION_open] = React.useState(false);
const Dialog_ATTESTATION_FORMATION_handleClose = () => {
//alert(" Utiliser le bouton 'fermer' ");
//setOpen(false);
};
const Dialog_ATTESTATION_FORMATION_handleClose_buton = () => {
setDialog_ATTESTATION_FORMATION_open(false);
};
const [Dialog_CONF_INSCRIPTION_open, setDialog_CONF_INSCRIPTION_open] = React.useState(false);
const Dialog_CONF_INSCRIPTION_handleClose = () => {
//alert(" Utiliser le bouton 'fermer' ");
//setOpen(false);
};
const Dialog_CONF_INSCRIPTION_handleClose_buton = () => {
setDialog_CONF_INSCRIPTION_open(false);
};
const [Dialog_CONVOCATION_STAGIAIRE_open, setDialog_CONVOCATION_STAGIAIRE_open] = React.useState(false);
const Dialog_CONVOCATION_STAGIAIRE_handleClose = () => {
//alert(" Utiliser le bouton 'fermer' ");
//setOpen(false);
};
const Dialog_CONVOCATION_STAGIAIRE_handleClose_buton = () => {
setDialog_CONVOCATION_STAGIAIRE_open(false);
};
const New_Option_Type_Document = [
{ "id": "email", "label": "Email", "value": "email" },
{ "id": "pdf", "label": "PDF", "value": "pdf" },
]
const [Dialog_EVALUATION_FORMATION_open, setDialog_EVALUATION_FORMATION_open] = React.useState(false);
const Dialog_EVALUATION_FORMATION_handleClose = () => {
};
const Dialog_EVALUATION_FORMATION_handleClose_buton = () => {
setDialog_EVALUATION_FORMATION_open(false);
};
const [Dialog_Q_POSITIONNEMENT_open, setDialog_Q_POSITIONNEMENT_open] = React.useState(false);
const Dialog_Q_POSITIONNEMENT_handleClose = () => {
};
const Dialog_Q_POSITIONNEMENT_handleClose_buton = () => {
setDialog_Q_POSITIONNEMENT_open(false);
};
const [Dialog_FACTURATION_FORMATION_open, setDialog_FACTURATION_FORMATION_open] = React.useState(false);
const Dialog_FACTURATION_FORMATION_handleClose = () => {
};
const Dialog_FACTURATION_FORMATION_handleClose_buton = () => {
setDialog_FACTURATION_FORMATION_open(false);
};
const [MSG_INFO_TEXT, setMSG_INFO_TEXT] = React.useState(false);
const [Dialog_MSG_INFO_open, setDialog_MSG_INFO_open] = React.useState(false);
const Dialog_MSG_INFO_handleClose = () => {
//alert(" Utiliser le bouton 'fermer' ");
//setOpen(false);
};
const Dialog_MSG_INFO_handleClose_buton = () => {
setDialog_MSG_INFO_open(false);
};
function handleExpandClick_audit() {
setdisplay_audit_data("1");
setExpanded_nom_traite((oldExpanded_nom_traite) =>
oldExpanded_nom_traite.length === 0 ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] : [],
);
}
const [display_alert_mysy, setdisplay_alert_mysy] = useState("");
const [alert_message, setalert_message] = useState("");
const [alert_type, setalert_type] = useState("");
function clear_alert_message() {
setalert_message("");
}
function clear_alert_type() {
setalert_type("");
}
function clear_display_alert_mysy() {
setdisplay_alert_mysy("");
}
const [Dialog_Config_Doc_Automation_open, setDialog_Config_Doc_Automation_open] = React.useState(false);
const Dialog_Config_Doc_Automation_handleClose = () => {
//alert(" Utiliser le bouton 'fermer' ");
//setOpen(false);
};
const Dialog_Config_Doc_Automation_handleClose_buton = () => {
setDialog_Config_Doc_Automation_open(false);
setedit_doc_automatic_setup("");
setis_modified_doc_automatic_setup("");
setp_doc_automatic_setup_selected_id("");
setp_doc_automatic_setup_actif("");
setp_doc_automatic_setup_nb_jour("");
setp_doc_automatic_setup_nom_document("");
setp_doc_automatic_setup_courrier_template_type_document_ref_interne("");
setp_doc_automatic_setup_courrier_template_type_document_id("");
setp_doc_automatic_setup_action_target_date("");
};
const [edit_doc_automatic_setup, setedit_doc_automatic_setup] = useState("");
const [is_modified_doc_automatic_setup, setis_modified_doc_automatic_setup] = useState("");
const [p_doc_automatic_setup_action_target_date, setp_doc_automatic_setup_action_target_date] = useState("");
const [p_doc_automatic_setup_selected_id, setp_doc_automatic_setup_selected_id] = useState("");
const [p_doc_automatic_setup_actif, setp_doc_automatic_setup_actif] = useState("");
const [p_doc_automatic_setup_nb_jour, setp_doc_automatic_setup_nb_jour] = useState("");
const [p_doc_automatic_setup_nom_document, setp_doc_automatic_setup_nom_document] = useState("");
const [p_doc_automatic_setup_courrier_template_type_document_ref_interne, setp_doc_automatic_setup_courrier_template_type_document_ref_interne] = useState("");
const [p_doc_automatic_setup_courrier_template_type_document_id, setp_doc_automatic_setup_courrier_template_type_document_id] = useState("");
const [Dialog_Access_Right_message, setDialog_Access_Right_message] = React.useState(false);
const [Dialog_Acces_Right_open, setDialog_Acces_Right_open] = React.useState(false);
function Dialog_Acces_Right_handle_acces_insuffisant(message) {
setDialog_Access_Right_message(message);
setDialog_Acces_Right_open(true);
}
const Dialog_Acces_Right_handleClose = () => {
//alert(" Utiliser le bouton 'fermer' ");
//setOpen(false);
};
const Dialog_Acces_Right_handleClose_buton = () => {
setDialog_Acces_Right_open(false);
};
const New_Option_Automatic_Doc_Action_Target = [
{ "id": "start_session", "label": "Date Début Session", "value": "start_session" },
{ "id": "end_session", "label": "Date Fin Session", "value": "end_session" },
{ "id": "", "label": "", "value": "" },
]
return (
{isLoading &&
}
{/*** Affichage des messages d'alerte*/}
{display_alert_mysy && String(display_alert_mysy) === "1" &&
}
{/*** FIN Affichage des messages d'alerte*/}
{/**** Dialog Pour les Droits d'acces **/}
{/**** Fin Dialog Pour les Droits d'acces **/}
{/* Dialog pour gerer les Config_Doc_Automation */}
{/* FIN Dialog pour gerer les Config_Doc_Automation */}
{/* Dialog pour gerer les MSG_INFO */}
{/* FIN Dialog pour gerer les MSG_INFO */}
{/* Dialog pour gerer les CONF_INSCRIPTION */}
{/* FIN Dialog pour gerer les CONF_INSCRIPTION */}
{/* Dialog pour gerer les EMARGEMENT_FORMATION */}
{/* FIN Dialog pour gerer les EMARGEMENT_FORMATION */}
{/* Dialog pour gerer les ATTESTATION_FORMATION */}
{/* FIN Dialog pour gerer les ATTESTATION_FORMATION */}
{/* Dialog pour gerer les EVALUATION_FORMATION */}
{/* FIN Dialog pour gerer les EVALUATION_FORMATION */}
{/* Dialog pour gerer les CONVOCATION_STAGIAIRE */}
{/* FIN Dialog pour gerer les CONVOCATION_STAGIAIRE */}
{/* Dialog pour gerer les CONVENTIONS */}
{/* FIN Dialog pour gerer les CONVENTIONS */}
{/* Dialog pour gerer les Q_POSITIONNEMENT */}
{/* FIN Dialog pour gerer les Q_POSITIONNEMENT */}
{/* Dialog pour gerer les FACTURATION_FORMATION */}
{/* FIN Dialog pour gerer les FACTURATION_FORMATION */}
{
setaction_server_to_run(String(JSON.parse(document).server_action_name))
//setaction_server_type_doc(String(JSON.parse(document).courrier_template_type_doc))
setaction_server_nom_doc(String(JSON.parse(document).courrier_template_nom))
setaction_server_ref_interne_doc(String(JSON.parse(document).courrier_template_ref_interne))
Action_Server(String(JSON.parse(document).server_action_name));
setaction_server_type_doc_ref_interne(JSON.parse(document).courrier_template_ref_interne);
setDialog_1_message(String(JSON.parse(document).courrier_template_ref_interne))
if (String(JSON.parse(document).courrier_template_ref_interne) === "CONVENTION_STAGIAIRE_ENTREPRISE") {
// Verifier que la date de la session n'est pas passée
var date_eval = new Date(moment(session_date_debut, "DD/MM/YYYY"));
var diff = date_eval.getTime() - Date.now();
if (diff <= 0) {
setMSG_INFO_TEXT("Cette session a déjà commencé. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
return;
}
if (String(is_session_invoiced) === "1") {
setMSG_INFO_TEXT("Cette session est en cours de facturation. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
}
else if (String(is_session_invoiced) === "2") {
setMSG_INFO_TEXT("Cette session a déjà été facturée. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
} else {
Get_List_Stagiaire_Conventions(String(JSON.parse(document).courrier_template_ref_interne), String(JSON.parse(document).courrier_template_nom), String(JSON.parse(document).courrier_template_type_doc)
);
setDialog_convention_open(true);
}
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "EMARGEMENT_FORMATION") {
// setDialog_EMARGEMENT_FORMATION_open(true);
props.submenu_emargement();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "ATTESTATION_FORMATION") {
//setDialog_ATTESTATION_FORMATION_open(true);
props.submenu_attestation();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "CONVOCATION_STAGIAIRE") {
// Verifier que la date de la session n'est pas passée
var date_eval = new Date(moment(session_date_debut, "DD/MM/YYYY"));
var diff = date_eval.getTime() - Date.now();
if (diff <= 0) {
setMSG_INFO_TEXT("Cette session a déjà commencé. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
return;
}
if (String(is_session_invoiced) === "1") {
setMSG_INFO_TEXT("Cette session est en cours de facturation. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
}
else if (String(is_session_invoiced) === "2") {
setMSG_INFO_TEXT("Cette session a déjà été facturée. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
} else {
Get_List_Stagiaire_Convocations(String(JSON.parse(document).courrier_template_ref_interne), String(JSON.parse(document).courrier_template_nom), String(JSON.parse(document).courrier_template_type_doc)
);
setDialog_CONVOCATION_STAGIAIRE_open(true);
}
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "CONF_INSCRIPTION") {
setDialog_CONF_INSCRIPTION_open(true);
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "EVAL_FORMATION") {
//setDialog_EVALUATION_FORMATION_open(true);
props.submenu_evaluation();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "QUESTION_POSITIONNEMENT") {
//setDialog_Q_POSITIONNEMENT_open(true);
props.submenu_q_positionnement();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "FACTURATION_SESSION") {
setDialog_FACTURATION_FORMATION_open(true);
}
}}>
{(JSON.parse(document).courrier_template_nom)}
{
setaction_server_to_run(String(JSON.parse(document).server_action_name))
//setaction_server_type_doc(String(JSON.parse(document).courrier_template_type_doc))
setaction_server_nom_doc(String(JSON.parse(document).courrier_template_nom))
setaction_server_ref_interne_doc(String(JSON.parse(document).courrier_template_ref_interne))
Action_Server(String(JSON.parse(document).server_action_name));
setaction_server_type_doc_ref_interne(JSON.parse(document).courrier_template_ref_interne);
setDialog_1_message(String(JSON.parse(document).courrier_template_ref_interne))
if (String(JSON.parse(document).courrier_template_ref_interne) === "CONVENTION_STAGIAIRE_INDIVIDUELLE") {
// Verifier que la date de la session n'est pas passée
var date_eval = new Date(moment(session_date_debut, "DD/MM/YYYY"));
var diff = date_eval.getTime() - Date.now();
if (diff <= 0) {
setMSG_INFO_TEXT("Cette session a déjà commencé. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
return;
}
if (String(is_session_invoiced) === "1") {
setMSG_INFO_TEXT("Cette session est en cours de facturation. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
}
else if (String(is_session_invoiced) === "2") {
setMSG_INFO_TEXT("Cette session a déjà été facturée. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
} else {
Get_List_Stagiaire_Conventions(String(JSON.parse(document).courrier_template_ref_interne), String(JSON.parse(document).courrier_template_nom), String(JSON.parse(document).courrier_template_type_doc)
);
setDialog_convention_open(true);
}
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "EMARGEMENT_FORMATION") {
// setDialog_EMARGEMENT_FORMATION_open(true);
props.submenu_emargement();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "ATTESTATION_FORMATION") {
//setDialog_ATTESTATION_FORMATION_open(true);
props.submenu_attestation();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "CONVOCATION_STAGIAIRE") {
// Verifier que la date de la session n'est pas passée
var date_eval = new Date(moment(session_date_debut, "DD/MM/YYYY"));
var diff = date_eval.getTime() - Date.now();
if (diff <= 0) {
setMSG_INFO_TEXT("Cette session a déjà commencé. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
return;
}
if (String(is_session_invoiced) === "1") {
setMSG_INFO_TEXT("Cette session est en cours de facturation. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
}
else if (String(is_session_invoiced) === "2") {
setMSG_INFO_TEXT("Cette session a déjà été facturée. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
} else {
Get_List_Stagiaire_Convocations(String(JSON.parse(document).courrier_template_ref_interne), String(JSON.parse(document).courrier_template_nom), String(JSON.parse(document).courrier_template_type_doc)
);
setDialog_CONVOCATION_STAGIAIRE_open(true);
}
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "CONF_INSCRIPTION") {
setDialog_CONF_INSCRIPTION_open(true);
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "EVAL_FORMATION") {
//setDialog_EVALUATION_FORMATION_open(true);
props.submenu_evaluation();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "QUESTION_POSITIONNEMENT") {
//setDialog_Q_POSITIONNEMENT_open(true);
props.submenu_q_positionnement();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "FACTURATION_SESSION") {
setDialog_FACTURATION_FORMATION_open(true);
}
}}>
{(JSON.parse(document).courrier_template_nom)}
{
setaction_server_to_run(String(JSON.parse(document).server_action_name))
//setaction_server_type_doc(String(JSON.parse(document).courrier_template_type_doc))
setaction_server_nom_doc(String(JSON.parse(document).courrier_template_nom))
setaction_server_ref_interne_doc(String(JSON.parse(document).courrier_template_ref_interne))
Action_Server(String(JSON.parse(document).server_action_name));
setaction_server_type_doc_ref_interne(JSON.parse(document).courrier_template_ref_interne);
setDialog_1_message(String(JSON.parse(document).courrier_template_ref_interne))
if (String(JSON.parse(document).courrier_template_ref_interne) === "CONVENTION_STAGIAIRE_ENTREPRISE" ||
String(JSON.parse(document).courrier_template_ref_interne) === "CONVENTION_STAGIAIRE_INDIVIDUELLE") {
// Verifier que la date de la session n'est pas passée
var date_eval = new Date(moment(session_date_debut, "DD/MM/YYYY"));
var diff = date_eval.getTime() - Date.now();
if (diff <= 0) {
setMSG_INFO_TEXT("Cette session a déjà commencé. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
return;
}
if (String(is_session_invoiced) === "1") {
setMSG_INFO_TEXT("Cette session est en cours de facturation. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
}
else if (String(is_session_invoiced) === "2") {
setMSG_INFO_TEXT("Cette session a déjà été facturée. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
} else {
Get_List_Stagiaire_Conventions(String(JSON.parse(document).courrier_template_ref_interne), String(JSON.parse(document).courrier_template_nom), String(JSON.parse(document).courrier_template_type_doc)
);
setDialog_convention_open(true);
}
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "EMARGEMENT_FORMATION") {
// setDialog_EMARGEMENT_FORMATION_open(true);
props.submenu_emargement();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "ATTESTATION_FORMATION") {
//setDialog_ATTESTATION_FORMATION_open(true);
props.submenu_attestation();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "CONVOCATION_STAGIAIRE") {
// Verifier que la date de la session n'est pas passée
var date_eval = new Date(moment(session_date_debut, "DD/MM/YYYY"));
var diff = date_eval.getTime() - Date.now();
if (diff <= 0) {
setMSG_INFO_TEXT("Cette session a déjà commencé. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
return;
}
if (String(is_session_invoiced) === "1") {
setMSG_INFO_TEXT("Cette session est en cours de facturation. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
}
else if (String(is_session_invoiced) === "2") {
setMSG_INFO_TEXT("Cette session a déjà été facturée. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
} else {
Get_List_Stagiaire_Convocations(String(JSON.parse(document).courrier_template_ref_interne), String(JSON.parse(document).courrier_template_nom), String(JSON.parse(document).courrier_template_type_doc)
);
setDialog_CONVOCATION_STAGIAIRE_open(true);
}
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "CONF_INSCRIPTION") {
setDialog_CONF_INSCRIPTION_open(true);
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "EVAL_FORMATION") {
//setDialog_EVALUATION_FORMATION_open(true);
props.submenu_evaluation();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "QUESTION_POSITIONNEMENT") {
//setDialog_Q_POSITIONNEMENT_open(true);
props.submenu_q_positionnement();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "FACTURATION_SESSION") {
setDialog_FACTURATION_FORMATION_open(true);
}
}}>
{(JSON.parse(document).courrier_template_nom)}
{
if (String(write_access_automatic_document_setup) !== "1") {
setDialog_Access_Right_message("Vos droits ne sont pas suffisants pour accéder cette fonction");
setDialog_Acces_Right_open(true);
return;
}
setp_doc_automatic_setup_actif(String((x).actif));
setp_doc_automatic_setup_nb_jour(String((x).nb_jour_action));
setp_doc_automatic_setup_action_target_date(String((x).action_target_date));
setp_doc_automatic_setup_selected_id(String((x).courrier_template_type_document_id));
setp_doc_automatic_setup_nom_document(String((x).nom_document));
setp_doc_automatic_setup_courrier_template_type_document_ref_interne(String((x).courrier_template_type_document_ref_interne));
setp_doc_automatic_setup_courrier_template_type_document_id(String(x.courrier_template_type_document_id));
setaction_server_nom_doc(String(JSON.parse(document).courrier_template_nom))
setaction_server_ref_interne_doc(String(JSON.parse(document).courrier_template_ref_interne))
setDialog_Config_Doc_Automation_open(true);
}}
>
{x && String(x.actif) === "1" &&
Nb Jours : " + `${x.nb_jour_action}` + " Date Cible: " + `${x.action_target_date}` + " Exécution dans : " + `${x.delta_day}` + " Jour(s)"}>
{String(x.delta_day) < "0" && }
{String(x.delta_day) >= "0" && }
}
{x && String((x).actif) !== "1" &&
}
}
))}
}
{/*** Cas d'une sesson facturée */}
{(String(JSON.parse(GetCurrentSession_result).selected_session_invoiced_statut) === "1" || String(JSON.parse(GetCurrentSession_result).selected_session_invoiced_statut) === "2") &&
{
setaction_server_to_run(String(JSON.parse(document).server_action_name))
//setaction_server_type_doc(String(JSON.parse(document).courrier_template_type_doc))
setaction_server_nom_doc(String(JSON.parse(document).courrier_template_nom))
setaction_server_ref_interne_doc(String(JSON.parse(document).courrier_template_ref_interne))
Action_Server(String(JSON.parse(document).server_action_name));
setaction_server_type_doc_ref_interne(JSON.parse(document).courrier_template_ref_interne);
setDialog_1_message(String(JSON.parse(document).courrier_template_ref_interne))
if (String(JSON.parse(document).courrier_template_ref_interne) === "CONVENTION_STAGIAIRE_ENTREPRISE" ||
String(JSON.parse(document).courrier_template_ref_interne) === "CONVENTION_STAGIAIRE_INDIVIDUELLE") {
// Verifier que la date de la session n'est pas passée
var date_eval = new Date(moment(session_date_debut, "DD/MM/YYYY"));
var diff = date_eval.getTime() - Date.now();
if (diff <= 0) {
setMSG_INFO_TEXT("Cette session a déjà commencé. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
return;
}
if (String(is_session_invoiced) === "1") {
setMSG_INFO_TEXT("Cette session est en cours de facturation. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
}
else if (String(is_session_invoiced) === "2") {
setMSG_INFO_TEXT("Cette session a déjà été facturée. Il n'est plus possible d'éditer une convention")
setDialog_MSG_INFO_open(true);
} else {
Get_List_Stagiaire_Conventions(String(JSON.parse(document).courrier_template_ref_interne), String(JSON.parse(document).courrier_template_nom), String(JSON.parse(document).courrier_template_type_doc)
);
setDialog_convention_open(true);
}
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "EMARGEMENT_FORMATION") {
// setDialog_EMARGEMENT_FORMATION_open(true);
props.submenu_emargement();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "ATTESTATION_FORMATION") {
//setDialog_ATTESTATION_FORMATION_open(true);
props.submenu_attestation();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "CONVOCATION_STAGIAIRE") {
// Verifier que la date de la session n'est pas passée
var date_eval = new Date(moment(session_date_debut, "DD/MM/YYYY"));
var diff = date_eval.getTime() - Date.now();
if (diff <= 0) {
setMSG_INFO_TEXT("Cette session a déjà commencé. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
return;
}
if (String(is_session_invoiced) === "1") {
setMSG_INFO_TEXT("Cette session est en cours de facturation. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
}
else if (String(is_session_invoiced) === "2") {
setMSG_INFO_TEXT("Cette session a déjà été facturée. Il n'est plus possible d'éditer une convocation")
setDialog_MSG_INFO_open(true);
} else {
Get_List_Stagiaire_Convocations(String(JSON.parse(document).courrier_template_ref_interne), String(JSON.parse(document).courrier_template_nom), String(JSON.parse(document).courrier_template_type_doc)
);
setDialog_CONVOCATION_STAGIAIRE_open(true);
}
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "CONF_INSCRIPTION") {
setDialog_CONF_INSCRIPTION_open(true);
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "EVAL_FORMATION") {
//setDialog_EVALUATION_FORMATION_open(true);
props.submenu_evaluation();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "QUESTION_POSITIONNEMENT") {
//setDialog_Q_POSITIONNEMENT_open(true);
props.submenu_q_positionnement();
}
else if (String(JSON.parse(document).courrier_template_ref_interne) === "FACTURATION_SESSION") {
setDialog_FACTURATION_FORMATION_open(true);
}
}}>
{(JSON.parse(document).courrier_template_nom)}