fix remove button in automatizace
This commit is contained in:
parent
370603e6a5
commit
e2be9e57ee
@ -14,52 +14,52 @@ if ('serviceWorker' in navigator) {
|
|||||||
$('select').change(function(e) {
|
$('select').change(function(e) {
|
||||||
console.log($(this).val());
|
console.log($(this).val());
|
||||||
if( $(this).val() == 'time') {
|
if( $(this).val() == 'time') {
|
||||||
|
|
||||||
$('#atTime').prop( "disabled", false );
|
$('#atTime').prop( "disabled", false );
|
||||||
|
|
||||||
$('#atDeviceValue').prop( "disabled", true );
|
$('#atDeviceValue').prop( "disabled", true );
|
||||||
$('#atDeviceValueInt').prop( "disabled", true );
|
$('#atDeviceValueInt').prop( "disabled", true );
|
||||||
} else if( $(this).val() == 'atDeviceValue') {
|
} else if( $(this).val() == 'atDeviceValue') {
|
||||||
|
|
||||||
$('#atDeviceValue').prop( "disabled", false );
|
$('#atDeviceValue').prop( "disabled", false );
|
||||||
$('#atDeviceValueInt').prop( "disabled", false );
|
$('#atDeviceValueInt').prop( "disabled", false );
|
||||||
|
|
||||||
$('#atTime').prop( "disabled", true );
|
$('#atTime').prop( "disabled", true );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var pressTimer;
|
var pressTimer;
|
||||||
var touch = 0;
|
var touch = 0;
|
||||||
var touchSubId = "";
|
var touchSubId = "";
|
||||||
$("div.square-content").on('touchend', function (e){
|
$("div.square-content").on('touchend', function (e){
|
||||||
clearTimeout(pressTimer);
|
clearTimeout(pressTimer);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("div.square-content").on('touchstart', function (eTarget) {
|
$("div.square-content").on('touchstart', function (eTarget) {
|
||||||
navigator.vibrate([500]);
|
navigator.vibrate([500]);
|
||||||
var id = '';
|
var id = '';
|
||||||
|
|
||||||
var windowLoc = $(location).attr('pathname');
|
var windowLoc = $(location).attr('pathname');
|
||||||
windowLoc = windowLoc.substring(windowLoc.lastIndexOf("/"));
|
windowLoc = windowLoc.substring(windowLoc.lastIndexOf("/"));
|
||||||
console.log(windowLoc);
|
console.log(windowLoc);
|
||||||
if (windowLoc == "/") {
|
if (windowLoc == "/") {
|
||||||
id = $(this).attr('id').replace('device-', '');
|
id = $(this).attr('id').replace('device-', '');
|
||||||
} else if (windowLoc == "/scene") {
|
} else if (windowLoc == "/scene") {
|
||||||
id = $(this).attr('id').replace('scene-', '');
|
id = $(this).attr('id').replace('scene-', '');
|
||||||
} else if (windowLoc == "/automation") {
|
} else if (windowLoc == "/automation") {
|
||||||
id = $(this).attr('id').replace('automation-', '');
|
id = $(this).attr('id').replace('automation-', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
var subId = $(this).attr('data-sub-device-id');
|
var subId = $(this).attr('data-sub-device-id');
|
||||||
|
|
||||||
touch++;
|
touch++;
|
||||||
if(touch == 2 && touchSubId == subId){
|
if(touch == 2 && touchSubId == subId){
|
||||||
console.log("Detail");
|
console.log("Detail");
|
||||||
if (windowLoc == "/") {
|
if (windowLoc == "/") {
|
||||||
$("#modal-detail-"+subId).removeClass('modal-container-hiden').show();
|
$("#modal-detail-"+subId).removeClass('modal-container-hiden').show();
|
||||||
ajaxChart(subId);
|
ajaxChart(subId);
|
||||||
} else if (windowLoc == "/scene") {
|
} else if (windowLoc == "/scene") {
|
||||||
|
|
||||||
} else if (windowLoc == "/automation") {
|
} else if (windowLoc == "/automation") {
|
||||||
}
|
}
|
||||||
touch = 0;
|
touch = 0;
|
||||||
@ -67,7 +67,7 @@ $("div.square-content").on('touchstart', function (eTarget) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
touchSubId = subId;
|
touchSubId = subId;
|
||||||
|
|
||||||
pressTimer = window.setTimeout(function (e) {
|
pressTimer = window.setTimeout(function (e) {
|
||||||
console.log("Setting");
|
console.log("Setting");
|
||||||
$("#modal-setting-"+id).removeClass('modal-container-hiden').show();
|
$("#modal-setting-"+id).removeClass('modal-container-hiden').show();
|
||||||
@ -81,7 +81,7 @@ $("div.square-content").mousedown(function(e) {
|
|||||||
windowLoc = windowLoc.substring(windowLoc.lastIndexOf("/"));
|
windowLoc = windowLoc.substring(windowLoc.lastIndexOf("/"));
|
||||||
console.log(windowLoc);
|
console.log(windowLoc);
|
||||||
var id = null;
|
var id = null;
|
||||||
if (windowLoc == "/") {
|
if (windowLoc == "/") {
|
||||||
id = $(this).attr('id').replace('device-', '');
|
id = $(this).attr('id').replace('device-', '');
|
||||||
} else if (windowLoc == "/scene") {
|
} else if (windowLoc == "/scene") {
|
||||||
id = $(this).attr('id').replace('scene-', '');
|
id = $(this).attr('id').replace('scene-', '');
|
||||||
@ -91,7 +91,7 @@ $("div.square-content").mousedown(function(e) {
|
|||||||
$("#modal-setting-"+id).removeClass('modal-container-hiden').show();
|
$("#modal-setting-"+id).removeClass('modal-container-hiden').show();
|
||||||
console.log("Setting");
|
console.log("Setting");
|
||||||
console.log("modal" + id);
|
console.log("modal" + id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".close").on('click', function (e) {
|
$(".close").on('click', function (e) {
|
||||||
@ -154,9 +154,9 @@ console.log();
|
|||||||
if (windowLoc == "/") {
|
if (windowLoc == "/") {
|
||||||
var selectRoomId = localStorage.getItem("selectedRoomId");
|
var selectRoomId = localStorage.getItem("selectedRoomId");
|
||||||
console.log('Saved Selected Room ID '+ selectRoomId);
|
console.log('Saved Selected Room ID '+ selectRoomId);
|
||||||
$('[name="room"]').val(selectRoomId);
|
$('[name="room"]').val(selectRoomId);
|
||||||
$('.device-button').each(function(){
|
$('.device-button').each(function(){
|
||||||
if (selectRoomId != 'all'){
|
if (selectRoomId != 'all'){
|
||||||
if($(this).data('room-id') != selectRoomId){
|
if($(this).data('room-id') != selectRoomId){
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
} else {
|
} else {
|
||||||
@ -167,19 +167,19 @@ if (windowLoc == "/") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Room selector
|
//Room selector
|
||||||
$( '[name="room"]' ).change(function (e) {
|
$( '[name="room"]' ).change(function (e) {
|
||||||
console.log('Selected Room ID ' + this.value)
|
console.log('Selected Room ID ' + this.value)
|
||||||
var roomId = this.value;
|
var roomId = this.value;
|
||||||
localStorage.setItem("selectedRoomId", roomId);
|
localStorage.setItem("selectedRoomId", roomId);
|
||||||
$('.device-button').show();
|
$('.device-button').show();
|
||||||
if (roomId != 'all'){
|
if (roomId != 'all'){
|
||||||
$('.device-button').each(function(){
|
$('.device-button').each(function(){
|
||||||
if($(this).data('room-id') != roomId){
|
if($(this).data('room-id') != roomId){
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// var windowLoc = $(location).attr('pathname');
|
// var windowLoc = $(location).attr('pathname');
|
||||||
@ -233,40 +233,7 @@ $( "button[name=remove]" ).click(function(e) {
|
|||||||
id = $(this).data('scene-id');
|
id = $(this).data('scene-id');
|
||||||
$("#scene-"+id+"-content").remove();
|
$("#scene-"+id+"-content").remove();
|
||||||
} else if (windowLoc == "/automation") {
|
} else if (windowLoc == "/automation") {
|
||||||
id = $(this).data('automation-id');
|
$(this).parent().remove();
|
||||||
$("#automation-"+id+"-content").remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="label"><?php echo $LANG['l_runAt']?></div>
|
<div class="label"><?php echo $LANG['l_runAt']?></div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<?php //TODO Dodělat identifikaci pro Selctor události a selector času zařízení hodnoty ?>
|
<?php //TODO Dodělat identifikaci pro Selctor události a selector času zařízení hodnoty ?>
|
||||||
<select class="input" name="atSelector" id="valueSelector" required>
|
<select class="input" name="atSelector" id="valueSelector" required>
|
||||||
<option value="sunSet" <?php ECHO ($AUTOMATION['ifSomething'] == "sunSet" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_sunSet']?></option>
|
<option value="sunSet" <?php ECHO ($AUTOMATION['ifSomething'] == "sunSet" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_sunSet']?></option>
|
||||||
<option value="sunRise" <?php ECHO ($AUTOMATION['ifSomething'] == "sunRise" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_sunRice']?></option>
|
<option value="sunRise" <?php ECHO ($AUTOMATION['ifSomething'] == "sunRise" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_sunRice']?></option>
|
||||||
@ -26,35 +26,14 @@
|
|||||||
=
|
=
|
||||||
<input class="input" type="num" name="atDeviceValueInt" id="atDeviceValueInt" required <?php ECHO ($AUTOMATION['ifSomething'] == "atDeviceValue" ? '' : 'disabled'); ?>/>
|
<input class="input" type="num" name="atDeviceValueInt" id="atDeviceValueInt" required <?php ECHO ($AUTOMATION['ifSomething'] == "atDeviceValue" ? '' : 'disabled'); ?>/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="label"><?php echo $LANG['l_resetAt']?></div>
|
|
||||||
<div class="field">
|
|
||||||
<?php //TODO Dodělat identifikaci pro Selctor události a selector času zařízení hodnoty ?>
|
|
||||||
<select class="input" name="restartAtSelector" id="valueSelector" required>
|
|
||||||
<option value="sunSet" <?php ECHO ($AUTOMATION['ifSomething'] == "sunSet" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_sunSet']?></option>
|
|
||||||
<option value="sunRise" <?php ECHO ($AUTOMATION['ifSomething'] == "sunRise" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_sunRice']?></option>
|
|
||||||
<option value="inHome" <?php ECHO ($AUTOMATION['ifSomething'] == "inHome" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_inHome']?></option>
|
|
||||||
<option value="outHome" <?php ECHO ($AUTOMATION['ifSomething'] == "outHome" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_outHome']?></option>
|
|
||||||
<option value="time" <?php ECHO ($AUTOMATION['ifSomething'] == "time" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_time']?></option>
|
|
||||||
<option value="atDeviceValue" <?php ECHO ($AUTOMATION['ifSomething'] == "atDeviceValue" ? 'selected="selected"' : ''); ?>><?php echo $LANG['l_deviceValue']?></option>
|
|
||||||
</select>
|
|
||||||
<input class="input" type="time" name="restartAtTime" id="atTime" <?php ECHO ($AUTOMATION['ifSomething'] == "time" ? '' : 'disabled'); ?>/>
|
|
||||||
<select class="input" name="restartAtDeviceValue" id="atDeviceValue" <?php ECHO ($AUTOMATION['ifSomething'] == "atDeviceValue" ? '' : 'disabled'); ?>>
|
|
||||||
<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){ ?>
|
|
||||||
<option value="<?php echo $subDeviceKey; ?>"><?php echo $subDeviceValue['name']; ?>[<?php echo $subDeviceValue['type']; ?>]</option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
=
|
|
||||||
<input class="input" type="num" name="restartAtDeviceValueInt" id="atDeviceValueInt" required <?php ECHO ($AUTOMATION['ifSomething'] == "atDeviceValue" ? '' : 'disabled'); ?>/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="label"><?php echo $LANG['l_affectedDevices'];?></div>
|
<div class="label"><?php echo $LANG['l_affectedDevices'];?></div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="field px-2">
|
<div class="field px-2">
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($AUTOMATION['doSomething'] as $subDeviceId => $subDeviceData){ ?>
|
foreach($AUTOMATION['doSomething'] as $subDeviceId => $subDeviceData){ ?>
|
||||||
<div id="automation-<?php echo $AUTOMATIONID; ?>-content">
|
<div id="automation-<?php echo $AUTOMATIONID; ?>-content">
|
||||||
<div class="label"><?php echo $subDeviceData['name']; ?></div>
|
<div class="label"><?php echo $subDeviceData['name']; ?></div>
|
||||||
<select class="input" name="devices[<?php echo $subDeviceId; ?>]">
|
<select class="input" name="devices[<?php echo $subDeviceId; ?>]">
|
||||||
<option value="0" <?php echo ($subDeviceData['state'] == "0" ? 'selected="selected"' : ''); ?>>off</option>
|
<option value="0" <?php echo ($subDeviceData['state'] == "0" ? 'selected="selected"' : ''); ?>>off</option>
|
||||||
@ -62,12 +41,12 @@
|
|||||||
</select>
|
</select>
|
||||||
<button name="remove" type="button" class="button is-danger fa" data-automation-id="<?php echo $AUTOMATIONID; ?>"></button>
|
<button name="remove" type="button" class="button is-danger fa" data-automation-id="<?php echo $AUTOMATIONID; ?>"></button>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$i++;
|
$i++;
|
||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="label"><?php echo $LANG['l_atDays'];?></div>
|
<div class="label"><?php echo $LANG['l_atDays'];?></div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<input type="checkbox" name="day[]" value="mon" <?php ECHO (in_array("mon", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Pondělí
|
<input type="checkbox" name="day[]" value="mon" <?php ECHO (in_array("mon", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Pondělí
|
||||||
</div>
|
</div>
|
||||||
@ -90,9 +69,9 @@
|
|||||||
<input type="checkbox" name="day[]" value="sun" <?php ECHO (in_array("sun", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Neděle
|
<input type="checkbox" name="day[]" value="sun" <?php ECHO (in_array("sun", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> Neděle
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="submit" class="button" name="modalFinal" value="<?php echo $LANG['b_edit'];?>"/>
|
<input type="submit" class="button" name="modalFinal" value="<?php echo $LANG['b_edit'];?>"/>
|
||||||
<input type="submit" class="button is-danger" onClick="ajaxPostSimple('ajax',{automation_id: '<?php echo $AUTOMATIONID ?>', action:'delete'}, true);" name="remove" value="<?php echo $LANG['b_remove'];?>"/>
|
<input type="submit" class="button is-danger" onClick="ajaxPostSimple('ajax',{automation_id: '<?php echo $AUTOMATIONID ?>', action:'delete'}, true);" name="remove" value="<?php echo $LANG['b_remove'];?>"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<script src="./templates/js/jquery.js"></script>
|
<script src="./app/templates/js/jquery.js"></script>
|
||||||
<script src="./templates/js/post.js"></script>
|
<script src="./app/templates/js/post.js"></script>
|
||||||
<script src="./templates/js/script.js"></script>
|
<script src="./app/templates/js/script.js"></script>
|
||||||
|
@ -10,16 +10,16 @@
|
|||||||
<meta name="msapplication-starturl" content="/vasek/home/">
|
<meta name="msapplication-starturl" content="/vasek/home/">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
<link rel="icon" sizes="192x192" href="/vasek/home/templates/images/icon-192x192.png">
|
<link rel="icon" sizes="192x192" href="/vasek/home/app/templates/images/icon-192x192.png">
|
||||||
<link rel="apple-touch-icon" sizes="192x192" href="/vasek/home/templates/images/icon-192x192.png">
|
<link rel="apple-touch-icon" sizes="192x192" href="/vasek/home/app/templates/images/icon-192x192.png">
|
||||||
<link rel="icon" sizes="512x512" href="/vasek/home/templates/images/icon-512x512.png">
|
<link rel="icon" sizes="512x512" href="/vasek/home/app/templates/images/icon-512x512.png">
|
||||||
<link rel="apple-touch-icon" sizes="512x512" href="/vasek/home/templates/images/icon-512x512.png">
|
<link rel="apple-touch-icon" sizes="512x512" href="/vasek/home/app/templates/images/icon-512x512.png">
|
||||||
|
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<link rel="stylesheet" href="./templates/css/main.css">
|
<link rel="stylesheet" href="./app/templates/css/main.css">
|
||||||
<link rel="stylesheet" href="./templates/css/font-awesome.min.css">
|
<link rel="stylesheet" href="./app/templates/css/font-awesome.min.css">
|
||||||
<link rel="stylesheet" href="./templates/css/modal.css">
|
<link rel="stylesheet" href="./app/templates/css/modal.css">
|
||||||
<link rel="stylesheet" href="./templates/css/pre.css">
|
<link rel="stylesheet" href="./app/templates/css/pre.css">
|
||||||
<link rel="stylesheet" href="./templates/css/loading.css">
|
<link rel="stylesheet" href="./app/templates/css/loading.css">
|
||||||
|
Loading…
Reference in New Issue
Block a user