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,15 +1719,25 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (mylocalattendee.eval_eval) {
|
||||
setfield_evaluation(mylocalattendee.eval_eval);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1818,8 +1846,79 @@ function GestionAdministrative(props) {
|
|||
const editorRef_evaluation = useRef(null);
|
||||
const [field_evaluation, setfield_evaluation] = useState("");
|
||||
function editor_keyup() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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'>
|
||||
|
@ -2603,7 +2702,7 @@ function GestionAdministrative(props) {
|
|||
dateFormat="dd/MM/yyyy HH:mm"
|
||||
className="disabled_style"
|
||||
locale='fr-FR'
|
||||
|
||||
|
||||
|
||||
/>
|
||||
</div>
|
||||
|
@ -2614,13 +2713,13 @@ function GestionAdministrative(props) {
|
|||
name="note_eval"
|
||||
id="note_eval"
|
||||
type="number"
|
||||
|
||||
|
||||
|
||||
|
||||
InputLabelProps={{
|
||||
shrink: true,
|
||||
}}
|
||||
inputProps={{ min: "0", max: "5", step: "1", readOnly: true, }}
|
||||
|
||||
inputProps={{ min: "0", max: "5", step: "1", readOnly: true, }}
|
||||
|
||||
className="disabled_style"
|
||||
/>
|
||||
</div>
|
||||
|
@ -2630,11 +2729,11 @@ function GestionAdministrative(props) {
|
|||
onInit={(evt, editor) => editorRef_evaluation.current = editor}
|
||||
initialValue={field_evaluation}
|
||||
onKeyUp={editor_keyup}
|
||||
disabled = {true}
|
||||
disabled={true}
|
||||
|
||||
init={{
|
||||
resize: false,
|
||||
|
||||
|
||||
height: 100,
|
||||
menubar: false,
|
||||
plugins: [
|
||||
|
@ -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