<?php
    use App\Enums\NocTrackingStatus;
    use App\Enums\WorkAssignmentStatus;
    use App\Enums\WorkInternalStatus;
    use App\Enums\WorkPriority;
    use App\Enums\WorkStatus;
?>

<div class="flex w-full flex-col gap-6">
    <?php echo $__env->make('components.catalog.toast', ['showToast' => $showToast, 'toastType' => $toastType, 'toastMessage' => $toastMessage, 'toastSeq' => $toastSeq], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <div class="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between">
        <div class="flex flex-wrap items-center gap-3">
            <a href="<?php echo e($this->backUrl); ?>" wire:navigate class="setel-btn-secondary inline-flex w-fit items-center gap-2">
                <?php if (isset($component)) { $__componentOriginale41799ef1b2ae0b0e320ff9b21dacd08 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale41799ef1b2ae0b0e320ff9b21dacd08 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::icon.arrow-left','data' => ['class' => 'size-4 shrink-0']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::icon.arrow-left'); ?>
<?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(['class' => 'size-4 shrink-0']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale41799ef1b2ae0b0e320ff9b21dacd08)): ?>
<?php $attributes = $__attributesOriginale41799ef1b2ae0b0e320ff9b21dacd08; ?>
<?php unset($__attributesOriginale41799ef1b2ae0b0e320ff9b21dacd08); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale41799ef1b2ae0b0e320ff9b21dacd08)): ?>
<?php $component = $__componentOriginale41799ef1b2ae0b0e320ff9b21dacd08; ?>
<?php unset($__componentOriginale41799ef1b2ae0b0e320ff9b21dacd08); ?>
<?php endif; ?>
                Volver
            </a>
            <button
                type="button"
                wire:click="$set('showWorkAuditHistory', true)"
                class="setel-btn-secondary inline-flex w-fit items-center gap-2"
                aria-haspopup="dialog"
            >
                <?php if (isset($component)) { $__componentOriginalb3870b881c50e33e7f9afb190d9670ac = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalb3870b881c50e33e7f9afb190d9670ac = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::icon.clipboard-document-list','data' => ['class' => 'size-4 shrink-0']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::icon.clipboard-document-list'); ?>
<?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(['class' => 'size-4 shrink-0']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalb3870b881c50e33e7f9afb190d9670ac)): ?>
<?php $attributes = $__attributesOriginalb3870b881c50e33e7f9afb190d9670ac; ?>
<?php unset($__attributesOriginalb3870b881c50e33e7f9afb190d9670ac); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalb3870b881c50e33e7f9afb190d9670ac)): ?>
<?php $component = $__componentOriginalb3870b881c50e33e7f9afb190d9670ac; ?>
<?php unset($__componentOriginalb3870b881c50e33e7f9afb190d9670ac); ?>
<?php endif; ?>
                Historial
            </button>
            <button
                type="button"
                wire:click="openAssignmentHistoryModal"
                class="setel-btn-secondary inline-flex w-fit items-center gap-2"
                aria-haspopup="dialog"
            >
                <?php if (isset($component)) { $__componentOriginalec36de86b0c342dc76f8040ade97006d = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalec36de86b0c342dc76f8040ade97006d = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::icon.calendar-days','data' => ['class' => 'size-4 shrink-0']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::icon.calendar-days'); ?>
