<% if @pre_sale.errors.values.any? %> $("#error_explanation").empty(); $('#error_explanation').removeClass('hidden'); $("#error_explanation").append($("
")); <% @pre_sale.errors.values.each do |message| %> $("#error_explanation div").append($("
  • ").html("<%= message.first.to_s %>")); toastr["error"]("<%= message.first.to_s %>"); <% end %> <% elsif defined? @pre_sale %> if($("#error_explanation_move").is(':visible')) { $("#error_explanation_move").addClass('hidden'); } var table = $('#products_table').DataTable(); var newRow = $('<%= j render (@pre_sale) %>'); x = $('#products_table').dataTable(); newRow.find('td:eq(0)').html(newRow.find('td:eq(0)').html().replace('#', x.fnGetData().length + 1)); table.row.add(newRow).draw(); //bloquear el agregar cliente para mantener congruencia $('#customer_remote').removeAttr("href"); $('#customer_remote').attr("disabled", true); <% else %> toastr["error"]("Error, No se encontrĂ³ el producto."); <% end %>