Portfolio Name and Defense Component read only on TOs that are started from existing portfolios

This commit is contained in:
Montana 2019-02-28 11:18:09 -05:00
parent 6720b60bc4
commit 68a1ffde8b
3 changed files with 17 additions and 5 deletions

View File

@ -237,6 +237,11 @@ def new(screen, task_order_id=None, portfolio_id=None):
task_order_id=task_order_id,
)
url_args["next"] = template_args["next"]
elif http_request.args.get("new_to_on_portfolio"):
portfolio = Portfolios.get(g.current_user, portfolio_id)
template_args["portfolio_name"] = portfolio.name
template_args["defense_component"] = portfolio.defense_component
template_args["new_to_on_portfolio"] = True
template_args["action_url"] = url_for("task_orders.update", **url_args)

View File

@ -93,7 +93,7 @@
<div class="portfolio-funding">
<div class='portfolio-funding__header row'>
<a href="{{ url_for("task_orders.new", screen=1, portfolio_id=portfolio.id) }}" class="usa-button">Start a New Task Order</a>
<a href="{{ url_for("task_orders.new", screen=1, portfolio_id=portfolio.id, new_to_on_portfolio=True) }}" class="usa-button">Start a New Task Order</a>
</div>
{% for task_order in pending_task_orders %}

View File

@ -4,6 +4,7 @@
{% from "components/options_input.html" import OptionsInput %}
{% from "components/date_input.html" import DateInput %}
{% from "components/multi_checkbox_input.html" import MultiCheckboxInput %}
{% from "components/review_field.html" import ReviewField %}
{% block heading %}
{{ "task_orders.new.app_info.section_title"| translate }}
@ -14,11 +15,17 @@
<!-- App Info Section -->
<h3 class="task-order-form__heading subheading">{{ "task_orders.new.app_info.basic_info_title"| translate }}</h3>
{{ TextInput(form.portfolio_name, placeholder="The name of your office or organization", validation="portfolioName") }}
{{ TextInput(form.scope, paragraph=True) }}
<p><i>{{ "task_orders.new.app_info.sample_scope" | translate | safe }}</i></p>
{% if new_to_on_portfolio %}
{{ ReviewField(heading="forms.portfolio.name_label" | translate, field=portfolio_name) }}
{% else %}
{{ TextInput(form.portfolio_name, placeholder="The name of your office or organization", validation="portfolioName") }}
{{ TextInput(form.scope, paragraph=True) }}
<p><i>{{ "task_orders.new.app_info.sample_scope" | translate | safe }}</i></p>
{% endif %}
<div class="subheading--black">
{{ OptionsInput(form.defense_component) }}
{{ ReviewField(heading="forms.task_order.defense_component_label" | translate, field=defense_component) if new_to_on_portfolio else OptionsInput(form.defense_component) }}
</div>
<hr>