foodsoft/app/views/finance/financial_transactions/_transactions.html.haml

43 lines
1.7 KiB
Text
Raw Normal View History

- with_ordergroup = local_assigns[:with_ordergroup]
- with_csv = local_assigns[:with_csv]
2014-05-06 19:02:01 +02:00
.pull-right
- if with_csv
.btn-group
= link_to url_for(search: params[:q], format: :csv), class: 'btn' do
= glyph :download
CSV
2014-05-06 19:02:01 +02:00
- if @financial_transactions.total_pages > 1
.btn-group= items_per_page wrap: false
= pagination_links_remote @financial_transactions
%table.table.table-striped
%thead
%tr
2013-11-23 12:05:29 +01:00
%th= sort_link_helper heading_helper(FinancialTransaction, :created_on), "date"
2014-05-06 19:02:01 +02:00
- if with_ordergroup
%th= heading_helper FinancialTransaction, :ordergroup
2013-11-23 12:05:29 +01:00
%th= heading_helper FinancialTransaction, :user
- if FinancialTransactionType.has_multiple_types
%th= heading_helper FinancialTransaction, :financial_transaction_type
2013-11-23 12:05:29 +01:00
%th= sort_link_helper heading_helper(FinancialTransaction, :note), "note"
- FinancialTransactionClass.sorted.each do |c|
%th
= sort_link_helper c.display, "amount"
%tbody
- @financial_transactions.each do |t|
%tr
%td
- if t.financial_link
= link_to format_time(t.created_on), finance_link_path(t.financial_link)
- else
= format_time(t.created_on)
2014-05-06 19:02:01 +02:00
- if with_ordergroup
%td= h link_to t.ordergroup.name, finance_ordergroup_transactions_path(t.ordergroup)
2013-09-20 22:40:13 +02:00
%td= h show_user(t.user)
- if FinancialTransactionType.has_multiple_types
%td= h t.financial_transaction_type.name
%td= h t.note
- FinancialTransactionClass.sorted.each do |c|
%td.currency{:style => "color:#{t.amount < 0 ? 'red' : 'black'}; width:5em"}
- if t.financial_transaction_type.financial_transaction_class == c
= number_to_currency(t.amount)