

<?php $__env->startSection('content'); ?>
<div class="max-w-7xl mx-auto px-6 py-8">
    <div class="mb-8">
        <h1 class="text-3xl font-extrabold text-gray-900">Activity Logs</h1>
        <p class="mt-2 text-gray-500">Track user activities and system changes.</p>
    </div>

    <div class="bg-white rounded shadow p-4">
        <div class="overflow-x-auto">
            <table class="min-w-full border whitespace-nowrap">
                <thead>
                    <tr class="bg-gray-100 border-b">
                        <th class="px-6 py-4 text-left font-medium text-gray-700">Time</th>
                        <th class="px-6 py-4 text-left font-medium text-gray-700">User</th>
                        <th class="px-6 py-4 text-left font-medium text-gray-700">Description</th>
                        <th class="px-6 py-4 text-left font-medium text-gray-700">Subject</th>
                        <th class="px-6 py-4 text-left font-medium text-gray-700">Changes</th>
                    </tr>
                </thead>
                <tbody class="divide-y divide-gray-200">
                    <?php $__empty_1 = true; $__currentLoopData = $activities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $activity): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr class="hover:bg-gray-50 transition">
                        <td class="px-6 py-4 text-gray-600">
                            <?php echo e($activity->created_at->format('Y-m-d H:i:s')); ?>

                        </td>
                        <td class="px-6 py-4">
                            <?php if($activity->causer): ?>
                                <span class="font-medium text-gray-900"><?php echo e($activity->causer->name); ?></span>
                            <?php else: ?>
                                <span class="text-gray-400 italic">System</span>
                            <?php endif; ?>
                        </td>
                        <td class="px-6 py-4 text-gray-800">
                            <?php echo e(ucfirst($activity->description)); ?>

                        </td>
                        <td class="px-6 py-4 text-gray-600">
                            <?php if($activity->subject_type): ?>
                                <?php echo e(class_basename($activity->subject_type)); ?> #<?php echo e($activity->subject_id); ?>

                            <?php else: ?>
                                -
                            <?php endif; ?>
                        </td>
                        <td class="px-6 py-4 text-sm text-gray-500 max-w-xs truncate">
                            <?php if($activity->properties && $activity->properties->has('attributes')): ?>
                                <div class="grid grid-cols-2 gap-2 text-xs">
                                    <div class="font-bold text-gray-700">Old</div>
                                    <div class="font-bold text-gray-700">New</div>
                                    
                                    <?php $__currentLoopData = $activity->properties['attributes']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $newValue): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php
                                            $oldValue = $activity->properties['old'][$key] ?? '-';
                                        ?>
                                        <div class="text-red-500 bg-red-50 p-1 rounded">
                                            <span class="font-mono"><?php echo e($key); ?>:</span> <?php echo e(is_array($oldValue) ? json_encode($oldValue) : $oldValue); ?>

                                        </div>
                                        <div class="text-green-600 bg-green-50 p-1 rounded">
                                            <span class="font-mono"><?php echo e($key); ?>:</span> <?php echo e(is_array($newValue) ? json_encode($newValue) : $newValue); ?>

                                        </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                            <?php elseif($activity->event == 'login' || $activity->event == 'logout'): ?>
                                -
                            <?php else: ?>
                                <span class="text-gray-400">Values not logged</span>
                            <?php endif; ?>
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="5" class="px-6 py-8 text-center text-gray-500">
                            No activities recorded yet.
                        </td>
                    </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
        <div class="mt-4">
            <?php echo e($activities->links()); ?>

        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH F:\xampp\htdocs\courier_booking\resources\views/activity_logs/index.blade.php ENDPATH**/ ?>