diff --git a/atst/domain/reports.py b/atst/domain/reports.py index 22d4f753..99a913ec 100644 --- a/atst/domain/reports.py +++ b/atst/domain/reports.py @@ -124,7 +124,7 @@ CUMULATIVE_BUDGET_AARDVARK = { "06/2018": {"spend": 41725, "cumulative": 116984}, "07/2018": {"spend": 41328, "cumulative": 158312}, "08/2018": {"spend": 47491, "cumulative": 205803}, - "09/2018": {"spend": 45826, "cumulative": 251629}, + "09/2018": {"spend": 36028, "cumulative": 241831}, } MONTHLY_SPEND_BELUGA = { diff --git a/atst/forms/internal_comment.py b/atst/forms/internal_comment.py index 71b88f7e..c082aefb 100644 --- a/atst/forms/internal_comment.py +++ b/atst/forms/internal_comment.py @@ -7,6 +7,6 @@ from .forms import ValidatedForm class InternalCommentForm(ValidatedForm): text = TextAreaField( "CCPO Internal Notes", - description="You may add additional comments and notes for internal CCPO reference and follow-up here.", + description="Add comments or notes for internal CCPO reference and follow-up here.These comments will not be visible to the person making the JEDI request.", validators=[Optional()], ) diff --git a/atst/routes/requests/approval.py b/atst/routes/requests/approval.py index 808bc7eb..e1f6511b 100644 --- a/atst/routes/requests/approval.py +++ b/atst/routes/requests/approval.py @@ -12,6 +12,9 @@ from . import requests_bp from atst.domain.requests import Requests from atst.domain.exceptions import NotFoundError from atst.forms.ccpo_review import CCPOReviewForm +from atst.forms.internal_comment import InternalCommentForm + +from datetime import date def map_ccpo_authorizing(user): @@ -27,6 +30,22 @@ def render_approval(request, form=None): mo_data = map_ccpo_authorizing(g.current_user) form = CCPOReviewForm(data=mo_data) + internal_comment_form = InternalCommentForm(text=request.internal_comments_text) + + # Dummy internal comments + comments = [ + { + "time_created": date(2018, 9, 18), + "full_name_commenter": "Darth Vader", + "message": "We'll have no more of this Obi-Wan Kenobi jibberish...and don't talk to me about your mission, either. You're fortunate he doesn't blast you into a million pieces right here. ", + }, + { + "time_created": date(2018, 9, 20), + "full_name_commenter": "Grand Moff Tarkin", + "message": "We'll have no more of this Obi-Wan Kenobi jibberish...and don't talk to me about your mission, either. You're fortunate he doesn't blast you into a million pieces right here. ", + }, + ] + return render_template( "requests/approval.html", data=data, @@ -34,6 +53,8 @@ def render_approval(request, form=None): request=request, current_status=request.status.value, f=form or CCPOReviewForm(), + internal_comment_form=internal_comment_form, + comments=comments, ) @@ -76,3 +97,14 @@ def task_order_pdf_download(request_id): else: raise NotFoundError("task_order pdf") + + +@requests_bp.route("/requests/internal_comments/", methods=["POST"]) +def create_internal_comment(request_id): + # form = InternalCommentForm(http_request.form) + # if form.validate(): + # request = Requests.get(g.current_user, request_id) + # Requests.update_internal_comments(g.current_user, request, form.data["text"]) + return redirect( + url_for("requests.approval", request_id=request_id, _anchor="ccpo-notes") + ) diff --git a/js/components/forms/ccpo_approval.js b/js/components/forms/ccpo_approval.js index 7fe245ed..a00abde3 100644 --- a/js/components/forms/ccpo_approval.js +++ b/js/components/forms/ccpo_approval.js @@ -1,10 +1,12 @@ import textinput from '../text_input' +import LocalDatetime from '../local_datetime' export default { name: 'ccpo-approval', components: { - textinput + textinput, + LocalDatetime }, data: function () { diff --git a/styles/sections/_request_approval.scss b/styles/sections/_request_approval.scss index f4b36140..7cc2cad1 100644 --- a/styles/sections/_request_approval.scss +++ b/styles/sections/_request_approval.scss @@ -33,12 +33,19 @@ } .request-approval__review { + + .request-approval__review__heading { + border-top: 1px solid $color-gray-light; + padding-bottom: 0; + } + .action-group { margin-bottom: $gap * 6; } } - .approval-log { + .approval-log, + .comment-log { ol { list-style: none; margin: 0; @@ -57,7 +64,8 @@ } } } - .approval-log__log-item { + .approval-log__log-item, + .comment-log__log-item { display: flex; flex-direction: column-reverse; justify-content: flex-end; @@ -66,12 +74,14 @@ flex-direction: row-reverse; } - .approval-log__log-item__header { + .approval-log__log-item__header, + .comment-log__log-item__header { @include h4; margin: 0 0 $gap 0; } - .approval-log__log-item__timestamp { + .approval-log__log-item__timestamp, + .comment-log__log-item__timestamp { @include h5; margin-right: $gap * 2; color: $color-gray; @@ -105,5 +115,14 @@ textarea { resize: vertical; } + + .internal-notes__add-comment__heading { + padding-bottom: 0; + border-top: 1px solid $color-gray-light; + } + + .usa-input__title { + @include hide; + } } } diff --git a/templates/requests/approval.html b/templates/requests/approval.html index 9b590ef5..64b150aa 100644 --- a/templates/requests/approval.html +++ b/templates/requests/approval.html @@ -32,7 +32,60 @@ - {% if request.is_pending_ccpo_action %} + {{ Alert('Comments and comment form are fake!', + message="

Please note, the comments and comment form below are just mocked out. Submitting it will do nothing. These will be hooked up to real functionality shortly.

Engineer: please remove this alert when you do your thing.

", + level='warning' + ) }} + +
+
+
+
+

CCPO Internal Comments

+
+ +
+ {% if comments %} +
    + {% for comment in comments %} +
  1. +
    +
    +

    {{ comment.full_name_commenter }}

    +

    {{ comment.message }}

    +
    + {% set timestamp=comment.time_created | formattedDate("%Y-%m-%d %H:%M:%S %Z") %} +
    + +
    +
    +
  2. + {% endfor %} +
+ {% else %} +
+

No CCPO comments have been recorded yet.

+
+ {% endif %} + +
+ +
+

Add a comment

+
+ +
+ {{ internal_comment_form.csrf_token }} + {{ TextInput(internal_comment_form.text, paragraph=True, noMaxWidth=True) }} +
+
+
+ +
+
+
+ +
{{ f.csrf_token }} @@ -40,8 +93,63 @@
+ +
+

CCPO Review Activity

+
+ +
+ {% if reviews %} +
    + {% for review in reviews %} +
  1. +
    +
    + {{ review.log_name }} +

    {{ review.status.log_name }} by {{ review.full_name_reviewer }}

    + {% if review.comment %} +

    {{ review.comment }}

    + {% endif %} + +
    + {% if review.lname_mao %} +
    +

    Mission Owner approval on behalf of:

    + {{ review.full_name_mao }} + {{ review.email_mao }} + {{ review.phone_mao }} +
    + {% endif %} + + {% if review.lname_ccpo %} +
    +

    CCPO approval on behalf of:

    + {{ review.full_name_ccpo }} +
    + {% endif %} +
    +
    + {% set timestamp=review.status.time_created | formattedDate("%Y-%m-%d %H:%M:%S %Z") %} +
    + +
    +
    +
  2. + {% endfor %} +
+ {% else %} +
+

No CCPO approvals or request changes have been recorded yet.

+
+ {% endif %} +
+ + {% if request.is_pending_ccpo_action %} +
+

Review this Request

+
+
-

Review this Request

@@ -119,8 +227,11 @@
+ {% endif %} +
+ {% if request.is_pending_ccpo_action %}
@@ -129,65 +240,12 @@ Cancel
+ {% endif %} +
- {% endif %} - -
-
-
-

CCPO Activity Log

-
- -
- {% if reviews %} -
    - {% for review in reviews %} -
  1. -
    -
    - {{ review.log_name }} -

    {{ review.status.log_name }} by {{ review.full_name_reviewer }}

    - {% if review.comment %} -

    {{ review.comment }}

    - {% endif %} - -
    - {% if review.lname_mao %} -
    -

    Mission Owner approval on behalf of:

    - {{ review.full_name_mao }} - {{ review.email_mao }} - {{ review.phone_mao }} -
    - {% endif %} - - {% if review.lname_ccpo %} -
    -

    CCPO approval on behalf of:

    - {{ review.full_name_ccpo }} -
    - {% endif %} -
    -
    - {% set timestamp=review.status.time_created | formattedDate("%Y-%m-%d %H:%M:%S %Z") %} -
    - -
    -
    -
  2. - {% endfor %} -
- {% else %} -
-

No CCPO approvals or request changes have been recorded yet.

-
- {% endif %} -
-
-