From 82fb9bcef47da54654e9592c91245590b93fd7ac Mon Sep 17 00:00:00 2001 From: Dennis Siemensma Date: Sun, 7 Mar 2021 22:56:32 +0100 Subject: [PATCH] Reworked dashboard GUI and templating a bit more #1160 / #1291 --- .../templates/dsmr_frontend/dashboard.html | 18 +----- .../fragments/dashboard-period-include.html | 34 ++++------- .../fragments/live-header-include.html | 59 +++++++++++-------- .../templates/dsmr_frontend/live-graphs.html | 8 +-- 4 files changed, 54 insertions(+), 65 deletions(-) diff --git a/dsmr_frontend/templates/dsmr_frontend/dashboard.html b/dsmr_frontend/templates/dsmr_frontend/dashboard.html index fda162a5a..c67f12592 100644 --- a/dsmr_frontend/templates/dsmr_frontend/dashboard.html +++ b/dsmr_frontend/templates/dsmr_frontend/dashboard.html @@ -16,20 +16,8 @@ {% endif %} - {% if capabilities.electricity or capabilities.electricity_returned or capabilities.gas %} -
-
-
-
- - - {% include "dsmr_frontend/fragments/live-header-include.html" with capabilities=capabilities %} - -
-
-
-
-
+ {% if capabilities.electricity %} + {% include "dsmr_frontend/fragments/live-header-include.html" with capabilities=capabilities %} {% endif %} {% if notification_count > 0 %} @@ -49,7 +37,7 @@ {% if capabilities.any %} {% include "dsmr_frontend/fragments/dashboard-period-include.html" with data=period_totals.today date_formatter=today_date_format capabilities=capabilities day=period_totals.day %} - {% include "dsmr_frontend/fragments/dashboard-period-include.html" with archive_link=True data=period_totals.month date_formatter=month_date_format capabilities=capabilities day=period_totals.day %} + {% include "dsmr_frontend/fragments/dashboard-period-include.html" with data=period_totals.month date_formatter=month_date_format capabilities=capabilities day=period_totals.day %} {% include "dsmr_frontend/fragments/dashboard-period-include.html" with data=period_totals.year date_formatter=year_date_format capabilities=capabilities day=period_totals.day %} {% endif %} diff --git a/dsmr_frontend/templates/dsmr_frontend/fragments/dashboard-period-include.html b/dsmr_frontend/templates/dsmr_frontend/fragments/dashboard-period-include.html index 164ff3dff..6cca22230 100644 --- a/dsmr_frontend/templates/dsmr_frontend/fragments/dashboard-period-include.html +++ b/dsmr_frontend/templates/dsmr_frontend/fragments/dashboard-period-include.html @@ -6,32 +6,18 @@
-
- {{ day|date:date_formatter }} - - {% if archive_link %} -
- -
- {% endif %} -
{% if data %} - + - {% if frontend_settings.merge_electricity_tariffs %} - - - - - - - {% else %} + {% if not frontend_settings.merge_electricity_tariffs %} @@ -45,6 +31,14 @@ {% endif %} + + + + + + + + {% if capabilities.gas %} @@ -61,9 +55,7 @@ {% endif %} - - - +
+ {{ day|date:date_formatter }} + {% if capabilities.electricity %}{% translate "Consumed" %}{% endif %} {% if capabilities.electricity_returned %}{% translate "Returned" %}{% endif %} {% translate "Costs" %}
{% if capabilities.electricity %}{% translate "Electricity (single tariff)" %} {% translate "kWh" noop %}{% endif %}{% if capabilities.electricity %}{{ data.electricity_merged|default:'-'|floatformat:2 }} {% endif %}{% if capabilities.electricity_returned %}{{ data.electricity_returned_merged|default:'-'|floatformat:2 }}{% endif %}{% if capabilities.electricity %}{{ data.electricity_cost_merged|default:'-' }}{% endif %}
{% if capabilities.electricity %}{{ frontend_settings.tariff_1_delivered_name }} {% translate "kWh" noop %}{% endif %} {% if capabilities.electricity %}{{ data.electricity1|default:'-'|floatformat:2 }}{% endif %}{% if capabilities.electricity %}{{ data.electricity2_cost|default:'-' }}{% endif %}
{% if capabilities.electricity %}{% translate "Electricity" %} {% if not frontend_settings.merge_electricity_tariffs %}{% translate "(combined)" %}{% else %}{% translate "(single tariff)" %}{% endif %} {% translate "kWh" noop %}{% endif %}{% if capabilities.electricity %}{{ data.electricity_merged|default:'-'|floatformat:2 }} {% endif %}{% if capabilities.electricity_returned %}{{ data.electricity_returned_merged|default:'-'|floatformat:2 }}{% endif %}{% if capabilities.electricity %}{{ data.electricity_cost_merged|default:'-' }}{% endif %}
{% translate "Gas" %} {% translate "m3" noop %}
{% translate "Total" %}{% if capabilities.electricity %}{{ data.electricity_merged|default:'-'|floatformat:2 }}{% endif %}{% if capabilities.electricity_returned %}{{ data.electricity_returned_merged|default:'-'|floatformat:2 }}{% endif %}{% translate "Total costs" %} {{ data.total_cost|default:'-' }}
diff --git a/dsmr_frontend/templates/dsmr_frontend/fragments/live-header-include.html b/dsmr_frontend/templates/dsmr_frontend/fragments/live-header-include.html index 02b5c84fc..f1de769b1 100644 --- a/dsmr_frontend/templates/dsmr_frontend/fragments/live-header-include.html +++ b/dsmr_frontend/templates/dsmr_frontend/fragments/live-header-include.html @@ -1,27 +1,40 @@ {% load i18n %} {% load l10n %} - - -
- - - - {% blocktranslate %}Based on the latest telegram received, no matter if it's still unprocessed.{% endblocktranslate %} - - - - - - {% if capabilities.electricity %} - - - {% translate "W" %} - {% endif %} - - - {% if capabilities.electricity %} - €{% translate '/hour' %} - {% endif %} - \ No newline at end of file +
+
+
+
+ + + + + + +
+ +
+ + + + + {% blocktranslate %}Based on the latest telegram received, no matter if it's still unprocessed.{% endblocktranslate %} + + + +
+ {% if capabilities.electricity %} + + + {% translate "W" %} + {% endif %} + + {% if capabilities.electricity %} + €{% translate '/hour' %} + {% endif %} +
+
+
+
+
diff --git a/dsmr_frontend/templates/dsmr_frontend/live-graphs.html b/dsmr_frontend/templates/dsmr_frontend/live-graphs.html index fc494cbd0..6baf8ce78 100644 --- a/dsmr_frontend/templates/dsmr_frontend/live-graphs.html +++ b/dsmr_frontend/templates/dsmr_frontend/live-graphs.html @@ -17,6 +17,8 @@ {% endif %} {% if capabilities.electricity %} + {% include "dsmr_frontend/fragments/live-header-include.html" with capabilities=capabilities %} +
@@ -24,12 +26,6 @@ {% translate "Recent electricity consumption" %}
- - - {% include "dsmr_frontend/fragments/live-header-include.html" with capabilities=capabilities %} - -
-
{% blocktranslate %}Scroll or pinch the graph to zoom in and out. To change the current point in time, drag the graph sideways, or use the scrollbar/control below the graph.{% endblocktranslate %}