<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8"/>
  <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
  <link rel="icon" href="/favicon.ico" type="image/x-icon"/>
  <link rel="stylesheet" href="{{document.meta.get_root_path_prefix()}}/_static/global.css" />
  <link rel="stylesheet" href="{{document.meta.get_root_path_prefix()}}/_static/layout-main-with-toc.css" />
  <script type="text/javascript" src="{{document.meta.get_root_path_prefix()}}/_static/toc.js"></script>
  <title>{{document.name}} - Traceability</title>
</head>

<body class="traceability">
  {%- set document_iterator = traceability_index.get_document_iterator(document) -%}
  <div id="toc_layout" class="layout-with-toc">

    <aside class="toc">
      {% include "_shared/table_of_contents.jinja.html" %}
    </aside>

    <main class="content">
      <header class="document-header">
        {{document.name}} <span class="document-view-type">Traceability</span>
      </header>

      {% include "_shared/tags.jinja.html" %}

      <article class="view-traceability" id="sections-and-requirements">
      {%- for section_or_requirement in document_iterator.all_content() %}

        {%- if section_or_requirement.is_requirement %}
        <section class="view-traceability_row" id="{{ link_renderer.render(section_or_requirement) }}">
          <div class="view-traceability_column" data-requirement-role="parents">
          {%- for requirement in traceability_index.get_parent_requirements(section_or_requirement) %}

            {% with requirement_view_type='card' -%}
            {% include "_shared/requirement.jinja.html" %}
            {%- endwith %}

          {%- endfor %}
          </div>

          <div class="view-traceability_column" data-requirement-role="current">
            {%- set requirement = section_or_requirement %}

            {% with requirement_view_type='card' -%}
            {% include "_shared/requirement.jinja.html" %}
            {%- endwith %}

          </div>
          <div class="view-traceability_column" data-requirement-role="children">
          {%- for requirement in traceability_index.get_children_requirements(section_or_requirement) %}

            {% with requirement_view_type='card' -%}
            {% include "_shared/requirement.jinja.html" %}
            {%- endwith %}

          {%- endfor %}
          </div>
        </section>

        {%- elif section_or_requirement.is_section %}
        <section class="view-traceability_row" id="{{ link_renderer.render(section_or_requirement) }}">

          <div class="view-traceability_column" data-requirement-role="parent"></div>
          <div class="view-traceability_column" data-requirement-role="current">

            {%- set section = section_or_requirement %}
            <h{{ section.ng_level }} class="section-title" data-level="{{ section.context.title_number_string }}">
              {{ section.title if section.title else '' }}
            </h{{ section.ng_level }}>
          </div>
          <div class="view-traceability_column" data-requirement-role="children"></div>
        </section>
        {%- for free_text in section.free_texts -%}
        <section class="view-traceability_row">
          <div class="view-traceability_column" data-requirement-role="parent">
          </div>
          <div class="view-traceability_column" data-requirement-role="current">
            <div class="free_text">
              {{ renderer.render_free_text(free_text) }}
            </div>
          </div>
          <div class="view-traceability_column" data-requirement-role="children">
          </div>
        </section>
        {%- endfor -%}

        {%- endif %}

      {%- endfor %}
      </article>

    </main>
  </div>
</body>
</html>
