mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-07 22:46:06 +00:00
update the invoice number rendering
This commit is contained in:
committed by
Sigmund Petersen
parent
41d5ca7861
commit
fea910f8b6
@@ -26,4 +26,8 @@ class Invoice < ApplicationRecord
|
||||
def cancel_previous_invoices
|
||||
order.invoices.where.not(id:).update_all(cancelled: true)
|
||||
end
|
||||
|
||||
def display_number
|
||||
"#{order.distributor.id}-#{number}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,8 +5,8 @@ class Invoice
|
||||
include ::ActionView::Helpers::NumberHelper
|
||||
attr_reader :invoice
|
||||
|
||||
delegate :data, to: :invoice
|
||||
delegate :number, :date, to: :invoice, prefix: true
|
||||
delegate :display_number, :data, to: :invoice
|
||||
delegate :date, to: :invoice, prefix: true
|
||||
|
||||
FINALIZED_NON_SUCCESSFUL_STATES = %w(canceled returned).freeze
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
%td.align-center.created_at
|
||||
= invoice.presenter.display_date
|
||||
%td.align-center.label
|
||||
= invoice.number
|
||||
= invoice.display_number
|
||||
%td.align-center.label
|
||||
= invoice.presenter.total
|
||||
%td.align-center.label
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
%td{ :align => "left" }
|
||||
%br
|
||||
= "#{t :invoice_number}:"
|
||||
= @order.invoice_number
|
||||
= @order.display_number
|
||||
%br
|
||||
= t :invoice_issued_on
|
||||
= l @order.invoice_date
|
||||
|
||||
Reference in New Issue
Block a user