Commit 6ca90bec by François C.

Merge branch '#1925-ACL-multiple-down-key-cause-error' into 'dev_cooperatic'

1925 pressing multiple times on down arrow throw js error

See merge request !111
parents 46d9ed42 83db0aad
Pipeline #1746 passed with stage
in 1 minute 35 seconds
......@@ -29,7 +29,7 @@ var dbc = null,
var clicked_order_pill = null;
var timerId
/* - UTILS */
/**
......@@ -116,6 +116,11 @@ function _compute_stats_date_from() {
return val;
}
function debounceFunction(func, delay = 1000) {
clearTimeout(timerId)
timerId = setTimeout(func, delay)
}
/* - PRODUCTS */
/**
......@@ -165,7 +170,7 @@ function add_product() {
res.default_code = ' ';
products.unshift(res);
update_main_screen({'sort_order_dir':'desc'});
update_cdb_order();
debounceFunction(update_cdb_order);
} else {
alert("L'article n'a pas toutes les caractéristiques pour être ajouté.");
}
......@@ -346,7 +351,7 @@ function update_product_ref(input_el, p_id, p_index) {
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
success: () => {
update_cdb_order();
debounceFunction(update_cdb_order);
$(".actions_buttons_area .right_action_buttons").notify(
"Référence sauvegardée !",
......@@ -424,7 +429,7 @@ function add_supplier() {
save_supplier_products(supplier, data.res.products);
update_main_screen();
$("#supplier_input").val("");
update_cdb_order();
debounceFunction(update_cdb_order);
closeModal();
},
error: function(data) {
......@@ -460,7 +465,7 @@ function remove_supplier(supplier_id) {
products = products.filter(product => product.suppliersinfo.length > 0);
update_main_screen();
update_cdb_order();
debounceFunction(update_cdb_order);
}
......@@ -527,7 +532,7 @@ function save_supplier_product_association(product, supplier, cell) {
products_table.row(row).data(new_row_data)
.draw();
update_cdb_order();
debounceFunction(update_cdb_order);
closeModal();
},
error: function(data) {
......@@ -581,7 +586,7 @@ function end_supplier_product_association(product, supplier) {
// Update table
display_products();
update_cdb_order();
debounceFunction(update_cdb_order);
closeModal();
},
error: function(data) {
......@@ -716,6 +721,8 @@ function save_products_npa_minimal_stock(product, inputs) {
if (actions.npa.length > 0) {
// Remove NPA products
products.splice(index, 1);
update_main_screen();
debounceFunction(update_cdb_order);
}
check_products_data()
......@@ -1166,7 +1173,7 @@ function goto_main_screen(doc) {
check_products_data()
.then(() => {
update_cdb_order();
debounceFunction(update_cdb_order);
update_main_screen();
switch_screen();
});
......@@ -1612,7 +1619,7 @@ function display_products(params) {
products_table.row($(this).closest('tr')).data(new_row_data)
.draw();
update_cdb_order();
debounceFunction(update_cdb_order);
display_total_values();
} else {
$(this).val('');
......@@ -2106,7 +2113,7 @@ $(document).ready(function() {
if (!isNaN(val)) {
order_doc.coverage_days = val;
compute_products_coverage_qties();
update_cdb_order();
debounceFunction(update_cdb_order);
update_main_screen();
} else {
$("#coverage_days_input").val(order_doc.coverage_days);
......@@ -2166,7 +2173,7 @@ $(document).ready(function() {
.then(() => {
compute_products_coverage_qties();
update_main_screen();
update_cdb_order();
debounceFunction(update_cdb_order);
closeModal();
});
}
......@@ -2183,7 +2190,7 @@ $(document).ready(function() {
openModal();
check_products_data()
.then(() => {
update_cdb_order();
debounceFunction(update_cdb_order);
update_main_screen();
$("#toggle_action_buttons").click();
closeModal();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment