From e53f45f19d92ffe26366325705d67a7508baa93d Mon Sep 17 00:00:00 2001 From: cherif Date: Fri, 17 Feb 2023 14:08:36 +0100 Subject: [PATCH] 17/02/23 - 14h --- src/components/GestionAdministrative.js | 798 +++++++++++++----- .../components/_gestionadministrative.scss | 34 +- 2 files changed, 592 insertions(+), 240 deletions(-) diff --git a/src/components/GestionAdministrative.js b/src/components/GestionAdministrative.js index 33cdd85..0c8e330 100644 --- a/src/components/GestionAdministrative.js +++ b/src/components/GestionAdministrative.js @@ -13,6 +13,8 @@ import MenuItem from '@mui/material/MenuItem'; import { AiOutlineEdit } from "react-icons/ai"; import { FcCancel, FcApproval, FcAcceptDatabase, FcPrint } from "react-icons/fc"; import { DataGrid, GridToolbar, frFR, GridCellParams } from '@mui/x-data-grid'; +import { AiFillFolderOpen, AiFillMinusSquare } from "react-icons/ai"; + import Popup from 'reactjs-popup'; import 'reactjs-popup/dist/index.css'; import DatePicker from "react-datepicker"; @@ -400,6 +402,70 @@ function GestionAdministrative(props) { form.append("date", date); form.append("matin", matin_val); form.append("apresmidi", apresmidi_val); + form.append("class_internal_url", internal_url); + + //console.log(" ## form = ", form); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/UpdateUserEmargementDate/"; + axios.post(myurl, form).then(res => { + + if (String(res.data.status) !== "false") { + //console.log(" In UpdateStagiaireData res.data.status = " + res.data.status); + //console.log(" In UpdateStagiaireData res.data.message r_class = " + res.data.message); + setUpdateStagiaireEmargement_api("true"); + setUpdateStagiaireEmargement_result(res.data.message); + GetListeEmargement(mysession); + } + else { + setUpdateStagiaireEmargement_api("false"); + setUpdateStagiaireEmargement_message(res.data.message); + + } + + }).catch((error) => { + + console.warn('handleClick_valide_emargement : Not good man :( mysearchtext = ' + error); + setUpdateStagiaireEmargement_api("false"); + + }) + + } + + + function handleClick_valide_emargement_One(tab_data) { + + var date = tab_data.date; + var email = tab_data.email; + var matin = tab_data.matin; + var matin_val = ""; + var apresmidi = tab_data.apresmidi; + var apresmidi_val = ""; + + if (matin === true) { + matin_val = "1" + } else if (matin === false) { + matin_val = "0" + } + + if (apresmidi === true) { + apresmidi_val = "1" + } else if (apresmidi === false) { + apresmidi_val = "0" + } + /*console.log(" ### date , email, matin,matin_val, apresmidi, apresmidi_val = ", + date, email, matin, matin_val, apresmidi, apresmidi_val);*/ + + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("session_id", mysession); + form.append("email", email); + form.append("date", date); + form.append("matin", matin_val); + form.append("apresmidi", apresmidi_val); + form.append("class_internal_url", internal_url); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/UpdateUserEmargementDate/"; @@ -493,6 +559,7 @@ function GestionAdministrative(props) { } var status = "0"; + var employeur = cellValues.row.employeur; if (String(employeur) === "undefined") { employeur = "" @@ -1707,7 +1774,7 @@ function GestionAdministrative(props) { var nom_fiche_detaillee = "Fiche_Detaillee.pdf"; - var url = process.env.REACT_APP_API_URL + "myclass/api/PrintAttendeeDetail_perSession/" + stored_cookie + "/" + mysession + "/" + selectedattendeeemail+ "/" + internal_url; + var url = process.env.REACT_APP_API_URL + "myclass/api/PrintAttendeeDetail_perSession/" + stored_cookie + "/" + mysession + "/" + selectedattendeeemail + "/" + internal_url; axios.get(url, { responseType: 'blob', },) @@ -1741,7 +1808,7 @@ function GestionAdministrative(props) { var nom_fiche_detaillee = "Fiche_Detaillee.pdf"; - var url = process.env.REACT_APP_API_URL + "myclass/api/PrintAttendeeDetail_perSession/" + stored_cookie + "/" + mysession + "/" + addendeeEmail+ "/" + internal_url; + var url = process.env.REACT_APP_API_URL + "myclass/api/PrintAttendeeDetail_perSession/" + stored_cookie + "/" + mysession + "/" + addendeeEmail + "/" + internal_url; axios.get(url, { responseType: 'blob', },) @@ -2343,6 +2410,41 @@ function GestionAdministrative(props) { form.append("token", stored_cookie); form.append("session_id", mysession); form.append("attendee_email", selectedattendeeemail); + form.append("class_internal_url", internal_url); + + + 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"); + + }) + } + + function SendEvaluationEmail_One(email) { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("session_id", mysession); + form.append("attendee_email", email); + form.append("class_internal_url", internal_url); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/SendTrainingEvaluationEmail/"; @@ -2453,7 +2555,7 @@ function GestionAdministrative(props) { } const [retval_ch, setretval_ch] = useState(); - function actionmass_preinsc_Traitemet() { + async function actionmass_preinsc_Traitemet() { var liste_formation = GetSelectedRows_PresInsc_Ids(); for (var i = 0; i < liste_formation.length; i++) { @@ -2510,6 +2612,7 @@ function GestionAdministrative(props) { } //console.log(" retval de ", email + " = retval_ch =", retval_ch); + await sleep(100); } setSelectionModel([]); setactionmass_preinsc_val(); @@ -2543,16 +2646,16 @@ function GestionAdministrative(props) { } - function actionmass_insc_Traitemet() { + async function actionmass_insc_Traitemet() { var liste_formation = GetSelectedRows_Insc_Ids(); for (var i = 0; i < liste_formation.length; i++) { - + var line = JSON.parse(rowss_insc[i]); console.log(" line = ", line); var email = line.email; console.log(" Traitement de email = ", email); - if (String(actionmass_insc_val) === "confirmation") { + if (String(actionmass_insc_val) === "confirmation") { SendInscriptionConfirmation(email); } else if (String(actionmass_insc_val) === "impression") { @@ -2561,6 +2664,7 @@ function GestionAdministrative(props) { DownloadAttendeeDetail_one(email); } + await sleep(100); } @@ -2568,6 +2672,109 @@ function GestionAdministrative(props) { setactionmass_insc_val(); } + const [actionmass_emarg_val, setactionmass_emarg_val] = useState(); + const actionmass_emarg = (event) => { + const value = event.target.value; + + + if (String(value) === "valider" || String(value) === "demande emargement") { + setactionmass_emarg_val(value); + } + else { + setactionmass_emarg_val(); + } + } + + function GetSelectedRows_Emarg_Ids() { + + var tab_tmp = [] + for (var i = 0; i < selectionModel_emarg.length; i++) { + var myid = parseInt(String(selectionModel_emarg[i])); + //var line = JSON.parse(rowss[myid]); + tab_tmp.push(myid); + } + return tab_tmp; + + } + + async function actionmass_emarge_Traitemet() { + var liste_formation = GetSelectedRows_Emarg_Ids(); + for (var i = 0; i < liste_formation.length; i++) { + var line = JSON.parse(rowss_emarg[i]); + //console.log(" line = ", line); + var email = line.email; + //console.log(" Traitement de email = ", email); + + if (String(actionmass_emarg_val) === "demande emargement") { + ActionMassListEmargement(); + } + await sleep(100) + } + setSelectionModel_emarg([]); + actionmass_emarg_val(); + } + + + const [actionmass_eval_val, setactionmass_eval_val] = useState(); + const actionmass_evaluation = (event) => { + const value = event.target.value; + + console.log(" ### actionmass_evaluation = ", value); + + if (String(value) === "demande evaluation") { + setactionmass_eval_val(value); + console.log(" ### LAAA = ", value); + } + + else { + setactionmass_eval_val(); + } + } + + function GetSelectedRows_Evaluation_Ids() { + + var tab_tmp = [] + for (var i = 0; i < selectionModel_evaluation.length; i++) { + var myid = parseInt(String(selectionModel_evaluation[i])); + //var line = JSON.parse(rowss[myid]); + tab_tmp.push(myid); + } + return tab_tmp; + + } + + const sleep = (milliseconds) => { + return new Promise(resolve => setTimeout(resolve, milliseconds)) + } + + async function actionmass_Evaluation_Traitemet() { + var liste_formation = GetSelectedRows_Evaluation_Ids(); + for (var i = 0; i < liste_formation.length; i++) { + var line = JSON.parse(rowss_evaluation[i]); + //console.log(" line = ", line); + var email = line.email; + + if (String(actionmass_eval_val) === "demande evaluation") { + + SendEvaluationEmail_One(email); + } + await sleep(100) + } + setSelectionModel_evaluation([]); + setactionmass_eval_val(); + } + + const [reduction_session, setreduction_session] = useState("0"); + function Session_small() { + if (String(reduction_session) === "1") { + setreduction_session("0"); + } + else if (String(reduction_session) === "0") { + setreduction_session("1"); + } + + } + return (
@@ -2709,9 +2916,6 @@ function GestionAdministrative(props) { ))} - - -
@@ -2720,6 +2924,16 @@ function GestionAdministrative(props) {
+ {mysession && String(reduction_session) === "0" &&
+
Reduire la fenetre
+
+ } + + {mysession && String(reduction_session) === "1" &&
+
Ouvrir la fenetre
+
+ } + {mysession &&
@@ -2823,240 +3037,237 @@ function GestionAdministrative(props) {
- -
Adresse
- -
-
Code postal
- -
-
Ville
- -
- -
Formateur
- -
- -
Nombre participants *
- -
- -
Prix session
- -
- - -
-
Date Debut des inscriptions * - +
Adresse
+ { - setSessionstartDateInscription(date); - setsessionChanged(true); - } + name="adresse" + id="adresse" - } - showTimeSelect - //filterTime={filterPassedTime_start} - dateFormat="dd/MM/yyyy HH:mm" - className="disabled_style" - locale='fr-FR' - - /> -
- - -
Date Fin des inscriptions * - { - setSessionendDateInscription(date); - setsessionChanged(true); - } - } - showTimeSelect - //filterTime={filterPassedTime_end} - dateFormat="dd/MM/yyyy HH:mm" - className="disabled_style" - /> -
-
- - -
- {!fields1desabled &&
Choisir un modèle d'attestation : - - - - -
} - {fields1desabled &&
Le modèle d'attestation : - - - -
} - -
Contenu de la formation (max 800 caractères)
- (à afficher sur l'attestation) - {!fields1desabled &&
} - {!fields1desabled &&
} - - editorRef_contenu_ftion.current = editor} - initialValue={field_contenu_ftion} - onKeyUp={editor_contenu_ftion_keyup} - disabled={fields1desabled} - - init={{ - resize: false, - - height: 200, - menubar: false, - plugins: [ - 'advlist autolink lists link image charmap print preview anchor', - 'searchreplace visualblocks code fullscreen', - 'insertdatetime media table paste code help wordcount' - ], - toolbar: false, - content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:12px; }' + InputLabelProps={{ + shrink: true, }} + disabled={false} + className="disabled_style" + />
-
+
Code postal
+ -   -
+ /> +
+
Ville
+ - /!\ Pensez à enregistrer les modifications -
} - - {!sessionChanged && String(CreateSessionFormation_api) === "true" && -
- La session de formation à été bien mise à jour. -
} - - {String(CreateSessionFormation_api) === "false" && -
- {CreateSessionFormation_message} -
} - - - {
- -
- - {sessionChanged && mysession && - } + />
-
- {!sessionChanged && mysession && fields1desabled && - } - - {((sessionChanged && mysession) || !fields1desabled) && - } - - +
Formateur
+
+
Nombre participants *
+ +
+ +
Prix session
+ +
+ + +
+
Date Debut des inscriptions * + { + setSessionstartDateInscription(date); + setsessionChanged(true); + } + + } + showTimeSelect + //filterTime={filterPassedTime_start} + dateFormat="dd/MM/yyyy HH:mm" + className="disabled_style" + locale='fr-FR' + + /> +
+ + +
Date Fin des inscriptions * + { + setSessionendDateInscription(date); + setsessionChanged(true); + } + } + showTimeSelect + //filterTime={filterPassedTime_end} + dateFormat="dd/MM/yyyy HH:mm" + className="disabled_style" + /> +
+
+ + +
+ {!fields1desabled &&
Choisir un modèle d'attestation : + + + + +
} + {fields1desabled &&
Le modèle d'attestation : + + + +
} + +
Contenu de la formation (max 800 caractères)
+ (à afficher sur l'attestation) + {!fields1desabled &&
} + {!fields1desabled &&
} + + editorRef_contenu_ftion.current = editor} + initialValue={field_contenu_ftion} + onKeyUp={editor_contenu_ftion_keyup} + disabled={fields1desabled} + + init={{ + resize: false, + + height: 200, + menubar: false, + plugins: [ + 'advlist autolink lists link image charmap print preview anchor', + 'searchreplace visualblocks code fullscreen', + 'insertdatetime media table paste code help wordcount' + ], + toolbar: false, + content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:12px; }' + }} + /> +
+
+ + +
+   +
+ + + {sessionChanged &&
+ /!\ Pensez à enregistrer les modifications +
} + + {!sessionChanged && String(CreateSessionFormation_api) === "true" && +
+ La session de formation à été bien mise à jour. +
} + + {String(CreateSessionFormation_api) === "false" && +
+ {CreateSessionFormation_message} +
} + + + {
+ +
+ + {sessionChanged && mysession && + } +
+ +
+ {!sessionChanged && mysession && fields1desabled && + } + + {((sessionChanged && mysession) || !fields1desabled) && + } + +
+ +
} +
} - -
@@ -3124,7 +3335,7 @@ function GestionAdministrative(props) { {selectionModel && selectionModel.length >= 1 &&
-
+
  + {selectionModel_emarg && selectionModel_emarg.length >= 1 && +
+ +     + + {actionmass_emarg_val && + + Traiter + + } + modal + nested + position="center center" + > + + {close => ( +
+ +
MySy Information
+
+ {' '} + + Confirmer l'action {actionmass_emarg_val} en masse. +
+
+
+ + +
+
+ +
+
+
+ )} +
+ } +
+ + +
+ }
-
- + {/*
+*/}
@@ -3432,6 +3705,69 @@ function GestionAdministrative(props) { /> + {selectionModel_evaluation && selectionModel_evaluation.length >= 1 && +
+ +     + + {actionmass_eval_val && + + Traiter + + } + modal + nested + position="center center" + > + + {close => ( +
+ +
MySy Information
+
+ {' '} + + Confirmer l'action {actionmass_eval_val} en masse. +
+
+
+ + +
+
+ +
+
+
+ )} +
+ } +
+ + +
+ }
diff --git a/src/styles/components/_gestionadministrative.scss b/src/styles/components/_gestionadministrative.scss index dd610e2..e462920 100644 --- a/src/styles/components/_gestionadministrative.scss +++ b/src/styles/components/_gestionadministrative.scss @@ -211,7 +211,7 @@ padding: 6px !important; } - .preview_certif{ + .preview_certif { display: block; width: 90%; height: 180px; @@ -432,8 +432,8 @@ .css-qiwgdb { padding: 6px !important; } - - .preview_certif{ + + .preview_certif { display: block; width: 90%; height: 200px; @@ -660,13 +660,14 @@ padding: 6px !important; } - .preview_certif{ + .preview_certif { display: block; width: 90%; height: 180px; border-radius: 1rem !important; margin-top: 1rem !important; } + .preview_certif:hover { transform: scale(2); margin-left: 5rem; @@ -692,7 +693,7 @@ //border: 1px solid black; border-width: 0.01rem; width: 100%; - margin-bottom: 1rem; + //margin-bottom: 1rem; border-radius: 1rem; } @@ -772,7 +773,7 @@ .detail_class_submenu:hover { background-color: #104277; color: white; - } + } .detail_class_submenu:focus { //border: 3px dotted green; @@ -856,7 +857,7 @@ margin: 5px !important; } - .preview_certif{ + .preview_certif { display: block; width: 90%; height: 200px; @@ -879,6 +880,21 @@ height: 2.5rem; } + + + .block_en_mass { + width: 50%; + float: left; + margin-bottom: 1rem; + } + + .session_open_close { + cursor: pointer; + text-align: right; + font-size: small; + margin-right: 10px; + } + } // end media @@ -930,7 +946,7 @@ margin-left: 5%; height: 2.5rem; color: white; - + } .bton_fermer { @@ -953,6 +969,6 @@ } -.tox-statusbar{ +.tox-statusbar { display: none !important; } \ No newline at end of file