Merge pull request #663 from dod-ccpo/edit-ko-sections
Allow User to Edit Sections of KO Review
This commit is contained in:
commit
d95039ea83
@ -200,23 +200,41 @@ def get_started():
|
|||||||
@task_orders_bp.route("/task_orders/new/<int:screen>/<task_order_id>")
|
@task_orders_bp.route("/task_orders/new/<int:screen>/<task_order_id>")
|
||||||
@task_orders_bp.route("/portfolios/<portfolio_id>/task_orders/new/<int:screen>")
|
@task_orders_bp.route("/portfolios/<portfolio_id>/task_orders/new/<int:screen>")
|
||||||
def new(screen, task_order_id=None, portfolio_id=None):
|
def new(screen, task_order_id=None, portfolio_id=None):
|
||||||
workflow = ShowTaskOrderWorkflow(g.current_user, screen, task_order_id)
|
|
||||||
|
|
||||||
if task_order_id and screen is 4:
|
if task_order_id and screen is 4:
|
||||||
task_order = TaskOrders.get(g.current_user, task_order_id)
|
task_order = TaskOrders.get(g.current_user, task_order_id)
|
||||||
if not TaskOrders.all_sections_complete(task_order):
|
if not TaskOrders.all_sections_complete(task_order):
|
||||||
flash("task_order_draft")
|
flash("task_order_draft")
|
||||||
|
|
||||||
return render_template(
|
workflow = ShowTaskOrderWorkflow(g.current_user, screen, task_order_id)
|
||||||
workflow.template,
|
template_args = {
|
||||||
current=screen,
|
"current": screen,
|
||||||
|
"task_order_id": task_order_id,
|
||||||
|
"portfolio_id": portfolio_id,
|
||||||
|
"screens": workflow.display_screens,
|
||||||
|
"form": workflow.form,
|
||||||
|
"complete": workflow.is_complete,
|
||||||
|
}
|
||||||
|
|
||||||
|
url_args = {"screen": screen}
|
||||||
|
if task_order_id:
|
||||||
|
url_args["task_order_id"] = task_order_id
|
||||||
|
else:
|
||||||
|
url_args["portfolio_id"] = portfolio_id
|
||||||
|
|
||||||
|
if workflow.task_order:
|
||||||
|
template_args["task_order"] = workflow.task_order
|
||||||
|
if http_request.args.get("ko_edit"):
|
||||||
|
template_args["ko_edit"] = True
|
||||||
|
template_args["next"] = url_for(
|
||||||
|
"portfolios.ko_review",
|
||||||
|
portfolio_id=workflow.task_order.portfolio.id,
|
||||||
task_order_id=task_order_id,
|
task_order_id=task_order_id,
|
||||||
task_order=workflow.task_order,
|
|
||||||
portfolio_id=portfolio_id,
|
|
||||||
screens=workflow.display_screens,
|
|
||||||
form=workflow.form,
|
|
||||||
complete=workflow.is_complete,
|
|
||||||
)
|
)
|
||||||
|
url_args["next"] = template_args["next"]
|
||||||
|
|
||||||
|
template_args["action_url"] = url_for("task_orders.update", **url_args)
|
||||||
|
|
||||||
|
return render_template(workflow.template, **template_args)
|
||||||
|
|
||||||
|
|
||||||
@task_orders_bp.route("/task_orders/new/<int:screen>", methods=["POST"])
|
@task_orders_bp.route("/task_orders/new/<int:screen>", methods=["POST"])
|
||||||
@ -229,15 +247,18 @@ def update(screen, task_order_id=None, portfolio_id=None):
|
|||||||
workflow = UpdateTaskOrderWorkflow(
|
workflow = UpdateTaskOrderWorkflow(
|
||||||
g.current_user, form_data, screen, task_order_id, portfolio_id
|
g.current_user, form_data, screen, task_order_id, portfolio_id
|
||||||
)
|
)
|
||||||
|
|
||||||
if workflow.validate():
|
if workflow.validate():
|
||||||
workflow.update()
|
workflow.update()
|
||||||
return redirect(
|
if http_request.args.get("next"):
|
||||||
url_for(
|
redirect_url = http_request.args.get("next")
|
||||||
|
else:
|
||||||
|
redirect_url = url_for(
|
||||||
"task_orders.new",
|
"task_orders.new",
|
||||||
screen=screen + 1,
|
screen=screen + 1,
|
||||||
task_order_id=workflow.task_order.id,
|
task_order_id=workflow.task_order.id,
|
||||||
)
|
)
|
||||||
)
|
return redirect(redirect_url)
|
||||||
else:
|
else:
|
||||||
return render_template(
|
return render_template(
|
||||||
workflow.template,
|
workflow.template,
|
||||||
|
@ -42,15 +42,23 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel__content">
|
<div class="panel__content">
|
||||||
<div class="h2">{{ "task_orders.new.review.app_info"| translate }}</div>
|
<div class="h2">
|
||||||
|
{{ "task_orders.new.review.app_info"| translate }}
|
||||||
|
</div>
|
||||||
{% include "fragments/task_order_review/app_info.html" %}
|
{% include "fragments/task_order_review/app_info.html" %}
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="h2">{{ "task_orders.new.review.reporting"| translate }}</div>
|
<div class="h2">
|
||||||
|
{{ "task_orders.new.review.reporting"| translate }}
|
||||||
|
{{ EditLink(url_for("task_orders.new", screen=1, task_order_id=task_order.id, _anchor="reporting", ko_edit=True)) }}
|
||||||
|
</div>
|
||||||
{% include "fragments/task_order_review/reporting.html" %}
|
{% include "fragments/task_order_review/reporting.html" %}
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="h2">{{ "task_orders.new.review.funding"| translate }}</div>
|
<div class="h2">
|
||||||
|
{{ "task_orders.new.review.funding"| translate }}
|
||||||
|
{{ EditLink(url_for("task_orders.new", screen=2, task_order_id=task_order.id, _anchor="reporting", ko_edit=True)) }}
|
||||||
|
</div>
|
||||||
{% include "fragments/task_order_review/funding.html" %}
|
{% include "fragments/task_order_review/funding.html" %}
|
||||||
|
|
||||||
<div class="form__sub-fields">
|
<div class="form__sub-fields">
|
||||||
@ -59,7 +67,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="h2">{{ "task_orders.new.review.oversight"| translate }}</div>
|
<div class="h2">
|
||||||
|
{{ "task_orders.new.review.oversight"| translate }}
|
||||||
|
{{ EditLink(url_for("task_orders.new", screen=3, task_order_id=task_order.id, _anchor="reporting", ko_edit=True)) }}
|
||||||
|
</div>
|
||||||
{% include "fragments/task_order_review/oversight.html" %}
|
{% include "fragments/task_order_review/oversight.html" %}
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
@ -9,11 +9,7 @@
|
|||||||
{% include "fragments/flash.html" %}
|
{% include "fragments/flash.html" %}
|
||||||
|
|
||||||
{% block form_action %}
|
{% block form_action %}
|
||||||
{% if task_order_id %}
|
<form method='POST' action="{{ action_url }}" autocomplete="off" enctype="multipart/form-data">
|
||||||
<form method='POST' action="{{ url_for('task_orders.new', screen=current, task_order_id=task_order_id) }}" autocomplete="off" enctype="multipart/form-data">
|
|
||||||
{% else %}
|
|
||||||
<form method='POST' action="{{ url_for('task_orders.update', screen=current, portfolio_id=portfolio_id) }}" autocomplete="off" enctype="multipart/form-data">
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
@ -39,7 +35,7 @@
|
|||||||
{% block next %}
|
{% block next %}
|
||||||
|
|
||||||
<div class='action-group'>
|
<div class='action-group'>
|
||||||
<input type='submit' class='usa-button usa-button-primary' value='Save & Continue' />
|
<input type='submit' class='usa-button usa-button-primary' value='{{ "Save" if ko_edit else "Save & Continue" }}' />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -11,20 +11,12 @@
|
|||||||
|
|
||||||
{% block form %}
|
{% block form %}
|
||||||
|
|
||||||
{% macro TOEditLink(screen=1, anchor=None) %}
|
<h3 class="subheading">{{ "task_orders.new.review.app_info"| translate }} {{ EditLink(url_for("task_orders.new", screen=1, task_order_id=task_order.id)) }}
|
||||||
{% if task_order %}
|
</h3>
|
||||||
{{ EditLink(url_for("task_orders.new", screen=screen, task_order_id=task_order.id, _anchor=anchor)) }}
|
|
||||||
{% else %}
|
|
||||||
{{ EditLink(url_for("task_orders.new", screen=screen, _anchor=anchor)) }}
|
|
||||||
{% endif %}
|
|
||||||
{% endmacro %}
|
|
||||||
|
|
||||||
|
|
||||||
<h3 class="subheading">{{ "task_orders.new.review.app_info"| translate }} {{ TOEditLink(screen=1) }}</h3>
|
|
||||||
{% include "fragments/task_order_review/app_info.html" %}
|
{% include "fragments/task_order_review/app_info.html" %}
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<h3 class="subheading">{{ "task_orders.new.review.reporting"| translate }} {{ TOEditLink(screen=1, anchor="reporting") }}</h3>
|
<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">
|
<div class="row">
|
||||||
{{
|
{{
|
||||||
@ -92,11 +84,11 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<h3 class="subheading">{{ "task_orders.new.review.funding"| translate }} {{ TOEditLink(screen=2) }}</h3>
|
<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" %}
|
{% include "fragments/task_order_review/funding.html" %}
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<h3 class="subheading">{{ "task_orders.new.review.oversight"| translate }} {{ TOEditLink(screen=3) }}</h3>
|
<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" %}
|
{% include "fragments/task_order_review/oversight.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -237,6 +237,24 @@ def test_update_task_order_with_existing_task_order(task_order):
|
|||||||
assert workflow.task_order.start_date.strftime("%m/%d/%Y") == to_data["start_date"]
|
assert workflow.task_order.start_date.strftime("%m/%d/%Y") == to_data["start_date"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_update_to_redirects_to_ko_review(client, user_session, task_order):
|
||||||
|
ko = UserFactory.create()
|
||||||
|
task_order.contracting_officer = ko
|
||||||
|
user_session(ko)
|
||||||
|
url = url_for(
|
||||||
|
"portfolios.ko_review",
|
||||||
|
portfolio_id=task_order.portfolio.id,
|
||||||
|
task_order_id=task_order.id,
|
||||||
|
)
|
||||||
|
response = client.post(
|
||||||
|
url_for("task_orders.new", screen=1, task_order_id=task_order.id, next=url)
|
||||||
|
)
|
||||||
|
body = response.data.decode()
|
||||||
|
|
||||||
|
assert url in body
|
||||||
|
assert response.status_code == 302
|
||||||
|
|
||||||
|
|
||||||
def test_other_text_not_saved_if_other_not_checked(task_order):
|
def test_other_text_not_saved_if_other_not_checked(task_order):
|
||||||
to_data = {
|
to_data = {
|
||||||
**TaskOrderFactory.dictionary(),
|
**TaskOrderFactory.dictionary(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user