<div class="table-responsive">
	<?php if(isset($_GET["view"])){ ?>
	<table id="all-vacations-page" class="table table-hover all-tasks tasks-inwork" style="margin:0;">
		<thead> 
			<tr> 
				<th width="5%">Статус</th> 
				<th width="30%">Заявление</th>
				<th width="12%">Начало</th> 
				<th width="12%">Окончание</th>
				<th width="8%"><i class="fa fa-fw fa-calendar" title="Кол-во дней"></i></th>
				<th style="text-align:left!important;">Комментарий</th>
				<th width="5%"></th>
			</tr> 
		</thead> 
		<tbody>
			<?php
			$dom = new DOMDocument;
			$dom->load($baseV);
			$xpath = new DOMXPath($dom);
			$vacations = $xpath->query('/vacations/vacation[@user="'.get_user_login($_GET["view"]).'"]');
			foreach($vacations as $vacation) {
				$vId 			= $vacation->getAttribute('id');
				$vUser 			= $vacation->getAttribute('user');
				$vAgreed 		= $vacation->getAttribute('agreed');
				$vType 			= $vacation->getAttribute('type');
				$vStatus 		= $vacation->getAttribute('status');
				$vDateS 		= $vacation->getElementsByTagName("dateS")->item(0)->nodeValue;
				$vDateE 		= $vacation->getElementsByTagName("dateE")->item(0)->nodeValue;
				$vComment 		= $vacation->getElementsByTagName("com")->item(0)->nodeValue;
				
				$date				= date("Y-m-d");
				$datetimeFrom 		= $date ;
				$datetimeTo 		= $vDateE;
			?>
			<tr class="<?php if ($vType == 'vac-3') {echo 'vhigh';} elseif ($vType == 'vac-2') {echo 'high';} elseif ($vType == 'vac-4') {echo 'medium';} elseif ($vType == 'vac-5') {echo 'low';} elseif ($vType == 'vac-1') {echo 'vlow';} else {echo 'none';} ?>"> 
				<td>
				<?php if($vStatus == '+'){
					echo '<button class="btn btn-sm btn-link" style="cursor:default;" type="button"><i class="fa fa-fw fa-check clr_low" title="Заявление подтверждено"></i></button>';
					} else {
						if ($GroupCheck == 'admin' or $GroupCheck == 'manager') {
						echo '
						<form method="POST">
							<button class="btn btn-sm btn-link" type="submit" name="vacationConfirm" onclick="return confirm(\'Подтвердить заявление #'.$vId.'?\')"><i class="fa fa-fw fa-clock-o clr_none" title="Подтвердить заявление"></i></button>
							<input type="text" class="hidden" name="vacationConfirmId" value="'.$vId.'">
						</form>
						';
					} else { echo '<button class="btn btn-sm btn-link btn-disabled"><i class="fa fa-fw fa-clock-o clr_none"></i></button>'; } } ?>
				</td>
				<td style="text-align:left!important;">
					<a href="/<?php echo $folder; ?>/vacations/?id=<?php echo $vId; ?>">Заявление №<?php echo $vId;?></a>
					<small class="d-block">
					<i class="fa fa-fw fa-user" aria-hidden="true" title="Заявитель" ></i> <?php echo get_user_name_login($vUser, '');?><br/>
					<i class="fa fa-fw fa-user-o" aria-hidden="true" title="Согласовант"></i> <?php echo get_user_name_login($vAgreed, '');?><br/>
					</small>
				</td>  
				<td>
					<div class="rem_days_body">
						<div class="txt"><?php echo $vDateS; ?></div>
					</div>
				</td>
				<td>
					<div class="rem_days_body <?php if ($vDateE != '' and $datetimeTo < $datetimeFrom){echo 'expired';} ?>">
						<div class="txt"><?php if ($vDateE != '') { echo '<span class="vDateE">'.$vDateE.'</span>'; } else {echo '- нет -';} ?></div>
						<?php if ($vDateE != '') {?><?php if (timediff2($vDateS, date("Y-m-d")) > 0) {?><div class="bar" style="width:<?php echo timediffpercent($vDateS, $vDateE); ?>%;"></div><?php } ?><?php } ?>
					</div>
				</td>
				<td style="text-align:center!important;"><?php if ($vDateE != ''){echo timediff2($vDateS, $vDateE) . ' дн.';}?></td>
				<td style="text-align:left!important;"><?php echo $vComment;?></td>
				<td>
					<? if ($GroupCheck == 'admin' or $GroupCheck == 'manager' or $vUser == $LoginCheck) {?>
						<form method="POST"><button class="btn btn-sm btn-link" type="submit" name="vacationDelete" onclick="return confirm('Удалить заявление #<? echo $vId; ?>?')"><i class="fa fa-fw fa-times" aria-hidden="true"></i></button><input type="text" class="hidden" name="vacationDelId" value="<? echo $vId; ?>"></form>
					<? } else {
						echo '<button class="btn btn-sm btn-link btn-disabled"><i class="fa fa-fw fa-times" aria-hidden="true"></i></button>';
					}?>
				</td>
			</tr>
			<?php } ?>
		</tbody>
	</table>
	<?php } else { ?>
	<table id="all-vacations" class="table table-hover all-vacations" style="margin:0;">
		<thead> 
			<tr> 
				<th width="5%">Статус</th> 
				<th width="30%">Заявление</th>
				<th width="12%">Начало</th> 
				<th width="12%">Окончание</th>
				<th width="8%"><i class="fa fa-fw fa-calendar" title="Кол-во дней"></i></th>
				<th style="text-align:left!important;">Комментарий</th>
				<th width="5%"></th>
			</tr> 
		</thead> 
		<tbody>
			<?php
			foreach($vacations as $vacation) {
				$vId 			= $vacation->getAttribute('id');
				$vUser 			= $vacation->getAttribute('user');
				$vAgreed 		= $vacation->getAttribute('agreed');
				$vType 			= $vacation->getAttribute('type');
				$vStatus 		= $vacation->getAttribute('status');
				$vDateS 		= $vacation->getElementsByTagName("dateS")->item(0)->nodeValue;
				$vDateE 		= $vacation->getElementsByTagName("dateE")->item(0)->nodeValue;
				$vComment 		= $vacation->getElementsByTagName("com")->item(0)->nodeValue;
				
				$date				= date("Y-m-d");
				$datetimeFrom 		= $date ;
				$datetimeTo 		= $vDateE;
			?>
			<tr class="<?php if ($vType == 'vac-3') {echo 'vhigh';} elseif ($vType == 'vac-2') {echo 'high';} elseif ($vType == 'vac-4') {echo 'medium';} elseif ($vType == 'vac-5') {echo 'low';} elseif ($vType == 'vac-1') {echo 'vlow';} else {echo 'none';} ?>"> 
				<td>
				<?php if($vStatus == '+'){
					echo '<button class="btn btn-sm btn-link" style="cursor:default;" type="button"><i class="fa fa-fw fa-check clr_low" title="Заявление подтверждено"></i></button>';
					} else {
						if ($GroupCheck == 'admin' or $GroupCheck == 'manager') {
						echo '
						<form method="POST">
							<button class="btn btn-sm btn-link" type="submit" name="vacationConfirm" onclick="return confirm(\'Подтвердить заявление #'.$vId.'?\')"><i class="fa fa-fw fa-clock-o clr_none" title="Подтвердить заявление"></i></button>
							<input type="text" class="hidden" name="vacationConfirmId" value="'.$vId.'">
						</form>
						';
					} else { echo '<button class="btn btn-sm btn-link btn-disabled"><i class="fa fa-fw fa-clock-o clr_none"></i></button>'; } } ?>
				</td>
				<td style="text-align:left!important;">
					<a href="/<?php echo $folder; ?>/vacations/?id=<?php echo $vId; ?>">Заявление №<?php echo $vId;?></a>
					<small class="d-block">
					<i class="fa fa-fw fa-user" aria-hidden="true" title="Заявитель" ></i> <?php echo get_user_name_login($vUser, '');?><br/>
					<i class="fa fa-fw fa-user-o" aria-hidden="true" title="Согласовант"></i> <?php echo get_user_name_login($vAgreed, '');?><br/>
					</small>
				</td>  
				<td>
					<div class="rem_days_body">
						<div class="txt"><?php echo $vDateS; ?></div>
					</div>
				</td>
				<td>
					<div class="rem_days_body <?php if ($vDateE != '' and $datetimeTo < $datetimeFrom){echo 'expired';} ?>" style="cursor:help;">
						<div class="txt"><?php if ($vDateE != '') { echo '<span class="vDateE">'.$vDateE.'</span>'; } else {echo '- нет -';} ?></div>
						<?php if ($vDateE != '') {?><?php if (timediff2($vDateS, date("Y-m-d")) > 0) {?><div class="bar" style="width:<?php echo timediffpercent($vDateS, $vDateE); ?>%;"></div><?php } ?><?php } ?>
					</div>
				</td>
				<td style="text-align:center!important;"><?php if ($vDateE != ''){echo timediff2($vDateS, $vDateE) . ' дн.';}?></td>
				<td style="text-align:left!important;"><?php echo $vComment;?></td>
				<td>
					<? if ($GroupCheck == 'admin' or $GroupCheck == 'manager' or $vUser == $LoginCheck) {?>
						<form method="POST"><button class="btn btn-sm btn-link" type="submit" name="vacationDelete" onclick="return confirm('Удалить заявление #<? echo $vId; ?>?')"><i class="fa fa-fw fa-times" aria-hidden="true"></i></button><input type="text" class="hidden" name="vacationDelId" value="<? echo $vId; ?>"></form>
					<? } else {
						echo '<button class="btn btn-sm btn-link btn-disabled"><i class="fa fa-fw fa-times" aria-hidden="true"></i></button>';
					}?>
				</td>
			</tr>
			<?php } ?>
		</tbody>
	</table>
	<?php } ?>
</div>
<?php require_once(ROOT . 'templates/table-pager.php'); ?>