computers in cabinets fix
This commit is contained in:
parent
5e26c1aa1e
commit
30120ca18d
@ -41,6 +41,10 @@ public class CabinetMvcController {
|
||||
computerService.findFilteredComputers(null, null, null, null, id).stream()
|
||||
.map(ComputerDto::new)
|
||||
.toList());
|
||||
model.addAttribute("allComputers",
|
||||
computerService.findAllComputers().stream()
|
||||
.map(ComputerDto::new)
|
||||
.toList());
|
||||
return "cabinet-edit";
|
||||
}
|
||||
@PostMapping(value = {"", "/{id}"})
|
||||
|
@ -12,7 +12,7 @@
|
||||
<label for="number" class="form-label">Номер кабинета</label>
|
||||
<input type="text" class="form-control" id="number" th:field="${cabinetDto.number}" required="true">
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<div th:if="${id != null}" class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -46,22 +46,23 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="mb-3">
|
||||
<button type="submit" class="btn btn-primary button-fixed">
|
||||
<span th:if="${id == null}">Добавить</span>
|
||||
<span th:if="${id != null}">Обновить</span>
|
||||
</button>
|
||||
<a class="btn btn-secondary button-fixed" th:href="@{/index}">
|
||||
Назад
|
||||
</a>
|
||||
<div class="mb-3">
|
||||
<button type="submit" class="btn btn-primary button-fixed">
|
||||
<span th:if="${id == null}">Добавить</span>
|
||||
<span th:if="${id != null}">Обновить</span>
|
||||
</button>
|
||||
<a class="btn btn-secondary button-fixed" th:href="@{/index}">
|
||||
Назад
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form th:action="@{/index/{id}/computer(id=${id})}" id="addComputerForm" method="post">
|
||||
<form th:if="${id != null}" th:action="@{/index/{id}/computer(id=${id})}" id="addComputerForm" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="computers" class="form-label">Добавить компьютер</label>
|
||||
<select class="form-select" id="computers" required>
|
||||
<option disabled value="">Выберите компьютер</option>
|
||||
<option th:each="computer, iterator: ${computers}" th:text="${computer.modelName}" th:value="${computer.id}">
|
||||
<option th:each="computer, iterator: ${allComputers}" th:text="${computer.modelName}" th:value="${computer.id}">
|
||||
</select>
|
||||
<button class="btn btn-outline-secondary" id="addComputerButton" th:attr="onclick=|document.getElementById('addComputerForm').action = document.getElementById('addComputerForm').action + '/' + document.getElementById('computers').value ; document.getElementById('addComputerForm}').submit()|">Добавить</button>
|
||||
</div>
|
||||
|
@ -3,6 +3,7 @@
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<head>
|
||||
<title>Сайт</title>
|
||||
</head>
|
||||
<body>
|
||||
<div layout:fragment="content">
|
||||
|
Loading…
x
Reference in New Issue
Block a user