13/09/2023 - 18h

recette2
cherif 2023-09-13 18:00:26 +02:00
parent 533db68e2c
commit e52a64f098
1 changed files with 47 additions and 6 deletions

View File

@ -2094,11 +2094,8 @@ const Partner_Commande = (props) => {
function print_order_pdf() { function print_order_pdf() {
const stored_cookie = getCookie('tokenmysypart'); const stored_cookie = getCookie('tokenmysypart');
var nom_fichier_cmd = "Order_" + order_internal_ref + ".pdf"; var nom_fichier_cmd = "Order_" + order_internal_ref + ".pdf";
console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id); console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id);
@ -2115,11 +2112,55 @@ const Partner_Commande = (props) => {
}); });
} }
function send_order_by_email() {
const [Send_Order_By_Email_api, setSend_Order_By_Email_api] = useState();
const [Send_Order_By_Email_message, setSend_Order_By_Email_message] = useState();
const [Send_Order_By_Email_result, setSend_Order_By_Email_result] = useState();
function Send_Order_By_Email() {
var form = new FormData();
//form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");
const stored_cookie = getCookie('tokenmysypart');
form.append("token", stored_cookie);
form.append("order_id", selected_id);
//console.log("### form = ", form);
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Send_Partner_Order_By_Email/";
axios.post(myurl, form).then(res => {
//console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status);
//console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message);
if (String(res.data.status) === String("true")) {
setSend_Order_By_Email_api("true");
setSend_Order_By_Email_message(res.data.message);
alert(res.data.message);
}
else {
setSend_Order_By_Email_api("false");
setSend_Order_By_Email_message(res.data.message);
alert(res.data.message);
}
}).catch((error) => {
console.warn('Send_Order_By_Email : Not good man :( Send_Order_By_Email = ' + error);
setSend_Order_By_Email_api("false");
if (String(p_add_cmd_header_order_type) === "devis") {
alert(" Impossible d'envoyer le devis par email");
} else if (String(p_add_cmd_header_order_type) === "commande") {
alert(" Impossible d'envoyer la commande par email");
}
})
} }
return ( return (
<div className="partner_commande"> <div className="partner_commande">
@ -3449,7 +3490,7 @@ const Partner_Commande = (props) => {
<div className="div_row"> <div className="div_row">
<Button variant="outlined" onClick={Compute_Order_Header_Price} className="detail_class_submenu" id='order_header_main' name='order_header_main'>Mettre a jour prix</Button> <Button variant="outlined" onClick={Compute_Order_Header_Price} className="detail_class_submenu" id='order_header_main' name='order_header_main'>Mettre a jour prix</Button>
<Button variant="outlined" onClick={print_order_pdf} className="detail_class_submenu" id='order_header_main' name='order_header_main'>Imprimer pdf</Button> <Button variant="outlined" onClick={print_order_pdf} className="detail_class_submenu" id='order_header_main' name='order_header_main'>Imprimer pdf</Button>
<Button variant="outlined" onClick={send_order_by_email} className="detail_class_submenu" id='order_header_main' name='order_header_main'>envoyer par mail</Button> <Button variant="outlined" onClick={Send_Order_By_Email} className="detail_class_submenu" id='order_header_main' name='order_header_main'>envoyer par mail</Button>
</div> </div>
<div className="div_row"> <div className="div_row">