mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Rename @invoice_presenter instance variable to @order in invoice templates
This commit is contained in:
@@ -100,9 +100,9 @@ module Spree
|
||||
|
||||
def print
|
||||
if OpenFoodNetwork::FeatureToggle.enabled?(:invoices)
|
||||
@invoice = @order.invoices.find(params[:invoice_id])
|
||||
@invoice_presenter = @invoice.presenter
|
||||
@order = @order.invoices.find(params[:invoice_id]).presenter
|
||||
end
|
||||
|
||||
render_with_wicked_pdf InvoiceRenderer.new.args(@order)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%p.callout{style: "margin-top: 30px"}
|
||||
%strong= t :additional_information
|
||||
%p{style: "margin: 5px"}
|
||||
= @invoice_presenter.note
|
||||
= @order.note
|
||||
@@ -1,20 +1,20 @@
|
||||
%p.callout
|
||||
%span{:style => "float:right;"}
|
||||
- if @invoice_presenter.outstanding_balance?
|
||||
= @invoice_presenter.outstanding_balance_label
|
||||
- if @order.outstanding_balance?
|
||||
= @order.outstanding_balance_label
|
||||
\:
|
||||
%strong= @invoice_presenter.display_outstanding_balance
|
||||
%strong= @order.display_outstanding_balance
|
||||
- else
|
||||
- if @invoice_presenter.paid?
|
||||
- if @order.paid?
|
||||
= t :email_payment_paid
|
||||
- else
|
||||
= t :email_payment_not_paid
|
||||
%strong
|
||||
= t :email_payment_summary
|
||||
- if @invoice_presenter.payments.any?
|
||||
= render partial: 'spree/admin/orders/_invoice/payments_list', locals: { payments: @invoice_presenter.payments }
|
||||
- if @invoice_presenter.last_payment_method
|
||||
- if @order.payments.any?
|
||||
= render partial: 'spree/admin/orders/_invoice/payments_list', locals: { payments: @order.payments }
|
||||
- if @order.last_payment_method
|
||||
%p.callout{style: "margin-top: 40px"}
|
||||
%strong
|
||||
= t :email_payment_description
|
||||
%p{style: "margin: 5px"}= @invoice_presenter.last_payment_method.description
|
||||
%p{style: "margin: 5px"}= @order.last_payment_method.description
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
%th{:align => "right", :width => "15%"}
|
||||
%h4= t(:invoice_column_qty)
|
||||
%th{:align => "right", :width => "15%"}
|
||||
%h4= @invoice_presenter.total_tax > 0 ? t(:invoice_column_tax) : ""
|
||||
%h4= @order.total_tax > 0 ? t(:invoice_column_tax) : ""
|
||||
%th{:align => "right", :width => "15%"}
|
||||
%h4= t(:invoice_column_price)
|
||||
%tbody
|
||||
- @invoice_presenter.sorted_line_items.each do |item|
|
||||
- @order.sorted_line_items.each do |item|
|
||||
%tr
|
||||
%td
|
||||
= render 'spree/admin/orders/_invoice/line_item_name', line_item: item
|
||||
@@ -24,7 +24,7 @@
|
||||
%td{:align => "right"}
|
||||
= item.display_amount_with_adjustments
|
||||
|
||||
- @invoice_presenter.checkout_adjustments(exclude: [:line_item]).reverse_each do |adjustment|
|
||||
- @order.checkout_adjustments(exclude: [:line_item]).reverse_each do |adjustment|
|
||||
- taxable = adjustment#.adjustable_type == "Spree::Shipment" ? adjustment.adjustable : adjustment
|
||||
%tr
|
||||
%td
|
||||
@@ -40,16 +40,16 @@
|
||||
%td{:align => "right", :colspan => "2"}
|
||||
%strong= t(:invoice_tax_total)
|
||||
%td{:align => "right", :colspan => "2"}
|
||||
%strong= @invoice_presenter.display_checkout_tax_total
|
||||
%strong= @order.display_checkout_tax_total
|
||||
%tr
|
||||
%td{:align => "right", :colspan => "2"}
|
||||
%strong= t(:total_excl_tax)
|
||||
%td{:align => "right", :colspan => "2"}
|
||||
%strong= @invoice_presenter.display_checkout_total_less_tax
|
||||
%strong= @order.display_checkout_total_less_tax
|
||||
%tr
|
||||
%td{:align => "right", :colspan => "2"}
|
||||
%strong= t(:total_incl_tax)
|
||||
%td{:align => "right", :colspan => "2"}
|
||||
%strong= @invoice_presenter.display_total
|
||||
%strong= @order.display_total
|
||||
%p
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
%th{:align => "right", :width => "15%"}
|
||||
%h5= t(:invoice_column_qty)
|
||||
%th{:align => "right", :width => "15%"}
|
||||
%h5= @invoice_presenter.has_taxes_included ? t(:invoice_column_unit_price_with_taxes) : t(:invoice_column_unit_price_without_taxes)
|
||||
%h5= @order.has_taxes_included ? t(:invoice_column_unit_price_with_taxes) : t(:invoice_column_unit_price_without_taxes)
|
||||
%th{:align => "right", :width => "15%"}
|
||||
%h5= @invoice_presenter.has_taxes_included ? t(:invoice_column_price_with_taxes) : t(:invoice_column_price_without_taxes)
|
||||
- if @invoice_presenter.total_tax > 0
|
||||
%h5= @order.has_taxes_included ? t(:invoice_column_price_with_taxes) : t(:invoice_column_price_without_taxes)
|
||||
- if @order.total_tax > 0
|
||||
%th{:align => "right", :width => "15%"}
|
||||
%h5= t(:invoice_column_tax_rate)
|
||||
%tbody
|
||||
- @invoice_presenter.sorted_line_items.each do |item|
|
||||
- @order.sorted_line_items.each do |item|
|
||||
%tr
|
||||
%td
|
||||
= render 'spree/admin/orders/_invoice/line_item_name', line_item: item
|
||||
@@ -26,11 +26,11 @@
|
||||
= item.single_display_amount_with_adjustments
|
||||
%td{:align => "right"}
|
||||
= item.display_amount_with_adjustments
|
||||
- if @invoice_presenter.total_tax > 0
|
||||
- if @order.total_tax > 0
|
||||
%td{:align => "right"}
|
||||
= display_line_item_tax_rates(item)
|
||||
|
||||
- @invoice_presenter.checkout_adjustments(exclude: [:line_item]).reverse_each do |adjustment|
|
||||
- @order.checkout_adjustments(exclude: [:line_item]).reverse_each do |adjustment|
|
||||
%tr
|
||||
%td
|
||||
%strong= "#{raw(adjustment.label)}"
|
||||
@@ -38,16 +38,16 @@
|
||||
%td{:align => "right"}
|
||||
%td{:align => "right"}
|
||||
= adjustment.display_amount
|
||||
- if @invoice_presenter.total_tax > 0
|
||||
- if @order.total_tax > 0
|
||||
%td{:align => "right"}
|
||||
= display_adjustment_tax_rates(adjustment)
|
||||
%tfoot
|
||||
%tr
|
||||
%td{:align => "right", :colspan => "3"}
|
||||
%strong= @invoice_presenter.has_taxes_included ? t(:total_incl_tax) : t(:total_excl_tax)
|
||||
%strong= @order.has_taxes_included ? t(:total_incl_tax) : t(:total_excl_tax)
|
||||
%td{:align => "right", :colspan => "2"}
|
||||
%strong= @invoice_presenter.has_taxes_included ? @invoice_presenter.display_total : @invoice_presenter.display_checkout_total_less_tax
|
||||
- @invoice_presenter.display_checkout_taxes_hash.each do |tax|
|
||||
%strong= @order.has_taxes_included ? @order.display_total : @order.display_checkout_total_less_tax
|
||||
- @order.display_checkout_taxes_hash.each do |tax|
|
||||
%tr
|
||||
%td{:align => "right", :colspan => "3"}
|
||||
= t(:tax_total, rate: tax[:percentage])
|
||||
@@ -55,8 +55,8 @@
|
||||
= tax[:amount]
|
||||
%tr
|
||||
%td{:align => "right", :colspan => "3"}
|
||||
= @invoice_presenter.has_taxes_included ? t(:total_excl_tax) : t(:total_incl_tax)
|
||||
= @order.has_taxes_included ? t(:total_excl_tax) : t(:total_incl_tax)
|
||||
%td{:align => "right", :colspan => "2"}
|
||||
= @invoice_presenter.has_taxes_included ? @invoice_presenter.display_checkout_total_less_tax : @invoice_presenter.display_total
|
||||
= @order.has_taxes_included ? @order.display_checkout_total_less_tax : @order.display_total
|
||||
%p
|
||||
|
||||
|
||||
@@ -6,32 +6,32 @@
|
||||
%td{ :align => "left", colspan: 3 }
|
||||
%h6
|
||||
= "#{t('spree.admin.orders.invoice.issued_on')}: "
|
||||
= l @invoice_presenter.invoice_date
|
||||
= l @order.invoice_date
|
||||
%tr{ valign: "top" }
|
||||
%td{ :align => "left" }
|
||||
%h4
|
||||
= "#{t('spree.admin.orders.invoice.tax_invoice')}: "
|
||||
= "#{@invoice_presenter.number}"
|
||||
= "#{@order.number}"
|
||||
%td{width: "10%" }
|
||||
|
||||
%td{ :align => "right" }
|
||||
%h4= @invoice_presenter.order_cycle.name
|
||||
%h4= @order.order_cycle.name
|
||||
%tr{ valign: "top" }
|
||||
%td{ align: "left", colspan: 3 }
|
||||
- if @invoice_presenter.distributor.business_address.blank?
|
||||
%strong= "#{t('spree.admin.orders.invoice.from')}: #{@invoice_presenter.distributor.name}"
|
||||
- if @order.distributor.business_address.blank?
|
||||
%strong= "#{t('spree.admin.orders.invoice.from')}: #{@order.distributor.name}"
|
||||
- else
|
||||
%strong= "#{t('spree.admin.orders.invoice.from')}: #{@invoice_presenter.distributor.business_address.company}"
|
||||
- if @invoice_presenter.distributor.abn.present?
|
||||
%strong= "#{t('spree.admin.orders.invoice.from')}: #{@order.distributor.business_address.company}"
|
||||
- if @order.distributor.abn.present?
|
||||
%br
|
||||
= "#{t(:abn)} #{@invoice_presenter.distributor.abn}"
|
||||
= "#{t(:abn)} #{@order.distributor.abn}"
|
||||
%br
|
||||
- if @invoice_presenter.distributor.business_address.blank?
|
||||
= @invoice_presenter.distributor.address.full_address
|
||||
- if @order.distributor.business_address.blank?
|
||||
= @order.distributor.address.full_address
|
||||
- else
|
||||
= @invoice_presenter.distributor.business_address.full_address
|
||||
= @order.distributor.business_address.full_address
|
||||
%br
|
||||
= @invoice_presenter.distributor.contact.email
|
||||
= @order.distributor.contact.email
|
||||
%tr{ valign: "top" }
|
||||
%td{ colspan: 3 }
|
||||
|
||||
@@ -39,44 +39,44 @@
|
||||
%td{ align: "left" }
|
||||
%strong= "#{t('spree.admin.orders.invoice.to')}:"
|
||||
%br
|
||||
- if @invoice_presenter.bill_address
|
||||
= @invoice_presenter.bill_address.full_name
|
||||
- if @invoice_presenter.customer.code.present?
|
||||
- if @order.bill_address
|
||||
= @order.bill_address.full_name
|
||||
- if @order.customer.code.present?
|
||||
%br
|
||||
= "#{t('spree.admin.orders.invoice.code')}: #{@invoice_presenter.customer.code}"
|
||||
= "#{t('spree.admin.orders.invoice.code')}: #{@order.customer.code}"
|
||||
%br
|
||||
- if @invoice_presenter.bill_address
|
||||
= @invoice_presenter.bill_address.full_address
|
||||
- if @order.bill_address
|
||||
= @order.bill_address.full_address
|
||||
%br
|
||||
- if @invoice_presenter.customer.email.present?
|
||||
= "#{@invoice_presenter.customer.email},"
|
||||
- if @invoice_presenter.bill_address
|
||||
= "#{@invoice_presenter.bill_address.phone}"
|
||||
- if @order.customer.email.present?
|
||||
= "#{@order.customer.email},"
|
||||
- if @order.bill_address
|
||||
= "#{@order.bill_address.phone}"
|
||||
%td
|
||||
|
||||
%td{ align: "left", style: "border-left: .1em solid black; padding-left: 1em" }
|
||||
%strong= "#{t('spree.admin.orders.invoice.shipping')}: #{@invoice_presenter.shipping_method.name}"
|
||||
- if @invoice_presenter.shipping_method.require_ship_address
|
||||
%strong= "#{t('spree.admin.orders.invoice.shipping')}: #{@order.shipping_method.name}"
|
||||
- if @order.shipping_method.require_ship_address
|
||||
%br
|
||||
= @invoice_presenter.ship_address.full_name
|
||||
= @order.ship_address.full_name
|
||||
%br
|
||||
= @invoice_presenter.ship_address.full_address
|
||||
= @order.ship_address.full_address
|
||||
%br
|
||||
= @invoice_presenter.ship_address.phone
|
||||
- if @invoice_presenter.special_instructions.present?
|
||||
= @order.ship_address.phone
|
||||
- if @order.special_instructions.present?
|
||||
%br
|
||||
%br
|
||||
%strong= t :customer_instructions
|
||||
= @invoice_presenter.special_instructions
|
||||
= @order.special_instructions
|
||||
|
||||
|
||||
= render 'spree/admin/orders/invoice_table3'
|
||||
|
||||
- if @invoice_presenter.distributor.invoice_text.present?
|
||||
- if @order.distributor.invoice_text.present?
|
||||
%p
|
||||
= @invoice_presenter.distributor.invoice_text
|
||||
= @order.distributor.invoice_text
|
||||
|
||||
= render 'spree/admin/orders/_invoice/payment'
|
||||
|
||||
- if @invoice_presenter.note.present?
|
||||
- if @order.note.present?
|
||||
= render partial: 'spree/admin/orders/_invoice/order_note'
|
||||
|
||||
@@ -6,89 +6,89 @@
|
||||
%td{ :align => "left" }
|
||||
%h4
|
||||
= t :tax_invoice
|
||||
- if @invoice_presenter.distributor.display_invoice_logo? && @invoice_presenter.distributor.logo_url
|
||||
- if @order.distributor.display_invoice_logo? && @order.distributor.logo_url
|
||||
%td{ :align => "right", rowspan: 2 }
|
||||
= wicked_pdf_image_tag @invoice_presenter.distributor.logo_url
|
||||
= wicked_pdf_image_tag @order.distributor.logo_url
|
||||
%tr{ valign: "top" }
|
||||
%td{ :align => "left" }
|
||||
- if @invoice_presenter.distributor.business_address.blank?
|
||||
%strong= @invoice_presenter.distributor.name
|
||||
- if @order.distributor.business_address.blank?
|
||||
%strong= @order.distributor.name
|
||||
%br
|
||||
= @invoice_presenter.distributor.address.address_part1
|
||||
= @order.distributor.address.address_part1
|
||||
%br
|
||||
= @invoice_presenter.distributor.address.address_part2
|
||||
= @order.distributor.address.address_part2
|
||||
%br
|
||||
= @invoice_presenter.distributor.email_address
|
||||
- if @invoice_presenter.distributor.phone.present?
|
||||
= @order.distributor.email_address
|
||||
- if @order.distributor.phone.present?
|
||||
%br
|
||||
= @invoice_presenter.distributor.phone
|
||||
= @order.distributor.phone
|
||||
- else
|
||||
%strong= @invoice_presenter.distributor.business_address.company
|
||||
%strong= @order.distributor.business_address.company
|
||||
%br
|
||||
= @invoice_presenter.distributor.business_address.address_part1
|
||||
= @order.distributor.business_address.address_part1
|
||||
%br
|
||||
= @invoice_presenter.distributor.business_address.address_part2
|
||||
= @order.distributor.business_address.address_part2
|
||||
%br
|
||||
= @invoice_presenter.distributor.email_address
|
||||
- if @invoice_presenter.distributor.business_address.phone.present?
|
||||
= @order.distributor.email_address
|
||||
- if @order.distributor.business_address.phone.present?
|
||||
%br
|
||||
= @invoice_presenter.distributor.business_address.phone
|
||||
- if @invoice_presenter.distributor.abn.present?
|
||||
= @order.distributor.business_address.phone
|
||||
- if @order.distributor.abn.present?
|
||||
%br
|
||||
= "#{t :abn} #{@invoice_presenter.distributor.abn}"
|
||||
- if @invoice_presenter.distributor.acn.present?
|
||||
= "#{t :abn} #{@order.distributor.abn}"
|
||||
- if @order.distributor.acn.present?
|
||||
%br
|
||||
= "#{t :acn} #{@invoice_presenter.distributor.acn}"
|
||||
= "#{t :acn} #{@order.distributor.acn}"
|
||||
%tr{ valign: "top" }
|
||||
%td{ :align => "left", colspan: 2 }
|
||||
%tr{ valign: "top" }
|
||||
%td{ :align => "left" }
|
||||
%br
|
||||
= t :invoice_issued_on
|
||||
= l @invoice_presenter.invoice_date
|
||||
= l @order.invoice_date
|
||||
%br
|
||||
= t :date_of_transaction
|
||||
= l @invoice_presenter.order_completed_at.to_date
|
||||
= l @order.order_completed_at.to_date
|
||||
%br
|
||||
= t :order_number
|
||||
= @invoice_presenter.number
|
||||
= @order.number
|
||||
%td{ :align => "right" }
|
||||
= t :invoice_billing_address
|
||||
%br
|
||||
- if @invoice_presenter.bill_address
|
||||
%strong= @invoice_presenter.bill_address.full_name
|
||||
- if @invoice_presenter&.customer&.code.present?
|
||||
- if @order.bill_address
|
||||
%strong= @order.bill_address.full_name
|
||||
- if @order&.customer&.code.present?
|
||||
%br
|
||||
= "Code: #{@invoice_presenter.customer.code}"
|
||||
= "Code: #{@order.customer.code}"
|
||||
%br
|
||||
- if @invoice_presenter.bill_address
|
||||
= @invoice_presenter.bill_address.address_part1
|
||||
- if @order.bill_address
|
||||
= @order.bill_address.address_part1
|
||||
%br
|
||||
- if @invoice_presenter.bill_address
|
||||
= @invoice_presenter.bill_address.address_part2
|
||||
- if @invoice_presenter.bill_address.phone.present?
|
||||
- if @order.bill_address
|
||||
= @order.bill_address.address_part2
|
||||
- if @order.bill_address.phone.present?
|
||||
%br
|
||||
= @invoice_presenter.bill_address.phone
|
||||
- if @invoice_presenter&.customer&.email.present?
|
||||
= @order.bill_address.phone
|
||||
- if @order&.customer&.email.present?
|
||||
%br
|
||||
= @invoice_presenter.customer.email
|
||||
= @order.customer.email
|
||||
|
||||
= render 'spree/admin/orders/invoice_table4'
|
||||
|
||||
- if @invoice_presenter.special_instructions.present?
|
||||
- if @order.special_instructions.present?
|
||||
%p.callout
|
||||
%strong
|
||||
= t :customer_instructions
|
||||
%p
|
||||
%em= @invoice_presenter.special_instructions
|
||||
%em= @order.special_instructions
|
||||
%p
|
||||
|
||||
|
||||
- if @invoice_presenter.distributor.invoice_text.present?
|
||||
- if @order.distributor.invoice_text.present?
|
||||
%p
|
||||
= @invoice_presenter.distributor.invoice_text
|
||||
= @order.distributor.invoice_text
|
||||
|
||||
= render 'spree/admin/orders/_invoice/payment'
|
||||
|
||||
- if @invoice_presenter.note.present?
|
||||
- if @order.note.present?
|
||||
= render partial: 'spree/admin/orders/_invoice/order_note'
|
||||
|
||||
Reference in New Issue
Block a user