Refactored finance/ordergroups|transactions module.
This commit is contained in:
parent
fc1d130113
commit
ea6348bc5c
38 changed files with 967 additions and 443 deletions
|
|
@ -23,7 +23,7 @@
|
|||
%h2 letzte Überweisungen
|
||||
.column_content
|
||||
%p
|
||||
= link_to "Bestellgruppen", :controller => 'finance/transactions'
|
||||
= link_to "Bestellgruppen", :controller => 'financial_transactions'
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
|
|
|
|||
|
|
@ -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
|
||||
30
app/views/finance/ordergroups/_ordergroups.html.haml
Normal file
30
app/views/finance/ordergroups/_ordergroups.html.haml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
%p
|
||||
Gefunden:
|
||||
= @ordergroups.size
|
||||
%p
|
||||
%table{:style => "width:100%"}
|
||||
%tr
|
||||
%td
|
||||
= pagination_links_remote @ordergroups, :update => :ordergroups, :params => {:sort => params[:sort]}
|
||||
%td{:style => "text-align:right"}
|
||||
- if @ordergroups.size > 20
|
||||
= items_per_page
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th= sort_link_helper "Name", "name", :per_page => @per_page
|
||||
%th Kontakt
|
||||
%th= sort_link_helper "Kontostand", "account_balance", :per_page => @per_page
|
||||
%th
|
||||
%tbody
|
||||
- for ordergroup in @ordergroups
|
||||
%tr{:class => cycle('even','odd', :name => 'ordergroups')}
|
||||
%td= ordergroup.name
|
||||
%td= ordergroup.contact
|
||||
%td{:class => "currency", :style => "width:5em"}= number_to_currency(ordergroup.account_balance)
|
||||
%td{:class => "actions"}
|
||||
= link_to image_tag("euro_new.png", :size => "16x16", :alt => "Neue Transaktion", :border => "0"),
|
||||
new_finance_ordergroup_transaction_path(ordergroup), :title => "Neue Transaktion"
|
||||
= link_to image_tag("b_browse.png", :size => "16x16", :border => "0", :alt => 'Kontoauszug'),
|
||||
finance_ordergroup_transactions_path(ordergroup), :title => "Kontoauszug"
|
||||
|
||||
20
app/views/finance/ordergroups/index.html.haml
Normal file
20
app/views/finance/ordergroups/index.html.haml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
- title "Konten verwalten"
|
||||
%p
|
||||
%i
|
||||
Um mehrer Transaktionen auf einmal anzulegen folge bitte diesem
|
||||
= link_to "Link", finance_new_transaction_collection_path
|
||||
|
||||
.left_column{:style=>"width:50em"}
|
||||
.box_title
|
||||
%h2 Bestellgruppen
|
||||
.column_content
|
||||
#group_filter
|
||||
= form_tag finance_ordergroups_path, :method => :get, :style=>"display:inline;", :id => 'ordergroup_search',
|
||||
:remote => true, 'data-submit-onchange' => true do
|
||||
%label{:for => 'article_name'} Suche nach Name:
|
||||
= text_field_tag :query, params[:query], :size => 10
|
||||
#ordergroups
|
||||
= render :partial => "ordergroups"
|
||||
%br/
|
||||
- if @current_user.role_admin?
|
||||
= link_to "Neue Bestellgruppe anlegen", new_admin_ordergroup_path
|
||||
1
app/views/finance/ordergroups/index.js.erb
Normal file
1
app/views/finance/ordergroups/index.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$('#ordergroups').html('<%= escape_javascript(render("ordergroups")) %>');
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
<% if @total == 0 %>
|
||||
|
||||
<p>Keine gefunden</p>
|
||||
|
||||
<% else %>
|
||||
|
||||
<p>Anzahl gefundener Transaktionen: <b><%= @total %></b></p>
|
||||
|
||||
<p>
|
||||
<%= pagination_links_remote @financial_transactions, :update => 'transactions',
|
||||
:params => {:sort => params[:sort], :query => params['query']}%>
|
||||
</p>
|
||||
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td <%= sort_td_class_helper "date" %>>
|
||||
<%= sort_link_helper "Datum", "date" %>
|
||||
</td>
|
||||
<td>Wer</td>
|
||||
<td <%= sort_td_class_helper "note" %>>
|
||||
<%= sort_link_helper "Notiz", "note" %>
|
||||
</td>
|
||||
<td <%= sort_td_class_helper "amount" %>>
|
||||
<%= sort_link_helper "Betrag", "amount" %>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @financial_transactions.each do |t| %>
|
||||
<tr class="<%= cycle("even","odd") %>">
|
||||
<td><%= format_time(t.created_on) %></td>
|
||||
<td><%=h t.user.nil? ? '??' : t.user.nick %></td>
|
||||
<td><%=h t.note %></td>
|
||||
<td style="color:<%= t.amount < 0 ? 'red' : 'black' %>; width:5em" class="currency"><%= number_to_currency(t.amount) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<% end %>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
%tr.transaction
|
||||
%td
|
||||
%select{:name => 'financial_transactions[][ordergroup_id]'}
|
||||
= options_for_select Ordergroup.without_deleted.all(:order => 'name').collect { |g| [ g.name, g.id ] }
|
||||
%td= text_field_tag 'financial_transactions[][amount]'
|
||||
%td= link_to_function icon(:delete), "$(this).up('.transaction').remove()", {:title => "Gruppe enfernen"}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
%p
|
||||
Gefunden:
|
||||
= @total
|
||||
%p
|
||||
%table{:style => "width:100%"}
|
||||
%tr
|
||||
%td
|
||||
= pagination_links_remote @groups, :update => :ordergroups, :params => {:sort => params[:sort]}
|
||||
%td{:style => "text-align:right"}
|
||||
- if @total > 20
|
||||
= items_per_page :update => :ordergroups
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th= sort_link_helper "Name", "name", :per_page => @per_page
|
||||
%th Kontakt
|
||||
%th= sort_link_helper "Kontostand", "account_balance", :per_page => @per_page
|
||||
%th
|
||||
%tbody
|
||||
- for group in @groups
|
||||
%tr{:class => cycle('even','odd', :name => 'groups')}
|
||||
%td= group.name
|
||||
%td= group.contact
|
||||
%td{:class => "currency", :style => "width:5em"}= number_to_currency(group.account_balance)
|
||||
%td{:class => "actions"}
|
||||
= link_to image_tag("euro_new.png", :size => "16x16", :alt => "Neue Transaktion", :border => "0"), {:action => 'new', :id => group}, {:title => "Neue Transaktion"}
|
||||
= link_to image_tag("b_browse.png", :size => "16x16", :border => "0", :alt => 'Kontoauszug'), {:action => 'list', :id => group}, {:title => "Kontoauszug"}
|
||||
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
- title "Konten verwalten"
|
||||
%p
|
||||
%i
|
||||
Um mehrer Transaktionen auf einmal anzulegen folge bitte diesem
|
||||
= link_to _("Link"), :action => 'new_collection'
|
||||
|
||||
.left_column{:style=>"width:50em"}
|
||||
.box_title
|
||||
%h2 Bestellgruppen
|
||||
.column_content
|
||||
#group_filter
|
||||
%form{:name=>"sform", :action=>"", :style=>"display:inline;"}
|
||||
Suchen im Namen:
|
||||
= text_field_tag("query", params['query'], :size => 10 )
|
||||
|
||||
= observe_field 'query', :frequency => 2, |
|
||||
:before => "Element.show('loader')", |
|
||||
:success => "Element.hide('loader')", |
|
||||
:url => {:action => 'index'}, |
|
||||
:with => 'query', |
|
||||
:update => 'ordergroups', |
|
||||
:method => :get |
|
||||
#ordergroups
|
||||
= render :partial => "ordergroups"
|
||||
%br/
|
||||
- if @current_user.role_admin?
|
||||
= link_to "Neue Bestellgruppe anlegen", new_admin_ordergroup_path
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<% title "Kontoauszug für #{@group.name}" %>
|
||||
|
||||
<p>
|
||||
<b>Kontostand: <%= number_to_currency(@group.account_balance) -%></b>
|
||||
<span style="color:grey">(zuletzt aktualisiert vor <%= distance_of_time_in_words(Time.now, @group.account_updated) -%>)</span>
|
||||
</p>
|
||||
<div class="left_column" style="width:100%">
|
||||
<div class="box_title"><h2>Überweisungen</h2></div>
|
||||
<div class="column_content">
|
||||
<form name="sform" action="" style="display:inline;">
|
||||
<label for="financial_transaction_note">in Notizen suchen: </label>
|
||||
<%= text_field_tag("query", params['query'], :size => 10 ) %>
|
||||
</form>
|
||||
<%= observe_field 'query', :frequency => 2,
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')",
|
||||
:url => {:action => 'list'},
|
||||
:with => 'query',
|
||||
:update => 'transactions' %>
|
||||
<div id="transactions">
|
||||
<%= render :partial => "list" %>
|
||||
</div>
|
||||
<p><%= link_to 'Neue Transaktion', :action => 'new', :id => @group %></p>
|
||||
</div>
|
||||
<%= link_to 'Gruppenübersicht', :action => 'index' %>
|
||||
</div>
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
- title "Neue Transaktion"
|
||||
|
||||
.edit_form{ :style => "width:30em" }
|
||||
- form_for @financial_transaction, :url => {:action => 'create'} do |f|
|
||||
= f.error_messages
|
||||
= f.hidden_field :ordergroup_id
|
||||
%p
|
||||
Bestellgruppe:
|
||||
%b=h @group.name
|
||||
%p
|
||||
Betrag
|
||||
%br/
|
||||
= f.text_field :amount, :size => 10
|
||||
%p
|
||||
Notiz
|
||||
%br/
|
||||
= f.text_area :note, :cols => 40, :rows => 5
|
||||
%p
|
||||
= submit_tag "Speichern"
|
||||
|
|
||||
= link_to "Abbrechen", :controller => 'transactions'
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
- title "Mehrer Konten aktualisieren"
|
||||
|
||||
- form_tag :action => "create_collection" 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_function "Neue Bestellgruppe hinzufügen" do |page|
|
||||
- page.insert_html :bottom, :Ordergroups, :partial => 'ordergroup'
|
||||
%p
|
||||
= submit_tag "Transaktionen speichern"
|
||||
|
|
||||
= link_to "Abbrechen", :controller => 'finance/transactions'
|
||||
Loading…
Add table
Add a link
Reference in a new issue