Projekt

Obecné

Profil

Stáhnout (19.6 KB) Statistiky
| Větev: | Revize:
1 2cdd3adc mlinha
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
2
<head>
3 cfe48a96 cagy
    <meta charset="utf-8">
4
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
5
    <meta name="description" content="">
6
    <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
7
    <meta name="generator" content="Jekyll v3.8.6">
8
    <title>Album example · Bootstrap</title>
9
    <link rel="canonical" href="https://getbootstrap.com/docs/4.4/examples/album/">
10
11
    <!-- Bootstrap core CSS -->
12
    <link href="css/bootstrap.min.css" rel="stylesheet">
13
14
    <link href="css/bootstrap-select.min.css" rel="stylesheet">
15
    <link href="css/fontawesome.min.css" rel="stylesheet">
16
    <link href="css/style.css" rel="stylesheet">
17
18 2cdd3adc mlinha
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
19
            integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
20
            crossorigin="anonymous"></script>
21 cfe48a96 cagy
    <script type="text/javascript" src="js/jquery.js"></script>
22
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
23
    <script type="text/javascript" src="js/bootstrap-select.min.js"></script>
24 e49f76e4 cagy
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>
27 2868bb9a Vojtěch Danišík
</head>
28
<body>
29 cfe48a96 cagy
<div id="test"></div>
30
<main role="main">
31
32
    <div class="container">
33
        <h1>
34
            Sestava - Studenti - studijní programy
35
        </h1>
36 e49f76e4 cagy
        <a href="/" class="btn btn-success mb-2">Zpět</a>
37 cfe48a96 cagy
    </div>
38
39 b439853d mlinha
    <form th:object="${configuration}" method="post" th:action="@{/configuration(configurationID=${configuration.id})}">
40 2cdd3adc mlinha
        <input type="hidden" th:field="*{assembly.id}" th:value="${configuration.assembly?.getId()}"/>
41 cfe48a96 cagy
        <div class="container box">
42
            <div class="col-md-12">
43
                <div class="col-md-12 form-group row">
44
                    <label for="exampleFormControlSelect1" class="name-input-label">Titulek tabulky:</label>
45 2cdd3adc mlinha
                    <input type="text" class="form-control name-input" th:field="*{tableName}"
46
                           th:value="${configuration?.tableName}">
47 cfe48a96 cagy
                </div>
48
49
                <span>Parametry:</span>
50 e49f76e4 cagy
                <div class="col-md-9">
51 cfe48a96 cagy
                    <table class="table">
52
                        <thead>
53
                        <tr>
54
                            <th class="col-1">Parametr</th>
55
                            <th class="col-2">Umístění</th>
56
                            <th class="col-3">Filtry</th>
57
                        </tr>
58
                        </thead>
59
                        <tbody>
60 e49f76e4 cagy
                        <tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" class="parameter-row">
61
                           <input type="hidden" class="parameterIndex" th:value="${itemStat.index}">
62 cfe48a96 cagy
                            <td>
63 e49f76e4 cagy
                                <span class="select-text-padding parameter-name"
64 2cdd3adc mlinha
                                      th:text="${parameterInConfiguration.parameter.name}"></span>
65 b439853d mlinha
                            </td>
66 e49f76e4 cagy
                            <td class="select-action-buttons">
67 b439853d mlinha
                                <optional th:each="location : ${parameterInConfiguration.parameter.locations}">
68 50c00b46 mlinha
                                    <span th:if="${location.name?.equals('Řádek')}"
69 2cdd3adc mlinha
                                      th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
70 e49f76e4 cagy
                                      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"  >
72 50c00b46 mlinha
                                        <i class="fas fa-align-justify"></i>
73
                                    </span>
74 e49f76e4 cagy
                                    <span th:if="${location.name?.equals('Sloupec')}"
75 2cdd3adc mlinha
                                          th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
76 e49f76e4 cagy
                                          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">
78 50c00b46 mlinha
                                        <i class="fas fa-align-justify transform"></i>
79
                                    </span>
80 e49f76e4 cagy
                                    <span th:if="${location.name?.equals('Hodnota')}"
81 2cdd3adc mlinha
                                          th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
82 e49f76e4 cagy
                                          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">
