@extends('layouts.app') @section('titulo', ($registro ? 'Modificar' : 'Nuevo').' · '.$cfg['titulo']) @section('contenido') @php($id = $registro?->{$cfg['pk']})
@csrf @if ($registro) @method('PUT') @endif
@foreach ($cfg['campos'] as $col => $c) @php $valor = old($col, $registro?->{$col} ?? null); if ($c['tipo'] === 'date' && $valor) { $valor = \Illuminate\Support\Carbon::parse($valor)->format('Y-m-d'); } if ($c['tipo'] === 'time' && $valor) { $valor = substr($valor, 0, 5); } $requerido = str_contains($c['reglas'], 'required'); @endphp
@if ($c['tipo'] === 'select') @elseif ($c['tipo'] === 'textarea') @else @endif @error($col)
{{ $message }}
@enderror
@endforeach
@endsection