{% extends 'base.html.j2' %}

{% block title %}Team - {{ team.team_name }}{% endblock %}

{% block content %}
<form method="post">
  {% csrf_token %}

  {{ form.as_div }}

      <input style="display:unset;" type="submit" value="Submit">
  </form>


<hr />

<input type="button" value="<< Back" onclick="window.location='{% url 'Access:_organization_view' pk=organization.id %}';">
<input type="button" value="Delete Team"
  onclick="window.location='{% url 'Access:_team_delete' organization_id=organization.id pk=team.id %}';">
<input type="button" value="Assign User"
  onclick="window.location='{% url 'Access:_team_user_add' organization_id=organization.id pk=team.id %}';">
{{ formset.management_form }}

<table id="formset" class="form">
  <thead>
    <tr>
      <th>User</th>
      <th>Manager</th>
      <th>Created</th>
      <th>Modified</th>
      <th>&nbsp;</th>
    </tr>
  </thead>

  {% for field in teamusers %}
  <tr>
    <td>{{ field.user }}</td>
    <td><input type="checkbox" {% if field.manager %}checked{% endif %} disabled></td>
    <td>{{ field.created }}</td>
    <td>{{ field.modified }}</td>
    <td><a
        href="{% url 'Access:_team_user_delete' organization_id=organization.id team_id=field.team_id pk=field.id %}">Delete</a></a>
    </td>
  </tr>
  {% endfor %}
</table>

{% endblock %}