{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% 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 %}

{% block service_page_title %}
  {{ user.name or user.email_localpart }}
{% 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,
    back_link=url_for('main.manage_users', service_id=current_service.id)
  ) }}

  <p>
    {{ user.email_address }}&emsp;<a href="{{ url_for('.edit_user_email', service_id=current_service.id, user_id=user.id)}}">Change</a>
  </p>
  {% if mobile_number %}
    <p id="user_mobile_number">
      {{ mobile_number }}&emsp;<a href="{{ url_for('.edit_user_mobile_number', service_id=current_service.id, user_id=user.id)}}">Change</a>
    </p>
  {% endif %}
  <div class="grid-row">
    {% call form_wrapper(class="column-three-quarters") %}

      {% 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 user from service'
        ) }}

    {% endcall %}
  </div>
{% endblock %}
