Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2cdd3adc

Přidáno uživatelem Michal Linha před asi 4 roky(ů)

re #7881 loading and editing parameters in configuration in their locations, ability to set user name of parameter

Zobrazit rozdíly:

src/main/java/vldc/aswi/domain/Assembly.java
64 64
        this.setOrder(order);
65 65
        this.setIsPublic(isPublic);
66 66
    }
67

  
68
    @Override
69
    public String toString() {
70
        return "";
71
    }
67 72
}
src/main/java/vldc/aswi/domain/Configuration.java
29 29
    private String tableName;
30 30

  
31 31
    /** Specific user, which created this configuration. */
32
    @ManyToOne(fetch= FetchType.LAZY)
32
    @ManyToOne(fetch= FetchType.EAGER)
33 33
    @JoinColumn(name = "uzivatel_id")
34 34
    private User user;
35 35

  
36 36
    /** Used assembly as template in configuration. */
37
    @ManyToOne(fetch= FetchType.LAZY)
37
    @ManyToOne(fetch= FetchType.EAGER)
38 38
    @JoinColumn(name = "sestava_id")
39 39
    private Assembly assembly;
40 40

  
......
52 52
        this.setName(name);
53 53
        this.setTableName(tableName);
54 54
    }
55

  
56
    @Override
57
    public String toString() {
58
        return "";
59
    }
55 60
}
src/main/java/vldc/aswi/domain/EntityParent.java
18 18
    @Id
19 19
    @GeneratedValue(strategy = GenerationType.IDENTITY)
20 20
    private Long id;
21

  
22
    @Override
23
    public String toString() {
24
        return "";
25
    }
21 26
}
src/main/java/vldc/aswi/domain/Function.java
39 39
    public Function(String name) {
40 40
        this.setName(name);
41 41
    }
42

  
43
    @Override
44
    public String toString() {
45
        return "";
46
    }
42 47
}
src/main/java/vldc/aswi/domain/Location.java
40 40
    public Location(String name) {
41 41
        this.setName(name);
42 42
    }
43

  
44
    @Override
45
    public String toString() {
46
        return "";
47
    }
43 48
}
src/main/java/vldc/aswi/domain/Operator.java
40 40
    public Operator(String name) {
41 41
        this.setName(name);
42 42
    }
43

  
44
    @Override
45
    public String toString() {
46
        return "";
47
    }
43 48
}
src/main/java/vldc/aswi/domain/Role.java
39 39
        this.setName(name);
40 40
    }
41 41

  
42
    @Override
43
    public String toString() {
44
        return "";
45
    }
46

  
42 47
}
src/main/java/vldc/aswi/domain/User.java
44 44
        this.setUsername(username);
45 45
        this.setPassword(password);
46 46
    }
47

  
48
    @Override
49
    public String toString() {
50
        return "";
51
    }
47 52
}
src/main/java/vldc/aswi/domain/parameter/Parameter.java
93 93
        this.setNameOfSelect(nameOfSelect);
94 94
        this.setDefaultValue(defaultValue);
95 95
    }
96

  
97
    @Override
98
    public String toString() {
99
        return "";
100
    }
96 101
}
src/main/java/vldc/aswi/domain/parameter/ParameterInConfiguration.java
25 25
    private Configuration configuration;
26 26

  
27 27
    /** Specific parameter of configuration, which is used as template. */
28
    @ManyToOne(fetch=FetchType.LAZY)
28
    @ManyToOne(fetch=FetchType.EAGER)
29 29
    @JoinColumn(name = "parametr_id")
30 30
    private Parameter parameter;
31 31

  
......
68 68
        this.setOperatorValue(operatorValue);
69 69
        this.setColumnName(columnName);
70 70
    }
71

  
72
    @Override
73
    public String toString() {
74
        return "";
75
    }
71 76
}
src/main/java/vldc/aswi/domain/parameter/ParameterType.java
34 34
    public ParameterType(String name) {
35 35
        this.setName(name);
36 36
    }
37

  
38
    @Override
39
    public String toString() {
40
        return "";
41
    }
37 42
}
src/main/java/vldc/aswi/domain/parameter/ParameterValue.java
32 32
    public ParameterValue(String value) {
33 33
        this.setValue(value);
34 34
    }
35

  
36
    @Override
37
    public String toString() {
38
        return "";
39
    }
