Remove print ticket action

This commit is contained in:
Ana Nunes da Silva
2023-02-10 17:45:04 +00:00
parent 9ea9ac99f9
commit 8dc50caaa8
3 changed files with 1 additions and 83 deletions

View File

@@ -9,15 +9,13 @@ module Spree
helper CheckoutHelper
before_action :load_order, only: [:edit, :update, :fire, :resend,
:invoice, :print, :print_ticket]
:invoice, :print]
before_action :load_distribution_choices, only: [:new, :edit, :update]
# Ensure that the distributor is set for an order when
before_action :ensure_distribution, only: :new
before_action :require_distributor_abn, only: :invoice
content_security_policy false, only: :print_ticket
respond_to :html, :json
def new
@@ -117,10 +115,6 @@ module Spree
render_with_wicked_pdf InvoiceRenderer.new.args(@order)
end
def print_ticket
render template: "spree/admin/orders/ticket", layout: false
end
private
def order_params

View File

@@ -1,75 +0,0 @@
!!! Basic
%html
%head
<meta content="text/html;charset=ansi" http-equiv="Content-Type">
= javascript_include_tag "shared/jquery-1.8.0.js"
= javascript_include_tag "qz/qz-tray.js"
= javascript_include_tag "qz/sha-256.min.js"
= javascript_include_tag "qz/rsvp-3.1.0.min.js"
= javascript_include_tag "qz/jsrsasign-latest-all-min.js"
:javascript
var printData = [
'\x1B' + '\x40', // init
'\x1B' + '\x74' + '\x10',
'\x1B' + '\x61' + '\x31', // center align
'\x1B' + '\x21' + '\x30', // em mode on
'#{j(@order.distributor.name)}' + '\x0A',
'\x1B' + '\x21' + '\x0A' + '\x1B' + '\x45' + '\x0A', // em mode off
'\x0A',
'#{j(@order.distributor.address.address_part1)}' + '\x0A', // text and line break
'#{j(@order.distributor.address.address_part2)}' + '\x0A',
'#{j(@order.distributor.contact.email)}' + '\x0A',
'\x0A', // line break
'\x1B' + '\x61' + '\x32', // right align
'#{j(l(Time.zone.now.to_date))}' + '\x0A',
'#{j(@order.number)}' + '\x0A',
'\x1B' + '\x61' + '\x30', // left align
'\x0A',
'\x1B' + '\x4D' + '\x31', // small text
"#{'%6s %-26s%10s%10s' %
[j(t(:ticket_column_qty)),
j(t(:ticket_column_item)),
j(t(:ticket_column_unit_price)),
j(t(:ticket_column_total_price))]}",
'\x0A',
'\x1B' + '\x4D' + '\x30', // normal text
'__________________________________________' + '\x0A',
"#{@order.line_items
.sort_by{ |line_item| line_item.product.name }
.map { |line_item| '%5d %-19.19s%8.8s%8.8s' %
[line_item.quantity,
j(line_item.product.name),
j(line_item.single_display_amount_with_adjustments.format(symbol: false, with_currency: false)),
j(line_item.display_amount_with_adjustments.format(symbol: false, with_currency: false))] }
.join('" + \'\x0A\' + "')}",
'\x0A',
"#{checkout_adjustments_for(@order, exclude: [:line_item], reject_zero_amount: false)
.reject{ |a| a.amount == 0 }
.reverse.map { |adjustment| '%5s %-27.27s%8.8s' %
["",
j(raw(adjustment.label)),
j(display_adjustment_amount(adjustment).format(symbol: false, with_currency: false))] +
'" + \'\x0A\' + "'}.join }",
'__________________________________________' + '\x0A',
'\x0A',
'\x1B' + '\x45' + '\x0D', // bold on
"#{'%31s%10s' %
[j(t(:total_incl_tax)),
j(@order.display_total.format(with_currency: false))]}",
'\x1B' + '\x45' + '\x0A', // bold off
'\x0A',
"#{display_checkout_taxes_hash(@order).map { |tax|
'%31s%10s' %
[j(t(:tax_total, rate: tax[:percentage])),
j(tax[:amount].format(with_currency: false))] +
'" + \'\x0A\' + "'}.join }",
"#{'%31s%10s' %
[j(t(:total_excl_tax)),
j(display_checkout_total_less_tax(@order).format(with_currency: false))]}",
'\x0A',
'\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A' + '\x0A',
'\x1B' + '\x69', // cut paper
];
= javascript_include_tag "qz/ticket-popup.js"
%body
%div#printer-list

View File

@@ -88,7 +88,6 @@ Spree::Core::Engine.routes.draw do
post :resend
get :invoice
get :print
get :print_ticket
end
collection do