Commit d53e7003 by Damien Moulard

Merge branch '1989-refresh-order-after-action' into 'dev_cooperatic'

refresh order data after action

See merge request !110
parents beada0b2 412f96f7
Pipeline #1739 passed with stage
in 1 minute 36 seconds
...@@ -700,6 +700,8 @@ function save_products_npa_minimal_stock(product, inputs) { ...@@ -700,6 +700,8 @@ function save_products_npa_minimal_stock(product, inputs) {
actions.minimal_stock = input.val() actions.minimal_stock = input.val()
} }
}); });
openModal();
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/products/update_npa_and_minimal_stock", url: "/products/update_npa_and_minimal_stock",
...@@ -710,6 +712,18 @@ function save_products_npa_minimal_stock(product, inputs) { ...@@ -710,6 +712,18 @@ function save_products_npa_minimal_stock(product, inputs) {
success: () => { success: () => {
const index = products.findIndex(p => p.id == product.id); const index = products.findIndex(p => p.id == product.id);
products[index].minimal_stock = actions.minimal_stock;
if (actions.npa.length > 0) {
// Remove NPA products
products.splice(index, 1);
}
check_products_data()
.then(() => {
update_cdb_order();
update_main_screen();
closeModal();
// Give time for modal to fade // Give time for modal to fade
setTimeout(function() { setTimeout(function() {
$(".actions_buttons_area .right_action_buttons").notify( $(".actions_buttons_area .right_action_buttons").notify(
...@@ -721,15 +735,7 @@ function save_products_npa_minimal_stock(product, inputs) { ...@@ -721,15 +735,7 @@ function save_products_npa_minimal_stock(product, inputs) {
} }
); );
}, 500); }, 500);
products[index].minimal_stock = actions.minimal_stock; });
if (actions.npa.length > 0) {
// Remove NPA products
products.splice(index, 1);
update_main_screen();
update_cdb_order();
}
closeModal();
}, },
error: function(data) { error: function(data) {
let msg = "erreur serveur lors de la sauvegarde". let msg = "erreur serveur lors de la sauvegarde".
......
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