2019-08-23 11:39:42 +00:00
|
|
|
<div class="modal-container modal-container-hiden" id="modal-setting-<?php echo $DEVICEID ?>">
|
|
|
|
<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_editDevice'); ?></h4>
|
2019-08-23 11:39:42 +00:00
|
|
|
<form method="post" action="">
|
|
|
|
<input class="input" type="hidden" name="deviceId" value="<?php echo $DEVICEID; ?>">
|
|
|
|
<?php if ($DEVICE['approved'] != 0) { ?>
|
|
|
|
<?php if ($DEVICE['userIsAdmin']) { ?>
|
|
|
|
<div class="field">
|
2019-10-11 12:12:05 +00:00
|
|
|
<div class="label"><?php $LANGMNG->echo('l_owner'); ?></div>
|
2019-08-23 11:39:42 +00:00
|
|
|
<select class="input" name="deviceOwnerUserId">
|
2019-10-11 12:12:05 +00:00
|
|
|
<option value=""><?php $LANGMNG->echo('w_noOne'); ?></option>
|
2019-08-23 11:39:42 +00:00
|
|
|
<?php foreach ($USERS as $user) {
|
|
|
|
$userId = $user['user_id'];
|
|
|
|
$userName = $user['username'];
|
|
|
|
?>
|
|
|
|
<option value="<?php echo $userId; ?>" <?php ECHO ((int) $userId === (int) $DEVICE['owner'] ? 'selected="selected"' : ''); ?>><?php echo $userName; ?></option>
|
|
|
|
<?php } ?>
|
|
|
|
</select>
|
|
|
|
</div>
|
2019-10-11 12:12:05 +00:00
|
|
|
<div class="label"><?php $LANGMNG->echo('l_permission'); ?></div>
|
2019-08-23 11:39:42 +00:00
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="col-6">
|
2019-10-11 12:12:05 +00:00
|
|
|
<div class="label"> - <?php $LANGMNG->echo('l_owner'); ?></div>
|
2019-08-23 11:39:42 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-6">
|
|
|
|
<?php
|
|
|
|
$permissions = $DEVICE['permission'];
|
|
|
|
//Debug
|
|
|
|
if (DEBUGMOD == 1) {
|
|
|
|
echo '<pre>';
|
|
|
|
VAR_DUMP($permissions);
|
|
|
|
echo '</pre>';
|
|
|
|
}
|
|
|
|
?>
|
2019-10-11 12:12:05 +00:00
|
|
|
<input type="radio" name="permissionOwner" value=1 <?php ECHO ($permissions[0] == 1 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_read'); ?>
|
|
|
|
<input type="radio" name="permissionOwner" value=2 <?php ECHO ($permissions[0] == 2 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_use'); ?>
|
|
|
|
<input type="radio" name="permissionOwner" value=3 <?php ECHO ($permissions[0] == 3 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_edit'); ?>
|
2019-08-23 11:39:42 +00:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-6">
|
2019-10-11 12:12:05 +00:00
|
|
|
<div class="label"> - <?php $LANGMNG->echo('l_member'); ?></div>
|
2019-08-23 11:39:42 +00:00
|
|
|
</div>
|
|
|
|
<div class="col-6">
|
2019-10-11 12:12:05 +00:00
|
|
|
<input type="radio" name="permissionOther" value=1 <?php ECHO ($permissions[1] == 1 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_read'); ?>
|
|
|
|
<input type="radio" name="permissionOther" value=2 <?php ECHO ($permissions[1] == 2 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_use'); ?>
|
|
|
|
<input type="radio" name="permissionOther" value=3 <?php ECHO ($permissions[1] == 3 ? 'checked' : ''); ?>/><?php $LANGMNG->echo('l_edit'); ?>
|
2019-08-23 11:39:42 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
2019-10-11 12:12:05 +00:00
|
|
|
<div class="label"><?php $LANGMNG->echo('w_title'); ?></div>
|
2019-08-23 11:39:42 +00:00
|
|
|
<input class="input" type="text" name="deviceName" value="<?php echo $DEVICE['name']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
|
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
<div class="field">
|
|
|
|
<div class="label">Token:</div>
|
|
|
|
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['token']; ?>" disabled>
|
|
|
|
</div>
|
|
|
|
<?php if ($DEVICE['userIsAdmin']) { ?>
|
2019-10-09 08:54:22 +00:00
|
|
|
<?php if (!in_array($SUBDEVICE['type'], ['on/off', 'door', 'water'])) { ?>
|
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_sleepTime'); ?></div>
|
2019-08-23 11:39:42 +00:00
|
|
|
<input class="input" type="int" name="sleepTime" value="<?php echo $DEVICE['sleepTime']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
|
2019-10-11 12:12:05 +00:00
|
|
|
<p>* - <?php $LANGMNG->echo('l_inMinutes'); ?></p>
|
2019-08-23 11:39:42 +00:00
|
|
|
</div>
|
|
|
|
<?php }?>
|
|
|
|
<div class="field">
|
2019-10-11 12:12:05 +00:00
|
|
|
<div class="label"><?php $LANGMNG->echo('w_room'); ?></div>
|
2019-08-23 11:39:42 +00:00
|
|
|
<select class="input" name="deviceOwnerId">
|
|
|
|
<?php foreach ($ROOMS as $room) {
|
|
|
|
$roomId = $room['room_id'];
|
|
|
|
$roomName = $room['name'];
|
|
|
|
?>
|
2019-09-09 19:30:03 +00:00
|
|
|
<option value="<?php echo $roomId; ?>" <?php ECHO ((int) $roomId === (int) $DEVICE['room'] ? 'selected="selected"' : ''); ?>><?php echo $roomName; ?></option>
|
2019-08-23 11:39:42 +00:00
|
|
|
<?php } ?>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
2019-10-11 12:12:05 +00:00
|
|
|
<div class="label"><?php $LANGMNG->echo('w_icon'); ?></div>
|
2019-08-23 11:39:42 +00:00
|
|
|
<select class="input fa" name="deviceIcon" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
|
2019-10-11 12:12:05 +00:00
|
|
|
<option value=""><?php $LANGMNG->echo('w_no'); ?><?php echo ' '; ?><?php $LANGMNG->echo('w_icon'); ?></option>
|
2019-08-23 11:39:42 +00:00
|
|
|
<option value="f0eb" <?php ECHO ($DEVICE['icon'] == "f0eb" ? 'selected="selected"' : ''); ?>> - fa-lightbulb-o</option>
|
|
|
|
<option value="f2dc" <?php ECHO ($DEVICE['icon'] == "f2dc" ? 'selected="selected"' : ''); ?>> - fa-snowflake-o</option>
|
|
|
|
<option value="f0e7" <?php ECHO ($DEVICE['icon'] == "f0e7" ? 'selected="selected"' : ''); ?>> - fa-bolt</option>
|
|
|
|
<option value="f2c7" <?php ECHO ($DEVICE['icon'] == "f2c7" ? 'selected="selected"' : ''); ?>> - fa-thermometer-full</option>
|
|
|
|
<option value="f236" <?php ECHO ($DEVICE['icon'] == "f236" ? 'selected="selected"' : ''); ?>> - fa-bed</option>
|
|
|
|
<option value="f185" <?php ECHO ($DEVICE['icon'] == "f185" ? 'selected="selected"' : ''); ?>> - fa-sun-o</option>
|
|
|
|
<option value="f2db" <?php ECHO ($DEVICE['icon'] == "f2db" ? 'selected="selected"' : ''); ?>> - fa-microchip</option>
|
|
|
|
<option value="f011" <?php ECHO ($DEVICE['icon'] == "f011" ? 'selected="selected"' : ''); ?>> - fa-power-off</option>
|
|
|
|
<option value="f011" <?php ECHO ($DEVICE['icon'] == "f011" ? 'selected="selected"' : ''); ?>> - fa-desktop</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
<div class="field">
|
2019-10-11 12:12:05 +00:00
|
|
|
<div class="label"><?php $LANGMNG->echo('w_moduls'); ?></div>
|
2019-08-23 11:39:42 +00:00
|
|
|
<div class="row no-gutters">
|
|
|
|
<?php foreach ($DEVICE['subDevices'] as $subDeviceKey => $subDevice) { ?>
|
|
|
|
<div class="col-4 col-sm-3 col-xl-2 square-wrap">
|
|
|
|
<div class="square">
|
|
|
|
<div class="square-content">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col">
|
|
|
|
<h3 class="fa">&#x<?php echo $DEVICE['icon']; ?></h3>
|
|
|
|
</div>
|
|
|
|
<div class="col">
|
|
|
|
<h3><?php echo $subDevice['unit']; ?></h3>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col">
|
|
|
|
<?php echo $DEVICE['name']; ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-10-11 12:12:05 +00:00
|
|
|
<input type="submit" class="button" name="saveDevice" value="<?php $LANGMNG->echo('b_save'); ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>/>
|
|
|
|
<input type="submit" class="button is-danger" name="disableDevice" value="<?php $LANGMNG->echo('b_disable'); ?>"/>
|
2019-08-23 11:39:42 +00:00
|
|
|
<?php } else { ?>
|
|
|
|
<div class="field">
|
2019-10-11 12:12:05 +00:00
|
|
|
<div class="label"><?php $LANGMNG->echo('w_moduls'); ?></div>
|
2019-08-23 11:39:42 +00:00
|
|
|
<div class="row no-gutters">
|
|
|
|
<?php foreach ($DEVICE['subDevices'] as $subDeviceKey => $subDevice) { ?>
|
|
|
|
<div class="col-4 col-sm-3 col-xl-2 square-wrap">
|
|
|
|
<div class="square">
|
|
|
|
<div class="square-content">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col">
|
|
|
|
<h3 class="fa">&#x<?php echo $DEVICE['icon']; ?></h3>
|
|
|
|
</div>
|
|
|
|
<div class="col">
|
|
|
|
<h3><?php echo $subDevice['unit']; ?></h3>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col">
|
|
|
|
<?php echo $DEVICE['name']; ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-10-11 12:12:05 +00:00
|
|
|
<input type="submit" class="button is-primary" name="approveDevice" value="<?php $LANGMNG->echo('b_approve'); ?>"/>
|
|
|
|
<input type="submit" class="button is-danger" name="disableDevice" value="<?php $LANGMNG->echo('b_disable'); ?>"/>
|
2019-08-23 11:39:42 +00:00
|
|
|
<?php } ?>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|