<div class="d-flex justify-content-between align-items-center mb-4">
    <h4 class="mb-0"><i class="fas fa-exchange-alt me-2"></i><?= lang('board.transfers') ?></h4>
    <?php if (auth_can('transfers.manage')): ?>
    <a href="/transfers/create" class="btn btn-primary"><i class="fas fa-plus me-1"></i><?= lang('common.create') ?></a>
    <?php endif; ?>
</div>
<div class="card mb-3">
    <div class="card-body">
        <form class="row g-2" data-filter-table="transfersTable">
            <div class="col-md-3">
                <select name="status" class="form-select" onchange="DataTableHelper.reload('transfersTable')">
                    <option value="">All Statuses</option>
                    <?php foreach (['requested','documents_pending','under_review','board_pending','approved','rejected','completed','cancelled'] as $s): ?>
                    <option value="<?= $s ?>"><?= ucfirst(str_replace('_', ' ', $s)) ?></option>
                    <?php endforeach; ?>
                </select>
            </div>
        </form>
    </div>
</div>
<div class="card">
    <div class="card-body">
        <table id="transfersTable" class="table table-striped table-hover w-100"
               data-url="/transfers/datatable"
               data-columns='[{"data":"id","title":"#","width":"50px"},{"data":"number","title":"Transfer #"},{"data":"from","title":"From"},{"data":"to","title":"To"},{"data":"type","title":"Type"},{"data":"reason","title":"Reason"},{"data":"status","title":"Status"},{"data":"date","title":"Date"},{"data":"actions","title":"Actions","orderable":false,"searchable":false}]'>
            <thead><tr><th>#</th><th>Transfer #</th><th>From</th><th>To</th><th>Type</th><th>Reason</th><th>Status</th><th>Date</th><th>Actions</th></tr></thead>
        </table>
    </div>
</div>
<?php $__view->push('scripts') ?>
<script>document.addEventListener('DOMContentLoaded', function(){ DataTableHelper.init('transfersTable'); });</script>
<?php $__view->endPush() ?>