<?
foreach ($requests as $request) {
	$id 		= $request->getAttribute('id');
	$name 		= $request->getElementsByTagName("uname")->item(0)->nodeValue;
	$sname 		= $request->getElementsByTagName("usname")->item(0)->nodeValue;
	$company 	= $request->getElementsByTagName("company")->item(0)->nodeValue;
	$phone 		= $request->getElementsByTagName("phone")->item(0)->nodeValue;
	$email 		= $request->getElementsByTagName("email")->item(0)->nodeValue;
	$service 	= $request->getElementsByTagName("service")->item(0)->nodeValue;
	$source 	= $request->getElementsByTagName("source")->item(0)->nodeValue;
	$web 		= $request->getElementsByTagName("web")->item(0)->nodeValue;
	$addr 		= $request->getElementsByTagName("addr")->item(0)->nodeValue;
	$date 		= $request->getElementsByTagName("date")->item(0)->nodeValue;
?>
<tr id="<? echo $reqId; ?>" type="<? echo $reqType; ?>" priority="<? echo $reqPriority; ?>">
	<td>
		<a href="/<? echo $folder; ?>/requests/?view=<? echo $id; ?>">
			<? if($company != '') {?>
			<div class="user-photo empty satur50" style="background:<? echo get_color2($company); ?>"><? echo mb_substr($company, 0, 1,'utf-8'); ?></div>
			<? } else { ?>
			<div class="user-photo empty satur50" style="background:<? echo get_color2($name); ?>"><? echo mb_substr($name, 0, 1,'utf-8'); ?></div>
			<? } ?>
		</a>
	</td>
	<td>
		<? if($company != '') {?>
		<a href="/<? echo $folder; ?>/requests/?view=<? echo $id; ?>"><? echo $company; ?></a>
		<? } else { ?>
		<a href="/<? echo $folder; ?>/requests/?view=<? echo $id; ?>"><? echo $name . ' ' . $sname; ?></a>
		<? } ?>
		<small class="d-block">
			<i class="fa fa-fw fa-phone" aria-hidden="true"></i> <? if ($phone != '') {echo '<span class="phone">' . $phone . '</span>';} else {echo 'телефон не указан';} ?>
			<div class="clear"></div>
			<i class="fa fa-fw fa-envelope-o" aria-hidden="true"></i> <? if ($email != '') { echo '<span class="email">' . $email . '</span>'; } else { echo 'E-mail не указан'; } ?>
		</small>
	</td>
	<td style="text-align:left!important;">
		<? if ($service != '') {echo '<span class="service">' . $service . '</span>';} else {echo '- нет -';} ?>
	</td>
	<td>
		<div class="rem_days_body" >
			<div class="txt"><? if($date != ''){echo '<span style="cursor:help;">' . date("Y-m-d",strtotime($date)) . ' ' . date("H:i",strtotime($date)) . '</span>';} else {echo '<span>- нет данных -</span>';} ?></div>
		</div>
	</td>
	<td>
		<a href="/<? echo $folder.'/clients/?new&name='.$name.' '.$sname.'&company='.$company.'&source='.$source.'&phone='.$phone.'&mail='.$email.'&web='.$web.'&addr='.$addr.'&date='.$date; ?>" class="btn btn-sm btn-link" title="Сохранить"><i class="fa fa-fw fa-save" aria-hidden="true"></i></a>
	</td>
	<td>
		<form method="POST">
			<button class="btn btn-sm btn-link" type="submit" name="requestDelete" onclick="return confirm('Удалить запрос от клиента <? echo $name; ?>?')" title="Удалить"><i class="fa fa-fw fa-times" aria-hidden="true"></i></button>
			<input type="text" class="hidden" name="requestDelId" value="<? echo $id; ?>" />
		</form>
	</td>
</tr>
<? } ?>