[ac151d1] | 1 | <style>
|
---|
| 2 | .flex-wrapper {
|
---|
| 3 | display: flex;
|
---|
| 4 | flex-flow: row nowrap;
|
---|
| 5 | }
|
---|
| 6 |
|
---|
| 7 | .single-chart {
|
---|
| 8 | width: 100%;
|
---|
| 9 | justify-content: space-around;
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | .circular-chart {
|
---|
| 13 | display: block;
|
---|
| 14 | margin: 10px auto;
|
---|
| 15 | max-width: 50%;
|
---|
| 16 | /*max-height: 25px;*/
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | .circle-bg {
|
---|
| 20 | fill: none;
|
---|
| 21 | stroke: #eee;
|
---|
| 22 | stroke-width: 3.8;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | .circle {
|
---|
| 26 | fill: none;
|
---|
| 27 | stroke-width: 2.8;
|
---|
| 28 | stroke-linecap: round;
|
---|
| 29 | animation: progress 1s ease-out forwards;
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | @keyframes progress {
|
---|
| 33 | 0% {
|
---|
| 34 | stroke-dasharray: 0 100;
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | .circular-chart.blue .circle {
|
---|
| 39 | stroke: #1982d5;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | .percentage {
|
---|
| 43 | fill: #666;
|
---|
| 44 | font-family: sans-serif;
|
---|
| 45 | font-size: 0.5em;
|
---|
| 46 | text-anchor: middle;
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | #map {
|
---|
| 50 | max-width: 100%;
|
---|
| 51 | }
|
---|
| 52 | </style>
|
---|
| 53 |
|
---|
| 54 | <nav class="navbar bg-secondary bg-gradient container-fluid px-0">
|
---|
| 55 | <div class="container-fluid">
|
---|
| 56 | <span class="navbar-brand mb-0 h1">Резултати за реализација</span>
|
---|
| 57 | </div>
|
---|
| 58 | </nav>
|
---|
| 59 |
|
---|
| 60 | <nav class="navbar navbar-expand-lg navbar-light bg-light">
|
---|
| 61 | <div class="container-fluid">
|
---|
| 62 | <div class="container-fluid" id="navbarSupportedContent">
|
---|
| 63 | <form class="d-flex row gx-3" method="GET" action="/results">
|
---|
| 64 | <div class="col-xl-2 dropdown">
|
---|
| 65 | <label for="realizacija" class="m-0 me-2">Реализација</label>
|
---|
| 66 | <select class="form-select" id="realizacija" name="realizationId">
|
---|
| 67 | <option th:each="realization : ${realizations}" th:value="${realization.id}"
|
---|
| 68 | th:text="${realization.name}"></option>
|
---|
| 69 | </select>
|
---|
| 70 | </div>
|
---|
| 71 | <div class="col-xl-2 dropdown">
|
---|
| 72 | <label for="opshtina" class="m-0 me-2">Општина</label>
|
---|
| 73 | <select class="form-select" value="${municipalityId}}" id="opshtina" name="municipalityId">
|
---|
| 74 | <option th:each="municipality : ${municipalities}" th:value="${municipality.id}"
|
---|
| 75 | th:text="${municipality.name}"></option>
|
---|
| 76 | </select>
|
---|
| 77 | </div>
|
---|
| 78 | <div class="col-xl-2 dropdown">
|
---|
| 79 | <label for="izbirachko" class="m-0 me-2">Избирачко место</label>
|
---|
| 80 | <select class="form-select" id="izbirachko" name="pollingStationId">
|
---|
| 81 | <option value="">Сите избирачки места</option>
|
---|
| 82 | <option th:each="pollingStation : ${pollingStations}" th:value="${pollingStation.id}"
|
---|
| 83 | th:text="${pollingStation.name}"></option>
|
---|
| 84 | </select>
|
---|
| 85 | </div>
|
---|
| 86 | <div class="col-xl-2 dropdown">
|
---|
| 87 | <label for="chas" class="m-0 me-2">Час</label>
|
---|
| 88 | <select class="form-select" id="chas" name="time">
|
---|
| 89 | </select>
|
---|
| 90 | </div>
|
---|
| 91 | <div class="col-xl-2 d-flex flex-col align-items-center justify-content-center">
|
---|
| 92 | <!-- <label></label>-->
|
---|
| 93 | <button class="btn h-100 w-75 p-auto btn-outline-success" type="submit">Пребарај</button>
|
---|
| 94 | </div>
|
---|
| 95 | </form>
|
---|
| 96 | </div>
|
---|
| 97 | </div>
|
---|
| 98 | </nav>
|
---|
| 99 |
|
---|
| 100 | <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
|
---|
| 101 | <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js"></script>
|
---|
| 102 |
|
---|
| 103 | <nav class="navbar bg-secondary-subtle container-fluid px-0 my-5">
|
---|
| 104 | <div class="container-fluid">
|
---|
| 105 | <span class="navbar-brand m-auto mb-0 h1" th:text="|Податоци за реализацијата: ${realization.name}|"></span>
|
---|
| 106 | </div>
|
---|
| 107 | </nav>
|
---|
| 108 |
|
---|
| 109 | <div class="container mt-5">
|
---|
| 110 | <div class="row mt-5">
|
---|
| 111 | <div class="col col-xl-6 col-md-12 d-flex flex-col justify-content-center align-items-center">
|
---|
| 112 | <table class="table table-striped">
|
---|
| 113 | <thead>
|
---|
| 114 | <th>#</th>
|
---|
| 115 | <th>Учесник</th>
|
---|
| 116 | <th>Број на гласови</th>
|
---|
| 117 | <th>Процент на гласови</th>
|
---|
| 118 | <th>Процент на гласови</th>
|
---|
| 119 | </thead>
|
---|
| 120 | <tbody>
|
---|
| 121 | <tr th:each="candidacy, iter : ${candidacies}">
|
---|
| 122 | <td style="vertical-align: middle" th:text="${iter.count}"></td>
|
---|
| 123 | <td style="vertical-align: middle" th:text="${candidacy.participantName}"></td>
|
---|
| 124 | <td style="vertical-align: middle" th:text="${candidacy.votesCount}"></td>
|
---|
| 125 | <td style="vertical-align: middle" th:text="${candidacy.votesPercentage}"></td>
|
---|
| 126 | <!-- <td th:text="${candidacy.percent()}"></td>-->
|
---|
| 127 | <td>
|
---|
| 128 | <div class="single-chart">
|
---|
| 129 | <svg viewBox="0 0 36 36" class="circular-chart blue" >
|
---|
| 130 | <path class="circle-bg"
|
---|
| 131 | d="M18 2.0845
|
---|
| 132 | a 15.9155 15.9155 0 0 1 0 31.831
|
---|
| 133 | a 15.9155 15.9155 0 0 1 0 -31.831"
|
---|
| 134 | />
|
---|
| 135 | <path class="circle"
|
---|
| 136 | th:stroke-dasharray="|${candidacy.votesPercentage}, 100|"
|
---|
| 137 | d="M18 2.0845
|
---|
| 138 | a 15.9155 15.9155 0 0 1 0 31.831
|
---|
| 139 |
|
---|
| 140 | a 15.9155 15.9155 0 0 1 0 -31.831"></path>
|
---|
| 141 | <text x="18" y="20.35" class="percentage" th:text="|${#numbers.formatDecimal(candidacy.votesPercentage, 1, 2, 'COMMA')}%|">30%</text>
|
---|
| 142 |
|
---|
| 143 | </svg>
|
---|
| 144 | </div>
|
---|
| 145 | </td>
|
---|
| 146 | </tr>
|
---|
| 147 | </tbody>
|
---|
| 148 | </table>
|
---|
| 149 | </div>
|
---|
| 150 | <div class="col col-xl-6 col-md-12 d-flex flex-col justify-content-center align-items-center">
|
---|
| 151 | <div id="map"></div>
|
---|
| 152 | </div>
|
---|
| 153 | </div>
|
---|
| 154 | </div>
|
---|
| 155 | <div class="flex-wrapper">
|
---|
| 156 |
|
---|
| 157 | </div>
|
---|
| 158 |
|
---|
| 159 | <script>
|
---|
| 160 | // Function to generate a random color
|
---|
| 161 | function getRandomColor() {
|
---|
| 162 | var letters = '0123456789ABCDEF';
|
---|
| 163 | var color = '#';
|
---|
| 164 | for (var i = 0; i < 6; i++) {
|
---|
| 165 | color += letters[Math.floor(Math.random() * 16)];
|
---|
| 166 | }
|
---|
| 167 | return color;
|
---|
| 168 | }
|
---|
| 169 |
|
---|
| 170 | function getRandomRedColor() {
|
---|
| 171 | function getRandomLowValue() {
|
---|
| 172 | return Math.floor(Math.random() * 56); // Random value between 0 and 55
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | function componentToHex(c) {
|
---|
| 176 | const hex = c.toString(16);
|
---|
| 177 | return hex.length == 1 ? "0" + hex : hex;
|
---|
| 178 | }
|
---|
| 179 |
|
---|
| 180 | const red = 200 + Math.floor(Math.random() * 56); // Random value between 200 and 255
|
---|
| 181 | const green = getRandomLowValue();
|
---|
| 182 | const blue = getRandomLowValue();
|
---|
| 183 | return `#${componentToHex(red)}${componentToHex(green)}${componentToHex(blue)}`;
|
---|
| 184 | }
|
---|
| 185 |
|
---|
| 186 | // Set random color for elements with class .circular-chart.blue .circle
|
---|
| 187 | document.addEventListener('DOMContentLoaded', function() {
|
---|
| 188 | var elements = document.querySelectorAll('.circular-chart.blue .circle');
|
---|
| 189 | elements.forEach(function(element) {
|
---|
| 190 | element.style.stroke = getRandomColor();
|
---|
| 191 | });
|
---|
| 192 |
|
---|
| 193 | Object.keys(simplemaps_countrymap_mapdata.state_specific).forEach(x => {
|
---|
| 194 | selectElement = document.getElementById("realizacija")
|
---|
| 195 | selectedOption = selectElement.options[selectElement.selectedIndex];
|
---|
| 196 | selectedId = selectedOption.value;
|
---|
| 197 | selectElement.addEventListener('change', function() {
|
---|
| 198 | selectedOption = selectElement.options[selectElement.selectedIndex];
|
---|
| 199 | selectedId = selectedOption.value;
|
---|
| 200 | console.log('Realizacija ID:', selectedId);
|
---|
| 201 | });
|
---|
| 202 | simplemaps_countrymap_mapdata.state_specific[x].url = 'http://localhost:8080/results?opshtinaId=' + x + '&realizationId=' + selectedId;
|
---|
| 203 | // simplemaps_countrymap_mapdata.state_specific[x].color = getRandomRedColor();
|
---|
| 204 | })
|
---|
| 205 | });
|
---|
| 206 |
|
---|
| 207 | </script>
|
---|
| 208 |
|
---|
| 209 | <script src="mapdata.js"></script>
|
---|
| 210 | <script src="countrymap.js"></script> |
---|