<section class="content-header">
    <h1><?= __('Requirements') ?></h1>

    <div class="actions">
        <a data-ajax class="btn btn-success btn-sm" href="<?= admin_url_to('/achievements/requirements/add?achievement_id=' . $achievement['id']) ?>"><?= __('Add') ?></a>
    </div>
</section>

<section class="content">
    <div class="nav-tabs-custom">
        <ul class="nav nav-tabs">
            <li><a data-ajax href="<?= admin_url_to('/achievements/edit/' . $achievement['id']) ?>"><?= __('Achievement') ?></a></li>
            <li class="active"><a href="#"><?= __('Requirements') ?></a></li>
            <li><a data-ajax href="<?= admin_url_to('/achievements/rewards?achievement_id=' . $achievement['id']) ?>"><?= __('Rewards') ?></a></li>
        </ul>
        <div class="tab-content" style="<?= empty($requirements) ? '' : 'padding:0' ?>">
            <?php if (empty($requirements)): ?>
                <div class="callout callout-warning" style="margin-bottom:0">
                    <h4>Ops!</h4>
                    <p><?= __('No requirements found') ?></p>
                </div>
            <?php else: ?>
                <table class="table table-condensed table-hover table-striped">
                    <thead>
                        <tr>
                            <th><?= __('Title') ?></th>
                            <th width="80"></th>
                        </tr>
                    </thead>

                    <tbody>
                        <?php foreach ($requirements as $requirement): ?>
                            <tr>
                                <td><?= $requirement['title'] ?></td>
                                <td class="record-actions">
                                    <a data-ajax class="btn btn-xs btn-default" href="<?= admin_url_to('/achievements/requirements/edit/' . $requirement['id']) ?>"><?= __('Edit') ?></a>
                                    <a data-ajax-delete class="btn btn-danger btn-xs" href="<?= admin_url_to('/achievements/requirements/delete/' . $requirement['id']) ?>"><?= __('Delete') ?></a>
                                </td>
                            </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            <?php endif ?>
        </div>
    </div>
</section>