@extends('layouts.app-layout') @section('title', 'Detalle de funcionario') @section('content') @php $isOwnProfile = auth()->check() && auth()->user()->funcionario?->id === $funcionario->id; $backUrl = $isOwnProfile ? route('funcionario.dashboard') : route('funcionarios.index'); $estadoRaw = $funcionario->estado->value ?? $funcionario->estado; $estadoLabel = 'Inactivo'; $estadoClass = 'bg-warning-subtle text-warning-emphasis'; if ($funcionario->trashed()) { $estadoLabel = 'Eliminado'; $estadoClass = 'bg-danger-subtle text-danger-emphasis'; } elseif ($estadoRaw === 'activo') { $estadoLabel = 'Activo'; $estadoClass = 'bg-success-subtle text-success-emphasis'; } $puedeDesactivar = !$funcionario->trashed() && $estadoRaw === 'activo'; $puedeRestaurar = $funcionario->trashed() || $estadoRaw === 'inactivo'; $puedeEditar = !$funcionario->trashed(); $nombre = trim(($funcionario->user->nombre ?? '') . ' ' . ($funcionario->user->apellido ?? '')); $iniciales = mb_strtoupper( mb_substr($funcionario->user->nombre ?? '', 0, 1) . mb_substr($funcionario->user->apellido ?? '', 0, 1), ); $rolLabel = $funcionario->rol?->label() ?? '—'; $horarioEntrada = $funcionario->horario_entrada ? substr((string) $funcionario->horario_entrada, 0, 5) : null; $horarioSalida = $funcionario->horario_salida ? substr((string) $funcionario->horario_salida, 0, 5) : null; $horarioAtencion = match (true) { $horarioEntrada && $horarioSalida => $horarioEntrada . ' - ' . $horarioSalida, $horarioEntrada => $horarioEntrada, $horarioSalida => $horarioSalida, default => '—', }; @endphp
@if (session('success')) @endif @if ($funcionario->trashed()) @endif
{{ $iniciales ?: 'F' }}

Perfil interno

{{ $nombre ?: 'Funcionario' }}

{{ $rolLabel }} {{ $estadoLabel }}
@if ($puedeEditar) @endif @if ($puedeDesactivar) @endif @if ($puedeRestaurar)
@csrf @method('PATCH')
@endif

Datos personales

Email
{{ $funcionario->user->email }}
Cédula
{{ $funcionario->user->cedula ?? '—' }}
Teléfono
{{ $funcionario->user->telefono ?? '—' }}
Centro/Unidad
{{ $funcionario->centro_unidad ?? '—' }}

Ficha del cargo

Rol
{{ $rolLabel }}
Estado
{{ $estadoLabel }}
Horario de atención
{{ $horarioAtencion }}

Trazabilidad

Creado
{{ $funcionario->created_at->format('d/m/Y H:i') }}
Última actualización
{{ $funcionario->updated_at->format('d/m/Y H:i') }}
@include('partials.privacy-policy-modal') @if ($puedeDesactivar) @endif @endsection