<?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(['class' => 'size-4 shrink-0']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalec36de86b0c342dc76f8040ade97006d)): ?>
<?php $attributes = $__attributesOriginalec36de86b0c342dc76f8040ade97006d; ?>
<?php unset($__attributesOriginalec36de86b0c342dc76f8040ade97006d); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalec36de86b0c342dc76f8040ade97006d)): ?>
<?php $component = $__componentOriginalec36de86b0c342dc76f8040ade97006d; ?>
<?php unset($__componentOriginalec36de86b0c342dc76f8040ade97006d); ?>
<?php endif; ?>
                Bitácora asignaciones
            </button>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($this->canEditCoordinator): ?>
                <button
                    type="submit"
                    form="work-coordinator-form"
                    class="setel-btn-primary inline-flex w-fit items-center gap-2"
                    wire:loading.attr="disabled"
                    wire:target="saveCoordinator"
                >
                    <span wire:loading.remove wire:target="saveCoordinator">Guardar cambios</span>
                    <span wire:loading wire:target="saveCoordinator">Guardando…</span>
                </button>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($this->canEditCoordinator): ?>
            <a href="<?php echo e(route('works.index')); ?>" wire:navigate class="text-sm font-medium text-[var(--setel-primary)] hover:underline">Ir al listado de trabajos</a>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    </div>

    <div>
        <h1 class="text-2xl font-bold tracking-tight text-[var(--setel-text)]"><?php echo e($work->ot); ?></h1>
        <p class="mt-1 text-sm text-[var(--setel-text-muted)]">
            <?php echo e($work->site?->name ?? 'Sin sitio'); ?>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($work->site?->code): ?>
                · <span class="font-mono"><?php echo e($work->site->code); ?></span>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </p>
    </div>

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($this->operationalEfficiencySnapshot): ?>
        <?php echo $__env->make('livewire.works.partials.operational-efficiency-card', [
            'snap' => $this->operationalEfficiencySnapshot,
            'work' => $work,
        ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    <?php echo $__env->make('livewire.works.partials.observed-incidents-card', [
        'summary' => $this->observedIncidentsSummary,
        'work' => $work,
    ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <div class="grid gap-6 xl:grid-cols-3">
        <div class="flex flex-col gap-6 xl:col-span-2">
            <div class="setel-card p-5 md:p-6">
                <h2 class="text-lg font-semibold text-[var(--setel-text)]">Resumen</h2>
                <dl class="mt-4 grid gap-4 sm:grid-cols-2">
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Tipo</dt>
                        <dd class="mt-1 text-sm text-[var(--setel-text)]"><?php echo e($work->workType?->name ?? '—'); ?></dd>
                    </div>
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">SLA</dt>
                        <dd class="mt-1 text-sm tabular-nums text-[var(--setel-text)]"><?php echo e(number_format($work->sla_hours)); ?> h</dd>
                    </div>
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Prioridad</dt>
                        <dd class="mt-1"><span class="<?php echo e(WorkPriority::tryFrom($work->priority)?->badgeClass() ?? 'setel-badge setel-badge--neutral'); ?> text-xs"><?php echo e(WorkPriority::tryFrom($work->priority)?->label() ?? $work->priority); ?></span></dd>
                    </div>
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Estado externo</dt>
                        <dd class="mt-1"><span class="<?php echo e(WorkStatus::tryFrom($work->work_status)?->badgeClass() ?? 'setel-badge setel-badge--neutral'); ?> text-xs"><?php echo e(WorkStatus::tryFrom($work->work_status)?->label() ?? $work->work_status); ?></span></dd>
                    </div>
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Estado interno</dt>
                        <dd class="mt-1"><span class="<?php echo e(WorkInternalStatus::tryFrom($work->internal_status)?->badgeClass() ?? 'setel-badge setel-badge--neutral'); ?> text-xs"><?php echo e(WorkInternalStatus::tryFrom($work->internal_status)?->label() ?? $work->internal_status); ?></span></dd>
                    </div>
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Escala</dt>
                        <dd class="mt-1 text-sm tabular-nums text-[var(--setel-text)]"><?php echo e($work->scale_datetime?->format('d/m/Y H:i') ?? '—'); ?></dd>
                    </div>
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Clareo</dt>
                        <dd class="mt-1 text-sm tabular-nums text-[var(--setel-text)]"><?php echo e($work->clearance_datetime?->format('d/m/Y H:i') ?? '—'); ?></dd>
                    </div>
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Programado</dt>
                        <dd class="mt-1 text-sm tabular-nums text-[var(--setel-text)]"><?php echo e($work->scheduled_date?->format('d/m/Y H:i') ?? '—'); ?></dd>
                    </div>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($work->site?->typeEnum()): ?>
                        <div>
                            <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Tipo de sitio</dt>
                            <dd class="mt-1 text-sm text-[var(--setel-text)]"><?php echo e($work->site->typeEnum()?->label() ?? $work->site->type); ?></dd>
                        </div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($work->site?->project): ?>
                        <div class="sm:col-span-2">
                            <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Proyecto (sitio)</dt>
                            <dd class="mt-1 flex items-center gap-2 text-sm text-[var(--setel-text)]">
                                <span class="size-3 shrink-0 rounded-full border border-[var(--setel-card-border)]" style="background-color: <?php echo e($work->site->project->color ?? '#64748b'); ?>"></span>
                                <?php echo e($work->site->project->name); ?>

                            </dd>
                        </div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <div class="sm:col-span-2">
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Observaciones</dt>
                        <dd class="mt-2 text-sm leading-relaxed text-[var(--setel-text-muted)]"><?php echo e($work->observation ?: 'Sin observaciones.'); ?></dd>
                    </div>
                </dl>
            </div>

            <?php echo $__env->make('livewire.works.partials.work-files-panel', ['work' => $work], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($this->canEditCoordinator): ?>
                <div class="setel-card p-5 md:p-6">
                    <h2 class="text-lg font-semibold text-[var(--setel-text)]">Edición completa (operaciones)</h2>
                    <p class="mt-1 text-sm text-[var(--setel-text-muted)]">Todos los campos de la OT agrupados por bloque. También puede gestionar asignaciones en <strong>Operaciones → Asignaciones</strong>.</p>
                    <form id="work-coordinator-form" class="mt-8 flex flex-col gap-10" wire:submit="saveCoordinator">
                        <section class="flex flex-col gap-4">
                            <div>
                                <h3 class="text-base font-semibold text-[var(--setel-text)]">Orden de trabajo</h3>
                                <p class="mt-1 text-sm text-[var(--setel-text-muted)]">Identificación, estados, fechas, SLA, prioridad, observaciones, sitio y tipo.</p>
                            </div>
                            <?php echo $__env->make('livewire.works.partials.coordinator-fields-work', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                        </section>
                        <section class="flex flex-col gap-4 border-t border-[var(--setel-card-border)] pt-8">
                            <div>
                                <h3 class="text-base font-semibold text-[var(--setel-text)]">NOC, técnico y coordinador</h3>
                                <p class="mt-1 text-sm text-[var(--setel-text-muted)]">Equipo asociado a la OT (búsqueda por nombre, documento o correo).</p>
                            </div>
                            <?php echo $__env->make('livewire.works.partials.coordinator-fields-team', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                        </section>
                    </form>
                </div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($this->canEditTechnician): ?>
                <div class="setel-card border-l-4 border-l-[var(--setel-primary)] p-5 md:p-6">
                    <h2 class="text-lg font-semibold text-[var(--setel-text)]">Tu cierre en campo</h2>
                    <p class="mt-1 text-sm text-[var(--setel-text-muted)]">Registra la fecha de clareo y el estado interno cuando termines la visita.</p>
                    <form class="mt-5 grid gap-4 sm:grid-cols-2" wire:submit="saveTechnician">
                        <div>
                            <label class="setel-users-filter-label" for="tech-clearance">Fecha y hora de clareo</label>
                            <input id="tech-clearance" type="datetime-local" class="setel-input w-full" wire:model="tech_clearance_datetime" />
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['tech_clearance_datetime'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                        <div>
                            <label class="setel-users-filter-label" for="tech-internal">Estado interno</label>
                            <select id="tech-internal" class="setel-input w-full py-0 pe-8" wire:model="tech_internal_status">
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = WorkInternalStatus::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $case): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                    <option value="<?php echo e($case->value); ?>"><?php echo e($case->label()); ?></option>
                                <?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; ?>
                            </select>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['tech_internal_status'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                        <div class="sm:col-span-2">
                            <button type="submit" class="setel-btn-primary" wire:loading.attr="disabled" wire:target="saveTechnician">
                                <span wire:loading.remove wire:target="saveTechnician">Guardar cierre</span>
                                <span wire:loading wire:target="saveTechnician">Guardando…</span>
                            </button>
                        </div>
                    </form>
                </div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>

        <div class="flex flex-col gap-6">
            <div class="setel-card p-5 md:p-6">
                <h2 class="text-lg font-semibold text-[var(--setel-text)]">Equipo</h2>
                <ul class="mt-4 flex flex-col gap-4">
                    <li class="flex items-start gap-3">
                        <span class="setel-avatar shrink-0"><?php echo e($work->noc?->initials() ?? '?'); ?></span>
                        <div class="min-w-0 flex-1">
                            <p class="truncate font-medium text-[var(--setel-text)]"><?php echo e($work->noc?->fullName() ?? '—'); ?></p>
                            <span class="setel-badge setel-badge--neutral mt-1 text-xs">NOC asignado</span>
                        </div>
                    </li>
                    <li class="flex items-start gap-3">
                        <span class="setel-avatar shrink-0"><?php echo e($work->technician?->initials() ?? '?'); ?></span>
                        <div class="min-w-0 flex-1">
                            <p class="truncate font-medium text-[var(--setel-text)]"><?php echo e($work->technician?->fullName() ?? '—'); ?></p>
                            <span class="setel-badge setel-badge--neutral mt-1 text-xs">Técnico</span>
                        </div>
                    </li>
                    <li class="flex items-start gap-3">
                        <span class="setel-avatar shrink-0"><?php echo e($work->coordinator?->initials() ?? '?'); ?></span>
                        <div class="min-w-0 flex-1">
                            <p class="truncate font-medium text-[var(--setel-text)]"><?php echo e($work->coordinator?->fullName() ?? '—'); ?></p>
                            <span class="setel-badge setel-badge--neutral mt-1 text-xs">Coordinador</span>
                        </div>
                    </li>
                </ul>
            </div>

            <div class="setel-card p-5 md:p-6">
                <h2 class="text-lg font-semibold text-[var(--setel-text)]">Seguimiento NOC</h2>
                <p class="mt-1 text-sm text-[var(--setel-text-muted)]">Estado operativo del NOC sobre esta OT. Los cambios quedan también en auditoría.</p>

                <dl class="mt-4 space-y-3 rounded-lg bg-[var(--setel-content-bg)] p-4">
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Estado seguimiento</dt>
                        <dd class="mt-1"><span class="<?php echo e(NocTrackingStatus::tryFrom((string) ($work->noc_tracking_status ?? NocTrackingStatus::PENDIENTE->value))?->badgeClass() ?? 'setel-badge setel-badge--neutral'); ?> text-xs"><?php echo e(NocTrackingStatus::tryFrom((string) ($work->noc_tracking_status ?? NocTrackingStatus::PENDIENTE->value))?->label()); ?></span></dd>
                    </div>
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Comentario NOC</dt>
                        <dd class="mt-1 text-sm text-[var(--setel-text)]"><?php echo e($work->noc_comment ?: '—'); ?></dd>
                    </div>
                    <div>
                        <dt class="text-xs font-semibold uppercase tracking-wide text-[var(--setel-text-muted)]">Usuario NOC (última acción)</dt>
                        <dd class="mt-1 text-sm text-[var(--setel-text)]"><?php echo e($work->noc?->fullName() ?? '—'); ?></dd>
                    </div>
                </dl>

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($this->canEditNoc): ?>
                    <form class="mt-5 flex flex-col gap-4 border-t border-[var(--setel-card-border)] pt-5" wire:submit="saveNoc">
                        <div>
                            <label class="setel-users-filter-label" for="noc-status">Actualizar estado</label>
                            <select id="noc-status" class="setel-input w-full py-0 pe-8" wire:model="noc_tracking_status">
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = NocTrackingStatus::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $case): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                    <option value="<?php echo e($case->value); ?>"><?php echo e($case->label()); ?></option>
                                <?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; ?>
                            </select>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['noc_tracking_status'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                        <div>
                            <label class="setel-users-filter-label" for="noc-comment">Comentario</label>
                            <textarea id="noc-comment" rows="3" class="setel-input w-full resize-y" wire:model="noc_comment" placeholder="Motivo de observación o nota de cierre"></textarea>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__errorArgs = ['noc_comment'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-sm text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                        <p class="text-xs text-[var(--setel-text-muted)]">Al guardar se actualiza el seguimiento y queda registrado el usuario NOC que realizó el cambio (también en auditoría).</p>
                        <button type="submit" class="setel-btn-primary w-full sm:w-auto" wire:loading.attr="disabled" wire:target="saveNoc">
                            <span wire:loading.remove wire:target="saveNoc">Guardar seguimiento</span>
                            <span wire:loading wire:target="saveNoc">Guardando…</span>
                        </button>
                    </form>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        </div>
    </div>

    <?php if (isset($component)) { $__componentOriginal8cc9d3143946b992b324617832699c5f = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal8cc9d3143946b992b324617832699c5f = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::modal.index','data' => ['wire:model.self' => 'showWorkAuditHistory','wire:close' => 'closeWorkAuditHistory','class' => 'max-w-4xl w-full !max-w-[min(96vw,56rem)]']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::modal'); ?>
<?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(['wire:model.self' => 'showWorkAuditHistory','wire:close' => 'closeWorkAuditHistory','class' => 'max-w-4xl w-full !max-w-[min(96vw,56rem)]']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

        <div class="flex max-h-[min(85vh,760px)] flex-col gap-4">
            <div class="flex items-start gap-3 pe-10">
                <span class="setel-modal__icon shrink-0 !static !flex"><?php if (isset($component)) { $__componentOriginalb3870b881c50e33e7f9afb190d9670ac = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalb3870b881c50e33e7f9afb190d9670ac = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::icon.clipboard-document-list','data' => ['class' => 'size-5']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::icon.clipboard-document-list'); ?>
<?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(['class' => 'size-5']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalb3870b881c50e33e7f9afb190d9670ac)): ?>
<?php $attributes = $__attributesOriginalb3870b881c50e33e7f9afb190d9670ac; ?>
<?php unset($__attributesOriginalb3870b881c50e33e7f9afb190d9670ac); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalb3870b881c50e33e7f9afb190d9670ac)): ?>
<?php $component = $__componentOriginalb3870b881c50e33e7f9afb190d9670ac; ?>
<?php unset($__componentOriginalb3870b881c50e33e7f9afb190d9670ac); ?>
<?php endif; ?></span>
                <div>
                    <?php if (isset($component)) { $__componentOriginale0fd5b6a0986beffac17a0a103dfd7b9 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale0fd5b6a0986beffac17a0a103dfd7b9 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::heading','data' => ['size' => 'lg']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::heading'); ?>
<?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(['size' => 'lg']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>
Historial y auditoría <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale0fd5b6a0986beffac17a0a103dfd7b9)): ?>
<?php $attributes = $__attributesOriginale0fd5b6a0986beffac17a0a103dfd7b9; ?>
<?php unset($__attributesOriginale0fd5b6a0986beffac17a0a103dfd7b9); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale0fd5b6a0986beffac17a0a103dfd7b9)): ?>
<?php $component = $__componentOriginale0fd5b6a0986beffac17a0a103dfd7b9; ?>
<?php unset($__componentOriginale0fd5b6a0986beffac17a0a103dfd7b9); ?>
<?php endif; ?>
                    <?php if (isset($component)) { $__componentOriginal43e8c568bbb8b06b9124aad3ccf4ec97 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal43e8c568bbb8b06b9124aad3ccf4ec97 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::subheading','data' => ['class' => 'mt-1']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::subheading'); ?>
<?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(['class' => 'mt-1']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

                        Registro de cambios en la OT <?php echo e($work->ot); ?> y en sus adjuntos (quién, cuándo y qué cambió).
                     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal43e8c568bbb8b06b9124aad3ccf4ec97)): ?>
<?php $attributes = $__attributesOriginal43e8c568bbb8b06b9124aad3ccf4ec97; ?>
<?php unset($__attributesOriginal43e8c568bbb8b06b9124aad3ccf4ec97); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal43e8c568bbb8b06b9124aad3ccf4ec97)): ?>
<?php $component = $__componentOriginal43e8c568bbb8b06b9124aad3ccf4ec97; ?>
<?php unset($__componentOriginal43e8c568bbb8b06b9124aad3ccf4ec97); ?>
<?php endif; ?>
                </div>
            </div>

            <div class="min-h-0 flex-1 overflow-y-auto border-t border-[var(--setel-card-border)] pt-4 pe-1">
                <?php echo $__env->make('livewire.works.partials.work-audit-panel', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
            </div>

            <div class="flex justify-end border-t border-[var(--setel-card-border)] pt-4">
                <?php if (isset($component)) { $__componentOriginalc04b147acd0e65cc1a77f86fb0e81580 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc04b147acd0e65cc1a77f86fb0e81580 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::button.index','data' => ['type' => 'button','variant' => 'ghost','wire:click' => 'closeWorkAuditHistory']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::button'); ?>
<?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(['type' => 'button','variant' => 'ghost','wire:click' => 'closeWorkAuditHistory']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>
Cerrar <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc04b147acd0e65cc1a77f86fb0e81580)): ?>
<?php $attributes = $__attributesOriginalc04b147acd0e65cc1a77f86fb0e81580; ?>
<?php unset($__attributesOriginalc04b147acd0e65cc1a77f86fb0e81580); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc04b147acd0e65cc1a77f86fb0e81580)): ?>
<?php $component = $__componentOriginalc04b147acd0e65cc1a77f86fb0e81580; ?>
<?php unset($__componentOriginalc04b147acd0e65cc1a77f86fb0e81580); ?>
<?php endif; ?>
            </div>
        </div>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal8cc9d3143946b992b324617832699c5f)): ?>
