Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
776 B
3
Indexable
Never
            row = $('*[data-id='+sku+']');
            quantity = Number(row.find('.quantity-label').html() || 0) + 1;
            if (row.length == 0) {
              new_row = "<tr class='nested-fields'><td class='item-selection'>"+data['sku']+"<input value="+data['id']+" type='hidden' name='sales_header[sales_details_attributes]["+sku+"][item_variant_pricelist_id]'></td></tr>";
              $('.sales_item_body').append(new_row);
            } else {
              row.find('.quantity-label').html(quantity);
              row.find('.quantity-field').val(quantity);
            }
            var sum = 0;

            $(".item-selection").each(function() {
                console.log($(this).val())
                sum += 1
            });
            console.log(sum)