{% extends "withnav_template.html" %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% from "components/banner.html" import banner %}
{% from "components/components/back-link/macro.njk" import usaBackLink %}

{% block service_page_title %}
  {{ user.name or user.email_localpart }}
{% endblock %}

{% block backLink %}
  {{ usaBackLink({ "href": url_for('main.manage_users', service_id=current_service.id) }) }}
{% endblock %}

{% block maincolumn_content %}
  {% if delete %}
    {{ banner(
      'Are you sure you want to remove {}?'.format(user.name),
      type='dangerous',
      delete_button='Yes, remove',
      action=url_for('.remove_user_from_service', service_id=current_service.id, user_id=user.id)
    ) }}
  {% endif %}

  {{ page_header(user.name or user.email_localpart) }}

  <p class="usa-body">
    {{ user.email_address }}&emsp;
    <a class="usa-link" href="{{ url_for('.edit_user_email', service_id=current_service.id, user_id=user.id)}}">
    Change<span class="usa-sr-only"> email address</span>
    </a>
  </p>
  <p class="usa-body">
    Platform admin users can access all template folders.
  </p>
  {% if mobile_number %}
    <p class="usa-body" id="user_mobile_number">
      {{ mobile_number }}&emsp;
      <a class="usa-link" href="{{ url_for('.edit_user_mobile_number', service_id=current_service.id, user_id=user.id)}}">
      Change<span class="usa-sr-only"> mobile number</span>
      </a>
    </p>
  {% endif %}
  {% call form_wrapper() %}

    {% include 'views/manage-users/permissions.html' %}

    {{ page_footer(
      'Save',
      delete_link=url_for('.edit_user_permissions', service_id=current_service.id, user_id=user.id, delete='yes'),
      delete_link_text='Remove this team member'
    ) }}

  {% endcall %}

{% endblock %}
