<?php
    use App\Support\Audit\AuditPresenter;
?>

<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($this->workAuditTimeline->isEmpty()): ?>
    <p class="py-6 text-center text-sm text-[var(--setel-text-muted)]">Aún no hay eventos registrados para esta OT.</p>
<?php else: ?>
    <ol class="flex flex-col gap-4 border-s border-[var(--setel-card-border)] ps-4">
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $this->workAuditTimeline; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $audit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
            <li class="relative">
                <span class="absolute -start-[1.15rem] top-1.5 size-2 rounded-full bg-[var(--setel-primary)] ring-4 ring-[var(--setel-content-bg)]" aria-hidden="true"></span>
                <div class="flex flex-wrap items-baseline gap-x-2 gap-y-1">
                    <span class="text-sm font-semibold text-[var(--setel-text)]"><?php echo e(AuditPresenter::eventLabel($audit->event)); ?></span>
                    <span class="text-xs text-[var(--setel-text-muted)]"><?php echo e(AuditPresenter::subjectLabel($audit)); ?></span>
                    <span class="text-xs tabular-nums text-[var(--setel-text-muted)]"><?php echo e($audit->created_at?->format('d/m/Y H:i:s')); ?></span>
                </div>
                <p class="mt-1 text-xs text-[var(--setel-text-muted)]">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($audit->user): ?>
                        <span class="font-medium text-[var(--setel-text)]"><?php echo e($audit->user->fullName()); ?></span>
                        <span class="text-[var(--setel-text-muted)]">(<?php echo e($audit->user->email); ?>)</span>
                    <?php else: ?>
                        <span>Sistema o usuario no identificado</span>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </p>

                <?php $rows = AuditPresenter::changedRows($audit); ?>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($rows !== []): ?>
                    <ul class="mt-3 space-y-2 rounded-lg bg-[var(--setel-content-bg)] p-3 text-sm">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $rows; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                            <li class="border-b border-[var(--setel-card-border)] pb-2 last:border-0 last:pb-0">
                                <span class="font-medium text-[var(--setel-text)]"><?php echo e($row['label']); ?></span>
                                <div class="mt-1 grid gap-1 text-xs sm:grid-cols-2">
                                    <div>
                                        <span class="text-[var(--setel-text-muted)]">Antes:</span>
                                        <span class="ms-1 break-words text-[var(--setel-text)]"><?php echo e($row['old']); ?></span>
                                    </div>
                                    <div>
                                        <span class="text-[var(--setel-text-muted)]">Después:</span>
                                        <span class="ms-1 break-words text-[var(--setel-text)]"><?php echo e($row['new']); ?></span>
                                    </div>
                                </div>
                            </li>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                    </ul>
                <?php elseif($audit->event === 'created'): ?>
                    <p class="mt-2 text-xs text-[var(--setel-text-muted)]">Registro inicial (sin campos adicionales en el detalle).</p>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </li>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
    </ol>
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
<?php /**PATH C:\laragon\www\setelsat-gilat-manager\resources\views\livewire\works\partials\work-audit-panel.blade.php ENDPATH**/ ?>