Add UI to show and create financial transactions for the foodcoop

This commit is contained in:
Patrick Gansterer 2019-11-01 17:25:20 +01:00
parent 1a49bee42d
commit 602f663245
12 changed files with 66 additions and 29 deletions

View file

@ -34,7 +34,7 @@
- else
= format_time(t.created_on)
- if with_ordergroup
%td= h link_to t.ordergroup_name, finance_ordergroup_transactions_path(t.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
@ -50,7 +50,7 @@
- if with_hidden
%td.actions{style: 'width:1em'}
- unless t.hidden?
= link_to finance_ordergroup_transaction_path(t.ordergroup, t), method: :delete,
= 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

View file

@ -1,25 +1,27 @@
- title t('.title', name: @ordergroup.name)
- title @ordergroup ? t('.title', name: @ordergroup.name) : t('.title_foodcoop')
- content_for :actionbar do
= link_to t('.new_transaction'), new_finance_ordergroup_transaction_path(@ordergroup), class: 'btn btn-primary'
- url = @ordergroup ? new_finance_ordergroup_transaction_path(@ordergroup) : new_finance_foodcoop_financial_transaction_path
= link_to t('.new_transaction'), url, class: 'btn btn-primary'
- content_for :sidebar do
.well.well-small
%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))
%p
- unless FoodsoftConfig[:charge_members_manually]
- if @ordergroup
- content_for :sidebar do
.well.well-small
%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))
%p
%b= heading_helper(Ordergroup, :available_funds) + ':'
= number_to_currency(@ordergroup.get_available_funds)
- if FinancialTransactionClass.has_multiple_classes
- FinancialTransactionClass.sorted.each do |c|
- unless FoodsoftConfig[:charge_members_manually]
%p
%b= c.display + ':'
= number_to_currency(@ordergroup["sum_of_class_#{c.id}"])
%b= heading_helper(Ordergroup, :available_funds) + ':'
= number_to_currency(@ordergroup.get_available_funds)
- if FinancialTransactionClass.has_multiple_classes
- FinancialTransactionClass.sorted.each do |c|
%p
%b= c.display + ':'
= number_to_currency(@ordergroup["sum_of_class_#{c.id}"])
= render 'transactions_search', url: finance_ordergroup_transactions_path(@ordergroup)
= render 'transactions_search', url: finance_group_transactions_path(@ordergroup)
#transactions= render 'transactions', with_csv: true, with_hidden: true

View file

@ -1,8 +1,11 @@
- title t('.title')
%p!= t('.paragraph', name: @ordergroup.name)
- if @ordergroup
%p!= t('.paragraph', name: @ordergroup.name)
- else
%p!= t('.paragraph_foodcoop')
= simple_form_for @financial_transaction, :url => finance_ordergroup_transactions_path(@ordergroup),
= simple_form_for @financial_transaction, :url => finance_group_transactions_path(@ordergroup),
:validate => true do |f|
= f.hidden_field :ordergroup_id
- if FinancialTransactionType.has_multiple_types
@ -11,4 +14,4 @@
= f.input :note, :as => :text
.form-actions
= f.submit class: 'btn btn-primary'
= link_to t('ui.or_cancel'), finance_ordergroup_transactions_path(@ordergroup)
= link_to t('ui.or_cancel'), finance_group_transactions_path(@ordergroup)

View file

@ -2,6 +2,7 @@
- content_for :actionbar do
= link_to t('.show_all'), finance_transactions_path, class: 'btn'
= link_to t('.show_foodcoop'), finance_foodcoop_financial_transactions_path, class: 'btn'
= link_to t('.new_transaction'), finance_new_transaction_collection_path, class: 'btn btn-primary'
.well.well-small