% @content_title = 'Grindable Home' -%>
<%= render :partial => 'shared/menu' %>
Fund details
<% if @fund.nil? -%>
You have no associated fund!
Visit the <%= link_to 'Fund Controller', :controller => 'fund' -%> to configure funds and change your associated fund.
<% else -%>
- Fund name: <%= h(@fund.name) -%>
- Total fund balance is: <%= display_amount @fund.balance -%>
<% unless @fund.contribution == 0.0 -%>
- Monthly contribution: <%= display_amount @fund.contribution -%>
<% end -%>
<% unless @fund.contribution == 0.0 -%>
<% if session[:barista].paid_this_month? -%>
You have paid this month's contribution.
<% else -%>
You have not paid this month
<% end -%>
<% end -%>
<% end -%>
<% unless @fund.nil? or @fund.contribution == 0.0 -%>
Milk Purchases
<%= form_tag({ :action => 'milk_purchased' }, { :id => 'milk_form' }) -%>
<%= end_form_tag -%>
<% unless session[:barista].milk_last_bought_at.nil? -%>
You last bought milk <%= time_ago_in_words session[:barista].milk_last_bought_at -%> ago.
<% else -%>
You have never bought milk!
<% end -%>
<% unless @next_milk_purchaser.id == session[:barista].id -%>
The next person to buy milk will be: <%= h(@next_milk_purchaser.name) -%>
<% else -%>
You will have to buy milk next.
<% end -%>
<% end -%>
<% unless @fund.nil? -%>
<%= form_tag( { :action => 'make_contribution' }, { :id => 'contribution_form' }) %>
Make A Contribution |
|
Barista | <%= select('contribution', 'barista_id', Barista.for_select(@fund.id), { :selected => session[:barista][:id] }, { :class => 'inputBox' }) -%> |
<% if @fund.contribution == 0.0 -%>
Amount | <%= text_field_tag 'contribution', nil, :class => 'inputBox', :size => 10, :maxsize => 12 -%> |
<% else -%>
<%
quantity_select = [ [ 'This month', 1 ] ]
(2..6).each do |i|
quantity_select << [ "Next #{i} months", i ]
end
%>
Quantity | <%= select 'contribution', 'quantity', quantity_select, {}, { :class => 'inputBox' } -%> |
<% end -%>
|
<%= submit_tag 'Go', :class => 'inputBox' -%> | <%= link_to_function 'Cancel', "dojo.widget.byId('contributionDialog').hide();dojo.byId('contribution_form').reset()" -%> |
<%= end_form_tag %>
<%= form_tag( { :action => 'make_purchase' }, { :id => 'purchase_form' }) %>
Make A Purchase |
|
Amount: (XXX.XX) | <%= text_field_tag 'amount', nil, :size => 10, :maxlength => 12, :class => 'inputBox' -%> |
Comment: | <%= text_field_tag 'comment', nil, :size => 32, :maxlength => 64, :class => 'inputBox' -%> |
|
<%= submit_tag 'Buy', :class => 'inputBox' -%> | <%= link_to_function 'Cancel', "dojo.widget.byId('purchaseDialog').hide();dojo.byId('purchase_form').reset()" -%> |
<%= end_form_tag %>
<%
@dojo_map ||= {}
@dojo_map['contributionDialog'] = ['dialog', '{bgColor: "black", bgOpacity: "0.5"}']
@dojo_map['purchaseDialog'] = ['dialog', '{bgColor: "black", bgOpacity: "0.5"}']
%>
<% end -%>