<h1><%= @user.name %>'s Profile</h1>

<h4>Current Savings: $<%= @user.savings.total_savings %></h4>
<br>
<h4>Planned Purchases: </h4>
  <% @user.purchases.each do |purchase| %>
    <p><%= purchase.title %> for $<%= purchase.cost %> <%= link_to "delete", purchase_path(purchase), method: :delete %></p>
  <% end %>
<br>

<%= button_to "Add savings", {:controller => "savings", :action => "new"} , :method => :get, :id => "button" %>
<%= button_to "Add a new purchase", {:controller => "purchases", :action => "new"} , :method => :get, :id => "button" %>


<h1><%= @user.name %>'s Profile</h1>
<% if @user.income == nil %>
  <h3>What is your monthly income?
  <%= form_tag(user_path(@user), method: "patch") do %>
    <%= text_field_tag(:income) %>
    <%= submit_tag("submit") %>
  <% end %>
<% else %>
  Your income is $<%= user.income %>
<% end %>

<h4>Current Savings: $<%= @user.savings.total_savings %></h4>
<br>
<h4>Planned Purchases: </h4>
  <% @user.purchases.each do |purchase| %>
    <p><%= purchase.title %> for $<%= purchase.cost %> <%= link_to "delete", purchase_path(purchase), method: :delete %></p>
  <% end %>
<br>

<%= button_to "Add savings", {:controller => "savings", :action => "new"} , :method => :get, :id => "button" %>
<%= button_to "Add a new purchase", {:controller => "purchases", :action => "new"} , :method => :get, :id => "button" %>


Add income box for profile page
Add income box for profile page
