@extends('layouts.admin') @section('title', 'Historial de agenda · Lugh Dental') @section('content')
Volver a la agenda
CONTROL DE CAMBIOS

Historial de agenda

Consulta quién creó, modificó, reservó, canceló o bloqueó horarios de Clínica y Boxes.

@unless($ready)
Todavía falta instalar la tabla del historial. Importa primero el SQL incluido en el ZIP.
@endunless
Filtrar movimientos
Limpiar
@if($items)

Movimientos registrados

{{ number_format($items->total(),0,',','.') }} resultado(s)
@forelse($items as $item) @php $badge = str_contains($item->tipo,'reserva') ? 'ah-blue' : ($item->tipo === 'bloqueo' ? 'ah-orange' : ($item->tipo === 'configuracion' ? 'ah-purple' : 'ah-teal')); $before = json_decode($item->datos_anteriores ?? '[]',true) ?: []; $after = json_decode($item->datos_nuevos ?? '[]',true) ?: []; $labels = ['fecha'=>'Fecha','date'=>'Fecha','hora'=>'Hora','hora_inicio'=>'Desde','hora_fin'=>'Hasta','start_time'=>'Desde','end_time'=>'Hasta','estado'=>'Estado','status'=>'Estado','rental_box_id'=>'Box ID','paciente_id'=>'Paciente ID','box_renter_id'=>'Usuario de Box ID','horario_id'=>'Horario ID','is_active'=>'Activo','mode'=>'Modalidad','slot_minutes'=>'Intervalo','name'=>'Nombre','motivo'=>'Motivo','creados'=>'Creados','existentes'=>'Existentes','protegidos'=>'Protegidos','borrados'=>'Retirados','boxes'=>'Boxes','dias'=>'Días','contadores'=>'Resultado']; @endphp
{{ $item->resumen }}
{{ $item->usuario_nombre ?: 'Sistema' }} {{ $item->box_nombre ?: 'Clínica / general' }} @if($item->fecha_afectada) {{ \Carbon\Carbon::parse($item->fecha_afectada)->format('d/m/Y') }}@endif {{ $item->origen === 'publico' ? 'Reserva pública / sistema' : 'Panel interno' }}
@if($before || $after)
Ver detalles del cambio
@if($before)

Antes

@foreach($before as $key=>$value)

{{ $labels[$key] ?? str_replace('_',' ',ucfirst($key)) }}: {{ is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : ($value === null ? '—' : (is_bool($value) ? ($value ? 'Sí' : 'No') : $value)) }}

@endforeach
@endif @if($after)

Después / configuración

@foreach($after as $key=>$value)

{{ $labels[$key] ?? str_replace('_',' ',ucfirst($key)) }}: {{ is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : ($value === null ? '—' : (is_bool($value) ? ($value ? 'Sí' : 'No') : $value)) }}

@endforeach
@endif
@endif
@empty
No hay movimientos con esos filtros.El historial comienza a registrar operaciones después de instalar esta tanda.
@endforelse
{{ $items->links() }}
@endif
@endsection