<div class="task">
<div class="flex bg-light">
<div class="p-3 pt-0 pb-0">
<div class="row">
<div class="col-sm-7 tasks">
<div class="task-list">
<h1>Задачи</h1>
<?php if ($countTasks < 1): ?>
<p>Задач не обнаружено. Вы можете их добавить</p>
<?php else: ?>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Имя</th>
<th scope="col">Email</th>
<th scope="col">Текст задачи</th>
<th scope="col">Статус</th>
</tr>
</thead>
<tbody>
<?php foreach ($tasks as $task): ?>
<tr>
<td><?php echo escapeFunction($task['id']); ?></td>
<td><?php echo escapeFunction($task['nameUser']); ?></td>
<td><?php echo escapeFunction($task['emailUser']); ?></td>
<td><?php echo escapeFunction($task['text']); ?></td>
<td><?php echo escapeFunction($task['status']); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<style>
.pagination li {
list-style-type: none;
float: left;
margin-right: 3px;
}
</style>
<div class="pagination" style="margin-left:20%;"><?php echo $pagination->get(); ?></div>
</div>
</div>
<div class="row">
<div class="col-sm-7 pt-4">
<h2>Добавить задачу</h2>
<?php if (!empty($session->get('success'))): ?>
<p class="text-success"><?php echo $session->get('success'); ?></p>
<?php $session->delete('success'); ?>
<?php endif; ?>
<form action="/" method="post" autocomplete="off">
<div class="form-group">
<label>Имя</label>
<input type="text"
class="form-control <?php echo isset($errors['name']) && !empty($errors['name']) ? 'border-danger' : '' ?>"
name="name" placeholder="Введите имя"
value="<?php echo isset($_POST['name']) ? escapeFunction($_POST['name']) : null; ?>">
<?php if (isset($errors['name']) && !empty($errors['name'])): ?>
<small class="text-danger"><?php echo escapeFunction($errors['name'][0]); ?></small>
<?php endif; ?>
</div>
<div class="form-group">
<label>Email</label>
<input type="text"
class="form-control <?php echo isset($errors['email']) && !empty($errors['email']) ? 'border-danger' : '' ?>"
name="email" placeholder="Введите email"
value="<?php echo isset($_POST['email']) ? escapeFunction($_POST['email']) : null; ?>">
<?php if (isset($errors['email']) && !empty($errors['email'])): ?>
<small class="text-danger"><?php echo escapeFunction($errors['email'][0]); ?></small>
<?php endif; ?>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Текст задачи</label>
<input type="text"
class="form-control <?php echo isset($errors['text']) && !empty($errors['text']) ? 'border-danger' : '' ?>"
name="text" placeholder="Введите текст задачи"
value="<?php echo isset($_POST['text']) ? escapeFunction($_POST['text']) : null; ?>">
<?php if (isset($errors['text']) && !empty($errors['text'])): ?>
<small class="text-danger"><?php echo escapeFunction($errors['text'][0]); ?></small>
<?php endif; ?>
</div>
<button type="submit" class="btn btn-dark">Добавить</button>
</form>
</div>
</div>
</div>
</div>
</div>