Start TO form template
This commit is contained in:
parent
91e41199b7
commit
e7771f789b
@ -1,7 +1,4 @@
|
|||||||
from wtforms.fields import (
|
from wtforms.fields import BooleanField, DecimalField, StringField
|
||||||
BooleanField,
|
|
||||||
StringField,
|
|
||||||
)
|
|
||||||
from wtforms.fields.html5 import DateField
|
from wtforms.fields.html5 import DateField
|
||||||
from wtforms.validators import Required, Optional
|
from wtforms.validators import Required, Optional
|
||||||
|
|
||||||
@ -10,7 +7,11 @@ from atst.utils.localization import translate
|
|||||||
|
|
||||||
|
|
||||||
class TaskOrderForm(BaseForm):
|
class TaskOrderForm(BaseForm):
|
||||||
number = StringField(validators=[Required()])
|
number = StringField(
|
||||||
|
translate("forms.task_order.number_label"),
|
||||||
|
description=translate("forms.task_order.number_description"),
|
||||||
|
validators=[Required()],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class FundingForm(BaseForm):
|
class FundingForm(BaseForm):
|
||||||
|
@ -1,12 +1,4 @@
|
|||||||
from copy import deepcopy
|
from flask import g, render_template, request as http_request
|
||||||
|
|
||||||
from flask import (
|
|
||||||
g,
|
|
||||||
redirect,
|
|
||||||
render_template,
|
|
||||||
request as http_request,
|
|
||||||
url_for,
|
|
||||||
)
|
|
||||||
|
|
||||||
from . import task_orders_bp
|
from . import task_orders_bp
|
||||||
from atst.domain.authz.decorator import user_can_access_decorator as user_can
|
from atst.domain.authz.decorator import user_can_access_decorator as user_can
|
||||||
@ -14,19 +6,12 @@ from atst.domain.task_orders import TaskOrders
|
|||||||
from atst.forms.task_order import TaskOrderForm
|
from atst.forms.task_order import TaskOrderForm
|
||||||
from atst.models.permissions import Permissions
|
from atst.models.permissions import Permissions
|
||||||
from atst.utils.flash import formatted_flash as flash
|
from atst.utils.flash import formatted_flash as flash
|
||||||
from atst.utils.localization import translate
|
|
||||||
|
|
||||||
|
|
||||||
@task_orders_bp.route("/task_orders/new/get_started")
|
|
||||||
# TODO: see if this route still exists in new design
|
|
||||||
def get_started():
|
|
||||||
return render_template("task_orders/new/get_started.html") # pragma: no cover
|
|
||||||
|
|
||||||
|
|
||||||
@task_orders_bp.route("/portfolios/<portfolio_id>/task_orders/new")
|
@task_orders_bp.route("/portfolios/<portfolio_id>/task_orders/new")
|
||||||
@user_can(Permissions.CREATE_TASK_ORDER, message="view new task order form")
|
@user_can(Permissions.CREATE_TASK_ORDER, message="view new task order form")
|
||||||
def new(portfolio_id):
|
def new(portfolio_id):
|
||||||
return render_template("task_orders/new", form=TaskOrderForm())
|
return render_template("task_orders/new.html", form=TaskOrderForm())
|
||||||
|
|
||||||
|
|
||||||
@task_orders_bp.route("/portfolios/<portfolio_id>/task_orders/new", methods=["POST"])
|
@task_orders_bp.route("/portfolios/<portfolio_id>/task_orders/new", methods=["POST"])
|
||||||
@ -37,7 +22,11 @@ def create(portfolio_id):
|
|||||||
|
|
||||||
if form.validate():
|
if form.validate():
|
||||||
TaskOrders.create(g.current_user, portfolio_id, **form.data)
|
TaskOrders.create(g.current_user, portfolio_id, **form.data)
|
||||||
# TODO: ask UX where do you go after save
|
flash("task_order_draft")
|
||||||
|
return render_template("task_orders/new.html", form=form)
|
||||||
|
else:
|
||||||
|
flash("form_errors")
|
||||||
|
return render_template("task_orders/new.html", form=form)
|
||||||
|
|
||||||
|
|
||||||
@task_orders_bp.route("/portfolios/<portfolio_id>/task_orders/<task_order_id>/edit")
|
@task_orders_bp.route("/portfolios/<portfolio_id>/task_orders/<task_order_id>/edit")
|
||||||
@ -56,4 +45,8 @@ def update(portfolio_id, task_order_id=None):
|
|||||||
|
|
||||||
if form.validate():
|
if form.validate():
|
||||||
TaskOrders.update(task_order_id, **form.data)
|
TaskOrders.update(task_order_id, **form.data)
|
||||||
# TODO: ask UX where do you go after save
|
flash("task_order_draft")
|
||||||
|
return render_template("task_orders/new.html", form=form)
|
||||||
|
else:
|
||||||
|
flash("form_errors")
|
||||||
|
return render_template("task_orders/new.html", form=form)
|
||||||
|
@ -29,12 +29,6 @@
|
|||||||
<li><span class="sidenav__text">You have no portfolios yet</span></li>
|
<li><span class="sidenav__text">You have no portfolios yet</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="sidenav__divider--small"></div>
|
|
||||||
<a class="sidenav__link sidenav__link--add" href="{{ url_for("task_orders.get_started") }}" title="Fund a New Portfolio">
|
|
||||||
<span class="sidenav__link-label">Fund a new portfolio</span>
|
|
||||||
{{ Icon("plus", classes="sidenav__link-icon") }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,11 +6,10 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
{{
|
{{
|
||||||
EmptyState(
|
EmptyState(
|
||||||
action_href=url_for("task_orders.get_started"),
|
action_href="#",
|
||||||
action_label=("portfolios.index.empty.start_button" | translate),
|
action_label=("portfolios.index.empty.start_button" | translate),
|
||||||
icon="cloud",
|
icon="cloud",
|
||||||
message=("portfolios.index.empty.title" | translate),
|
message=("portfolios.index.empty.title" | translate),
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@
|
|||||||
|
|
||||||
{% call StickyCTA(text="Funding") %}
|
{% call StickyCTA(text="Funding") %}
|
||||||
<div class='portfolio-funding__header row'>
|
<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", portfolio_id=portfolio.id) }}" class="usa-button">Start a new task order</a>
|
||||||
</div>
|
</div>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|
||||||
@ -125,7 +125,7 @@
|
|||||||
{{ EmptyState(
|
{{ EmptyState(
|
||||||
'This portfolio doesn’t have any active or pending task orders.',
|
'This portfolio doesn’t have any active or pending task orders.',
|
||||||
action_label='Add a New Task Order',
|
action_label='Add a New Task Order',
|
||||||
action_href=url_for('task_orders.new', screen=1, portfolio_id=portfolio.id),
|
action_href=url_for('task_orders.new', portfolio_id=portfolio.id),
|
||||||
icon='cloud',
|
icon='cloud',
|
||||||
) }}
|
) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% from 'components/save_button.html' import SaveButton %}
|
||||||
|
{% from 'components/text_input.html' import TextInput %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="col task-order-form">
|
||||||
|
{% include "fragments/flash.html" %}
|
||||||
|
<div class="panel">
|
||||||
|
{% block portfolio_header %}
|
||||||
|
{% include "portfolios/header.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
<base-form inline-template>
|
||||||
|
<form id="new-task-order" action='{{ url_for("task_orders.create", portfolio_id=portfolio.id) }}' method="POST" autocomplete="off">
|
||||||
|
{{ form.csrf_token }}
|
||||||
|
<div class="panel__content">
|
||||||
|
<!-- TODO: implement save bar with component -->
|
||||||
|
<span class="h3">Add Funding</span>
|
||||||
|
{{ SaveButton(text=('common.save' | translate), element='input', form='new-task-order') }}
|
||||||
|
</div>
|
||||||
|
<div class="panel__content">
|
||||||
|
{{ "task_orders.new.form_help_text" | translate }}
|
||||||
|
<hr>
|
||||||
|
{{ TextInput(form.number) }}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</base-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@ -1,5 +1,3 @@
|
|||||||
{% extends 'task_orders/_new.html' %}
|
|
||||||
|
|
||||||
{% from "components/text_input.html" import TextInput %}
|
{% from "components/text_input.html" import TextInput %}
|
||||||
{% from "components/options_input.html" import OptionsInput %}
|
{% from "components/options_input.html" import OptionsInput %}
|
||||||
{% from "components/date_input.html" import DateInput %}
|
{% from "components/date_input.html" import DateInput %}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
{% extends 'task_orders/_new.html' %}
|
|
||||||
|
|
||||||
{% from "components/text_input.html" import TextInput %}
|
{% from "components/text_input.html" import TextInput %}
|
||||||
{% from "components/options_input.html" import OptionsInput %}
|
{% from "components/options_input.html" import OptionsInput %}
|
||||||
{% from "components/date_input.html" import DateInput %}
|
{% from "components/date_input.html" import DateInput %}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
{% extends 'task_orders/_new.html' %}
|
|
||||||
|
|
||||||
{% from "components/user_info.html" import UserInfo %}
|
{% from "components/user_info.html" import UserInfo %}
|
||||||
{% from "components/checkbox_input.html" import CheckboxInput %}
|
{% from "components/checkbox_input.html" import CheckboxInput %}
|
||||||
{% from "components/text_input.html" import TextInput %}
|
{% from "components/text_input.html" import TextInput %}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
{% extends 'task_orders/_new.html' %}
|
|
||||||
|
|
||||||
{% from "components/edit_link.html" import EditLink %}
|
{% from "components/edit_link.html" import EditLink %}
|
||||||
{% from "components/required_label.html" import RequiredLabel %}
|
{% from "components/required_label.html" import RequiredLabel %}
|
||||||
{% from "components/icon.html" import Icon %}
|
{% from "components/icon.html" import Icon %}
|
||||||
|
@ -33,12 +33,20 @@ def user():
|
|||||||
return UserFactory.create()
|
return UserFactory.create()
|
||||||
|
|
||||||
|
|
||||||
def test_task_orders_new():
|
def test_task_orders_new(client, user_session, portfolio):
|
||||||
pass
|
user_session(portfolio.owner)
|
||||||
|
response = client.get(url_for("task_orders.new", portfolio_id=portfolio.id))
|
||||||
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
def test_task_orders_create():
|
def test_task_orders_create(client, user_session, portfolio):
|
||||||
pass
|
user_session(portfolio.owner)
|
||||||
|
response = client.post(
|
||||||
|
url_for("task_orders.create", portfolio_id=portfolio.id),
|
||||||
|
data={"number": "0123456789"},
|
||||||
|
)
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert translate("task_orders.form.draft_alert_message") in response.data.decode()
|
||||||
|
|
||||||
|
|
||||||
def test_task_orders_edit():
|
def test_task_orders_edit():
|
||||||
|
@ -298,6 +298,8 @@ forms:
|
|||||||
not_sure: 'Not sure, unsure if planning to develop natively in the cloud'
|
not_sure: 'Not sure, unsure if planning to develop natively in the cloud'
|
||||||
'yes': 'Yes, planning to develop natively in the cloud'
|
'yes': 'Yes, planning to develop natively in the cloud'
|
||||||
not_sure_help: Not sure? Talk to your technical lead about where and how they plan on developing your application.
|
not_sure_help: Not sure? Talk to your technical lead about where and how they plan on developing your application.
|
||||||
|
number_description: Task order number (10 digit number from your system of record)
|
||||||
|
number_label: Add your task order
|
||||||
oversight_am_cor_label: I am the Contracting Officer Representative (COR) for this task order
|
oversight_am_cor_label: I am the Contracting Officer Representative (COR) for this task order
|
||||||
oversight_dod_id_label: DoD ID
|
oversight_dod_id_label: DoD ID
|
||||||
oversight_email_label: Email
|
oversight_email_label: Email
|
||||||
@ -619,6 +621,7 @@ task_orders:
|
|||||||
task_order_information: Task order information
|
task_order_information: Task order information
|
||||||
title: Verify task order information
|
title: Verify task order information
|
||||||
new:
|
new:
|
||||||
|
form_help_text: Before you can begin work in the cloud, you'll need to complete the information below and upload your approved task order for reference by the CCPO.
|
||||||
app_info:
|
app_info:
|
||||||
basic_info_title: Basic information
|
basic_info_title: Basic information
|
||||||
details_description: 'Provide a few more details about the work you will be doing. The CCPO will use this section for reporting purposes, but it won’t be included in the final task order.'
|
details_description: 'Provide a few more details about the work you will be doing. The CCPO will use this section for reporting purposes, but it won’t be included in the final task order.'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user