Skip to content

Commit

Permalink
pages changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoleNG18 committed Apr 17, 2024
1 parent 106214f commit 6fcf9f0
Show file tree
Hide file tree
Showing 16 changed files with 216 additions and 214 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import jakarta.validation.constraints.NotEmpty;
import pmgkn.pescores.pescores.validation.common.UniqueSchoolName;
import pmgkn.pescores.pescores.validation.common.ValidSchool;

import static pmgkn.pescores.pescores.domain.entity.constants.ValidationErrorMessages.*;

public class SchoolAddBindingDto {

@NotEmpty(message = SCHOOL_NAME_REQUIRED)
@UniqueSchoolName
@ValidSchool
private String schoolName;

@NotEmpty(message = CITY_NAME_REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class UserRegistrationBindingDto {
@ValidPersonName
private String lastName;
@ValidEmail
@UniqueUserEmail(message = EMAIL_UNIQUE)
@UniqueUserEmail
private String email;

private String school;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private StudentEntity mapToStudentEntity(StudentAddBindingDto studentAddBindingD
String loggedUser) {
return this.modelMapper.map(studentAddBindingDto, StudentEntity.class)
.setTeacher(this.userService.getUserByEmail(loggedUser))
.setStudentClass(this.classesService.getClassEntityByLoggedUserAndName(loggedUser,studentAddBindingDto.getStudentClass()));
.setStudentClass(this.classesService.getClassEntityByLoggedUserAndName(loggedUser, studentAddBindingDto.getStudentClass()));
}

public UUID editStudent(StudentUpdateBindingDto studentUpdate,
Expand Down Expand Up @@ -173,7 +173,7 @@ public boolean checkIfClassNumRepeats(String studentClass,
String loggedUser,
Integer studentNumber) {

ClassEntity classEntityByNameAndTeacher=this.classesService.getClassEntityByLoggedUserAndName(loggedUser,studentClass);
ClassEntity classEntityByNameAndTeacher = this.classesService.getClassEntityByLoggedUserAndName(loggedUser, studentClass);

List<Integer> collect = classEntityByNameAndTeacher.
getStudents()
Expand All @@ -196,4 +196,8 @@ public void deleteStudent(UUID id) {

this.studentRepository.deleteById(id);
}

public UUID getStudentClassId(UUID id) {
return this.studentRepository.findFirstById(id).getStudentClass().getId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ValidSchoolValidator implements ConstraintValidator<ValidSchool, St
public boolean isValid(String schoolName,
ConstraintValidatorContext context) {

if (schoolName.length() < 15) {
if (schoolName.length() < 10 || schoolName.length() > 40) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ public String editClass(
@PathVariable("id") UUID id,
@Valid ClassEditBindingDto classEdit,
BindingResult bindingResult,
RedirectAttributes redirectAttributes,
Principal principal) {
RedirectAttributes redirectAttributes) {

if (bindingResult.hasErrors()) {

Expand All @@ -138,7 +137,7 @@ public String editClass(

this.classesService.editClass(id, classEdit);

return "redirect:/classes/"+id;
return "redirect:/classes";
}

@PostMapping("/delete/{id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ public String deleteStudent(@PathVariable("idTeacher") UUID idTeacher,
@PathVariable("id") UUID id,
Principal principal) {

if (!this.userService.getUserById(idTeacher).equals(this.userService.getUserByEmail(principal.getName()))) {
if (!this.userService.getUserById(idTeacher).getSchool().getName().equals(this.userService.getUserByEmail(principal.getName()).getSchool().getName())) {
throw new ObjectNotFoundException("the info is not yours", ClassEntity.class);
}

UUID classId = this.studentsService.getStudentClassId(id);

this.studentsService.deleteStudent(id);

return "redirect:/classes";
return "redirect:/classes/" + classId;
}
}
9 changes: 4 additions & 5 deletions src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
navbar_language=Language
navbar_login=Log in
navbar_register=Register
navbar_add_school=How to add your school?
navbar_add_school=Add your school
navbar_dense_ball=Dense ball
navbar_jump=Jump
navbar_t_test=T-test
Expand Down Expand Up @@ -51,10 +51,9 @@ signup_email=Email
signup_last_name=Last name
signup_first_name=First name
err_name=Between 2 and 15 letters
err_email=Email should be unique
err_school=At least 15 symbols.
err_pass=At least 8 characters and 1 digit
err_name=Name must be between 2 and 15 letters
err_email=Email should be unique and valid
err_pass=Password should be at least 8 symbols with at least 1 digit
err_confirm_pass=Passwords should match
howto_welcome=Welcome to PE Scores
Expand Down
9 changes: 4 additions & 5 deletions src/main/resources/i18n/messages_bg.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
navbar_language = Език
navbar_login = Вход
navbar_register = Регистрация
navbar_add_school = Как да добавите училището си?
navbar_add_school = Добави училището си
navbar_dense_ball= Плътна топка
navbar_jump=Скок дължина
navbar_t_test=Т-тест
Expand Down Expand Up @@ -50,10 +50,9 @@ signup_email = Имейл
signup_last_name = Фамилия
signup_first_name = Име

err_name=Между 2 и 15 букви
err_email=Имейлът трябва да бъде уникален
err_school=Поне 15 символа
err_pass=Поне 8 символа и поне 1 число
err_name=Името трябва да бъде между 2 и 15 букви
err_email=Имейлът трябва да бъде уникален и валиден
err_pass=Паролата трябва да e поне 8 символа, от които
err_confirm_pass=Паролите трябва да съвпадат

howto_welcome=Добре дошли
Expand Down
56 changes: 4 additions & 52 deletions src/main/resources/static/css/all-schools.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
}

.all-schools {
width: 35%;
width: 70%;
padding: 2em;
background-color: #d8d7fe;
text-align: center;
border-radius: 1em;
Expand All @@ -33,8 +34,7 @@
margin-bottom: 0.5em;
display: flex;
flex-direction: row;
gap: 2em;
justify-content: center;
justify-content: space-between;
padding-bottom: 1em;
border-bottom: 2px solid #5d54c3;
}
Expand Down Expand Up @@ -96,52 +96,4 @@ form {
color: #5d54c3;
background-color: #d8d7fe;
border-color: #d8d7fe;
}


/*.classes-table{*/
/* width: 80%;*/
/* background-color: #d8d7fe;*/
/* border-radius:1em;*/
/* box-shadow: -4px -3px 45px 21px rgba(0,0,0,0.35);*/
/*}*/

/*.classes-table h2{*/
/* font-weight: 700;*/
/* margin-bottom: 1em;*/
/* margin-top: 1.5em;*/
/* color: #5d54c3;*/
/* text-align: center;*/
/*}*/

/*.classes-table table{*/
/* border: 3px solid #5d54c3;*/
/* margin: 0 auto;*/
/* border-collapse: collapse;*/
/* width: 90%;*/
/*}*/

/*.classes-table thead th{*/
/* padding: 0.5em;*/
/* font-weight: 400;*/
/* color: #5d54c3;*/
/* text-align: center;*/
/* border-bottom: 2px solid #5d54c3;*/
/* border-right: 2px solid #5d54c3;*/
/*}*/

/*.classes-table tbody td{*/
/* padding: 0.5em;*/
/* border-bottom: 2px solid #5d54c3;*/
/* border-right: 2px solid #5d54c3;*/
/*}*/

/*.classes-table tbody td input{*/
/* width: 98%;*/
/* background-color: #d8d7fe;*/
/* border: none;*/
/* outline: none;*/
/* font-weight: 400;*/
/* color: #5d54c3;*/
/* text-align: left;*/
/*}*/
}
2 changes: 1 addition & 1 deletion src/main/resources/static/css/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

.form {
height: 520px;
min-height: 400px;
width: 400px;
background-color: rgba(255, 255, 255, 0.13);
border-radius: 10px;
Expand Down
13 changes: 9 additions & 4 deletions src/main/resources/static/css/register.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.row-form {
display: flex;
flex-direction: row;
gap: 3em;
gap:3em;
}

.form {
Expand Down Expand Up @@ -72,21 +72,21 @@ option {
color: #5d54c3;
font-size: 13px;
font-weight: 500;
margin-top: 0.5em;
text-align: center;
border-radius: 5px;
width: 15em;
}

::placeholder {
color: #362bb7;
}

.errors-register {
width: 95%;
width: 70%;
border-radius: 4px;
text-align: center;
font-weight: 500;
font-size: 13px;
font-size: 11px;
background-color: #d8d7fe;
color: red;
margin: 1em auto;
Expand All @@ -105,6 +105,11 @@ option {
cursor: pointer;
}

.option-color {
color: #362bb7;
background-color: #d8d7fe;
}

.register-btn:hover {
background-color: #5d54c3;
color: #d8d7fe;
Expand Down
Loading

0 comments on commit 6fcf9f0

Please sign in to comment.