<?php $attributes = $__attributesOriginal8cc9d3143946b992b324617832699c5f; ?>
<?php unset($__attributesOriginal8cc9d3143946b992b324617832699c5f); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8cc9d3143946b992b324617832699c5f)): ?>
<?php $component = $__componentOriginal8cc9d3143946b992b324617832699c5f; ?>
<?php unset($__componentOriginal8cc9d3143946b992b324617832699c5f); ?>
<?php endif; ?>

    <?php if (isset($component)) { $__componentOriginal8cc9d3143946b992b324617832699c5f = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal8cc9d3143946b992b324617832699c5f = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::modal.index','data' => ['wire:model.self' => 'showAssignmentHistoryModal','wire:close' => 'closeAssignmentHistoryModal','class' => 'max-w-4xl w-full !max-w-[min(96vw,56rem)]']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::modal'); ?>
<?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(['wire:model.self' => 'showAssignmentHistoryModal','wire:close' => 'closeAssignmentHistoryModal','class' => 'max-w-4xl w-full !max-w-[min(96vw,56rem)]']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

        <div class="flex max-h-[min(85vh,760px)] flex-col gap-4">
            <div class="flex items-start gap-3 pe-10">
                <span class="setel-modal__icon shrink-0 !static !flex"><?php if (isset($component)) { $__componentOriginalec36de86b0c342dc76f8040ade97006d = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalec36de86b0c342dc76f8040ade97006d = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::icon.calendar-days','data' => ['class' => 'size-5']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::icon.calendar-days'); ?>
<?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(['class' => 'size-5']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalec36de86b0c342dc76f8040ade97006d)): ?>
<?php $attributes = $__attributesOriginalec36de86b0c342dc76f8040ade97006d; ?>
<?php unset($__attributesOriginalec36de86b0c342dc76f8040ade97006d); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalec36de86b0c342dc76f8040ade97006d)): ?>
<?php $component = $__componentOriginalec36de86b0c342dc76f8040ade97006d; ?>
<?php unset($__componentOriginalec36de86b0c342dc76f8040ade97006d); ?>
<?php endif; ?></span>
                <div>
                    <?php if (isset($component)) { $__componentOriginale0fd5b6a0986beffac17a0a103dfd7b9 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale0fd5b6a0986beffac17a0a103dfd7b9 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::heading','data' => ['size' => 'lg']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::heading'); ?>
