@php
$oldContactoId = old('contacto_id', $reunion->contacto_id ?? null);
$oldUnidadIds = old('unidades_atencion', $reunion->unidadesAtencion->pluck('id')->toArray());
$oldFuncIds = old('funcionarios', $reunion->funcionarios->pluck('id')->toArray());
$contactoNombre = '';
if ($oldContactoId) {
$c = $contactos->firstWhere('id', $oldContactoId);
$contactoNombre = $c ? $c->user->nombre . ' ' . $c->user->apellido : '';
}
$unidadesById = $unidades->keyBy('id');
$funcionariosById = $funcionarios->keyBy('id');
@endphp
{{-- SECCIÓN: PARTICIPANTES --}}
Participantes
{{-- UNIDADES DE ATENCIÓN (multi-chip) --}}
@error('unidades_atencion')
{{ $message }}
@enderror
@foreach ($oldUnidadIds as $uid)
@php $u = $unidadesById->get($uid) @endphp
@if ($u)
{{ $u->nombre_comercial }}
@endif
@endforeach
{{-- CONTACTO (single-chip) --}}
@error('contacto_id')
{{ $message }}
@enderror
{{ $contactoNombre }}
{{-- FUNCIONARIOS (multi-chip) --}}
@error('funcionarios')
{{ $message }}
@enderror
@foreach ($oldFuncIds as $fid)
@php $f = $funcionariosById->get($fid) @endphp
@if ($f)
{{ $f->user->nombre }} {{ $f->user->apellido }}
@endif
@endforeach
{{-- SECCIÓN: LOGÍSTICA --}}
Logística y Tiempo
{{-- FECHA --}}
@error('fecha_reunion')
{{ $message }}
@enderror
@php
$slots = [];
for ($h = 9; $h <= 16; $h++) {
foreach ([0, 15, 30, 45] as $m) {
if ($h === 16 && $m > 0) {
break;
}
$slots[] = sprintf('%02d:%02d', $h, $m);
}
}
$oldHoraInicio = old(
'hora_inicio',
$reunion->hora_inicio ? \Carbon\Carbon::parse($reunion->hora_inicio)->format('H:i') : '',
);
$oldHoraFin = old(
'hora_fin',
$reunion->hora_fin ? \Carbon\Carbon::parse($reunion->hora_fin)->format('H:i') : '',
);
@endphp
{{-- HORA INICIO --}}
{{ $oldHoraInicio ?: '--:--' }}
@error('hora_inicio')
{{ $message }}
@enderror
@foreach ($slots as $slot)
@endforeach
{{-- HORA FIN --}}
{{ $oldHoraFin ?: '--:--' }}
La hora de fin debe ser posterior a la hora de inicio.
@error('hora_fin')
{{ $message }}
@enderror
@foreach ($slots as $slot)
@endforeach
{{-- MODALIDAD / LUGAR --}}
@error('modalidad')
{{ $message }}
@enderror
@error('lugar')
{{ $message }}
@enderror
{{-- SECCIÓN: ACCIONES VINCULADAS --}}
Acciones vinculadas
@php
$selectedAccionIds = old('accion_ids', $reunion->acciones->pluck('id')->toArray());
$unidadIds = $reunion->unidadesAtencion->pluck('id')->toArray();
@endphp
@include('reuniones.partials.buscador-acciones', [
'acciones' => $acciones,
'selectedIds' => $selectedAccionIds,
'startDisabled' => false,
])
{{-- SECCIÓN: DETALLES --}}
Detalles de la Reunión
{{-- TIPO / ESTADO --}}
@error('tipo_reunion')
{{ $message }}
@enderror
@error('estado')
{{ $message }}
@enderror
{{-- TEMÁTICAS (multi-chip) --}}
@error('tematicas')
{{ $message }}
@enderror
@php
$oldTematicas = old('tematicas', $reunion->tematicas ?? []);
@endphp
@foreach ($oldTematicas as $tematicaValue)
{{ $tematicaValue }}
@endforeach
{{-- OBSERVACIONES --}}
Máximo 1000 caracteres. Evite caracteres especiales o emojis.
@error('observaciones')
{{ $message }}
@enderror
{{-- OBSERVACIONES INTERNAS (solo para funcionarios) --}}
@if(auth()->user()->funcionario)
@if(request('iniciar') === '1')
Obligatorio al iniciar la reunión.
@endif
Máximo 3000 caracteres. Este campo no es visible para contactos.
@error('observaciones_internas')
{{ $message }}
@enderror
@endif
@php
$contactosJson2 = $contactos->map(
fn($c) => [
'id' => $c->id,
'nombre' => $c->user->nombre . ' ' . $c->user->apellido,
'email' => $c->user->email,
],
);
$unidadesJson2 = $unidades->map(
fn($u) => [
'id' => $u->id,
'nombre' => $u->nombre_comercial,
],
);
$funcionariosJson2 = $funcionarios->map(
fn($f) => [
'id' => $f->id,
'nombre' => $f->user->nombre . ' ' . $f->user->apellido,
],
);
$accionesJson = $acciones->map(
fn($a) => [
'id' => $a->id,
'nombre' => $a->detalle_accion,
'unidades' => $a->planes->pluck('unidad_atencion_id')->filter()->unique()->values()->all(),
],
);
$oldContactoId2 = (int) old('contacto_id', $reunion->contacto_id ?? 0);
$oldUnidadIds2 = array_map('intval', old('unidades_atencion', $reunion->unidadesAtencion->pluck('id')->toArray()));
$oldFuncIds2 = array_map('intval', old('funcionarios', $reunion->funcionarios->pluck('id')->toArray()));
$selectedAccionIdsJson = array_map('intval', old('accion_ids', $reunion->acciones->pluck('id')->toArray()));
$tematicasData = collect(\App\Enums\TematicaReunionEnum::cases())->map(fn($t) => ['value' => $t->value, 'label' => $t->value]);
$oldTematicasArray = old('tematicas', $reunion->tematicas ?? []);
@endphp
@push('scripts')
@endpush