21 |
21 |
<script type="text/javascript" src="js/jquery.js"></script>
|
22 |
22 |
<script type="text/javascript" src="js/bootstrap.min.js"></script>
|
23 |
23 |
<script type="text/javascript" src="js/bootstrap-select.min.js"></script>
|
|
24 |
|
|
25 |
<link href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" rel="stylesheet">
|
|
26 |
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
|
24 |
27 |
</head>
|
25 |
28 |
<body>
|
26 |
29 |
<div id="test"></div>
|
27 |
30 |
<main role="main">
|
28 |
31 |
|
29 |
32 |
<div class="container">
|
30 |
|
<a href="/" class="btn btn-success mb-2">Zpět</a>
|
31 |
33 |
<h1>
|
32 |
34 |
Sestava - Studenti - studijní programy
|
33 |
35 |
</h1>
|
|
36 |
<a href="/" class="btn btn-success mb-2">Zpět</a>
|
34 |
37 |
</div>
|
35 |
38 |
|
36 |
39 |
<form th:object="${configuration}" method="post" th:action="@{/configuration(configurationID=${configuration.id})}">
|
... | ... | |
44 |
47 |
</div>
|
45 |
48 |
|
46 |
49 |
<span>Parametry:</span>
|
47 |
|
<div class="col-md-7">
|
|
50 |
<div class="col-md-9">
|
48 |
51 |
<table class="table">
|
49 |
52 |
<thead>
|
50 |
53 |
<tr>
|
... | ... | |
54 |
57 |
</tr>
|
55 |
58 |
</thead>
|
56 |
59 |
<tbody>
|
57 |
|
<tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}">
|
|
60 |
<tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" class="parameter-row">
|
|
61 |
<input type="hidden" class="parameterIndex" th:value="${itemStat.index}">
|
58 |
62 |
<td>
|
59 |
|
<span class="select-text-padding"
|
|
63 |
<span class="select-text-padding parameter-name"
|
60 |
64 |
th:text="${parameterInConfiguration.parameter.name}"></span>
|
61 |
65 |
</td>
|
62 |
|
<td>
|
|
66 |
<td class="select-action-buttons">
|
63 |
67 |
<optional th:each="location : ${parameterInConfiguration.parameter.locations}">
|
64 |
|
<span th:if="${location.name.equals('Sloupec')}"
|
|
68 |
<span th:if="${location.name?.equals('Řádek')}"
|
65 |
69 |
th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
|
66 |
|
class="select-action-padding select-action-button select-input-action-margin-collapse">
|
|
70 |
class="select-action-padding select-action-button select-input-action-margin-collapse unselectable row-button"
|
|
71 |
th:classappend="(${configuration.parametersInConfiguration[__${itemStat.index}__].location.name?.equals('Řádek')}) ? select-action-headlight" >
|
67 |
72 |
<i class="fas fa-align-justify"></i>
|
68 |
73 |
</span>
|
69 |
|
<span th:if="${location.name.equals('Řádek')}"
|
|
74 |
<span th:if="${location.name?.equals('Sloupec')}"
|
70 |
75 |
th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
|
71 |
|
class="select-action-padding select-action-button select-input-action-margin-collapse">
|
|
76 |
class="select-action-padding select-action-button select-input-action-margin-collapse unselectable column-button"
|
|
77 |
th:classappend="(${configuration.parametersInConfiguration[__${itemStat.index}__].location.name?.equals('Sloupec')}) ? select-action-headlight">
|
72 |
78 |
<i class="fas fa-align-justify transform"></i>
|
73 |
79 |
</span>
|
74 |
|
<span th:if="${location.name.equals('Hodnota')}"
|
|
80 |
<span th:if="${location.name?.equals('Hodnota')}"
|
75 |
81 |
th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
|
76 |
|
class="select-action-padding select-action-button select-input-action-margin-collapse">
|
|
82 |
class="select-action-padding select-action-button select-input-action-margin-collapse unselectable value-button"
|
|
83 |
th:classappend="(${configuration.parametersInConfiguration[__${itemStat.index}__].location.name?.equals('Hodnota')}) ? select-action-headlight">
|
77 |
84 |
<i class="fas fa-heading"></i>
|
78 |
85 |
</span>
|
79 |
86 |
</optional>
|
80 |
87 |
</td>
|
81 |
88 |
<td class="s">
|
82 |
89 |
<div class="col select-filter">
|
83 |
|
<select class="form-control" style="{width:60px;}" id="exampleFormControlSelect1"
|
|
90 |
<select class="form-control"
|
84 |
91 |
th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].operator.name}">
|
85 |
|
<option th:value="zadny" selected value> -- Zvolte operátor --</option>
|
|
92 |
<option th:value="zadny" selected value> -- Operátor --</option>
|
86 |
93 |
<option th:each="operator : ${parameterInConfiguration.parameter.operators}"
|
87 |
94 |
th:text="${operator.name}" th:value="${operator.name}"></option>
|
88 |
95 |
</select>
|
... | ... | |
90 |
97 |
th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].operatorValue}">
|
91 |
98 |
</div>
|
92 |
99 |
</td>
|
|
100 |
|
|
101 |
<select class="form-control hidden" th:id="'function-select-' + ${itemStat.index}"
|
|
102 |
th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].functions}"
|
|
103 |
multiple>
|
|
104 |
<option th:each="function : ${parameterInConfiguration.parameter.functions}"
|
|
105 |
th:text="${function.name}" th:value="${{function.id}}"></option>
|
|
106 |
</select>
|
93 |
107 |
</tr>
|
94 |
108 |
</tbody>
|
95 |
109 |
</table>
|
... | ... | |
108 |
122 |
<th class="col-3-p"></th>
|
109 |
123 |
</tr>
|
110 |
124 |
</thead>
|
111 |
|
<tbody>
|
112 |
|
<tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Řádek')}">
|
|
125 |
<tbody id="row-wrapper" class="sortable">
|
|
126 |
<tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Řádek')}" class="row-parameter parameter">
|
|
127 |
<input type="hidden" th:field="${configuration.parametersInConfiguration[__${i.index}__].locations}">
|
113 |
128 |
<td>
|
114 |
|
<span th:text="${parameterInConfiguration.parameter.name}"></span>
|
|
129 |
<span class="parameter-name" th:text="${parameterInConfiguration.parameter.name}"></span>
|
115 |
130 |
</td>
|
116 |
131 |
<td>
|
117 |
132 |
<input th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].columnName}"
|
118 |
|
type="text" class="form-control select-filter-input" id="name">
|
|
133 |
type="text" class="form-control select-filter-input">
|
119 |
134 |
</td>
|
120 |
135 |
<td>
|
121 |
136 |
<span><i class="fas fa-sort"></i></span>
|
... | ... | |
138 |
153 |
<th class="col-3-p"></th>
|
139 |
154 |
</tr>
|
140 |
155 |
</thead>
|
141 |
|
<tbody>
|
142 |
|
<tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Sloupec')}">
|
|
156 |
<tbody id="column-wrapper" class="sortable">
|
|
157 |
<tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Sloupec')}" class="column-parameter parameter">
|
|
158 |
<input type="hidden" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.id}" value="2">
|
|
159 |
|
143 |
160 |
<td>
|
144 |
|
<span th:text="${parameterInConfiguration.parameter.name}"></span>
|
|
161 |
<span class="parameter-name" th:text="${parameterInConfiguration.parameter.name}"></span>
|
145 |
162 |
</td>
|
146 |
163 |
<td>
|
147 |
164 |
<input th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].columnName}"
|
... | ... | |
167 |
184 |
<th class="col-2-p">Funkce</th>
|
168 |
185 |
</tr>
|
169 |
186 |
</thead>
|
170 |
|
<tbody>
|
171 |
|
<tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Hodnota')}">
|
|
187 |
<tbody id="value-wrapper">
|
|
188 |
<tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Hodnota')}" class="value-parameter parameter">
|
|
189 |
<input type="hidden" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.id}">
|
|
190 |
|
172 |
191 |
<td>
|
173 |
|
<span th:text="${parameterInConfiguration.parameter.name}"></span>
|
|
192 |
<span class="parameter-name" th:text="${parameterInConfiguration.parameter.name}"></span>
|
174 |
193 |
</td>
|
175 |
194 |
<td>
|
176 |
|
<select class="form-control" style="{width:60px;}"
|
177 |
|
id="exampleFormControlSelect1"
|
|
195 |
<select class="form-control"
|
178 |
196 |
th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].functions}"
|
179 |
197 |
multiple>
|
180 |
198 |
<option th:each="function : ${parameterInConfiguration.parameter.functions}"
|
181 |
199 |
th:text="${function.name}" th:value="${{function.id}}"></option>
|
182 |
200 |
</select>
|
183 |
201 |
</td>
|
184 |
|
|
185 |
202 |
</tr>
|
186 |
203 |
</tbody>
|
187 |
204 |
</table>
|
... | ... | |
213 |
230 |
|
214 |
231 |
<div th:if="${contingencyTableRows}" class="container box">
|
215 |
232 |
<div class="col-md-12">
|
216 |
|
|
217 |
|
|
218 |
233 |
<table class="tg table">
|
219 |
|
|
220 |
|
|
221 |
234 |
<tr th:each="contingencyTableRow : ${contingencyTableRows}">
|
222 |
235 |
<div class="tg-align" th:if="${contingencyTableRow.isHeader()}">
|
223 |
236 |
<th class="tg-align" th:each="contingencyTableRowCell : ${contingencyTableRow.getCells()}">
|
... | ... | |
248 |
261 |
</html>
|
249 |
262 |
<script type="text/javascript">
|
250 |
263 |
$("select").selectpicker();
|
|
264 |
</script>
|
|
265 |
<script>
|
|
266 |
$(document).ready(function() {
|
|
267 |
|
|
268 |
$('.select-action-button').on('click', function () {
|
|
269 |
if ($(this).hasClass('select-action-headlight'))
|
|
270 |
{
|
|
271 |
$(this).removeClass('select-action-headlight');
|
|
272 |
removeParameter(getParameterTitle($(this)), getParameterType($(this)));
|
|
273 |
}
|
|
274 |
else
|
|
275 |
{
|
|
276 |
$(this).closest('.select-action-buttons').find('.select-action-button').removeClass('select-action-headlight');
|
|
277 |
|
|
278 |
removeFromAll(getParameterTitle($(this)));
|
|
279 |
|
|
280 |
$(this).addClass('select-action-headlight');
|
|
281 |
|
|
282 |
addParameter(getParameterIndex($(this)),
|
|
283 |
getParameterTitle($(this)),
|
|
284 |
getParameterType($(this)),
|
|
285 |
getParameterHiddenValue($(this)));
|
|
286 |
|
|
287 |
initParameters();
|
|
288 |
}
|
|
289 |
});
|
|
290 |
|
|
291 |
initParameters();
|
|
292 |
|
|
293 |
});
|
|
294 |
|
|
295 |
function removeFromAll(title) {
|
|
296 |
$rows = $('.selected-input-container');
|
|
297 |
|
|
298 |
$rows.each(function () {
|
|
299 |
$(this).find('.parameter-name').each(function () {
|
|
300 |
if ($(this).text() == title)
|
|
301 |
{
|
|
302 |
$(this).closest('.parameter').remove();
|
|
303 |
}
|
|
304 |
})
|
|
305 |
});
|
|
306 |
}
|
|
307 |
|
|
308 |
function getParameterIndex(button) {
|
|
309 |
return $(button).closest('.parameter-row').find('.parameterIndex').val();
|
|
310 |
}
|
|
311 |
|
|
312 |
function addParameter(index, parameterName, type, hiddenValue) {
|
|
313 |
var row = document.createElement('tr');
|
|
314 |
row.classList.add(type + '-parameter', 'parameter');
|
|
315 |
|
|
316 |
let hiddenInput = document.createElement('input');
|
|
317 |
hiddenInput.type = 'hidden';
|
|
318 |
hiddenInput.id = `parametersInConfiguration${index}.location.id`;
|
|
319 |
hiddenInput.name = `parametersInConfiguration[${index}].location.id`;
|
|
320 |
hiddenInput.value = hiddenValue;
|
|
321 |
|
|
322 |
row.appendChild(hiddenInput);
|
|
323 |
|
|
324 |
var firstTd = document.createElement('td');
|
|
325 |
|
|
326 |
var firstTdBody = document.createElement('span');
|
|
327 |
firstTdBody.classList.add('parameter-name');
|
|
328 |
firstTdBody.innerHTML = parameterName;
|
|
329 |
|
|
330 |
firstTd.appendChild(firstTdBody);
|
|
331 |
|
|
332 |
row.appendChild(firstTd);
|
|
333 |
|
|
334 |
var thirdTd = document.createElement('td');
|
|
335 |
|
|
336 |
var thirdTdBody;
|
|
337 |
|
|
338 |
|
|
339 |
if (type == 'value')
|
|
340 |
{
|
|
341 |
thirdTdBody = $('#function-select-' + index).clone()[0];
|
|
342 |
|
|
343 |
$(thirdTdBody).removeClass('hidden');
|
|
344 |
}
|
|
345 |
else
|
|
346 |
{
|
|
347 |
var secondTd = document.createElement('td');
|
|
348 |
|
|
349 |
var secondTdBody = document.createElement('input');
|
|
350 |
secondTdBody.type = 'text';
|
|
351 |
secondTdBody.classList.add('form-control', 'select-filter-input-name');
|
|
352 |
secondTdBody.name = `parametersInConfiguration[${index}].columnName`;
|
|
353 |
|
|
354 |
secondTd.appendChild(secondTdBody);
|
|
355 |
|
|
356 |
row.appendChild(secondTd);
|
|
357 |
|
|
358 |
thirdTdBody = document.createElement('span');
|
|
359 |
thirdTdBody.innerHTML = "<i class=\"fas fa-sort\"></i>";
|
|
360 |
}
|
|
361 |
|
|
362 |
thirdTd.appendChild(thirdTdBody);
|
|
363 |
|
|
364 |
row.appendChild(thirdTd);
|
|
365 |
|
|
366 |
$('#' + type + '-wrapper').append($(row));
|
|
367 |
|
|
368 |
}
|
|
369 |
|
|
370 |
function removeParameter(title, parameterClass) {
|
|
371 |
$rows = $('.' + parameterClass + '-parameter');
|
|
372 |
|
|
373 |
$rows.each(function () {
|
|
374 |
$(this).find('.parameter-name').each(function () {
|
|
375 |
if ($(this).text() == title)
|
|
376 |
{
|
|
377 |
$(this).closest('.' + parameterClass + '-parameter').remove();
|
|
378 |
}
|
|
379 |
})
|
|
380 |
});
|
|
381 |
}
|
|
382 |
|
|
383 |
function getParameterType(context) {
|
|
384 |
if ($(context).hasClass('column-button'))
|
|
385 |
{
|
|
386 |
return 'column';
|
|
387 |
}
|
|
388 |
else if ($(context).hasClass('row-button'))
|
|
389 |
{
|
|
390 |
return 'row';
|
|
391 |
}
|
|
392 |
else if ($(context).hasClass('value-button'))
|
|
393 |
{
|
|
394 |
return 'value';
|
|
395 |
}
|
|
396 |
}
|
|
397 |
|
|
398 |
function getParameterHiddenValue(context) {
|
|
399 |
if ($(context).hasClass('column-button'))
|
|
400 |
{
|
|
401 |
return 1;
|
|
402 |
}
|
|
403 |
else if ($(context).hasClass('row-button'))
|
|
404 |
{
|
|
405 |
return 2;
|
|
406 |
}
|
|
407 |
else if ($(context).hasClass('value-button'))
|
|
408 |
{
|
|
409 |
return 3;
|
|
410 |
}
|
|
411 |
}
|
|
412 |
|
|
413 |
function getParameterTitle(context) {
|
|
414 |
return $(context).closest('.parameter-row').find('.parameter-name').text();
|
|
415 |
}
|
|
416 |
|
|
417 |
|
|
418 |
function initParameters()
|
|
419 |
{
|
|
420 |
$('.sortable').sortable();
|
|
421 |
$("select").selectpicker('refresh');
|
|
422 |
}
|
|
423 |
|
|
424 |
|
251 |
425 |
</script>
|
re #7883 - added javascript to template assembly