diff --git a/src/app/dashboard/profile-sections/[id]/page.tsx b/src/app/dashboard/profile-sections/[id]/page.tsx index 1961e1e..cb13adc 100644 --- a/src/app/dashboard/profile-sections/[id]/page.tsx +++ b/src/app/dashboard/profile-sections/[id]/page.tsx @@ -64,6 +64,8 @@ export default function SectionDetailPage() { uiConfig: undefined, }); + const [editSlug, setEditSlug] = useState(''); + // Options editor state const [optionInput, setOptionInput] = useState({ value: '', label: '' }); @@ -128,6 +130,7 @@ export default function SectionDetailPage() { const openEditFieldModal = (field: ProfileField) => { setSelectedField(field); + setEditSlug(field.slug); setFieldForm({ sectionId, name: field.name, @@ -183,7 +186,11 @@ export default function SectionDetailPage() { setModalError(''); try { const { sectionId: _, ...updateData } = fieldForm; - await profileFieldsService.update(selectedField.id, updateData as UpdateFieldDto); + const updatePayload: UpdateFieldDto = { ...updateData }; + if (editSlug && editSlug !== selectedField.slug) { + updatePayload.slug = editSlug; + } + await profileFieldsService.update(selectedField.id, updatePayload); closeFieldModal(); fetchData(); } catch (err) { @@ -669,6 +676,19 @@ export default function SectionDetailPage() { required /> + {fieldModalType === 'edit' && ( +
+ + setEditSlug(e.target.value.toLowerCase().replace(/[^a-z0-9_]/g, '_'))} + className="w-full px-3 py-2 border border-[#e5e7eb] rounded-xl focus:outline-none focus:border-[#f5a623] text-[#00293d] bg-white font-mono text-sm" + /> +
+ )}