<?php $this->layout('main', ['title' => __('Custom Fields'), 'manual' => true]); ?>

<div class="card">
    <div class="card-header bg-primary-dark">
        <h2 class="card-title"><?=__('Custom Fields') ?></h2>
    </div>
    <div class="card-actions">
        <a class="btn btn-outline-primary" role="button" href="<?=$router->named('admin:custom_fields:add') ?>">
            <i class="material-icons" aria-hidden="true">add</i>
            <?=__('Add Custom Field') ?>
        </a>
    </div>
    <table class="table table-responsive-md table-striped mb-0">
        <colgroup>
            <col width="30%">
            <col width="40%">
            <col width="30%">
        </colgroup>
        <thead>
        <tr>
            <th><?=__('Actions') ?></th>
            <th><?=__('Name') ?></th>
            <th><?=__('Programmatic Name') ?></th>
        </tr>
        </thead>
        <tbody>
        <?php foreach($records as $row): ?>
            <tr class="align-middle">
                <td>
                    <div class="btn-group btn-group-sm">
                        <a class="btn btn-sm btn-primary" href="<?=$router->named('admin:custom_fields:edit', ['id' => $row['id']]) ?>"><?=__('Edit') ?></a>
                        <a class="btn btn-sm btn-danger" data-confirm-title="<?=$this->e(__('Delete custom field "%s"?', $row['name'])) ?>" href="<?=$router->named('admin:custom_fields:delete', ['id' => $row['id'], 'csrf' => $csrf]) ?>"><?=__('Delete') ?></a>
                    </div>
                </td>
                <td>
                    <?=$this->e($row['name']) ?>
                </td>
                <td>
                    <?=$this->e($row['short_name']) ?>
                </td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
</div>
