<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<div class="container-fluid">
    <div class="card">
        <div class="card-header d-flex justify-content-between align-items-center">
            <h5 class="mb-0">Activity Logs</h5>
            <div>
                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('activity_log.delete')): ?>
                    <button id="bulk-delete" class="btn btn-danger btn-sm" disabled>Delete Selected</button>
                <?php endif; ?>
            </div>
        </div>
        <div class="card-body">
            <table id="activity-logs-table" class="table table-striped table-bordered" style="width:100%">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>User</th>
                        <th>Resource</th>
                        <th>Action</th>
                        <th>Created At</th>
                        <th>Actions</th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
</div>

<?php $__env->startPush('scripts'); ?>
<script>
$(function() {
    var table = $('#activity-logs-table').DataTable({
        processing: true,
        serverSide: true,
        ajax: {
            url: '<?php echo e(route("admin.activity-logs.data")); ?>',
            type: 'GET'
        },
        columns: [
            { data: 'id', name: 'id' },
            { data: 'user', name: 'user' },
            { data: 'resource', name: 'resource' },
            { data: 'action', name: 'action' },
            { data: 'created_at', name: 'created_at' },
            { data: 'operations', name: 'operations', orderable: false, searchable: false },
        ]
    });

    // Delete handler
    $('#activity-logs-table').on('click', '.js-delete-activity-log', function(e) {
        e.preventDefault();
        var id = $(this).data('id');
        if (!confirm('Delete this activity log?')) return;
        $.ajax({
            url: '<?php echo e(url("admin/activity-logs")); ?>/' + id,
            type: 'DELETE',
            headers: { 'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>' },
            success: function(res) {
                if (res.success) {
                    table.ajax.reload();
                    alert(res.message);
                } else {
                    alert('Failed to delete');
                }
            },
            error: function() { alert('Error while deleting'); }
        });
    });
});
</script>
<?php $__env->stopPush(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php /**PATH D:\herd\billing\laravel-app\resources\views/admin/activity-logs.blade.php ENDPATH**/ ?>