{% extends "base_workspace.html" %}

{% from "components/empty_state.html" import EmptyState %}

{% block workspace_content %}

{% if not members %}

  {{ EmptyState(
    'There are currently no members in this Workspace.',
    actionLabel='Invite a new Member',
    actionHref='/members/new',
    icon='avatar'
  ) }}


{% else %}

  <form class='search-bar'>
    <div class='usa-input search-input'>
      <label for='members-search'>Search members by name</label>
      <input type='search' id='members-search' name='members-search' placeholder="Search by name"/>
      <button type="submit">
        <span class="hide">Search</span>
      </button>
    </div>

    <div class='usa-input filter-input'>
      <label for='filter-status'>Filter members by status</label>
      <select id="filter-status" name="filter-status">
        <option value="" selected disabled>Filter by status</option>
        <option value="">Active</option>
        <option value="">Pending</option>
        <option value="">Denied</option>
      </select>
    </div>

    <div class='usa-input filter-input'>
      <label for='filter-role'>Filter members by role</label>
      <select id="filter-role" name="filter-role">
        <option value="" selected disabled>Filter by role</option>
        <option value="">Admin</option>
        <option value="">CCPO</option>
        <option value="">Developer</option>
      </select>
    </div>
  </form>


  <div class='responsive-table-wrapper'>
    <table>
      <thead>
        <tr>
          <th scope="col" width="50%">Name</th>
          <th scope="col" class='table-cell--shrink'>&nbsp;<span class="hide">Status Flag</span></th>
          <th scope="col">Status</th>
          <th scope="col">Workspace Role</th>
        </tr>
      </thead>
      <tbody>
        {% for m in members %}
        <tr>
          <td><a href="/workspaces/123456/members/789/edit" class="icon-link icon-link--large">{{ m['first_name'] }} {{ m['last_name'] }}</a></td>
          <td class='table-cell--shrink'>{% if m['num_projects'] == '0' %} <span class="label label--info">No Project Access</span> {% endif %}</td>
          <td>{{ m['status'] }}</a></td>
          <td>{{ m['workspace_role'] }}</a></td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>

{% endif %}


{% endblock %}

