04/12/2023 - 21h
parent
ddb2d4fea0
commit
746835e6a6
|
@ -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 (
|
||||
<nav>
|
||||
{cellValues.row.duplicate && String(cellValues.row.duplicate) === "1" &&
|
||||
|
||||
<Button
|
||||
<Button style={{ "color": "green" }} onClick={(e) => {
|
||||
|
||||
onClick={(event) => {
|
||||
Display_Detail_Document(event, cellValues);
|
||||
}}
|
||||
>
|
||||
<FcViewDetails />
|
||||
setduplicate_doc_sujet();
|
||||
setduplicate_doc_nom();
|
||||
setduplicate_doc_type();
|
||||
|
||||
</Button>
|
||||
setDialog_duplicate_doc_open(true);
|
||||
|
||||
setdocument_id_to_duplicate(cellValues.row._id);
|
||||
|
||||
|
||||
}}>
|
||||
<HiOutlineDocumentDuplicate /> Dupliquer
|
||||
|
||||
</Button>
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</nav>
|
||||
)
|
||||
|
||||
);
|
||||
}
|
||||
},*/
|
||||
},
|
||||
|
||||
|
||||
|
||||
/* {
|
||||
field: "Dupliquer", headerName: 'Dupliquer',
|
||||
renderCell: (cellValues) => {
|
||||
return (
|
||||
|
||||
<Button
|
||||
|
||||
onClick={(event) => {
|
||||
Display_Detail_Document(event, cellValues);
|
||||
}}
|
||||
>
|
||||
<FcViewDetails />
|
||||
|
||||
</Button>
|
||||
|
||||
);
|
||||
}
|
||||
},*/
|
||||
{
|
||||
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 (
|
||||
<div className="config_document">
|
||||
<Dialog
|
||||
|
@ -1262,6 +1382,109 @@ const Config_Documents = (props) => {
|
|||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
<Dialog
|
||||
open={Dialog_duplicate_doc_open}
|
||||
onClose={Dialog_duplicate_doc_handleClose}
|
||||
className="displaypartnersession"
|
||||
>
|
||||
|
||||
<DialogTitle>MySy Information</DialogTitle>
|
||||
<DialogContent className="DialogContent_width">
|
||||
|
||||
<div className="session_caract_Dialog" > Type Document
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
|
||||
name="duplicate_type_doc"
|
||||
id="duplicate_type_doc"
|
||||
|
||||
select
|
||||
fullWidth
|
||||
|
||||
value={duplicate_doc_type}
|
||||
onChange={(e) => {
|
||||
setduplicate_doc_type(e.target.value);
|
||||
}
|
||||
}
|
||||
|
||||
>
|
||||
<MenuItem value="email" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Email </MenuItem>
|
||||
<MenuItem value="pdf" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >PDF </MenuItem>
|
||||
|
||||
</TextField>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div className="session_caract_Dialog" > Nom Document<br />
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 } }}
|
||||
|
||||
name="duplicate_nom_doc"
|
||||
id="duplicate_nom_doc"
|
||||
|
||||
fullWidth
|
||||
value={duplicate_doc_nom}
|
||||
onChange={(e) => {
|
||||
setduplicate_doc_nom(e.target.value);
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div className="session_caract_Dialog" > Sujet Document<br />
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 } }}
|
||||
|
||||
name="duplicate_nom_doc"
|
||||
id="duplicate_nom_doc"
|
||||
fullWidth
|
||||
value={duplicate_doc_sujet}
|
||||
onChange={(e) => {
|
||||
setduplicate_doc_sujet(e.target.value);
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</DialogContent>
|
||||
|
||||
|
||||
|
||||
<DialogActions>
|
||||
<div className="div_row">
|
||||
<div className="div_row_gauche">
|
||||
<Button onClick={(e) => {
|
||||
if (String(duplicate_doc_nom).length > 2 && String(duplicate_doc_type).length > 2 && String(duplicate_doc_sujet).length > 10) {
|
||||
const response = window.confirm(" Vous allez créer un nouveau document. Continuer ?");
|
||||
if (!response) {
|
||||
return;
|
||||
}
|
||||
|
||||
Duplicate_Partner_Document();
|
||||
|
||||
}
|
||||
else {
|
||||
alert(" Vous devez les champs : Nom, Type et Sujet");
|
||||
}
|
||||
}}
|
||||
className="bton_enreg_dialog">Dupliquer</Button>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="div_row_droite" style={{ "textAlign": 'center' }}>
|
||||
<Button onClick={Dialog_duplicate_doc_handleClose_buton} className="bton_annule_dialog" >Fermer</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</DialogActions>
|
||||
|
||||
</Dialog>
|
||||
|
||||
<h3> Configuration documents </h3>
|
||||
<div className="div_row">
|
||||
<div className="titre1"> Utilisez les filtres !</div>
|
||||
|
@ -1500,76 +1723,7 @@ const Config_Documents = (props) => {
|
|||
</div>
|
||||
}
|
||||
|
||||
{/*
|
||||
{p_filtre4 &&
|
||||
<div className="div_row" style={{ "marginBottom": "5px" }}>
|
||||
<div className="div_row_gauche texte_area_filter">
|
||||
<TextField
|
||||
name="filtre4"
|
||||
label="Choisir un champ"
|
||||
select
|
||||
sx={{ m: 1, width: '100%' }}
|
||||
|
||||
value={p_filtre4}
|
||||
onChange={(e) => {
|
||||
setp_filtre4(e.target.value)
|
||||
}}
|
||||
>
|
||||
<MenuItem value="email" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Email </MenuItem>
|
||||
<MenuItem value="nom" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Nom </MenuItem>
|
||||
<MenuItem value="code_session" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Code Session </MenuItem>
|
||||
<MenuItem value="class_title" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }} >Titre Formation </MenuItem>
|
||||
|
||||
|
||||
</TextField>
|
||||
</div>
|
||||
<div className="div_row_droite texte_area_filter_value" style={{ "marginTop": "0.5rem" }}>
|
||||
{String(p_filtre4).length > 2 &&
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
required
|
||||
name="filtre4_value"
|
||||
id="filtre4_value"
|
||||
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
disabled={false}
|
||||
className="disabled_style"
|
||||
value={p_filtre4_value}
|
||||
onChange={(e) => setp_filtre2_value(e.target.value)}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
<AiFillCloseCircle
|
||||
style={{ 'cursor': "pointer", "color": "orangered" }}
|
||||
onClick={(e) => {
|
||||
setp_filtre4_value("");
|
||||
}} />
|
||||
</InputAdornment>
|
||||
),
|
||||
}}
|
||||
|
||||
/>}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{String(p_filtre2).length > 2 && <div className='filter_bton_add'>
|
||||
<Tooltip id="my-tooltip04" style={{ "fontSize": "12px" }} />
|
||||
<a data-tooltip-id="my-tooltip04" data-tooltip-content="Supprimer cette ligne de filtre">
|
||||
<MdRemoveCircleOutline
|
||||
onClick={(e) => {
|
||||
setp_filtre4();
|
||||
setp_filtre4_value();
|
||||
}}
|
||||
/>
|
||||
</a>
|
||||
</div>}
|
||||
|
||||
</div>
|
||||
}
|
||||
*/}
|
||||
<div className="div_row" ref={myRef_head} id="myRef_head" style={{ "border": "None", "color": "orange", "textAlign": "center" }}>
|
||||
|
||||
<div className="div_row_gauche" style={{ "textAlign": 'left', 'marginLeft': '15px' }}>
|
||||
|
@ -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={{
|
||||
|
|
|
@ -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 (
|
||||
<div className="displaypartnerstagiaire">
|
||||
|
@ -4555,7 +4675,7 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
<DialogTitle>MySy Information</DialogTitle>
|
||||
<DialogContent className="DialogContent_width">
|
||||
|
||||
<div className="session_caract_Dialog" > Version convention
|
||||
<div className="session_caract_Dialog" > Choisir une convention
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
|
||||
|
@ -4570,7 +4690,7 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
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) => {
|
|||
</TextField>
|
||||
{String(selected_convention_type) === "email" && <label className="bton_image_class" style={{ "width": "20%", "float": "right", "height": "3.5rem", "paddingTop": "15px" }} onClick={(e) => {
|
||||
|
||||
if (selected_convention_email_test) {
|
||||
var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
|
||||
if (!selected_convention_email_test.match(validRegex)) {
|
||||
alert("L'adresse email de test est invalide.");
|
||||
return;
|
||||
}
|
||||
Send_Stagiaire_Conventions_By_Email_Test();
|
||||
}else{
|
||||
alert("L'adresse email de test est invalide.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}} > <FcSearch /> Test</label>}
|
||||
|
||||
|
@ -4715,18 +4847,23 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
<DialogActions>
|
||||
<div className="div_row">
|
||||
<div className="div_row_gauche">
|
||||
{String(selected_convention_type) === "email" && <Button onChange={(e) => {
|
||||
{String(selected_convention_type) === "email" && <Button onClick={(e) => {
|
||||
if (String(selected_convention_email_test).length > 2) {
|
||||
const response = window.confirm(" Vous allez envoyer le convention au destinaitaire final. Continuer ?");
|
||||
if (!response) {
|
||||
return;
|
||||
}
|
||||
alert(" Ok envoyé");
|
||||
Send_Stagiaire_Conventions_By_Email();
|
||||
Dialog_convention_handleClose_buton();
|
||||
}
|
||||
}}
|
||||
className="bton_enreg_dialog">Envoyer</Button>}
|
||||
{String(selected_convention_type) === "pdf" && <Button onClick={"Add_One_Sequence_Session_Ressource"} className="bton_enreg_dialog">Télécharger</Button>}
|
||||
{String(selected_convention_type) === "pdf" &&
|
||||
<Button className="bton_enreg_dialog" onClick={(e) => {
|
||||
Download_Stagiaire_Conventions_PDF();
|
||||
Dialog_convention_handleClose_buton();
|
||||
}}
|
||||
>Télécharger</Button>}
|
||||
</div>
|
||||
|
||||
<div className="div_row_droite" style={{ "textAlign": 'center' }}>
|
||||
|
@ -5794,6 +5931,10 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
|
||||
<label className="bton_image_class" onClick={(e) => {
|
||||
Get_List_Stagiaire_Conventions();
|
||||
setselected_convention_id();
|
||||
setselected_convention_type();
|
||||
setselected_convention_email_destinataire_prod();
|
||||
setselected_convention_email_test();
|
||||
setDialog_convention_open(true);
|
||||
}} >Editer une convention</label><br />
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue