<?= $this->extend('layouts/mobile') ?>

<?= $this->section('header') ?>
<?= view('layouts/_inner_header', [
    'title'    => config('Tieasy')->priorities[$priority] ?? 'Tasks',
    'backHref' => isset($dash, $filters) ? $dash->href('dashboard', $filters) : site_url('dashboard'),
]) ?>
<?= view('dashboard/_filter_bar', ['showBell' => false]) ?>
<?= $this->endSection() ?>

<?= $this->section('content') ?>
<?php if (! empty($filterError)): ?>
    <div class="flash flash-error" role="alert"><?= esc($filterError) ?></div>
<?php endif; ?>
<div class="priority-list" data-task-lists data-status-filter="<?= esc($filters['status'] ?? 'pending') ?>" data-priority="<?= (int) $priority ?>" data-empty-message="<?= esc($emptyMessage ?? 'No pending tasks match these filters.') ?>">
    <?php $rows = $rows ?? []; ?>
    <?php if ($rows === []): ?>
        <p class="quadrant-empty"><?= esc($emptyMessage ?? 'No pending tasks match these filters.') ?></p>
    <?php else: ?>
        <?php foreach ($rows as $row): ?>
            <?= view('dashboard/_task_row', ['row' => $row]) ?>
        <?php endforeach; ?>
    <?php endif; ?>
</div>
<a class="quadrant-add priority-add" href="<?= site_url('tasks/create?priority=' . (int) $priority) ?>">+ Add Task</a>
<?= view('dashboard/_task_sheets') ?>
<?= $this->endSection() ?>
