<h4 class="mb-4"><i class="fas fa-trash-restore me-2"></i><?= lang('admin.recycle_bin') ?></h4>
<div class="card"><div class="card-body">
    <table id="recycle-table" class="table table-sm table-striped w-100" data-url="/admin/recycle-bin/datatable"
           data-columns='[{"data":"type"},{"data":"entity_id"},{"data":"deleted_by"},{"data":"deleted_at"},{"data":"deadline"},{"data":"actions","orderable":false}]'>
        <thead><tr><th>Entity Type</th><th>Entity ID</th><th>Deleted By</th><th>Deleted At</th><th>Restore Deadline</th><th>Actions</th></tr></thead>
    </table>
</div></div>
<?php $__view->push('scripts') ?>
<script>
DataTableHelper.init('recycle-table');
$(document).on('click','.btn-restore',function(){if(!confirm('Restore this item?'))return;$.post('/admin/recycle-bin/'+$(this).data('id')+'/restore',{_token:'<?= csrf_token() ?>'},function(r){if(r.success){FormHelper.showToast('success',r.message);DataTableHelper.reload('recycle-table');}else FormHelper.showToast('error',r.message);},'json');});
$(document).on('click','.btn-purge',function(){if(!confirm('PERMANENTLY delete? This cannot be undone!'))return;$.post('/admin/recycle-bin/'+$(this).data('id')+'/purge',{_token:'<?= csrf_token() ?>'},function(r){if(r.success){FormHelper.showToast('success',r.message);DataTableHelper.reload('recycle-table');}else FormHelper.showToast('error',r.message);},'json');});
</script>
<?php $__view->endPush() ?>