{% extends "masterRead.html" %}

{% block content %}

  <h2>Goal #{{ 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>The following processes work towards this goal:</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>No processes have been identified as working towards this goal.</p>
  {% endif %}
  </div>
  {% if view.canUpdateDomainObject %}
  <div><form><input type="text" id="processes-completer" class="completer" registryPath="{{registryPath}}/processes"/></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 %}