35 40
}
src/main/java/vldc/aswi/web/controller/AssemblyController.java
92 92

  
93 93
        Configuration configuration = configurationManager.getConfigurationById(Long.parseLong(id));
94 94

  
95
        for(ParameterInConfiguration parameterInConfiguration : configuration.getParametersInConfiguration()) {
96
            if(parameterInConfiguration.getLocation() == null) {
97
                parameterInConfiguration.setLocation(new Location());
98
            }
99
            if(parameterInConfiguration.getOperator() == null) {
100
                parameterInConfiguration.setOperator(new Operator());
101
            }
102
        }
95
        initializeFields(configuration);
103 96

  
104 97
        modelMap.addAttribute("configuration", configuration);
105 98
        modelMap.addAttribute("isAssembly", "0");
......
127 120

  
128 121
        Configuration configuration = configurationManager.saveConfiguration(newConfiguration, id);
129 122

  
130
        for(ParameterInConfiguration parameterInConfiguration : configuration.getParametersInConfiguration()) {
131
            if(parameterInConfiguration.getLocation() == null) {
132
                parameterInConfiguration.setLocation(new Location());
133
            }
134
            if(parameterInConfiguration.getOperator() == null) {
135
                parameterInConfiguration.setOperator(new Operator());
136
            }
137
        }
123
        initializeFields(configuration);
138 124

  
139 125
        modelAndView.setViewName("redirect:/configuration?configurationID=" + configuration.getId());
140 126

  
141 127
        return modelAndView;
142 128
    }
143 129

  
144

  
145 130
    @PostMapping("/assembly")
146 131
    public ModelAndView indexPost(@Valid Assembly assembly, BindingResult bindingResult, RedirectAttributes atts) {
147 132
        ModelAndView modelAndView = new ModelAndView();
......
173 158

  
174 159
        return modelAndView;
175 160
    }
161

  
162
    /**
163
     * Initializes fields of a given configuration
164
     * @param configuration configuration which fields should be initialized
165
     */
166
    private void initializeFields(Configuration configuration) {
167
        for(ParameterInConfiguration parameterInConfiguration : configuration.getParametersInConfiguration()) {
168
            if(parameterInConfiguration.getLocation() == null) {
169
                parameterInConfiguration.setLocation(new Location());
170
            }
171
            if(parameterInConfiguration.getOperator() == null) {
172
                parameterInConfiguration.setOperator(new Operator());
173
            }
174
            if(parameterInConfiguration.getFunctions() == null) {
175
                parameterInConfiguration.setFunctions(new ArrayList<>());
176
            }
177
        }
178
    }
176 179
}
src/main/webapp/WEB-INF/templates/assembly.html
1
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml"><head>
1
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
2
<head>
2 3
    <meta charset="utf-8">
3 4
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
4 5
    <meta name="description" content="">
......
14 15
    <link href="css/fontawesome.min.css" rel="stylesheet">
15 16
    <link href="css/style.css" rel="stylesheet">
16 17

  
17
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
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>
18 21
    <script type="text/javascript" src="js/jquery.js"></script>
19 22
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
20 23
    <script type="text/javascript" src="js/bootstrap-select.min.js"></script>
......
30 33
    </div>
31 34

  
32 35
    <form th:object="${configuration}" method="post" th:action="@{/configuration(configurationID=${configuration.id})}">
33
        <input type="hidden" th:field="*{assembly.id}" th:value="${configuration.assembly?.getId()}" />
36
        <input type="hidden" th:field="*{assembly.id}" th:value="${configuration.assembly?.getId()}"/>
34 37
        <div class="container box">
35 38
            <div class="col-md-12">
36 39
                <div class="col-md-12 form-group row">
37 40
                    <label for="exampleFormControlSelect1" class="name-input-label">Titulek tabulky:</label>
38
                    <input type="text" class="form-control name-input" th:field="*{tableName}" th:value="${configuration?.tableName}">
41
                    <input type="text" class="form-control name-input" th:field="*{tableName}"
42
                           th:value="${configuration?.tableName}">
39 43
                </div>
40 44

  
41 45
                <span>Parametry:</span>
......
51 55
                        <tbody>
52 56
                        <tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}">
53 57
                            <td>
54
                                <span class="select-text-padding" th:text="${parameterInConfiguration.parameter.name}"></span>
58
                                <span class="select-text-padding"
