<?php if (isset($component)) { $__componentOriginal4619374cef299e94fd7263111d0abc69 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal4619374cef299e94fd7263111d0abc69 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.app-layout','data' => []] + (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(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('title', null, []); ?> Activity Logs <?php $__env->endSlot(); ?>
     <?php $__env->slot('header', null, []); ?> 
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            <?php echo e(__('System Activity Logs')); ?>

        </h2>
     <?php $__env->endSlot(); ?>

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6 bg-white border-b border-gray-200">
                    
                    <!-- Filters -->
                    <form method="GET" action="<?php echo e(route('activity-logs.index')); ?>" class="mb-6 bg-gray-50 p-4 rounded-lg flex flex-col sm:flex-row gap-4 items-end">
                        <div class="w-full sm:w-1/4">
                            <label class="block text-sm font-medium text-gray-700">Action / Event</label>
                            <select name="event" class="mt-1 block w-full py-2 px-3 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
                                <option value="">All Events</option>
                                <option value="created" <?php echo e(request('event') == 'created' ? 'selected' : ''); ?>>Created</option>
                                <option value="updated" <?php echo e(request('event') == 'updated' ? 'selected' : ''); ?>>Updated</option>
                                <option value="deleted" <?php echo e(request('event') == 'deleted' ? 'selected' : ''); ?>>Deleted</option>
                            </select>
                        </div>
                        <div class="w-full sm:w-1/4">
                            <label class="block text-sm font-medium text-gray-700">User (Causer)</label>
                            <select name="causer_id" class="mt-1 block w-full py-2 px-3 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm">
                                <option value="">All Users</option>
                                <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($user->id); ?>" <?php echo e(request('causer_id') == $user->id ? 'selected' : ''); ?>><?php echo e($user->name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>
                        <div>
                            <button type="submit" class="px-4 py-2 bg-primary-600 text-white rounded hover:bg-primary-700 text-sm font-medium">Filter</button>
                            <a href="<?php echo e(route('activity-logs.index')); ?>" class="px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300 text-sm font-medium ml-2">Clear</a>
                        </div>
                    </form>

                    <div class="overflow-x-auto border border-gray-200 sm:rounded-lg">
                        <table class="min-w-full divide-y divide-gray-200">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date & Time</th>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">User</th>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Subject</th>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Details</th>
                                </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">
                                <?php $__empty_1 = true; $__currentLoopData = $logs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $log): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                            <?php echo e($log->created_at->format('d M Y, h:i A')); ?>

                                        </td>
                                        <td class="px-6 py-4 whitespace-nowrap">
                                            <div class="text-sm font-medium text-gray-900">
                                                <?php echo e($log->causer ? $log->causer->name : 'System'); ?>

                                            </div>
                                        </td>
                                        <td class="px-6 py-4 whitespace-nowrap">
                                            <?php
                                                $eventClass = 'bg-gray-100 text-gray-800';
                                                if($log->event === 'created') $eventClass = 'bg-green-100 text-green-800';
                                                if($log->event === 'updated') $eventClass = 'bg-blue-100 text-blue-800';
                                                if($log->event === 'deleted') $eventClass = 'bg-red-100 text-red-800';
                                            ?>
                                            <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full <?php echo e($eventClass); ?>">
                                                <?php echo e(ucfirst($log->event)); ?>

                                            </span>
                                        </td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
                                            <?php echo e(class_basename($log->subject_type)); ?> #<?php echo e($log->subject_id); ?>

                                        </td>
                                        <td class="px-6 py-4 text-sm text-gray-500">
                                            <?php if($log->properties && $log->properties->count() > 0): ?>
                                                <?php if(isset($log->properties['old']) && isset($log->properties['attributes'])): ?>
                                                    <div class="space-y-2">
                                                        <?php $__currentLoopData = $log->properties['attributes']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $newValue): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <?php if(isset($log->properties['old'][$key]) && $log->properties['old'][$key] != $newValue): ?>
                                                                <div class="text-xs">
                                                                    <span class="font-semibold text-gray-700"><?php echo e($key); ?>:</span>
                                                                    <span class="line-through text-red-500 mr-1"><?php echo e(is_array($log->properties['old'][$key]) ? json_encode($log->properties['old'][$key]) : $log->properties['old'][$key]); ?></span>
                                                                    <span class="text-green-600 font-medium"><?php echo e(is_array($newValue) ? json_encode($newValue) : $newValue); ?></span>
                                                                </div>
                                                            <?php endif; ?>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    </div>
                                                <?php elseif(isset($log->properties['attributes'])): ?>
                                                    <div class="text-xs">
                                                        <span class="font-semibold text-green-600">New Record:</span>
                                                        <span class="text-gray-500 truncate block max-w-xs" title="<?php echo e(json_encode($log->properties['attributes'])); ?>">
                                                            <?php echo e(Str::limit(json_encode($log->properties['attributes']), 100)); ?>

                                                        </span>
                                                    </div>
                                                <?php else: ?>
                                                    <div class="text-xs truncate max-w-xs" title="<?php echo e(json_encode($log->properties)); ?>">
                                                        <?php echo e(Str::limit(json_encode($log->properties), 50)); ?>

                                                    </div>
                                                <?php endif; ?>
                                            <?php else: ?>
                                                -
                                            <?php endif; ?>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="5" class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">No activity logs found.</td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                    
                    <div class="mt-4">
                        <?php echo e($logs->links()); ?>

                    </div>
                </div>
            </div>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal4619374cef299e94fd7263111d0abc69)): ?>
<?php $attributes = $__attributesOriginal4619374cef299e94fd7263111d0abc69; ?>
<?php unset($__attributesOriginal4619374cef299e94fd7263111d0abc69); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal4619374cef299e94fd7263111d0abc69)): ?>
<?php $component = $__componentOriginal4619374cef299e94fd7263111d0abc69; ?>
<?php unset($__componentOriginal4619374cef299e94fd7263111d0abc69); ?>
<?php endif; ?>
<?php /**PATH C:\wamp64\www\my-project\resources\views/activity-logs/index.blade.php ENDPATH**/ ?>