app/views/bookkeeper/balance/index.html.erb in bookkeeper-0.0.5 vs app/views/bookkeeper/balance/index.html.erb in bookkeeper-0.0.6

- old
+ new

@@ -1,31 +1,56 @@ <h1><%= t '.title' %></h1> -<table class='table table-striped table-condensed table-bordered'> - <thead> - <tr> - <th><%=t 'bookkeeper.models.movement.attributes.amount' %></th> - <th><%=t 'bookkeeper.models.movement.attributes.description' %></th> - <th><%=t 'bookkeeper.models.movement.attributes.created_at' %></th> - <th><%=t 'bookkeeper.models.movement.attributes.updated_at' %></th> - <th></th> - </tr> - </thead> - <tbody> - <% @movements.each do |movement| %> - <tr> - <td><%= number_to_currency movement.amount %></td> - <td><%= movement.description %></td> - <td><%=l movement.created_at, format: :short rescue '' %></td> - <td><%=l movement.updated_at, format: :short rescue '' %></td> - <td> - <%= link_to ('<i class="icon-pencil"></i> ' + t('bookkeeper.actions.edit')).html_safe, edit_movement_path(movement), class: 'btn btn-mini' %> - <%= link_to ('<i class="icon-remove"></i> ' + t('bookkeeper.actions.destroy')).html_safe, movement, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-mini btn-danger' %> - </td> - </tr> - <% end %> - </tbody> -</table> +<div class="row"> + <div class="span3"> + <h3><%=t '.account_balance' %></h3> + <p><%= number_to_currency @account.balance %></p> + </div> + <div id="balance_chart" class="span9" style="height: 300px;"></div> +</div> -<br /> +<div class="row"> + <div class="span6"> + <table class='table table-striped table-condensed table-bordered'> + <thead> + <tr> + <th><%=t 'bookkeeper.models.movement.attributes.amount' %></th> + <th><%=t 'bookkeeper.models.movement.attributes.description' %></th> + <th><%=t 'bookkeeper.models.movement.attributes.date' %></th> + <th></th> + </tr> + </thead> + <tbody> + <% @movements.reverse_ordered.each do |movement| %> + <tr> + <td> + <span class="label label-<%= movement.incoming? ? "success" : "warning" %>"><%= (movement.incoming? ? '<i class="icon-circle-arrow-down"></i>' : '<i class="icon-circle-arrow-up"></i>').html_safe %></span> + <%= number_to_currency movement.amount %></td> + <td><%= movement.description %></td> + <td><%=l movement.date, format: :short rescue '' %></td> + <td> + <% if movement.incoming? %> + <%= link_to ('<i class="icon-pencil"></i> ' + t('bookkeeper.actions.edit')).html_safe, edit_incoming_path(movement), class: 'btn btn-mini' %> + <% else %> + <%= link_to ('<i class="icon-pencil"></i> ' + t('bookkeeper.actions.edit')).html_safe, edit_outgoing_path(movement), class: 'btn btn-mini' %> + <% end %> + <%= link_to ('<i class="icon-remove"></i> ' + t('bookkeeper.actions.destroy')).html_safe, movement, method: :delete, data: { confirm: t('bookkeeper.actions.destroy_confirm', default: 'Are you sure?') }, class: 'btn btn-mini btn-danger' %> + </td> + </tr> + <% end %> + </tbody> + </table> -<%= link_to ('<i class="icon-plus"></i> ' + t('.new')).html_safe, new_movement_path, class: 'btn' %> + <br /> + + <%= link_to ('<i class="icon-circle-arrow-down"></i> ' + t('.new_incoming')).html_safe, new_incoming_path, class: 'btn btn-success' %> + <%= link_to ('<i class="icon-circle-arrow-up"></i> ' + t('.new_outgoing')).html_safe, new_outgoing_path, class: 'btn btn-warning' %> + </div> + <div id="movements_chart" class="span6" style="height: 500px;"></div> +</div> + + +<% content_for :javascripts do %> + <script type="text/javascript" src="https://www.google.com/jsapi"></script> +<% end %> +<%= render partial: "movements_chart" %> +<%= render partial: "balance_chart" %>