<div class="clearfix">
    <h3><?php _e('File list'); ?></h3>
    <?php if (isset($list) && !empty($list)) { ?>
        <table class="table table-striped table-bordered table-sm">
            <tr>
                <th><?php _e('ID'); ?></th>
                <th><?php _e('Version'); ?></th>
                <th><?php _e('Filename'); ?></th>
                <th><?php _e('Created at'); ?></th>
                <th><?php _e('Active at'); ?></th>
                <th><?php _e('Action'); ?></th>
            </tr>
            <?php foreach ($list as $file) { ?>
                <tr>
                    <td>
                        <span class="badge badge-info"><?php echo $file['id']; ?></span>
                    </td>
                    <td><?php echo $this->escape($file['version']); ?></td>
                    <td><?php echo $this->escape($file['filename']); ?></td>
                    <td><?php echo $this->escape($file['created_at']); ?></td>
                    <td><?php echo $this->escape($file['active_at']); ?></td>
                    <td>
                        <a class="btn btn-primary btn-sm" title="<?php _e('Edit'); ?>"
                           href="<?php echo $this->url('', ['action' => 'update', 'id' => $file['id']]); ?>">
                            <i class="fas fa-edit"></i> <?php _e('Edit'); ?>
                        </a>

                        <a class="btn btn-danger btn-sm" title="<?php _e('Remove'); ?>"
                           href="<?php echo $this->url('', ['action' => 'remove', 'id' => $file['id']]); ?>">
                            <i class="fas fa-edit"></i> <?php _e('Remove'); ?>
                        </a>
                    </td>
                </tr>
            <?php } ?>
        </table>
    <?php } ?>
</div>
<div class="alert alert-info">
    <?php $downloadUrl = Pi::url($this->url('user', ['controller' => 'condition', 'action' => 'download'])) ?>
    <?php _e('Shortcut : latest version of term and condition is available from'); ?>
    <a ref="<?php echo $downloadUrl ?>" target="_blank">
        <?php echo $downloadUrl ?>
    </a>
</div>