From 88b8f470154c440ab8348649362c2c57488e5c54 Mon Sep 17 00:00:00 2001 From: LRiera24 Date: Tue, 5 Jul 2022 14:15:09 -0400 Subject: [PATCH 1/3] 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." } ] }, From 074487179715df522a4d5431c086110efa2defc1 Mon Sep 17 00:00:00 2001 From: Andry Date: Tue, 5 Jul 2022 14:27:33 -0400 Subject: [PATCH 2/3] Revisa Lau --- .../Data/SchoolInitializer.cs | 103 +++++++++++++++--- 1 file changed, 88 insertions(+), 15 deletions(-) diff --git a/src/SchoolManagementSystem.Infrastructure/Data/SchoolInitializer.cs b/src/SchoolManagementSystem.Infrastructure/Data/SchoolInitializer.cs index 98e690d..e644b4e 100644 --- a/src/SchoolManagementSystem.Infrastructure/Data/SchoolInitializer.cs +++ b/src/SchoolManagementSystem.Infrastructure/Data/SchoolInitializer.cs @@ -32,6 +32,7 @@ public static class SchoolInitializer Name = "Frank", PhoneNumber = 57881239, }; + static Tuitor roger = new Tuitor { Name = "Roger", PhoneNumber = 54444444 }; #region Students static Student sasha = new Student{ @@ -89,6 +90,27 @@ public static class SchoolInitializer ScholarityLevel = Domain.Enums.Education.Preuniversitario, Tuitor = frank }; + static Student Jorgito = new Student { + IDCardNo = "14253681562", + Name = "Jorgito", + LastName = "Gonzalez Gutierrez", + PhoneNumber = 54763443, + Address = "Test Direccion de jorgito", + DateBecomedMember = new DateTime(2022, 3, 5), + ScholarityLevel = Domain.Enums.Education.Primaria +}; + static Student Guillermo = new Student + { + IDCardNo = "99111165645", + Name = "Guillermo", + LastName = "Rodriguez de Vivar", + PhoneNumber = 53545515, + Address = "Test Direccion de Guillermo", + DateBecomedMember = new DateTime(2020, 11, 25), + Tuitor = roger, + Founds = 2, + ScholarityLevel = Domain.Enums.Education.Universidad + }; #endregion @@ -105,6 +127,7 @@ public static class SchoolInitializer #endregion #region Courses + static Course aleman = new Course { Name = "Aleman 1", Price = 55, Type = "Idioma" }; static Course algebra = new Course{ Name = "Algebra", Price = 200, @@ -163,7 +186,25 @@ public static class SchoolInitializer StartDate = new DateTime(2020,01,01), EndDate = new DateTime(2020,11,09), }; - + static CourseGroup Aleman = new CourseGroup + { + Course = aleman, + Name = "Aula T2", + Capacity = 14, + StartDate = new DateTime(2022, 3, 12), + EndDate = new DateTime(2022, 5, 12), + Teacher = new Teacher + { + IDCardNo = "00523573122", + Name = "Leo", + LastName = "LLosa", + PhoneNumber = 55555555, + Address = "Calle Berlin", + DateBecomedMember = new DateTime(2020, 5, 14), + CourseGroups = new List() + } + }; + #endregion #endregion @@ -526,11 +567,12 @@ private static Student[] GetStudents() DateBecomedMember = new DateTime(2020, 2, 1), Tuitor = new Tuitor { Name = "Elena", PhoneNumber = 54637721 }, Founds = 3, ScholarityLevel = Domain.Enums.Education.Posgrado }, - new Student { IDCardNo = "123456789012", Name = "Pablo", LastName = "Curbelo Paez", PhoneNumber = 56784392, - Address = "Pocitos No.23 e/ Czda de Vento y ALmendares", + new Student { IDCardNo = "12312312312", Name = "Pablito", LastName = "Curbelito Paecito", PhoneNumber = 56784555, + Address = "Se mudo", DateBecomedMember = new DateTime(2020, 2, 1), Tuitor = new Tuitor { Name = "Elena", PhoneNumber = 54637721 }, Founds = 3, ScholarityLevel = Domain.Enums.Education.Primaria }, + }; } @@ -540,6 +582,7 @@ private static Tuitor[] GetTuitors() { new Tuitor { Name = "Josefa", PhoneNumber = 54674982 }, new Tuitor { Name = "Mari", PhoneNumber = 54637121 }, + new Tuitor{ Name = "Roger", PhoneNumber = 54444444 }, }; } @@ -620,11 +663,11 @@ private static StudentPaymentRecordForAdditionalService[] GetStudentPaymentRecor } }; } - + private static StudentPaymentRecordPerCourseGroup[] GetStudentPaymentRecordPerCourseGroups() { var course = new Course { Name = "Transito 101", Price = 16, Type = "Transito" }; - + var courseGroup = new CourseGroup { Course = course, @@ -637,6 +680,7 @@ private static StudentPaymentRecordPerCourseGroup[] GetStudentPaymentRecordPerCo CourseGroups = new List() } }; + var student = new Student { IDCardNo = "93084574542", Name = "Pablo", LastName = "Curbelo Paez", PhoneNumber = 56784392, @@ -645,8 +689,7 @@ private static StudentPaymentRecordPerCourseGroup[] GetStudentPaymentRecordPerCo Tuitor = new Tuitor { Name = "Elena", PhoneNumber = 54637721 }, Founds = 3, ScholarityLevel = Domain.Enums.Education.Posgrado }; - - return new [] + return new StudentPaymentRecordPerCourseGroup[] { new StudentPaymentRecordPerCourseGroup { @@ -661,16 +704,27 @@ private static StudentPaymentRecordPerCourseGroup[] GetStudentPaymentRecordPerCo new StudentPaymentRecordPerCourseGroup { - CourseGroup = courseGroup, - CourseGroupCourseId = course.Id, - CourseGroupId = courseGroup.Id, + CourseGroup = Aleman, + CourseGroupCourseId = Aleman.Id, + CourseGroupId = Aleman.Id, Date = new DateTime(2017,8,20), - DatePaid = new DateTime(2017,9, 14), - StudentId = student.Id, - Student = student + DatePaid = new DateTime(2022, 5, 12), + StudentId = Guillermo.Id, + Student = Guillermo + }, + new StudentPaymentRecordPerCourseGroup + { + CourseGroup = Aleman, + CourseGroupCourseId = Aleman.Id, + CourseGroupId = Aleman.Id, + Date = new DateTime(2017,8,20), + DatePaid = new DateTime(2022, 5, 12), + StudentId = Jorgito.Id, + Student = Jorgito } }; } + // agregar mas private static WorkerPayRecordByPosition[] GetWorkerPayRecordByPositions() { @@ -750,7 +804,7 @@ private static StudentCourseGroupRelation[] GetStudentCourseGroupRelations() }, Founds = 3, ScholarityLevel = Domain.Enums.Education.Posgrado }; - return new [] + return new StudentCourseGroupRelation[] { new StudentCourseGroupRelation { @@ -830,8 +884,27 @@ private static StudentCourseGroupRelation[] GetStudentCourseGroupRelations() StartDate = historiaDelArte.StartDate, Student = Carlos, StudentId = Carlos.Id + }, + new StudentCourseGroupRelation + { + CourseGroup = Aleman, + CourseGroupCourseId = Aleman.Id, + CourseGroupId = Aleman.Id, + EndDate = Aleman.EndDate, + StartDate = Aleman.StartDate, + Student = Guillermo, + StudentId = Guillermo.Id + }, + new StudentCourseGroupRelation + { + CourseGroup = Aleman , + CourseGroupCourseId = Aleman.Id, + CourseGroupId = Aleman.Id, + EndDate = Aleman.EndDate, + StartDate = Aleman.StartDate, + Student = Jorgito, + StudentId = Jorgito.Id } - }; } From 2a85db5e2cb28621f7e0ed7675661e340e847496 Mon Sep 17 00:00:00 2001 From: LRiera24 Date: Tue, 5 Jul 2022 15:23:45 -0400 Subject: [PATCH 3/3] Update Students.js --- .../src/pages/Students.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/SchoolManagementSystem.Presentation/src/pages/Students.js b/src/SchoolManagementSystem.Presentation/src/pages/Students.js index 038bb05..42a7393 100644 --- a/src/SchoolManagementSystem.Presentation/src/pages/Students.js +++ b/src/SchoolManagementSystem.Presentation/src/pages/Students.js @@ -164,7 +164,7 @@ const Students = () => { }, { //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$/, + pattern: /^\b1[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19[0-9][0-9]|20[0-2][0-2])|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." } ] @@ -181,6 +181,10 @@ const Students = () => { { whitespace: true, message: "Introduzca el número de teléfono." + }, + { + pattern: /^\d$/, + message: 'El teléfono solo puede contener números.' } ] }, @@ -193,6 +197,10 @@ const Students = () => { compare: (a, b) => a.founds - b.founds }, rules: [ + { + pattern: /^\d$/, + message: 'Los fondos solo pueden contener números.' + } ] }, { @@ -204,6 +212,10 @@ const Students = () => { compare: (a, b) => a.tuitorName.localeCompare(b.tuitorName) }, rules: [ + { + 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.' + } ], }, { @@ -215,6 +227,10 @@ const Students = () => { compare: (a, b) => a.tuitorPhoneNumber - b.tuitorPhoneNumber }, rules: [ + { + pattern: /^\d$/, + message: 'El teléfono solo puede contener números.' + } ] } ];