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()
|
computerService.findFilteredComputers(null, null, null, null, id).stream()
|
||||||
.map(ComputerDto::new)
|
.map(ComputerDto::new)
|
||||||
.toList());
|
.toList());
|
||||||
|
model.addAttribute("allComputers",
|
||||||
|
computerService.findAllComputers().stream()
|
||||||
|
.map(ComputerDto::new)
|
||||||
|
.toList());
|
||||||
return "cabinet-edit";
|
return "cabinet-edit";
|
||||||
}
|
}
|
||||||
@PostMapping(value = {"", "/{id}"})
|
@PostMapping(value = {"", "/{id}"})
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<label for="number" class="form-label">Номер кабинета</label>
|
<label for="number" class="form-label">Номер кабинета</label>
|
||||||
<input type="text" class="form-control" id="number" th:field="${cabinetDto.number}" required="true">
|
<input type="text" class="form-control" id="number" th:field="${cabinetDto.number}" required="true">
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
<div th:if="${id != null}" class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -55,13 +55,14 @@
|
|||||||
Назад
|
Назад
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</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">
|
<div class="mb-3">
|
||||||
<label for="computers" class="form-label">Добавить компьютер</label>
|
<label for="computers" class="form-label">Добавить компьютер</label>
|
||||||
<select class="form-select" id="computers" required>
|
<select class="form-select" id="computers" required>
|
||||||
<option disabled value="">Выберите компьютер</option>
|
<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>
|
</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>
|
<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>
|
</div>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
layout:decorate="~{default}">
|
layout:decorate="~{default}">
|
||||||
<head>
|
<head>
|
||||||
|
<title>Сайт</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div layout:fragment="content">
|
<div layout:fragment="content">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user