diff --git a/atst/filters.py b/atst/filters.py index 47ac3afc..b0ceda9c 100644 --- a/atst/filters.py +++ b/atst/filters.py @@ -65,9 +65,9 @@ def renderList(value): return app.jinja_env.filters["safe"]("
".join(value)) -def formattedDate(value): +def formattedDate(value, formatter="%m/%d/%Y"): if value: - return value.strftime("%m/%d/%Y") + return value.strftime(formatter) else: return "-" diff --git a/atst/models/request_review.py b/atst/models/request_review.py index 3c991ea5..c46f1d11 100644 --- a/atst/models/request_review.py +++ b/atst/models/request_review.py @@ -20,3 +20,15 @@ class RequestReview(Base): phone_mao = Column(String) fname_ccpo = Column(String) lname_ccpo = Column(String) + + @property + def full_name_reviewer(self): + return self.reviewer.full_name + + @property + def full_name_mao(self): + return "{} {}".format(self.fname_mao, self.lname_mao) + + @property + def full_name_ccpo(self): + return "{} {}".format(self.fname_ccpo, self.lname_ccpo) diff --git a/atst/models/request_status_event.py b/atst/models/request_status_event.py index a5373bdd..15e8a3d1 100644 --- a/atst/models/request_status_event.py +++ b/atst/models/request_status_event.py @@ -42,3 +42,12 @@ class RequestStatusEvent(Base): @property def displayname(self): return self.new_status.value + + @property + def log_name(self): + if self.new_status == RequestStatus.CHANGES_REQUESTED: + return "Denied" + elif self.new_status == RequestStatus.PENDING_FINANCIAL_VERIFICATION: + return "Accepted" + else: + return self.displayname diff --git a/atst/routes/requests/approval.py b/atst/routes/requests/approval.py index ca02933f..ebb4126e 100644 --- a/atst/routes/requests/approval.py +++ b/atst/routes/requests/approval.py @@ -35,8 +35,9 @@ def render_approval(request, form=None): return render_template( "requests/approval.html", data=data, + status_events=reversed(request.status_events), request_id=request.id, - status=request.status.value, + current_status=request.status.value, pending_review=pending_review, financial_review=pending_final_approval, pdf_available=request.task_order and request.task_order.pdf, diff --git a/templates/requests/approval.html b/templates/requests/approval.html index 8cf4ec2c..f29814fc 100644 --- a/templates/requests/approval.html +++ b/templates/requests/approval.html @@ -20,7 +20,7 @@

Request #{{ request_id }}

- {{ status }} + {{ current_status }}
@@ -142,60 +142,42 @@
    -
  1. -
    -
    -

    Denied by Darth Vader

    -

    "You have failed me for the last time, Admiral. Captain Piett. Yes, my lord. Make ready to land out troops beyond the energy shield and deploy the fleet so that nothing gets off that system."

    -
    -
    -

    Mission Owner approval on behalf of:

    - Grand Moff Tarkin - tarkin@empire.mil - (234) 567-8901 + {% for status_event in status_events %} + {% if status_event.review %} +
  2. +
    +
    +

    {{ status_event.log_name }} by {{ status_event.review.full_name_reviewer }}

    + {% if status_event.review.comment %} +

    {{ status_event.review.comment }}

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

    Mission Owner approval on behalf of:

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

    CCPO approval on behalf of:

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

    CCPO approval on behalf of:

    - Emperor Palpatine - palpatine@empire.mil - (345) 678-9012 -
    -
    -
    - -
    -
    -
  4. - - -
  5. -
    -
    -

    Denied by Darth Vader

    -

    "You have failed me for the last time, Admiral. Captain Piett. Yes, my lord. Make ready to land out troops beyond the energy shield and deploy the fleet so that nothing gets off that system."

    - -
    -
    -

    Mission Owner approval on behalf of:

    - Grand Moff Tarkin - tarkin@empire.mil - (234) 567-8901 -
    - -
    -

    CCPO approval on behalf of:

    - Emperor Palpatine - palpatine@empire.mil - (345) 678-9012 -
    -
    -
    - - -
    -