<?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(['size' => 'lg']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>
Bitácora de asignaciones <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale0fd5b6a0986beffac17a0a103dfd7b9)): ?>
<?php $attributes = $__attributesOriginale0fd5b6a0986beffac17a0a103dfd7b9; ?>
<?php unset($__attributesOriginale0fd5b6a0986beffac17a0a103dfd7b9); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale0fd5b6a0986beffac17a0a103dfd7b9)): ?>
<?php $component = $__componentOriginale0fd5b6a0986beffac17a0a103dfd7b9; ?>
<?php unset($__componentOriginale0fd5b6a0986beffac17a0a103dfd7b9); ?>
<?php endif; ?>
                    <?php if (isset($component)) { $__componentOriginal43e8c568bbb8b06b9124aad3ccf4ec97 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal43e8c568bbb8b06b9124aad3ccf4ec97 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::subheading','data' => ['class' => 'mt-1']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::subheading'); ?>
<?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(['class' => 'mt-1']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

                        Todas las filas de asignación de <span class="font-mono"><?php echo e($work->ot); ?></span>. Use «Desde» y «Hasta» para filtrar por fecha y hora de registro.
                     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal43e8c568bbb8b06b9124aad3ccf4ec97)): ?>
<?php $attributes = $__attributesOriginal43e8c568bbb8b06b9124aad3ccf4ec97; ?>
<?php unset($__attributesOriginal43e8c568bbb8b06b9124aad3ccf4ec97); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal43e8c568bbb8b06b9124aad3ccf4ec97)): ?>
<?php $component = $__componentOriginal43e8c568bbb8b06b9124aad3ccf4ec97; ?>
<?php unset($__componentOriginal43e8c568bbb8b06b9124aad3ccf4ec97); ?>
<?php endif; ?>
                </div>
            </div>

            <div class="flex flex-wrap items-end gap-3 border-t border-[var(--setel-card-border)] pt-4">
                <div class="setel-users-filter-field min-w-[10rem]">
                    <label class="setel-users-filter-label" for="asg-hist-from">Desde</label>
                    <input id="asg-hist-from" type="date" class="setel-input w-full" wire:model.live="assignmentHistoryDateFrom" />
                </div>
                <div class="setel-users-filter-field min-w-[10rem]">
                    <label class="setel-users-filter-label" for="asg-hist-to">Hasta</label>
                    <input id="asg-hist-to" type="date" class="setel-input w-full" wire:model.live="assignmentHistoryDateTo" />
                </div>
                <button
                    type="button"
                    class="inline-flex size-[2.5rem] shrink-0 items-center justify-center rounded-lg border border-[var(--setel-card-border)] bg-[var(--setel-card)] text-[var(--setel-text-muted)] hover:bg-[var(--setel-content-bg)] hover:text-[var(--setel-text)]"
                    wire:click="clearAssignmentHistoryDateFilter"
                    title="Quitar filtro de fechas"
                    aria-label="Quitar filtro de fechas"
                >
                    <?php if (isset($component)) { $__componentOriginal155e76c41fe51242bc25d269fabf82f5 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal155e76c41fe51242bc25d269fabf82f5 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::icon.x-mark','data' => ['class' => 'size-5 shrink-0']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::icon.x-mark'); ?>
