From 5e5b357c7e1df1be48af371636c719165d9a7da8 Mon Sep 17 00:00:00 2001 From: dandds Date: Thu, 9 Aug 2018 13:15:01 -0400 Subject: [PATCH 1/5] add mechanism for initial modal display; fix financial verification modal display --- atst/app.py | 2 +- atst/routes/requests/requests_form.py | 5 ++- js/index.js | 8 ++++ templates/base.html | 5 +++ templates/requests.html | 53 ++++++++++++--------------- tests/routes/test_request_submit.py | 6 +-- 6 files changed, 44 insertions(+), 35 deletions(-) diff --git a/atst/app.py b/atst/app.py index d095a8bf..4a0f80c4 100644 --- a/atst/app.py +++ b/atst/app.py @@ -68,7 +68,7 @@ def make_flask_callbacks(app): ) g.dev = os.getenv("FLASK_ENV", "dev") == "dev" g.matchesPath = lambda href: re.match("^" + href, request.path) - g.modalOpen = request.args.get("modal", False) + g.modal = request.args.get("modal", None) g.current_user = { "id": "cce17030-4109-4719-b958-ed109dbb87c8", "first_name": "Amanda", diff --git a/atst/routes/requests/requests_form.py b/atst/routes/requests/requests_form.py index d384abdf..15033d47 100644 --- a/atst/routes/requests/requests_form.py +++ b/atst/routes/requests/requests_form.py @@ -4,6 +4,7 @@ from . import requests_bp from atst.domain.requests import Requests from atst.routes.requests.jedi_request_flow import JEDIRequestFlow from atst.models.permissions import Permissions +from atst.models.request_status_event import RequestStatus from atst.domain.exceptions import UnauthorizedError @@ -99,8 +100,8 @@ def requests_submit(request_id=None): request = Requests.get(request_id) Requests.submit(request) - if request.status == "approved": - return redirect("/requests?modal=True") + if request.status == RequestStatus.PENDING_FINANCIAL_VERIFICATION: + return redirect("/requests?modal=pendingFinancialVerification") else: return redirect("/requests") diff --git a/js/index.js b/js/index.js index 59883c65..07da8d42 100644 --- a/js/index.js +++ b/js/index.js @@ -20,7 +20,15 @@ const app = new Vue({ return { modals: { styleguideModal: false, + pendingFinancialVerification: false, } } + }, + mounted: function() { + const modalOpen = document.querySelector("#modalOpen"); + if (modalOpen) { + const modal = modalOpen.getAttribute("data-modal"); + this.modals[modal] = true; + } } }) diff --git a/templates/base.html b/templates/base.html index 8416032f..a29a6c04 100644 --- a/templates/base.html +++ b/templates/base.html @@ -35,6 +35,11 @@ {% include 'footer.html' %} {% block modal %}{% endblock %} + + {% if g.modal %} +
+
+ {% endif %} {% assets "js_all" %} diff --git a/templates/requests.html b/templates/requests.html index 25520ac2..4bb7509b 100644 --- a/templates/requests.html +++ b/templates/requests.html @@ -4,37 +4,32 @@ {% from "components/modal.html" import Modal %} {% from "components/empty_state.html" import EmptyState %} -{% block modal %} - {% if g.modalOpen %} - {% call Modal() %} -

Your request is now approved!

- -

- Your next step is to create a Task Order (T.O.) associated with - JEDI Cloud. Please consult a Contracting Officer (KO) or - Contracting Officer Representative (COR) to help with this step. -

- -

- Once the Task Order (T.O.) has been created, we will need the following - details to create your account. These details will help keep your cloud - usage in sync with your budget. -

