Files
notifications-admin/app/templates/views/providers/edit-sms-provider-ratio.html
Chris Hill-Scott 581296b95e Fix off-by-one dates on provider history
We chunk history entries by their YYYY-MM-DD date representation to
display them day-by-day.

However trying to convert a YYYY-MM-DD string into a timestamp is
unpredictable, and was causing our dates to be one day out (probably
because of midnight/daylight savings/general datetime horrors).

This commit changes the code to do the same thing as the history page,
which is look at the `updated_at` field on the first entry to get a
datetime object and from that the formatted date we show in the headings
on the page.
2019-12-13 13:20:56 +00:00

93 lines
3.0 KiB
HTML

{% extends "views/platform-admin/_base_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% from "components/radios.html" import radios %}
{% block per_page_title %}
Text message providers
{% endblock %}
{% block platform_admin_content %}
{{ page_header('Text message providers') }}
<h2 class="heading-small top-gutter">
Now
</h2>
<div class="bottom-gutter">
<div class="history-list-item">
<div class="grid-row">
<div class="column-one-third">&nbsp;</div>
<div class="column-two-thirds">
<div class="history-list-percentage-without-border">
<div class="history-list-percentage-left-label">
{{ primary_provider }}
</div>
<div class="history-list-percentage-right-label">
{{ secondary_provider }}
</div>
{% call form_wrapper() %}
<div class="radio-slider" data-module="radio-slider">
{{ radios(form.ratio, inline=True, hide_legend=True) }}
<div class="radio-slider-left-value">
</div>
<div class="radio-slider-right-value">
</div>
</div>
{{ page_footer('Update', centered_button=True) }}
{% endcall %}
</div>
</div>
</div>
</div>
</div>
{% for day, versions in versions %}
<h2 class="heading-small top-gutter">
{% if day %}
{{ versions[0]['updated_at']|format_date_human|title }}
{% else %}
Start
{% endif %}
</h2>
<ul class="bottom-gutter">
{% for version in versions %}
<li class="history-list-item">
<div class="grid-row">
<div class="column-one-third">
<div class="history-list-user">
{{ version.created_by.name or ('&nbsp;'|safe) }}
</div>
{% if version.updated_at %}
<div class="history-list-time">
{{ version.updated_at|format_time }}
</div>
{% endif %}
</div>
<div class="column-two-thirds">
<div class="history-list-percentage">
<div class="history-list-percentage-left-label">
{{ primary_provider }}<br><br>
{{ version.priority|format_thousands }}%
</div>
<div class="history-list-percentage-right-label">
{{ secondary_provider }}<br><br>
{{ (100 - version.priority)|format_thousands }}%
</div>
<div class="history-list-percentage-marker" style="left: {{ (100 -version.priority)|format_thousands }}%"></div>
</div>
</div>
</div>
</li>
{% endfor %}
</ul>
{% endfor %}
{% endblock %}