|
@ -11,20 +11,16 @@ |
|
|
<a v-on:click="sendsignal(item, item.oncommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-play" aria-hidden="true"></i></a> |
|
|
<a v-on:click="sendsignal(item, item.oncommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-play" aria-hidden="true"></i></a> |
|
|
<a v-on:click="sendsignal(item, item.offcommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-stop" aria-hidden="true"></i></a> |
|
|
<a v-on:click="sendsignal(item, item.offcommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-stop" aria-hidden="true"></i></a> |
|
|
</div> |
|
|
</div> |
|
|
<?php if ($admin): ?> |
|
|
<div v-show="admin"> |
|
|
<div> |
|
|
|
|
|
<a v-on:click="delitem(item)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-trash" aria-hidden="true"></i></a> |
|
|
<a v-on:click="delitem(item)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-trash" aria-hidden="true"></i></a> |
|
|
|
|
|
<a v-on:click="showinfo(item)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-info" aria-hidden="true"></i></a> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<?php endif ?> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<?php if ($admin): ?> |
|
|
<div v-if="admin"> |
|
|
<div> |
|
|
|
|
|
<a href="javascript:void(0)" class="addbtn" v-on:click="add">{{addtext}}</a> |
|
|
<a href="javascript:void(0)" class="addbtn" v-on:click="add">{{addtext}}</a> |
|
|
<div class="add" v-show="adding"> |
|
|
<div class="add" v-show="adding"> |
|
|
<form> |
|
|
<form> |
|
@ -102,9 +98,6 @@ |
|
|
</form> |
|
|
</form> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<?php endif ?> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -114,6 +107,7 @@ var app = new Vue({ |
|
|
el: '#app', |
|
|
el: '#app', |
|
|
data: { |
|
|
data: { |
|
|
items: [], |
|
|
items: [], |
|
|
|
|
|
admin: <?php echo ($admin) ? 'true' : 'false' ?>, |
|
|
sending: false, |
|
|
sending: false, |
|
|
adding: false, |
|
|
adding: false, |
|
|
messages: [], |
|
|
messages: [], |
|
@ -173,6 +167,33 @@ var app = new Vue({ |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
showinfo: function(item) { |
|
|
|
|
|
alert(this.dump(item,2)) |
|
|
|
|
|
}, |
|
|
|
|
|
dump: function(arr,level) { |
|
|
|
|
|
var dumped_text = ""; |
|
|
|
|
|
if(!level) level = 0; |
|
|
|
|
|
|
|
|
|
|
|
//The padding given at the beginning of the line. |
|
|
|
|
|
var level_padding = ""; |
|
|
|
|
|
for(var j=0;j<level+1;j++) level_padding += " "; |
|
|
|
|
|
|
|
|
|
|
|
if(typeof(arr) == 'object') { //Array/Hashes/Objects |
|
|
|
|
|
for(var item in arr) { |
|
|
|
|
|
var value = arr[item]; |
|
|
|
|
|
|
|
|
|
|
|
if(typeof(value) == 'object') { //If it is an array, |
|
|
|
|
|
dumped_text += level_padding + "'" + item + "' ...\n"; |
|
|
|
|
|
dumped_text += this.dump(value,level+1); |
|
|
|
|
|
} else { |
|
|
|
|
|
dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n"; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else { //Stings/Chars/Numbers etc. |
|
|
|
|
|
dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; |
|
|
|
|
|
} |
|
|
|
|
|
return dumped_text; |
|
|
|
|
|
}, |
|
|
getitems: function() { |
|
|
getitems: function() { |
|
|
axios |
|
|
axios |
|
|
.get('api/items') |
|
|
.get('api/items') |
|
|