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

57 lines
2.2 KiB
Plaintext

- with_ordergroup = local_assigns[:with_ordergroup]
- with_hidden = local_assigns[:with_hidden]
- with_csv = local_assigns[:with_csv]
.pull-right
- if with_csv
.btn-group
= link_to url_for(search: params[:q], format: :csv), class: 'btn' do
= glyph :download
CSV
- if @financial_transactions.total_pages > 1
.btn-group= items_per_page wrap: false
= pagination_links_remote @financial_transactions
%table.table.table-striped
%thead
%tr
%th= sort_link_helper heading_helper(FinancialTransaction, :created_on), "date"
- if with_ordergroup
%th= heading_helper FinancialTransaction, :ordergroup
%th= heading_helper FinancialTransaction, :user
- if FinancialTransactionType.has_multiple_types
%th= heading_helper FinancialTransaction, :financial_transaction_type
%th= sort_link_helper heading_helper(FinancialTransaction, :note), "note"
- FinancialTransactionClass.sorted.each do |c|
%th
= sort_link_helper c.display, "amount"
- if with_hidden
%th
%tbody
- @financial_transactions.each do |t|
%tr{class: "#{'deleted_row' if t.hidden?}"}
%td
- if t.financial_link
= link_to format_time(t.created_on), finance_link_path(t.financial_link)
- else
= format_time(t.created_on)
- if with_ordergroup
%td= h link_to t.ordergroup_name, finance_group_transactions_path(t.ordergroup)
%td= h show_user(t.user)
- if FinancialTransactionType.has_multiple_types
%td= h t.financial_transaction_type.name
%td
- if t.group_order
= link_to t.note, t.group_order
- else
= t.note
- FinancialTransactionClass.sorted.each do |c|
%td.numeric{style: 'width:5em'}
- if t.financial_transaction_type.financial_transaction_class == c
= format_currency t.amount
- if with_hidden
%td.actions{style: 'width:1em'}
- unless t.hidden?
= link_to finance_transaction_path(t), method: :delete,
data: {confirm: t('.confirm_revert', name: t.note)}, title: t('.revert_title'),
class: 'btn btn-danger btn-mini' do
= glyph :remove