{% extends "masterRead.html" %}

{% block content %}

  <table class="requirement"><tr><td>

  {% if view.canUpdateDomainObject %}
  <form action="{{uriPrefix}}/{{registryPath}}/update/" method="post">
    <p>
      <input type="submit" value="Update &raquo;" />
  {% if domainObject.ticketUrl %}
    &nbsp;&nbsp;
    <a href="{{domainObject.ticketUrl|escape}}" title="{{domainObject.ticketUrl|escape}}"><b>ticket</b> &#10004;</a>
  {% endif %}
    </p>
  </form>
  {% else %}
    {% if domainObject.ticketUrl %}
    <a href="{{domainObject.ticketUrl|escape}}" title="{{domainObject.ticketUrl|escape}}"><b>ticket</b> &#10004;</a>
    {% endif %}
  {% endif %}

  <h3>{{domainObject.type.name|escape}} Requirement #{{domainObject.id|escape}}</h3>

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

  <p>
    <br />
    <b>Satisfaction:</b> {{domainObject.satisfaction|escape}}
    &nbsp;&nbsp;&nbsp;
    <b>Dissatisfaction:</b> {{domainObject.dissatisfaction|escape}} 
  </p>

  </td></tr><tr><td>
  <p><b>Stories:</b></p>
  <div id="stories-table">
  <p>
  {% for assn in domainObject.stories %}
    {% if view.canUpdateDomainObject %}
    <a class="dissociate" href="#{{registryPath}}/stories/{{ assn.story.id }}">x</a>
    {% endif %}
    <a href="{{uriPrefix}}/stories/{{assn.story.id}}/">{{assn.story.description|escape}}</a>&nbsp;
  {% endfor %}
  </p>
  </div>
  {% if view.canUpdateDomainObject %}
  <br/>
  <div><form action=""><input type="text" id="stories-completer" class="completer" registryPath="{{registryPath}}/stories"/></form></div><br/>
  {% endif %}

  {% if domainObject.dependencies %}
  </td></tr><tr><td>
  <p><b>Dependencies:</b></p><p>
  {% for assn in domainObject.dependencies %}
      <a href="{{uriPrefix}}/requirements/{{assn.requirement.id}}/">{{assn.requirement.description|escape}}</a>&nbsp;
  {% endfor %}
  {% endif %}


  {% if domainObject.conflicts %}
  </td></tr><tr><td>
  <p><b>Conflicts:</b></p><p>
  {% for assn in domainObject.conflicts %}
      <a href="{{uriPrefix}}/requirements/{{assn.requirement.id}}/">{{assn.requirement.description|escape}}</a>&nbsp;
  {% endfor %}
  {% endif %}

  {% if domainObject.rationale %}
  </td></tr><tr><td>
  <p><b>Rationale:</b> {{domainObject.rationale|escape|linebreaks}}</p>
  {% endif %}

  {% if domainObject.source %}
  </td></tr><tr><td>
  <p><b>Source:</b> {{domainObject.source|escape|linebreaks}}</p>
  {% endif %}

  {% if domainObject.fitCriterion %}
  </td></tr><tr><td>
  <p><b>Fit Criterion:</b> {{domainObject.fitCriterion|escape|linebreaks}}</p>
  {% endif %}


  {% if domainObject.supportingMaterials %}
  </td></tr><tr><td>
  <p><b>Supporting Materials:</b> {{domainObject.supportingMaterials|escape|linebreaks}}</p>
  {% endif %}

  {% if domainObject.history %}
  </td></tr><tr><td>
  <p><b>History:</b> {{domainObject.history|escape|linebreaks}}</p>
  {% endif %}

  </td></tr></table>

  <br />

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

  {% if view.canDeleteDomainObject %}
  <form action="{{uriPrefix}}/{{registryPath}}/delete/" method="post">
    <p>
      <input type="submit" value="Delete this requirement &raquo;" />
    </p>
  </form>
  {% endif %}
    

{% endblock %}

