<?php 
	if(isset($_GET['view']) AND $_GET['view'] != ''){
		$pageTitle 	= 'Сотрудник: ' . get_user_name($_GET['view'], '');
	} elseif(isset($_GET['edit']) AND $_GET['edit'] != ''){
		$pageTitle 	= 'Редактирование данных сотрудника: ' . get_user_name($_GET['edit'], '');
	} elseif(isset($_GET['new'])){
		$pageTitle 	= "Добавление сотрудника";
	} else {
		$pageTitle 	= 'Сотрудники компании';
	}
	
	if(!isset($_GET['view']) AND !isset($_GET['edit'])){$filters = '1';}
	
	require_once(ROOT . 'templates/header.php'); 
	
	require_once(ROOT . 'modules/users/list-users.php'); 
	
	require_once(ROOT . 'templates/main-menu.php');
?>
<div class="container<?php global $designView; echo $designView; ?>">
	<div class="row">
		<?php 
		if(isset($_GET['view']) and $_GET['view'] != ''){ 
			require_once(ROOT . 'modules/users/page-users-view.php');
		} elseif(isset($_GET['edit']) and $_GET['edit'] != '') {
			if (isset($Login) AND $LoginCheck == $Login OR $GroupCheck == 'admin' OR $GroupCheck == 'manager' AND isset($Group) AND $Group != 'admin') {
				require_once(ROOT . 'modules/users/page-users-edit.php');
			} else {
				echo '<meta http-equiv="refresh" content="0;/'.$folder.'/users">';
			}
		} elseif(isset($_GET['new'])) {
			if ($GroupCheck == 'admin' or $GroupCheck == 'manager') {
				require_once(ROOT . 'modules/users/page-users-edit.php');
			} else {
				echo '<meta http-equiv="refresh" content="0;/'.$folder.'/users">';
			}
		} else {
		?>
		<div class="col-lg-3 col-lg-push-9 col-md-4 col-md-push-8 col-sm-12">
			<?php require_once(ROOT . 'templates/side-block.php'); ?>
		</div>
		<div class="col-lg-9 col-lg-pull-3 col-md-8 col-md-pull-4 col-sm-12">
			
			<h1><?php echo $pageTitle; ?><span class="list-num"><i class="fa fa-fw fa-angle-double-down" aria-hidden="true"></i> <?php echo $countUser; ?></span></h1>
			
			<?php require_once(ROOT . 'templates/search-form.php'); ?>
			
			<div class="table-responsive">
				<table id="all-users" class="table table-hover all-users users-inwork">
					<thead> 
						<tr> 
							<th width="6%"></th>
							<th width="41%">Имя пользователя</th> 
							<th width="6%"></th>
							<th width="6%" title="Производительность"><i class="fa fa-line-chart" aria-hidden="true"></i></th> 
							<th width="15%" data-sorter="shortDate" data-date-format="yyyymmdd">Посещение</th>
							<th width="6%"></th>
							<th width="6%"></th>
						</tr> 
					</thead> 
					<tbody>
						<?php require_once(ROOT . 'modules/users/list-users-m.php'); ?>
					</tbody>
				</table>
			</div>
			<?php require_once(ROOT . 'templates/table-pager.php'); ?>
		</div>
		<?php } ?>
	</div>
</div>
<?
	require_once(ROOT . 'templates/modal-wind.php');
	require_once(ROOT . 'templates/footer.php');
?>
	</body>
</html>