Counters for buttons

This commit is contained in:
Ruben van de Ven 2019-11-13 12:28:01 +01:00
parent 163b4821f3
commit b3f3bc9ca2
2 changed files with 16 additions and 2 deletions

View file

@ -34,8 +34,8 @@
</ul> </ul>
<div class='hvactions'> <div class='hvactions'>
<span class='btn' id='unblock-all' @click="unblockAll">Unblock all</span> <span class='btn' id='unblock-all' @click="unblockAll">Unblock all ({{blockedHugveys}})</span>
<span class='btn' id='start-all' @click="startAll">Start all</span> <span class='btn' id='start-all' @click="startAll">Start all ({{availableHugveys}})</span>
</div> </div>
</div> </div>

View file

@ -17,6 +17,8 @@ class Panopticon {
logbook: "", logbook: "",
logbookId: null, logbookId: null,
selectedLang: null, selectedLang: null,
blockedHugveys: 0,
availableHugveys: 0,
}, },
methods: { methods: {
time_passed: function( hugvey, property ) { time_passed: function( hugvey, property ) {
@ -161,6 +163,18 @@ class Panopticon {
if(this.hugveys.selectedId) { if(this.hugveys.selectedId) {
this.updateSelectedHugvey(); 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; break;
case 'log': case 'log':