Add model and views for bank accounts

This commit is contained in:
Patrick Gansterer 2018-09-14 19:33:27 +02:00
parent 4b1e9a6f53
commit f0a55fb951
24 changed files with 351 additions and 1 deletions

View file

@ -0,0 +1,12 @@
- title t('.title', name: @bank_account.name)
= form_for :bank_accounts, :url => parse_upload_finance_bank_account_path(@bank_account),
:html => { multipart: true, class: "form-horizontal" } do |f|
.control-group
%label(for="bank_transactions_file")= t '.file_label'
= f.file_field "file"
.form-actions
= submit_tag t('.submit'), class: 'btn btn-primary'
= link_to t('ui.or_cancel'), finance_bank_account_transactions_path(@bank_account)

View file

@ -0,0 +1,16 @@
- title t('.title')
%table.table.table-striped
%thead
%tr
%th= heading_helper BankAccount, :name
%th= heading_helper BankAccount, :iban
%th= heading_helper BankAccount, :description
%th= heading_helper BankAccount, :balance
%tbody
- for account in @bank_accounts
%tr
%td= link_to account.name, finance_bank_account_transactions_path(account)
%td= account.iban
%td= truncate account.description, length: 50
%td.numeric{style: 'width:5em'}= format_currency account.balance

View file

@ -0,0 +1,22 @@
.pull-right
- if @bank_transactions.total_pages > 1
.btn-group= items_per_page wrap: false
= pagination_links_remote @bank_transactions
%table.table.table-striped
%thead
%tr
%th= sort_link_helper heading_helper(BankTransaction, :date), "date"
%th= heading_helper(BankTransaction, :text)
%th= heading_helper(BankTransaction, :reference)
%th= sort_link_helper heading_helper(BankTransaction, :amount), "amount"
%th= sort_link_helper heading_helper(BankTransaction, :financial_link), "financial_link"
%tbody
- @bank_transactions.each do |t|
%tr
%td= h link_to format_date(t.date), finance_bank_transaction_path(t)
%td= h(t.text).gsub("\n", "<br>").html_safe
%td= h t.reference
%td.numeric{style: 'width:5em'}= format_currency t.amount
%td
- if t.financial_link
= link_to t('ui.show'), finance_link_path(t.financial_link)

View file

@ -0,0 +1,9 @@
- title t('.title', name: @bank_account.name, balance: number_to_currency(@bank_account.balance))
.well.well-small
= form_tag finance_bank_account_transactions_path, :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('ui.search_placeholder')
#transactionsTable= render 'transactions'

View file

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

View file

@ -0,0 +1,40 @@
%p
%b= heading_helper(BankTransaction, :external_id) + ':'
= @bank_transaction.external_id
%p
%b= heading_helper(BankTransaction, :date) + ':'
= @bank_transaction.date
%p
%b= heading_helper(BankTransaction, :amount) + ':'
= number_to_currency(@bank_transaction.amount)
%p
%b= heading_helper(BankTransaction, :iban) + ':'
= @bank_transaction.iban
- if user = @bank_transaction.user
= t('.belongs_to_user')
= user.display
- if user.ordergroup
= t('.in_ordergroup')
= link_to user.ordergroup.name, finance_ordergroup_transactions_path(user.ordergroup)
- elsif supplier = @bank_transaction.supplier
= t('.belongs_to_supplier')
= link_to supplier.name, supplier_path(supplier)
%p
%b= heading_helper(BankTransaction, :reference) + ':'
= @bank_transaction.reference
%p
%b= heading_helper(BankTransaction, :text) + ':'
= h(@bank_transaction.text).gsub("\n", "<br>").html_safe
%p
%b= heading_helper(BankTransaction, :financial_link) + ':'
- if @bank_transaction.financial_link
= link_to t('ui.show'), finance_link_path(@bank_transaction.financial_link)
- else
= link_to t('.add_financial_link'), '/'
- unless @bank_transaction.receipt.blank?
%pre= preserve @bank_transaction.receipt
- if @bank_transaction.image
%p= image_tag @bank_transaction.image_url
= link_to t('ui.or_cancel'), finance_bank_account_transactions_path(@bank_transaction.bank_account)