<? 
	if(isset($_GET['view']) AND $_GET['view'] != ''){
		$pageTitle 	= 'Клиент: ' . get_client_name($_GET['view']);
	} elseif(isset($_GET['edit']) AND $_GET['edit'] != ''){
		$pageTitle 	= 'Редактирование данных клиента: ' . get_client_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/clients/list-clients.php'); 
	
	require_once(ROOT . 'templates/main-menu.php');
?>
<div class="container<? echo $designView; ?>">
	<div class="row">
		<? 
		if(isset($_GET['view']) and $_GET['view'] != ''){ 
			require_once(ROOT . 'modules/clients/page-clients-view.php');
		} elseif(isset($_GET['edit']) and $_GET['edit'] != '' or isset($_GET['new'])) {
			if($GroupCheck == 'admin' or $GroupCheck == 'manager'){
				require_once(ROOT . 'modules/clients/page-clients-edit.php');
			} else { echo '<meta http-equiv="refresh" content="0;/'.$folder.'/clients">';}
		} else {
		?>
		<div class="col-lg-3 col-lg-push-9 col-md-4 col-md-push-8 col-sm-12">
			<? 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><? echo $pageTitle; ?><span class="list-num"><i class="fa fa-fw fa-angle-double-down" aria-hidden="true"></i> <? echo $countClient; ?></span></h1>
			
			<? require_once(ROOT . 'templates/search-form.php'); ?>
			
			<div class="table-responsive">
				<table id="all-clients" class="table table-hover tablesorter all-clients clients-inwork">
					<thead> 
						<tr> 
							<th width="6%"></th>
							<th>Имя клиента</th> 
							<th width="15%" style="text-align:right!important;">Сумма сделок</th>
							<th width="15%" style="text-align:right!important;">Сумма долга</th>
							<th width="15%" data-sorter="shortDate" data-date-format="yyyymmdd">Регистрация</th>
							<th width="6%"></th>
							<th width="6%"></th>
						</tr> 
					</thead> 
					<tbody>
						<? require_once(ROOT . 'modules/clients/list-clients-m.php'); ?>
					</tbody>
				</table>
			</div>
			<? require_once(ROOT . 'templates/table-pager.php'); ?>
		</div>
		<? } ?>
	</div>
</div>
<?
	require_once(ROOT . 'templates/modal-wind.php');
	require_once(ROOT . 'templates/footer.php');
?>
	</body>
</html>