84 50c00b46 mlinha
                                        <i class="fas fa-heading"></i>
85
                                    </span>
86 b439853d mlinha
                                </optional>
87 cfe48a96 cagy
                            </td>
88
                            <td class="s">
89
                                <div class="col select-filter">
90 e49f76e4 cagy
                                    <select class="form-control"
91 2cdd3adc mlinha
                                            th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].operator.name}">
92 e49f76e4 cagy
                                        <option th:value="zadny" selected value> -- Operátor --</option>
93 2cdd3adc mlinha
                                        <option th:each="operator : ${parameterInConfiguration.parameter.operators}"
94
                                                th:text="${operator.name}" th:value="${operator.name}"></option>
95 cfe48a96 cagy
                                    </select>
96 2cdd3adc mlinha
                                    <input type="text" class="form-control select-filter-input" id="name"
97
                                           th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].operatorValue}">
98 cfe48a96 cagy
                                </div>
99
                            </td>
100 e49f76e4 cagy
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>
107 cfe48a96 cagy
                        </tr>
108
                        </tbody>
109
                    </table>
110
                </div>
111
112
                <div class="selected-input-container">
113
                    <div class="selected-input-box">
114
                        <div class="selected-input-box-icon">
115
                            <i class="fas fa-align-justify"></i>
116
                        </div>
117
                        <table class="table table-parameter">
118
                            <thead>
119
                            <tr>
120
                                <th class="col-1-p"></th>
121
                                <th class="col-2-p">Vlastní název</th>
122
                                <th class="col-3-p"></th>
123
                            </tr>
124
                            </thead>
125 e49f76e4 cagy
                            <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 50c00b46 mlinha
                                <input type="hidden" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.id}" value="1">
128
                                <input type="hidden" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].order}">
129 cfe48a96 cagy
                                <td>
130 e49f76e4 cagy
                                    <span class="parameter-name" th:text="${parameterInConfiguration.parameter.name}"></span>
131 cfe48a96 cagy
                                </td>
132
                                <td>
133 2cdd3adc mlinha
                                    <input th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].columnName}"
134 e49f76e4 cagy
                                           type="text" class="form-control select-filter-input">
135 cfe48a96 cagy
                                </td>
136
                                <td>
137
                                    <span><i class="fas fa-sort"></i></span>
138
                                </td>
139
                            </tr>
140
                            </tbody>
141
                        </table>
142
                    </div>
143
144
145
                    <div class="selected-input-box">
146
                        <div class="selected-input-box-icon">
147
                            <i class="fas fa-align-justify transform"></i>
148
                        </div>
149
                        <table class="table table-parameter">
150
                            <thead>
151
                            <tr>
152
                                <th class="col-1-p"></th>
153
                                <th class="col-2-p">Vlastní název</th>
154
                                <th class="col-3-p"></th>
155
                            </tr>
156
                            </thead>
157 e49f76e4 cagy
                            <tbody id="column-wrapper" class="sortable">
158
                            <tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Sloupec')}" class="column-parameter parameter">
159
                                <input type="hidden" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.id}" value="2">
160 50c00b46 mlinha
                                <input type="hidden" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].order}">
161 cfe48a96 cagy
                                <td>
162 e49f76e4 cagy
                                    <span class="parameter-name" th:text="${parameterInConfiguration.parameter.name}"></span>
163 cfe48a96 cagy
                                </td>
164
                                <td>
165 2cdd3adc mlinha
                                    <input th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].columnName}"
166
                                           type="text" class="form-control select-filter-input" id="name">
167 cfe48a96 cagy
                                </td>
168
                                <td>
169
                                    <span><i class="fas fa-sort"></i></span>
170
                                </td>
171
                            </tr>
172
                            </tbody>
173
                        </table>
174
                    </div>
175
176
177
                    <div class="selected-input-box">
178
                        <div class="selected-input-box-icon">
179
                            <i class="fas fa-heading"></i>
180
                        </div>
181
                        <table class="table table-parameter">
182
                            <thead>
183
                            <tr>
184
                                <th class="col-1-p"></th>
185 2cdd3adc mlinha
                                <th class="col-2-p">Funkce</th>
