This commit is contained in:
JonatanRek
2019-09-01 15:55:49 +02:00
14 changed files with 170 additions and 78 deletions

View File

@@ -48,7 +48,7 @@
<i class="fa fa-times"></i>
</div>
<h4 class="mb-4">Modal bitch</h4>
<form method="post" action="controls/dashboard.php">
<form method="post">
<div class="field px-2">
<div class="label">Zvolte zařízení:</div>
<select class="input" name="devices[]" multiple>

View File

@@ -35,10 +35,8 @@
<div class="col-md-9 main-body">
<div class="label m-1">
doma jsou:
<?php
$keyWords = ['entered', 'connected', 'connected to'];
foreach ($USERS as $user) {
if (in_array(trim($user['at_home']), $keyWords)) {
<?php foreach ($USERS as $user) {
if ($user['at_home'] == 'true') {
echo $user['username'] . ' ';
}
} ?>

View File

@@ -33,7 +33,7 @@ function ajaxPost(path, params, self, reload = false) {
}
console.log(msg);
if (reload){
//location.reload();
location.reload();
}
},
error: function (request, status, error) {

View File

@@ -182,36 +182,36 @@ $( '[name="room"]' ).change(function (e) {
});
var windowLoc = $(location).attr('pathname');
windowLoc = windowLoc.substring(windowLoc.lastIndexOf("/"));
console.log();
if (windowLoc == "/") {
var autoUpdate = setInterval(function(){
$.ajax({
url: 'ajax',
type: 'POST',
dataType: 'json',
data: {
"action": 'getState'
},
success: function(data){
// console.log('DATA: ', data);
for (const key in data) {
if (data.hasOwnProperty(key)) {
const device = data[key];
$('[data-sub-device-id="'+key+'"]')
.find('.device-button-value')
.text(device['value'])
.attr('title',device['time'])
}
}
},
error: function (request, status, error) {
console.log("ERROR ajaxChart():", request, error);
}
});
},2000);
}
// var windowLoc = $(location).attr('pathname');
// windowLoc = windowLoc.substring(windowLoc.lastIndexOf("/"));
// console.log();
// if (windowLoc == "/") {
// var autoUpdate = setInterval(function(){
// $.ajax({
// url: 'ajax',
// type: 'POST',
// dataType: 'json',
// data: {
// "action": 'getState'
// },
// success: function(data){
// // console.log('DATA: ', data);
// for (const key in data) {
// if (data.hasOwnProperty(key)) {
// const device = data[key];
// $('[data-sub-device-id="'+key+'"]')
// .find('.device-button-value')
// .text(device['value'])
// .attr('title',device['time'])
// }
// }
// },
// error: function (request, status, error) {
// console.log("ERROR ajaxChart():", request, error);
// }
// });
// },2000);
// }

View File

@@ -12,7 +12,10 @@
<option value="inHome"><?php echo $LANG['l_inHome']?></option>
<option value="outHome"><?php echo $LANG['l_outHome']?></option>
<option value="time"><?php echo $LANG['l_time']?></option>
<option value="atDeviceValue"><?php echo $LANG['l_deviceValue']?></option>
<option value="noOneHome"><?php echo $LANG['l_time']?></option>
<option value="atDeviceValue"><?php echo $LANG['l_deviceValue'];?></option>
<option value="noOneHome"><?php echo $LANG['w_noOne'] . ' ' . $LANG['w_neni'] . ' ' . $LANG['w_home'];?></option>
<option value="someOneHome"><?php echo $LANG['w_someOne'] . ' ' . $LANG['w_is'] . ' ' . $LANG['w_home'];?></option>
</select>
<input class="input" type="time" name="atTime" id="atTime" disabled/>
<select class="input" name="atDeviceValue" id="atDeviceValue" disabled>