{% extends 'task_orders/_new.html' %}

{% from "components/edit_link.html" import EditLink %}
{% from "components/required_label.html" import RequiredLabel %}
{% from "components/icon.html" import Icon %}
{% from "components/review_field.html" import ReviewField %}

{% block heading %}
  {{ "task_orders.new.review.section_title"| translate }}
{% endblock %}

{% block form %}

<h3 class="subheading">{{ "task_orders.new.review.app_info"| translate }} {{ EditLink(url_for("task_orders.new", screen=1, task_order_id=task_order.id)) }}
</h3>
{% include "fragments/task_order_review/app_info.html" %}
<hr>

<h3 class="subheading">{{ "task_orders.new.review.reporting"| translate }} {{ EditLink(url_for("task_orders.new", screen=1, task_order_id=task_order.id, _anchor="reporting")) }}</h3>

<div class="row">
  {{
    ReviewField(
      ("forms.task_order.app_migration.label" | translate),
      (
        ("forms.task_order.app_migration.{}".format(task_order.app_migration) | translate) if task_order.app_migration
      ),
      filter='safe'
    )
  }}

  {{
    ReviewField(
      ("forms.task_order.native_apps.label" | translate),
      (
        ("forms.task_order.native_apps.{}".format(task_order.native_apps) | translate) if task_order.native_apps
      )
    )
  }}
</div>

<h4 class='task-order-form__heading'>{{ "task_orders.new.review.complexity"| translate }}</h4>
{% if task_order.complexity %}
  <ul class="checklist">
  {% for item in task_order.complexity %}
    <li>
      {{ Icon('ok', classes='icon--gray icon--medium') }}{{ "forms.task_order.complexity.{}".format(item) | translate }}{% if item == 'other' %}: {{ task_order.complexity_other }}{% endif %}
    </li>
  {% endfor %}
  </ul>
{% else %}
  <p>{{ RequiredLabel() }}</p>
{% endif %}

<div class="row">
  <div class="col col--grow">
    <h4 class='task-order-form__heading'>{{ "task_orders.new.review.team"| translate }}</h4>
    {% if task_order.dev_team %}
      <ul class="checklist">
      {% for item in task_order.dev_team %}
        <li>
          {% if item == 'other' %}
            {{ Icon('ok', classes='icon--gray icon--medium') }}Other: {{ task_order.dev_team_other }}
          {% else %}
            {{ Icon('ok', classes='icon--gray icon--medium') }}{{ "forms.task_order.dev_team.{}".format(item) | translate }}
          {% endif %}
        </li>
      {% endfor %}
      </ul>
    {% else %}
      <p>{{ RequiredLabel() }}</p>
    {% endif %}
  </div>

  {{
    ReviewField(
      ("forms.task_order.team_experience.label" |translate),
      (
        ("forms.task_order.team_experience.{}".format(task_order.team_experience) | translate) if task_order.team_experience
      )
    )
  }}
</div>

<hr>

<h3 class="subheading">{{ "task_orders.new.review.funding"| translate }} {{ EditLink(url_for("task_orders.new", screen=2, task_order_id=task_order.id)) }}</h3>
{% include "fragments/task_order_review/funding.html" %}
<hr>

<h3 class="subheading">{{ "task_orders.new.review.oversight"| translate }} {{ EditLink(url_for("task_orders.new", screen=3, task_order_id=task_order.id)) }}</h3>
{% include "fragments/task_order_review/oversight.html" %}
{% endblock %}

{% block next %}
  <div class='action-group'>
    <input type='submit' class='usa-button usa-button-primary' value='Done'
    {% if not complete %}disabled{% endif %}/>
  </div>
{% endblock %}

{% block form_action %}
  {% if task_order_id %}
    <form method='POST' action="{{ url_for('task_orders.invite', task_order_id=task_order_id) }}" autocomplete="off">
  {% endif %}
{% endblock %}
