diff --git a/src/components/Facture.js b/src/components/Facture.js index 8eb4bc3..8a4733d 100644 --- a/src/components/Facture.js +++ b/src/components/Facture.js @@ -70,7 +70,7 @@ function Facture(props) { ); } } - + ] function handleClick(event, cellValues) { diff --git a/src/components/PROD_FRONT_CODE_12122025/Partner_Facture.js b/src/components/PROD_FRONT_CODE_12122025/Partner_Facture.js index 9c80ac5..43da7a9 100644 --- a/src/components/PROD_FRONT_CODE_12122025/Partner_Facture.js +++ b/src/components/PROD_FRONT_CODE_12122025/Partner_Facture.js @@ -1076,7 +1076,7 @@ registerLocale('fr', fr); if (String(res.data.status) === "true") { setLoading(false); //console.log(" In Get_Invoice_Data res.data.status = " + res.data.status); - //console.log(" In Get_Invoice_Data res.data.message r_class = " + res.data.message); + console.log(" In Get_Invoice_Data res.data.message r_class = " + res.data.message); setGetAttendee_api("true"); setGetAttendee_result(res.data.message); diff --git a/src/components/Partner_Commande.js b/src/components/Partner_Commande.js index 6b76bd1..36c7785 100644 --- a/src/components/Partner_Commande.js +++ b/src/components/Partner_Commande.js @@ -199,6 +199,8 @@ const Partner_Commande = (props) => { {cellValues.row.order_header_status && String(cellValues.row.order_header_status) === "4" && String(cellValues.row.order_header_type) === "devis" && "Perdu"} + {cellValues.row.order_header_status && String(cellValues.row.order_header_status) === "5" + && String(cellValues.row.order_header_type) === "devis" && "Facturé"} @@ -854,7 +856,7 @@ const Partner_Commande = (props) => { //console.log(" ### setNew_GetCurrentPartnerClass_result = ", New_GetCurrentPartnerClass_result); } - console.log(" ## new_data2 = ", new_data2) + // console.log(" ## new_data2 = ", new_data2) } else if (String(res.data.status) === String("Err_Connexion")) { alert('Erreur: ' + res.data.message); @@ -874,15 +876,15 @@ const Partner_Commande = (props) => { } - const [New_Getall_TrainingSession_For_Given_Class_result, setNew_Getall_TrainingSession_For_Given_Class_result] = useState([ { - "_id": "", - "id": "", - "label": "", - "code_session": "", - "titre": "", - "date_debut": "", - "date_fin": "", - }]); + const [New_Getall_TrainingSession_For_Given_Class_result, setNew_Getall_TrainingSession_For_Given_Class_result] = useState([{ + "_id": "", + "id": "", + "label": "", + "code_session": "", + "titre": "", + "date_debut": "", + "date_fin": "", + }]); const [Getall_TrainingSession_For_Given_Class_api, setGetall_TrainingSession_For_Given_Class_api] = useState(); const [Getall_TrainingSession_For_Given_Class_message, setGetall_TrainingSession_For_Given_Class_message] = useState(); @@ -956,15 +958,15 @@ const Partner_Commande = (props) => { setNew_Getall_TrainingSession_For_Given_Class_result(new_data2); } else { - setNew_Getall_TrainingSession_For_Given_Class_result([ { - "_id": "", - "id": "", - "label": "", - "code_session": "", - "titre": "", - "date_debut": "", - "date_fin": "", - }]) + setNew_Getall_TrainingSession_For_Given_Class_result([{ + "_id": "", + "id": "", + "label": "", + "code_session": "", + "titre": "", + "date_debut": "", + "date_fin": "", + }]) } @@ -1597,6 +1599,10 @@ const Partner_Commande = (props) => { setp_detail_header_statut_label("Perdu"); } + else if (String(mylocal_order.order_header_status) === "5") { + setp_detail_header_statut_label("Facturé"); + } + else if (String(mylocal_order.order_header_status) === "-1") { setp_detail_header_statut_label("Annulé"); } @@ -4162,6 +4168,12 @@ const Partner_Commande = (props) => { form.append("order_header_id", selected_id); + if (!rows_order_lines || rows_order_lines.length <= 0) { + setdisplay_alert_mysy("1"); + setalert_message("Ce devis ne contient aucune ligne à confirmer"); + setalert_type("error"); + return; + } //console.log("### form = ", form); var myurl = process.env.REACT_APP_API_URL + "myclass/api/Confirm_Partner_Order_Header_And_Lines/"; setLoading(true); @@ -4536,6 +4548,69 @@ const Partner_Commande = (props) => { }) + } + + + const [Invoice_Quotation_Data_api, setInvoice_Quotation_Data_api] = useState(); + const [Invoice_Quotation_Data_message, setInvoice_Quotation_Data_message] = useState(); + const [Invoice_Quotation_Data_result, setInvoice_Quotation_Data_result] = useState(); + function Invoice_Quotation_Data() { + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("order_id", selected_id); + form.append("order_ref_interne", order_internal_ref); + + + //console.log("### form = ", form); + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Invoice_Partner_Quotation/"; + + setLoading(true); + 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); + + setLoading(false); + if (String(res.data.status) === String("true")) { + // clean_article_detail_fields(); + setInvoice_Quotation_Data_api("true"); + setInvoice_Quotation_Data_message(res.data.message); + clean_all_filters(); + Getall_Parter_Orders_No_Filter(); + + Display_Detail_Order_data(selected_id); + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("success"); + } + else { + setInvoice_Quotation_Data_api("false"); + setInvoice_Quotation_Data_message(res.data.message); + + // alert(res.data.message); + setdisplay_alert_mysy("1"); + setalert_message(res.data.message); + setalert_type("error"); + } + + }).catch((error) => { + setLoading(false); + + console.warn('Invoice_Quotation_Data : Not good man :( Invoice_Quotation_Data = ' + error); + setInvoice_Quotation_Data_api("false"); + alert(" Impossible de facturer le devis "); + }) + + } const [Get_Class_Data_api, setGet_Class_Data_api] = useState(); @@ -6092,7 +6167,7 @@ const Partner_Commande = (props) => { /> } - + {/*** Si c'est pour une formation */} {article_formation_ou_produit && String(article_formation_ou_produit) === "formation" &&
@@ -7767,19 +7842,19 @@ const Partner_Commande = (props) => { */} - - + {/**/} +
} @@ -7884,30 +7959,7 @@ const Partner_Commande = (props) => { />} - {/* { - setp_detail_header_statut(e.target.value); - setOrder_data_changed("1"); - } - } - > - Brouillon    - En cours   - Traité   - Annulé   - */} } {String(order_data_edit_mode) === "1" && String(p_detail_header_type) === "devis" &&
Statut
@@ -9018,10 +9070,64 @@ const Partner_Commande = (props) => { {String(props.check_user_acces_right("commande", "write")) === "1" && String(selected_order_header_type) === "devis" && + ( p_detail_header_statut === "1" || p_detail_header_statut === "3") && + Facturer + } + + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, vous allez lancer le processus de facturation.
+
+ + + +
+
+ + +
+
+ +
+
+
+ )} +
+ + } + + + + + {/*String(props.check_user_acces_right("commande", "write")) === "1" && String(selected_order_header_type) === "devis" && (String(p_detail_header_statut_label).toLowerCase().trim() === "en cours" || String(p_detail_header_statut_label).toLowerCase().trim() === "gagné") && String(p_detail_header_order_header_ref_interne) === "" && - } + */} {String(selected_order_header_type) === "devis" && (String(p_detail_header_statut_label).toLowerCase().trim() === "en cours" || String(p_detail_header_statut_label).toLowerCase().trim() === "gagné") && diff --git a/src/components/Partner_Facture.js b/src/components/Partner_Facture.js index eee563b..be72d05 100644 --- a/src/components/Partner_Facture.js +++ b/src/components/Partner_Facture.js @@ -1139,9 +1139,9 @@ const Partner_Facture = (props) => { //document.getElementsByName("detail_header_ref_cient")[0].value = ""; if (mylocal_order.order_header_ref_client) { - setp_detail_header_ref_interne(mylocal_order.order_header_ref_client); + setp_detail_header_ref_client(mylocal_order.order_header_ref_client); } else { - setp_detail_header_ref_interne("") + setp_detail_header_ref_client("") } @@ -4796,7 +4796,7 @@ const Partner_Facture = (props) => { />
- +
Ref. Commande