Add indicator proof docs description

This commit is contained in:
Anton Romanov 2025-01-29 10:31:57 +04:00
parent bf57c20b96
commit 779ae11861
4 changed files with 56 additions and 4 deletions

View File

@ -7,6 +7,8 @@ public class IndicatorForm {
private int max; private int max;
private String proofDocuments;
public String getName() { public String getName() {
return name; return name;
} }
@ -30,4 +32,12 @@ public class IndicatorForm {
public void setMax(int max) { public void setMax(int max) {
this.max = max; this.max = max;
} }
public String getProofDocuments() {
return proofDocuments;
}
public void setProofDocuments(String proofDocuments) {
this.proofDocuments = proofDocuments;
}
} }

View File

@ -25,6 +25,7 @@ public class AdminService {
: indicatorService.getIndicatorById(indicatorForm.getId()); : indicatorService.getIndicatorById(indicatorForm.getId());
indicator.setName(indicatorForm.getName()); indicator.setName(indicatorForm.getName());
indicator.setMax(indicatorForm.getMax()); indicator.setMax(indicatorForm.getMax());
indicator.setProofDocuments(indicatorForm.getProofDocuments());
indicatorService.save(indicator); indicatorService.save(indicator);
} }

View File

@ -1,6 +1,7 @@
package ru.ulstu.indicator.model; package ru.ulstu.indicator.model;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.Lob;
import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
@ -17,12 +18,17 @@ public class Indicator extends BaseEntity {
@Max(30) @Max(30)
private int max; private int max;
@NotBlank
@Lob
private String proofDocuments;
public Indicator() { public Indicator() {
} }
public Indicator(IndicatorForm indicatorForm) { public Indicator(IndicatorForm indicatorForm) {
this.name = indicatorForm.getName(); this.name = indicatorForm.getName();
this.max = indicatorForm.getMax(); this.max = indicatorForm.getMax();
this.proofDocuments = indicatorForm.getProofDocuments();
} }
public String getName() { public String getName() {
@ -40,4 +46,12 @@ public class Indicator extends BaseEntity {
public void setMax(int max) { public void setMax(int max) {
this.max = max; this.max = max;
} }
public String getProofDocuments() {
return proofDocuments;
}
public void setProofDocuments(String proofDocuments) {
this.proofDocuments = proofDocuments;
}
} }

View File

@ -11,15 +11,42 @@
<input type="hidden" th:field="*{id}"> <input type="hidden" th:field="*{id}">
<div class="form-group"> <div class="form-group">
<label for="name">Название</label> <label for="name">Название</label>
<input type="text" required class="form-control" id="name" th:field="*{name}" <input th:field="*{name}"
id="name"
type="text"
required
class="form-control"
placeholder="Название показателя"> placeholder="Название показателя">
<p th:if="${#fields.hasErrors('name')}" th:class="${#fields.hasErrors('name')}? error"> <p th:if="${#fields.hasErrors('name')}"
Не может быть пустым</p> th:class="${#fields.hasErrors('name')}? error">
Не может быть пустым
</p>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="name">Максимальная сумма баллов</label> <label for="name">Максимальная сумма баллов</label>
<input type="number" required class="form-control" id="max" min="0" , max="30" th:field="*{max}"> <input th:field="*{max}"
required
id="max"
type="number"
class="form-control"
min="0"
max="30">
</div>
<div class="form-group">
<label for="name">Описание подтверждающих документов</label>
<textarea th:field="*{proofDocuments}"
required
id="proofDocuments"
class="form-control"
placeholder="Описание подтверждающих документов"
style="height: 100px">
</textarea>
<p th:if="${#fields.hasErrors('proofDocuments')}"
th:class="${#fields.hasErrors('proofDocuments')}? error">
Не может быть пустым
</p>
</div> </div>
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button> <button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>