Projekt

Obecné

Profil

Stáhnout (20 KB) Statistiky
| Větev: | Revize:
1
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
2
<head>
3
    <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
    <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
    <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

    
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
</head>
28
<body>
29
<div id="test"></div>
30
<main role="main">
31

    
32
    <div class="container">
33
        <h1>
34
            Sestava - Studenti - studijní programy
35
        </h1>
36
        <a href="/" class="btn btn-success mb-2">Zpět</a>
37
    </div>
38

    
39
    <form th:object="${configuration}" method="post" th:action="@{/configuration(configurationID=${configuration.id})}">
40
        <input type="hidden" th:field="*{assembly.id}" th:value="${configuration.assembly?.getId()}"/>
41
        <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
                    <input type="text" class="form-control name-input" th:field="*{tableName}"
46
                           th:value="${configuration?.tableName}">
47
                </div>
48
                <span>Parametry:</span>
49
                <div class="col-md-9">
50
                    <table class="table">
51
                        <thead>
52
                        <tr>
53
                            <th class="col-1">Parametr</th>
54
                            <th class="col-2">Umístění</th>
55
                            <th class="col-3">Filtry</th>
56
                        </tr>
57
                        </thead>
58
                        <tbody>
59
                        <tr th:each="parameterInConfiguration, itemStat : ${#lists.sort(configuration.parametersInConfiguration, comparator)}" class="parameter-row">
60
                           <input type="hidden" class="parameterIndex" th:value="${itemStat.index}">
61
                            <td>
62
                                <span class="select-text-padding parameter-name"
63
                                      th:text="${parameterInConfiguration.parameter.name}"></span>
64
                            </td>
65
                            <td class="select-action-buttons">
66
                                <optional th:each="location : ${parameterInConfiguration.parameter.locations}">
67
                                    <span th:if="${location.name?.equals('Řádek')}"
68
                                      th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
69
                                      class="select-action-padding select-action-button select-input-action-margin-collapse unselectable row-button"
70
                                      th:classappend="(${configuration.parametersInConfiguration[__${itemStat.index}__].location.name?.equals('Řádek')}) ? select-action-headlight"  >
71
                                        <i class="fas fa-align-justify"></i>
72
                                    </span>
73
                                    <span th:if="${location.name?.equals('Sloupec')}"
74
                                          th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
75
                                          class="select-action-padding select-action-button select-input-action-margin-collapse unselectable column-button"
76
                                          th:classappend="(${configuration.parametersInConfiguration[__${itemStat.index}__].location.name?.equals('Sloupec')}) ? select-action-headlight">
77
                                        <i class="fas fa-align-justify transform"></i>
78
                                    </span>
79
                                    <span th:if="${location.name?.equals('Hodnota')}"
80
                                          th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
81
                                          class="select-action-padding select-action-button select-input-action-margin-collapse unselectable value-button"
82
                                          th:classappend="(${configuration.parametersInConfiguration[__${itemStat.index}__].location.name?.equals('Hodnota')}) ? select-action-headlight">
83
                                        <i class="fas fa-heading"></i>
84
                                    </span>
85
                                </optional>
86
                            </td>
87
                            <td class="s">
88
                                <div class="col select-filter">
89
                                    <select class="form-control"
90
                                            th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].operator.name}">
91
                                        <option th:value="zadny" selected value> -- Operátor --</option>
92
                                        <option th:each="operator : ${parameterInConfiguration.parameter.operators}"
93
                                                th:text="${operator.name}" th:value="${operator.name}"></option>
94
                                    </select>
95
                                    <input type="text" class="form-control select-filter-input" id="name"
96
                                           th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].operatorValue}">
97
                                </div>
98
                            </td>
99

    
100
                            <select class="form-control hidden" th:id="'function-select-' + ${itemStat.index}"
101
                                    th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].functions}"
102
                                    multiple>
103
                                <option th:each="function : ${parameterInConfiguration.parameter.functions}"
104
                                        th:text="${function.name}" th:value="${{function.id}}"></option>
105
                            </select>
106
                        </tr>
107
                        </tbody>
108
                    </table>
109
                </div>
110

    
111
                <div class="selected-input-container">
112
                    <div class="selected-input-box">
113
                        <div class="selected-input-box-icon">
114
                            <i class="fas fa-align-justify"></i>
115
                        </div>
116
                        <table class="table table-parameter">
117
                            <thead>
118
                            <tr>
119
                                <th class="col-1-p"></th>
120
                                <th class="col-2-p">Vlastní název</th>
121
                                <th class="col-3-p"></th>
122
                            </tr>
123
                            </thead>
124
                            <tbody id="row-wrapper" class="sortable">
125
                            <tr th:each="parameterInConfiguration, itemStat : ${#lists.sort(configuration.parametersInConfiguration)}" th:if="${parameterInConfiguration.location.name?.equals('Řádek')}" class="row-parameter parameter">
126
                                <input type="hidden" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.id}" value="1">
127
                                <input type="hidden" class="parametr-order" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].parameterOrder}" th:value="${configuration.parametersInConfiguration[__${itemStat.index}__].parameterOrder}">
128
                                <td>
129
                                    <span class="parameter-name" th:text="${parameterInConfiguration.parameter.name}"></span>
