diff --git a/src/components/DisplayPartnerStagiaires.js b/src/components/DisplayPartnerStagiaires.js
index 110e5e3..2abdb48 100644
--- a/src/components/DisplayPartnerStagiaires.js
+++ b/src/components/DisplayPartnerStagiaires.js
@@ -56,6 +56,7 @@ import { IoAddCircleOutline, IoCloseCircleOutline } from "react-icons/io5";
import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
import CheckBoxIcon from '@mui/icons-material/CheckBox';
import Checkbox from '@mui/material/Checkbox';
+import Module_Email_Management from "./Module_Email_Management";
const DisplayPartnerStagiaires = (props) => {
const history = useHistory();
@@ -5339,6 +5340,9 @@ const DisplayPartnerStagiaires = (props) => {
var liste_session = GetSelectedRowsSession();
setliste_selected_inscription_id(liste_session);
+ var liste_emails = GetSelectedRows_Emails();
+ setselectedtraining_emails(liste_session);
+
//console.log(" liste_formation = ", liste_formation);
//console.log(" actionmass_ftion_val = ", actionmass_ftion_val);
@@ -5366,7 +5370,10 @@ const DisplayPartnerStagiaires = (props) => {
}
else if (String(actionmass_ftion_val) === String("recyclage_disable")) {
Recyclage_Desactivation(liste_session);
-
+ }
+ else if (String(actionmass_ftion_val) === String("sendemail")) {
+ // console.log(" #### selectedtraining_emails_liste = ", selectedtraining_emails_liste);
+ setDialog_SEND_EMAIL_open(true);
}
}
@@ -5417,6 +5424,24 @@ const DisplayPartnerStagiaires = (props) => {
}
+
+ const [selectedtraining_emails, setselectedtraining_emails] = useState([])
+ const [selectedtraining_emails_liste, setselectedtraining_emails_liste] = useState("")
+ function GetSelectedRows_Emails() {
+
+ var tab_tmp = []
+ for (var i = 0; i < selectionModel.length; i++) {
+ var myid = parseInt(String(selectionModel[i]));
+ var line = JSON.parse(rowss[myid]);
+ tab_tmp.push(line.email);
+ //console.log(rowss[myid]['external_code']);
+ }
+ setselectedtraining_emails(tab_tmp);
+
+ setselectedtraining_emails_liste(tab_tmp.join());
+ return tab_tmp;
+ }
+
const [Delete_LIST_Stagiaires_api, setDelete_LIST_Stagiaires_api] = useState();
const [Delete_LIST_Stagiaires_message, setDelete_LIST_Stagiaires_message] = useState();
const [Delete_LIST_Stagiaires_result, setDelete_LIST_Stagiaires_result] = useState();
@@ -6280,6 +6305,7 @@ const DisplayPartnerStagiaires = (props) => {
{ "id": "1", "label": "Supprimer", "value": "supprimer" },
{ "id": "2", "label": "Exporter", "value": "exporter" },
{ "id": "3", "label": "Desactiver Recyclage", "value": "recyclage_disable" },
+ { "id": "4", "label": "Rédiger un Email", "value": "sendemail" },
]
@@ -6432,12 +6458,60 @@ const DisplayPartnerStagiaires = (props) => {
}
+
+ const [Dialog_SEND_EMAIL_open, setDialog_SEND_EMAIL_open] = React.useState(false);
+
+
+ const Dialog_SEND_EMAIL_handleClose = () => {
+ setDialog_SEND_EMAIL_open(false);
+ }
+
+ const Clean_Selected_Rows_For_Email = () => {
+ setSelectionModel([])
+ }
+
+
+
return (
{isLoading &&
}
+
+
+ { /********* Dialog redaction email */}
+
+ { /********* Fin Dialog redaction email */}
+
+
+
{ /**** Dialog info stagiaire */}
diff --git a/src/components/Module_Editique.js b/src/components/Module_Editique.js
index e63b604..376ba7d 100644
--- a/src/components/Module_Editique.js
+++ b/src/components/Module_Editique.js
@@ -780,7 +780,7 @@ const Module_Editique = (props) => {
settab_convention_pieces_jointes_result(new_tmp);
- console.log(" tab_convention_pieces_jointes_result = ", tab_convention_pieces_jointes_result)
+ //console.log(" tab_convention_pieces_jointes_result = ", tab_convention_pieces_jointes_result)
return;
};
@@ -952,7 +952,7 @@ const Module_Editique = (props) => {
let new_myArray = myArray.filter(file => file.name !== String(doc_to_del_name));
- console.log(" new_myArray = ", new_myArray);
+ //console.log(" new_myArray = ", new_myArray);
var new_tab = []
diff --git a/src/components/Module_Email_Management.js b/src/components/Module_Email_Management.js
index 5a50479..04daad4 100644
--- a/src/components/Module_Email_Management.js
+++ b/src/components/Module_Email_Management.js
@@ -45,10 +45,10 @@ import daygridPlugin from "@fullcalendar/daygrid";
//import timeGridPlugin from "@fullcalendar/timegrid";
import allLocales from '@fullcalendar/core/locales-all'
-import { RepeatOnRounded } from "@mui/icons-material";
+import { RepeatOnRounded, ResetTvRounded, RestaurantMenu } from "@mui/icons-material";
import { alignPropType } from "react-bootstrap/esm/types";
-
+import AttachFileIcon from '@mui/icons-material/AttachFile';
import ToggleSwitch from "./ToggleSwitch";
import ToggleSwitch_v2_mysy from "./ToggleSwitch_v2_mysy";
import ToggleSwitch_v3_mysy from "./ToggleSwitch_v3_mysy";
@@ -97,7 +97,13 @@ const Module_Email_Management = (props) => {
};
const Dialog_1_handleClose_buton = () => {
+ settab_email_pieces_jointes_result([]);
setselected_courrier_template_id("");
+ setemail_destinataire("");
+ setemail_cc("");
+ setemail_bcc("");
+ settab_email_pieces_jointes_result([]);
+
setDialog_1_open(false);
};
@@ -385,18 +391,112 @@ const Module_Email_Management = (props) => {
})
}
+
+ const [Send_Front_Email_api, setSend_Front_Email_api] = useState();
+ const [Send_Front_Email_message, setSend_Front_Email_message] = useState();
+ const [Send_Front_Email_result, setSend_Front_Email_result] = useState();
+ function Send_Front_Email() {
+
+
+ /*
+
+ /!\ : Pour eviter les spams, ce module ne doit pas envoyer plus de 20 email à la fois
+ */
+
+ const tab_destinataire = email_destinataire.split(',');
+ if (tab_destinataire.length > 20) {
+ alert(" Vous ne pouvez pas envoyer plus de 20 emails (destinataires) à la fois.");
+ return;
+ }
+
+ const tab_email_cc = email_cc.split(',');
+ if (tab_email_cc.length > 10) {
+ alert(" Vous ne pouvez mettre plus de 10 adresses en copie.");
+ return;
+ }
+
+
+ const tab_email_bcc = email_bcc.split(',');
+ if (tab_email_bcc.length > 10) {
+ alert(" Vous ne pouvez mettre plus de 10 adresses en copie-cachée.");
+ return;
+ }
+
+
+ if (tab_email_pieces_jointes_result.length > 10) {
+ alert("Vous ne pouvez pas envoyer plus de 5 pièces jointes à la fois.");
+ return;
+ }
+
+
+
+ var form = new FormData();
+
+ const stored_cookie = getCookie('tokenmysypart');
+ form.append("token", stored_cookie);
+ form.append("list_email_dest", email_destinataire);
+ form.append("list_email_cc", email_cc);
+ form.append("list_email_bcc", email_bcc);
+ form.append("email_corps", field_programme);
+ form.append("related_collection", props.related_collection);
+ form.append("email_sujet", email_sujet);
+
+ // pièce jointe
+
+
+ for (let i = 0; i < tab_email_pieces_jointes_result.length; i++) {
+ form.append('File', tab_email_pieces_jointes_result[i]);
+ }
+
+
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Email_From_Front/";
+ setLoading(true);
+
+
+ axios.post(myurl, form).then(res => {
+ //console.log(" In Send_Front_Email res.data.status = " + res.data.status);
+ //console.log(" In Send_Front_Email res.data.message r_class = " + res.data.message);
+ setLoading(false);
+ if (String(res.data.status) === String("true")) {
+
+
+ setSend_Front_Email_api("true");
+ setSend_Front_Email_result(res.data.message);
+ Dialog_1_handleClose_buton();
+ props.father_close_function();
+ props.Clean_Selected_Rows_For_Email();
+
+ alert(res.data.message);
+
+ }
+ else {
+ setSend_Front_Email_api("false");
+ setSend_Front_Email_message(res.data.message);
+ alert(res.data.message);
+ }
+
+ }).catch((error) => {
+ setLoading(false);
+ console.warn('Not good man :( Send_Front_Email = ', error);
+ setSend_Front_Email_api("false");
+ alert("Impossible d'envoyer les email");
+ //setmyApimyApiMessage("")
+ })
+ }
+
+
useEffect(() => {
Get_Partner_List_SendEmail_Document("SENDEMAIL_MODELE");
- if( props.email_destinataire){
+ if (props.email_destinataire) {
setemail_destinataire(props.email_destinataire)
}
- if( props.email_cc){
+ if (props.email_cc) {
setemail_cc(props.email_cc)
}
- if( props.email_bcc){
+ if (props.email_bcc) {
setemail_bcc(props.email_bcc)
}
@@ -415,6 +515,74 @@ const Module_Email_Management = (props) => {
const [email_sujet, setemail_sujet] = useState("");
+ const [tab_email_pieces_jointes_result, settab_email_pieces_jointes_result] = useState([]);
+
+
+ const sessions_file_change_1_convention = event => {
+
+
+ const fileUploaded = event.target.files[0];
+ let file_size = event.target.files[0].size;
+ let file_type = event.target.files[0].type;
+
+
+ if (file_type !== "application/pdf") {
+ alert("Le fichier n'est pas de type PDF");
+ return;
+ }
+
+
+
+ if (file_size > 10000000) {
+ alert("Le fichier ne doit pas depasser un 1 Méga octets");
+ console.log("Le fichier ne doit pas depasser un 1 Méga octets");
+ return;
+ }
+
+ //var new_node = {'name':event.target.files[0].name, 'type':event.target.files[0].type}
+
+
+ var new_tmp = [];
+
+ if (tab_email_pieces_jointes_result && tab_email_pieces_jointes_result.length > 0) {
+
+ tab_email_pieces_jointes_result.map((x) => {
+ new_tmp.push(x);
+
+ });
+
+ }
+
+ new_tmp.push(event.target.files[0])
+
+ settab_email_pieces_jointes_result(new_tmp);
+
+ //console.log(" tab_convention_pieces_jointes_result = ", tab_convention_pieces_jointes_result)
+ return;
+ };
+
+
+ function Delete_Email_Attached_Doc(event) {
+
+ var doc_to_del_name = event.target.id;
+ const myArray = tab_email_pieces_jointes_result;
+
+
+ console.log(" Suppression du fichier : ", doc_to_del_name)
+ let new_myArray = myArray.filter(file => file.name !== String(doc_to_del_name));
+
+ //console.log(" new_myArray = ", new_myArray);
+
+
+ var new_tab = []
+ for (let i = 0; i < new_myArray.length; i++) {
+ new_tab.push(new_myArray[i]);
+ }
+
+ settab_email_pieces_jointes_result(new_tab);
+
+
+ }
return (
@@ -472,7 +640,7 @@ const Module_Email_Management = (props) => {
-
Gestion Email
+
Gestion Email
Choisir un modèle de courrier
{New_Get_Partner_List_SendEmail_Document_result &&
{
/>
-
+
+
+
@@ -615,7 +785,7 @@ const Module_Email_Management = (props) => {
}}
init={{
resize: false,
- height: 500,
+ height: 400,
menubar: true,
plugins: [
'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'print', 'preview', 'anchor', 'searchreplace',
@@ -634,23 +804,176 @@ const Module_Email_Management = (props) => {
+
+
+
+
+
+
+
+
+
+
+
+
+ {tab_email_pieces_jointes_result &&
+
+
+ Liste des pièces jointes
+
+
+ {tab_email_pieces_jointes_result &&
+
+
+
+ {tab_email_pieces_jointes_result && tab_email_pieces_jointes_result.map((val) => (
+
+
+
+
+
Supprimer
+
+
+ }
+ modal
+ nested
+ position="center center"
+ >
+ {close => (
+
+
+
MySy Information
+
+ {' '}
+
+ Confirmer la suppression de la pièce jointe.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )}
+
+
+
+ ))}
+
+
+
}
+
+
}
+
+
+
+
-
+ }} className="bton_enreg_dialog">Envoyer
+
+
+ }
+ modal
+ nested
+ position="center center"
+ >
+ {close => (
+
+
+
MySy Information
+
+ {' '}
+
+ Envoyer l'email ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )}
+
diff --git a/src/components/TestUrl_new.js b/src/components/TestUrl_new.js
index 9fe5d91..8338769 100644
--- a/src/components/TestUrl_new.js
+++ b/src/components/TestUrl_new.js
@@ -674,7 +674,8 @@ const TestUrl_New = (props) => {
-
+
@@ -694,7 +695,7 @@ const TestUrl_New = (props) => {
*/}
- { /********* Dialog email */}
+ { /********* Fin Dialog email */}
diff --git a/src/styles/components/_module_email_management.scss b/src/styles/components/_module_email_management.scss
index 4a98093..5129586 100644
--- a/src/styles/components/_module_email_management.scss
+++ b/src/styles/components/_module_email_management.scss
@@ -713,6 +713,14 @@
.DialogContent_width {
width: 200px !important;
}
+
+ .div_row_list_pj {
+ width: 100%;
+ border-left: 3mm ridge rgba(211, 220, 50, .6);
+ float: left;
+ font-size: medium;
+ }
+
}
@media only screen and (min-width: 601px) and (max-width: 991px) {
@@ -1329,6 +1337,14 @@
width: 500px !important;
}
+ .div_row_list_pj {
+ width: 50%;
+ border-left: 3mm ridge rgba(211, 220, 50, .6);
+ float: left;
+ font-size: medium;
+ text-align: left;
+ padding-left: 5px;
+ }
}
@media only screen and (min-width: 992px) and (max-width: 1199px) {
@@ -1850,6 +1866,14 @@
width: 500px !important;
}
+ .div_row_list_pj {
+ width: 30%;
+ border-left: 3mm ridge rgba(211, 220, 50, .6);
+ float: left;
+ font-size: medium;
+ text-align: left;
+ padding-left: 5px;
+ }
}
@media only screen and (min-width: 1200px) {
@@ -2497,8 +2521,17 @@
width: 500px !important;
}
+ .div_row_list_pj {
+ width: 30%;
+ border-left: 3mm ridge rgba(211, 220, 50, .6);
+ float: left;
+ font-size: medium;
+ text-align: left;
+ padding-left: 5px;
+ }
}
+ // end media
.DialogContent_width {
width: 1500px !important;
@@ -2522,7 +2555,7 @@
text-align: left;
}
- // end media
+
.css-md26zr-MuiInputBase-root-MuiOutlinedInput-root {