{% extends "layout.html" %}

{% block content_header %}
  {{ build_breadcrumbs([
    { 'name': _('Phonebook'), 'link': url_for('.PhonebookView:index'), 'icon': 'book' }
  ]) }}
{% endblock %}

{% block content %}
  <section class="content">
    {% call build_list_containers(_('Phonebooks'), 'book') %}
      {% call build_list_table() %}
        {% call build_list_table_headers(get=url_for('.PhonebookView:get', id=''), delete=url_for('.PhonebookView:delete', id='')) %}
          <th>{{ _('Name') }}</th>
          <th>{{ _('Description') }}</th>
        {% endcall %}
        {% call(phonebook) build_list_table_rows(resource_list['items']) %}
          <td>{{ phonebook.name }}</td>
          <td>{{ phonebook.description or '-' }}</td>
        {% endcall %}
      {% endcall %}
    {% endcall %}

    {% call build_hidden_add_containers(_('Add Phonebook')) %}
      {% call build_form() %}
        {% call add_default_fields(form=form, submit_value=_('Add')) %}
          {{ render_field(form.name) }}
          {{ render_field(form.description) }}
        {% endcall %}
      {% endcall %}
    {% endcall %}
  </section>
{% endblock %}
