<div class="plate">
	<div class="plate_ttl __secondary ic_list"><h1><?=$this->PAGE['name']?></h1></div>
	<div class="bttns-wrap">
		<?if( Serval::call('Auth')->Data['type']=="admin" ){
			$_users_id = (int)$_GET['users_id']>0 ? (int)$_GET['users_id'] : (int)$_SESSION['list_users_id'];
		?>
		<div class="bttns_left">
			<div class="bttns_left_i">
				<form method="get">
					<select name="users_id" onchange="$(this).parent().submit();">
						<?if($users = Serval::call('db')->Select("mod_users","id, fio","","ORDER BY fio")){?>
							<option value="0">Все пользователи</option>
							<?foreach($users as $val){?>
								<option <?=($val['id']==$_users_id ? 'selected' : '')?> value="<?=$val['id']?>"><?=$val['fio']?></option>	
						<?}}?>
					</select>
				</form>
			</div>
		</div>
		<?}?>
		<a data-maxwidth="800" data-height="790" href="#project" class="open-dialog btn __primary ic_add" data-title="Добавить новый проект">Добавить новый проект</a>
	</div>
	<?if($this->getList){?>
		<table class="tbl-base  __stripe">
	    <?foreach ($this->getList['result'] as $val) {
			  	$val['domain'] = str_replace("www.","",$val['domain']);
				?>
	      <tr class="<?=$val['is_active']=="no" ? '__notactive' : ''?> <?=$val['status']=="error" ? ' __disabled' : ''?>">
	        <td>
	          <ul class="logs_date">
	              <li><span class="lbl">Последняя проверка:</span> <span class="date __check"><?=$this->datetime("d.m.Y в H:i",$val['last_date_check'],'-')?></span></li>
	              <li><span class="lbl">Создание:</span> <span class="date __add"><?=$this->datetime("d.m.Y",$val['date'])?></span></li>
	          </ul>
	          <?=($val['status']=="process") ? '<b>идет проверка</b>'.($val['_processStep']>0 ? ' <small>шаг: '.$val['_processStep'].'</small>' : '') : ''?>
	          <?=$val['attempt_check']>0 ? '<b>ожидает перезапуска</b> <small>попытка: '.$val['attempt_check'].'</small>' : ''?>
						
	          <?=($val['status']=="check" || $val['status']=="waiting") ? '<b>ожидает запуска</b>' : ''?>
	          
	        </td>
	        <td><a href="#edit_project" data-id="<?=$val['id']?>"><?=$val['domain']?></a></td>
	        <td>Владелец: <a href="#profile" data-id="<?=$val['users_id']?>"><?=$val['createUser']?></a></td>
	        <td class="bttns-wrap" nowrap>
						<div class="tooltip_wrap">
							<a href="<?=(isset($this->config['http_dir']) ? $this->config['http_dir'] : '/')?>projects/<?=$val['id']?>/log/" data-type="iframe" class="open-dialog btn __primary-inverse ic_log<?=$val['is_verified']=="yes" ? '_alert' : ''?>" data-title="Лог изменений для <span><?=$val['domain']?></span>">Смотреть изменения</a>
							<a href="#" class="btn __base-inverse ic_menu tooltip_btn"></a>
							<div class="tooltip_content">
								<a href="#test" data-id="<?=$val['id']?>"  data-width="300" data-height="100" class="btn __base-inverse __light ic_test">Тест</a>
								<?if($val['is_active']=="yes" && $val['status']!="process" && $val['status']!="check" && $val['status']!="waiting"){?>
									<a href="#precheck" data-project_id="<?=$val['id']?>" class="btn __base-inverse __light ic_precheck">Проверить сейчас</a>
								<?}?>
								<a href="#download" data-width="300" data-height="100" data-project_id="<?=$val['id']?>" class="btn __base-inverse ic_load">Получить сканер</a>
								<a href="<?=(isset($this->config['http_dir']) ? $this->config['http_dir'] : '/')?>projects/<?=$val['id']?>/structure/" data-type="iframe" class="open-dialog btn __primary-inverse ic_structure" data-title="Структура для <span><?=$val['domain']?></span>">Структура</a>
							</div>
						</div>
	        </td>
	        <td class="remove-td"><a href="#delete_project" data-project_id="<?=$val['id']?>" class="remove_btn"></a></td>
	      </tr>
	      <?if($val['status']=="error"){?>
				<tr class="__disabled">
	      	<td colspan="6"><?=$val['error_msg']?> <a href="#verified_error" data-project_id="<?=$val['id']?>" class="btn">Всё OK!</a></td>
	      </tr>
	      <?}?>
	    <?}?>
		</table>
	<?$this->display("block/pages",false);?>
	<?}else{?>
	<div class="pad-wrap">
		<div class="warning">-Нет данных-</div>
	</div>
	<?}?>
</div>
<div id="project" class="popup">
	<?$this->display("form/project",false);?>
</div>
<iframe style="display:none" id="_iframe" name="_iframe"></iframe>