{% extends "masterRead.html" %}

{% block content %}

  <h2>Collection #{{ domainObject.id }}</h2>

  {% if view.canUpdateDomainObject %}
  <form action="{{uriPrefix}}/{{registryPath}}/update/" method="post">
      <input type="submit" value="Update &raquo;" />
      <br />
  </form>
  {% endif %}

  <h2>&quot;{{ domainObject.description|escape }}&quot;</h2>

  <h3>Processes</h3>
  <div id="processes-table">
  {% if domainObject.processes %}
    <p>This collection presents these processes:
    </p>
    <table>
      <th>Process</th>
      <th>Events</th>
  {% for assn in domainObject.processes %}
    <tr>
      <td> 
      {% if view.canUpdateDomainObject %}
        <a class="dissociate" href="#{{registryPath}}/processes/{{ assn.process.id }}">x</a>
      {% endif %}
        <a href="{{ uriPrefix }}/processes/{{ assn.process.id }}/">{{ assn.process.description|escape }}</a>
      </td>
      <td>
    {% for eventAssn in assn.process.events %}
      <a href="{{ uriPrefix }}/events/{{ eventAssn.event.id }}/">{{ eventAssn.event.description|escape }}.</a>&nbsp;
    {% endfor %}
      </td>
    </tr>
  {% endfor %}
    </table>
  {% else %}
  <p>This collection does not contain any processes at this time.</p>
  {% endif %}
  </div>

  {% if view.canUpdateDomainObject %}
  <div><form action=""><input type="text" id="processes-completer" class="completer" registryPath="{{registryPath}}/processes"/></form></div><br/>
  {% endif %}

  <h3>Products</h3>
  <div id="products-table">
  {% if domainObject.products %}
    <p>This collection presents these products:
    </p>
    <table>
      <th>Product</th><th>Stories</th>
  {% for assn in domainObject.products %}
    <tr>
      <td>
      {% if view.canUpdateDomainObject %}
        <a class="dissociate" href="#{{registryPath}}/products/{{ assn.product.id }}">x</a>
      {% endif %}
        <a href="{{ uriPrefix }}/products/{{ assn.product.id }}/">{{ assn.product.description|escape }}</a>
      </td>
      <td>
    {% for storyAssn in assn.product.stories %}
      <a href="{{ uriPrefix }}/stories/{{ storyAssn.story.id }}/">{{ storyAssn.story.description|escape }}.</a>&nbsp;
    {% endfor %}
      </td>
      </tr>
  {% endfor %}
    </table>
  {% else %}
    <p>This collection does not contain any products at this time.</p>
  {% endif %}
  </div>
  {% if view.canUpdateDomainObject %}
  <div><form><input type="text" id="products-completer" class="completer" registryPath="{{registryPath}}/products"/></form></div><br/>
  {% endif %}

  {% if view.canUpdateDomainObject %}
  <form action="{{uriPrefix}}/{{registryPath}}/update/" method="post">
    <strong>Do you wish to update this {{domainClassName}}?</strong><br />
    <p>
      <input type="submit" value="Update {{domainClassName}} &raquo;" />
    </p>
  </form>
    {% endif %}
    {% if view.canDeleteDomainObject %}
  <form action="{{uriPrefix}}/{{registryPath}}/delete/" method="post">
    <strong>Do you wish to delete this {{domainClassName}}?</strong><br />
    <p>
      <input type="submit" value="Delete {{domainClassName}} &raquo;" />
    </p>
  </form>
  {% endif %}

{% endblock %}





