Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2f4be233

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

  • ID 2f4be233a84f6238e5711b4529b699be5aa9e3b2
  • Vorgänger 0020c077
  • Nachfolger 96032e41

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