#21 -- Fix report indicator description

This commit is contained in:
Anton Romanov 2025-04-03 16:09:34 +04:00
parent 0ec47113d1
commit 7d40a52f19
2 changed files with 13 additions and 8 deletions

View File

@ -13,6 +13,7 @@ import ru.ulstu.indicator.model.Indicator;
import ru.ulstu.model.OffsetablePageRequest; import ru.ulstu.model.OffsetablePageRequest;
import ru.ulstu.report.model.Report; import ru.ulstu.report.model.Report;
import ru.ulstu.report.model.ReportListForm; import ru.ulstu.report.model.ReportListForm;
import ru.ulstu.report.model.ReportPeriod;
import ru.ulstu.report.service.ReportPeriodService; import ru.ulstu.report.service.ReportPeriodService;
import ru.ulstu.report.service.ReportService; import ru.ulstu.report.service.ReportService;
@ -42,17 +43,19 @@ public class ReportController {
@GetMapping("reportList") @GetMapping("reportList")
public String getReportPeriods(Model model) { public String getReportPeriods(Model model) {
model.addAttribute("reportListForm", new ReportListForm()); model.addAttribute("reportListForm", new ReportListForm());
model.addAttribute("reportPeriods", reportPeriodService.getReportPeriods()); List<ReportPeriod> periods = reportPeriodService.getReportPeriods();
model.addAttribute("canCreate", false); model.addAttribute("reportPeriods", periods);
model.addAttribute("canCreate", !periods.isEmpty() && reportService.canCreateReport(periods.getFirst()));
return "report/reportList"; return "report/reportList";
} }
@PostMapping("reportList") @PostMapping("reportList")
public String getReportPeriods(ReportListForm reportListForm, Model model) { public String getReportPeriods(ReportListForm reportListForm, Model model) {
model.addAttribute("reportListForm", reportListForm); model.addAttribute("reportListForm", reportListForm);
model.addAttribute("reportPeriods", reportPeriodService.getReportPeriods());
model.addAttribute("reports", reportService.getReports(reportListForm.getReportPeriod())); model.addAttribute("reports", reportService.getReports(reportListForm.getReportPeriod()));
model.addAttribute("canCreate", reportService.canCreateReport(reportListForm.getReportPeriod())); List<ReportPeriod> periods = reportPeriodService.getReportPeriods();
model.addAttribute("reportPeriods", periods);
model.addAttribute("canCreate", !periods.isEmpty() && reportService.canCreateReport(periods.getFirst()));
return "report/reportList"; return "report/reportList";
} }

View File

@ -2,14 +2,16 @@
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml"
layout:decorate="~{default}"> layout:decorate="~{default}">
<div class="container" layout:fragment="content"> <div class="container" layout:fragment="content">
<h3 th:text="${'Редактирование отчета аспиранта '} +${report.createDate}"></h3> <h3 th:text="${'Редактирование отчета аспиранта от '} +${#calendars.format(report.createDate, 'dd.MM.yyyy HH:mm')}"></h3>
<form action="#" th:action="@{/report/saveReport}" <form action="#" th:action="@{/report/saveReport}"
th:object="${report}" th:object="${report}"
method="post"> method="post">
<input type="hidden" th:field="*{id}"> <input type="hidden" th:field="*{id}">
<div class="form-group" th:each="i, ind : ${indicators}"> <div class="form-group" th:each="i, ind : ${indicators}">
<label th:text="${i.name}"></label> <p th:text="${i.name}"></p>
<p th:text="${i.proofDocuments}"></p>
<p th:text="'Максимальное количество баллов за показатель: '+ ${i.max}"></p>
<div class="form-group"> <div class="form-group">
<button class="form-control btn btn-danger" type="button" onclick="deleteAllFiles();">Удалить все <button class="form-control btn btn-danger" type="button" onclick="deleteAllFiles();">Удалить все
документы документы
@ -99,11 +101,11 @@
<a href="/report/reportList" class="btn btn-outline-dark">Отмена</a> <a href="/report/reportList" class="btn btn-outline-dark">Отмена</a>
</form> </form>
<div th:if="${indicators.totalPages > 0}" class="pagination"> <div th:if="${indicators.totalPages > 0}" class="pagination">
<span style="float: left; padding: 5px 5px;">Страницы:</span> <span style="float: left; padding: 5px 5px;">Показатели:</span>
</div> </div>
<div th:if="${indicators.totalPages > 0}" class="pagination" <div th:if="${indicators.totalPages > 0}" class="pagination"
th:each="pageNumber : ${pageNumbers}"> th:each="pageNumber : ${pageNumbers}">
<a th:href="@{/report/editReport(size=${indicators.size}, page=${pageNumber})}" <a th:href="@{'/report/editReport/' + ${report.id}+'(size=${indicators.size}, page=${pageNumber})'}"
th:text=${pageNumber} th:text=${pageNumber}
th:class="${pageNumber == indicators.number+1} ? active"></a> th:class="${pageNumber == indicators.number+1} ? active"></a>
</div> </div>