<?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(['class' => 'size-5 shrink-0']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal155e76c41fe51242bc25d269fabf82f5)): ?>
<?php $attributes = $__attributesOriginal155e76c41fe51242bc25d269fabf82f5; ?>
<?php unset($__attributesOriginal155e76c41fe51242bc25d269fabf82f5); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal155e76c41fe51242bc25d269fabf82f5)): ?>
<?php $component = $__componentOriginal155e76c41fe51242bc25d269fabf82f5; ?>
<?php unset($__componentOriginal155e76c41fe51242bc25d269fabf82f5); ?>
<?php endif; ?>
                </button>
            </div>

            <div class="min-h-0 flex-1 overflow-y-auto border-t border-[var(--setel-card-border)] pt-4 pe-1">
                <div class="setel-table-wrap max-w-full overflow-x-auto">
                    <table class="setel-table min-w-[640px]">
                        <thead>
                            <tr>
                                <th>Registro</th>
                                <th class="text-center">Estado</th>
                                <th>Técnico</th>
                                <th>Coordinador</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $this->workAssignmentHistoryRows; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                <tr <?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::$currentLoop['key'] = 'work-asg-hist-'.e($row->id).''; ?>wire:key="work-asg-hist-<?php echo e($row->id); ?>">
                                    <td class="text-sm tabular-nums text-[var(--setel-text)]"><?php echo e($row->recorded_at?->format('d/m/Y H:i') ?? '—'); ?></td>
                                    <td class="text-center">
                                        <span class="<?php echo e(WorkAssignmentStatus::fromDatabase((string) $row->status)?->badgeClass() ?? 'setel-badge setel-badge--neutral'); ?> text-xs">
                                            <?php echo e(WorkAssignmentStatus::fromDatabase((string) $row->status)?->label() ?? $row->status); ?>

                                        </span>
                                    </td>
                                    <td class="text-sm"><?php echo e($row->technician?->fullName() ?? '—'); ?></td>
                                    <td class="text-sm"><?php echo e($row->coordinator?->fullName() ?? '—'); ?></td>
                                </tr>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                                <tr>
                                    <td colspan="4" class="py-8 text-center text-sm text-[var(--setel-text-muted)]">No hay filas para los filtros actuales.</td>
                                </tr>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="flex justify-end border-t border-[var(--setel-card-border)] pt-4">
                <?php if (isset($component)) { $__componentOriginalc04b147acd0e65cc1a77f86fb0e81580 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc04b147acd0e65cc1a77f86fb0e81580 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'e60dd9d2c3a62d619c9acb38f20d5aa5::button.index','data' => ['type' => 'button','variant' => 'ghost','wire:click' => 'closeAssignmentHistoryModal']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('flux::button'); ?>
<?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(['type' => 'button','variant' => 'ghost','wire:click' => 'closeAssignmentHistoryModal']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>
Cerrar <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc04b147acd0e65cc1a77f86fb0e81580)): ?>
<?php $attributes = $__attributesOriginalc04b147acd0e65cc1a77f86fb0e81580; ?>
<?php unset($__attributesOriginalc04b147acd0e65cc1a77f86fb0e81580); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc04b147acd0e65cc1a77f86fb0e81580)): ?>
<?php $component = $__componentOriginalc04b147acd0e65cc1a77f86fb0e81580; ?>
<?php unset($__componentOriginalc04b147acd0e65cc1a77f86fb0e81580); ?>
<?php endif; ?>
            </div>
        </div>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal8cc9d3143946b992b324617832699c5f)): ?>
<?php $attributes = $__attributesOriginal8cc9d3143946b992b324617832699c5f; ?>
<?php unset($__attributesOriginal8cc9d3143946b992b324617832699c5f); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8cc9d3143946b992b324617832699c5f)): ?>
<?php $component = $__componentOriginal8cc9d3143946b992b324617832699c5f; ?>
<?php unset($__componentOriginal8cc9d3143946b992b324617832699c5f); ?>
<?php endif; ?>
</div>
<?php /**PATH C:\laragon\www\setelsat-gilat-manager\resources\views/livewire/works/show.blade.php ENDPATH**/ ?>