Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Basic account listing

Josh Pigfordaef3e70ba052
diff --git a/app/models/account.rb b/app/models/account.rb
index 9f130896..f561d1b8 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -1,3 +1,5 @@
class Account < ApplicationRecord
belongs_to :family
+
+ scope :depository, -> { where(type: 'Depository') }
end
diff --git a/app/views/accounts/index.html.erb b/app/views/accounts/index.html.erb
index 24ad03e5..8eda0d01 100644
--- a/app/views/accounts/index.html.erb
+++ b/app/views/accounts/index.html.erb
@@ -1,8 +1,14 @@
-<div>
- <h1 class="text-4xl font-bold">Accounts#index</h1>
- <p>Find me in app/views/accounts/index.html.erb</p>
-</div>
-<% @accounts.each do |account| %>
- <%= account.name %>
-<% end %>
+<h2 class="text-2xl font-semibold font-display">Cash</h2>
+<h3 class="mt-1 mb-4 text-sm text-gray-500"><%#= number_to_currency current_family.cash_balance %></h3>
+
+<% current_family.accounts.depository.each do |account| %>
+ <div class="flex items-center justify-between px-3 py-3 mb-2 bg-white shadow-sm rounded-xl">
+ <div class="flex items-center text-sm">
+ <%= account.name %>
+ </div>
+ <p class="text-sm text-right">
+ <span class="block mb-1"><%= number_to_currency account.balance %></span>
+ </p>
+ </div>
+ <% end %>
\ No newline at end of file