- - {{ Alert("You'll need these details: ", - message="

Task Order Number

Contracting Officer: Name, E-mail and Office

" - ) }} - - -
- Close -
- {% endcall %} - {% endif %} -{% endblock %} - {% block content %} + {% call Modal(name='pendingFinancialVerification', dismissable=True) %} +

Your request is now approved!

+ +

+ Your next step is to create a Task Order (T.O.) associated with + JEDI Cloud. Please consult a Contracting Officer (KO) or + Contracting Officer Representative (COR) to help with this step. +

+ +

+ Once the Task Order (T.O.) has been created, we will need the following + details to create your account. These details will help keep your cloud + usage in sync with your budget. +

+ + {{ Alert("You'll need these details: ", + message="

Task Order Number

Contracting Officer: Name, E-mail and Office

" + ) }} + +
+ Close +
+ {% endcall %} + {% if not requests %} {{ EmptyState( diff --git a/tests/routes/test_request_submit.py b/tests/routes/test_request_submit.py index 428e056e..f8e61400 100644 --- a/tests/routes/test_request_submit.py +++ b/tests/routes/test_request_submit.py @@ -1,6 +1,7 @@ import pytest from tests.mocks import MOCK_USER from tests.factories import RequestFactory +from atst.models.request_status_event import RequestStatus def _mock_func(*args, **kwargs): @@ -27,12 +28,11 @@ def test_submit_autoapproved_reviewed_request(monkeypatch, client, user_session) user_session() monkeypatch.setattr("atst.domain.requests.Requests.get", _mock_func) monkeypatch.setattr("atst.domain.requests.Requests.submit", _mock_func) - monkeypatch.setattr("atst.models.request.Request.status", "approved") - # this just needs to send a known invalid form value + monkeypatch.setattr("atst.models.request.Request.status", RequestStatus.PENDING_FINANCIAL_VERIFICATION) response = client.post( "/requests/submit/1", headers={"Content-Type": "application/x-www-form-urlencoded"}, data="", follow_redirects=False, ) - assert "/requests?modal=True" in response.headers["Location"] + assert "/requests?modal=" in response.headers["Location"] From a9dfa005a919a8f96fb15dc1ec3c66afcd7e5162 Mon Sep 17 00:00:00 2001 From: dandds Date: Thu, 9 Aug 2018 13:53:45 -0400 Subject: [PATCH 2/5] update financial verification copy --- templates/requests.html | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/templates/requests.html b/templates/requests.html index 4bb7509b..879560a2 100644 --- a/templates/requests.html +++ b/templates/requests.html @@ -7,23 +7,22 @@ {% block content %} {% call Modal(name='pendingFinancialVerification', dismissable=True) %} -

Your request is now approved!

+

Request submitted!

- Your next step is to create a Task Order (T.O.) associated with - JEDI Cloud. Please consult a Contracting Officer (KO) or - Contracting Officer Representative (COR) to help with this step. + The next step is to create a Task Order associated with JEDI Cloud. + Please contact a Contracting Officer (KO), Contracting Officer + Representative (COR), or a Financial Manager to help with this step.

- Once the Task Order (T.O.) has been created, we will need the following - details to create your account. These details will help keep your cloud - usage in sync with your budget. + Once the Task Order has been created, you will be asked to provide + details about the task order in the Financial Verification step.

- {{ Alert("You'll need these details: ", - message="

Task Order Number

Contracting Officer: Name, E-mail and Office

" - ) }} +

+ Learn more about the JEDI Task Order and the Financial Verification process. +

Close @@ -42,7 +41,20 @@ {% else %} {{ Alert('Pending Financial Verification', - message="

Your next step is to create a Task Order (T.O.) associated with JEDI Cloud. Please consult a Contracting Officer (KO) or Contracting Officer Representative (COR) to help with this step.

" + message=" +

+ The next step is to create a Task Order associated with JEDI Cloud. + Please contact a Contracting Officer (KO), Contracting Officer + Representative (COR), or a Financial Manager to help with this step. +

+

+ Once the Task Order has been created, you will be asked to provide + details about the task order in the Financial Verification step. +

+

+ Learn more about the JEDI Task Order and the Financial Verification process. +

+ " ) }}
From 5f9b58946576cc37b313bbb2abbaa5dc95c19ac7 Mon Sep 17 00:00:00 2001 From: dandds Date: Thu, 9 Aug 2018 14:10:17 -0400 Subject: [PATCH 3/5] only show financial verification alert on requests index page if relevant --- atst/routes/requests/index.py | 5 ++++- templates/requests.html | 36 +++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/atst/routes/requests/index.py b/atst/routes/requests/index.py index 5e9d26ca..dc1d137e 100644 --- a/atst/routes/requests/index.py +++ b/atst/routes/requests/index.py @@ -3,6 +3,7 @@ from flask import render_template, g, url_for from . import requests_bp from atst.domain.requests import Requests +from atst.models.request_status_event import RequestStatus def map_request(request): @@ -33,4 +34,6 @@ def requests_index(): mapped_requests = [map_request(r) for r in requests] - return render_template("requests.html", requests=mapped_requests) + pending_fv = any(r["status"] == RequestStatus.PENDING_FINANCIAL_VERIFICATION.value for r in mapped_requests) + + return render_template("requests.html", requests=mapped_requests, pending_financial_verification=pending_fv) diff --git a/templates/requests.html b/templates/requests.html index 879560a2..4dc0e865 100644 --- a/templates/requests.html +++ b/templates/requests.html @@ -40,22 +40,26 @@ {% else %} - {{ Alert('Pending Financial Verification', - message=" -

- The next step is to create a Task Order associated with JEDI Cloud. - Please contact a Contracting Officer (KO), Contracting Officer - Representative (COR), or a Financial Manager to help with this step. -

-

- Once the Task Order has been created, you will be asked to provide - details about the task order in the Financial Verification step. -

-

- Learn more about the JEDI Task Order and the Financial Verification process. -

- " - ) }} + {% if pending_financial_verification %} + + {{ Alert('Pending Financial Verification', + message=" +

+ The next step is to create a Task Order associated with JEDI Cloud. + Please contact a Contracting Officer (KO), Contracting Officer + Representative (COR), or a Financial Manager to help with this step. +

+

+ Once the Task Order has been created, you will be asked to provide + details about the task order in the Financial Verification step. +

+

+ Learn more about the JEDI Task Order and the Financial Verification process. +

+ " + ) }} + + {% endif %}
From 1c101a3c4f0f7a426156198fc32aa60e2c4f84cb Mon Sep 17 00:00:00 2001 From: dandds Date: Fri, 10 Aug 2018 12:05:01 -0400 Subject: [PATCH 4/5] use Requests method to check in pending financial verification --- atst/routes/requests/index.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/atst/routes/requests/index.py b/atst/routes/requests/index.py index dc1d137e..f756836f 100644 --- a/atst/routes/requests/index.py +++ b/atst/routes/requests/index.py @@ -3,7 +3,6 @@ from flask import render_template, g, url_for from . import requests_bp from atst.domain.requests import Requests -from atst.models.request_status_event import RequestStatus def map_request(request): @@ -34,6 +33,6 @@ def requests_index(): mapped_requests = [map_request(r) for r in requests] - pending_fv = any(r["status"] == RequestStatus.PENDING_FINANCIAL_VERIFICATION.value for r in mapped_requests) + pending_fv = any(Requests.is_pending_financial_verification(r) for r in requests) return render_template("requests.html", requests=mapped_requests, pending_financial_verification=pending_fv) From 251bef6bb88585ca06b43ff13d20640ece1a34e0 Mon Sep 17 00:00:00 2001 From: dandds Date: Fri, 10 Aug 2018 12:12:02 -0400 Subject: [PATCH 5/5] move pending financial review text --- templates/components/alert.html | 8 ++++- .../pending_financial_verification.html | 12 +++++++ templates/requests.html | 32 ++----------------- 3 files changed, 21 insertions(+), 31 deletions(-) create mode 100644 templates/fragments/pending_financial_verification.html diff --git a/templates/components/alert.html b/templates/components/alert.html index d3385d1d..1fd30167 100644 --- a/templates/components/alert.html +++ b/templates/components/alert.html @@ -1,6 +1,6 @@ {% from "components/icon.html" import Icon %} -{% macro Alert(title, message=None, actions=None, level='info') -%} +{% macro Alert(title, message=None, actions=None, level='info', fragment=None) -%} {% set role = 'alertdialog' if actions else 'alert' %} {% set levels = { 'warning': { @@ -31,6 +31,12 @@
{{ message | safe }}
{% endif %} + {% if fragment %} +
+ {% include fragment %} +
+ {% endif %} + {% if actions %}
{{ actions | safe }}
{% endif %} diff --git a/templates/fragments/pending_financial_verification.html b/templates/fragments/pending_financial_verification.html new file mode 100644 index 00000000..858b3e26 --- /dev/null +++ b/templates/fragments/pending_financial_verification.html @@ -0,0 +1,12 @@ +

+ The next step is to create a Task Order associated with JEDI Cloud. + Please contact a Contracting Officer (KO), Contracting Officer + Representative (COR), or a Financial Manager to help with this step. +

+

+ Once the Task Order has been created, you will be asked to provide + details about the task order in the Financial Verification step. +

+

+ Learn more about the JEDI Task Order and the Financial Verification process. +

diff --git a/templates/requests.html b/templates/requests.html index 4dc0e865..df6999ca 100644 --- a/templates/requests.html +++ b/templates/requests.html @@ -9,20 +9,7 @@ {% call Modal(name='pendingFinancialVerification', dismissable=True) %}

Request submitted!

-

- The next step is to create a Task Order associated with JEDI Cloud. - Please contact a Contracting Officer (KO), Contracting Officer - Representative (COR), or a Financial Manager to help with this step. -

- -

- Once the Task Order has been created, you will be asked to provide - details about the task order in the Financial Verification step. -

- -

- Learn more about the JEDI Task Order and the Financial Verification process. -

+ {% include 'fragments/pending_financial_verification.html' %}
Close @@ -42,22 +29,7 @@ {% if pending_financial_verification %} - {{ Alert('Pending Financial Verification', - message=" -

- The next step is to create a Task Order associated with JEDI Cloud. - Please contact a Contracting Officer (KO), Contracting Officer - Representative (COR), or a Financial Manager to help with this step. -

-

- Once the Task Order has been created, you will be asked to provide - details about the task order in the Financial Verification step. -

-

- Learn more about the JEDI Task Order and the Financial Verification process. -

- " - ) }} + {{ Alert('Pending Financial Verification', fragment="fragments/pending_financial_verification.html") }} {% endif %}