diff --git a/atst/forms/poc.py b/atst/forms/poc.py index 3dcdc223..02ef76ab 100644 --- a/atst/forms/poc.py +++ b/atst/forms/poc.py @@ -1,16 +1,34 @@ -from wtforms.fields import StringField +from wtforms.fields import StringField, RadioField from wtforms.fields.html5 import EmailField -from wtforms.validators import Required, Email, Length +from wtforms.validators import Required, Email, Length, Optional from .forms import ValidatedForm from .validators import IsNumber class POCForm(ValidatedForm): - fname_poc = StringField("First Name", validators=[Required()]) - lname_poc = StringField("Last Name", validators=[Required()]) + def validate(self, *args, **kwargs): + if self.am_poc.data == "yes": + self.fname_poc.validators.insert(0, Optional()) + self.lname_poc.validators.insert(0, Optional()) + self.email_poc.validators.insert(0, Optional()) + self.dodid_poc.validators.insert(0, Optional()) - email_poc = EmailField("Email Address", validators=[Required(), Email()]) + return super(POCForm, self).validate(*args, **kwargs) + + + am_poc = RadioField( + "I am the technical POC.", + choices=[("yes", "Yes"), ("no", "No")], + default="no", + validators=[Required()], + ) + + fname_poc = StringField("POC First Name", validators=[Required()]) + + lname_poc = StringField("POC Last Name", validators=[Required()]) + + email_poc = EmailField("POC Email Address", validators=[Required(), Email()]) dodid_poc = StringField( "DOD ID", validators=[Required(), Length(min=10), IsNumber()] diff --git a/atst/routes/requests/jedi_request_flow.py b/atst/routes/requests/jedi_request_flow.py index 79506916..ce9b3d01 100644 --- a/atst/routes/requests/jedi_request_flow.py +++ b/atst/routes/requests/jedi_request_flow.py @@ -130,5 +130,14 @@ class JEDIRequestFlow(object): self.request_id = request.id def update_request(self, section, data): + if section == "primary_poc": + if data.get("am_poc") == "yes": + data = { + "dodid_poc": self.existing_request.creator.dod_id, + "fname_poc": self.existing_request.creator.first_name, + "lname_poc": self.existing_request.creator.last_name, + "email_poc": self.existing_request.creator.email + } + request_data = {section: data} Requests.update(self.request_id, request_data) diff --git a/js/components/forms/poc.js b/js/components/forms/poc.js new file mode 100644 index 00000000..0be9fb1f --- /dev/null +++ b/js/components/forms/poc.js @@ -0,0 +1,44 @@ +import optionsinput from '../options_input' +import textinput from '../text_input' + +export default { + name: 'poc', + + components: { + optionsinput, + textinput, + }, + + props: { + initialData: { + type: Object, + default: () => ({}) + } + }, + + data: function () { + return { + am_poc: "no" + } + }, + + mounted: function () { + this.$root.$on('field-change', this.handleFieldChange) + }, + + computed: { + amPOC: function () { + return this.am_poc === 'yes' + }, + }, + + methods: { + handleFieldChange: function (event) { + const { value, name } = event + console.log(value, name) + if (typeof this[name] !== undefined) { + this[name] = value + } + }, + } +} diff --git a/js/index.js b/js/index.js index 5cf47a60..84b90c96 100644 --- a/js/index.js +++ b/js/index.js @@ -5,6 +5,7 @@ import VTooltip from 'v-tooltip' import optionsinput from './components/options_input' import textinput from './components/text_input' import DetailsOfUse from './components/forms/details_of_use' +import poc from './components/forms/poc' Vue.use(VTooltip) @@ -15,6 +16,7 @@ const app = new Vue({ optionsinput, textinput, DetailsOfUse, + poc, }, methods: { closeModal: function(name) { diff --git a/templates/requests/screen-3.html b/templates/requests/screen-3.html index 2f03c8bf..41c632dc 100644 --- a/templates/requests/screen-3.html +++ b/templates/requests/screen-3.html @@ -2,6 +2,7 @@ {% from "components/alert.html" import Alert %} {% from "components/text_input.html" import TextInput %} +{% from "components/options_input.html" import OptionsInput %} {% block subtitle %}
The Workspace Owner is the primary point of contact and technical administrator of the JEDI Workspace and will have the following responsibilities:
-Please designate a Primary Point of Contact that will be responsible for owning the workspace in the JEDI Cloud.
+The Point of Contact will become the primary owner of the workspace created to use the JEDI Cloud. As a workspace owner, this person will have the ability to: +
This person must be a DoD employee (not a contractor).
-The Workspace Owner may be you. You will be able to add other administrators later. This person will be invited via email once your request is approved.
+ {{ OptionsInput(f.am_poc) }} -{{ TextInput(f.fname_poc,placeholder='First Name') }} -{{ TextInput(f.lname_poc,placeholder='Last Name') }} -{{ TextInput(f.email_poc,placeholder='jane@mail.mil', validation='email') }} -{{ TextInput(f.dodid_poc,placeholder='10-digit number on the back of the CAC', validation='dodId') }} + + {{ TextInput(f.fname_poc,placeholder='First Name') }} + {{ TextInput(f.lname_poc,placeholder='Last Name') }} + {{ TextInput(f.email_poc,placeholder='jane@mail.mil', validation='email') }} + {{ TextInput(f.dodid_poc,placeholder='10-digit number on the back of the CAC', validation='dodId') }} + +