{{-- Partial: muestra los datos de una entidad para auditoría. Variables: $payload → datos a mostrar $entityType → 'rule' | 'coverage' $compareTo → (opcional) payload contra el cual comparar para resaltar diferencias $mode → 'new' | 'old' | 'solo' (solo = sin comparación) --}} @php $compareTo = $compareTo ?? null; // Helper: devuelve true si el campo cambió respecto al compareTo $changed = function(string $section, string $field) use ($payload, $compareTo): bool { if (!$compareTo) return false; $newVal = $payload[$section][$field] ?? null; $oldVal = $compareTo[$section][$field] ?? null; return (string)$newVal !== (string)$oldVal; }; $rowClass = fn(string $section, string $field): string => $changed($section, $field) ? 'bg-amber-50 border-l-4 border-amber-400' : ''; $valClass = fn(string $section, string $field): string => $changed($section, $field) ? 'font-bold text-amber-800' : 'text-gray-800'; $changedIcon = fn(string $section, string $field): string => $changed($section, $field) ? '' : ''; @endphp @if($entityType === 'rule') @php $r = $payload['rule'] ?? []; @endphp
| Nombre | {!! ($r['name'] ?? '—') . $changedIcon('rule','name') !!} |
| Categoría | {!! ($r['category'] ?? '—') . $changedIcon('rule','category') !!} |
| Contexto | @php $ctx = $r['context'] ?? ''; @endphp {{ $ctx ?: '—' }} {!! $changedIcon('rule','context') !!} |
| Prioridad | {!! ($r['priority'] ?? '—') . $changedIcon('rule','priority') !!} |
| Activa | @if($r['is_active'] ?? false) Sí @else No @endif {!! $changedIcon('rule','is_active') !!} |
Condiciones ({{ count($newConds) }}) @if($condsChanged) @endif
@if(!empty($newConds))Acciones ({{ count($newActions) }}) @if($actionsChanged) @endif
@if(!empty($newActions))| Nombre comercial | {!! ($c['commercial_name'] ?? '—') . $changedIcon('coverage','commercial_name') !!} |
| Nombre + AuxiSeg | {!! ($c['commercial_name_with_auxiseg'] ?? '—') . $changedIcon('coverage','commercial_name_with_auxiseg') !!} |
| Código base | {!! ($c['base_code_equis'] ?? '—') . $changedIcon('coverage','base_code_equis') !!} |
| Código completo | {!! ($c['full_code_equis'] ?? '—') . $changedIcon('coverage','full_code_equis') !!} |
| Orden | {!! ($c['sort_order'] ?? '—') . $changedIcon('coverage','sort_order') !!} |
| Activa | @if($c['is_active'] ?? false) Sí @else No @endif {!! $changedIcon('coverage','is_active') !!} |
| AuxiSeg | @if($c['allows_auxiseg'] ?? false) Permite {!! $changedIcon('coverage','allows_auxiseg') !!} @else No {!! $changedIcon('coverage','allows_auxiseg') !!} @endif @if($c['requires_auxiseg'] ?? false) Requerida {!! $changedIcon('coverage','requires_auxiseg') !!} @endif |
Condiciones ({{ count($newConds) }}) @if($condsChanged) @endif
@if(!empty($newConds))