Funded Through on each portfolio screen

This commit is contained in:
Montana 2019-02-11 15:33:28 -05:00
parent aecab933b0
commit 6a8d4964d4
4 changed files with 48 additions and 2 deletions

View File

@ -18,14 +18,17 @@ def dollars(value):
numberValue = 0
return "${:,.2f}".format(numberValue)
def justDollars(value):
raw = dollars(value)
return raw[:-3]
def justCents(value):
raw = dollars(value)
return raw[-3:]
def usPhone(number):
phone = re.sub(r"\D", "", number)
return "+1 ({}) {} - {}".format(phone[0:3], phone[3:6], phone[6:])

View File

@ -1,4 +1,5 @@
from flask import Blueprint, request as http_request, g, render_template
from operator import attrgetter
portfolios_bp = Blueprint("portfolios", __name__)
@ -31,4 +32,20 @@ def portfolio():
)
return False
return {"portfolio": portfolio, "permissions": Permissions, "user_can": user_can}
active_task_orders = [
task_order for task_order in portfolio.task_orders if task_order.is_active
]
funding_end_date = (
sorted(active_task_orders, key=attrgetter("end_date"))[-1].end_date
if active_task_orders
else None
)
funded = len(active_task_orders) > 1
return {
"portfolio": portfolio,
"permissions": Permissions,
"user_can": user_can,
"funding_end_date": funding_end_date,
"funded": funded,
}

View File

@ -89,6 +89,32 @@
}
}
}
.cents {
font-size: 2rem;
margin-top: .75rem;
font-weight: bold;
}
.portfolio-funding__header--funded-through {
flex-grow: 1;
text-align: left;
font-weight: bold;
}
.funded {
color: $color-blue;
.icon {
@include icon-color($color-blue);
}
}
.unfunded {
color: $color-red;
.icon {
@include icon-color($color-red);
}
}
}
@mixin subheading {

View File

@ -22,7 +22,7 @@
<span class='portfolio-header__budget--dollars'>
{{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justDollars }}
</span>
<span>
<span class='cents'>
{{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justCents }}
</span>
</div>