fix
This commit is contained in:
@@ -64,6 +64,8 @@ export default function SectionDetailPage() {
|
|||||||
uiConfig: undefined,
|
uiConfig: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [editSlug, setEditSlug] = useState('');
|
||||||
|
|
||||||
// Options editor state
|
// Options editor state
|
||||||
const [optionInput, setOptionInput] = useState({ value: '', label: '' });
|
const [optionInput, setOptionInput] = useState({ value: '', label: '' });
|
||||||
|
|
||||||
@@ -128,6 +130,7 @@ export default function SectionDetailPage() {
|
|||||||
|
|
||||||
const openEditFieldModal = (field: ProfileField) => {
|
const openEditFieldModal = (field: ProfileField) => {
|
||||||
setSelectedField(field);
|
setSelectedField(field);
|
||||||
|
setEditSlug(field.slug);
|
||||||
setFieldForm({
|
setFieldForm({
|
||||||
sectionId,
|
sectionId,
|
||||||
name: field.name,
|
name: field.name,
|
||||||
@@ -183,7 +186,11 @@ export default function SectionDetailPage() {
|
|||||||
setModalError('');
|
setModalError('');
|
||||||
try {
|
try {
|
||||||
const { sectionId: _, ...updateData } = fieldForm;
|
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();
|
closeFieldModal();
|
||||||
fetchData();
|
fetchData();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -669,6 +676,19 @@ export default function SectionDetailPage() {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{fieldModalType === 'edit' && (
|
||||||
|
<div>
|
||||||
|
<label className="block text-sm font-medium text-[#00293d] mb-1">
|
||||||
|
Slug
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={editSlug}
|
||||||
|
onChange={(e) => 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"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-[#00293d] mb-1">
|
<label className="block text-sm font-medium text-[#00293d] mb-1">
|
||||||
Field Type <span className="text-red-500">*</span>
|
Field Type <span className="text-red-500">*</span>
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ export interface CreateFieldDto {
|
|||||||
|
|
||||||
export interface UpdateFieldDto {
|
export interface UpdateFieldDto {
|
||||||
name?: string;
|
name?: string;
|
||||||
|
slug?: string;
|
||||||
fieldType?: FieldType;
|
fieldType?: FieldType;
|
||||||
description?: string;
|
description?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user