186 cfe48a96 cagy
                            </tr>
187
                            </thead>
188 e49f76e4 cagy
                            <tbody id="value-wrapper">
189
                            <tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Hodnota')}" class="value-parameter parameter">
190 50c00b46 mlinha
                                <input type="hidden" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.id}" value="3">
191
                                <input type="hidden" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].order}">
192 cfe48a96 cagy
                                <td>
193 e49f76e4 cagy
                                    <span class="parameter-name" th:text="${parameterInConfiguration.parameter.name}"></span>
194 cfe48a96 cagy
                                </td>
195
                                <td>
196 e49f76e4 cagy
                                    <select class="form-control"
197 2cdd3adc mlinha
                                            th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].functions}"
198
                                            multiple>
199
                                        <option th:each="function : ${parameterInConfiguration.parameter.functions}"
200
                                                th:text="${function.name}" th:value="${{function.id}}"></option>
201 cfe48a96 cagy
                                    </select>
202
                                </td>
203
                            </tr>
204
                            </tbody>
205
                        </table>
206
                    </div>
207
                </div>
208
209
210
                <div class="col-md-12 form-group row template-input">
211
                    <label for="exampleFormControlSelect1" class="template-input-label">Vlastní název šablony:</label>
212
                    <div class="">
213 2cdd3adc mlinha
                        <input type="text" required="required" class="form-control select-filter-input" id="name"
214
                               th:field="${configuration.name}">
215 cfe48a96 cagy
                    </div>
216
217
                    <button type="submit" class="btn btn-success mb-2 template-input-submit">Uložit šablonu</button>
218
                </div>
219
220
221
                <div class="buttons-wrap">
222 2cdd3adc mlinha
                    <button type="submit" class="btn btn-secondary mb-2 " name="generate-table">Vygenerovat tabulku
223
                    </button>
224 cfe48a96 cagy
                    <button type="submit" class="btn btn-secondary mb-2 " name="export-xls">Export do XLS</button>
225
                    <button type="submit" class="btn btn-secondary mb-2 " name="export-pdf">Export do PDF</button>
226
                </div>
227 2868bb9a Vojtěch Danišík
            </div>
228
        </div>
229 cfe48a96 cagy
    </form>
230
231
232
    <div th:if="${contingencyTableRows}" class="container box">
233
        <div class="col-md-12">
234
            <table class="tg table">
235 2cdd3adc mlinha
                <tr th:each="contingencyTableRow : ${contingencyTableRows}">
236
                    <div class="tg-align" th:if="${contingencyTableRow.isHeader()}">
237
                        <th class="tg-align" th:each="contingencyTableRowCell : ${contingencyTableRow.getCells()}">
238
                            <span th:text="${contingencyTableRowCell.getValue()}"></span>
239
                        </th>
240
                    </div>
241
                    <div th:unless="${contingencyTableRow.isHeader()}">
242
                        <td class="tg-align" th:each="contingencyTableRowCell : ${contingencyTableRow.getCells()}">
243
                            <span th:text="${contingencyTableRowCell.getValue()}"></span>
244
                        </td>
245
                    </div>
246
                </tr>
247 cfe48a96 cagy
248
249
            </table>
250 2868bb9a Vojtěch Danišík
        </div>
251 cfe48a96 cagy
    </div>
252
</main>
253
254
<footer class="text-muted">
255
    <div class="container">
256
257
    </div>
258
</footer>
259
260
<script type="text/javascript" src="js/app.js"></script>
261 2868bb9a Vojtěch Danišík
</body>
262 cfe48a96 cagy
</html>
263
<script type="text/javascript">
264
    $("select").selectpicker();
265 e49f76e4 cagy
</script>
266
<script>
267
    $(document).ready(function() {
268
269
        $('.select-action-button').on('click', function () {
270
            if ($(this).hasClass('select-action-headlight'))
271
            {
272
                $(this).removeClass('select-action-headlight');
273
                removeParameter(getParameterTitle($(this)), getParameterType($(this)));
274
            }
275
            else
276
            {
277
                $(this).closest('.select-action-buttons').find('.select-action-button').removeClass('select-action-headlight');
278
279
                removeFromAll(getParameterTitle($(this)));
280
281
                $(this).addClass('select-action-headlight');
282
283
                addParameter(getParameterIndex($(this)),
284
                             getParameterTitle($(this)),
285
                             getParameterType($(this)),
286
                             getParameterHiddenValue($(this)));
287
288
                initParameters();
289
            }
290
        });
291
292
        initParameters();
293
294
    });
