{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}

{% block description %}
{% endblock %}

{% block endpoints %}
<ul>
<li>{% trans 'Dump database (debug):' %} <a href="{% url 'fake-family-dump' slug=object.slug %}"
        >{{ site_base_uri }}{% url 'fake-family-dump' slug=object.slug %}</a></li>
<li>{% trans 'Link NameID with an adult:' %} <a href="{% url 'fake-family-link' slug=object.slug %}"
        >{{ site_base_uri }}{% url 'fake-family-link' slug=object.slug %}?NameID=...&login=...&password=...</a></li>
<li>{% trans 'Unlink NameID:' %} <a href="{% url 'fake-family-unlink' slug=object.slug %}"
        >{{ site_base_uri }}{% url 'fake-family-unlink' slug=object.slug %}?NameID=...</a></li>
<li>{% trans 'Get all family informations:' %} <a href="{% url 'fake-family-info' slug=object.slug %}"
        >{{ site_base_uri }}{% url 'fake-family-info' slug=object.slug %}?NameID=...</a></li>
<li>{% trans 'Get family list of items:' %} <a href="{% url 'fake-family-key' slug=object.slug key='key' %}"
        >{{ site_base_uri }}{% url 'fake-family-key' slug=object.slug key='key' %}?NameID=...</a></li>
        <em>key</em> = <em>adults</em>, <em>children</em>, …
</ul>

<div>
<h3>Contents</h3>

<h4>Adults</h4>
<table class="main">
  <thead><tr><th>id</th><th>text</th><th>birthdate</th><th>keywords</th></tr></thead>
  <tbody>
  {% for adult in object.jsondatabase.adults.values|dictsort:"id" %}
    <tr>
      <td>{{ adult.id }}</td><td>{{ adult.text }}</td><td>{{ adult.birthdate }}</td>
      <td>{{ adult.keywords|join:'<br />' }}</td>
    </tr>
{% endfor %}
  </tbody>
</table>

<h4>Children</h4>
<table class="main">
  <thead><tr><th>id</th><th>text</th><th>birthdate</th><th>keywords</th></tr></thead>
  <tbody>
  {% for child in object.jsondatabase.children.values|dictsort:"id" %}
    <tr>
      <td>{{ child.id }}</td><td>{{ child.text }}</td><td>{{ child.birthdate }}</td>
      <td>{{ child.keywords|join:'<br />' }}</td>
    </tr>
{% endfor %}
  </tbody>
</table>

<h4>Families</h4>
<table class="main">
  <thead><tr><th>id</th><th>adults</th><th>children</th>
  <th>contacts</th><th>keywords</th></tr></thead>
  <tbody>
  {% for family in object.jsondatabase.families.values|dictsort:"id" %}
    <tr>
      <td>{{ family.id }}</td>
      <td>{{ family.adults|join:', ' }}</td>
      <td>{{ family.children|join:', ' }}</td>
      <td>{{ family.contacts|join:', ' }}</td>
      <td>{{ family.keywords|join:'<br />' }}</td>
    </tr>
{% endfor %}
  </tbody>
</table>
</div>
{% endblock %}


{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
{% endblock %}
