Improve the frontend and repository layer

This commit is contained in:
Urtzi Alfaro
2025-10-23 07:44:54 +02:00
parent 8d30172483
commit 07c33fa578
112 changed files with 14726 additions and 2733 deletions

View File

@@ -257,6 +257,9 @@ export interface AddModalProps {
// Validation
validationErrors?: Record<string, string>;
onValidationError?: (errors: Record<string, string>) => void;
// Field change callback for dynamic form behavior
onFieldChange?: (fieldName: string, value: any) => void;
}
/**
@@ -285,6 +288,7 @@ export const AddModal: React.FC<AddModalProps> = ({
initialData = EMPTY_INITIAL_DATA,
validationErrors = EMPTY_VALIDATION_ERRORS,
onValidationError,
onFieldChange,
}) => {
const [formData, setFormData] = useState<Record<string, any>>({});
const [fieldErrors, setFieldErrors] = useState<Record<string, string>>({});
@@ -356,6 +360,9 @@ export const AddModal: React.FC<AddModalProps> = ({
onValidationError?.(newErrors);
}
}
// Notify parent component of field change
onFieldChange?.(fieldName, value);
};
const findFieldByName = (fieldName: string): AddModalField | undefined => {