<tr <?php if($item->isEmAndamento()): ?> class="table-warning" <?php endif; ?>>
    <td class="fw-semibold"><?php echo e($item->numero); ?></td>
    <td><?php echo e($item->solicitante_nome); ?></td>
    <td><?php echo e($item->unidade->abbreviation ?? '—'); ?></td>
    <td><?php echo e($item->setor_nome ?? $item->setor?->nome ?? '—'); ?></td>
    <td><?php echo e($item->assunto_nome ?? $item->assunto?->nome ?? '—'); ?></td>
    <td><?php echo e($item->subassunto_nome ?? $item->subassunto?->nome ?? '—'); ?></td>
    <td>
        <?php
            $statusLabel = \App\Models\IndicadoresTi\Chamado::STATUS[$item->status] ?? $item->status;
            $statusClass = match ($item->status) {
                'pendente'     => 'warning',
                'em_andamento' => 'info',
                'atendido'     => 'success',
                default        => 'secondary',
            };
        ?>
        <span class="badge bg-<?php echo e($statusClass); ?>"><?php echo e(__($statusLabel)); ?></span>
    </td>
    <td>
        <?php
            $prioLabel = \App\Models\IndicadoresTi\Chamado::PRIORIDADE[$item->prioridade] ?? $item->prioridade;
            $prioClass = match ($item->prioridade) {
                'alta'   => 'danger',
                'critica'=> 'danger',
                'media'  => 'warning',
                'baixa'  => 'success',
                default  => 'secondary',
            };
        ?>
        <span class="badge bg-<?php echo e($prioClass); ?>"><?php echo e(__($prioLabel)); ?></span>
    </td>
    <td><?php echo e($item->atendente->name ?? '—'); ?></td>
    <td><?php echo e(optional($item->data_abertura)->format('d/m/Y H:i')); ?></td>
    <td><?php echo e(optional($item->data_fechamento)->format('d/m/Y H:i') ?? '—'); ?></td>
    <td>
        <?php if($item->isEmAndamento() && $item->data_abertura): ?>
            <span class="badge bg-warning text-dark tempo-em-andamento"
                data-inicio="<?php echo e(($item->data_reabertura ?? $item->data_abertura)->toIsoString()); ?>"
                data-acumulado="<?php echo e($item->tempo_acumulado ?? 0); ?>">
                <i class="fa-solid fa-spinner fa-spin me-1"></i>
                <?php echo e($item->getTempoAtendimentoFormatado()); ?>

            </span>
        <?php elseif($item->data_fechamento): ?>
            <small class="text-muted"><?php echo e($item->getTempoAtendimentoFormatado()); ?></small>
        <?php else: ?>
            <small class="text-muted">—</small>
        <?php endif; ?>
    </td>
    <td class="text-center">
        <div class="d-flex gap-1 justify-content-center">
            <a href="<?php echo e(route('admin.indicadoresTi.show', ['chamado' => $item->id] + request()->only(['status', 'prioridade', 'setor_id', 'busca']))); ?>"
                class="btn btn-sm btn-primary" title="<?php echo e(__('Abrir')); ?>">
                <i class="fa-solid fa-pen-to-square"></i>
            </a>
            <?php if($item->status !== 'atendido'): ?>
                <form action="<?php echo e(route('admin.indicadoresTi.concluir', $item->id)); ?>" method="POST"
                    onsubmit="return confirm('<?php echo e(__('Deseja concluir este chamado?')); ?>')">
                    <?php echo csrf_field(); ?>
                    <?php $__currentLoopData = request()->only(['status', 'prioridade', 'setor_id', 'busca']); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k => $v): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php if($v): ?> <input type="hidden" name="<?php echo e($k); ?>" value="<?php echo e($v); ?>"> <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <button class="btn btn-sm btn-success" title="<?php echo e(__('Concluir')); ?>">
                        <i class="fa-solid fa-check"></i>
                    </button>
                </form>
            <?php endif; ?>
            <?php if(
                auth()->user()->getPermissaoDetalhes('SYSADMIN')['excluir']
                || $item->atendente_id === auth()->id()
                || $item->participantes->contains('id', auth()->id())
            ): ?>
                <form action="<?php echo e(route('admin.indicadoresTi.destroy', $item->id)); ?>" method="POST"
                    onsubmit="return confirm('<?php echo e(__('Excluir permanentemente?')); ?>')">
                    <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                    <?php $__currentLoopData = request()->only(['status', 'prioridade', 'setor_id', 'busca']); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k => $v): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php if($v): ?> <input type="hidden" name="<?php echo e($k); ?>" value="<?php echo e($v); ?>"> <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <button class="btn btn-sm btn-danger" title="<?php echo e(__('Excluir')); ?>">
                        <i class="fa-solid fa-trash"></i>
                    </button>
                </form>
            <?php endif; ?>
        </div>
    </td>
</tr>
<?php /**PATH /var/www/html/portal/resources/views/admin/indicadoresTi/_row_chamado.blade.php ENDPATH**/ ?>