Funded Through on each portfolio screen
This commit is contained in:
parent
aecab933b0
commit
6a8d4964d4
@ -18,14 +18,17 @@ def dollars(value):
|
|||||||
numberValue = 0
|
numberValue = 0
|
||||||
return "${:,.2f}".format(numberValue)
|
return "${:,.2f}".format(numberValue)
|
||||||
|
|
||||||
|
|
||||||
def justDollars(value):
|
def justDollars(value):
|
||||||
raw = dollars(value)
|
raw = dollars(value)
|
||||||
return raw[:-3]
|
return raw[:-3]
|
||||||
|
|
||||||
|
|
||||||
def justCents(value):
|
def justCents(value):
|
||||||
raw = dollars(value)
|
raw = dollars(value)
|
||||||
return raw[-3:]
|
return raw[-3:]
|
||||||
|
|
||||||
|
|
||||||
def usPhone(number):
|
def usPhone(number):
|
||||||
phone = re.sub(r"\D", "", number)
|
phone = re.sub(r"\D", "", number)
|
||||||
return "+1 ({}) {} - {}".format(phone[0:3], phone[3:6], phone[6:])
|
return "+1 ({}) {} - {}".format(phone[0:3], phone[3:6], phone[6:])
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from flask import Blueprint, request as http_request, g, render_template
|
from flask import Blueprint, request as http_request, g, render_template
|
||||||
|
from operator import attrgetter
|
||||||
|
|
||||||
portfolios_bp = Blueprint("portfolios", __name__)
|
portfolios_bp = Blueprint("portfolios", __name__)
|
||||||
|
|
||||||
@ -31,4 +32,20 @@ def portfolio():
|
|||||||
)
|
)
|
||||||
return False
|
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,
|
||||||
|
}
|
||||||
|
@ -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 {
|
@mixin subheading {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<span class='portfolio-header__budget--dollars'>
|
<span class='portfolio-header__budget--dollars'>
|
||||||
{{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justDollars }}
|
{{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justDollars }}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span class='cents'>
|
||||||
{{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justCents }}
|
{{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justCents }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user