{% extends "layout.html" %}

{% block content_header %}
  {{ build_breadcrumbs(current_breadcrumbs + [
    { 'name': resource.name, 'link': url_for('.CallPickupView:get', id=resource.id), 'icon': 'rotate-left' }
  ]) }}
{% endblock %}

{% block content %}
  {% call build_section_row() %}
    {% call build_form_tabs_box() %}

      {% call build_tabs_navigation() %}
        {{ add_tab_navigation_header(_('Call Pickups'), resource.name, 'rotate-left') }}
        {{ add_tab_navigation_item('general', _('General'), active=True) }}
        {{ add_tab_navigation_item('interceptors', _('Interceptors')) }}
        {{ add_tab_navigation_item('targets', _('Targets')) }}
      {% endcall %}

      {% call build_form(action=url_for('.CallPickupView:put', id=resource.id)) %}
        {% call build_tabs_content() %}

          {% call build_tab_content_item('general', active=True) %}
            {% call add_default_fields(form=form, submit_value=_('Update')) %}
              {{ render_field(form.name) }}
              {{ render_field(form.description) }}
            {% endcall %}
          {% endcall %}

          {% call build_tab_content_item('interceptors') %}
            {% call add_default_fields(form=form, submit_value=_('Update')) %}
              {{ render_field(form.interceptors.form.user_uuids, data_listing_href=url_for(listing_urls['uuid_user'])) }}
              {{ render_field(form.interceptors.form.group_ids, data_listing_href=url_for(listing_urls['group'])) }}
            {% endcall %}
          {% endcall %}

          {% call build_tab_content_item('targets') %}
            {% call add_default_fields(form=form, submit_value=_('Update')) %}
              {{ render_field(form.targets.form.user_uuids, data_listing_href=url_for(listing_urls['uuid_user'])) }}
              {{ render_field(form.targets.form.group_ids, data_listing_href=url_for(listing_urls['group'])) }}
            {% endcall %}
          {% endcall %}

        {% endcall %}

      {% endcall %}
    {% endcall %}
  {% endcall %}
{% endblock %}
