<!-- FIXME: This view is quickly turning into what should be applicants/index.html.erb -->

<% unless @applicants.empty? %>
  <p>Who is applying for housing?<p>
  <table class="table">
    <tr>
      <th>
        Name
      </th>
      <th>
        Address
      </th>
      <th> </th>
      <th> </th>
    </tr>
  <% @applicants.each do |applicant| %>
    <tr>
      <td>
        <%= applicant %>
      </td>
      <td>
        <%= applicant.identity.mail_address %>
      </td>
      <td>
        <%= link_to 'Edit', applicant, class: "btn btn-lg btn-info"%>
      </td>
      <td>
        <%= link_to 'Delete', applicant, class: "btn btn-lg btn-danger", method: :delete, data: { confirm: 'Are you sure?' } %>
      </td>
    </tr>
  <% end %>
  </table>
<% else %>
  <p>Looks like you don't have any applicants yet.  You should create one!</p>
<% end %>

<p><%= link_to "Create a new applicant", new_applicant_path, class: "btn btn-lg btn-success"%></p>
<p><%= link_to "Pull applicants from Salesforce", '/salesforce_applicants/sync', class: "btn btn-lg btn-success"%></p>

<!-- FIXME: This view is quickly turning into what should be applicants/index.html.erb -->

<% unless @applicants.empty? %>
  <p>Who is applying for housing?<p>
  <table class="table">
    <tr>
      <th>
        Name
      </th>
      <th>
        Address
      </th>
      <th/>
      <th/>
      <th/>
    </tr>
    <% @applicants.each do |applicant| %>
      <tr>
        <td>
          <%= applicant %>
        </td>
        <td>
          <%= applicant.identity.mail_address %>
        </td>
        <td>
          <% if applicant.salesforce_applicant.nil? %>
            <p class="text-muted">Not from Salesforce</p>
          <% else %>
            <%= link_to 'Update from Salesforce', "/salesforce_applicants/#{applicant.salesforce_applicant.id}/sync", class: "btn btn-lg btn-info"%>
          <% end %>
        </td>
        <td>
          <%= link_to 'Edit', applicant, class: "btn btn-lg btn-info"%>
        </td>
        <td>
          <%= link_to 'Delete', applicant, class: "btn btn-lg btn-danger", method: :delete, data: { confirm: 'Are you sure?' } %>
        </td>
      </tr>
    <% end %>
  </table>
<% else %>
  <p>Looks like you don't have any applicants yet.  You should create one!</p>
<% end %>

<p><%= link_to "Create a new applicant", new_applicant_path, class: "btn btn-lg btn-success"%></p>
<p><%= link_to "Pull applicants from Salesforce", '/salesforce_applicants/sync', class: "btn btn-lg btn-success"%></p>

Add "Sync from salesforce" button for individual applicants
Add "Sync from salesforce" button for individual applicants
