X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/8496b280c5142ead5a0c211f50865b32586d3b5c..18a627a60525c399009c39b4e6ce7cf5ade46a87:/js/kivi.DeliveryOrder.js?ds=sidebyside diff --git a/js/kivi.DeliveryOrder.js b/js/kivi.DeliveryOrder.js index f708413e9..d937a51ce 100644 --- a/js/kivi.DeliveryOrder.js +++ b/js/kivi.DeliveryOrder.js @@ -84,7 +84,7 @@ namespace('kivi.DeliveryOrder', function(ns) { $row.uniqueId(); kivi.popup_dialog({ - id: "stock_in_out", + id: "stock_in_out_dialog", url: "controller.pl?action=DeliveryOrder/stock_in_out_dialog", data: { id: $("#id").val(), @@ -100,6 +100,36 @@ namespace('kivi.DeliveryOrder', function(ns) { }); }; + ns.save_updated_stock = function() { + // stock information is saved in DOM as a yaml dump. + // we don't want to do this in javascript so we do a tiny roundtrip to the backend + + let data = []; + $("#stock-in-out-table tr.listrow").each((i,row) => { + data.push({ + qty: kivi.parse_amount($(row).find(".data-qty").val()), + warehouse_id: $(row).find(".data-warehouse-id").val(), + bin_id: $(row).find(".data-bin-id").val(), + chargenumber: $(row).find(".data-chargenumber").val(), + bestbefore: $(row).find(".data-bestbefore").val(), + unit: $(row).find(".data-unit").val(), + delivery_order_items_stock_id: $(row).find(".data-stock-id").val(), + }); + }); + + let row = $(".data-row").val(); + + $.post("controller.pl", kivi.serialize({ + action: "DeliveryOrder/pack_stock_information", + stock_info: data + }), + (data) => { + $("[name=stock_info_" + row + "]").val(data); + $("#stock_in_out_dialog").dialog("close"); + } + ); + }; + ns.print = function() { $('#print_options').dialog('close');