diff --git a/frontend/src/certs/NewRegister/ManualRegistration.tsx b/frontend/src/certs/NewRegister/ManualRegistration.tsx index eed0e3d..7fbeead 100644 --- a/frontend/src/certs/NewRegister/ManualRegistration.tsx +++ b/frontend/src/certs/NewRegister/ManualRegistration.tsx @@ -21,6 +21,16 @@ export function ManualRegistration(props: { let datePicker: HTMLInputElement | undefined; + const courseHasCustomLabel = () => { + const courseId = selectedCourseId(); + if (courseId === null) { + return false; + } + + const course = courseMap()[courseId]; + return course?.course_has_custom_label === true; + }; + const register: HTMLEventFn = async(ev) => { ev.preventDefault(); @@ -30,6 +40,15 @@ export function ManualRegistration(props: { return; } + if (courseHasCustomLabel() && customLabel() === "") { + setError("Escoge una denominaciĆ³n"); + + console.log(error()); + + setTimeout(() => setError(""), 5000); + return; + } + const date = datePicker.value; if (subject === null) { @@ -57,16 +76,6 @@ export function ManualRegistration(props: { setCustomLabel(""); }; - const courseHasCustomLabel = () => { - const courseId = selectedCourseId(); - if (courseId === null) { - return false; - } - - const course = courseMap()[courseId]; - return course?.course_has_custom_label === true; - }; - return ( <>
@@ -112,8 +121,7 @@ export function ManualRegistration(props: { />

{error()}