<!DOCTYPE html>
<html lang="en">
<head>
	<?php
	$partial = new Partial('head');
	$partial->prepare('baseDir', $BASEDIR);
	$partial->render();
	?>
	<title><?php echo $TITLE; ?></title>
</head>
<body class="no-transitions">
	<div class="row no-gutters main">
		<div class="col-md-3 d-sm-none"></div>
		<div class="col-md-3 nav-container">
			<?php
			$partial = new Partial('menu');
			$partial->prepare('item', 'dashboard');
			$partial->prepare('langMng',$LANGMNG);
			$partial->prepare('debugMod',$DEBUGMOD);
			$partial->render();
			?>
		</div>
		<div class="col-md-9 main-body">
			<a onClick="$('#modal').removeClass('modal-container-hiden').show();" class="button is-primary m-1"><?php $LANGMNG->echo('t_addDevice'); ?></a>
			<div class="row no-gutters">
				<?php foreach ($DASHBOARD as $dashboardItemId => $dashboardItemData) {
					$partialDeviceButton = new Partial('dashboardButton');
					$partialDeviceButton->prepare('dashboardItemData', $dashboardItemData);

					$partialDeviceButton->render();
				} ?>
			</div>
		</div>
	</div>

	<div class="modal-container modal-container-hiden" id="modal">
		<div class="modal">
			<div class="close">
				<i class="fa fa-times"></i>
			</div>
			<h4 class="mb-4"><?php $LANGMNG->echo('t_addDevice'); ?></h4>
			<form method="post">
				<div class="field px-2">
					<div class="label"><?php $LANGMNG->echo('l_choseDevice'); ?>:</div>
					<select class="input" name="devices[]" multiple required>
						<?php foreach ($SUBDEVICES as $subDeviceKey => $subDeviceValue){ ?>
							<option value="<?php echo $subDeviceKey; ?>"><?php echo $subDeviceValue['name'] . '[' . $subDeviceValue['type']  . ']'; ?></option>
						<?php } ?>
					</select>
				</div>
				<input type="submit" class="button" name="modalFinal" value="<?php $LANGMNG->echo('b_create'); ?>"/>
			</form>
		</div>
	</div>

	<?php
	if (isset($_POST['deviceId'])) {
		$partial = new Partial('deviceEdit');
		$partial->prepare('DEVICEDATA', $DEVICEDATA);

		$partial->render();
	}
	$partial = new Partial('footer');
	$partial->render();
	?>
</body>
</html>
