diff --git a/src/components/Partner_Commande.js b/src/components/Partner_Commande.js index 69d42b6..de96e75 100644 --- a/src/components/Partner_Commande.js +++ b/src/components/Partner_Commande.js @@ -527,6 +527,7 @@ const Partner_Commande = (props) => { Getall_Training_Employee_No_Filter(); Getall_Parter_Orders_No_Filter(); GetCurrentPartnerClass(); + Get_Given_Partner_Config_Point_Taux_TVA(); if (myRef_head) myRef_head.current.scrollIntoView({ behavior: "smooth" }); }, []) @@ -1095,6 +1096,62 @@ const Partner_Commande = (props) => { + + + const [partner_taux_tva, setpartner_taux_tva] = useState("20"); + + const [Get_Given_Partner_Config_Point_Taux_TVA_api, setGet_Given_Partner_Config_Point_Taux_TVA_api] = useState(); + const [Get_Given_Partner_Config_Point_Taux_TVA_message, setGet_Given_Partner_Config_Point_Taux_TVA_message] = useState(); + const [Get_Given_Partner_Config_Point_Taux_TVA_result, setGet_Given_Partner_Config_Point_Taux_TVA_result] = useState(); + function Get_Given_Partner_Config_Point_Taux_TVA() { + + var form = new FormData(); + const stored_cookie = getCookie('tokenmysypart'); + + form.append("token", stored_cookie); + form.append("config_name", "tva"); + + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Partner_Basic_Setup/"; + + axios.post(myurl, form).then(res => { + //console.log(" In Get_Given_Partner_Config_Point_Taux_TVA res.data.status = " + res.data.status); + //console.log(" In Get_Given_Partner_Config_Point_Taux_TVA res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setGet_Given_Partner_Config_Point_Taux_TVA_api("true"); + setGet_Given_Partner_Config_Point_Taux_TVA_result(res.data.message); + + if (res.data.message.length > 0) { + var point_config_tva = JSON.parse(res.data.message); + + if (point_config_tva.config_value) { + setpartner_taux_tva(point_config_tva.config_value); + console.log(" GGG TVA PART = ", point_config_tva.config_value); + } + + } else { + alert(" Aucun taux de TVA récuperé") + } + } + else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + else { + setGet_Given_Partner_Config_Point_Taux_TVA_api("false"); + setGet_Given_Partner_Config_Point_Taux_TVA_message(res.data.message); + alert('Erreur: ' + res.data.message); + } + + }).catch((error) => { + console.warn('Not good man :( Get_Given_Partner_Config_Point_Taux_TVA = ', error); + setGet_Given_Partner_Config_Point_Taux_TVA_api("false"); + alert('Erreur: Impossible de recuperer la liste des clients'); + //setmyApimyApiMessage("") + }) + } + const [Get_Givent_Partner_Client_Data_api, setGet_Givent_Partner_Client_Data_api] = useState(); const [Get_Givent_Partner_Client_Data_message, setGet_Givent_Partner_Client_Data_message] = useState(); const [Get_Givent_Partner_Client_Data_result, setGet_Givent_Partner_Client_Data_result] = useState(); @@ -1863,7 +1920,7 @@ const Partner_Commande = (props) => { console.warn('UpdateStagiaireData : Not good man :( Update_One_Order_Data = ' + error); setUpdate_One_Order_Data_api("false"); - alert(" Impossible de mettre à jour "); + alert(" Impossible de faire la mise à jour"); }) } @@ -1965,7 +2022,7 @@ const Partner_Commande = (props) => { Display_Detail_Order_data(selected_id); alert(" La mise à jour été correctement faite."); - myRef_head.current.scrollIntoView({ behavior: "smooth" }); + //myRef_head.current.scrollIntoView({ behavior: "smooth" }); } else { @@ -2286,8 +2343,8 @@ const Partner_Commande = (props) => { console.log(" ### qty = ", qty, " ### unit_price = ", unit_price, " ### total_base1 = ", total_base1, " ### total_reduction = ", total_reduction, " ### reduct_value = ", reduct_value); - var montant_taxe_tva = ((total_base1 - total_reduction) * 0.2).toFixed(3); - var montant_ttc = ((total_base1 - total_reduction) * 1.2).toFixed(3); //(total_base2 + montant_taxe_tva).toFixed(2); + var montant_taxe_tva = ((total_base1 - total_reduction) * [parseFloat(String(partner_taux_tva)) / 100]).toFixed(3); + var montant_ttc = ((total_base1 - total_reduction) * (1 + [parseFloat(String(partner_taux_tva)) / 100])).toFixed(3); //(total_base2 + montant_taxe_tva).toFixed(2); setp_add_line_item_reduction_total_amount(String(total_reduction)); setp_add_line_item_total_amount_ht(String(total_base1)); @@ -2785,7 +2842,7 @@ const Partner_Commande = (props) => { {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Quantité { {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Quantité { {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Prix Unitaire { {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Prix Unitaire { />
} +
Taux TVA + +
+ {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Type reduction { {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Type reduction { {String(p_detail_header_statut_label).toLowerCase() !== "facturé" &&
Reduction { {String(p_detail_header_statut_label).toLowerCase() === "facturé" &&
Reduction {
Total Reduction { name="ref_article_comment" id="ref_article_comment" - autoFocus + fullWidth value={p_add_line_item_comment} @@ -2992,7 +3065,7 @@ const Partner_Commande = (props) => { name="ref_article_comment" id="ref_article_comment" - autoFocus + fullWidth value={p_add_line_item_comment} @@ -3011,7 +3084,7 @@ const Partner_Commande = (props) => {
Total HT {
Description
{
Ref. externe
{
Vendeur
{ sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }} name="order_paiement_condition" id="order_paiement_condition" - autoFocus + fullWidth value={p_add_cmd_header_condition_paiement} onChange={(e) => { @@ -3246,7 +3319,7 @@ const Partner_Commande = (props) => { sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }} name="order_type" id="order_type" - autoFocus + fullWidth value={p_add_cmd_header_order_type} disabled @@ -3260,7 +3333,7 @@ const Partner_Commande = (props) => { sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }} name="order_header_location_type" id="order_header_location_type" - autoFocus + fullWidth value={p_add_cmd_header_order_location_type} onChange={(e) => { @@ -3284,7 +3357,7 @@ const Partner_Commande = (props) => { sx={{ '& legend': { display: 'none' }, '& fieldset': { top: 0 }, }} name="order_commentaire" id="order_commentaire" - autoFocus + fullWidth multiline rows={2} diff --git a/src/components/Partner_Config_Technique.js b/src/components/Partner_Config_Technique.js index 9edef68..7dfbeca 100644 --- a/src/components/Partner_Config_Technique.js +++ b/src/components/Partner_Config_Technique.js @@ -75,7 +75,7 @@ const Partner_Configuration_Technique = (props) => { { field: 'config_value', headerName: 'Valeur config', flex: 1, hide: false, editable: false }, - { + /* { field: "delete", headerName: 'Supprimer', renderCell: (cellValues) => { return ( @@ -134,10 +134,12 @@ const Partner_Configuration_Technique = (props) => { ); } - } + }*/ ] + + const myRef = useRef(null) useEffect(() => { @@ -187,10 +189,14 @@ const Partner_Configuration_Technique = (props) => { const [display_detail_config, setdisplay_detail_config] = React.useState(); + const [selected_row_id_val, setselected_row_id_val] = React.useState(); + function handleClick_edit_config_From_Line(selected_row_id) { //submenu_detail_employe(); + setselected_row_id_val(selected_row_id); + var line = JSON.parse(rowss[selected_row_id]); setdisplay_detail_config("1"); @@ -204,8 +210,7 @@ const Partner_Configuration_Technique = (props) => { var local_config_value = line.config_value; setp_detail_config_valeur(local_config_value); - - + Disable_Config_DetailFields(); if (myRef) { myRef.current.scrollIntoView({ behavior: "smooth" }); @@ -214,6 +219,31 @@ const Partner_Configuration_Technique = (props) => { } + function Annule_Order_DetailFields() { + + var line = JSON.parse(rowss[selected_row_id_val]); + + setdisplay_detail_config("1"); + //console.log("### line = ", line); + var invoice_id = line._id; + setselected_id(invoice_id); + + var local_config_name = line.config_name; + setp_detail_config_point(local_config_name); + + var local_config_value = line.config_value; + setp_detail_config_valeur(local_config_value); + + setConfig_data_changed(); + setconfig_data_edit_mode(); + + Disable_Config_DetailFields(); + + if (myRef) { + myRef.current.scrollIntoView({ behavior: "smooth" }); + } + + } const myRef_head = useRef(null); const [selected_id, setselected_id] = useState(""); @@ -240,6 +270,95 @@ const Partner_Configuration_Technique = (props) => { const [p_detail_config_point, setp_detail_config_point] = useState(""); const [config_data_edit_mode, setconfig_data_edit_mode] = useState(""); + + function Enable_Config_DetailFields() { + + setconfig_data_edit_mode("1"); + + if (document.getElementsByName("detail_config_point")[0]) { + document.getElementsByName("detail_config_point")[0].disabled = false; + document.getElementsByName("detail_config_point")[0].style.backgroundColor = "#FFFFFF"; + } + + if (document.getElementsByName("detail_config_valeur")[0]) { + document.getElementsByName("detail_config_valeur")[0].disabled = false; + document.getElementsByName("detail_config_valeur")[0].style.backgroundColor = "#FFFFFF"; + } + + } + + function Disable_Config_DetailFields() { + + setconfig_data_edit_mode("0"); + + if (document.getElementsByName("detail_config_point")[0]) { + + document.getElementsByName("detail_config_point")[0].disabled = true; + document.getElementsByName("detail_config_point")[0].style.backgroundColor = "#ECEFF1"; + } + + if (document.getElementsByName("detail_config_valeur")[0]) { + document.getElementsByName("detail_config_valeur")[0].disabled = true; + document.getElementsByName("detail_config_valeur")[0].style.backgroundColor = "#ECEFF1"; + } + + } + + const [Update_One_Config_Data_api, setUpdate_One_Config_Data_api] = useState(); + const [Update_One_Config_Data_message, setUpdate_One_Config_Data_message] = useState(); + const [Update_One_Config_Data_result, setUpdate_One_Config_Data_result] = useState(); + function Update_One_Config_Data() { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("config_name", p_detail_config_point); + form.append("config_value", p_detail_config_valeur); + + console.log(" form == ", form); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Update_Partner_Basic_Setup/"; + + + axios.post(myurl, form).then(res => { + //console.log(" In Update_One_Config_Data res.data.status = " + res.data.status); + //console.log(" In Update_One_Config_Data res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + setUpdate_One_Config_Data_api("true"); + setUpdate_One_Config_Data_result(res.data.message); + + Getall_Parter_config_Points(); + + setp_detail_config_valeur(); + setp_detail_config_point(); + setConfig_data_changed(); + setconfig_data_edit_mode(); + setdisplay_detail_config(); + + alert(res.data.message); + if (myRef_head) + myRef_head.current.scrollIntoView({ behavior: "smooth" }); + + } + else { + setUpdate_One_Config_Data_api("false"); + setUpdate_One_Config_Data_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + + console.warn('UpdateStagiaireData : Not good man :( Update_One_Config_Data = ' + error); + setUpdate_One_Config_Data_api("false"); + alert(" Impossible de mettre à jour le paramétrage "); + + }) + } + + return (
{isLoading &&
@@ -523,11 +642,11 @@ const Partner_Configuration_Technique = (props) => { } > - Brouillon    - En cours   - Traité   - - Annulé   + tva + smtp_server   + smtp_user   + smtp_user_pwd   + smtp_count_from_name
} @@ -538,7 +657,7 @@ const Partner_Configuration_Technique = (props) => { required name="detail_config_point" id="detail_config_point" - + InputLabelProps={{ shrink: true, }} @@ -601,13 +720,13 @@ const Partner_Configuration_Technique = (props) => { {String(config_data_edit_mode) === "1" && String(Config_data_changed) === "1" &&
-
} {String(config_data_edit_mode) === "1" &&
-
}
@@ -615,7 +734,7 @@ const Partner_Configuration_Technique = (props) => { {String(config_data_edit_mode) !== "1" &&
-
} diff --git a/src/styles/components/partner_configuration_technique.scss b/src/styles/components/partner_configuration_technique.scss index 847dd0b..e039198 100644 --- a/src/styles/components/partner_configuration_technique.scss +++ b/src/styles/components/partner_configuration_technique.scss @@ -537,6 +537,7 @@ border-radius: 5px; background: white; border: solid gainsboro 1px; + padding-left: 5px !important; } @@ -700,6 +701,7 @@ border-radius: 5px; background: white; border: solid gainsboro 1px; + padding-left: 5px !important; } .training_caract { @@ -1294,6 +1296,7 @@ border-radius: 5px; background: white; border: solid gainsboro 1px; + padding-left: 5px !important; } .training_caract { @@ -1768,6 +1771,7 @@ border-radius: 5px; background: white; border: solid gainsboro 1px; + padding-left: 5px !important; } .disabled_style_Dialog { @@ -1781,6 +1785,7 @@ border-radius: 5px; background: white; border: solid gainsboro 1px; + padding-left: 5px !important; } .session_caract_Dialog {