set_include_path(".:/usr/lib/php:/usr/local/lib/php:/var/www/html/assets");
date_default_timezone_set('Europe/Moscow');
require 'test/bd.php';
$time = time();

$sql = 'SELECT * FROM massage WHERE status = \'0\' OR status = \'2\'';
$data = mysqli_query($bd, $sql);
while($row = mysqli_fetch_assoc($data))
	$data_arr[] = $row;

?>
<link rel="stylesheet" type="text/css" href="/assets/components/style_vay.css">

<div class="container_vay table-responsive">
	<table>
		<thead>
			<th>ID</th>
			<th>Время начала</th>
			<th>Получатели</th>
			<th>Сообщение</th>
			<th>Статус</th>
			<th>Процесс</th>
                        <th>Изменения</th>
			<th></th>
		</thead>
		<tbody>
			<?foreach($data_arr as $row):?>
			<tr>
				<td><?=$row['id']?></td>
				<td><?=date('d/m H:i', $row['dec_time'])?></td>
				<td class="phones"><?=$row['user_phone']?></td>
				<td class="msg"><?=$row['massage']?></td>
				<td class="msg"><?=(int)$row['status'] === 2 ? 'выполняется' : (!$row['status'] ? 'в ожидании' : 'завершена')?></td>
				<td class="msg"><?=$row['progress']?></td>
				<td>
					<a href="/generacziya-soobshhenij?mode=edit&id=<?=$row['id']?>">Редактировать</a> / 
					<a class="delete" href="/generacziya-soobshhenij?mode=delete&id=<?=$row['id']?>">Удалить</a>
				</td>
			</tr>
			<?endforeach?>
		</tbody>
	</table>
</div>
<?php