From 88b8f470154c440ab8348649362c2c57488e5c54 Mon Sep 17 00:00:00 2001 From: LRiera24 Date: Tue, 5 Jul 2022 14:15:09 -0400 Subject: [PATCH] Date Validation ok (sin hora ni tener en cuenta no bisiesto) --- .../package-lock.json | 21 +++++++++++++++++++ .../package.json | 1 + .../src/pages/Students.js | 18 ++++++++++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/SchoolManagementSystem.Presentation/package-lock.json b/src/SchoolManagementSystem.Presentation/package-lock.json index 2f55168..3f21f31 100644 --- a/src/SchoolManagementSystem.Presentation/package-lock.json +++ b/src/SchoolManagementSystem.Presentation/package-lock.json @@ -23,6 +23,7 @@ "react": "^18.2.0", "react-bootstrap": "^2.4.0", "react-dom": "^18.2.0", + "react-faq-component": "^1.3.4", "react-router-dom": "^6.3.0", "react-scripts": "^5.0.1", "school-calendar-react": "^1.0.1", @@ -15033,6 +15034,20 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" }, + "node_modules/react-faq-component": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/react-faq-component/-/react-faq-component-1.3.4.tgz", + "integrity": "sha512-oRXUfdr5OItsW4fRp5RMIUh4P2G1PAVMlFizWGR3ecwuCiNv/Akjx63yeOBrupCfh4AYqumPvQ3+hhKdxNkvxw==", + "engines": { + "node": ">=8", + "npm": ">=5" + }, + "peerDependencies": { + "prop-types": "^15.5.4", + "react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -28578,6 +28593,12 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" }, + "react-faq-component": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/react-faq-component/-/react-faq-component-1.3.4.tgz", + "integrity": "sha512-oRXUfdr5OItsW4fRp5RMIUh4P2G1PAVMlFizWGR3ecwuCiNv/Akjx63yeOBrupCfh4AYqumPvQ3+hhKdxNkvxw==", + "requires": {} + }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", diff --git a/src/SchoolManagementSystem.Presentation/package.json b/src/SchoolManagementSystem.Presentation/package.json index 4198833..c1a5c56 100644 --- a/src/SchoolManagementSystem.Presentation/package.json +++ b/src/SchoolManagementSystem.Presentation/package.json @@ -18,6 +18,7 @@ "react": "^18.2.0", "react-bootstrap": "^2.4.0", "react-dom": "^18.2.0", + "react-faq-component": "^1.3.4", "react-router-dom": "^6.3.0", "react-scripts": "^5.0.1", "school-calendar-react": "^1.0.1", diff --git a/src/SchoolManagementSystem.Presentation/src/pages/Students.js b/src/SchoolManagementSystem.Presentation/src/pages/Students.js index 18110ba..038bb05 100644 --- a/src/SchoolManagementSystem.Presentation/src/pages/Students.js +++ b/src/SchoolManagementSystem.Presentation/src/pages/Students.js @@ -47,7 +47,7 @@ const Students = () => { message: "Introduzca el nombre." }, { - pattern: /^\S{2,}(\s\S{2,})?(\s\S{2,})?(\s\S{2,})?$/, + pattern: /^[a-zA-Z]{2,}(\s[a-zA-Z]{2,})?(\s[a-zA-Z]{2,})?(\s[a-zA-Z]{2,})?$/, message: 'El nombre solo puede contener letras (dos como mínimo). En caso de ser compuesto, deben estar separados por un único espacio.' }, ] @@ -70,7 +70,7 @@ const Students = () => { message: "Introduzca los apellidos." }, { - pattern: /^\S{2,}(\s\S{2,})?(\s\S{2,})?(\s\S{2,})?$/, + pattern: /^[a-zA-Z]{2,}(\s[a-zA-Z]{2,})?(\s[a-zA-Z]{2,})?(\s[a-zA-Z]{2,})?$/, message: 'Los apellidos solo pueden contener letras (dos como mínimo) y estar separados por un único espacio.' }, ] @@ -114,6 +114,10 @@ const Students = () => { { whitespace: true, message: "Introduzca la dirección." + }, + { + pattern: /^[a-zA-Z0-9,#/&\-.\s]{1,100}$/, + message: "La dirección debe tener máximo 100 caracteres." } ] }, @@ -133,6 +137,11 @@ const Students = () => { { whitespace: true, message: "Introduzca el grado de escolaridad." + }, + { + pattern: /^\bPrimaria|Secundaria|EscuelaOficios|TecnicoMedio|Preuniversitario|Universidad|Posgrado\b$/, + message: "El nivel escolar debe ser de uno de los siguientes tipos: Primaria, Secundaria, EscuelaOficios, " + + "TecnicoMedio, Preuniversitario, Universidad, Posgrado." } ], }, @@ -152,6 +161,11 @@ const Students = () => { { whitespace: true, message: "Introduzca la fecha de inicio en la sede." + }, + { + //pattern: /^(0[1-9]|1[0-2])[-/.](0[1-9]|[12][0-9]|3[01])[-/.]\d{4}$/, + pattern: /^\b1[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|2[-/.](0[1-9]|[12][0-9]|2[08])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|3[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|4[-/.](0[1-9]|[12][0-9]|3[00])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|5[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|6[-/.](0[1-9]|[12][0-9]|3[00])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|7[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|8[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|9[-/.](0[1-9]|[12][0-9]|3[00])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|10[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|11[-/.](0[1-9]|[12][0-9]|3[00])[-/.](19[0-9][0-9]|20[01][0-9]|2022)|12[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[01][0-9]|2022)\b$/, + message: "El formato de la fecha debe ser M/d/yyyy. Ej: 4/22/2021." } ] },