diff --git a/src/components/GestionAdministrative.js b/src/components/GestionAdministrative.js index b28fb8b..5e37129 100644 --- a/src/components/GestionAdministrative.js +++ b/src/components/GestionAdministrative.js @@ -26,7 +26,7 @@ import fileDownload from 'js-file-download' import { ConsoleView } from "react-device-detect"; import { confirmAlert } from 'react-confirm-alert'; import SendIcon from '@mui/icons-material/Send'; - +import { FcViewDetails } from "react-icons/fc"; function GestionAdministrative(props) { @@ -290,16 +290,14 @@ function GestionAdministrative(props) { Display_Detail_Inscription(event, cellValues); }} > - + ); } }, - - - + ] @@ -847,6 +845,7 @@ function GestionAdministrative(props) { useEffect(() => { GetCurrentClass(); GetCurrentClass_trainingsession(); + GetAttestation_Certif(); window.scrollTo(0, 0); @@ -860,6 +859,9 @@ function GestionAdministrative(props) { setsessionChanged(false); clearSessionFields(); + setselectedCertif(); + seturlpreview_certif(); + var tab_date = []; @@ -1014,6 +1016,7 @@ function GestionAdministrative(props) { form.append("session_status", sessionStatus); form.append("date_debut_inscription", format(SessionstartDateInscription, 'dd/MM/yyyy kk:mm:ss')); form.append("date_fin_inscription", format(SessionendDateInscription, 'dd/MM/yyyy kk:mm:ss')); + form.append("attestation_certif", selectedCertif); var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Update_SessionFormation/"; @@ -1059,8 +1062,8 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { if (res.data.status != "false") { - 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.status = " + res.data.status); + //console.log(" In GetCurrentSession res.data.message r_class = " + res.data.message); setGetCurrentSession_api("true"); setGetCurrentSession_result(res.data.message); var mylocaltraining = JSON.parse(res.data.message); @@ -1087,6 +1090,13 @@ function GestionAdministrative(props) { setSessionendDateInscription(date_fin_inscript); } + document.getElementsByName("certif_liste")[0].value = ""; + if (mylocaltraining.attestation_certif) { + + setselectedCertif(mylocaltraining.attestation_certif); + GetSpecificAttestation_Certif(mylocaltraining.attestation_certif); + + } document.getElementsByName("nb_participant")[0].value = ""; @@ -1149,7 +1159,15 @@ function GestionAdministrative(props) { return currentDate.getTime() < selectedDate.getTime(); }; + const [detailuser_date_inscription, setdetailuser_date_inscription] = useState(); + const [detailuser_date_evaluation, setdetailuser_date_evaluation] = useState(); + const [detailuser_date_certification, setdetailuser_date_certification] = useState(); + + + const [SessionstartDateInscription, setSessionstartDateInscription] = useState(); + + const filterPassedTime_start_Inscription = (time) => { const currentDate = new Date(); const selectedDate = new Date(time); @@ -1278,6 +1296,23 @@ function GestionAdministrative(props) { } + const [selectedattendeeemail, setselectedattendeeemail] = useState([]) + function DownloadAttendeeDetail(event) { + + const stored_cookie = getCookie('tokenmysypart'); + + var nom_fiche_detaillee = "Fiche_Detaillee.pdf"; + + var url = process.env.REACT_APP_API_URL + "myclass/api/PrintAttendeeDetail_perSession/" + stored_cookie + "/" + mysession + "/" + selectedattendeeemail; + + + + axios.get(url, { responseType: 'blob', },) + .then((res) => { + fileDownload(res.data, nom_fiche_detaillee) + }) + } + useEffect(() => { desableSessionFields(); setCreateListEmargement_api(); @@ -1566,6 +1601,7 @@ function GestionAdministrative(props) { var montant = String(cellValues.row.amount); var nom = cellValues.row.nom; var email = cellValues.row.email; + setselectedattendeeemail(email); var prenom = cellValues.row.prenom; GetAttendee_Data(email, mysession); } @@ -1588,12 +1624,92 @@ function GestionAdministrative(props) { axios.post(myurl, form).then(res => { 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.status = " + res.data.status); + //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); + + if (mylocalattendee.inscription_validation_date) { + var date_du = new Date(moment(mylocalattendee.inscription_validation_date, "DD/MM/YYYY HH:mm:ss")); + setdetailuser_date_inscription(date_du); + } + + + + document.getElementsByName("detail_nom")[0].value = ""; + if (mylocalattendee.nom) + document.getElementsByName("detail_nom")[0].value = mylocalattendee.nom; + + document.getElementsByName("detail_prenom")[0].value = ""; + if (mylocalattendee.prenom) + document.getElementsByName("detail_prenom")[0].value = mylocalattendee.prenom; + + document.getElementsByName("detail_mail")[0].value = ""; + if (mylocalattendee.email) { + document.getElementsByName("detail_mail")[0].value = mylocalattendee.email; + } + + + document.getElementsByName("detail_tel")[0].value = ""; + if (mylocalattendee.telephone) { + document.getElementsByName("detail_tel")[0].value = mylocalattendee.telephone; + } + + document.getElementsByName("detail_adresse")[0].value = ""; + if (mylocalattendee.adresse) { + document.getElementsByName("detail_adresse")[0].value = mylocalattendee.adresse; + } + + document.getElementsByName("detail_code_postal")[0].value = ""; + if (mylocalattendee.code_postal) { + document.getElementsByName("detail_code_postal")[0].value = mylocalattendee.code_postal; + } + + document.getElementsByName("detail_ville")[0].value = ""; + if (mylocalattendee.ville) { + document.getElementsByName("detail_ville")[0].value = mylocalattendee.ville; + } + + + + document.getElementsByName("detail_cout")[0].value = ""; + if (mylocalattendee.price) { + document.getElementsByName("detail_cout")[0].value = mylocalattendee.price; + } + + + document.getElementsByName("detail_mode_fin")[0].value = ""; + if (mylocalattendee.modefinancement) { + document.getElementsByName("detail_mode_fin")[0].value = mylocalattendee.modefinancement; + } + + + document.getElementsByName("detail_employeur")[0].value = ""; + if (mylocalattendee.employeur) { + document.getElementsByName("detail_employeur")[0].value = mylocalattendee.employeur; + } + + document.getElementsByName("date_evaluation")[0].value = ""; + if (mylocalattendee.date_evaluation) { + + var date_eval = new Date(moment(mylocalattendee.date_evaluation, "DD/MM/YYYY HH:mm:ss")); + setdetailuser_date_evaluation(date_eval); + } + + document.getElementsByName("note_eval")[0].value = ""; + if (mylocalattendee.note_evaluation) { + document.getElementsByName("note_eval")[0].value = mylocalattendee.note_evaluation; + } + + document.getElementsByName("detail_evalution")[0].value = ""; + if (mylocalattendee.evaluation) { + document.getElementsByName("detail_evalution")[0].value = mylocalattendee.evaluation; + } + + + } else { setGetAttendee_api("false"); @@ -1607,6 +1723,94 @@ function GestionAdministrative(props) { }) } + const [selectedCertif, setselectedCertif] = useState(); + const [urlpreview_certif, seturlpreview_certif] = useState(); + function handleChangeselectedCertif(event) { + + var val = event.target.value + console.log(val); + GetSpecificAttestation_Certif(val) + + setselectedCertif(val); + + //seturlpreview_certif(val[1]); + } + + + + const [GetAttestation_Certif_api, setGetAttestation_Certif_api] = useState(); + const [GetAttestation_Certif_message, setGetAttestation_Certif_message] = useState(); + const [GetAttestation_Certif_result, setGetAttestation_Certif_result] = useState(); + function GetAttestation_Certif(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/GetPartnerAttestation_Certificat/"; + + axios.post(myurl, form).then(res => { + + if (res.data.status != "false") { + //console.log(" In GetAttestation_Certif res.data.status = " + res.data.status); + //console.log(" In GetAttestation_Certif res.data.message r_class = " + res.data.message); + setGetAttestation_Certif_api("true"); + setGetAttestation_Certif_result(res.data.message); + } + else { + setGetAttestation_Certif_api("false"); + setGetAttestation_Certif_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetAttestation_Certif = ', error); + setGetAttestation_Certif_api("false"); + + }) + } + + + const [GetSpecificAttestation_Certif_api, setGetSpecificAttestation_Certif_api] = useState(); + const [GetSpecificAttestation_Certif_message, setGetSpecificAttestation_Certif_message] = useState(); + const [GetSpecificAttestation_Certif_result, setGetSpecificAttestation_Certif_result] = useState(); + function GetSpecificAttestation_Certif(nom) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("nom", nom); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/GetSpecificPartnerAttestation_Certificat/"; + + axios.post(myurl, form).then(res => { + + if (res.data.status != "false") { + //console.log(" In GetSpecificAttestation_Certif res.data.status = " + res.data.status); + //console.log(" In GetSpecificAttestation_Certif res.data.message r_class = " + res.data.message); + setGetSpecificAttestation_Certif_api("true"); + setGetSpecificAttestation_Certif_result(res.data.message); + + var mylocal = JSON.parse(res.data.message); + console.log(mylocal); + seturlpreview_certif(mylocal.preview_url); + + + } + else { + setGetSpecificAttestation_Certif_api("false"); + setGetSpecificAttestation_Certif_message(res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( GetSpecificAttestation_Certif = ', error); + setGetSpecificAttestation_Certif_api("false"); + + }) + } + + return (
@@ -1710,8 +1914,6 @@ function GestionAdministrative(props) {
- -
+ + {GetAttestation_Certif_result && + GetAttestation_Certif_result.map((certificat) => ( + + ))} +
+ + +
+ + +
+ +
 
@@ -2295,14 +2517,8 @@ function GestionAdministrative(props) { { - setSessionstartDate(date); - setsessionChanged(true); - } - } - showTimeSelect - filterTime={filterPassedTime_start} + selected={detailuser_date_inscription} + dateFormat="dd/MM/yyyy HH:mm" className="disabled_style" locale='fr-FR' @@ -2373,14 +2589,9 @@ function GestionAdministrative(props) { { - setSessionstartDate(date); - setsessionChanged(true); - } - } - showTimeSelect - filterTime={filterPassedTime_start} + selected={detailuser_date_evaluation} + + dateFormat="dd/MM/yyyy HH:mm" className="disabled_style" locale='fr-FR' @@ -2441,7 +2652,7 @@ function GestionAdministrative(props) {
- @@ -2462,14 +2673,8 @@ function GestionAdministrative(props) { { - setSessionstartDate(date); - setsessionChanged(true); - } - } - showTimeSelect - filterTime={filterPassedTime_start} + selected={detailuser_date_certification} + dateFormat="dd/MM/yyyy HH:mm" className="disabled_style" locale='fr-FR' diff --git a/src/components/Inscription_Information.js b/src/components/Inscription_Information.js index 992b4d2..7443d64 100644 --- a/src/components/Inscription_Information.js +++ b/src/components/Inscription_Information.js @@ -90,7 +90,7 @@ function Inscription_Information(props) { function handleChangeFinancement(event) { setmonfinancement(event.target.value); - }; + }; const [RecordData_api, setRecordData_api] = useState(""); diff --git a/src/styles/components/_gestionadministrative.scss b/src/styles/components/_gestionadministrative.scss index b03fdb3..37c36d3 100644 --- a/src/styles/components/_gestionadministrative.scss +++ b/src/styles/components/_gestionadministrative.scss @@ -178,7 +178,8 @@ height: 2rem !important; margin: 5px !important; } - .css-1x5jdm{ + + .css-1x5jdm { padding: 5px; } @@ -200,11 +201,12 @@ background-color: white; color: #104277 !important; } - .css-1x5jdmq{ + + .css-1x5jdmq { padding: 6px !important; } - - .css-qiwgdb{ + + .css-qiwgdb { padding: 6px !important; } } @@ -389,7 +391,8 @@ height: 2rem !important; margin: 5px !important; } - .css-1x5jdm{ + + .css-1x5jdm { padding: 5px; } @@ -410,11 +413,12 @@ background-color: white; color: #104277 !important; } - .css-1x5jdmq{ + + .css-1x5jdmq { padding: 6px !important; } - - .css-qiwgdb{ + + .css-qiwgdb { padding: 6px !important; } @@ -601,7 +605,7 @@ margin: 5px !important; } - .css-1x5jdm{ + .css-1x5jdm { padding: 5px; } @@ -624,11 +628,11 @@ color: #104277 !important; } - .css-1x5jdmq{ + .css-1x5jdmq { padding: 6px !important; } - .css-qiwgdb{ + .css-qiwgdb { padding: 6px !important; } @@ -814,6 +818,15 @@ height: 2rem !important; margin: 5px !important; } + + .preview_certif{ + display: block; + width: 128px; + height: 128px; + border-radius: 1rem !important; + margin-top: 1rem !important; + } + } .css-1t8l2tu-MuiInputBase-input-MuiOutlinedInput-input:invalid { @@ -840,7 +853,7 @@ margin-right: 5px; } - .css-1x5jdm{ + .css-1x5jdm { padding: 5px; } @@ -861,11 +874,12 @@ background-color: white; color: #104277 !important; } - .css-1x5jdmq{ + + .css-1x5jdmq { padding: 6px !important; } - .css-qiwgdb{ + .css-qiwgdb { padding: 6px !important; }