Update TO Form to include CLINs and LOAs

This commit is contained in:
leigh-mil
2019-06-04 10:37:27 -04:00
parent 9fa4292736
commit 633e1b6a37
4 changed files with 90 additions and 39 deletions

View File

@@ -221,3 +221,10 @@ ENV_ROLE_NO_ACCESS = "No Access"
ENV_ROLES = [(role.value, role.value) for role in CSPRole] + [
(ENV_ROLE_NO_ACCESS, "No access")
]
JEDI_CLIN_TYPES = [
("jedi_clin_0001", translate("forms.task_order.clin_01_label")),
("jedi_clin_0002", translate("forms.task_order.clin_02_label")),
("jedi_clin_0003", translate("forms.task_order.clin_03_label")),
("jedi_clin_0004", translate("forms.task_order.clin_04_label")),
]

View File

@@ -1,13 +1,37 @@
from wtforms.fields import BooleanField, DecimalField, FileField, StringField
from wtforms.fields import BooleanField, DecimalField, FieldList, FileField, FormField, StringField
from wtforms.fields.html5 import DateField
from wtforms.validators import Required, Optional
from flask_wtf.file import FileAllowed
from .data import JEDI_CLIN_TYPES
from .fields import SelectField
from .forms import BaseForm
from atst.forms.validators import FileLength
from atst.utils.localization import translate
class CLINForm(FlaskForm):
jedi_clin_type = SelectField("Jedi CLIN type", choices=JEDI_CLIN_TYPES)
clin_number = StringField(validators=[Required()])
start_date = DateField(
translate("forms.task_order.start_date_label"),
format="%m/%d/%Y",
validators=[Required()],
)
end_date = DateField(
translate("forms.task_order.end_date_label"),
format="%m/%d/%Y",
validators=[Required()],
)
obligated_funds = DecimalField()
loas = FieldList(StringField())
class UnclassifiedCLINForm(CLINForm):
# TODO: overwrite jedi_clin_type to only include the unclassified options
pass
class TaskOrderForm(BaseForm):
number = StringField(
translate("forms.task_order.number_label"),
@@ -22,38 +46,7 @@ class TaskOrderForm(BaseForm):
],
render_kw={"accept": ".pdf,application/pdf"},
)
class FundingForm(BaseForm):
start_date = DateField(
translate("forms.task_order.start_date_label"), format="%m/%d/%Y"
)
end_date = DateField(
translate("forms.task_order.end_date_label"), format="%m/%d/%Y"
)
clin_01 = DecimalField(
translate("forms.task_order.clin_01_label"), validators=[Optional()]
)
clin_02 = DecimalField(
translate("forms.task_order.clin_02_label"), validators=[Optional()]
)
clin_03 = DecimalField(
translate("forms.task_order.clin_03_label"), validators=[Optional()]
)
clin_04 = DecimalField(
translate("forms.task_order.clin_04_label"), validators=[Optional()]
)
class UnclassifiedFundingForm(FundingForm):
clin_02 = StringField(
translate("forms.task_order.unclassified_clin_02_label"),
filters=[BaseForm.remove_empty_string],
)
clin_04 = StringField(
translate("forms.task_order.unclassified_clin_04_label"),
filters=[BaseForm.remove_empty_string],
)
clins = FieldList(FormField(CLINForm))
class SignatureForm(BaseForm):

View File

@@ -14,7 +14,7 @@ def render_task_orders_edit(portfolio_id, task_order_id=None, form=None):
if task_order_id:
task_order = TaskOrders.get(task_order_id)
render_args["form"] = form or TaskOrderForm(
number=task_order.number, pdf=task_order.pdf
**task_order.to_dictionary()
)
render_args["task_order_id"] = task_order_id
else: