WIP - Basic adding and deleting field

This commit is contained in:
Francisco Gaona
2026-01-06 10:01:02 +01:00
parent 8e4690c9c9
commit 6c73eb1658
3 changed files with 128 additions and 27 deletions

View File

@@ -560,13 +560,29 @@ const saveField = async () => {
defaultValue: fieldForm.value.defaultValue,
}
// Extract type-specific database fields
const typeAttrs = fieldForm.value.typeAttributes || {}
// For text fields
if (fieldForm.value.type === 'text' && typeAttrs.maxLength) {
payload.length = typeAttrs.maxLength
}
// For number and currency fields
if ((fieldForm.value.type === 'number' || fieldForm.value.type === 'currency') && typeAttrs.scale !== undefined) {
payload.scale = typeAttrs.scale
if (typeAttrs.scale > 0) {
payload.precision = 10 // Default precision for decimals
}
}
// Merge UI metadata
const uiMetadata: any = {
placeholder: fieldForm.value.placeholder,
helpText: fieldForm.value.helpText,
}
// Add type-specific attributes
// Add type-specific attributes to UI metadata
if (fieldForm.value.typeAttributes) {
Object.assign(uiMetadata, fieldForm.value.typeAttributes)
}