// var table = $('#change_for_product_table').DataTable();

//  var data = table.rows().each(function () {
//      console.log($(this).attr('id'));
//  });

$('#change_for_product_table tbody tr').each(function() {
  trTxt = $(this).attr('id');
  id = parseInt(trTxt.substring(trTxt.lastIndexOf('_') + 1, trTxt.length));
  if (id == <%= @product_for_return.id %>) {
    //iva
    $(this).find('td:eq(6)').text("<%= number_to_currency(@object_totals['tax'], precision: 2) %>");
    //discount
    $(this).find('td:eq(7)').text("<%= number_to_currency(@object_totals['discount'], precision: 2) %>");
    //total
    text = "<%= number_to_currency(@object_totals['total'], precision: 2) %>" + "<input type='hidden' name='total' id='total' value=" + <%= @object_totals['total'] %> + ">"
    $(this).find('td:eq(8)').html(text);

    $(this).find(".hagglebutton").addClass("disabled").click(function(e){ e.preventDefault();});
  }
});
$('#dialog').modal('toggle');
calculateTotals();
