Refactored finance/ordergroups|transactions module.
This commit is contained in:
parent
fc1d130113
commit
ea6348bc5c
38 changed files with 967 additions and 443 deletions
|
|
@ -0,0 +1,6 @@
|
|||
%tr.transaction
|
||||
%td
|
||||
= select_tag 'financial_transactions[][ordergroup_id]',
|
||||
options_for_select(Ordergroup.order(:name).all.map { |g| [ g.name, g.id ] })
|
||||
%td= text_field_tag 'financial_transactions[][amount]'
|
||||
%td= link_to icon(:delete), "#", :title => "Gruppe enfernen", 'data-remove-transaction' => true
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
- if @total == 0
|
||||
%p Keine gefunden
|
||||
- else
|
||||
%p
|
||||
Anzahl gefundener Transaktionen:
|
||||
%b= @total
|
||||
%p
|
||||
= pagination_links_remote @financial_transactions, :update => 'transactions', |
|
||||
:params => {:sort => params[:sort], :query => params['query']} |
|
||||
%table
|
||||
%thead
|
||||
%tr
|
||||
<td #{sort_td_class_helper "date"}>
|
||||
\#{sort_link_helper "Datum", "date"}
|
||||
%td Wer
|
||||
<td #{sort_td_class_helper "note"}>
|
||||
\#{sort_link_helper "Notiz", "note"}
|
||||
<td #{sort_td_class_helper "amount"}>
|
||||
\#{sort_link_helper "Betrag", "amount"}
|
||||
%tbody
|
||||
- @financial_transactions.each do |t|
|
||||
%tr{:class => cycle("even","odd")}
|
||||
%td= format_time(t.created_on)
|
||||
%td= h t.user.nil? ? '??' : t.user.nick
|
||||
%td= h t.note
|
||||
%td.currency{:style => "color:#{t.amount < 0 ? 'red' : 'black'}; width:5em"}= number_to_currency(t.amount)
|
||||
18
app/views/finance/financial_transactions/index.html.haml
Normal file
18
app/views/finance/financial_transactions/index.html.haml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
- title "Kontoauszug für #{@ordergroup.name}"
|
||||
%p
|
||||
%b
|
||||
Kontostand: #{number_to_currency(@ordergroup.account_balance)}
|
||||
%span{:style => "color:grey"}
|
||||
(zuletzt aktualisiert vor #{distance_of_time_in_words(Time.now, @ordergroup.account_updated)})
|
||||
.left_column{:style => "width:100%"}
|
||||
.box_title
|
||||
%h2 Überweisungen
|
||||
.column_content
|
||||
= form_tag finance_ordergroup_transactions_path(@ordergroup), :method => :get, :style=>"display:inline;", :id => 'ordergroup_search',
|
||||
:remote => true, 'data-submit-onchange' => true do
|
||||
%label{:for => 'article_name'} Suche in Notiz:
|
||||
= text_field_tag :query, params[:query], :size => 10
|
||||
#transactions
|
||||
= render :partial => "transactions"
|
||||
%p= link_to 'Neue Transaktion', new_finance_ordergroup_transaction_path(@ordergroup)
|
||||
= link_to 'Gruppenübersicht', finance_ordergroups_path
|
||||
1
app/views/finance/financial_transactions/index.js.erb
Normal file
1
app/views/finance/financial_transactions/index.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$('#transactions').html('<%= escape_javascript(render("transactions")) %>');
|
||||
9
app/views/finance/financial_transactions/new.html.haml
Normal file
9
app/views/finance/financial_transactions/new.html.haml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
- title "Neue Transaktion"
|
||||
|
||||
= simple_form_for @financial_transaction, :url => finance_ordergroup_transactions_path(@ordergroup),
|
||||
:validate => true do |f|
|
||||
= f.association :ordergroup
|
||||
= f.input :amount
|
||||
= f.input :note, :as => :text
|
||||
= f.submit
|
||||
= link_to "oder abbrechen", finance_ordergroup_transactions_path(@ordergroup)
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
- title "Mehrer Konten aktualisieren"
|
||||
|
||||
- content_for :head do
|
||||
:javascript
|
||||
var ordergroup = "#{escape_javascript(render('ordergroup'))}"
|
||||
|
||||
$(function() {
|
||||
$('a[data-remove-transaction]').live('click', function() {
|
||||
$(this).parents('tr').remove();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('a[data-add-transaction]').click(function() {
|
||||
$('#ordergroups').append(ordergroup);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
- form_tag finance_create_transaction_collection_path do
|
||||
%p
|
||||
%b Notiz
|
||||
= text_field_tag :note
|
||||
%p
|
||||
%table#ordergroups{:style => "width:20em"}
|
||||
%tr
|
||||
%th Bestellgruppe
|
||||
%th Betrag
|
||||
= render :partial => 'ordergroup', :collection => [1, 2, 3]
|
||||
|
||||
%p
|
||||
= link_to "Neue Bestellgruppe hinzufügen", '#', 'data-add-transaction' => true
|
||||
%p
|
||||
= submit_tag "Transaktionen speichern"
|
||||
= link_to "oder abbrechen", finance_ordergroups_path
|
||||
Loading…
Add table
Add a link
Reference in a new issue