#70 added checking empty fields of deadline, fix bug on EventDto

This commit is contained in:
Nightblade73 2019-04-27 09:45:47 +04:00
parent dbcdb96dbf
commit e178cd1639
3 changed files with 13 additions and 3 deletions

View File

@ -78,6 +78,12 @@ public class ConferenceController {
@PostMapping(value = "/conference", params = "save")
public String save(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException {
filterEmptyDeadlines(conferenceDto);
for (Deadline deadline : conferenceDto.getDeadlines()) {
if (deadline.getDate() == null || deadline.getDescription().isEmpty()) {
errors.rejectValue("deadlines", "errorCode", "Все поля дедлайна должны быть заполнены");
return CONFERENCE_PAGE;
}
}
if (errors.hasErrors()) {
return CONFERENCE_PAGE;
}

View File

@ -62,10 +62,14 @@ public class EventDto {
this.createDate = event.getCreateDate();
this.updateDate = event.getUpdateDate();
this.description = event.getDescription();
this.paperDto = new PaperDto(event.getPaper());
this.recipients = convert(event.getRecipients(), UserDto::new);
if (paperDto != null) {
this.paperDto = new PaperDto(event.getPaper());
}
if (conferenceDto != null) {
this.conferenceDto = new ConferenceDto(event.getConference());
}
}
public Integer getId() {
return id;

View File

@ -150,10 +150,10 @@
</a>
<a class="paper-name"
th:unless="*{papers[__${rowStat.index}__].id !=null}">
<span th:replace="papers/fragments/paperStatusFragment :: paperStatus(paperStatus=*{papers[__${rowStat.index}__].status})"/>
<span th:text="*{papers[__${rowStat.index}__].title}">
Имя статьи
</span>
<img class="icon-paper" src="/img/conference/paper.png"/>
</a>
<input type="submit" class="icon icon-delete grey-border"
alt="Удалить" name="removePaper" th:value="${rowStat.index}"/>