mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Show all payments, format unsuccessful payments grey, add 'invalid' translation.
This commit is contained in:
@@ -32,6 +32,13 @@
|
||||
.debit
|
||||
color: $clr-brick
|
||||
|
||||
.invalid
|
||||
color: $ofn-grey
|
||||
.credit
|
||||
color: $ofn-grey
|
||||
.debit
|
||||
color: $ofn-grey
|
||||
|
||||
.distributor-balance.paid
|
||||
visibility: hidden
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ Spree.user_class.class_eval do
|
||||
def orders_by_distributor
|
||||
# Remove uncompleted payments as these will not be reflected in order balance
|
||||
data_array = complete_orders_by_distributor.to_a
|
||||
remove_uncompleted_payments(data_array)
|
||||
remove_payments_in_checkout(data_array)
|
||||
data_array.sort! { |a, b| b.distributed_orders.length <=> a.distributed_orders.length }
|
||||
end
|
||||
|
||||
@@ -78,10 +78,10 @@ Spree.user_class.class_eval do
|
||||
end
|
||||
end
|
||||
|
||||
def remove_uncompleted_payments(enterprises)
|
||||
def remove_payments_in_checkout(enterprises)
|
||||
enterprises.each do |enterprise|
|
||||
enterprise.distributed_orders.each do |order|
|
||||
order.payments.keep_if { |payment| payment.state == "completed" }
|
||||
order.payments.keep_if { |payment| payment.state != "checkout" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Api
|
||||
class PaymentSerializer < ActiveModel::Serializer
|
||||
attributes :amount, :updated_at, :payment_method
|
||||
attributes :amount, :updated_at, :payment_method, :state
|
||||
def payment_method
|
||||
object.payment_method.name
|
||||
end
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
%td.order5.text-right{"ng-class" => "{'credit' : order.total < 0, 'debit' : order.total > 0, 'paid' : order.total == 0}","bo-text" => "order.total | localizeCurrency"}
|
||||
%td.order6.text-right.show-for-large-up{"ng-class" => "{'credit' : order.outstanding_balance < 0, 'debit' : order.outstanding_balance > 0, 'paid' : order.outstanding_balance == 0}", "bo-text" => "order.outstanding_balance | localizeCurrency"}
|
||||
%td.order7.text-right{"ng-class" => "{'credit' : order.running_balance < 0, 'debit' : order.running_balance > 0, 'paid' : order.running_balance == 0}", "bo-text" => "order.running_balance | localizeCurrency"}
|
||||
%tr.payment-row{"ng-repeat" => "payment in order.payments"}
|
||||
%td.order1= t :payment
|
||||
%tr.payment-row{"ng-repeat" => "payment in order.payments", "ng-class" => "{'invalid': payment.state != 'completed'}"}
|
||||
%td.order1{"bo-text" => "payment.payment_method"}
|
||||
%td.order2{"bo-text" => "payment.updated_at"}
|
||||
%td.order3.show-for-large-up{"bo-text" => "payment.payment_method"}
|
||||
%td.order3.show-for-large-up{"bo-text" => "'spree.payment_states.' + payment.state | t | capitalize"}
|
||||
%td.order4.show-for-large-up
|
||||
%td.order5.text-right{"ng-class" => "{'credit' : payment.amount > 0, 'debit' : payment.amount < 0, 'paid' : payment.amount == 0}","bo-text" => "payment.amount | localizeCurrency"}
|
||||
%td.order6.show-for-large-up
|
||||
|
||||
@@ -635,3 +635,34 @@ Please follow the instructions there to make your enterprise visible on the Open
|
||||
price_graph: "Price graph"
|
||||
included_tax: "Included tax"
|
||||
remove_tax: "Remove tax"
|
||||
spree:
|
||||
shipment_states:
|
||||
backorder: backorder
|
||||
partial: partial
|
||||
pending: pending
|
||||
ready: ready
|
||||
shipped: shipped
|
||||
payment_states:
|
||||
balance_due: balance due
|
||||
completed: completed
|
||||
checkout: checkout
|
||||
credit_owed: credit owed
|
||||
failed: failed
|
||||
paid: paid
|
||||
pending: pending
|
||||
processing: processing
|
||||
void: void
|
||||
invalid: invalid
|
||||
order_state:
|
||||
address: address
|
||||
adjustments: adjustments
|
||||
awaiting_return: awaiting return
|
||||
canceled: canceled
|
||||
cart: cart
|
||||
complete: complete
|
||||
confirm: confirm
|
||||
delivery: delivery
|
||||
payment: payment
|
||||
resumed: resumed
|
||||
returned: returned
|
||||
skrill: skrill
|
||||
|
||||
@@ -996,6 +996,7 @@ Please follow the instructions there to make your enterprise visible on the Open
|
||||
pending: pending
|
||||
processing: processing
|
||||
void: void
|
||||
invalid: invalid
|
||||
order_state:
|
||||
address: address
|
||||
adjustments: adjustments
|
||||
|
||||
Reference in New Issue
Block a user