160 lines
10 KiB
PHTML
160 lines
10 KiB
PHTML
|
<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>
|
||
|
<h4 class="mb-4"><?php echo $LANG['t_editDevice']; ?></h4>
|
||
|
<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">
|
||
|
<div class="label"><?php echo $LANG['l_owner']; ?></div>
|
||
|
<select class="input" name="deviceOwnerUserId">
|
||
|
<option value=""><?php echo $LANG['w_noOne']; ?></option>
|
||
|
<?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>
|
||
|
<div class="label"> <?php echo $LANG['l_permission']; ?></div>
|
||
|
<div class="row">
|
||
|
|
||
|
<div class="col-6">
|
||
|
<div class="label"> - <?php echo $LANG['l_owner']; ?></div>
|
||
|
</div>
|
||
|
|
||
|
<div class="col-6">
|
||
|
<?php
|
||
|
$permissions = $DEVICE['permission'];
|
||
|
//Debug
|
||
|
if (DEBUGMOD == 1) {
|
||
|
echo '<pre>';
|
||
|
VAR_DUMP($permissions);
|
||
|
echo '</pre>';
|
||
|
}
|
||
|
?>
|
||
|
<input type="radio" name="permissionOwner" value=1 <?php ECHO ($permissions[0] == 1 ? 'checked' : ''); ?>/> <?php echo $LANG['l_read']; ?>
|
||
|
<input type="radio" name="permissionOwner" value=2 <?php ECHO ($permissions[0] == 2 ? 'checked' : ''); ?>/> <?php echo $LANG['l_use']; ?>
|
||
|
<input type="radio" name="permissionOwner" value=3 <?php ECHO ($permissions[0] == 3 ? 'checked' : ''); ?>/> <?php echo $LANG['l_edit']; ?>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="col-6">
|
||
|
<div class="label"> - <?php echo $LANG['l_member']; ?></div>
|
||
|
</div>
|
||
|
<div class="col-6">
|
||
|
<input type="radio" name="permissionOther" value=1 <?php ECHO ($permissions[1] == 1 ? 'checked' : ''); ?>/> <?php echo $LANG['l_read']; ?>
|
||
|
<input type="radio" name="permissionOther" value=2 <?php ECHO ($permissions[1] == 2 ? 'checked' : ''); ?>/> <?php echo $LANG['l_use']; ?>
|
||
|
<input type="radio" name="permissionOther" value=3 <?php ECHO ($permissions[1] == 3 ? 'checked' : ''); ?>/> <?php echo $LANG['l_edit']; ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="field">
|
||
|
<div class="label"><?php echo $LANG['w_title']; ?></div>
|
||
|
<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']) { ?>
|
||
|
<?php if (!in_array($SUBDEVICE['type'], ['on/off', 'door'])) { ?>
|
||
|
<div class="field">
|
||
|
<div class="label"><?php echo $LANG['l_sleepTime']; ?></div>
|
||
|
<input class="input" type="int" name="sleepTime" value="<?php echo $DEVICE['sleepTime']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
|
||
|
<p>* - <?php echo $LANG['l_inMinutes']; ?></p>
|
||
|
</div>
|
||
|
<?php }?>
|
||
|
<div class="field">
|
||
|
<div class="label"><?php echo $LANG['w_room']; ?></div>
|
||
|
<select class="input" name="deviceOwnerId">
|
||
|
<?php foreach ($ROOMS as $room) {
|
||
|
$roomId = $room['room_id'];
|
||
|
$roomName = $room['name'];
|
||
|
?>
|
||
|
<option value="<?php echo $roomName; ?>" <?php ECHO ((int) $roomId === (int) $DEVICE['room'] ? 'selected="selected"' : ''); ?>><?php echo $roomName; ?></option>
|
||
|
<?php } ?>
|
||
|
</select>
|
||
|
</div>
|
||
|
<div class="field">
|
||
|
<div class="label"><?php echo $LANG['w_icon']; ?></div>
|
||
|
<select class="input fa" name="deviceIcon" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>>
|
||
|
<option value=""><?php echo $LANG['w_no'] . ' ' . $LANG['w_icon']; ?></option>
|
||
|
<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">
|
||
|
<div class="label"><?php echo $LANG['w_moduls']; ?></div>
|
||
|
<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>
|
||
|
<input type="submit" class="button" name="saveDevice" value="<?php echo $LANG['b_save']; ?>" <?php echo (!$DEVICE['userIsAdmin'] ? 'disabled' : ''); ?>/>
|
||
|
<input type="submit" class="button is-danger" name="disableDevice" value="<?php echo $LANG['b_disable']; ?>"/>
|
||
|
<?php } else { ?>
|
||
|
<div class="field">
|
||
|
<div class="label"><?php echo $LANG['w_moduls']; ?></div>
|
||
|
<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>
|
||
|
<input type="submit" class="button is-primary" name="approveDevice" value="<?php echo $LANG['b_approve']; ?>"/>
|
||
|
<input type="submit" class="button is-danger" name="disableDevice" value="<?php echo $LANG['b_disable']; ?>"/>
|
||
|
<?php } ?>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|