Resolve "Bug: ошибка при попытке сохранить конференцию с невыбранными датами" #230
@ -92,6 +92,7 @@ public class ConferenceService extends BaseService {
|
|||||||
conferenceDto.setName(conferenceDto.getTitle());
|
conferenceDto.setName(conferenceDto.getTitle());
|
||||||
filterEmptyDeadlines(conferenceDto);
|
filterEmptyDeadlines(conferenceDto);
|
||||||
checkEmptyFieldsOfDeadline(conferenceDto, errors);
|
checkEmptyFieldsOfDeadline(conferenceDto, errors);
|
||||||
|
checkEmptyFieldsOfDates(conferenceDto, errors);
|
||||||
checkUniqueName(conferenceDto,
|
checkUniqueName(conferenceDto,
|
||||||
errors,
|
errors,
|
||||||
conferenceDto.getId(),
|
conferenceDto.getId(),
|
||||||
@ -301,6 +302,12 @@ public class ConferenceService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkEmptyFieldsOfDates(ConferenceDto conferenceDto, Errors errors) {
|
||||||
|
if (conferenceDto.getBeginDate() == null || conferenceDto.getEndDate() == null) {
|
||||||
|
errors.rejectValue("beginDate", "errorCode", "Даты должны быть заполнены");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void filterEmptyDeadlines(ConferenceDto conferenceDto) {
|
public void filterEmptyDeadlines(ConferenceDto conferenceDto) {
|
||||||
conferenceDto.setDeadlines(conferenceDto.getDeadlines().stream()
|
conferenceDto.setDeadlines(conferenceDto.getDeadlines().stream()
|
||||||
.filter(dto -> dto.getDate() != null || !org.springframework.util.StringUtils.isEmpty(dto.getDescription()))
|
.filter(dto -> dto.getDate() != null || !org.springframework.util.StringUtils.isEmpty(dto.getDescription()))
|
||||||
|
@ -42,12 +42,20 @@
|
|||||||
placeholder="http://"/>
|
placeholder="http://"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p th:if="${#fields.hasErrors('url')}" th:errors="*{url}"
|
||||||
|
class="alert alert-danger">Incorrect description</p>
|
||||||
|
<p class="help-block text-danger"></p>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="description">Описание:</label>
|
<label for="description">Описание:</label>
|
||||||
<textarea class="form-control" rows="8" th:field="*{description}" id="description">
|
<textarea class="form-control" rows="8" th:field="*{description}" id="description">
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p th:if="${#fields.hasErrors('description')}" th:errors="*{description}"
|
||||||
|
class="alert alert-danger">Incorrect description</p>
|
||||||
|
<p class="help-block text-danger"></p>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="deadlines">Дедлайны:</label>
|
<label for="deadlines">Дедлайны:</label>
|
||||||
<div class="deadline-list form-control list-group" id="deadlines">
|
<div class="deadline-list form-control list-group" id="deadlines">
|
||||||
@ -65,6 +73,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p th:if="${#fields.hasErrors('deadlines')}" th:errors="*{deadlines}"
|
<p th:if="${#fields.hasErrors('deadlines')}" th:errors="*{deadlines}"
|
||||||
class="alert alert-danger">Incorrect title</p>
|
class="alert alert-danger">Incorrect title</p>
|
||||||
<p class="help-block text-danger"></p>
|
<p class="help-block text-danger"></p>
|
||||||
@ -94,6 +103,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<p th:if="${#fields.hasErrors('beginDate') || #fields.hasErrors('endDate')}"
|
||||||
|
th:errors="*{beginDate}"
|
||||||
|
class="alert alert-danger">Incorrect date</p>
|
||||||
|
<p class="help-block text-danger"></p>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="members">Участники:</label>
|
<label for="members">Участники:</label>
|
||||||
@ -123,7 +136,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group d-flex justify-content-between flex-wrap">
|
<div class="form-group d-flex justify-content-between flex-wrap">
|
||||||
<!--<input type="hidden" th:value="*{ping}" th:name="ping"/>-->
|
|
||||||
<input id="ping-button" class="btn btn-primary"
|
<input id="ping-button" class="btn btn-primary"
|
||||||
type="submit" name="pingConference" value="Ping участникам"
|
type="submit" name="pingConference" value="Ping участникам"
|
||||||
th:disabled="*{id == null ? 'true' : 'false'}"/>
|
th:disabled="*{id == null ? 'true' : 'false'}"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user