<?php
$this->css($this->assetModule('script/admin.css'));
?>
<div id="pi-js-list">
    <div class="clearfix form-inline">
        <form class="form-inline navbar-left" method="get" style="margin: 0; padding-left: 0"
              action="<?php echo $this->url('', ['action' => 'list']); ?>">
            <div class="form-group">
                <input type="text" value="" placeholder="<?php echo _a('Name'); ?>"
                       class="form-control" name="name">
            </div>
            <button type="submit" class="btn"><?php echo _a('Search'); ?></button>
        </form>
    </div>
    <table class="table table-striped">
        <tbody>
        <tr>
            <th style="width:10%;"><?php echo _a('Photo'); ?></th>
            <th style="width:15%;"><?php echo _a('Name'); ?></th>
            <th><?php echo _a('Biography'); ?></th>
        </tr>
        <?php foreach ($authors as $author) { ?>
            <tr>
                <td>
                    <?php if ($author->photo) { ?>
                        <img src="<?php echo Pi::url($author->photo); ?>"
                             alt="<?php echo $this->escape($author->name); ?>"
                             style="height: 40px;">
                    <?php } else { ?>
                        <div class="default-author-img">
                            <span class="fas fa-user"><i></i></span>
                        </div>
                    <?php } ?>
                </td>
                <td>
                    <?php echo $this->escape($author->name); ?>
                    <div class="row-actions">
                        <a href="<?php echo $this->url('', [
                            'action' => 'edit',
                            'id'     => $author->id,
                        ]); ?>"><?php echo _a('Edit'); ?></a> |
                        <a href="<?php echo $this->url('', [
                            'action' => 'delete',
                            'id'     => $author->id,
                        ]); ?>"
                           onclick="return window.confirm('Are you sure want to delete it?');"><?php echo _a('Delete'); ?></a>
                    </div>
                </td>
                <td><?php echo $this->escape($author->description); ?></td>
            </tr>
        <?php } ?>
        </tbody>
    </table>
    <div class="float-right">
        <?php echo $this->paginationControl($paginator, 'Sliding', 'paginator.phtml'); ?>
    </div>
</div>
