#98 deadline model and service edited

This commit is contained in:
Васин Антон 2019-05-06 20:17:10 +03:00
parent ee55e08fee
commit 4bab980f62
3 changed files with 17 additions and 10 deletions

View File

@ -66,9 +66,7 @@ public class Deadline extends BaseEntity {
return executor; return executor;
} }
public void setExecutor(String executor) { public void setExecutor(String executor) { this.executor = executor; }
this.executor = executor;
}
public Boolean getDone() { public Boolean getDone() {
return done; return done;

View File

@ -29,6 +29,8 @@ public class DeadlineService {
Deadline updateDeadline = deadlineRepository.findOne(deadline.getId()); Deadline updateDeadline = deadlineRepository.findOne(deadline.getId());
updateDeadline.setDate(deadline.getDate()); updateDeadline.setDate(deadline.getDate());
updateDeadline.setDescription(deadline.getDescription()); updateDeadline.setDescription(deadline.getDescription());
updateDeadline.setExecutor(deadline.getExecutor());
updateDeadline.setDone(deadline.getDone());
deadlineRepository.save(updateDeadline); deadlineRepository.save(updateDeadline);
return updateDeadline; return updateDeadline;
} }
@ -38,6 +40,8 @@ public class DeadlineService {
Deadline newDeadline = new Deadline(); Deadline newDeadline = new Deadline();
newDeadline.setDate(deadline.getDate()); newDeadline.setDate(deadline.getDate());
newDeadline.setDescription(deadline.getDescription()); newDeadline.setDescription(deadline.getDescription());
newDeadline.setExecutor(deadline.getExecutor());
newDeadline.setDone(deadline.getDone());
newDeadline = deadlineRepository.save(newDeadline); newDeadline = deadlineRepository.save(newDeadline);
return newDeadline; return newDeadline;
} }

View File

@ -71,20 +71,17 @@
<div class="form-group"> <div class="form-group">
<label>Дедлайны показателей:</label> <label>Дедлайны показателей:</label>
<div class="row" th:each="deadline, rowStat : *{deadlines}"> <div class="row" th:each="deadline, rowStat : *{deadlines}"
style="margin-bottom: 15px;">
<input type="hidden" th:field="*{deadlines[__${rowStat.index}__].id}"/> <input type="hidden" th:field="*{deadlines[__${rowStat.index}__].id}"/>
<div class="col-3 div-deadline-date"> <div class="col-6 div-deadline-date">
<input type="date" class="form-control form-deadline-date" name="deadline" <input type="date" class="form-control form-deadline-date" name="deadline"
th:field="*{deadlines[__${rowStat.index}__].date}"/> th:field="*{deadlines[__${rowStat.index}__].date}"/>
</div> </div>
<div class="col-3 div-deadline-description"> <div class="col-4 div-deadline-description">
<input class="form-control" type="text" placeholder="Описание" <input class="form-control" type="text" placeholder="Описание"
th:field="*{deadlines[__${rowStat.index}__].description}"/> th:field="*{deadlines[__${rowStat.index}__].description}"/>
</div> </div>
<div class="col-4 div-deadline-executor">
<input class="form-control" type="text" placeholder="Исполнитель"
th:field="*{deadlines[__${rowStat.index}__].executor}"/>
</div>
<div class="col-2"> <div class="col-2">
<a class="btn btn-danger float-right" <a class="btn btn-danger float-right"
th:onclick="|$('#deadlines${rowStat.index}\\.description').val(''); th:onclick="|$('#deadlines${rowStat.index}\\.description').val('');
@ -97,6 +94,14 @@
<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>
</div> </div>
<div class="form-group">
<div class="row" th:each="deadline, rowStat : *{deadlines}">
<div class="col-10 div-deadline-executor">
<input class="form-control" type="text" placeholder="Исполнитель"
th:field="*{deadlines[__${rowStat.index}__].executor}"/>
</div>
</div>
</div>
<div class="form-group"> <div class="form-group">
<input type="submit" id="addDeadline" name="addDeadline" class="btn btn-primary" <input type="submit" id="addDeadline" name="addDeadline" class="btn btn-primary"
value="Добавить дедлайн"/> value="Добавить дедлайн"/>