122 lines
3.8 KiB
HTML
122 lines
3.8 KiB
HTML
{% from "components/empty_state.html" import EmptyState %}
|
||
{% from "components/icon.html" import Icon %}
|
||
{% from "components/sticky_cta.html" import StickyCTA %}
|
||
|
||
{% extends "portfolios/base.html" %}
|
||
|
||
{% block portfolio_content %}
|
||
|
||
{% macro TaskOrderReviewButton(task_order, text="Edit", secondary=False, modal=None) %}
|
||
<a href="{{ url_for('task_orders.review_task_order', task_order_id=task_order.id, modal=modal) }}" class="usa-button {{ 'usa-button-secondary' if secondary else '' }}">
|
||
{{ text }}
|
||
</a>
|
||
{% endmacro %}
|
||
|
||
{% macro TaskOrderEditButton(task_order, text="Edit", secondary=False) %}
|
||
<a href="{{ url_for('task_orders.form_step_one_add_pdf', task_order_id=task_order.id) }}" class="usa-button {{ 'usa-button-secondary' if secondary else '' }}">
|
||
{{ text }}
|
||
</a>
|
||
{% endmacro %}
|
||
|
||
{% macro TaskOrderDateTime(dt, className="") %}
|
||
<local-datetime timestamp="{{ dt }}" format="MMMM D, YYYY" class="{{ className }}"></local-datetime>
|
||
{% endmacro %}
|
||
|
||
{% macro TaskOrderDate(task_order) %}
|
||
<span class="datetime">
|
||
<!-- Draft: {Begins, Began} start_date -->
|
||
<!-- Everything else: {Starts, Started} start_date | {Ends, Ended} end_date -->
|
||
|
||
{% if task_order.is_draft %}
|
||
{% if task_order.has_begun %}
|
||
Started on
|
||
{% else %}
|
||
Starts on
|
||
{% endif %}
|
||
{{ TaskOrderDateTime(task_order.time_created) }}
|
||
{% else %}
|
||
{% if task_order.has_begun %}
|
||
Began
|
||
{% else %}
|
||
Begins
|
||
{% endif %}
|
||
{{ TaskOrderDateTime(task_order.start_date) }}
|
||
{% endif %}
|
||
|
||
{% if not task_order.is_draft %}
|
||
|
|
||
|
||
{% if task_order.has_ended %}
|
||
Ended
|
||
{% else %}
|
||
Ends
|
||
{% endif %}
|
||
|
||
{{ TaskOrderDateTime(task_order.end_date) }}
|
||
{% endif %}
|
||
</span>
|
||
{% endmacro %}
|
||
|
||
{% macro TaskOrderActions(task_order) %}
|
||
<div class="task-order-card__buttons">
|
||
{% if task_order.is_draft %}
|
||
{{ TaskOrderEditButton(task_order, text="Edit") }}
|
||
{% elif task_order.is_expired %}
|
||
{{ TaskOrderReviewButton(task_order, text="View") }}
|
||
{% elif task_order.is_unsigned %}
|
||
{{ TaskOrderReviewButton(task_order, text="Sign", secondary=True, modal="submit-to-1") }}
|
||
{{ TaskOrderReviewButton(task_order, text="View") }}
|
||
{% else %}
|
||
{% endif %}
|
||
</div>
|
||
{% endmacro %}
|
||
|
||
{% macro TaskOrderList(task_orders, label='success') %}
|
||
<div class="task-order-list">
|
||
{% for task_order in task_orders %}
|
||
<div class="card task-order-card">
|
||
<div class="card__status">
|
||
<span class='label label--{{ label_colors[task_order.status] }}'>{{ task_order.display_status }}</span>
|
||
{{ TaskOrderDate(task_order) }}
|
||
<span class="card__status-spacer"></span>
|
||
<span class="card__button">
|
||
{{ TaskOrderActions(task_order) }}
|
||
</span>
|
||
</div>
|
||
<div class="card__header">
|
||
<h3>Task Order #{{ task_order.number }}</h3>
|
||
</div>
|
||
<div class="card__body">
|
||
<b>Obligated amount: </b>${{ task_order.total_obligated_funds }}
|
||
</div>
|
||
</div>
|
||
{% endfor %}
|
||
</div>
|
||
{% endmacro %}
|
||
|
||
|
||
{% call StickyCTA(text="Funding") %}
|
||
{% if user_can(permissions.CREATE_TASK_ORDER) %}
|
||
<a href="{{ url_for("task_orders.form_step_one_add_pdf", portfolio_id=portfolio.id) }}" class="usa-button usa-button-primary" type="submit">Start a new task order</a>
|
||
{% endif %}
|
||
{% endcall %}
|
||
|
||
{% include "fragments/flash.html" %}
|
||
|
||
<div class="portfolio-funding">
|
||
|
||
{% if task_orders %}
|
||
{{ TaskOrderList(task_orders) }}
|
||
{% else %}
|
||
{{ EmptyState(
|
||
'This portfolio doesn’t have any active or pending task orders.',
|
||
action_label='Add a New Task Order',
|
||
action_href=url_for('task_orders.form_step_one_add_pdf', portfolio_id=portfolio.id),
|
||
icon='cloud',
|
||
add_perms=user_can(permissions.CREATE_TASK_ORDER)
|
||
) }}
|
||
{% endif %}
|
||
</div>
|
||
|
||
{% endblock %}
|