PHP_SMART_HOME_V3/app/templates/part/automationEdit.phtml

86 lines
7.3 KiB
PHTML
Raw Permalink Normal View History

2019-08-23 11:39:42 +00:00
<div class="modal-container modal-container-hiden" id="modal-setting-<?php echo $AUTOMATIONID; ?>">
<div class="modal">
<div class="close">
<i class="fa fa-times"></i>
</div>
2019-10-11 12:12:05 +00:00
<h4 class="mb-4"><?php $LANGMNG->echo('t_createAutomation');?></h4>
2019-08-23 11:39:42 +00:00
<form method="post">
2019-10-13 08:07:03 +00:00
<input type="hidden" name="action" value="edit" required/>
2019-09-19 18:05:32 +00:00
<input name="automation_id" type="hidden" value="<?php echo $AUTOMATIONID; ?>">
2019-08-23 11:39:42 +00:00
<div class="field">
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('l_nameAt');?></div>
2019-10-08 16:23:57 +00:00
<div class="field">
<input class="input" type="text" name="name" value="<?php echo (isset ($AUTOMATION['name']) ? $AUTOMATION['name'] : ""); ?>" required/>
</div>
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('l_runAt');?></div>
2019-08-23 11:39:42 +00:00
<div class="field">
2019-09-19 17:14:01 +00:00
<?php //TODO Dodělat identifikaci pro Selctor události a selector času zařízení hodnoty ?>
2019-08-23 11:39:42 +00:00
<select class="input" name="atSelector" id="valueSelector" required>
2019-10-11 12:12:05 +00:00
<option value="sunSet" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "sunSet" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_sunSet');?></option>
<option value="sunRise" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "sunRise" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_sunRice');?></option>
<option value="inHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "inHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_inHome');?></option>
<option value="outHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "outHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_outHome');?></option>
<option value="time" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_time');?></option>
<option value="atDeviceValue" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('l_deviceValue');;?></option>
<option value="noOneHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "noOneHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('w_noOne'); echo ' ' . $LANGMNG->get('w_neni') . ' ' . $LANGMNG->get('w_home');?></option>
<option value="someOneHome" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "someOneHome" ? 'selected="selected"' : ''); ?>><?php $LANGMNG->echo('w_someOne'); echo ' ' . $LANGMNG->get('w_is') . ' ' . $LANGMNG->get('w_home');?></option>
2019-08-23 11:39:42 +00:00
</select>
2019-10-08 16:59:51 +00:00
<input class="input" type="time" name="atTime" id="atTime" value="<?php echo (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? json_decode($AUTOMATION['ifSomething'], true)['value'] : ""); ?>" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "time" ? '' : 'disabled'); ?>/>
<select class="input" name="atDeviceValue" id="atDeviceValue" <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? '' : 'disabled'); ?>>
2019-08-23 11:39:42 +00:00
<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){ ?>
<option value="<?php echo $subDeviceKey; ?>"><?php echo $subDeviceValue['name']; ?>[<?php echo $subDeviceValue['type']; ?>]</option>
<?php } ?>
</select>
=
2019-10-08 16:59:51 +00:00
<input class="input" type="text" name="atDeviceValueInt" id="atDeviceValueInt" required <?php ECHO (json_decode($AUTOMATION['ifSomething'], true)['type'] == "atDeviceValue" ? '' : 'disabled'); ?>/>
2019-08-23 11:39:42 +00:00
</div>
2019-09-19 17:14:01 +00:00
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('l_affectedDevices'); ?></div>
2019-08-23 11:39:42 +00:00
<div class="field">
<div class="field px-2">
2019-09-19 17:14:01 +00:00
<?php
2019-08-23 11:39:42 +00:00
$i = 0;
2019-09-19 17:14:01 +00:00
foreach($AUTOMATION['doSomething'] as $subDeviceId => $subDeviceData){ ?>
<div id="automation-<?php echo $AUTOMATIONID; ?>-content">
2019-08-23 11:39:42 +00:00
<div class="label"><?php echo $subDeviceData['name']; ?></div>
2019-09-19 18:05:32 +00:00
<select class="input" name="device[<?php echo $subDeviceId; ?>]">
2019-08-23 11:39:42 +00:00
<option value="0" <?php echo ($subDeviceData['state'] == "0" ? 'selected="selected"' : ''); ?>>off</option>
<option value="1" <?php echo ($subDeviceData['state'] == "1" ? 'selected="selected"' : ''); ?>>on</option>
</select>
<button name="remove" type="button" class="button is-danger fa" data-automation-id="<?php echo $AUTOMATIONID; ?>">&#xf1f8;</button>
</div>
2019-09-19 17:14:01 +00:00
<?php
2019-08-23 11:39:42 +00:00
$i++;
} ?>
</div>
</div>
2019-10-11 12:12:05 +00:00
<div class="label"><?php $LANGMNG->echo('l_atDays');?></div>
2019-08-23 11:39:42 +00:00
<div class="field">
2019-10-11 12:12:05 +00:00
<input type="checkbox" name="day[]" value="mon" <?php ECHO (in_array("mon", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_monday'); ?>
2019-08-23 11:39:42 +00:00
</div>
<div class="field">
2019-10-11 12:12:05 +00:00
<input type="checkbox" name="day[]" value="tue" <?php ECHO (in_array("tue", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_tuesday'); ?>
2019-08-23 11:39:42 +00:00
</div>
<div class="field">
2019-10-11 12:12:05 +00:00
<input type="checkbox" name="day[]" value="wed" <?php ECHO (in_array("wed", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_wednesday'); ?>
2019-08-23 11:39:42 +00:00
</div>
<div class="field">
2019-10-11 12:12:05 +00:00
<input type="checkbox" name="day[]" value="thu" <?php ECHO (in_array("thu", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_thursday'); ?>
2019-08-23 11:39:42 +00:00
</div>
<div class="field">
2019-10-11 12:12:05 +00:00
<input type="checkbox" name="day[]" value="fri" <?php ECHO (in_array("fri", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_friday'); ?>
2019-08-23 11:39:42 +00:00
</div>
<div class="field">
2019-10-11 12:12:05 +00:00
<input type="checkbox" name="day[]" value="sat" <?php ECHO (in_array("sat", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_saturday'); ?>
2019-08-23 11:39:42 +00:00
</div>
<div class="field">
2019-10-11 12:12:05 +00:00
<input type="checkbox" name="day[]" value="sun" <?php ECHO (in_array("sun", $AUTOMATION['onDays']) ? 'checked' : ''); ?>/> <?php $LANGMNG->echo('d_sunday'); ?>
2019-08-23 11:39:42 +00:00
</div>
</div>
2019-10-11 12:12:05 +00:00
<input type="submit" class="button" name="modalFinal" value="<?php $LANGMNG->echo('b_edit'); ?>"/>
<input type="submit" class="button is-danger" onClick="ajaxPostSimple('ajax',{automation_id: '<?php echo $AUTOMATIONID ?>', action:'delete'}, true);" name="remove" value="<?php $LANGMNG->echo('b_remove');?>"/>
2019-08-23 11:39:42 +00:00
</form>
2019-08-24 11:07:07 +00:00
2019-08-23 11:39:42 +00:00
</div>
2019-09-19 17:14:01 +00:00
</div>