add view for all transactions + csv

This commit is contained in:
wvengen 2014-05-06 19:02:01 +02:00
parent b5b4ccd922
commit ef0888f38d
15 changed files with 111 additions and 19 deletions

View file

@ -1,10 +1,18 @@
- if @ordergroup.financial_transactions.count > 20
= items_per_page
- with_ordergroup ||= false
.pull-right
.btn-group
= link_to url_for(q: 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
%th= sort_link_helper heading_helper(FinancialTransaction, :note), "note"
%th= sort_link_helper heading_helper(FinancialTransaction, :amount), "amount"
@ -12,6 +20,8 @@
- @financial_transactions.each do |t|
%tr
%td= format_time(t.created_on)
- if with_ordergroup
%td= h link_to t.ordergroup.name, finance_ordergroup_transactions_path(t.ordergroup)
%td= h show_user(t.user)
%td= h t.note
%td.currency{:style => "color:#{t.amount < 0 ? 'red' : 'black'}; width:5em"}= number_to_currency(t.amount)

View file

@ -0,0 +1,22 @@
.well.well-small
= search_form_for @q, url: url,
html: {data: {'submit-onchange' => true}, method: :get, remote: true, class: 'form-search'} do |f|
= f.text_field :note_cont, class: 'search-query', placeholder: t('.search_placeholder')
&nbsp;
= label_tag 'q_created_on_gteq', FinancialTransaction.human_attribute_name(:created_on)
&nbsp;
.input-append.input-prepend
= f.text_field :created_on_gteq, class: 'input-small datepicker'
%span.add-on -
= f.text_field :created_on_lteq, class: 'input-small search-query datepicker'
&nbsp;
= label_tag 'q_amount_gteq', FinancialTransaction.human_attribute_name(:amount)
&nbsp;
.input-append.input-prepend
%span.add-on= t 'number.currency.format.unit'
= f.text_field :amount_gteq, class: 'input-mini'
%span.add-on -
= f.text_field :amount_lteq, class: 'input-mini search-query'

View file

@ -8,11 +8,7 @@
%strong= t('.balance', balance: number_to_currency(@ordergroup.account_balance))
%br/
%small= t('.last_updated_at', when: distance_of_time_in_words(Time.now, @ordergroup.account_updated))
.well.well-small
= form_tag finance_ordergroup_transactions_path(@ordergroup), :method => :get, :remote => true,
'data-submit-onchange' => true, class: 'form-search' do
= text_field_tag :query, params[:query], class: 'input-medium search-query',
placeholder: t('.search_placeholder')
= render 'transactions_search', url: finance_ordergroup_transactions_path(@ordergroup)
#transactions= render 'transactions'
#transactions= render 'transactions'

View file

@ -0,0 +1 @@
$('#transactions').html('<%= escape_javascript(render("transactions")) %>');

View file

@ -1 +0,0 @@
$('#transactions').html('#{escape_javascript(render("transactions"))}');

View file

@ -0,0 +1,8 @@
- title t('.title')
- content_for :actionbar do
= link_to t('.show_groups'), finance_ordergroups_path, class: 'btn'
= render 'transactions_search', url: finance_transactions_path
#transactions= render 'transactions', with_ordergroup: true

View file

@ -0,0 +1 @@
$('#transactions').html('<%= escape_javascript(render("transactions", with_ordergroup: true)) %>');

View file

@ -22,7 +22,7 @@
%h2
= t('.last_transactions')
%small= link_to(t('.show_all'), finance_ordergroups_path)
%small= link_to(t('.show_all'), finance_transactions_path)
%table.table.table-striped
%thead
%tr

View file

@ -1,6 +1,7 @@
- title t('.title')
- content_for :actionbar do
= link_to t('.show_all'), finance_transactions_path, class: 'btn'
= link_to t('.new_transaction'), finance_new_transaction_collection_path, class: 'btn btn-primary'
.well.well-small
@ -10,4 +11,4 @@
placeholder: t('.search_placeholder')
#ordergroupsTable
= render :partial => "ordergroups"
= render :partial => "ordergroups"