<?php 
    $evenement = event::getFiche(core::getGet("id"));
    if($evenement["type_inscription"] == 1){
?>
<div style="float:right; margin-top: -60px;">
    <a href="/evenement-inscription-upload-<?php echo core::getGet("id") ?>.html"><button type="submit" class="btn btn-outline-success btn-sm"><span data-feather="file-plus"></span> Importer un fichier Excel</button></a>
</div>
<?php } ?>
<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?jsonData=event-inscrits&id=<?php echo core::getGet("id") ?>">
    <thead>
        <tr>
            <th data-sortable="true" data-field="loginId" data-filter-control="input">Login</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="sexe" data-filter-control="select">Sexe</th>
            <th data-sortable="true" data-field="lieu" data-filter-control="select">Localité</th>
            <th data-sortable="true" data-field="contrat" data-filter-control="select">Statut Contrat</th>
            <th data-sortable="true" data-field="actif" data-filter-control="select">Actif</th>
            <th data-sortable="true" data-field="present" data-filter-control="select">Emargement</th>
            <th data-field="id" data-formatter="selectFormatterInscrit"></th>
        </tr>
    </thead>
</table> 

<script>
        function selectFormatterInscrit(value, row) {
<?php if(ENVIRONNEMENT == "PROD") { ?>            
            if(row.present === "-"){
                return '<form method="post" action="/submit.php">\n\
                <input type="hidden" name="from" value="event-deinscription">\n\
                <input type="hidden" name="texte" value="' + row.prenom + ' ' + row.nom + '">\n\
                <input type="hidden" name="event" value="' + <?php echo core::getGet("id") ?> + '">\n\
                <input type="hidden" name="salarie" value="' + row.id + '">\n\
                <button type="submit" onclick="return confirm(\'Etes-vous certain de vouloir supprimer cet enregistrement ?\')" class="btn btn-outline-danger btn-sm">Désinscrire</button>\n\
                </form>'; 
            } else {
                return '<button class="btn btn-outline-secondary btn-sm" disabled="">Inscrit</button>';
            }
<?php } else { ?>
            return '<form method="post" action="/submit.php">\n\
                <input type="hidden" name="from" value="event-deinscription">\n\
                <input type="hidden" name="texte" value="' + row.prenom + ' ' + row.nom + '">\n\
                <input type="hidden" name="event" value="' + <?php echo core::getGet("id") ?> + '">\n\
                <input type="hidden" name="salarie" value="' + row.id + '">\n\
                <button type="submit" onclick="return confirm(\'Etes-vous certain de vouloir supprimer cet enregistrement ?\')" class="btn btn-outline-danger btn-sm">Désinscrire</button>\n\
                </form>'; 
<?php } ?>
        }
</script>