File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # frozen_string_literal: true
2-
1+ # app/controllers/pages_controller.rb
32class PagesController < ApplicationController
43 def landing
54 query = TransactionsQuery . new ( current_user )
65 @transactions = ActiveRecord ::Base . connection . exec_query ( query . query . order ( query . arel_table [ :time ] . desc ) . take ( 10 ) . project ( Arel . star ) . to_sql )
76 @requests = current_user . incoming_requests . open . includes ( :creditor ) . take ( 10 )
7+ @total_incoming_amount = current_user . incoming_requests . open . sum ( :amount )
88 @outgoing_requests = current_user . outgoing_requests . open . includes ( :debtor ) . take ( 10 )
9+ @total_outgoing_amount = current_user . outgoing_requests . open . sum ( :amount )
910 @notifications = current_user . notifications . unread
1011 end
1112
Original file line number Diff line number Diff line change 11<%= render 'shared/dashboard_card',
22 card_title: "Outgoing requests",
33 view_all_path: user_requests_path(current_user) do %>
4- <ul role ="list " class =" divide-y divide-gray-200 " >
4+ <ul role ="list ">
55 <% if @outgoing_requests . any? %>
66 <% @outgoing_requests . each do |r | %>
77 < li class ="py-3 sm:py-4 ">
2020 </ div >
2121 </ li >
2222 <% end %>
23+ < li class ="py-4 border-t-2 border-gray-900 mt-2 ">
24+ < div class ="flex items-center justify-between font-bold text-gray-900 ">
25+ < span > Total</ span >
26+ < span > <%= euro_from_cents @total_outgoing_amount %> </ span >
27+ </ div >
28+ </ li >
2329 <% else %>
2430 None!
2531 <% end %>
Original file line number Diff line number Diff line change 11<%= render 'shared/dashboard_card',
22 card_title: "Requests",
33 view_all_path: user_requests_path(current_user) do %>
4- <ul role ="list " class =" divide-y divide-gray-200 " >
4+ <ul role ="list ">
55 <% if @requests . any? %>
66 <% @requests . each do |r | %>
77 < li class ="py-3 sm:py-4 ">
3434 </ div >
3535 </ li >
3636 <% end %>
37+ < li class ="py-4 border-t-2 border-gray-900 mt-2 ">
38+ < div class ="flex items-center justify-between font-bold text-gray-900 ">
39+ < span > Total</ span >
40+ < span > <%= euro_from_cents @total_incoming_amount %> </ span >
41+ </ div >
42+ </ li >
3743 <% else %>
3844 None!
3945 <% end %>
You can’t perform that action at this time.
0 commit comments