25/12/22 - 12h30
parent
9952a6b0c4
commit
48aff858b4
|
@ -1,4 +1,4 @@
|
|||
import React, { useState, useEffect, useRef} from "react";
|
||||
import React, { useState, useEffect, useRef } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { getCookie, setCookie } from 'react-use-cookie';
|
||||
import Box from '@mui/material/Box';
|
||||
|
@ -1316,6 +1316,24 @@ function GestionAdministrative(props) {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
function DownloadAttendeeAttestation(event) {
|
||||
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
|
||||
var nom_fiche_detaillee = "Attestation.pdf";
|
||||
|
||||
var url = process.env.REACT_APP_API_URL + "myclass/api/PrintAttendeeCertification/" + stored_cookie + "/" + mysession + "/" + selectedattendeeemail;
|
||||
|
||||
|
||||
|
||||
axios.get(url, { responseType: 'blob', },)
|
||||
.then((res) => {
|
||||
fileDownload(res.data, nom_fiche_detaillee)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
desableSessionFields();
|
||||
setCreateListEmargement_api();
|
||||
|
@ -1628,7 +1646,7 @@ function GestionAdministrative(props) {
|
|||
|
||||
if (res.data.status != "false") {
|
||||
//console.log(" In GetAttendee res.data.status = " + res.data.status);
|
||||
//console.log(" In GetAttendee res.data.message r_class = " + res.data.message);
|
||||
console.log(" In GetAttendee res.data.message r_class = " + res.data.message);
|
||||
setGetAttendee_api("true");
|
||||
setGetAttendee_result(res.data.message);
|
||||
var mylocalattendee = JSON.parse(res.data.message);
|
||||
|
@ -1701,6 +1719,16 @@ function GestionAdministrative(props) {
|
|||
setdetailuser_date_evaluation(date_eval);
|
||||
}
|
||||
|
||||
document.getElementsByName("date_evaluation")[0].value = "";
|
||||
if (mylocalattendee.certification_send_date) {
|
||||
alert(" certification_send_date = ", mylocalattendee.certification_send_date);
|
||||
|
||||
var date_eval = new Date(moment(mylocalattendee.certification_send_date, "DD/MM/YYYY"));
|
||||
setdetailuser_date_certification(date_eval);
|
||||
}
|
||||
|
||||
|
||||
|
||||
document.getElementsByName("note_eval")[0].value = "";
|
||||
if (mylocalattendee.eval_note) {
|
||||
document.getElementsByName("note_eval")[0].value = mylocalattendee.eval_note;
|
||||
|
@ -1821,6 +1849,77 @@ function GestionAdministrative(props) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
const [SendEvaluationEmail_api, setSendEvaluationEmail_api] = useState();
|
||||
const [SendEvaluationEmail_message, setSendEvaluationEmail_message] = useState();
|
||||
const [SendEvaluationEmail_result, setSendEvaluationEmail_result] = useState();
|
||||
function SendEvaluationEmail() {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
form.append("token", stored_cookie);
|
||||
form.append("session_id", mysession);
|
||||
form.append("attendee_email", selectedattendeeemail);
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/SendTrainingEvaluationEmail/";
|
||||
|
||||
axios.post(myurl, form).then(res => {
|
||||
|
||||
if (String(res.data.status) == "true") {
|
||||
console.log(" In SendEvaluationEmail res.data.status = " + res.data.status);
|
||||
console.log(" In SendEvaluationEmail res.data.message r_class = " + res.data.message);
|
||||
setSendEvaluationEmail_api("true");
|
||||
setSendEvaluationEmail_result(res.data.message);
|
||||
|
||||
}
|
||||
else {
|
||||
setSendEvaluationEmail_api("false");
|
||||
setSendEvaluationEmail_message(res.data.message);
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.warn('Not good man :( SendEvaluationEmail = ', error);
|
||||
setSendEvaluationEmail_api("false");
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
const [SendAttendeeAttestation_api, setSendAttendeeAttestation_api] = useState();
|
||||
const [SendAttendeeAttestation_message, setSendAttendeeAttestation_message] = useState();
|
||||
const [SendAttendeeAttestation_result, setSendAttendeeAttestation_result] = useState();
|
||||
function SendAttendeeAttestation() {
|
||||
|
||||
var form = new FormData();
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
form.append("token", stored_cookie);
|
||||
form.append("session_id", mysession);
|
||||
form.append("attendee_email", selectedattendeeemail);
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/SendAttendeeCertification/";
|
||||
|
||||
axios.post(myurl, form).then(res => {
|
||||
|
||||
if (String(res.data.status) == "true") {
|
||||
console.log(" In SendAttendeeAttestation res.data.status = " + res.data.status);
|
||||
console.log(" In SendAttendeeAttestation res.data.message r_class = " + res.data.message);
|
||||
setSendAttendeeAttestation_api("true");
|
||||
setSendAttendeeAttestation_result(res.data.message);
|
||||
|
||||
}
|
||||
else {
|
||||
setSendAttendeeAttestation_api("false");
|
||||
setSendAttendeeAttestation_message(res.data.message);
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.warn('Not good man :( SendAttendeeAttestation = ', error);
|
||||
setSendAttendeeAttestation_api("false");
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='gestionadministrative'>
|
||||
<Helmet>
|
||||
|
@ -2630,7 +2729,7 @@ function GestionAdministrative(props) {
|
|||
onInit={(evt, editor) => editorRef_evaluation.current = editor}
|
||||
initialValue={field_evaluation}
|
||||
onKeyUp={editor_keyup}
|
||||
disabled = {true}
|
||||
disabled={true}
|
||||
|
||||
init={{
|
||||
resize: false,
|
||||
|
@ -2663,15 +2762,22 @@ function GestionAdministrative(props) {
|
|||
|
||||
<div className="div_row_gauche" style={{ "textAlign": 'left', 'marginLeft': '15px' }}>
|
||||
|
||||
{String(SendEvaluationEmail_api) === "false" && <div className="div_row koUpdateData" style={{ "textAlign": "center" }}>
|
||||
{SendEvaluationEmail_message}</div>}
|
||||
|
||||
<Button variant="contained" className="bton_envoyer" onClick={"CreateSessionFormation"}>Envoi demande evaluation
|
||||
|
||||
{String(SendEvaluationEmail_api) === "true" && <div className="div_row okUpdateData" style={{ "textAlign": "center" }}>
|
||||
La demande d'evaluation ete envoyée par emaiil </div>}
|
||||
|
||||
|
||||
<Button variant="contained" className="bton_envoyer" onClick={SendEvaluationEmail}>Envoi demande evaluation
|
||||
</Button>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }}>
|
||||
|
||||
<Button variant="contained" className="bton_fermer" onClick={DownloadAttendeeDetail}>Imprimer fiche detaillee
|
||||
<Button variant="contained" className="bton_fermer" onClick={DownloadAttendeeDetail}>Imprimer fiche detaillée
|
||||
</Button>
|
||||
|
||||
</div>
|
||||
|
@ -2723,14 +2829,24 @@ function GestionAdministrative(props) {
|
|||
<div className="div_row_gauche" style={{ "textAlign": 'left', 'marginLeft': '15px' }}>
|
||||
|
||||
|
||||
{String(SendAttendeeAttestation_api) === "true" &&
|
||||
<div className="div_row okUpdateData" style={{ "textAlign": "center" }}>
|
||||
L'attestation a été bien envoyée par email
|
||||
</div>}
|
||||
|
||||
<Button variant="contained" className="bton_envoyer" onClick={CreateSessionFormation}>Delivrer certificat
|
||||
{String(SendAttendeeAttestation_api) === "false" &&
|
||||
<div className="div_row koUpdateData" style={{ "textAlign": "center" }}>
|
||||
{SendAttendeeAttestation_message}
|
||||
</div>}
|
||||
|
||||
|
||||
<Button variant="contained" className="bton_envoyer" onClick={SendAttendeeAttestation}>Delivrer certificat
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="div_row_droite" style={{ "textAlign": 'right', 'marginRight': '15px' }}>
|
||||
|
||||
<Button variant="contained" className="bton_fermer" onClick={enableSessionFields}>Imprimer certificat
|
||||
<Button variant="contained" className="bton_fermer" onClick={DownloadAttendeeAttestation}>Imprimer certificat
|
||||
</Button>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue