diff --git a/src/components/Config_Document.js b/src/components/Config_Document.js
index 5c24045..039e811 100644
--- a/src/components/Config_Document.js
+++ b/src/components/Config_Document.js
@@ -6,30 +6,19 @@ import Button from '@mui/material/Button';
import axios from "axios";
import { getCookie, setCookie } from 'react-use-cookie';
import { useHistory } from "react-router-dom";
-import CheckOut from "./CheckOut";
+
import { DataGrid, GridToolbar, frFR } from '@mui/x-data-grid';
import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
import { Editor } from '@tinymce/tinymce-react';
-import parse from 'html-react-parser';
-import { FcViewDetails, FcDisapprove } from "react-icons/fc";
import 'react-tooltip/dist/react-tooltip.css'
import { Tooltip } from 'react-tooltip'
import add_plus from "../mysy_img/plus.png";
-import excel_icone from "../mysy_img/excel_icone.png";
-import participants from "../mysy_img/participants.png";
-import fileDownload from 'js-file-download'
import Popup from 'reactjs-popup';
import 'reactjs-popup/dist/index.css';
-import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint } from "react-icons/fc";
-import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
-import { format } from 'date-fns'
-import moment from "moment";
import InputAdornment from '@mui/material/InputAdornment';
import { AiFillCloseCircle } from "react-icons/ai";
import Box from '@mui/material/Box';
-import { Typography, LinearProgress } 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';
@@ -37,8 +26,8 @@ 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 { HiOutlineDocumentDuplicate } from "react-icons/hi2";
+
const Config_Documents = (props) => {
const history = useHistory();
const [submenu, setsubmenu] = useState("");
@@ -68,26 +57,60 @@ const Config_Documents = (props) => {
{ field: 'type_doc', headerName: 'type_doc', width: 150, hideable: false, },
{ field: 'cible', headerName: 'cible', width: 150, hide: false, editable: false },
{ field: 'sujet', headerName: 'sujet', hide: false, editable: false, flex: 1 },
-
-
- /*{
- field: "Detail", headerName: 'Voir detail',
+ {
+ field: 'duplicate', headerName: 'Dupliquer', hide: false, editable: false, flex: 1,
renderCell: (cellValues) => {
+
return (
+
+ )
- );
}
- },*/
+ },
+
+
+
+ /* {
+ field: "Dupliquer", headerName: 'Dupliquer',
+ renderCell: (cellValues) => {
+ return (
+
+
+
+ );
+ }
+ },*/
{
field: "delete", headerName: 'Supprimer',
renderCell: (cellValues) => {
@@ -283,7 +306,7 @@ const Config_Documents = (props) => {
Get_Partner_Document_Data(document_id);
if (document.getElementById('myRef')) {
- // myRef.current.scrollIntoView({ behavior: "smooth" });
+ // myRef.current.scrollIntoView({ behavior: "smooth" });
var divh = document.getElementById('myRef').offsetTop;
window.scrollTo({
top: divh,
@@ -309,6 +332,7 @@ const Config_Documents = (props) => {
const [p_detail_ref_interne, setp_detail_ref_interne] = useState("");
const [p_detail_sujet, setp_detail_sujet] = useState("");
const [p_detail_type_doc, setp_detail_type_doc] = useState("");
+ const [p_detail_duplicate, setp_detail_duplicate] = useState("");
const [p_one_detail_cible, setp_one_detail_cible] = useState("");
@@ -400,7 +424,7 @@ const Config_Documents = (props) => {
disable_Partner_DocumentFields();
if (document.getElementById('myRef')) {
- // myRef.current.scrollIntoView({ behavior: "smooth" });
+ // myRef.current.scrollIntoView({ behavior: "smooth" });
var divh = document.getElementById('myRef').offsetTop;
window.scrollTo({
top: divh,
@@ -497,7 +521,7 @@ const Config_Documents = (props) => {
disable_Partner_DocumentFields();
if (document.getElementById('myRef')) {
//myRef.current.scrollIntoView({ behavior: "smooth" });
-
+
var divh = document.getElementById('myRef').offsetTop;
window.scrollTo({
top: divh,
@@ -814,9 +838,9 @@ const Config_Documents = (props) => {
//Get_Personnalisable_Collection_and_Fields();
Getall_Partner_Document_No_filter();
- // myRef_head.current.scrollIntoView({ behavior: "smooth" });
+ // myRef_head.current.scrollIntoView({ behavior: "smooth" });
- if(document.getElementById('myRef_head')){
+ if (document.getElementById('myRef_head')) {
var divh = document.getElementById('myRef_head').offsetTop;
window.scrollTo({
top: divh,
@@ -969,6 +993,79 @@ const Config_Documents = (props) => {
}
+ const [document_id_to_duplicate, setdocument_id_to_duplicate] = useState();
+
+ const [Duplicate_Partner_Document_api, setDuplicate_Partner_Document_api] = useState();
+ const [Duplicate_Partner_Document_message, setDuplicate_Partner_Document_message] = useState();
+ const [Duplicate_Partner_Document_result, setDuplicate_Partner_Document_result] = useState();
+ function Duplicate_Partner_Document() {
+ var form = new FormData();
+ //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");
+
+
+ const stored_cookie = getCookie('tokenmysypart');
+ form.append("token", stored_cookie);
+ form.append("_id", document_id_to_duplicate);
+
+ if (duplicate_doc_sujet)
+ form.append("sujet", duplicate_doc_sujet);
+ else {
+ alert(" Vous devez definir un sujet");
+ return;
+ }
+
+
+ if (duplicate_doc_nom)
+ form.append("nom", duplicate_doc_nom);
+ else {
+ alert(" Vous devez definir un nom de document");
+ return;
+ }
+
+
+ if (duplicate_doc_type)
+ form.append("type_doc", duplicate_doc_type);
+ else {
+ alert(" Vous devez definir un type de document");
+ return;
+ }
+
+ //console.log(" Duplicate_Partner_Document affectation form == ", form);
+
+
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Duplicate_Given_Partner_Document/";
+
+ axios.post(myurl, form).then(res => {
+ console.log(" In Duplicate_Partner_Document res.data.status = " + res.data.status);
+ console.log(" In Duplicate_Partner_Document res.data.message r_class = " + res.data.message);
+
+ if (String(res.data.status) === String("true")) {
+ setDuplicate_Partner_Document_api("true");
+ setDuplicate_Partner_Document_result(res.data.message);
+ Dialog_duplicate_doc_handleClose_buton();
+
+ alert(res.data.message);
+ clear_one_detail_fields();
+ setadd_one_document();
+ setdisplay_add_one_document();
+ Getall_Partner_Document_No_filter();
+ }
+ else {
+ setDuplicate_Partner_Document_api("false");
+ setDuplicate_Partner_Document_message(res.data.message);
+ alert(res.data.message);
+
+ }
+
+ }).catch((error) => {
+
+ console.log('UpdateStagiaireData : Not good man :( Duplicate_Partner_Document = ' + error);
+ setDuplicate_Partner_Document_api("false");
+ alert(" Impossible de dupliquer le document");
+
+ })
+ }
+
const [Update_one_Partner_Document_api, setUpdate_one_Partner_Document_api] = useState();
const [Update_one_Partner_Document_message, setUpdate_one_Partner_Document_message] = useState();
const [Update_one_Partner_Document_result, setUpdate_one_Partner_Document_result] = useState();
@@ -1240,6 +1337,29 @@ const Config_Documents = (props) => {
}
+
+
+ const [Dialog_duplicate_doc_message, setDialog_duplicate_doc_message] = React.useState(false);
+ const [Dialog_duplicate_doc_open, setDialog_duplicate_doc_open] = React.useState(false);
+ function Dialog_duplicate_doc_handle_change_participant_session(message) {
+ setDialog_duplicate_doc_message(message);
+ setDialog_duplicate_doc_open(true);
+ }
+
+ const Dialog_duplicate_doc_handleClose = () => {
+ //alert(" Utiliser le bouton 'fermer' ");
+ //setOpen(false);
+ };
+
+ const Dialog_duplicate_doc_handleClose_buton = () => {
+ setDialog_duplicate_doc_open(false);
+ };
+
+ const [duplicate_doc_sujet, setduplicate_doc_sujet] = React.useState();
+ const [duplicate_doc_nom, setduplicate_doc_nom] = React.useState();
+ const [duplicate_doc_type, setduplicate_doc_type] = React.useState();
+
+
return (
+
+
Configuration documents
Utilisez les filtres !
@@ -1500,76 +1723,7 @@ const Config_Documents = (props) => {
}
- {/*
- {p_filtre4 &&
-
-
- {
- setp_filtre4(e.target.value)
- }}
- >
-
-
-
-
-
-
-
-
-
- {String(p_filtre4).length > 2 &&
-
setp_filtre2_value(e.target.value)}
- InputProps={{
- endAdornment: (
-
- {
- setp_filtre4_value("");
- }} />
-
- ),
- }}
-
- />}
-
-
-
-
- {String(p_filtre2).length > 2 &&
}
-
-
- }
- */}
@@ -1645,8 +1799,8 @@ const Config_Documents = (props) => {
checkboxSelection
onSelectionModelChange={(newSelectionModel) => {
setSelectionModel(newSelectionModel);
- if (newSelectionModel.length === 1)
- handleClick_display_partner_document(newSelectionModel);
+ /* if (newSelectionModel.length === 1)
+ handleClick_display_partner_document(newSelectionModel);*/
if (newSelectionModel.length !== 1) {
setpartner_document_data_edit_mode();
setpartner_document_data_changed();
@@ -1668,6 +1822,7 @@ const Config_Documents = (props) => {
type_doc: JSON.parse(item).type_doc,
cible: JSON.parse(item).cible,
sujet: JSON.parse(item).sujet,
+ duplicate: JSON.parse(item).duplicate,
}
))}
@@ -1676,6 +1831,12 @@ const Config_Documents = (props) => {
pageSize={10}
className="datagridclass"
+ onRowDoubleClick={(newSelectionModel) => {
+ handleClick_display_partner_document(newSelectionModel.row.id);
+
+
+ }}
+
rowsPerPageOptions={[10]}
//disableSelectionOnClick
components={{
diff --git a/src/components/DisplayPartnerStagiaires.js b/src/components/DisplayPartnerStagiaires.js
index bb7be44..dc4b50a 100644
--- a/src/components/DisplayPartnerStagiaires.js
+++ b/src/components/DisplayPartnerStagiaires.js
@@ -4183,12 +4183,18 @@ const DisplayPartnerStagiaires = (props) => {
};
const Dialog_convention_handleClose_buton = () => {
+
setDialog_convention_open(false);
+ setselected_convention_id();
+ setselected_convention_type();
+ setselected_convention_email_destinataire_prod();
+ setselected_convention_email_test();
+
};
const [selected_convention_id, setselected_convention_id] = useState();
- const [selected_convention_type, setselected_convention_type] = useState("email");
+ 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("");
@@ -4230,6 +4236,120 @@ const DisplayPartnerStagiaires = (props) => {
}
+ 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();
+
+ form.append("class_internal_url", selected_internal_url);
+ const stored_cookie = getCookie('tokenmysypart');
+ form.append("token", stored_cookie);
+ form.append("inscription_id", selected_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);
+
+
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Sent_Convention_Stagiaire_By_Email/";
+
+ axios.post(myurl, form).then(res => {
+
+ if (String(res.data.status) === String("true")) {
+ //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);
+ setSend_Stagiaire_Conventions_By_Email_api("true");
+ setSend_Stagiaire_Conventions_By_Email_result(res.data.message);
+
+ alert(res.data.message);
+ 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);
+ }
+
+ }).catch((error) => {
+ 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("")
+ })
+ }
+
+ function Download_Stagiaire_Conventions_PDF() {
+
+ const stored_cookie = getCookie('tokenmysypart');
+
+ var nom_fichier_cmd = "Convention.pdf";
+
+ var url = process.env.REACT_APP_API_URL + "myclass/api/Download_Convention_Stagiaire_PDF/" + stored_cookie + "/" + selected_id + "/" + selected_convention_id;
+
+ //console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url);
+ 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)
+
+ }
+ }).catch((error) => {
+ setLoading(false);
+ console.error('Error:', error);
+ alert(" Impossible de télécharger la convention ")
+
+ });
+
+ }
+
+ 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();
+
+ form.append("class_internal_url", selected_internal_url);
+ const stored_cookie = getCookie('tokenmysypart');
+ form.append("token", stored_cookie);
+ form.append("inscription_id", selected_id);
+ form.append("courrier_template_id", selected_convention_id);
+ form.append("email_test", selected_convention_email_test);
+ form.append("email_production", "");
+
+
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Sent_Convention_Stagiaire_By_Email/";
+
+ axios.post(myurl, form).then(res => {
+
+ if (String(res.data.status) === String("true")) {
+ //console.log(" In Send_Stagiaire_Conventions_By_Email_Test res.data.status = " + res.data.status);
+ //console.log(" In Send_Stagiaire_Conventions_By_Email_Test res.data.message r_class = " + res.data.message);
+ setSend_Stagiaire_Conventions_By_Email_Test_api("true");
+ setSend_Stagiaire_Conventions_By_Email_Test_result(res.data.message);
+
+ alert(res.data.message);
+ Dialog_convention_handleClose_buton()
+ }
+ else {
+ setSend_Stagiaire_Conventions_By_Email_Test_api("false");
+ setSend_Stagiaire_Conventions_By_Email_Test_message(res.data.message);
+ alert(res.data.message);
+ }
+
+ }).catch((error) => {
+ console.warn('Not good man :( Send_Stagiaire_Conventions_By_Email_Test = ', error);
+ setSend_Stagiaire_Conventions_By_Email_Test_api("false");
+ alert("Impossible d'envoyer la convention par email");
+ //setmyApimyApiMessage("")
+ })
+ }
return (
@@ -4555,7 +4675,7 @@ const DisplayPartnerStagiaires = (props) => {
MySy Information
- Version convention
+
Choisir une convention
{
setselected_convention_id(e.target.value);
var result2 = Get_List_Stagiaire_Conventions_result.filter((local_mymanager) => JSON.parse(local_mymanager)._id === String(e.target.value))
setselected_convention_type(JSON.parse(result2).type_doc);
-
+
}
}
@@ -4611,6 +4731,18 @@ const DisplayPartnerStagiaires = (props) => {
{String(selected_convention_type) === "email" &&
}
@@ -4715,18 +4847,23 @@ const DisplayPartnerStagiaires = (props) => {
- {String(selected_convention_type) === "email" &&
@@ -5794,6 +5931,10 @@ const DisplayPartnerStagiaires = (props) => {