Review history #159038479
This commit is contained in:
dandds 2018-09-11 11:14:28 -04:00 committed by GitHub
commit f69396ac73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 55 deletions

View File

@ -65,9 +65,9 @@ def renderList(value):
return app.jinja_env.filters["safe"]("<br>".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 "-"

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@
<section class='panel'>
<header class='panel__heading request-approval__heading'>
<h1 class='h2'>Request #{{ request_id }}</h1>
<span class='label label--info'>{{ status }}</span>
<span class='label label--info'>{{ current_status }}</span>
</header>
<div class='panel__content'>
@ -142,60 +142,42 @@
<div>
<div class='approval-log'>
<ol>
<li>
<article class='approval-log__log-item'>
<div>
<h3 class='approval-log__log-item__header'>Denied by Darth Vader</h3>
<p>"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."</p>
<div class='approval-log__behalfs'>
<div class='approval-log__behalf'>
<h3 class='approval-log__log-item__header'>Mission Owner approval on behalf of:</h3>
<span>Grand Moff Tarkin</span>
<span>tarkin@empire.mil</span>
<span>(234) 567-8901</span>
{% for status_event in status_events %}
{% if status_event.review %}
<li>
<article class='approval-log__log-item'>
<div>
<h3 class='approval-log__log-item__header'>{{ status_event.log_name }} by {{ status_event.review.full_name_reviewer }}</h3>
{% if status_event.review.comment %}
<p>{{ status_event.review.comment }}</p>
{% endif %}
<div class='approval-log__behalfs'>
{% if status_event.review.lname_mao %}
<div class='approval-log__behalf'>
<h3 class='approval-log__log-item__header'>Mission Owner approval on behalf of:</h3>
<span>{{ status_event.review.full_name_mao }}</span>
<span>{{ status_event.review.email_mao }}</span>
<span>{{ status_event.review.phone_mao }}</span>
</div>
{% endif %}
{% if status_event.review.lname_ccpo %}
<div class='approval-log__behalf'>
<h3 class='approval-log__log-item__header'>CCPO approval on behalf of:</h3>
<span>{{ status_event.review.full_name_ccpo }}</span>
</div>
{% endif %}
</div>
</div>
{% set timestamp=status_event.time_created | formattedDate("%Y-%m-%d %H:%M:%S %Z") %}
<footer class='approval-log__log-item__timestamp'><time datetime='{{ timestamp }}'>{{ timestamp }}</time></footer>
</article>
</li>
{% endif %}
{% endfor %}
<div class='approval-log__behalf'>
<h3 class='approval-log__log-item__header'>CCPO approval on behalf of:</h3>
<span>Emperor Palpatine</span>
<span>palpatine@empire.mil</span>
<span>(345) 678-9012</span>
</div>
</div>
</div>
<footer class='approval-log__log-item__timestamp'><time datetime='2018-07-02 04:23:02 EST'>2018-07-02 04:23:02 EST</time></footer>
</article>
</li>
<li>
<article class='approval-log__log-item'>
<div>
<h3 class='approval-log__log-item__header'>Denied by Darth Vader</h3>
<p>"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."</p>
<div class='approval-log__behalfs'>
<div class='approval-log__behalf'>
<h3 class='approval-log__log-item__header'>Mission Owner approval on behalf of:</h3>
<span>Grand Moff Tarkin</span>
<span>tarkin@empire.mil</span>
<span>(234) 567-8901</span>
</div>
<div class='approval-log__behalf'>
<h3 class='approval-log__log-item__header'>CCPO approval on behalf of:</h3>
<span>Emperor Palpatine</span>
<span>palpatine@empire.mil</span>
<span>(345) 678-9012</span>
</div>
</div>
</div>
<footer class='approval-log__log-item__timestamp'><time datetime='2018-07-02 04:23:02 EST'>2018-07-02 04:23:02 EST</time></footer>
</article>
</li>
</ol>
</div>
</div>