Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 18a627a6

Von Sven Schöling vor fast 3 Jahren hinzugefügt

  • ID 18a627a60525c399009c39b4e6ce7cf5ade46a87
  • Vorgänger 8496b280
  • Nachfolger 241a16d8

DeliveryOrder: serialize stock to yaml

Unterschiede anzeigen:

js/kivi.DeliveryOrder.js
84 84
    $row.uniqueId();
85 85

  
86 86
    kivi.popup_dialog({
87
      id: "stock_in_out",
87
      id: "stock_in_out_dialog",
88 88
      url: "controller.pl?action=DeliveryOrder/stock_in_out_dialog",
89 89
      data: {
90 90
        id:            $("#id").val(),
......
100 100
    });
101 101
  };
102 102

  
103
  ns.save_updated_stock = function() {
104
    // stock information is saved in DOM as a yaml dump.
105
    // we don't want to do this in javascript so we do a tiny roundtrip to the backend
106

  
107
    let data = [];
108
    $("#stock-in-out-table tr.listrow").each((i,row) => {
109
      data.push({
110
        qty:         kivi.parse_amount($(row).find(".data-qty").val()),
111
        warehouse_id:                  $(row).find(".data-warehouse-id").val(),
112
        bin_id:                        $(row).find(".data-bin-id").val(),
113
        chargenumber:                  $(row).find(".data-chargenumber").val(),
114
        bestbefore:                    $(row).find(".data-bestbefore").val(),
115
        unit:                          $(row).find(".data-unit").val(),
116
        delivery_order_items_stock_id: $(row).find(".data-stock-id").val(),
117
      });
118
    });
119

  
120
    let row = $(".data-row").val();
121

  
122
    $.post("controller.pl", kivi.serialize({
123
        action: "DeliveryOrder/pack_stock_information",
124
        stock_info: data
125
      }),
126
      (data) => {
127
        $("[name=stock_info_" + row + "]").val(data);
128
        $("#stock_in_out_dialog").dialog("close");
129
      }
130
    );
131
  };
132

  
103 133
  ns.print = function() {
104 134
    $('#print_options').dialog('close');
105 135

  

Auch abrufbar als: Unified diff