From 44cf3606878f1753aa7a4cac389bfdf48c37e49f Mon Sep 17 00:00:00 2001 From: dandds Date: Wed, 6 Feb 2019 12:49:34 -0500 Subject: [PATCH] display status as pending for officer invites awaiting TO completion --- .../c98adf9bb431_record_invitation_status.py | 4 +- atst/models/task_order.py | 38 ++++++++++++++++ styles/elements/_icons.scss | 4 ++ styles/sections/_task_order.scss | 8 +++- .../task_order_review/oversight.html | 43 +++++++++++++------ translations.yaml | 1 + 6 files changed, 81 insertions(+), 17 deletions(-) diff --git a/alembic/versions/c98adf9bb431_record_invitation_status.py b/alembic/versions/c98adf9bb431_record_invitation_status.py index 5852f5e5..f017beef 100644 --- a/alembic/versions/c98adf9bb431_record_invitation_status.py +++ b/alembic/versions/c98adf9bb431_record_invitation_status.py @@ -1,7 +1,7 @@ """record invitation status Revision ID: c98adf9bb431 -Revises: da9d1c911a52 +Revises: 1f690989e38e Create Date: 2019-02-06 09:02:28.617202 """ @@ -11,7 +11,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'c98adf9bb431' -down_revision = 'da9d1c911a52' +down_revision = '1f690989e38e' branch_labels = None depends_on = None diff --git a/atst/models/task_order.py b/atst/models/task_order.py index a9e187a9..4f43b206 100644 --- a/atst/models/task_order.py +++ b/atst/models/task_order.py @@ -159,6 +159,44 @@ class TaskOrder(Base, mixins.TimestampsMixin): def is_pending(self): return self.status == Status.PENDING + @property + def ko_invitable(self): + """ + The MO has indicated that the KO should be invited but we have not sent + an invite and attached the KO user + """ + return self.ko_invite and not self.contracting_officer + + @property + def cor_invitable(self): + """ + The MO has indicated that the COR should be invited but we have not sent + an invite and attached the COR user + """ + return self.cor_invite and not self.contracting_officer_representative + + @property + def so_invitable(self): + """ + The MO has indicated that the SO should be invited but we have not sent + an invite and attached the SO user + """ + return self.so_invite and not self.security_officer + + _OFFICER_PREFIXES = { + "contracting_officer": "ko", + "contracting_officer_representative": "cor", + "security_officer": "so", + } + _OFFICER_PROPERTIES = ["first_name", "last_name", "phone_number", "email", "dod_id"] + + def officer_dictionary(self, officer_type): + prefix = self._OFFICER_PREFIXES[officer_type] + return { + field: getattr(self, "{}_{}".format(prefix, field)) + for field in self._OFFICER_PROPERTIES + } + def to_dictionary(self): return { "portfolio_name": self.portfolio_name, diff --git a/styles/elements/_icons.scss b/styles/elements/_icons.scss index 5703356d..df42642c 100644 --- a/styles/elements/_icons.scss +++ b/styles/elements/_icons.scss @@ -70,4 +70,8 @@ &.icon--medium { @include icon-size(12); } + + &.icon--gold { + @include icon-color($color-gold-dark); + } } diff --git a/styles/sections/_task_order.scss b/styles/sections/_task_order.scss index f916a0b7..c9bb769b 100644 --- a/styles/sections/_task_order.scss +++ b/styles/sections/_task_order.scss @@ -230,14 +230,18 @@ } .task-order-invite-message { + font-weight: $font-bold; + &.not-sent { color: $color-red; - font-weight: $font-bold; } &.sent { color: $color-green; - font-weight: $font-bold; + } + + &.pending { + color: $color-gold-dark; } } diff --git a/templates/fragments/task_order_review/oversight.html b/templates/fragments/task_order_review/oversight.html index cc519892..cdeb883e 100644 --- a/templates/fragments/task_order_review/oversight.html +++ b/templates/fragments/task_order_review/oversight.html @@ -1,15 +1,17 @@ -{% macro ReviewOfficerInfo(heading, first_name, last_name, email, phone_number, dod_id, officer) %} +{% macro ReviewOfficerInfo(heading, officer_data, has_officer, invite_pending) %}

{{ heading | translate }}

- {{ first_name }} {{ last_name }}
- {{ email }}
- {% if phone_number %} - {{ phone_number | usPhone }} + {{ officer_data.first_name }} {{ officer_data.last_name }}
+ {{ officer_data.email }}
+ {% if officer_data.phone_number %} + {{ officer_data.phone_number | usPhone }} {% endif %}
- {{ "task_orders.new.review.dod_id" | translate }} {{ dod_id}}
- {% if officer %} + {{ "task_orders.new.review.dod_id" | translate }} {{ officer_data.dod_id}}
+ {% if has_officer %} {{ Icon('ok', classes='icon--green') }} {{ "task_orders.new.review.invited"| translate }} + {% elif invite_pending %} + {{ Icon('alert', classes='icon--gold') }} {{ "task_orders.new.review.pending_to"| translate }} {% else %} {{ Icon('alert', classes='icon--red') }} {{ "task_orders.new.review.not_invited"| translate }} {% endif %} @@ -17,9 +19,24 @@ {% endmacro %}
- {{ ReviewOfficerInfo("task_orders.new.review.ko", task_order.ko_first_name, task_order.ko_last_name, task_order.ko_email, task_order.ko_phone_number, task_order.ko_dod_id, task_order.contracting_officer) }} - {{ ReviewOfficerInfo("task_orders.new.review.cor", task_order.cor_first_name, task_order.cor_last_name, task_order.cor_email, task_order.cor_phone_number, task_order.cor_dod_id, task_order.contracting_officer_representative) }} -
-
- {{ ReviewOfficerInfo("task_orders.new.review.so", task_order.so_first_name, task_order.so_last_name, task_order.so_email, task_order.so_phone_number, task_order.so_dod_id, task_order.security_officer) }} -
+ {{ ReviewOfficerInfo( + "task_orders.new.review.ko", + task_order.officer_dictionary("contracting_officer"), + task_order.contracting_officer, + task_order.ko_invitable + ) }} + {{ ReviewOfficerInfo( + "task_orders.new.review.cor", + task_order.officer_dictionary("contracting_officer_representative"), + task_order.contracting_officer_representative, + task_order.cor_invitable + ) }} +
+
+ {{ ReviewOfficerInfo( + "task_orders.new.review.so", + task_order.officer_dictionary("security_officer"), + task_order.security_officer, + task_order.so_invitable + ) }} +
diff --git a/translations.yaml b/translations.yaml index f9a00d8c..983db1b9 100644 --- a/translations.yaml +++ b/translations.yaml @@ -458,6 +458,7 @@ task_orders: invited: Invited not_invited: Not Yet Invited not_uploaded: Not Uploaded + pending_to: Pending TO Completion invitations: dod_id_label: DoD ID contracting_officer: