diff --git a/src/components/Config_Document.js b/src/components/Config_Document.js index 18f0892..c23b72f 100644 --- a/src/components/Config_Document.js +++ b/src/components/Config_Document.js @@ -860,7 +860,7 @@ const Config_Documents = (props) => { const [p_collection, setp_collection] = useState(); function add_selected_fields() { - if(!p_champ_table || String(p_champ_table) === "undefined"){ + if (!p_champ_table || String(p_champ_table) === "undefined") { alert(" vous devez choisir un champ "); return; } @@ -1554,6 +1554,7 @@ const Config_Documents = (props) => { } + const [New_Get_List_Personnalisable_Default_Document_result, setNew_Get_List_Personnalisable_Default_Document_result] = useState(); const [Get_List_Personnalisable_Default_Document_api, setGet_List_Personnalisable_Default_Document_api] = useState(); const [Get_List_Personnalisable_Default_Document_message, setGet_List_Personnalisable_Default_Document_message] = useState(); @@ -1577,6 +1578,32 @@ const Config_Documents = (props) => { setGet_List_Personnalisable_Default_Document_api("true"); setGet_List_Personnalisable_Default_Document_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_nom = JSON.parse(x).nom; + var local_type_doc = JSON.parse(x).type_doc; + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_nom+" - "+local_type_doc+"", + "nom": local_nom, + "type_doc": local_type_doc, + + }; + new_data2.push(node); + }); + + if (new_data2.length > 0) + setNew_Get_List_Personnalisable_Default_Document_result(new_data2); + + } else { setGet_List_Personnalisable_Default_Document_api("false"); @@ -1629,7 +1656,7 @@ const Config_Documents = (props) => { setadd_one_document(); setdisplay_add_one_document(); setp_champ_table(""); - + } @@ -2611,19 +2638,19 @@ const Config_Documents = (props) => {
{String(partner_document_data_edit_mode) === "1" && - { - setp_champ_table(value.nom_champ_technique); - }} + { + setp_champ_table(value.nom_champ_technique); + }} - - renderInput={(params) => - } - /> - } + + renderInput={(params) => + } + /> + } {String(partner_document_data_edit_mode) === "1" &&
@@ -3036,8 +3063,10 @@ const Config_Documents = (props) => { {String(display_detail_document) !== "1" && String(add_one_document) === "1" &&

Personnaliser un nouveau document

+
Choisir le document à ajouter
- { ))} - + */} + + { + if (value && value._id) { + setselecte_defaul_doc_to_add(value._id); + + } + + }} + + renderInput={(params) => + } + />
diff --git a/src/components/DisplayPartnerSession.js b/src/components/DisplayPartnerSession.js index 6e7ade4..50083c8 100644 --- a/src/components/DisplayPartnerSession.js +++ b/src/components/DisplayPartnerSession.js @@ -52,7 +52,7 @@ import { FcOpenedFolder } from "react-icons/fc"; import { gridClasses } from '@mui/x-data-grid'; import Link from '@mui/material/Link'; import { PiDotsThree } from "react-icons/pi"; - +import Module_Editique from "./Module_Editique"; const DisplayPartnerSession = (props) => { @@ -14361,7 +14361,9 @@ const DisplayPartnerSession = (props) => { {String(submenu) === String("editique") &&
- + +
}
diff --git a/src/components/Module_Editique.js b/src/components/Module_Editique.js index 9fff918..d8297ab 100644 --- a/src/components/Module_Editique.js +++ b/src/components/Module_Editique.js @@ -108,9 +108,13 @@ const Module_Editique = (props) => { setSelected(nodeIds); }; + + const [tab_handleExpandClick_id, settab_handleExpandClick_id] = React.useState([]); + //settab_handleExpandClick_id(['0', '1', '2', '3', '4', '20']) + const handleExpandClick = () => { setExpanded((oldExpanded) => - oldExpanded.length === 0 ? ['1', '5', '6', '7'] : [], + oldExpanded.length === 0 ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] : [], ); }; @@ -207,10 +211,7 @@ const Module_Editique = (props) => { setselected_session_id(props.related_collection_recid); Getall_Editable_Document_By_Partner_By_Collection(); Get_related_collection_Data(); - window.scrollTo({ - top: 0, - behavior: "smooth", - }); + }, []) @@ -274,6 +275,11 @@ const Module_Editique = (props) => { var nom_fichier_cmd = "Convention.zip"; + if( String(selected_convention_id).trim() === ""){ + alert(" Vous devez choisir un modèle de document "); + return; + } + var url = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Convention_From_Session_By_PDF/" + stored_cookie + "/" + selected_session_id + "/" + selected_convention_id; @@ -307,6 +313,50 @@ const Module_Editique = (props) => { } + + function Download_Session_Convocation_PDF() { + + const stored_cookie = getCookie('tokenmysypart'); + + var nom_fichier_cmd = "Convocation.zip"; + + if( String(selected_convention_id).trim() === ""){ + alert(" Vous devez choisir un modèle de document "); + return; + } + var url = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Convocation_From_Session_By_PDF/" + stored_cookie + "/" + selected_session_id + "/" + selected_convention_id; + + + + if (String(selected_convention_id) === "default_pdf") { + // Il s'agit d'envoyer les convention par defaut de type mail + url = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Default_Convocation_From_Session_By_PDF/" + stored_cookie + "/" + selected_session_id + "/" + selected_convention_id; + + } + + console.log(" ### url = ", url); + + //console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_session_id = ", selected_session_id, " --- selected_convention_id =", selected_convention_id); + setLoading(true); + axios.get(url, { responseType: 'blob', },) + .then((res) => { + setLoading(false); + //console.log(" In Download_Stagiaire_Conventions_PDF res.data = " + res.data); + if (String(res.data) === String("false")) { + alert("Impossible de télécharger la convocation (2) "); + } else { + fileDownload(res.data, nom_fichier_cmd); + Getall_Editable_Document_By_Partner_By_Collection(); + + } + }).catch((error) => { + setLoading(false); + console.error('Error:', error); + alert(" Impossible de télécharger la convocation ") + + }); + + } const [New_Get_List_Stagiaire_Conventions_result, setNew_Get_List_Stagiaire_Conventions_result] = useState([]); const [Get_List_Stagiaire_Conventions_api, setGet_List_Stagiaire_Conventions_api] = useState(); @@ -388,6 +438,90 @@ const Module_Editique = (props) => { }) } + + + const [New_Get_List_Stagiaire_Convocations_result, setNew_Get_List_Stagiaire_Convocations_result] = useState([]); + + const [Get_List_Stagiaire_Convocations_api, setGet_List_Stagiaire_Convocations_api] = useState(); + const [Get_List_Stagiaire_Convocations_message, setGet_List_Stagiaire_Convocations_message] = useState(); + const [Get_List_Stagiaire_Convocations_result, setGet_List_Stagiaire_Convocations_result] = useState(); + function Get_List_Stagiaire_Convocations(ref_interne, nom, type_doc, courrier_template_type_document_ref_interne) { + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("type_doc", type_doc); + form.append("courrier_template_type_document_ref_interne", courrier_template_type_document_ref_interne); + + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Convocations_Stagiaire_With_Filter/"; + setLoading(true); + + + axios.post(myurl, form).then(res => { + //console.log(" In Get_List_Stagiaire_Convocations res.data.status = " + res.data.status); + //console.log(" In Get_List_Stagiaire_Convocations res.data.message r_class = " + res.data.message); + setLoading(false); + if (String(res.data.status) === String("true")) { + + + setGet_List_Stagiaire_Convocations_api("true"); + setGet_List_Stagiaire_Convocations_result(res.data.message); + + var new_data2 = []; + + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_ref_interne = JSON.parse(x).ref_interne; + var local_nom = JSON.parse(x).nom; + var local_sujet = JSON.parse(x).sujet; + var local_type_doc = JSON.parse(x).type_doc; + var local_cible = JSON.parse(x).cible; + var local_joint_pdf = JSON.parse(x).joint_pdf; + + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_nom, + "ref_interne": local_ref_interne, + "nom": local_nom, + "sujet": local_sujet, + "type_doc": local_type_doc, + "cible": local_cible, + "joint_pdf": local_joint_pdf, + + }; + new_data2.push(node); + }); + + if (new_data2.length > 0) + setNew_Get_List_Stagiaire_Convocations_result(new_data2); + + } + else { + setGet_List_Stagiaire_Convocations_api("false"); + setGet_List_Stagiaire_Convocations_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_List_Stagiaire_Convocations = ', error); + setGet_List_Stagiaire_Convocations_api("false"); + alert("Impossible de récupérer les modèles de convocations"); + //setmyApimyApiMessage("") + }) + } + + const [sessions_file_change_1_convention_api, setsessions_file_change_1_convention_api] = useState(); const [sessions_file_change_1_convention_result, setsessions_file_change_1_convention_result] = useState(); const [sessions_file_change_1_convention_message, setsessions_file_change_1_convention_message] = useState(); @@ -676,6 +810,77 @@ const Module_Editique = (props) => { }) } + + const [Send_Stagiaire_Convocations_By_Email_api, setSend_Stagiaire_Convocations_By_Email_api] = useState(); + const [Send_Stagiaire_Convocations_By_Email_message, setSend_Stagiaire_Convocations_By_Email_message] = useState(); + const [Send_Stagiaire_Convocations_By_Email_result, setSend_Stagiaire_Convocations_By_Email_result] = useState(); + function Send_Stagiaire_Convocations_By_Email(event) { + + var form = new FormData(); + + if (String(selected_convention_id).trim() === "") { + alert(" Vous devez choisir un document"); + return; + } + + form.append("class_internal_url", selected_internal_url); + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("session_id", selected_session_id); + form.append("courrier_template_id", selected_convention_id); + form.append("email_test", selected_convention_email_test); + form.append("email_production", selected_convention_email_destinataire_prod); + + + console.log("form === ", form); + // pièce jointe + form.append("file_business_object", ""); + var list_files = new FormData(); + + for (let i = 0; i < tab_convention_pieces_jointes_result.length; i++) { + form.append('File', tab_convention_pieces_jointes_result[i]); + + } + //form.append("File", list_files); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Convocation_From_Session_By_Email/"; + if (String(selected_convention_id) === "default_mail") { + // Il s'agit d'envoyer les convention par defaut de type mail + myurl = process.env.REACT_APP_API_URL + "myclass/api/Prepare_and_Send_Default_Convocation_From_Session_By_Email/"; + } + + //console.log(" ### myurl = ", myurl); + + setLoading(true); + axios.post(myurl, form).then(res => { + setLoading(false); + //console.log(" In Send_Stagiaire_Convocations_By_Email res.data.status = " + res.data.status); + //console.log(" In Send_Stagiaire_Convocations_By_Email res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setSend_Stagiaire_Convocations_By_Email_api("true"); + setSend_Stagiaire_Convocations_By_Email_result(res.data.message); + + Getall_Editable_Document_By_Partner_By_Collection(); + alert(res.data.message); + Dialog_convention_handleClose_buton() + } + else { + setSend_Stagiaire_Convocations_By_Email_api("false"); + setSend_Stagiaire_Convocations_By_Email_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Send_Stagiaire_Convocations_By_Email = ', error); + setSend_Stagiaire_Convocations_By_Email_api("false"); + alert("Impossible d'envoyer la convocation par email"); + //setmyApimyApiMessage("") + }) + } + const [action_server_to_run, setaction_server_to_run] = useState(""); const [action_server_type_doc, setaction_server_type_doc] = useState(""); const [action_server_nom_doc, setaction_server_nom_doc] = useState(""); @@ -703,6 +908,17 @@ const Module_Editique = (props) => { setDialog_CONF_INSCRIPTION_open(false); }; + const [Dialog_CONVOCATION_STAGIAIRE_open, setDialog_CONVOCATION_STAGIAIRE_open] = React.useState(false); + const Dialog_CONVOCATION_STAGIAIRE_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const Dialog_CONVOCATION_STAGIAIRE_handleClose_buton = () => { + setDialog_CONVOCATION_STAGIAIRE_open(false); + }; + + return (
@@ -839,6 +1055,314 @@ const Module_Editique = (props) => { {/* FIN Dialog pour gerer les EMARGEMENT_FORMATION */} + {/* Dialog pour gerer les CONVOCATION_STAGIAIRE */} + + + MySy Information + + + {Dialog_1_message} - {action_server_type_doc} + + + +
Type Document
+ { + setselected_convention_type(e.target.value); + Get_List_Stagiaire_Convocations(action_server_ref_interne_doc, action_server_nom_doc, + String(e.target.value), Dialog_1_message); + + } + } + > + + Email   + PDF   + + +
+ + {(String(selected_convention_type) === "email" || String(selected_convention_type) === "pdf") &&
Choisir une convention + { + if (value && value._id) { + + setselected_convention_id(value._id); + + if (String(value._id) === "default_mail") { + setselected_convention_type("email"); + } + else if (String(value._id) === "default_pdf") { + setselected_convention_type("pdf"); + } else { + var result2 = Get_List_Stagiaire_Convocations_result.filter((local_mymanager) => JSON.parse(local_mymanager)._id === String(value._id)) + setselected_convention_type(JSON.parse(result2).type_doc); + } + settab_convention_pieces_jointes_result([]); + } + }} + + renderInput={(params) => + } + /> + +
} + + {String(selected_convention_type) === "email" &&
Type Document
+ + + + {String(selected_convention_type) === "email" && } + +
} + + {String(selected_convention_type) === "pdf" &&
Type Document
+ + + + +
} + + + {String(selected_convention_type) === "email" && + } + + {String(selected_convention_type) === "pdf" &&
Recevoir un pré-envoie + + +
+ } + + {String(selected_convention_type) === "email" && + String(actionmass_ftion_val) !== String("convention") &&
Email destinaitaire + { + setselected_convention_email_destinataire_prod(e.target.value); + } + } + /> + +
+ } + + + {String(selected_convention_type) === "pdf" && + String(actionmass_ftion_val) !== String("convention") &&
Email destinaitaire + + +
+ } + + {String(selected_convention_type) === "email" &&
+ +
+
+
+
+ +
+ Pièces jointes Convention + +
+ +
+ +
+ +
+ + +
+ + + {tab_convention_pieces_jointes_result &&
+ +
+ Liste des pièces jointes
+ {
+ {tab_convention_pieces_jointes_result && tab_convention_pieces_jointes_result.map((val) => ( +
+
+ + +
+ ))} +
} +
+
} + + + +
+
} + + + +
+ + +
+
+ {String(selected_convention_type) === "email" && } + + + {String(selected_convention_type) === "pdf" && + } + +
+ + + +
+ +
+
+ +
+ +
+ {/* FIN Dialog pour gerer les CONVOCATION_STAGIAIRE */} + + {/* Dialog pour gerer les conventions */} { }} className="bton_enreg_dialog">Envoyer mail } + + {String(selected_convention_type) === "pdf" && +
+ Détail + + + + {Getall_Editable_Document_By_Partner_By_Collection_result && + Getall_Editable_Document_By_Partner_By_Collection_result.map((document) => ( + + + } + defaultExpandIcon={} + expanded={expanded} + selected={selected} + onNodeToggle={handleToggle} + onNodeSelect={handleSelect} + multiSelect + className="test03" + > + + + {JSON.parse(document).list_document_history_event && + JSON.parse(document).list_document_history_event.map((history_doc) => ( + + + + ))} + + {/*!JSON.parse(document).list_document_history_event || (JSON.parse(document).list_document_history_event).length <= 0 && + */} + + + - - } - defaultExpandIcon={} - expanded={expanded} - selected={selected} - onNodeToggle={handleToggle} - onNodeSelect={handleSelect} - multiSelect - > - - - - - - - - - - - - - + + + ))}
diff --git a/src/components/TestUrl_new.js b/src/components/TestUrl_new.js index b826c5b..689b60a 100644 --- a/src/components/TestUrl_new.js +++ b/src/components/TestUrl_new.js @@ -607,7 +607,7 @@ const TestUrl_New = (props) => {

Module Ediditique

- +