display status as pending for officer invites awaiting TO completion

This commit is contained in:
dandds 2019-02-06 12:49:34 -05:00
parent a85487a2d1
commit 44cf360687
6 changed files with 81 additions and 17 deletions

View File

@ -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

View File

@ -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,

View File

@ -70,4 +70,8 @@
&.icon--medium {
@include icon-size(12);
}
&.icon--gold {
@include icon-color($color-gold-dark);
}
}

View File

@ -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;
}
}

View File

@ -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) %}
<div class="col col--grow">
<h4 class='task-order-form__heading'>{{ heading | translate }}</h4>
{{ first_name }} {{ last_name }}<br>
{{ email }}<br>
{% if phone_number %}
{{ phone_number | usPhone }}
{{ officer_data.first_name }} {{ officer_data.last_name }}<br>
{{ officer_data.email }}<br>
{% if officer_data.phone_number %}
{{ officer_data.phone_number | usPhone }}
{% endif %}
<br>
{{ "task_orders.new.review.dod_id" | translate }} {{ dod_id}}<br>
{% if officer %}
{{ "task_orders.new.review.dod_id" | translate }} {{ officer_data.dod_id}}<br>
{% if has_officer %}
{{ Icon('ok', classes='icon--green') }} <span class="task-order-invite-message sent">{{ "task_orders.new.review.invited"| translate }}</<span>
{% elif invite_pending %}
{{ Icon('alert', classes='icon--gold') }} <span class="task-order-invite-message pending">{{ "task_orders.new.review.pending_to"| translate }}</<span>
{% else %}
{{ Icon('alert', classes='icon--red') }} <span class="task-order-invite-message not-sent">{{ "task_orders.new.review.not_invited"| translate }}</span>
{% endif %}
@ -17,9 +19,24 @@
{% endmacro %}
<div class="row">
{{ 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) }}
</div>
<div class="row">
{{ 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) }}
</div>
{{ 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
) }}
</div>
<div class="row">
{{ ReviewOfficerInfo(
"task_orders.new.review.so",
task_order.officer_dictionary("security_officer"),
task_order.security_officer,
task_order.so_invitable
) }}
</div>

View File

@ -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: