[ac151d1] | 1 | <div class="container mt-5">
|
---|
| 2 | <h2>Додај коалиција</h2>
|
---|
| 3 | <form th:action="@{/admin/coalition/add}" th:object="${coalitionForm}" method="post">
|
---|
| 4 | <input type="hidden" th:field="*{id}" />
|
---|
| 5 |
|
---|
| 6 | <div class="form-group">
|
---|
| 7 | <label for="name">Name:</label>
|
---|
| 8 | <input type="text" id="name" th:field="*{name}" class="form-control" required />
|
---|
| 9 | </div>
|
---|
| 10 |
|
---|
| 11 | <div class="form-group">
|
---|
| 12 | <label for="moto">Moto:</label>
|
---|
| 13 | <input type="text" id="moto" th:field="*{motto}" class="form-control" required />
|
---|
| 14 | </div>
|
---|
| 15 |
|
---|
| 16 | <div class="form-group">
|
---|
| 17 | <label for="electionRealization">Election Realization:</label>
|
---|
| 18 | <select id="electionRealization" th:field="*{electionRealization}" class="form-select">
|
---|
| 19 | <option th:each="realization : ${realizations}" th:value="${realization.id}" th:text="${realization.name}"></option>
|
---|
| 20 | </select>
|
---|
| 21 | </div>
|
---|
| 22 |
|
---|
| 23 | <div class="container mt-5">
|
---|
| 24 | <div class="row">
|
---|
| 25 | <div class="col-md-5">
|
---|
| 26 | <label for="leftSelect">Сите партии</label>
|
---|
| 27 | <select id="leftSelect" class="form-control" size="10" multiple>
|
---|
| 28 | <option th:each="party : ${parties}" th:value="${party.id}" th:text="${party.name}"></option>
|
---|
| 29 | </select>
|
---|
| 30 | </div>
|
---|
| 31 | <div class="col-md-2 text-center">
|
---|
| 32 | <button id="moveRight" class="btn btn-primary mb-2">>></button>
|
---|
| 33 | <button id="moveLeft" class="btn btn-primary mb-2"><<</button>
|
---|
| 34 | </div>
|
---|
| 35 | <div class="col-md-5">
|
---|
| 36 | <label for="rightSelect">Избрани партии</label>
|
---|
| 37 | <select id="rightSelect" class="form-control" size="10" name="parties" multiple>
|
---|
| 38 | <!-- Options moved from left select will appear here -->
|
---|
| 39 | </select>
|
---|
| 40 | </div>
|
---|
| 41 | </div>
|
---|
| 42 | </div>
|
---|
| 43 |
|
---|
| 44 | <div class="form-group">
|
---|
| 45 | <button type="submit" class="btn btn-primary">Зачувај</button>
|
---|
| 46 | </div>
|
---|
| 47 | </form>
|
---|
| 48 | </div>
|
---|
| 49 |
|
---|
| 50 | <div class="container-fluid">
|
---|
| 51 | <table class="table table-striped table-hover">
|
---|
| 52 | <thead class="table-header">
|
---|
| 53 | <tr>
|
---|
| 54 | <th>#</th>
|
---|
| 55 | <th>Име</th>
|
---|
| 56 | <th>Мото</th>
|
---|
| 57 | <th>Реализација</th>
|
---|
| 58 | <th>Членови на коалиција</th>
|
---|
| 59 | </tr>
|
---|
| 60 | </thead>
|
---|
| 61 | <tbody>
|
---|
| 62 | <tr th:onclick="|window.location.href='/admin/coalition/${coalition.id}';|" th:each="coalition, iter : ${coalitions}">
|
---|
| 63 | <td th:text="${iter.count}"></td>
|
---|
| 64 | <td th:text="${coalition?.name}"></td>
|
---|
| 65 | <td th:text="${coalition?.motto}"></td>
|
---|
| 66 | <td th:text="${coalition?.electionRealization?.name}"></td>
|
---|
| 67 | <td th:text="${coalition?.getPartiesString()}"></td>
|
---|
| 68 | </tr>
|
---|
| 69 | </tbody>
|
---|
| 70 | </table>
|
---|
| 71 | </div>
|
---|
| 72 |
|
---|
| 73 | <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
---|
| 74 | <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
|
---|
| 75 | <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
---|
| 76 |
|
---|
| 77 | <script>
|
---|
| 78 | document.getElementById('moveRight').addEventListener('click', function(e) {
|
---|
| 79 | e.preventDefault();
|
---|
| 80 | moveSelectedOptions('leftSelect', 'rightSelect');
|
---|
| 81 | });
|
---|
| 82 |
|
---|
| 83 | document.getElementById('moveLeft').addEventListener('click', function(e) {
|
---|
| 84 | e.preventDefault();
|
---|
| 85 | moveSelectedOptions('rightSelect', 'leftSelect');
|
---|
| 86 | });
|
---|
| 87 |
|
---|
| 88 | function moveSelectedOptions(sourceId, destinationId) {
|
---|
| 89 | let sourceSelect = document.getElementById(sourceId);
|
---|
| 90 | let destinationSelect = document.getElementById(destinationId);
|
---|
| 91 |
|
---|
| 92 | let selectedOptions = Array.from(sourceSelect.selectedOptions);
|
---|
| 93 | selectedOptions.forEach(option => {
|
---|
| 94 | destinationSelect.appendChild(option);
|
---|
| 95 | });
|
---|
| 96 | }
|
---|
| 97 | </script>
|
---|