59
                                      th:text="${parameterInConfiguration.parameter.name}"></span>
55 60
                            </td>
56 61
                            <td>
57 62
                                <optional th:each="location : ${parameterInConfiguration.parameter.locations}">
58
                                <span th:if="${location.name.equals('Sloupec')}" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}" class="select-action-padding select-action-button select-input-action-margin-collapse">
63
                                <span th:if="${location.name.equals('Sloupec')}"
64
                                      th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
65
                                      class="select-action-padding select-action-button select-input-action-margin-collapse">
59 66
                                  <i class="fas fa-align-justify"></i>
60 67
                                </span>
61
                                <span th:if="${location.name.equals('Řádek')}" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}" class="select-action-padding select-action-button select-input-action-margin-collapse">
68
                                    <span th:if="${location.name.equals('Řádek')}"
69
                                          th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
70
                                          class="select-action-padding select-action-button select-input-action-margin-collapse">
62 71
                                  <i class="fas fa-align-justify transform"></i>
63 72
                                </span>
64
                                <span th:if="${location.name.equals('Hodnota')}" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}" class="select-action-padding select-action-button select-input-action-margin-collapse">
73
                                    <span th:if="${location.name.equals('Hodnota')}"
74
                                          th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].location.name}"
75
                                          class="select-action-padding select-action-button select-input-action-margin-collapse">
65 76
                                    <i class="fas fa-heading"></i>
66 77
                                </span>
67 78
                                </optional>
68 79
                            </td>
69 80
                            <td class="s">
70 81
                                <div class="col select-filter">
71
                                    <select class="form-control" style="{width:60px;}" id="exampleFormControlSelect1" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].operator.name}">
72
                                        <option th:value="zadny" selected value> -- Zvolte operátor -- </option>
73
                                        <option th:each="operator : ${parameterInConfiguration.parameter.operators}" th:text="${operator.name}" th:value="${operator.name}"></option>
82
                                    <select class="form-control" style="{width:60px;}" id="exampleFormControlSelect1"
83
                                            th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].operator.name}">
84
                                        <option th:value="zadny" selected value> -- Zvolte operátor --</option>
85
                                        <option th:each="operator : ${parameterInConfiguration.parameter.operators}"
86
                                                th:text="${operator.name}" th:value="${operator.name}"></option>
74 87
                                    </select>
75
                                    <input type="text" class="form-control select-filter-input" id="name" th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].operatorValue}">
88
                                    <input type="text" class="form-control select-filter-input" id="name"
89
                                           th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].operatorValue}">
76 90
                                </div>
77 91
                            </td>
78 92
                        </tr>
......
94 108
                            </tr>
95 109
                            </thead>
96 110
                            <tbody>
97
                            <tr>
111
                            <tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Řádek')}">
98 112
                                <td>
99
                                    <span>Fakulta</span>
113
                                    <span th:text="${parameterInConfiguration.parameter.name}"></span>
100 114
                                </td>
101 115
                                <td>
102
                                    <input type="text" class="form-control select-filter-input" id="name">
103
                                </td>
104
                                <td>
105
                                    <span><i class="fas fa-sort"></i></span>
106
                                </td>
107
                            </tr>
108
                            <tr>
109
                                <td>
110
                                    <span>Typ studia</span>
111
                                </td>
112
                                <td>
113
                                    <input type="text" class="form-control select-filter-input" id="name">
116
                                    <input th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].columnName}"
117
                                           type="text" class="form-control select-filter-input" id="name">
114 118
                                </td>
115 119
                                <td>
116 120
                                    <span><i class="fas fa-sort"></i></span>
......
134 138
                            </tr>
135 139
                            </thead>
136 140
                            <tbody>
137
                            <tr>
141
                            <tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Sloupec')}">
138 142
                                <td>
139
                                    <span>Ročník</span>
143
                                    <span th:text="${parameterInConfiguration.parameter.name}"></span>
140 144
                                </td>
141 145
                                <td>
142
                                    <input type="text" class="form-control select-filter-input" id="name">
146
                                    <input th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].columnName}"
147
                                           type="text" class="form-control select-filter-input" id="name">
143 148
                                </td>
144 149
                                <td>
145 150
                                    <span><i class="fas fa-sort"></i></span>
......
158 163
                            <thead>
159 164
                            <tr>
160 165
                                <th class="col-1-p"></th>
