confirm_payments.js.erb 514 B

123456789101112131415161718
  1. <% if @sale.present? %>
  2. $("#notice").html("<%= flash[:notice] %>");
  3. $.ajax({
  4. type: "get",
  5. url: '<%= print_receipt_path(@sale.id) %>',
  6. dataType: 'script'
  7. });
  8. window.location = "<%= new_sale_path %>";
  9. <% elsif @products_return.present? %>
  10. window.location = "<%= products_returns_path %>";
  11. $("#notice").html("<%= flash[:notice] %>");
  12. var ticket_window = window.open("<%= print_return_receipt_path(@products_return.id, format: 'pdf') %>", 'New tab', '' );
  13. ticket_window.print();
  14. <% end %>