295
296
    function removeFromAll(title) {
297
        $rows = $('.selected-input-container');
298
299
        $rows.each(function () {
300
            $(this).find('.parameter-name').each(function () {
301
                if ($(this).text() == title)
302
                {
303
                    $(this).closest('.parameter').remove();
304
                }
305
            })
306
        });
307
    }
308
309
    function getParameterIndex(button) {
310
        return $(button).closest('.parameter-row').find('.parameterIndex').val();
311
    }
312
313
    function addParameter(index, parameterName, type, hiddenValue) {
314
        var row = document.createElement('tr');
315
        row.classList.add(type + '-parameter', 'parameter');
316
317
        let hiddenInput = document.createElement('input');
318
        hiddenInput.type = 'hidden';
319
        hiddenInput.id = `parametersInConfiguration${index}.location.id`;
320
        hiddenInput.name = `parametersInConfiguration[${index}].location.id`;
321
        hiddenInput.value = hiddenValue;
322
323
        row.appendChild(hiddenInput);
324
325
        var firstTd = document.createElement('td');
326
327
        var firstTdBody = document.createElement('span');
328
        firstTdBody.classList.add('parameter-name');
329
        firstTdBody.innerHTML = parameterName;
330
331
        firstTd.appendChild(firstTdBody);
332
333
        row.appendChild(firstTd);
334
335
        var thirdTd = document.createElement('td');
336
337
        var thirdTdBody;
338
339
340
        if (type == 'value')
341
        {
342
            thirdTdBody = $('#function-select-' + index).clone()[0];
343
344
            $(thirdTdBody).removeClass('hidden');
345
        }
346
        else
347
        {
348
            var secondTd = document.createElement('td');
349
350
            var secondTdBody = document.createElement('input');
351
            secondTdBody.type = 'text';
352
            secondTdBody.classList.add('form-control', 'select-filter-input-name');
353
            secondTdBody.name = `parametersInConfiguration[${index}].columnName`;
354
355
            secondTd.appendChild(secondTdBody);
356
357
            row.appendChild(secondTd);
358
359
            thirdTdBody = document.createElement('span');
360
            thirdTdBody.innerHTML = "<i class=\"fas fa-sort\"></i>";
361
        }
362
363
        thirdTd.appendChild(thirdTdBody);
364
365
        row.appendChild(thirdTd);
366
367
        $('#' + type + '-wrapper').append($(row));
368
369
    }
370
    
371
    function removeParameter(title, parameterClass) {
372
        $rows = $('.' + parameterClass + '-parameter');
373
374
        $rows.each(function () {
375
            $(this).find('.parameter-name').each(function () {
376
                if ($(this).text() == title)
377
                {
378
                    $(this).closest('.' + parameterClass + '-parameter').remove();
379
                }
380
            })
381
        });
382
    }
383
384
    function getParameterType(context) {
385
        if ($(context).hasClass('column-button'))
386
        {
387
            return 'column';
388
        }
389
        else if ($(context).hasClass('row-button'))
390
        {
391
            return 'row';
392
        }
393
        else if ($(context).hasClass('value-button'))
394
        {
395
            return 'value';
396
        }
397
    }
398
399
    function getParameterHiddenValue(context) {
400
        if ($(context).hasClass('column-button'))
401
        {
402
            return 1;
403
        }
404
        else if ($(context).hasClass('row-button'))
405
        {
406
            return 2;
407
        }
408
        else if ($(context).hasClass('value-button'))
409
        {
410
            return 3;
411
        }
412
    }
413
414
    function getParameterTitle(context) {
415
        return $(context).closest('.parameter-row').find('.parameter-name').text();
416
    }
417
418
419
    function initParameters()
420
    {
421
        $('.sortable').sortable();
422
        $("select").selectpicker('refresh');
423
    }
424
425
426 cfe48a96 cagy
</script>