diff --git a/manager/components/PreMatricula.tsx b/manager/components/PreMatricula.tsx index 08f6357..bf2619f 100644 --- a/manager/components/PreMatricula.tsx +++ b/manager/components/PreMatricula.tsx @@ -94,10 +94,14 @@ const PreMatricula: React.FC = ({ data, onConvert }) => { }; const addField = async () => { - if (!newField.label.trim()) return; + let label = newField.label.trim(); + if (newField.tipo === 'banner' && !label) { + label = 'Folder Promocional'; + } + if (!label) return; const campo = { id: crypto.randomUUID(), - label: newField.label, + label: label, tipo: newField.tipo, placeholder: newField.placeholder, obrigatorio: newField.obrigatorio, @@ -126,12 +130,17 @@ const PreMatricula: React.FC = ({ data, onConvert }) => { }; const updateField = async (campo: PreMatriculaCampo) => { + let label = campo.label.trim(); + if (campo.tipo === 'banner' && !label) { + label = 'Folder Promocional'; + } + const updatedCampo = { ...campo, label }; try { await fetch(`/api/prematricula/campos/${campo.id}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(campo) + body: JSON.stringify(updatedCampo) }); - setCampos(prev => prev.map(c => c.id === campo.id ? campo : c)); + setCampos(prev => prev.map(c => c.id === campo.id ? updatedCampo : c)); setEditingCampo(null); } catch (e) { console.error(e); } }; @@ -468,22 +477,22 @@ const PreMatricula: React.FC = ({ data, onConvert }) => {
{newField.placeholder ? ( -
- Banner -
+
+ Banner +
) : ( -