130
                                </td>
131
                                <td>
132
                                    <input th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].columnName}"
133
                                           type="text" class="form-control select-filter-input">
134
                                </td>
135
                                <td>
136
                                    <span><i class="fas fa-sort"></i></span>
137
                                </td>
138
                            </tr>
139
                            </tbody>
140
                        </table>
141
                    </div>
142

    
143

    
144
                    <div class="selected-input-box">
145
                        <div class="selected-input-box-icon">
146
                            <i class="fas fa-align-justify transform"></i>
147
                        </div>
148
                        <table class="table table-parameter">
149
                            <thead>
150
                            <tr>
151
                                <th class="col-1-p"></th>
152
                                <th class="col-2-p">Vlastní název</th>
153
                                <th class="col-3-p"></th>
154
                            </tr>
155
                            </thead>
156
                            <tbody id="column-wrapper" class="sortable">
157
                            <tr th:each="parameterInConfiguration, itemStat : ${#lists.sort(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
                                <input type="hidden" class="parametr-order" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].parameterOrder}" th:value="${configuration.parametersInConfiguration[__${itemStat.index}__].parameterOrder}">
160
                                <td>
161
                                    <span class="parameter-name" th:text="${parameterInConfiguration.parameter.name}"></span>
162
                                </td>
163
                                <td>
164
                                    <input th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].columnName}"
165
                                           type="text" class="form-control select-filter-input" id="name">
166
                                </td>
167
                                <td>
168
                                    <span><i class="fas fa-sort"></i></span>
169
                                </td>
170
                            </tr>
171
                            </tbody>
172
                        </table>
173
                    </div>
174

    
175

    
176
                    <div class="selected-input-box">
177
                        <div class="selected-input-box-icon">
178
                            <i class="fas fa-heading"></i>
179
                        </div>
180
                        <table class="table table-parameter">
181
                            <thead>
182
                            <tr>
183
                                <th class="col-1-p"></th>
184
                                <th class="col-2-p">Funkce</th>
185
                            </tr>
186
                            </thead>
187
                            <tbody id="value-wrapper">
188
                            <tr th:each="parameterInConfiguration, itemStat : ${#lists.sort(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}" value="3">
190
                                <input type="hidden" class="parametr-order" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].parameterOrder}" th:value="${configuration.parametersInConfiguration[__${itemStat.index}__].parameterOrder}">
191
                                <td>
192
                                    <span class="parameter-name" th:text="${parameterInConfiguration.parameter.name}"></span>
193
                                </td>
194
                                <td>
195
                                    <select class="form-control"
196
                                            th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].functions}"
197
                                            multiple>
198
                                        <option th:each="function : ${parameterInConfiguration.parameter.functions}"
199
                                                th:text="${function.name}" th:value="${{function.id}}"></option>
200
                                    </select>
201
                                </td>
202
                            </tr>
203
                            </tbody>
204
                        </table>
205
                    </div>
206
                </div>
207

    
208

    
209
                <div class="col-md-12 form-group row template-input">
210
                    <label for="exampleFormControlSelect1" class="template-input-label">Vlastní název šablony:</label>
211
                    <div class="">
212
                        <input type="text" required="required" class="form-control select-filter-input" id="name"
213
                               th:field="${configuration.name}">
214
                    </div>
215

    
216
                    <button type="submit" class="btn btn-success mb-2 template-input-submit">Uložit šablonu</button>
217
                </div>
218

    
219

    
220
                <div class="buttons-wrap">
221
                    <button type="submit" class="btn btn-secondary mb-2 " name="generate-table">Vygenerovat tabulku
222
                    </button>
223
                    <button type="submit" class="btn btn-secondary mb-2 " name="export-xls">Export do XLS</button>
224
                    <button type="submit" class="btn btn-secondary mb-2 " name="export-pdf">Export do PDF</button>
225
                </div>
226
            </div>
227
        </div>
228
    </form>
229

    
230

    
231
    <div th:if="${contingencyTableRows}" class="container box">
232
        <div class="col-md-12">
233
            <table class="tg table">
234
                <tr th:each="contingencyTableRow : ${contingencyTableRows}">
235
                    <div class="tg-align" th:if="${contingencyTableRow.isHeader()}">
236
                        <th class="tg-align" th:each="contingencyTableRowCell : ${contingencyTableRow.getCells()}">
237
                            <span th:text="${contingencyTableRowCell.getValue()}"></span>
238
                        </th>
239
                    </div>
240
                    <div th:unless="${contingencyTableRow.isHeader()}">
241
                        <td class="tg-align" th:each="contingencyTableRowCell : ${contingencyTableRow.getCells()}">
242
                            <span th:text="${contingencyTableRowCell.getValue()}"></span>
243
                        </td>
244
                    </div>
245
                </tr>
246

    
247

    
248
            </table>
249
        </div>
250
    </div>
251
</main>
252

    
253
<footer class="text-muted">
254
    <div class="container">
255

    
256
    </div>
257
</footer>
258

    
259
<script type="text/javascript" src="js/app.js"></script>
260
</body>
261
</html>
262
<script type="text/javascript">
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

    
425
</script>
(1-1/4)