<?php 
	if(isset($_GET['view']) AND $_GET['view'] != ''){
		$pageTitle 	= "Заметка";
	} elseif(isset($_GET['edit']) AND $_GET['edit'] != ''){
		$pageTitle 	= "Редактирование заметки";
	} elseif(isset($_GET['new-note']) AND isset($_GET['new-note'])){
		$pageTitle 	= "Добавление заметки";
	} else {
		$pageTitle 	= 'Главная страница';
	}
	
	if(!isset($_GET['view']) AND !isset($_GET['edit'])){$moreinfo = '1';}
	
	require_once(ROOT . 'templates/header.php'); 
	require_once(ROOT . 'templates/main-menu.php');
	if($nCRMsn != '' and $nCRMdateTo > $nCRMdateFrom){
?>
<div class="container<?php global $designView; echo $designView; ?>">
	<div class="row">
		<?php 
		if(isset($_GET['view']) and $_GET['view'] != ''){ 
			require_once(ROOT . 'modules/notes/page-notes-view.php');
		} elseif(isset($_GET['edit']) and $_GET['edit'] != '' or isset($_GET['new-note'])) {
			require_once(ROOT . 'modules/notes/page-notes-edit.php');
		} 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">
		
			<?php if (file_exists($baseT) and file_exists($fileT)) { ?>
			<?php $countUserTaskInWork = count($xmltask->xpath('/tasks/task[@status="inwork" and @deligated="'.$LoginCheck.'" or @status="inwork" and supervisor="'.$LoginCheck.'"]')); ?>
			<h1>Ваши текущие задачи<span class="list-num"><i class="fa fa-fw fa-angle-double-down" aria-hidden="true"></i> <?php echo $countUserTaskInWork; ?></span></h1>
			<div class="table-responsive"> 
				<table id="index-tasks" class="table table-hover all-tasks tasks-inwork">
					<thead> 
						<tr> 
							<th width="6%"></th> 
							<th width="55%">Наименование</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="15%" data-sorter="shortDate" data-date-format="yyyymmdd">Завершение</th>
							<th width="6%"></th>
							<th width="6%"></th>
						</tr> 
					</thead> 
					<tbody>
						<?
						$dom = new DOMDocument;
						$dom->load($baseT);
						$xpath = new DOMXPath($dom);
						$tasks = $xpath->query('/tasks/task[@status="inwork" and @deligated="'.$LoginCheck.'" or @status="inwork" and supervisor="'.$LoginCheck.'"]');
						require_once(ROOT . 'modules/tasks/list-tasks-m.php'); ?>
					</tbody>
				</table>
			</div>
			<div class="content-separator"></div>
			<?php } ?>
			
			<?php if (file_exists($fileN)) { ?>
			
			<h1>Ваши заметки<span class="list-num"><i class="fa fa-fw fa-angle-double-down" aria-hidden="true"></i> <?php echo $countNotes; ?></span></h1>
						
			<?php require_once(ROOT . 'templates/search-form.php'); ?>
			
			<div class="table-responsive">
				<table id="all-notes" class="table table-hover all-notes notes-inwork">
					<thead> 
						<tr> 
							<th width="6%"></th>
							<th width="67%">Название заметки</th>
							<th width="15%">Изменение</th>
							<th width="6%"></th>
							<th width="6%"></th>
						</tr> 
					</thead> 
					<tbody>
						<?php require_once(ROOT . 'modules/notes/list-notes-m.php'); ?>
					</tbody>
				</table>
			</div>
			<?php include(ROOT . 'templates/table-pager.php'); ?>
			<?php } ?>
		</div>
		<?php } ?>
	</div>
</div>
<?
	}
	require_once(ROOT . 'templates/modal-wind.php');
	require_once(ROOT . 'templates/footer.php');
?>
	</body>
</html>