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 } - }; } diff --git a/src/SchoolManagementSystem.Presentation/package-lock.json b/src/SchoolManagementSystem.Presentation/package-lock.json index 1fcb99c..a274649 100644 --- a/src/SchoolManagementSystem.Presentation/package-lock.json +++ b/src/SchoolManagementSystem.Presentation/package-lock.json @@ -24,7 +24,6 @@ "react-bootstrap": "^2.4.0", "react-dom": "^18.2.0", "react-faq-component": "^1.3.4", - "react-highlight-words": "^0.18.0", "react-router-dom": "^6.3.0", "react-scripts": "^5.0.1", "school-calendar-react": "^1.0.1", @@ -15054,24 +15053,6 @@ "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" } }, - "node_modules/react-highlight-words": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/react-highlight-words/-/react-highlight-words-0.18.0.tgz", - "integrity": "sha512-5z+46eLPjB4JWgOhuQ0E+6iUPTD1U3amiy5KKjzZmeJ5zyvHr91hnzBT3UHya/KlySm5KRTKpYpba9vs67oO2A==", - "dependencies": { - "highlight-words-core": "^1.2.0", - "memoize-one": "^4.0.0", - "prop-types": "^15.5.8" - }, - "peerDependencies": { - "react": "^0.14.0 || ^15.0.0 || ^16.0.0-0 || ^17.0.0-0 || ^18.0.0-0" - } - }, - "node_modules/react-highlight-words/node_modules/memoize-one": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-4.0.3.tgz", - "integrity": "sha512-QmpUu4KqDmX0plH4u+tf0riMc1KHE1+lw95cMrLlXQAFOx/xnBtwhZ52XJxd9X2O6kwKBqX32kmhbhlobD0cuw==" - }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -28628,23 +28609,6 @@ "integrity": "sha512-oRXUfdr5OItsW4fRp5RMIUh4P2G1PAVMlFizWGR3ecwuCiNv/Akjx63yeOBrupCfh4AYqumPvQ3+hhKdxNkvxw==", "requires": {} }, - "react-highlight-words": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/react-highlight-words/-/react-highlight-words-0.18.0.tgz", - "integrity": "sha512-5z+46eLPjB4JWgOhuQ0E+6iUPTD1U3amiy5KKjzZmeJ5zyvHr91hnzBT3UHya/KlySm5KRTKpYpba9vs67oO2A==", - "requires": { - "highlight-words-core": "^1.2.0", - "memoize-one": "^4.0.0", - "prop-types": "^15.5.8" - }, - "dependencies": { - "memoize-one": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-4.0.3.tgz", - "integrity": "sha512-QmpUu4KqDmX0plH4u+tf0riMc1KHE1+lw95cMrLlXQAFOx/xnBtwhZ52XJxd9X2O6kwKBqX32kmhbhlobD0cuw==" - } - } - }, "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 7be739c..c1a5c56 100644 --- a/src/SchoolManagementSystem.Presentation/package.json +++ b/src/SchoolManagementSystem.Presentation/package.json @@ -19,7 +19,6 @@ "react-bootstrap": "^2.4.0", "react-dom": "^18.2.0", "react-faq-component": "^1.3.4", - "react-highlight-words": "^0.18.0", "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 44e0358..e43e907 100644 --- a/src/SchoolManagementSystem.Presentation/src/pages/Students.js +++ b/src/SchoolManagementSystem.Presentation/src/pages/Students.js @@ -178,7 +178,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.' }, ], @@ -202,7 +202,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.' }, ], @@ -248,6 +248,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." } ], ...getColumnSearchProps('address') @@ -268,6 +272,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." } ], filters: levels(), @@ -290,6 +299,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[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." } ], ...getColumnSearchProps('dateBecomeMember') @@ -306,6 +320,10 @@ const Students = () => { { whitespace: true, message: "Introduzca el número de teléfono." + }, + { + pattern: /^\d$/, + message: 'El teléfono solo puede contener números.' } ], ...getColumnSearchProps('phoneNumber') @@ -326,6 +344,10 @@ const Students = () => { { whitespace: true, message: "Introduzca los fondos." + }, + { + pattern: /^\d$/, + message: 'Los fondos solo pueden contener números.' } ], filters: [ @@ -347,7 +369,7 @@ const Students = () => { } else { return record.founds <= value[1]; } - } + } }, { title: 'Nombre del tutor', @@ -358,6 +380,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.' + } ], ...getColumnSearchProps('tuitorName') },