From b3f3bc9ca2d3d509f17c0c2e2fe210eec9c2bc02 Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Wed, 13 Nov 2019 12:28:01 +0100 Subject: [PATCH] Counters for buttons --- www/index.html | 4 ++-- www/js/hugvey_console.js | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/www/index.html b/www/index.html index 90d0e33..a0a1f47 100644 --- a/www/index.html +++ b/www/index.html @@ -34,8 +34,8 @@
- Unblock all - Start all + Unblock all ({{blockedHugveys}}) + Start all ({{availableHugveys}})
diff --git a/www/js/hugvey_console.js b/www/js/hugvey_console.js index a556bfb..1e24b5a 100644 --- a/www/js/hugvey_console.js +++ b/www/js/hugvey_console.js @@ -17,6 +17,8 @@ class Panopticon { logbook: "", logbookId: null, selectedLang: null, + blockedHugveys: 0, + availableHugveys: 0, }, methods: { time_passed: function( hugvey, property ) { @@ -161,6 +163,18 @@ class Panopticon { if(this.hugveys.selectedId) { this.updateSelectedHugvey(); } + + let avail = 0; + let blocked = 0; + for(let hv of this.hugveys.hugveys) { + if(hv.status =='available') avail ++; + if(hv.status =='blocked') blocked ++; + } + + this.hugveys.blockedHugveys = blocked; + this.hugveys.availableHugveys = avail; + + break; case 'log':