$("#error_explanation").html("")
<% if @products_return.errors.any? %>
	$('#error_explanation').removeClass('hidden');
    <% @products_return.errors.values.each do |message| %>
        $("#error_explanation").append($("<li />").html("<%= message.first.to_s %>"));
    <% end %>
    window.scrollTo(0,0);
<% else %>
  window.location = "<%= products_returns_path %>";
  $("#notice").html("<%= flash[:notice] %>");
  var ticket_window = window.open("<%= print_return_receipt_path(@products_return.id, format: 'pdf') %>", 'New tab', '' );
  ticket_window.print();
<% end %>