161
                                <th class="col-2-p">Vlastní název</th>
166
                                <th class="col-2-p">Funkce</th>
162 167
                            </tr>
163 168
                            </thead>
164 169
                            <tbody>
165
                            <tr>
170
                            <tr th:each="parameterInConfiguration, itemStat : ${configuration.parametersInConfiguration}" th:if="${parameterInConfiguration.location.name?.equals('Hodnota')}">
166 171
                                <td>
167
                                    <span>Počet</span>
172
                                    <span th:text="${parameterInConfiguration.parameter.name}"></span>
168 173
                                </td>
169 174
                                <td>
170
                                    <select class="form-control" style="{width:60px;}" id="exampleFormControlSelect1">
171
                                        <option>SUM</option>
172
                                        <option>AVG</option>
173
                                        <option>MIN</option>
174
                                        <option>MAX</option>
175
                                    <select class="form-control" style="{width:60px;}"
176
                                            id="exampleFormControlSelect1"
177
                                            th:field="${configuration.parametersInConfiguration[__${itemStat.index}__].functions}"
178
                                            multiple>
179
                                        <option th:each="function : ${parameterInConfiguration.parameter.functions}"
180
                                                th:text="${function.name}" th:value="${{function.id}}"></option>
175 181
                                    </select>
176 182
                                </td>
177 183

  
......
185 191
                <div class="col-md-12 form-group row template-input">
186 192
                    <label for="exampleFormControlSelect1" class="template-input-label">Vlastní název šablony:</label>
187 193
                    <div class="">
188
                        <input type="text" required="required" class="form-control select-filter-input" id="name" th:field="${configuration.name}">
194
                        <input type="text" required="required" class="form-control select-filter-input" id="name"
195
                               th:field="${configuration.name}">
189 196
                    </div>
190 197

  
191 198
                    <button type="submit" class="btn btn-success mb-2 template-input-submit">Uložit šablonu</button>
......
193 200

  
194 201

  
195 202
                <div class="buttons-wrap">
196
                    <button type="submit" class="btn btn-secondary mb-2 " name="generate-table">Vygenerovat tabulku</button>
203
                    <button type="submit" class="btn btn-secondary mb-2 " name="generate-table">Vygenerovat tabulku
204
                    </button>
197 205
                    <button type="submit" class="btn btn-secondary mb-2 " name="export-xls">Export do XLS</button>
198 206
                    <button type="submit" class="btn btn-secondary mb-2 " name="export-pdf">Export do PDF</button>
199 207
                </div>
......
202 210
    </form>
203 211

  
204 212

  
205

  
206

  
207 213
    <div th:if="${contingencyTableRows}" class="container box">
208 214
        <div class="col-md-12">
209 215

  
......
211 217
            <table class="tg table">
212 218

  
213 219

  
214
                    <tr th:each="contingencyTableRow : ${contingencyTableRows}">
215
                        <div class="tg-align" th:if="${contingencyTableRow.isHeader()}">
216
                            <th class="tg-align" th:each="contingencyTableRowCell : ${contingencyTableRow.getCells()}">
217
                                <span th:text="${contingencyTableRowCell.getValue()}"></span>
218
                            </th>
219
                        </div>
220
                        <div th:unless="${contingencyTableRow.isHeader()}">
221
                            <td class="tg-align" th:each="contingencyTableRowCell : ${contingencyTableRow.getCells()}">
222
                                <span th:text="${contingencyTableRowCell.getValue()}"></span>
223
                            </td>
224
                        </div>
225
                    </tr>
226

  
220
                <tr th:each="contingencyTableRow : ${contingencyTableRows}">
221
                    <div class="tg-align" th:if="${contingencyTableRow.isHeader()}">
222
                        <th class="tg-align" th:each="contingencyTableRowCell : ${contingencyTableRow.getCells()}">
223
                            <span th:text="${contingencyTableRowCell.getValue()}"></span>
224
                        </th>
225
                    </div>
226
                    <div th:unless="${contingencyTableRow.isHeader()}">
227
                        <td class="tg-align" th:each="contingencyTableRowCell : ${contingencyTableRow.getCells()}">
228
                            <span th:text="${contingencyTableRowCell.getValue()}"></span>
229
                        </td>
230
                    </div>
231
                </tr>
227 232

  
228 233

  
229 234
            </table>

Také k dispozici: Unified diff