<?php
    json::create("users");
?>

<div>
    <table
        id="table"
        class="table-striped table-hover table-sm" 
        data-page-size="25"
        data-toggle="table"
        data-show-columns="true"
        data-search="true"
        data-buttons-align="left"
        data-pagination="true"
        data-filter-control="true"
        data-flat="true"
        data-search="true"
        data-url="/json.php?file=users">
        <thead>
            <tr>
                <th data-sortable="true" data-field="id" data-filter-control="input">#</th>
                <th data-sortable="true" data-field="nom" data-filter-control="input">Nom</th>
                <th data-sortable="true" data-field="prenom" data-filter-control="input">Prénom</th>
                <th data-sortable="true" data-field="type" data-filter-control="select">Type de compte</th>
                <th data-sortable="true" data-field="cree" data-filter-control="input">Créé</th>
                <th data-sortable="true" data-field="last_connect" data-filter-control="input">Dernière connexion</th>
                <th data-field="id" data-formatter="selectUser"></th>
            </tr>
        </thead>
    </table> 
</div>

<script>
        function selectUser(value, row) { 
            return '<a href="/user-' + row.id + '.html"><button type="submit" class="btn btn-outline-primary btn-sm">Administrer</button></a>';

        }
</script>