From 46f41d6e91f329711eac188fa99f628345fd8f7a Mon Sep 17 00:00:00 2001 From: Thorsten Zoerner Date: Sun, 28 Jan 2024 13:52:18 +0100 Subject: [PATCH] Increment: Adding switch between cost and revenue in PWA (customer interface). --- framework/public_pwa/assets/js/index.js | 9 +++++++++ framework/public_pwa/index.html | 6 +++--- framework/services/access.service.js | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/framework/public_pwa/assets/js/index.js b/framework/public_pwa/assets/js/index.js index 91d81a2..64fcf8b 100644 --- a/framework/public_pwa/assets/js/index.js +++ b/framework/public_pwa/assets/js/index.js @@ -62,6 +62,8 @@ const app = async function(token) { }); $.getJSON("/api/debit/open?meterId="+window.meterId+"&token="+token, function(data) { + let totalConsumption = 0; + // Handling "Abrechnung Übersicht in Zeile" for (let [key, value] of Object.entries(data)) { if(key.indexOf('cost') == 0) { @@ -69,6 +71,7 @@ const app = async function(token) { } if(key.indexOf('consumption') == 0) { $('.'+key).html((value/1000).toFixed(3).replace('.',',')); + totalConsumption += value * 1; } } $('.consumption').html((data.consumption/1000).toFixed(3).replace('.',',')); @@ -347,6 +350,12 @@ const app = async function(token) { }) $.getJSON("/api/access/getAssetMeta?meterId="+window.meterId+"&token="+token, function(data) { + if(typeof data.balancerule !== 'undefined') { + if(typeof data.balancerule.to !== 'undefined') { + $('.kosten').html("Einnahmen"); + $('.verbrauch').html("Einspeisung"); + } + } let customName = window.meterId; if(typeof data.operationMeta !== 'undefined') { if(typeof data.operationMeta.meterPointName !== 'undefined') { diff --git a/framework/public_pwa/index.html b/framework/public_pwa/index.html index 73f3e77..2df7f83 100644 --- a/framework/public_pwa/index.html +++ b/framework/public_pwa/index.html @@ -106,10 +106,10 @@
-kWh / 
-
Verbrauch
+
Verbrauch
-
Kosten
+
Kosten
@@ -175,7 +175,7 @@