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