05/12/2023 - 21h
parent
746835e6a6
commit
fe07e8307c
|
@ -3749,7 +3749,7 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
const value = event.target.value;
|
||||
|
||||
|
||||
if (String(value) === "supprimer" || String(value) === "depublier" || String(value) === "desactiver") {
|
||||
if (String(value) === "supprimer" || String(value) === "convention" || String(value) === "desactiver") {
|
||||
setactionmass_ftion_val(value);
|
||||
}
|
||||
else {
|
||||
|
@ -3757,22 +3757,29 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const [liste_selected_inscription_id, setliste_selected_inscription_id] = useState([]);
|
||||
async function actionmass_ftion_Traitemet() {
|
||||
|
||||
|
||||
var liste_session = GetSelectedRowsSession();
|
||||
setliste_selected_inscription_id(liste_session);
|
||||
|
||||
//console.log(" liste_formation = ", liste_formation);
|
||||
//console.log(" actionmass_ftion_val = ", actionmass_ftion_val);
|
||||
|
||||
if (String(actionmass_ftion_val) === String("supprimer")) {
|
||||
console.log(" ### liste session : ", liste_session)
|
||||
Delete_LIST_Stagiaires(liste_session);
|
||||
|
||||
}
|
||||
|
||||
else if (String(actionmass_ftion_val) === String("publier")) {
|
||||
|
||||
else if (String(actionmass_ftion_val) === String("convention")) {
|
||||
Get_List_Stagiaire_Conventions();
|
||||
setselected_convention_id();
|
||||
setselected_convention_type();
|
||||
setselected_convention_email_destinataire_prod();
|
||||
setselected_convention_email_test();
|
||||
setDialog_convention_open(true);
|
||||
}
|
||||
|
||||
else if (String(actionmass_ftion_val) === String("desactiver")) {
|
||||
|
@ -4170,6 +4177,7 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
|
||||
})
|
||||
}
|
||||
|
||||
const [Dialog_convention_message, setDialog_convention_message] = React.useState(false);
|
||||
const [Dialog_convention_open, setDialog_convention_open] = React.useState(false);
|
||||
function Dialog_convention_handle_change_participant_session(message) {
|
||||
|
@ -4190,6 +4198,8 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
setselected_convention_email_destinataire_prod();
|
||||
setselected_convention_email_test();
|
||||
|
||||
setactionmass_ftion_val();
|
||||
setSelectionModel([]);
|
||||
};
|
||||
|
||||
|
||||
|
@ -4209,7 +4219,7 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
form.append("class_internal_url", selected_internal_url);
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
form.append("token", stored_cookie);
|
||||
form.append("inscription_id", selected_id);
|
||||
//form.append("inscription_id", selected_id);
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_List_Conventions_Stagiaire/";
|
||||
|
||||
|
@ -4308,6 +4318,41 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
|
||||
}
|
||||
|
||||
function Download_Stagiaire_Conventions_PDF_Masse() {
|
||||
|
||||
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
var nom_fichier_cmd = "Convention.pdf";
|
||||
for (let i = 0; i < liste_selected_inscription_id.length; i++) {
|
||||
|
||||
var local_selected_id = liste_selected_inscription_id[i];
|
||||
|
||||
|
||||
|
||||
var url = process.env.REACT_APP_API_URL + "myclass/api/Download_Convention_Stagiaire_PDF/" + stored_cookie + "/" + local_selected_id + "/" + selected_convention_id;
|
||||
|
||||
//console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url);
|
||||
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 convention (2) ");
|
||||
} else {
|
||||
fileDownload(res.data, nom_fichier_cmd)
|
||||
|
||||
}
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.error('Error:', error);
|
||||
alert(" Impossible de télécharger la convention ")
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const [Send_Stagiaire_Conventions_By_Email_Test_api, setSend_Stagiaire_Conventions_By_Email_Test_api] = useState();
|
||||
const [Send_Stagiaire_Conventions_By_Email_Test_message, setSend_Stagiaire_Conventions_By_Email_Test_message] = useState();
|
||||
const [Send_Stagiaire_Conventions_By_Email_Test_result, setSend_Stagiaire_Conventions_By_Email_Test_result] = useState();
|
||||
|
@ -4351,6 +4396,98 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const [Get_Stagiaire_List_Email_Com_api, setGet_Stagiaire_List_Email_Com_api] = useState();
|
||||
const [Get_Stagiaire_List_Email_Com_message, setGet_Stagiaire_List_Email_Com_message] = useState();
|
||||
const [Get_Stagiaire_List_Email_Com_result, setGet_Stagiaire_List_Email_Com_result] = useState();
|
||||
function Get_Stagiaire_List_Email_Com(event) {
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append("class_internal_url", selected_internal_url);
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
form.append("token", stored_cookie);
|
||||
form.append("inscription_id", selected_id);
|
||||
setLoading(true);
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Stagiaire_Communication_List_Email/";
|
||||
|
||||
axios.post(myurl, form).then(res => {
|
||||
|
||||
setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Get_Stagiaire_List_Email_Com res.data.status = " + res.data.status);
|
||||
//console.log(" In Get_Stagiaire_List_Email_Com res.data.message r_class = " + res.data.message);
|
||||
setGet_Stagiaire_List_Email_Com_api("true");
|
||||
setGet_Stagiaire_List_Email_Com_result(res.data.message);
|
||||
|
||||
var tab_email_prod = []
|
||||
res.data.message.map((x) => {
|
||||
tab_email_prod.push(String(JSON.parse(x).email));
|
||||
}
|
||||
);
|
||||
|
||||
var liste_email_prod = tab_email_prod.join()
|
||||
setselected_convention_email_destinataire_prod(liste_email_prod);
|
||||
|
||||
}
|
||||
else {
|
||||
setGet_Stagiaire_List_Email_Com_api("false");
|
||||
setGet_Stagiaire_List_Email_Com_message(res.data.message);
|
||||
alert(res.data.message);
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
setLoading(false);
|
||||
console.warn('Not good man :( Get_Stagiaire_List_Email_Com = ', error);
|
||||
setGet_Stagiaire_List_Email_Com_api("false");
|
||||
alert("Impossible de récupérer les adresses email de communication");
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
const [Send_Stagiaire_Conventions_By_Email_Masse_api, setSend_Stagiaire_Conventions_By_Email_Masse_api] = useState();
|
||||
const [Send_Stagiaire_Conventions_By_Email_Masse_message, setSend_Stagiaire_Conventions_By_Email_Masse_message] = useState();
|
||||
const [Send_Stagiaire_Conventions_By_Email_Masse_result, setSend_Stagiaire_Conventions_By_Email_Masse_result] = useState();
|
||||
function Send_Stagiaire_Conventions_By_Email_Masse(event) {
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append("class_internal_url", selected_internal_url);
|
||||
const stored_cookie = getCookie('tokenmysypart');
|
||||
form.append("token", stored_cookie);
|
||||
form.append("tab_inscription_id", liste_selected_inscription_id);
|
||||
form.append("courrier_template_id", selected_convention_id);
|
||||
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Sent_Convention_Stagiaire_By_Email_mass/";
|
||||
|
||||
axios.post(myurl, form).then(res => {
|
||||
|
||||
if (String(res.data.status) === String("true")) {
|
||||
//console.log(" In Send_Stagiaire_Conventions_By_Email_Masse res.data.status = " + res.data.status);
|
||||
//console.log(" In Send_Stagiaire_Conventions_By_Email_Masse res.data.message r_class = " + res.data.message);
|
||||
setSend_Stagiaire_Conventions_By_Email_Masse_api("true");
|
||||
setSend_Stagiaire_Conventions_By_Email_Masse_result(res.data.message);
|
||||
|
||||
alert(res.data.message);
|
||||
Dialog_convention_handleClose_buton()
|
||||
}
|
||||
else {
|
||||
setSend_Stagiaire_Conventions_By_Email_Masse_api("false");
|
||||
setSend_Stagiaire_Conventions_By_Email_Masse_message(res.data.message);
|
||||
alert(res.data.message);
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.warn('Not good man :( Send_Stagiaire_Conventions_By_Email_Masse = ', error);
|
||||
setSend_Stagiaire_Conventions_By_Email_Masse_api("false");
|
||||
alert("Impossible d'envoyer les conventions en masse par email");
|
||||
//setmyApimyApiMessage("")
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="displaypartnerstagiaire">
|
||||
{isLoading && <div className="loader-container">
|
||||
|
@ -4723,6 +4860,7 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
onChange={(e) => {
|
||||
setselected_convention_type(e.target.value);
|
||||
}
|
||||
|
||||
}
|
||||
>
|
||||
|
||||
|
@ -4738,11 +4876,11 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
return;
|
||||
}
|
||||
Send_Stagiaire_Conventions_By_Email_Test();
|
||||
}else{
|
||||
} else {
|
||||
alert("L'adresse email de test est invalide.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}} > <FcSearch /> Test</label>}
|
||||
|
||||
|
@ -4804,41 +4942,46 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
</div>
|
||||
}
|
||||
|
||||
{String(selected_convention_type) === "email" && <div className="session_caract_Dialog" > Email destinaitaire
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
{String(selected_convention_type) === "email" &&
|
||||
String(actionmass_ftion_val) !== String("convention") && <div className="session_caract_Dialog" > Email destinaitaire
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
|
||||
name="event_dialog_email_production_convention"
|
||||
id="event_dialog_email_production_convention"
|
||||
name="event_dialog_email_production_convention"
|
||||
id="event_dialog_email_production_convention"
|
||||
|
||||
fullWidth
|
||||
fullWidth
|
||||
|
||||
value={selected_convention_email_destinataire_prod}
|
||||
onChange={(e) => {
|
||||
setselected_convention_email_destinataire_prod(e.target.value);
|
||||
}
|
||||
}
|
||||
/>
|
||||
value={selected_convention_email_destinataire_prod}
|
||||
onChange={(e) => {
|
||||
setselected_convention_email_destinataire_prod(e.target.value);
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
{String(selected_convention_type) === "pdf" && <div className="session_caract_Dialog" > Email destinaitaire
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
{String(selected_convention_type) === "pdf" &&
|
||||
String(actionmass_ftion_val) !== String("convention") && <div className="session_caract_Dialog" > Email destinaitaire
|
||||
<TextField
|
||||
sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }}
|
||||
|
||||
name="event_dialog_email_production_convention"
|
||||
id="event_dialog_email_production_convention"
|
||||
name="event_dialog_email_production_convention"
|
||||
id="event_dialog_email_production_convention"
|
||||
|
||||
fullWidth
|
||||
fullWidth
|
||||
|
||||
value=""
|
||||
value=""
|
||||
|
||||
/>
|
||||
/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
PIECES JOINTES EEEEE xxxx
|
||||
</div>
|
||||
|
||||
</DialogContent>
|
||||
|
||||
|
@ -4846,10 +4989,10 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
|
||||
<DialogActions>
|
||||
<div className="div_row">
|
||||
<div className="div_row_gauche">
|
||||
{String(actionmass_ftion_val) !== String("convention") && <div className="div_row_gauche">
|
||||
{String(selected_convention_type) === "email" && <Button onClick={(e) => {
|
||||
if (String(selected_convention_email_test).length > 2) {
|
||||
const response = window.confirm(" Vous allez envoyer le convention au destinaitaire final. Continuer ?");
|
||||
const response = window.confirm(" Vous allez envoyer la convention au destinaitaire final. Continuer ?");
|
||||
if (!response) {
|
||||
return;
|
||||
}
|
||||
|
@ -4864,7 +5007,35 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
Dialog_convention_handleClose_buton();
|
||||
}}
|
||||
>Télécharger</Button>}
|
||||
</div>
|
||||
</div>}
|
||||
|
||||
|
||||
{String(actionmass_ftion_val) === String("convention") && <div className="div_row_gauche">
|
||||
{String(selected_convention_type) === "email" && <Button onClick={(e) => {
|
||||
if (String(selected_convention_email_test).length > 2) {
|
||||
const response = window.confirm(" Vous allez envoyer " + String(selectionModel.length) + " convention(s) aux destinaitaires final. Continuer ?");
|
||||
if (!response) {
|
||||
return;
|
||||
}
|
||||
Send_Stagiaire_Conventions_By_Email_Masse();
|
||||
Dialog_convention_handleClose_buton();
|
||||
}
|
||||
}}
|
||||
className="bton_enreg_dialog">Envoyer</Button>}
|
||||
{String(selected_convention_type) === "pdf" &&
|
||||
<Button className="bton_enreg_dialog" onClick={(e) => {
|
||||
const response = window.confirm(" Vous allez télécharger " + String(selectionModel.length) + " convention(s). Continuer ?");
|
||||
if (!response) {
|
||||
return;
|
||||
}
|
||||
|
||||
Download_Stagiaire_Conventions_PDF_Masse();
|
||||
Dialog_convention_handleClose_buton();
|
||||
}}
|
||||
>Télécharger</Button>}
|
||||
</div>}
|
||||
|
||||
|
||||
|
||||
<div className="div_row_droite" style={{ "textAlign": 'center' }}>
|
||||
<Button onClick={Dialog_convention_handleClose_buton} className="bton_annule_dialog" >Fermer</Button>
|
||||
|
@ -5371,6 +5542,7 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
onChange={actionmass_ftion}
|
||||
>
|
||||
<MenuItem value="n/a" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Action </MenuItem>
|
||||
<MenuItem value="convention" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Envoyer Convention </MenuItem>
|
||||
<MenuItem value="supprimer" style={{ "paddingLeft": "5px", "textAlign": "left", "width": "100%" }}>Supprimer </MenuItem>
|
||||
|
||||
</TextField>
|
||||
|
@ -5934,7 +6106,9 @@ const DisplayPartnerStagiaires = (props) => {
|
|||
setselected_convention_id();
|
||||
setselected_convention_type();
|
||||
setselected_convention_email_destinataire_prod();
|
||||
|
||||
setselected_convention_email_test();
|
||||
Get_Stagiaire_List_Email_Com();
|
||||
setDialog_convention_open(true);
|
||||
}} >Editer une convention</label><br />
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue