More contract tweaks

This commit is contained in:
2014-03-02 21:48:49 -07:00
parent d8311fa7cc
commit 3cd6c59df0
14 changed files with 53 additions and 20 deletions

View File

@@ -19,6 +19,10 @@
<%= f.label :last_name %><br />
<%= f.text_field :last_name, class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :cosigner %><br />
<%= f.text_field :cosigner, class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :user_id, "User" %><br />
@@ -32,7 +36,13 @@
<div class="form-group">
<%= f.label :document %><br />
<%= f.file_field :document %>
<%= link_to "View Existing Document", @contract.document.url, class: "btn btn-default" unless @contract.document.blank? %>
<p>
<%= link_to "Upload New Document", "#", class: "btn btn-default", onclick: "$('#document_upload').removeClass('hidden'); $(this).addClass('hidden')" unless @contract.document.blank? %>
<div id="document_upload" class="<%= "hidden" unless @contract.document.blank? %>">
<%= f.file_field :document %>
</div>
</p>
</div>
<div class="form-group">

View File

@@ -23,6 +23,7 @@
<td>
<%= contract.last_name %>,
<%= contract.first_name %>
<%= "and #{contract.cosigner}" unless contract.cosigner.blank? %>
</td>
<td>
<%= link_to contract.user.name, contract.user if contract.user %>

View File

@@ -2,6 +2,7 @@
<h1 class="col-md-8">
Contract
<%= link_to 'Back', contracts_path, :class => "btn btn-default" %>
<%= link_to 'Edit', edit_contract_path(@contract), :class => "btn btn-primary" %>
<%= link_to 'Delete', contract_path(@contract), {:confirm => 'Are you sure you want to delete this forever?', :method => :delete, :class => "btn btn-danger"} if can? :destroy, @contract %>
</h1>
</div>
@@ -10,6 +11,7 @@
<h2>
<%= @contract.first_name %>
<%= @contract.last_name %>
<%= "and #{@contract.cosigner}" unless @contract.cosigner.blank? %>
<%= link_to "(#{@contract.user.name})", @contract.user if @contract.user %>
<small>
signed
@@ -17,12 +19,15 @@
</small>
</h2>
<% if @contract.document.blank? %>
No document uploaded
<% else %>
<p><%= link_to "Download Contract", @contract.document.url %>
<div class="col-xs-12">
<iframe src="<%= @contract.document.url %>" width="100%" height="600"></iframe>
</div>
</p>
<% end %>
<br />

View File

@@ -24,6 +24,7 @@
<% else %>
<%= link_to 'Certifications', certifications_path if can? :read, Certification %>
<% end %>
<%= link_to 'Waivers', contracts_path if can? :read, Contract %>
<%= link_to 'Payments', payments_path if can? :create, Payment %>
<%= link_to 'Computers', macs_path if user_signed_in? || (can? :read, Mac) %>
<%= link_to 'Settings', settings_path if can? :read, Setting %>

View File

@@ -89,6 +89,7 @@
<% else %>
<%= li_link_to 'Certifications', certifications_path if can? :read, Certification %>
<% end %>
<%= li_link_to 'Waivers', contracts_path if can? :read, Contract %>
<%= li_link_to 'Computers', macs_path if user_signed_in? || (can? :read, Mac) %>
<%= li_link_to 'Payments', payments_path if can? :create, Payment %>
<%= li_link_to 'Settings', settings_path if can? :read, Setting %>

View File

@@ -34,18 +34,18 @@
<% end %>
<tr>
<th></th>
<th><a href="?sort=name">Name</a></th>
<th><a href="?sort=member">Member?</a></th>
<th><a href="?full=full&sort=name">Name</a></th>
<th><a href="?full=full&sort=member">Member?</a></th>
<% if current_user.admin? then %><th><a href="?sort=email">Email</a></th><% end %>
<% if current_user.admin? then %>
<th><a href="?sort=orientation">Orientation?</a></th>
<th><a href="?full=full&sort=orientation">Orientation?</a></th>
<% end %>
<th><a href="?sort=waiver">Waiver?</a></th>
<th><a href="?sort=card">Card?</a></th>
<th><a href="?sort=instructor">Instructor?</a></th>
<th><a href="?full=full&sort=waiver">Waiver?</a></th>
<th><a href="?full=full&sort=card">Card?</a></th>
<th><a href="?full=full&sort=instructor">Instructor?</a></th>
<% if current_user.admin? then %><th><a href="?sort=admin">Admin?</a></th><% end %>
<% @certifications.each do |c| %>
<th><a href="?sort=cert&cert=<%= c.id %>"><%= c.name %></a></th>
<th><a href="?full=full&sort=cert&cert=<%= c.id %>"><%= c.name %></a></th>
<% end %>
<th></th>
<th></th>
@@ -61,7 +61,7 @@
<% if current_user.admin? then %><td>
<%= unless user.orientation.blank? then raw("<span class='hoverinfo' title='"+user.orientation.strftime("%B %d %Y")+"'>&#x2713;</span>") end %>
</td><% end %>
<td><%= unless user.waiver.blank? then raw("<span class='hoverinfo' title='"+user.waiver.strftime("%B %d %Y")+"'>&#x2713;</span>") end %></td>
<td><%= unless user.contracts.blank? then raw("<span class='hoverinfo' title='"+user.contracts.first.signed_at.strftime("%B %d %Y")+"'>&#x2713;</span>") end %></td>
<td><%= unless user.cards.blank? then raw("<span class='iconinfo'>&#x2713;</span>") end %></td>
<td><%= if user.instructor? then raw("<span class='iconinfo'>&#x2713;</a>") end %></td>
<% if current_user.admin? then %><td><%= if user.admin? then raw("<span class='iconinfo'>&#x2713;</a>") end %></td><% end %>

View File

@@ -173,9 +173,15 @@ margin-right: auto;
<%= @user.waiver.strftime("%B %d %Y") unless @user.waiver.blank? %><br/>
<b>Contracts:</b> <%= link_to "+ Add", new_contract_path, :class => 'btn' if can? :create, Contract %>
<ul>
<% @user.contracts.each do |contract| %>
<li><%= link_to contract.signed_at.strftime("%B %d %Y"), contract %></li>
<% end %>
<% @user.contracts.each do |contract| %>
<li>
<% if can? :read, contract %>
<%= link_to contract.signed_at.strftime("%B %d %Y"), contract %>
<% else %>
<%= contract.signed_at.strftime("%B %d %Y") %>
<% end %>
</li>
<% end %>
</ul>
</p>