diff --git a/resources/views/components/form/basic-contact.blade.php b/resources/views/components/form/basic-contact.blade.php new file mode 100644 index 0000000..42e0cdf --- /dev/null +++ b/resources/views/components/form/basic-contact.blade.php @@ -0,0 +1,176 @@ +@props([ + 'id' => 'contact-form', + 'fields' => [], + 'buttonLabel' => 'Enviar', + 'successMessage' => '¡Gracias! Te contactaremos muy pronto.', + 'action' => config('app.contact_form_action', request()->url()), {{-- Ajusta si usas una ruta específica --}} + 'method' => 'POST', + 'buttonClass' => 'btn btn-primary custom-btn text-center text-uppercase text-decoration-none border-0 py-0 px-5 font-weight-semibold', + 'class' => 'row g-3', + 'showHoneypot' => true, +]) + +@php + // Normaliza campos y valores por defecto + $normalized = collect($fields)->map(function ($f) { + $f = collect($f); + return [ + 'type' => $f->get('type', 'text'), + 'name' => $f->get('name', ''), + 'label' => $f->get('label', ''), + 'placeholder' => $f->get('placeholder', ''), + 'value' => old($f->get('name'), $f->get('value', '')), + 'required' => (bool) $f->get('required', false), + 'rows' => (int) $f->get('rows', 6), + 'options' => $f->get('options', []), // para selects/radios si en el futuro lo usas + 'col' => $f->get('col', 'col-12'), // grid responsive opcional + 'help' => $f->get('help', ''), + 'attrs' => $f->get('attrs', []), // atributos HTML extra + ]; + }); +@endphp + +
+ +{{-- Mejora UX: evita reenvío al volver / scroll a errores --}} +@push('scripts') + +@endpush