Commit 2d254598 by Damien Moulard

add loading for inventory

parent f58946f8
Pipeline #1136 passed with stage
in 1 minute 23 seconds
...@@ -586,6 +586,7 @@ function generate_inventory() { ...@@ -586,6 +586,7 @@ function generate_inventory() {
openModal( openModal(
modal_create_inventory.html(), modal_create_inventory.html(),
() => { () => {
$('#do_inventory').empty().append(`<i class="fas fa-spinner fa-spin"></i>`);
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/inventory/generate_inventory_list", url: "/inventory/generate_inventory_list",
...@@ -595,9 +596,10 @@ function generate_inventory() { ...@@ -595,9 +596,10 @@ function generate_inventory() {
data: JSON.stringify(data), data: JSON.stringify(data),
success: () => { success: () => {
unselect_all_rows(); unselect_all_rows();
// Give time for modal to fade // Give time for modal to fade
setTimeout(function() { setTimeout(function() {
$('#do_inventory').empty().append(`Faire un inventaire`);
$('#do_inventory').notify( $('#do_inventory').notify(
"Inventaire créé !", "Inventaire créé !",
{ {
...@@ -605,9 +607,10 @@ function generate_inventory() { ...@@ -605,9 +607,10 @@ function generate_inventory() {
className: "success" className: "success"
} }
); );
}, 500); }, 200);
}, },
error: function(data) { error: function(data) {
$('#do_inventory').empty().append(`Faire un inventaire`);
let msg = "erreur serveur lors de la création de l'inventaire". let msg = "erreur serveur lors de la création de l'inventaire".
err = {msg: msg, ctx: 'generate_inventory'}; err = {msg: msg, ctx: 'generate_inventory'};
...@@ -1478,6 +1481,7 @@ function update_main_screen(params) { ...@@ -1478,6 +1481,7 @@ function update_main_screen(params) {
return 0; return 0;
}); });
} }
$("#select_all_products_cb").prop("checked", false);
if (order_doc.coverage_days !== null) { if (order_doc.coverage_days !== null) {
$("#coverage_days_input").val(order_doc.coverage_days); $("#coverage_days_input").val(order_doc.coverage_days);
......
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