month selector for total spend per month section in reports
This commit is contained in:
parent
b2984bc86b
commit
9f7284070e
@ -1,4 +1,5 @@
|
|||||||
import re
|
import re
|
||||||
|
import datetime
|
||||||
from flask import current_app as app
|
from flask import current_app as app
|
||||||
from werkzeug.datastructures import FileStorage
|
from werkzeug.datastructures import FileStorage
|
||||||
|
|
||||||
@ -72,6 +73,10 @@ def formattedDate(value, formatter="%m/%d/%Y"):
|
|||||||
return "-"
|
return "-"
|
||||||
|
|
||||||
|
|
||||||
|
def dateFromString(value, formatter="%m/%Y"):
|
||||||
|
return datetime.datetime.strptime(value, formatter)
|
||||||
|
|
||||||
|
|
||||||
def register_filters(app):
|
def register_filters(app):
|
||||||
app.jinja_env.filters["iconSvg"] = iconSvg
|
app.jinja_env.filters["iconSvg"] = iconSvg
|
||||||
app.jinja_env.filters["dollars"] = dollars
|
app.jinja_env.filters["dollars"] = dollars
|
||||||
@ -82,3 +87,4 @@ def register_filters(app):
|
|||||||
app.jinja_env.filters["findFilter"] = findFilter
|
app.jinja_env.filters["findFilter"] = findFilter
|
||||||
app.jinja_env.filters["renderList"] = renderList
|
app.jinja_env.filters["renderList"] = renderList
|
||||||
app.jinja_env.filters["formattedDate"] = formattedDate
|
app.jinja_env.filters["formattedDate"] = formattedDate
|
||||||
|
app.jinja_env.filters["dateFromString"] = dateFromString
|
||||||
|
@ -301,8 +301,21 @@
|
|||||||
<div class='spend-table__header'>
|
<div class='spend-table__header'>
|
||||||
<h2 class='spend-table__title'>Total spend per month </h2>
|
<h2 class='spend-table__title'>Total spend per month </h2>
|
||||||
|
|
||||||
<select name='month' id='month' class='spend-table__month-select'>
|
<select name='month' id='month' onchange='location = this.value' class='spend-table__month-select'>
|
||||||
<option value='03/2019'>{{ current_month.strftime('%B %Y') }}</option>
|
{% for m in cumulative_budget["months"] %}
|
||||||
|
{% set month = m | dateFromString %}
|
||||||
|
<option
|
||||||
|
{% if month.month == current_month.month and month.year == current_month.year %}
|
||||||
|
selected='selected'
|
||||||
|
{% endif %}
|
||||||
|
value='{{ url_for("workspaces.workspace_reports",
|
||||||
|
workspace_id=workspace.id,
|
||||||
|
month=month.month,
|
||||||
|
year=month.year) }}'
|
||||||
|
>
|
||||||
|
{{ month.strftime('%B %Y') }}
|
||||||
|
</option>
|
||||||
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user