
<div style="margin-top:60px;">

    <a href="/submit.php?from=parametres-add-backup" style="position:absolute; right:25px; margin-top:-55px;">
        <button type="submit" class="btn btn-outline-success btn-sm">
        <span data-feather="plus-square"></span> Créer un nouveau backup</button>
    </a>

    <div>
        <table 
            id="table" 
            class="table-striped table-hover table-sm" 
            data-toggle="table" 
            data-sort-name="date" 
            data-sort-order="desc" 
            data-url="/json.php?jsonData=parametres-restore">
            <thead>
                <tr>
                    <th data-formatter="downloadFile" data-sortable="true" data-field="file" data-filter-control="input" data-align="left">Nom</th>
                    <th data-sortable="true" data-field="size" data-filter-control="input" data-width="100">Taille</th>
                    <th data-sortable="true" data-field="date" data-filter-control="input" data-width="170">Date de création</th>
                    <th data-formatter="restoreBackup" data-width="130"></th>
                </tr>
            </thead>
        </table>
    </div>

</div>

<script>
    function downloadFile(value, row) {
        return '<form method="post" action="/submit.php">\n\
        <input type="hidden" name="from" value="parametres-download-backup-zip">\n\
        <input type="hidden" name="file" value="' + row.file + '">\n\
        <button type="submit" style="border:none; background:none;" title="Télécharger le fichier : ' + row.file + '">' + row.file + '</button>\n\
        </form>';
    }

    function restoreBackup(value, row) {
        return '<form method="post" action="/submit.php">\n\
        <input type="hidden" name="from" value="parametres-restore-backup-zip">\n\
        <input type="hidden" name="file" value="' + row.file + '">\n\
        <button type="submit" onclick="return confirm(\'Etes-vous certain de vouloir restaurer cette version (données et fichiers) ?\')" class="btn btn-outline-danger btn-sm">Restaurer</button>\n\
        </form>';
    }
</script>