977 |
geraldo |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
|
|
|
5 |
$roleName = $currentUser->getUserTypeId();
|
|
|
6 |
|
985 |
geraldo |
7 |
$routeAdd = $this->url('performance-evaluation/forms/add');
|
|
|
8 |
$routeDatatable = $this->url('performance-evaluation/forms');
|
977 |
geraldo |
9 |
$routeDashboard = $this->url('dashboard');
|
|
|
10 |
|
985 |
geraldo |
11 |
$allowAdd = $acl->isAllowed($roleName, 'performance-evaluation/forms/add') ? 1 : 0;
|
|
|
12 |
$allowEdit = $acl->isAllowed($roleName, 'performance-evaluation/forms/edit') ? 1 : 0;
|
|
|
13 |
$allowDelete = $acl->isAllowed($roleName, 'performance-evaluation/forms/delete') ? 1 : 0;
|
977 |
geraldo |
14 |
|
|
|
15 |
|
|
|
16 |
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
|
|
|
20 |
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
|
|
|
24 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
|
|
|
25 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
|
|
|
26 |
|
|
|
27 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
|
|
|
28 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
|
|
|
29 |
|
|
|
30 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
|
|
|
31 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
|
|
|
32 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
|
|
|
33 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
|
|
|
37 |
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
|
|
|
38 |
|
|
|
39 |
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.full.min.js'));
|
|
|
40 |
|
|
|
41 |
$this->inlineScript()->appendFile($this->basePath('plugins/moment/moment-with-locales.min.js'));
|
|
|
42 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
|
|
|
43 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
|
|
|
47 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
|
|
|
48 |
|
|
|
49 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
|
|
|
50 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
|
|
|
51 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
|
|
|
52 |
|
|
|
53 |
// bootbox Alert //
|
|
|
54 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
|
|
|
55 |
|
|
|
56 |
// JsRender //
|
|
|
57 |
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
|
|
|
58 |
|
|
|
59 |
$this->inlineScript()->captureStart();
|
|
|
60 |
echo <<<JS
|
|
|
61 |
const classFormGenerator = function() {
|
|
|
62 |
this.id = 0,
|
|
|
63 |
this.table = '',
|
|
|
64 |
this.name = '',
|
|
|
65 |
this.text = '',
|
|
|
66 |
this.status = 'a',
|
|
|
67 |
this.sections = [],
|
|
|
68 |
this.clear = function() {
|
|
|
69 |
this.sections = [];
|
|
|
70 |
this.render();
|
|
|
71 |
},
|
|
|
72 |
/**
|
|
|
73 |
* Render array sections
|
|
|
74 |
*/
|
|
|
75 |
this.renderSection = function(slug_section) {
|
|
|
76 |
var s = '';
|
|
|
77 |
for (i = 0; i < this.sections.length; i++) {
|
|
|
78 |
if (slug_section != this.sections[i].slug_section) {
|
|
|
79 |
continue;
|
|
|
80 |
}
|
997 |
geraldo |
81 |
for (j = 0; j < this.sections[i].sections.length; j++) {
|
|
|
82 |
this.sections[i].sections[j].position = j;
|
|
|
83 |
if (this.sections[i].sections[j].type == 'simple' || this.sections[i].sections[j].type == 'multiple' || this.sections[i].sections[j].type == 'rating-open') {
|
|
|
84 |
this.sections[i].sections[j].options.sort(function(a, b) {
|
977 |
geraldo |
85 |
if (a.position > b.position) {
|
|
|
86 |
return 1;
|
|
|
87 |
}
|
|
|
88 |
if (a.position < b.position) {
|
|
|
89 |
return -1;
|
|
|
90 |
}
|
|
|
91 |
return 0;
|
|
|
92 |
});
|
997 |
geraldo |
93 |
for (k = 0; k < this.sections[i].sections[j].options.length; k++) {
|
|
|
94 |
this.sections[i].sections[j].options[k].position = j;
|
977 |
geraldo |
95 |
}
|
|
|
96 |
}
|
|
|
97 |
}
|
|
|
98 |
}
|
|
|
99 |
$('[data-toggle="tooltip"]').tooltip();
|
|
|
100 |
},
|
|
|
101 |
this.render = function() {
|
|
|
102 |
this.sections.sort(function(a, b) {
|
|
|
103 |
if (a.position > b.position) {
|
|
|
104 |
return 1;
|
|
|
105 |
}
|
|
|
106 |
if (a.position < b.position) {
|
|
|
107 |
return -1;
|
|
|
108 |
}
|
|
|
109 |
return 0;
|
|
|
110 |
});
|
|
|
111 |
var s = '';
|
|
|
112 |
for (i = 0; i < this.sections.length; i++) {
|
|
|
113 |
this.sections[i].position = i;
|
997 |
geraldo |
114 |
this.sections[i].sections.sort(function(a, b) {
|
977 |
geraldo |
115 |
if (a.position > b.position) {
|
|
|
116 |
return 1;
|
|
|
117 |
}
|
|
|
118 |
if (a.position < b.position) {
|
|
|
119 |
return -1;
|
|
|
120 |
}
|
|
|
121 |
return 0;
|
|
|
122 |
});
|
997 |
geraldo |
123 |
for (j = 0; j < this.sections[i].sections.length; j++) {
|
|
|
124 |
this.sections[i].sections[j].position = j;
|
|
|
125 |
if (this.sections[i].sections[j].type == 'simple' || this.sections[i].sections[j].type == 'multiple' || this.sections[i].sections[j].type == 'rating-open') {
|
|
|
126 |
this.sections[i].sections[j].options.sort(function(a, b) {
|
977 |
geraldo |
127 |
if (a.position > b.position) {
|
|
|
128 |
return 1;
|
|
|
129 |
}
|
|
|
130 |
if (a.position < b.position) {
|
|
|
131 |
return -1;
|
|
|
132 |
}
|
|
|
133 |
return 0;
|
|
|
134 |
});
|
997 |
geraldo |
135 |
for (k = 0; k < this.sections[i].sections[j].options.length; k++) {
|
|
|
136 |
this.sections[i].sections[j].options[k].position = j;
|
977 |
geraldo |
137 |
}
|
|
|
138 |
}
|
|
|
139 |
}
|
|
|
140 |
}
|
|
|
141 |
$('[data-toggle="tooltip"]').tooltip();
|
|
|
142 |
},
|
|
|
143 |
/**
|
|
|
144 |
* Add element to section array
|
|
|
145 |
*/
|
|
|
146 |
this.addSection = function(name, text, value) {
|
|
|
147 |
var d = new Date();
|
|
|
148 |
var slug = 'section' + d.getTime();
|
|
|
149 |
var position = 0;
|
|
|
150 |
$.each(this.sections, function(index, section) {
|
|
|
151 |
if (position < section.position) {
|
|
|
152 |
position = section.position;
|
|
|
153 |
}
|
|
|
154 |
});
|
|
|
155 |
position++;
|
|
|
156 |
var section = {
|
|
|
157 |
'slug_section': slug,
|
|
|
158 |
'name': name,
|
|
|
159 |
'text': text,
|
|
|
160 |
'value': value,
|
|
|
161 |
'position': position,
|
997 |
geraldo |
162 |
'sections': [],
|
977 |
geraldo |
163 |
'status': 0
|
|
|
164 |
}
|
|
|
165 |
this.sections.push(section);
|
|
|
166 |
},
|
|
|
167 |
/**
|
|
|
168 |
* Edit element to section array
|
|
|
169 |
*/
|
|
|
170 |
this.editSection = function(slug, name, text, value) {
|
|
|
171 |
var renderTable = false;
|
|
|
172 |
for (i = 0; i < this.sections.length; i++) {
|
|
|
173 |
if (slug == this.sections[i].slug_section) {
|
|
|
174 |
this.sections[i].name = name;
|
|
|
175 |
this.sections[i].text = text;
|
|
|
176 |
this.sections[i].value = value;
|
|
|
177 |
renderTable = true;
|
|
|
178 |
break;
|
|
|
179 |
}
|
|
|
180 |
}
|
|
|
181 |
if (renderTable) {
|
|
|
182 |
this.renderSection(slug);
|
|
|
183 |
}
|
|
|
184 |
},
|
|
|
185 |
/**
|
|
|
186 |
* Remove element to section array
|
|
|
187 |
*/
|
|
|
188 |
this.deleteSection = function(slug) {
|
|
|
189 |
var renderTable = false;
|
|
|
190 |
for (i = 0; i < this.sections.length; i++) {
|
|
|
191 |
if (slug == this.sections[i].slug_section) {
|
|
|
192 |
this.sections.splice(i, 1);
|
|
|
193 |
renderTable = true;
|
|
|
194 |
break;
|
|
|
195 |
}
|
|
|
196 |
}
|
|
|
197 |
if (renderTable) {
|
|
|
198 |
$('#panel' + slug).remove();
|
|
|
199 |
}
|
|
|
200 |
},
|
|
|
201 |
/**
|
997 |
geraldo |
202 |
* Add element to section array
|
977 |
geraldo |
203 |
*/
|
997 |
geraldo |
204 |
this.addsection = function(slug_section, text, value, type, maxlength, multiline, range) {
|
977 |
geraldo |
205 |
var d = new Date();
|
997 |
geraldo |
206 |
var slug_section = 'section' + d.getTime();
|
977 |
geraldo |
207 |
var position = 0;
|
|
|
208 |
var renderTable = false;
|
|
|
209 |
for (i = 0; i < this.sections.length; i++) {
|
|
|
210 |
if (slug_section == this.sections[i].slug_section) {
|
997 |
geraldo |
211 |
$.each(this.sections[i].sections, function(index, section) {
|
|
|
212 |
if (position < section.position) {
|
|
|
213 |
position = section.position;
|
977 |
geraldo |
214 |
}
|
|
|
215 |
});
|
|
|
216 |
position++;
|
997 |
geraldo |
217 |
var section = {
|
977 |
geraldo |
218 |
'slug_section': slug_section,
|
997 |
geraldo |
219 |
'slug_section': slug_section,
|
977 |
geraldo |
220 |
'text': text,
|
|
|
221 |
'value': value,
|
|
|
222 |
'type': type,
|
|
|
223 |
'position': position,
|
|
|
224 |
'maxlength': maxlength,
|
|
|
225 |
'multiline': multiline,
|
|
|
226 |
'range': range,
|
|
|
227 |
'options': [],
|
|
|
228 |
'answer': type=='multiple' ? [] : ''
|
|
|
229 |
}
|
997 |
geraldo |
230 |
this.sections[i].sections.push(section);
|
977 |
geraldo |
231 |
renderTable = true;
|
|
|
232 |
break;
|
|
|
233 |
}
|
|
|
234 |
}
|
|
|
235 |
if (renderTable) {
|
|
|
236 |
this.renderSection(slug_section);
|
|
|
237 |
}
|
|
|
238 |
},
|
|
|
239 |
/**
|
997 |
geraldo |
240 |
* Add element to section array
|
977 |
geraldo |
241 |
*/
|
997 |
geraldo |
242 |
this.editsection = function(slug_section, slug_section, text, value, type, maxlength, multiline, range) {
|
977 |
geraldo |
243 |
var renderTable = false;
|
|
|
244 |
for (i = 0; i < this.sections.length; i++) {
|
|
|
245 |
if (slug_section == this.sections[i].slug_section) {
|
997 |
geraldo |
246 |
for (j = 0; j < this.sections[i].sections.length; j++) {
|
|
|
247 |
if (slug_section == this.sections[i].sections[j].slug_section) {
|
|
|
248 |
this.sections[i].sections[j].text = text,
|
|
|
249 |
this.sections[i].sections[j].value = value,
|
|
|
250 |
this.sections[i].sections[j].type = type;
|
977 |
geraldo |
251 |
if (type == 'open') {
|
997 |
geraldo |
252 |
this.sections[i].sections[j].maxlength = maxlength;
|
|
|
253 |
this.sections[i].sections[j].multiline = multiline;
|
|
|
254 |
this.sections[i].sections[j].options = [];
|
977 |
geraldo |
255 |
} else {
|
997 |
geraldo |
256 |
this.sections[i].sections[j].maxlength = 0;
|
|
|
257 |
this.sections[i].sections[j].multiline = 0;
|
977 |
geraldo |
258 |
}
|
|
|
259 |
if (type == 'rating-range') {
|
997 |
geraldo |
260 |
this.sections[i].sections[j].range = range;
|
977 |
geraldo |
261 |
} else {
|
997 |
geraldo |
262 |
this.sections[i].sections[j].range = 0;
|
977 |
geraldo |
263 |
}
|
|
|
264 |
|
|
|
265 |
if(type=='multiple'){
|
997 |
geraldo |
266 |
this.sections[i].sections[j].answer = [];
|
977 |
geraldo |
267 |
}else{
|
997 |
geraldo |
268 |
this.sections[i].sections[j].answer = '';
|
977 |
geraldo |
269 |
}
|
|
|
270 |
|
|
|
271 |
renderTable = true;
|
|
|
272 |
break;
|
|
|
273 |
}
|
|
|
274 |
}
|
|
|
275 |
}
|
|
|
276 |
if (renderTable) {
|
|
|
277 |
break;
|
|
|
278 |
}
|
|
|
279 |
}
|
|
|
280 |
if (renderTable) {
|
|
|
281 |
this.renderSection(slug_section);
|
|
|
282 |
}
|
|
|
283 |
},
|
|
|
284 |
/**
|
997 |
geraldo |
285 |
* Remove element to section array
|
977 |
geraldo |
286 |
*/
|
997 |
geraldo |
287 |
this.deletesection = function(slug_section, slug_section) {
|
977 |
geraldo |
288 |
var renderTable = false;
|
|
|
289 |
for (i = 0; i < this.sections.length; i++) {
|
|
|
290 |
if (slug_section == this.sections[i].slug_section) {
|
997 |
geraldo |
291 |
for (j = 0; j < this.sections[i].sections.length; j++) {
|
|
|
292 |
if (slug_section == this.sections[i].sections[j].slug_section) {
|
|
|
293 |
this.sections[i].sections.splice(j, 1);
|
977 |
geraldo |
294 |
renderTable = true;
|
|
|
295 |
break;
|
|
|
296 |
}
|
|
|
297 |
}
|
|
|
298 |
}
|
|
|
299 |
if (renderTable) {
|
|
|
300 |
break;
|
|
|
301 |
}
|
|
|
302 |
}
|
|
|
303 |
if (renderTable) {
|
|
|
304 |
this.renderSection(slug_section);
|
|
|
305 |
}
|
|
|
306 |
},
|
|
|
307 |
/**
|
|
|
308 |
* Add element to option array
|
|
|
309 |
*/
|
997 |
geraldo |
310 |
this.addOption = function(slug_section, slug_section, text, correct, value) {
|
977 |
geraldo |
311 |
var d = new Date();
|
|
|
312 |
var slug_option = 'option' + d.getTime();
|
|
|
313 |
var position = 0;
|
|
|
314 |
var renderTable = false;
|
|
|
315 |
for (i = 0; i < this.sections.length; i++) {
|
|
|
316 |
if (slug_section == this.sections[i].slug_section) {
|
997 |
geraldo |
317 |
for (j = 0; j < this.sections[i].sections.length; j++) {
|
|
|
318 |
if (slug_section == this.sections[i].sections[j].slug_section) {
|
|
|
319 |
$.each(this.sections[i].sections[j].options, function(index, option) {
|
977 |
geraldo |
320 |
if (position < option.position) {
|
|
|
321 |
position = option.position;
|
|
|
322 |
}
|
|
|
323 |
});
|
|
|
324 |
position++;
|
|
|
325 |
var option = {
|
|
|
326 |
'slug_section': slug_section,
|
997 |
geraldo |
327 |
'slug_section': slug_section,
|
977 |
geraldo |
328 |
'slug_option': slug_option,
|
|
|
329 |
'text': text,
|
|
|
330 |
'correct': correct,
|
|
|
331 |
'value': value,
|
|
|
332 |
'checked': false
|
|
|
333 |
}
|
997 |
geraldo |
334 |
this.sections[i].sections[j].options.push(option);
|
977 |
geraldo |
335 |
renderTable = true;
|
|
|
336 |
break;
|
|
|
337 |
}
|
|
|
338 |
if (renderTable) {
|
|
|
339 |
break;
|
|
|
340 |
}
|
|
|
341 |
}
|
|
|
342 |
}
|
|
|
343 |
}
|
|
|
344 |
if (renderTable) {
|
|
|
345 |
this.renderSection(slug_section);
|
|
|
346 |
}
|
|
|
347 |
},
|
|
|
348 |
/**
|
|
|
349 |
* Edit element to option array
|
|
|
350 |
*/
|
997 |
geraldo |
351 |
this.editOption = function(slug_section, slug_section, option_slug, text, correct, value) {
|
977 |
geraldo |
352 |
var renderTable = false;
|
|
|
353 |
for (i = 0; i < this.sections.length; i++) {
|
|
|
354 |
if (slug_section == this.sections[i].slug_section) {
|
997 |
geraldo |
355 |
for (j = 0; j < this.sections[i].sections.length; j++) {
|
|
|
356 |
if (slug_section == this.sections[i].sections[j].slug_section) {
|
|
|
357 |
for (k = 0; k < this.sections[i].sections[j].options.length; k++) {
|
|
|
358 |
if (option_slug == this.sections[i].sections[j].options[k].slug_option) {
|
|
|
359 |
this.sections[i].sections[j].options[k].text = text;
|
|
|
360 |
this.sections[i].sections[j].options[k].correct = correct;
|
|
|
361 |
this.sections[i].sections[j].options[k].value = value;
|
977 |
geraldo |
362 |
renderTable = true;
|
|
|
363 |
break;
|
|
|
364 |
}
|
|
|
365 |
}
|
|
|
366 |
}
|
|
|
367 |
if (renderTable) {
|
|
|
368 |
break;
|
|
|
369 |
}
|
|
|
370 |
}
|
|
|
371 |
}
|
|
|
372 |
if (renderTable) {
|
|
|
373 |
break;
|
|
|
374 |
}
|
|
|
375 |
}
|
|
|
376 |
if (renderTable) {
|
|
|
377 |
this.renderSection(slug_section);
|
|
|
378 |
}
|
|
|
379 |
},
|
|
|
380 |
/**
|
|
|
381 |
* Remove element to option array
|
|
|
382 |
*/
|
997 |
geraldo |
383 |
this.deleteOption = function(slug_section, slug_section, option_slug) {
|
977 |
geraldo |
384 |
var renderTable = false;
|
|
|
385 |
for (i = 0; i < this.sections.length; i++) {
|
|
|
386 |
if (slug_section == this.sections[i].slug_section) {
|
997 |
geraldo |
387 |
for (j = 0; j < this.sections[i].sections.length; j++) {
|
|
|
388 |
if (slug_section == this.sections[i].sections[j].slug_section) {
|
|
|
389 |
for (k = 0; k < this.sections[i].sections[j].options.length; k++) {
|
|
|
390 |
if (option_slug == this.sections[i].sections[j].options[k].slug_option) {
|
|
|
391 |
this.sections[i].sections[j].options.splice(k, 1);
|
977 |
geraldo |
392 |
renderTable = true;
|
|
|
393 |
break;
|
|
|
394 |
}
|
|
|
395 |
}
|
|
|
396 |
}
|
|
|
397 |
if (renderTable) {
|
|
|
398 |
break;
|
|
|
399 |
}
|
|
|
400 |
}
|
|
|
401 |
}
|
|
|
402 |
if (renderTable) {
|
|
|
403 |
break;
|
|
|
404 |
}
|
|
|
405 |
}
|
|
|
406 |
if (renderTable) {
|
|
|
407 |
this.renderSection(slug_section);
|
|
|
408 |
}
|
|
|
409 |
}
|
|
|
410 |
}
|
|
|
411 |
|
|
|
412 |
function htmlEntities(str) {
|
|
|
413 |
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
|
414 |
}
|
|
|
415 |
jQuery(document).ready(function($) {
|
|
|
416 |
var objFormGenerator = new classFormGenerator();
|
|
|
417 |
objFormGenerator.render();
|
|
|
418 |
var allowEdit = $allowEdit;
|
|
|
419 |
var allowDelete = $allowDelete;
|
|
|
420 |
/**
|
|
|
421 |
* Get rows and set data table
|
|
|
422 |
*/
|
|
|
423 |
var tableForm = $('#gridTable').dataTable({
|
|
|
424 |
'processing': true,
|
|
|
425 |
'serverSide': true,
|
|
|
426 |
'searching': true,
|
|
|
427 |
'order': [
|
|
|
428 |
[0, 'asc']
|
|
|
429 |
],
|
|
|
430 |
'ordering': true,
|
|
|
431 |
'ordenable': true,
|
|
|
432 |
'responsive': true,
|
|
|
433 |
'select': false,
|
|
|
434 |
'paging': true,
|
|
|
435 |
'pagingType': 'simple_numbers',
|
|
|
436 |
'ajax': {
|
|
|
437 |
'url': '$routeDatatable',
|
|
|
438 |
'type': 'get',
|
|
|
439 |
'beforeSend': function(request) {
|
|
|
440 |
NProgress.start();
|
|
|
441 |
},
|
|
|
442 |
'dataFilter': function(response) {
|
|
|
443 |
var response = jQuery.parseJSON(response);
|
|
|
444 |
var json = {};
|
|
|
445 |
json.recordsTotal = 0;
|
|
|
446 |
json.recordsFiltered = 0;
|
|
|
447 |
json.data = [];
|
|
|
448 |
if (response.success) {
|
|
|
449 |
json.recordsTotal = response.data.total;
|
|
|
450 |
json.recordsFiltered = response.data.total;
|
|
|
451 |
json.data = response.data.items;
|
|
|
452 |
} else {
|
|
|
453 |
$.fn.showError(response.data)
|
|
|
454 |
}
|
|
|
455 |
return JSON.stringify(json);
|
|
|
456 |
}
|
|
|
457 |
},
|
|
|
458 |
'language': {
|
|
|
459 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
460 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
461 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
462 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
463 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
464 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
465 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
466 |
'sInfoPostFix': '',
|
|
|
467 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
468 |
'sUrl': '',
|
|
|
469 |
'sInfoThousands': ',',
|
|
|
470 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
471 |
'oPaginate': {
|
|
|
472 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
473 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
474 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
475 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
476 |
},
|
|
|
477 |
'oAria': {
|
|
|
478 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
479 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
480 |
},
|
|
|
481 |
},
|
|
|
482 |
'drawCallback': function(settings) {
|
|
|
483 |
NProgress.done();
|
|
|
484 |
$('button.btn-delete').confirmation({
|
|
|
485 |
rootSelector: 'button.btn-delete',
|
|
|
486 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
487 |
singleton: true,
|
|
|
488 |
btnOkLabel: 'LABEL_YES',
|
|
|
489 |
btnCancelLabel: 'LABEL_NO',
|
|
|
490 |
onConfirm: function(value) {
|
|
|
491 |
action = $(this).data('href');
|
|
|
492 |
NProgress.start();
|
|
|
493 |
$.ajax({
|
|
|
494 |
'dataType': 'json',
|
|
|
495 |
'accept': 'application/json',
|
|
|
496 |
'method': 'post',
|
|
|
497 |
'url': action,
|
|
|
498 |
}).done(function(response) {
|
|
|
499 |
if (response['success']) {
|
|
|
500 |
$.fn.showSuccess(response['data']);
|
|
|
501 |
tableForm.fnDraw();
|
|
|
502 |
} else {
|
|
|
503 |
$.fn.showError(response['data']);
|
|
|
504 |
}
|
|
|
505 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
506 |
$.fn.showError(textStatus);
|
|
|
507 |
}).always(function() {
|
|
|
508 |
NProgress.done();
|
|
|
509 |
});
|
|
|
510 |
},
|
|
|
511 |
});
|
|
|
512 |
},
|
|
|
513 |
'aoColumns': [{
|
|
|
514 |
'mDataProp': 'name'
|
|
|
515 |
},
|
|
|
516 |
{
|
|
|
517 |
'mDataProp': 'language'
|
|
|
518 |
},
|
|
|
519 |
{
|
|
|
520 |
'mDataProp': 'status'
|
|
|
521 |
},
|
|
|
522 |
{
|
|
|
523 |
'mDataProp': 'actions'
|
|
|
524 |
},
|
|
|
525 |
],
|
|
|
526 |
'columnDefs': [{
|
|
|
527 |
'targets': 0,
|
|
|
528 |
'className': 'text-vertical-middle',
|
|
|
529 |
},
|
|
|
530 |
{
|
|
|
531 |
'targets': 1,
|
|
|
532 |
'className': 'text-vertical-middle',
|
|
|
533 |
},
|
|
|
534 |
{
|
|
|
535 |
'targets': -2,
|
|
|
536 |
'orderable': false,
|
|
|
537 |
'className': 'text-center',
|
|
|
538 |
'render': function(data, type, row) {
|
|
|
539 |
checked = data == 'a' ? ' checked="checked" ' : '';
|
|
|
540 |
return '<div class="checkbox checkbox-success">' +
|
|
|
541 |
'<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
|
|
|
542 |
'<label ></label></div>';
|
|
|
543 |
}
|
|
|
544 |
},
|
|
|
545 |
{
|
|
|
546 |
'targets': -1,
|
|
|
547 |
'orderable': false,
|
|
|
548 |
'render': function(data, type, row) {
|
|
|
549 |
s = '';
|
|
|
550 |
if (allowEdit) {
|
|
|
551 |
s = s + '<button class="btn btn-primary btn-edit-form" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button> ';
|
|
|
552 |
}
|
|
|
553 |
if (allowDelete) {
|
|
|
554 |
s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete'] + '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button> ';
|
|
|
555 |
}
|
|
|
556 |
return s;
|
|
|
557 |
}
|
|
|
558 |
}
|
|
|
559 |
],
|
|
|
560 |
});
|
|
|
561 |
/**
|
|
|
562 |
* Clicked on edit form
|
|
|
563 |
*/
|
|
|
564 |
$('body').on('click', 'button.btn-edit-form', function(e) {
|
|
|
565 |
e.preventDefault();
|
|
|
566 |
form_id = $(this).data('id')
|
|
|
567 |
var action = $(this).data('href');
|
|
|
568 |
$.ajax({
|
|
|
569 |
'dataType': 'json',
|
|
|
570 |
'accept': 'application/json',
|
|
|
571 |
'method': 'get',
|
|
|
572 |
'url': action,
|
|
|
573 |
}).done(function(response) {
|
|
|
574 |
if (response['success']) {
|
|
|
575 |
validatorForm.resetForm();
|
|
|
576 |
$('#form-main').attr('action', action);
|
|
|
577 |
$('#form-main #form-id').val(response['data']['id']),
|
|
|
578 |
$('#form-main #form-continue').val('0');
|
|
|
579 |
$('#form-main #form-name').val(response['data']['name']),
|
|
|
580 |
|
|
|
581 |
/*----------Set Ckeditor ------------*/
|
|
|
582 |
CKEDITOR.instances['form-description'].setData(response['data']['description']);
|
|
|
583 |
CKEDITOR.instances['form-text'].setData(response['data']['text']);
|
|
|
584 |
|
|
|
585 |
$('#form-main #form-language').val(response['data']['language']),
|
|
|
586 |
$('#form-main #form-status').val(response['data']['status']);
|
|
|
587 |
|
|
|
588 |
/*-------------Render Sections -------*/
|
|
|
589 |
|
|
|
590 |
objFormGenerator.clear();
|
|
|
591 |
objFormGenerator.sections = response['data']['content'] || [];
|
|
|
592 |
objFormGenerator.render();
|
|
|
593 |
renderSectionData(objFormGenerator.sections);
|
|
|
594 |
|
|
|
595 |
$('#row-forms').hide();
|
|
|
596 |
$('#row-edit').show();
|
|
|
597 |
$('#form-main #form-name').focus();
|
|
|
598 |
|
|
|
599 |
} else {
|
|
|
600 |
$.fn.showError(response['message'] || 'ERROR_UNKNOWN');
|
|
|
601 |
}
|
|
|
602 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
603 |
$.fn.showError(textStatus);
|
|
|
604 |
});
|
|
|
605 |
});
|
|
|
606 |
$(document).on('click', '[data-type="select_all"]', function() {
|
|
|
607 |
if ($('input[name="select_all"]:checked').val() == 'all') {
|
|
|
608 |
$('[data-type="select"]').prop('checked', true);
|
|
|
609 |
$('[data-action="delete"]').removeClass('hide');
|
|
|
610 |
} else {
|
|
|
611 |
$('[data-type="select"]').prop('checked', false);
|
|
|
612 |
$('[data-action="delete"]').addClass('hide');
|
|
|
613 |
}
|
|
|
614 |
});
|
|
|
615 |
|
|
|
616 |
function getLength() {
|
|
|
617 |
return $('[data-type="select"]').length;
|
|
|
618 |
}
|
|
|
619 |
|
|
|
620 |
function currentSelected() {
|
|
|
621 |
var selected = [];
|
|
|
622 |
$.each($("input[name='select[]']:checked"), function() {
|
|
|
623 |
selected.push($(this).val());
|
|
|
624 |
});
|
|
|
625 |
return selected;
|
|
|
626 |
}
|
|
|
627 |
$(document).on('change', "input[name='select[]']", function() {
|
|
|
628 |
var c = currentSelected();
|
|
|
629 |
var cc = getLength();
|
|
|
630 |
if (c.length == cc) {
|
|
|
631 |
if ($('[data-action="delete"]').hasClass('hide')) {
|
|
|
632 |
$('[data-action="delete"]').removeClass('hide');
|
|
|
633 |
}
|
|
|
634 |
return true;
|
|
|
635 |
} else {
|
|
|
636 |
$('input[name="select_all"]').prop('checked', false);
|
|
|
637 |
}
|
|
|
638 |
if (c.length > 0) {
|
|
|
639 |
if ($('[data-action="delete"]').hasClass('hide')) {
|
|
|
640 |
$('[data-action="delete"]').removeClass('hide');
|
|
|
641 |
}
|
|
|
642 |
} else {
|
|
|
643 |
if (!$('[data-action="delete"]').hasClass('hide')) {
|
|
|
644 |
$('[data-action="delete"]').addClass('hide');
|
|
|
645 |
}
|
|
|
646 |
}
|
|
|
647 |
});
|
|
|
648 |
var form3 = $('#form_sample_3');
|
|
|
649 |
var error3 = $('.alert-danger', form3);
|
|
|
650 |
var success3 = $('.alert-success', form3);
|
|
|
651 |
//IMPORTANT: update CKEDITOR textarea with actual content before submit
|
|
|
652 |
$("#form-main").on('submit', function() {
|
|
|
653 |
for (var instanceName in CKEDITOR.instances) {
|
|
|
654 |
CKEDITOR.instances[instanceName].updateElement();
|
|
|
655 |
}
|
|
|
656 |
})
|
|
|
657 |
/**
|
|
|
658 |
* Validate rules form
|
|
|
659 |
*/
|
|
|
660 |
var validatorForm = $("#form-main").validate({
|
|
|
661 |
ignore: [],
|
|
|
662 |
errorClass: 'help-block',
|
|
|
663 |
errorElement: 'span',
|
|
|
664 |
rules: {
|
|
|
665 |
'form-name': {
|
|
|
666 |
required: true,
|
|
|
667 |
minlength: 2,
|
|
|
668 |
maxlength: 50
|
|
|
669 |
},
|
|
|
670 |
'form-description': {
|
|
|
671 |
required: true,
|
|
|
672 |
},
|
|
|
673 |
'form-text': {
|
|
|
674 |
required: true,
|
|
|
675 |
},
|
|
|
676 |
'form-language': {
|
|
|
677 |
required: true,
|
|
|
678 |
},
|
|
|
679 |
'forrm-status': {
|
|
|
680 |
required: true,
|
|
|
681 |
},
|
|
|
682 |
},
|
|
|
683 |
highlight: function(element) {
|
|
|
684 |
$(element).closest('.form-group').addClass('has-error');
|
|
|
685 |
},
|
|
|
686 |
unhighlight: function(element) {
|
|
|
687 |
$(element).closest('.form-group').removeClass('has-error');
|
|
|
688 |
},
|
|
|
689 |
errorPlacement: function(error, element) {
|
|
|
690 |
if (element.attr("data-error-container")) {
|
|
|
691 |
error.appendTo(element.attr("data-error-container"));
|
|
|
692 |
} else {
|
|
|
693 |
error.insertAfter(element);
|
|
|
694 |
}
|
|
|
695 |
},
|
|
|
696 |
invalidHandler: function(form, validator) {
|
|
|
697 |
if (!validator.numberOfInvalids())
|
|
|
698 |
return;
|
|
|
699 |
$('html, body').animate({
|
|
|
700 |
scrollTop: $(validator.errorList[0].element).offset().top - 100
|
|
|
701 |
}, 1000);
|
|
|
702 |
},
|
|
|
703 |
submitHandler: function(form) {
|
|
|
704 |
var error = false;
|
|
|
705 |
if (objFormGenerator.sections.length == 0) {
|
|
|
706 |
$.fn.showError('ERROR_SECCTIONS');
|
|
|
707 |
return false;
|
|
|
708 |
} else {
|
|
|
709 |
for (i = 0; i < objFormGenerator.sections.length; i++) {
|
997 |
geraldo |
710 |
if (objFormGenerator.sections[i].sections.length == 0) {
|
|
|
711 |
$.fn.showError('ERROR_sectionS'.replace('%s', objFormGenerator.sections[i].name));
|
977 |
geraldo |
712 |
return false;
|
|
|
713 |
}
|
|
|
714 |
var valueSection = parseInt(objFormGenerator.sections[i].value);
|
997 |
geraldo |
715 |
var totalValuesection = 0;
|
|
|
716 |
for (j = 0; j < objFormGenerator.sections[i].sections.length; j++) {
|
|
|
717 |
valuesection = parseInt(objFormGenerator.sections[i].sections[j].value);
|
|
|
718 |
totalValuesection = totalValuesection + valuesection;
|
|
|
719 |
if (objFormGenerator.sections[i].sections[j].type == 'simple' ||
|
|
|
720 |
objFormGenerator.sections[i].sections[j].type == 'multiple' ||
|
|
|
721 |
objFormGenerator.sections[i].sections[j].type == 'rating-open') {
|
|
|
722 |
var sectionNumber = j + 1;
|
977 |
geraldo |
723 |
var numberCorrect = 0;
|
997 |
geraldo |
724 |
if (objFormGenerator.sections[i].sections[j].options.length == 0) {
|
|
|
725 |
$.fn.showError('ERROR_OPTIONS'.replace('%s', objFormGenerator.sections[i].name).replace('%n', sectionNumber));
|
977 |
geraldo |
726 |
return false;
|
|
|
727 |
}
|
|
|
728 |
var totalOption = 0;
|
|
|
729 |
var maxOption = 0;
|
997 |
geraldo |
730 |
for (k = 0; k < objFormGenerator.sections[i].sections[j].options.length; k++) {
|
|
|
731 |
if (objFormGenerator.sections[i].sections[j].type == 'simple' || objFormGenerator.sections[i].sections[j].type == 'multiple') {
|
|
|
732 |
if (objFormGenerator.sections[i].sections[j].options[k].correct == 1) {
|
977 |
geraldo |
733 |
numberCorrect++;
|
|
|
734 |
}
|
|
|
735 |
}
|
997 |
geraldo |
736 |
if (objFormGenerator.sections[i].sections[j].type == 'multiple' && objFormGenerator.sections[i].sections[j].options[k].correct == 1) {
|
|
|
737 |
totalOption = totalOption + parseInt(objFormGenerator.sections[i].sections[j].options[k].value);
|
977 |
geraldo |
738 |
}
|
997 |
geraldo |
739 |
if (objFormGenerator.sections[i].sections[j].type == 'rating-open') {
|
|
|
740 |
if (parseInt(objFormGenerator.sections[i].sections[j].options[k].value) > maxOption) {
|
|
|
741 |
maxOption = parseInt(objFormGenerator.sections[i].sections[j].options[k].value);
|
977 |
geraldo |
742 |
}
|
|
|
743 |
}
|
|
|
744 |
}
|
997 |
geraldo |
745 |
if (objFormGenerator.sections[i].sections[j].type == 'simple' || objFormGenerator.sections[i].sections[j].type == 'multiple') {
|
977 |
geraldo |
746 |
if (numberCorrect == 0) {
|
997 |
geraldo |
747 |
$.fn.showError('ERROR_OPTIONS_CORRECT'.replace('%s', objFormGenerator.sections[i].name).replace('%n', sectionNumber));
|
977 |
geraldo |
748 |
return false;
|
|
|
749 |
}
|
|
|
750 |
if (
|
997 |
geraldo |
751 |
objFormGenerator.sections[i].sections[j].type == 'simple' && numberCorrect > 1) {
|
|
|
752 |
$.fn.showError('ERROR_OPTIONS_DUPLICATE_CORRECT'.replace('%s', objFormGenerator.sections[i].name).replace('%n', sectionNumber));
|
977 |
geraldo |
753 |
return false;
|
|
|
754 |
}
|
997 |
geraldo |
755 |
if (objFormGenerator.sections[i].sections[j].type == 'multiple' && numberCorrect == 1) {
|
|
|
756 |
$.fn.showError('ERROR_OPTIONS_ONE_CORRECT'.replace('%s', objFormGenerator.sections[i].name).replace('%n', sectionNumber));
|
977 |
geraldo |
757 |
return false;
|
|
|
758 |
}
|
|
|
759 |
}
|
997 |
geraldo |
760 |
if (objFormGenerator.sections[i].sections[j].type == 'multiple' && totalOption != valuesection) {
|
|
|
761 |
$.fn.showError('ERROR_OPTIONS_SUM_VALUES'.replace('%s', objFormGenerator.sections[i].name).replace('%n', sectionNumber));
|
977 |
geraldo |
762 |
return false;
|
|
|
763 |
}
|
997 |
geraldo |
764 |
if (objFormGenerator.sections[i].sections[j].type == 'rating-open' && maxOption > valuesection) {
|
|
|
765 |
$.fn.showError('ERROR_OPTIONS_MAX_OPTION'.replace('%s', objFormGenerator.sections[i].name).replace('%n', sectionNumber));
|
977 |
geraldo |
766 |
return false;
|
|
|
767 |
}
|
|
|
768 |
}
|
|
|
769 |
}
|
997 |
geraldo |
770 |
if (valueSection != totalValuesection) {
|
977 |
geraldo |
771 |
$.fn.showError('ERROR_VALUE_SECTIONS'.replace('%s', objFormGenerator.sections[i].name));
|
|
|
772 |
return false;
|
|
|
773 |
}
|
|
|
774 |
}
|
|
|
775 |
var formId = parseInt($('#form-main #form-id').val());
|
|
|
776 |
var formContinue = parseInt($('#form-main #form-continue').val());
|
|
|
777 |
var data = {
|
|
|
778 |
'id': formId,
|
|
|
779 |
'name': $('#form-main #form-name').val(),
|
|
|
780 |
'description': $('#form-main #form-description').val(),
|
|
|
781 |
'text': $('#form-main #form-text').val(),
|
|
|
782 |
'language': $('#form-main #form-language').val(),
|
|
|
783 |
'status': $('#form-main #form-status').val(),
|
|
|
784 |
'content': JSON.stringify(objFormGenerator.sections)
|
|
|
785 |
}
|
|
|
786 |
$.ajax({
|
|
|
787 |
'dataType': 'json',
|
|
|
788 |
'method': 'post',
|
|
|
789 |
'url': $('#form-main').attr('action'),
|
|
|
790 |
'data': data,
|
|
|
791 |
}).done(function(response) {
|
|
|
792 |
if (response['success']) {
|
|
|
793 |
$.fn.showSuccess(response['data']);
|
|
|
794 |
if (formContinue == 1) {
|
|
|
795 |
$('#form-main').attr('action',response['action_edit']);
|
|
|
796 |
$('#form-main #form-id').val(response['id']);
|
|
|
797 |
$('#form-main #form-continue').val(0);
|
|
|
798 |
} else {
|
|
|
799 |
$('#row-edit').hide();
|
|
|
800 |
$('#row-forms').show();
|
|
|
801 |
/*---------- Reset Form -------- */
|
|
|
802 |
$('#form-main')[0].reset();
|
|
|
803 |
/*--------Reset Ckeditor ----------*/
|
|
|
804 |
CKEDITOR.instances['form-text'].setData('');
|
|
|
805 |
CKEDITOR.instances['form-description'].setData('');
|
|
|
806 |
/*--------Reset Sections ----------*/
|
|
|
807 |
clearSectionData();
|
|
|
808 |
/* ------- Refresh Table -----------*/
|
|
|
809 |
|
|
|
810 |
}
|
|
|
811 |
tableForm.fnDraw();
|
|
|
812 |
} else {
|
|
|
813 |
$.fn.showError(response['message'] || 'ERROR_UNKNOWN');
|
|
|
814 |
}
|
|
|
815 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
816 |
$.fn.showError(textStatus);
|
|
|
817 |
});
|
|
|
818 |
return false;
|
|
|
819 |
}
|
|
|
820 |
}
|
|
|
821 |
});
|
|
|
822 |
/**
|
997 |
geraldo |
823 |
* Validate rules form sections
|
977 |
geraldo |
824 |
*/
|
997 |
geraldo |
825 |
var validatorFormsection = $("#form-section").validate({
|
977 |
geraldo |
826 |
ignore: [],
|
|
|
827 |
errorClass: 'help-block',
|
|
|
828 |
errorElement: 'span',
|
|
|
829 |
rules: {
|
995 |
geraldo |
830 |
'section-text': {
|
977 |
geraldo |
831 |
required: true,
|
|
|
832 |
},
|
995 |
geraldo |
833 |
'section-value': {
|
977 |
geraldo |
834 |
required: true,
|
|
|
835 |
number: true,
|
|
|
836 |
min: 1
|
|
|
837 |
},
|
995 |
geraldo |
838 |
'section-type': {
|
977 |
geraldo |
839 |
required: true,
|
|
|
840 |
},
|
995 |
geraldo |
841 |
'section-max-length': {
|
977 |
geraldo |
842 |
required: true,
|
|
|
843 |
digits: true,
|
|
|
844 |
min: 0
|
|
|
845 |
},
|
995 |
geraldo |
846 |
'section-range': {
|
977 |
geraldo |
847 |
required: true,
|
|
|
848 |
number: true,
|
|
|
849 |
min: 1
|
|
|
850 |
},
|
|
|
851 |
},
|
|
|
852 |
highlight: function(element) {
|
|
|
853 |
$(element).closest('.form-group').addClass('has-error');
|
|
|
854 |
},
|
|
|
855 |
unhighlight: function(element) {
|
|
|
856 |
$(element).closest('.form-group').removeClass('has-error');
|
|
|
857 |
},
|
|
|
858 |
errorPlacement: function(error, element) {
|
|
|
859 |
if (element.attr("data-error-container")) {
|
|
|
860 |
error.appendTo(element.attr("data-error-container"));
|
|
|
861 |
} else {
|
|
|
862 |
error.insertAfter(element);
|
|
|
863 |
}
|
|
|
864 |
},
|
|
|
865 |
invalidHandler: function(form, validator) {
|
|
|
866 |
if (!validator.numberOfInvalids())
|
|
|
867 |
return;
|
|
|
868 |
$('html, body').animate({
|
|
|
869 |
scrollTop: $(validator.errorList[0].element).offset().top - 100
|
|
|
870 |
}, 1000);
|
|
|
871 |
},
|
|
|
872 |
submitHandler: function(form) {
|
993 |
geraldo |
873 |
if ($('#form-section #section-id').val()) {
|
997 |
geraldo |
874 |
objFormGenerator.editsection(
|
995 |
geraldo |
875 |
$('#form-section #section-section').val(),
|
993 |
geraldo |
876 |
$('#form-section #section-id').val(),
|
995 |
geraldo |
877 |
$('#form-section #section-text').val(),
|
|
|
878 |
$('#form-section #section-value').val(),
|
|
|
879 |
$('#form-section #section-type').val(),
|
|
|
880 |
$('#form-section #section-max-length').val(),
|
|
|
881 |
$('#form-section #section-multiline').val(),
|
|
|
882 |
$('#form-section #section-range').val()
|
977 |
geraldo |
883 |
);
|
|
|
884 |
} else {
|
997 |
geraldo |
885 |
objFormGenerator.addsection(
|
995 |
geraldo |
886 |
$('#form-section #section-section').val(),
|
|
|
887 |
$('#form-section #section-text').val(),
|
|
|
888 |
$('#form-section #section-value').val(),
|
|
|
889 |
$('#form-section #section-type').val(),
|
|
|
890 |
$('#form-section #section-max-length').val(),
|
|
|
891 |
$('#form-section #section-multiline').val(),
|
|
|
892 |
$('#form-section #section-range').val()
|
977 |
geraldo |
893 |
);
|
|
|
894 |
}
|
|
|
895 |
renderSectionData(objFormGenerator.sections);
|
993 |
geraldo |
896 |
$('#modal-section').modal('hide');
|
977 |
geraldo |
897 |
return false;
|
|
|
898 |
}
|
|
|
899 |
});
|
|
|
900 |
//IMPORTANT: update CKEDITOR textarea with actual content before submit
|
|
|
901 |
$("#form-option").on('submit', function() {
|
|
|
902 |
for (var instanceName in CKEDITOR.instances) {
|
|
|
903 |
CKEDITOR.instances[instanceName].updateElement();
|
|
|
904 |
}
|
|
|
905 |
})
|
|
|
906 |
/**
|
|
|
907 |
* Validate rules form options
|
|
|
908 |
*/
|
|
|
909 |
var validatorFormOption = $("#form-option").validate({
|
|
|
910 |
ignore: [],
|
|
|
911 |
errorClass: 'help-block',
|
|
|
912 |
errorElement: 'span',
|
|
|
913 |
rules: {
|
|
|
914 |
'option-text': {
|
|
|
915 |
required: true,
|
|
|
916 |
},
|
|
|
917 |
'option-value': {
|
|
|
918 |
required: true,
|
|
|
919 |
number: true,
|
|
|
920 |
min: 1
|
|
|
921 |
}
|
|
|
922 |
},
|
|
|
923 |
highlight: function(element) {
|
|
|
924 |
$(element).closest('.form-group').addClass('has-error');
|
|
|
925 |
},
|
|
|
926 |
unhighlight: function(element) {
|
|
|
927 |
$(element).closest('.form-group').removeClass('has-error');
|
|
|
928 |
},
|
|
|
929 |
errorPlacement: function(error, element) {
|
|
|
930 |
if (element.attr("data-error-container")) {
|
|
|
931 |
error.appendTo(element.attr("data-error-container"));
|
|
|
932 |
} else {
|
|
|
933 |
error.insertAfter(element);
|
|
|
934 |
}
|
|
|
935 |
},
|
|
|
936 |
invalidHandler: function(form, validator) {
|
|
|
937 |
if (!validator.numberOfInvalids())
|
|
|
938 |
return;
|
|
|
939 |
$('html, body').animate({
|
|
|
940 |
scrollTop: $(validator.errorList[0].element).offset().top - 100
|
|
|
941 |
}, 1000);
|
|
|
942 |
},
|
|
|
943 |
submitHandler: function(form) {
|
|
|
944 |
if ($('#form-option #option-slug').val()) {
|
|
|
945 |
objFormGenerator.editOption(
|
|
|
946 |
$('#form-option #option-section').val(),
|
997 |
geraldo |
947 |
$('#form-option #option-section').val(),
|
977 |
geraldo |
948 |
$('#form-option #option-slug').val(),
|
|
|
949 |
$('#form-option #option-text').val(),
|
|
|
950 |
$('#form-option #option-correct').val(),
|
|
|
951 |
$('#form-option #option-value').val()
|
|
|
952 |
);
|
|
|
953 |
} else {
|
|
|
954 |
objFormGenerator.addOption(
|
|
|
955 |
$('#form-option #option-section').val(),
|
997 |
geraldo |
956 |
$('#form-option #option-section').val(),
|
977 |
geraldo |
957 |
$('#form-option #option-text').val(),
|
|
|
958 |
$('#form-option #option-correct').val(),
|
|
|
959 |
$('#form-option #option-value').val()
|
|
|
960 |
);
|
|
|
961 |
}
|
|
|
962 |
renderSectionData(objFormGenerator.sections);
|
|
|
963 |
$('#modal-option').modal('hide');
|
|
|
964 |
return false;
|
|
|
965 |
}
|
|
|
966 |
});
|
|
|
967 |
/**
|
997 |
geraldo |
968 |
* Clicked add new section
|
977 |
geraldo |
969 |
*/
|
993 |
geraldo |
970 |
$('body').on('click', 'button.btn-add-section', function(e) {
|
|
|
971 |
$('#modal-section').modal('show');
|
977 |
geraldo |
972 |
});
|
|
|
973 |
/**
|
997 |
geraldo |
974 |
* Clicked edit section
|
977 |
geraldo |
975 |
*/
|
993 |
geraldo |
976 |
$('body').on('click', 'button.btn-edit-section', function(e) {
|
977 |
geraldo |
977 |
e.preventDefault();
|
|
|
978 |
var slug_section = $(this).data('section');
|
997 |
geraldo |
979 |
var slug = $(this).data('section');
|
977 |
geraldo |
980 |
var showForm = false;
|
997 |
geraldo |
981 |
|
977 |
geraldo |
982 |
});
|
|
|
983 |
/**
|
997 |
geraldo |
984 |
* Clicked remove section
|
977 |
geraldo |
985 |
*/
|
993 |
geraldo |
986 |
$('body').on('click', 'button.btn-delete-section', function(e) {
|
977 |
geraldo |
987 |
e.preventDefault();
|
|
|
988 |
var slug_section = $(this).data('section');
|
997 |
geraldo |
989 |
var slug = $(this).data('section');
|
977 |
geraldo |
990 |
bootbox.confirm({
|
993 |
geraldo |
991 |
title: "LABEL_DELETE LABEL_SECTION",
|
|
|
992 |
message: "LABEL_SECTION_DELETE",
|
977 |
geraldo |
993 |
buttons: {
|
|
|
994 |
cancel: {
|
|
|
995 |
label: '<i class="fa fa-times"></i> LABEL_CANCEL'
|
|
|
996 |
},
|
|
|
997 |
confirm: {
|
|
|
998 |
label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
|
|
|
999 |
}
|
|
|
1000 |
},
|
|
|
1001 |
callback: function(result) {
|
|
|
1002 |
if (result) {
|
997 |
geraldo |
1003 |
objFormGenerator.deletesection(slug_section, slug);
|
977 |
geraldo |
1004 |
renderSectionData(objFormGenerator.sections);
|
|
|
1005 |
}
|
|
|
1006 |
}
|
|
|
1007 |
});
|
|
|
1008 |
});
|
|
|
1009 |
/**
|
|
|
1010 |
* Clicked add new Option
|
|
|
1011 |
*/
|
|
|
1012 |
$('body').on('click', 'button.btn-add-option', function(e) {
|
|
|
1013 |
e.preventDefault();
|
|
|
1014 |
var slug_section = $(this).data('section');
|
997 |
geraldo |
1015 |
var slug_section = $(this).data('section');
|
977 |
geraldo |
1016 |
var showForm = false;
|
|
|
1017 |
for (i = 0; i < objFormGenerator.sections.length; i++) {
|
|
|
1018 |
if (slug_section == objFormGenerator.sections[i].slug_section) {
|
997 |
geraldo |
1019 |
for (j = 0; j < objFormGenerator.sections[i].sections.length; j++) {
|
|
|
1020 |
if (slug_section == objFormGenerator.sections[i].sections[j].slug_section) {
|
977 |
geraldo |
1021 |
validatorFormOption.resetForm();
|
|
|
1022 |
$('#form-option #option-section').val(slug_section);
|
997 |
geraldo |
1023 |
$('#form-option #option-section').val(slug_section);
|
977 |
geraldo |
1024 |
$('#form-option #option-slug').val('');
|
|
|
1025 |
CKEDITOR.instances['option-text'].setData('', function() {
|
|
|
1026 |
editor.focus();
|
|
|
1027 |
});
|
|
|
1028 |
$('#form-option #option-correct').val('0');
|
997 |
geraldo |
1029 |
if (objFormGenerator.sections[i].sections[j].type == 'rating-open') {
|
977 |
geraldo |
1030 |
$('#form-option #option-correct').parent().hide();
|
|
|
1031 |
} else {
|
|
|
1032 |
$('#form-option #option-correct').parent().show();
|
|
|
1033 |
}
|
997 |
geraldo |
1034 |
if (objFormGenerator.sections[i].sections[j].type == 'multiple' || objFormGenerator.sections[i].sections[j].type == 'rating-open') {
|
977 |
geraldo |
1035 |
$('#form-option #option-value').val('0');
|
|
|
1036 |
$('#form-option #option-value').parent().show();
|
|
|
1037 |
} else {
|
|
|
1038 |
$('#form-option #option-value').val('1');
|
|
|
1039 |
$('#form-option #option-value').parent().hide();
|
|
|
1040 |
}
|
|
|
1041 |
renderSectionData(objFormGenerator.sections);
|
|
|
1042 |
$('#modal-option h4[class="modal-title"]').html('LABEL_ADD LABEL_OPTION');
|
|
|
1043 |
$('#modal-option').modal('show');
|
|
|
1044 |
return true;
|
|
|
1045 |
}
|
|
|
1046 |
}
|
|
|
1047 |
}
|
|
|
1048 |
}
|
|
|
1049 |
});
|
|
|
1050 |
/**
|
|
|
1051 |
* Clicked edit option
|
|
|
1052 |
*/
|
|
|
1053 |
$('body').on('click', 'button.btn-edit-option', function(e) {
|
|
|
1054 |
e.preventDefault();
|
|
|
1055 |
var slug_section = $(this).data('section');
|
997 |
geraldo |
1056 |
var slug_section = $(this).data('section');
|
977 |
geraldo |
1057 |
var slug = $(this).data('slug');
|
|
|
1058 |
var showForm = false;
|
|
|
1059 |
for (i = 0; i < objFormGenerator.sections.length; i++) {
|
|
|
1060 |
if (slug_section == objFormGenerator.sections[i].slug_section) {
|
997 |
geraldo |
1061 |
for (j = 0; j < objFormGenerator.sections[i].sections.length; j++) {
|
|
|
1062 |
if (slug_section == objFormGenerator.sections[i].sections[j].slug_section) {
|
|
|
1063 |
for (k = 0; k < objFormGenerator.sections[i].sections[j].options.length; k++) {
|
|
|
1064 |
if (slug == objFormGenerator.sections[i].sections[j].options[k].slug_option) {
|
977 |
geraldo |
1065 |
validatorFormOption.resetForm();
|
|
|
1066 |
$('#form-option #option-section').val(objFormGenerator.sections[i].slug_section);
|
997 |
geraldo |
1067 |
$('#form-option #option-section').val(objFormGenerator.sections[i].sections[j].slug_section);
|
|
|
1068 |
$('#form-option #option-slug').val(objFormGenerator.sections[i].sections[j].options[k].slug_option);
|
|
|
1069 |
CKEDITOR.instances['option-text'].setData(objFormGenerator.sections[i].sections[j].options[k].text,
|
977 |
geraldo |
1070 |
function() {
|
|
|
1071 |
editor.focus();
|
|
|
1072 |
});
|
997 |
geraldo |
1073 |
$('#form-option #option-correct').val(objFormGenerator.sections[i].sections[j].options[k].correct);
|
|
|
1074 |
if (objFormGenerator.sections[i].sections[j].type == 'multiple' || objFormGenerator.sections[i].sections[j].type == 'simple') {
|
977 |
geraldo |
1075 |
$('#form-option #option-correct').parent().show();
|
|
|
1076 |
} else {
|
|
|
1077 |
$('#form-option #option-correct').parent().hide();
|
|
|
1078 |
}
|
997 |
geraldo |
1079 |
$('#form-option #option-value').val(objFormGenerator.sections[i].sections[j].options[k].value);
|
|
|
1080 |
if (objFormGenerator.sections[i].sections[j].type == 'multiple' || objFormGenerator.sections[i].sections[j].type == 'rating-open') {
|
977 |
geraldo |
1081 |
$('#form-option #option-value').parent().show();
|
|
|
1082 |
} else {
|
|
|
1083 |
$('#form-option #option-value').parent().hide();
|
|
|
1084 |
}
|
|
|
1085 |
showForm = true;
|
|
|
1086 |
break;
|
|
|
1087 |
}
|
|
|
1088 |
}
|
|
|
1089 |
}
|
|
|
1090 |
if (showForm) {
|
|
|
1091 |
break;
|
|
|
1092 |
}
|
|
|
1093 |
}
|
|
|
1094 |
}
|
|
|
1095 |
if (showForm) {
|
|
|
1096 |
break;
|
|
|
1097 |
}
|
|
|
1098 |
}
|
|
|
1099 |
if (showForm) {
|
|
|
1100 |
$('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
|
|
|
1101 |
$('#modal-option').modal('show');
|
|
|
1102 |
}
|
|
|
1103 |
});
|
|
|
1104 |
/**
|
|
|
1105 |
* Clicked remove option
|
|
|
1106 |
*/
|
|
|
1107 |
$('body').on('click', 'button.btn-delete-option', function(e) {
|
|
|
1108 |
e.preventDefault();
|
|
|
1109 |
var slug_section = $(this).data('section');
|
997 |
geraldo |
1110 |
var slug_section = $(this).data('section');
|
977 |
geraldo |
1111 |
var slug = $(this).data('slug');
|
|
|
1112 |
bootbox.confirm({
|
|
|
1113 |
title: "LABEL_DELETE LABEL_OPTION",
|
993 |
geraldo |
1114 |
message: "LABEL_SECTION_DELETE",
|
977 |
geraldo |
1115 |
buttons: {
|
|
|
1116 |
cancel: {
|
|
|
1117 |
label: '<i class="fa fa-times"></i> LABEL_CANCEL'
|
|
|
1118 |
},
|
|
|
1119 |
confirm: {
|
|
|
1120 |
label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
|
|
|
1121 |
}
|
|
|
1122 |
},
|
|
|
1123 |
callback: function(result) {
|
|
|
1124 |
if (result) {
|
997 |
geraldo |
1125 |
objFormGenerator.deleteOption(slug_section, slug_section, slug);
|
977 |
geraldo |
1126 |
renderSectionData(objFormGenerator.sections);
|
|
|
1127 |
}
|
|
|
1128 |
}
|
|
|
1129 |
});
|
|
|
1130 |
})
|
|
|
1131 |
/**
|
|
|
1132 |
* Clicked new Form
|
|
|
1133 |
*/
|
|
|
1134 |
$('button.btn-add-form').click(function(e) {
|
|
|
1135 |
e.preventDefault();
|
|
|
1136 |
objFormGenerator.clear();
|
|
|
1137 |
objFormGenerator.render();
|
|
|
1138 |
validatorForm.resetForm();
|
|
|
1139 |
clearSectionData();
|
|
|
1140 |
$('#form-main').attr('action', '$routeAdd');
|
|
|
1141 |
$('#form-main #form-id').val('0');
|
|
|
1142 |
$('#form-main #form-continue').val('0');
|
|
|
1143 |
$('#form-main #form-name').val('');
|
|
|
1144 |
$('#row-forms').hide();
|
|
|
1145 |
$('#row-edit').show();
|
|
|
1146 |
$('#form-main #form-name').focus();
|
|
|
1147 |
});
|
|
|
1148 |
/**
|
|
|
1149 |
* Clicked cancel new/edit Form
|
|
|
1150 |
*/
|
|
|
1151 |
$('button.btn-edit-cancel').click(function(e) {
|
|
|
1152 |
e.preventDefault();
|
|
|
1153 |
$('#row-edit').hide();
|
|
|
1154 |
$('#row-forms').show();
|
|
|
1155 |
});
|
|
|
1156 |
/**
|
|
|
1157 |
* Clicked save and continue new Form
|
|
|
1158 |
*/
|
|
|
1159 |
$('button.btn-form-save-continue').click(function(e) {
|
|
|
1160 |
e.preventDefault();
|
|
|
1161 |
$('#form-main #form-continue').val('1')
|
|
|
1162 |
$('#form-main').submit();
|
|
|
1163 |
});
|
|
|
1164 |
/**
|
|
|
1165 |
* Clicked save and close new/edit Form
|
|
|
1166 |
*/
|
|
|
1167 |
$('button.btn-form-save-close').click(function(e) {
|
|
|
1168 |
e.preventDefault();
|
|
|
1169 |
$('#form-main #form-continue').val('0')
|
|
|
1170 |
$('#form-main').submit();
|
|
|
1171 |
});
|
|
|
1172 |
/**
|
997 |
geraldo |
1173 |
* Get section type
|
977 |
geraldo |
1174 |
*/
|
997 |
geraldo |
1175 |
const getsectionTypeBySlug = (slug_section, slug_section) => {
|
977 |
geraldo |
1176 |
for (i = 0; i < objFormGenerator.sections.length; i++) {
|
|
|
1177 |
if (slug_section == objFormGenerator.sections[i].slug_section) {
|
997 |
geraldo |
1178 |
for (j = 0; j < objFormGenerator.sections[i].sections.length; j++) {
|
|
|
1179 |
if (slug_section == objFormGenerator.sections[i].sections[j].slug_section) {
|
|
|
1180 |
return objFormGenerator.sections[i].sections[j].type;
|
977 |
geraldo |
1181 |
}
|
|
|
1182 |
}
|
|
|
1183 |
}
|
|
|
1184 |
}
|
|
|
1185 |
}
|
|
|
1186 |
/**
|
|
|
1187 |
* Remove Html Tags
|
|
|
1188 |
*/
|
|
|
1189 |
const removeTags = (str) => str.toString().replace( /(<([^>]+)>)/ig, '')
|
|
|
1190 |
/**
|
|
|
1191 |
* Render Sections data
|
|
|
1192 |
*/
|
|
|
1193 |
const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
|
997 |
geraldo |
1194 |
getType: getsectionTypeBySlug,
|
977 |
geraldo |
1195 |
removeTags: removeTags
|
|
|
1196 |
}));
|
|
|
1197 |
|
|
|
1198 |
|
|
|
1199 |
/**
|
|
|
1200 |
* Clear Div Section data
|
|
|
1201 |
*/
|
|
|
1202 |
const clearSectionData = () => $("#rows").html('');
|
|
|
1203 |
/**
|
|
|
1204 |
* Clicked refresh button
|
|
|
1205 |
*/
|
|
|
1206 |
$('button.btn-refresh').click(function(e) {
|
|
|
1207 |
tableForm.fnDraw();
|
|
|
1208 |
});
|
|
|
1209 |
|
|
|
1210 |
});
|
|
|
1211 |
JS;
|
|
|
1212 |
$this->inlineScript()->captureEnd();
|
|
|
1213 |
?>
|
|
|
1214 |
|
|
|
1215 |
<!-- Content Header (Page header) -->
|
|
|
1216 |
<section class="content-header">
|
|
|
1217 |
<div class="container-fluid">
|
|
|
1218 |
<div class="row mb-2">
|
|
|
1219 |
<div class="col-sm-12">
|
984 |
geraldo |
1220 |
<h1>LABEL_PERFORMANCE_EVALUATION</h1>
|
977 |
geraldo |
1221 |
</div>
|
|
|
1222 |
</div>
|
|
|
1223 |
</div>
|
|
|
1224 |
<!-- /.container-fluid -->
|
|
|
1225 |
</section>
|
|
|
1226 |
<section class="content">
|
|
|
1227 |
<div class="container-fluid" id="row-forms">
|
|
|
1228 |
<div class="row">
|
|
|
1229 |
<div class="col-12">
|
|
|
1230 |
<div class="card">
|
|
|
1231 |
<div class="card-body">
|
|
|
1232 |
<table id="gridTable" class="table table-hover">
|
|
|
1233 |
<thead>
|
|
|
1234 |
<tr>
|
990 |
geraldo |
1235 |
<th>LABEL_NAME</th>
|
|
|
1236 |
<th>LABEL_LANGUAGE</th>
|
|
|
1237 |
<th>LABEL_ACTIVE</th>
|
977 |
geraldo |
1238 |
<th>LABEL_ACTIONS</th>
|
|
|
1239 |
</tr>
|
|
|
1240 |
</thead>
|
|
|
1241 |
<tbody></tbody>
|
|
|
1242 |
</table>
|
|
|
1243 |
</div>
|
|
|
1244 |
<div class="card-footer clearfix">
|
|
|
1245 |
<div style="float:right;">
|
|
|
1246 |
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
|
|
|
1247 |
<?php if ($allowAdd) : ?>
|
|
|
1248 |
<button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
|
|
|
1249 |
<?php endif; ?>
|
|
|
1250 |
</div>
|
|
|
1251 |
</div>
|
|
|
1252 |
</div>
|
|
|
1253 |
</div>
|
|
|
1254 |
</div>
|
|
|
1255 |
</div>
|
|
|
1256 |
|
|
|
1257 |
<!-- Create/Edit Form -->
|
|
|
1258 |
|
|
|
1259 |
<div class="row" id="row-edit" style="display: none">
|
|
|
1260 |
<div class="col-xs-12 col-md-12">
|
|
|
1261 |
<form action="#" name="form-main" id="form-main">
|
|
|
1262 |
<input type="hidden" name="form-id" id="form-id" value="0" />
|
|
|
1263 |
<input type="hidden" name="form-continue" id="form-continue" value="0" />
|
990 |
geraldo |
1264 |
<div class="form-group">
|
|
|
1265 |
<label for="form-name">LABEL_FIRST_NAME</label>
|
|
|
1266 |
<input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
|
|
|
1267 |
</div>
|
977 |
geraldo |
1268 |
<div class="row">
|
|
|
1269 |
<div class="col-xs-12 col-md-12 text-right">
|
994 |
geraldo |
1270 |
<button type="button" class="btn btn-primary" id="btn-add-section" data-toggle="tooltip" title="LABEL_ADD LABEL_SECTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_SECTION</button>
|
977 |
geraldo |
1271 |
</div>
|
|
|
1272 |
</div>
|
|
|
1273 |
<br />
|
|
|
1274 |
<div class="row">
|
|
|
1275 |
<div class="col-xs-12 col-md-12">
|
|
|
1276 |
<div class="panel-group" id="rows"></div>
|
|
|
1277 |
</div>
|
|
|
1278 |
</div>
|
|
|
1279 |
<div class="form-group">
|
|
|
1280 |
<button type="submit" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
|
|
|
1281 |
<button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
|
|
|
1282 |
<button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
|
|
|
1283 |
</div>
|
|
|
1284 |
</form>
|
|
|
1285 |
</div>
|
|
|
1286 |
</div>
|
|
|
1287 |
|
|
|
1288 |
<!-- Create/Edit Form-->
|
|
|
1289 |
|
990 |
geraldo |
1290 |
|
977 |
geraldo |
1291 |
|
997 |
geraldo |
1292 |
<!-- section Modal -->
|
977 |
geraldo |
1293 |
|
993 |
geraldo |
1294 |
<div id="modal-section" class="modal" tabindex="-1" role="dialog">
|
977 |
geraldo |
1295 |
<div class="modal-dialog modal-lg" role="document">
|
993 |
geraldo |
1296 |
<form action="#" name="form-section" id="form-section">
|
995 |
geraldo |
1297 |
<input type="hidden" name="section-section" id="section-section" />
|
993 |
geraldo |
1298 |
<input type="hidden" name="section-id" id="section-id" />
|
977 |
geraldo |
1299 |
<div class="modal-content">
|
|
|
1300 |
<div class="modal-header">
|
993 |
geraldo |
1301 |
<h4 class="modal-title">LABEL_ADD LABEL_SECTION</h4>
|
977 |
geraldo |
1302 |
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
1303 |
<span aria-hidden="true">×</span>
|
|
|
1304 |
</button>
|
|
|
1305 |
</div>
|
|
|
1306 |
<div class="modal-body">
|
|
|
1307 |
<div class="form-group">
|
995 |
geraldo |
1308 |
<label for="section-text">LABEL_TEXT</label>
|
977 |
geraldo |
1309 |
<!-- ckeditor -->
|
995 |
geraldo |
1310 |
<textarea name="section-text" id="section-text" rows="5" class="ckeditor form-control"></textarea>
|
977 |
geraldo |
1311 |
</div>
|
|
|
1312 |
<div class="form-group">
|
995 |
geraldo |
1313 |
<label for="section-value">LABEL_VALUE</label>
|
|
|
1314 |
<input type="text" name="section-value" id="section-value" class="form-control" />
|
990 |
geraldo |
1315 |
</div>
|
|
|
1316 |
<div class="form-group">
|
995 |
geraldo |
1317 |
<label for="section-type">LABEL_TYPE</label>
|
|
|
1318 |
<select name="section-type" id="section-type" class="form-control">
|
977 |
geraldo |
1319 |
<option value="open">LABEL_OPEN</option>
|
|
|
1320 |
<option value="simple">Simple</option>
|
|
|
1321 |
<option value="multiple">Multiple</option>
|
|
|
1322 |
</select>
|
|
|
1323 |
</div>
|
|
|
1324 |
<div class="form-group">
|
995 |
geraldo |
1325 |
<label for="section-max-length">LABEL_MAXLENGTH</label>
|
|
|
1326 |
<input type="text" name="section-max-length" id="section-max-length" class="form-control" />
|
977 |
geraldo |
1327 |
</div>
|
|
|
1328 |
</div>
|
|
|
1329 |
<div class="modal-footer">
|
|
|
1330 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
1331 |
<button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
|
|
|
1332 |
</div>
|
|
|
1333 |
</div>
|
|
|
1334 |
</form>
|
|
|
1335 |
</div>
|
|
|
1336 |
</div>
|
|
|
1337 |
|
997 |
geraldo |
1338 |
<!-- End Modal section -->
|
977 |
geraldo |
1339 |
|
|
|
1340 |
<!-- Modal Options -->
|
|
|
1341 |
|
|
|
1342 |
<div id="modal-option" class="modal" tabindex="-1" role="dialog">
|
|
|
1343 |
<div class="modal-dialog modal-lg" role="document">
|
|
|
1344 |
<form action="#" name="form-option" id="form-option">
|
|
|
1345 |
<input type="hidden" name="option-section" id="option-section" value="" />
|
997 |
geraldo |
1346 |
<input type="hidden" name="option-section" id="option-section" value="" />
|
977 |
geraldo |
1347 |
<input type="hidden" name="option-slug" id="option-slug" value="" />
|
|
|
1348 |
<div class="modal-content">
|
|
|
1349 |
<div class="modal-header">
|
|
|
1350 |
<h4 class="modal-title">LABEL_OPTION</h4>
|
|
|
1351 |
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
1352 |
<span aria-hidden="true">×</span>
|
|
|
1353 |
</button>
|
|
|
1354 |
</div>
|
|
|
1355 |
<div class="modal-body">
|
|
|
1356 |
<div class="form-group">
|
|
|
1357 |
<label for="option-text">LABEL_TEXT</label>
|
|
|
1358 |
<!-- ckeditor -->
|
|
|
1359 |
<textarea name="option-text" id="option-text" rows="5" class="ckeditor form-control"></textarea>
|
|
|
1360 |
</div>
|
|
|
1361 |
</div>
|
|
|
1362 |
<div class="modal-footer">
|
|
|
1363 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
1364 |
<button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
|
|
|
1365 |
</div>
|
|
|
1366 |
</div>
|
|
|
1367 |
</form>
|
|
|
1368 |
</div>
|
|
|
1369 |
</div>
|
|
|
1370 |
|
|
|
1371 |
<!-- End Modal Options -->
|
|
|
1372 |
|
|
|
1373 |
<!---Template Sections --->
|
|
|
1374 |
<script id="sectionTemplate" type="text/x-jsrender">
|
|
|
1375 |
<div class="panel panel-default" id="panel-{{:slug_section}}">
|
|
|
1376 |
<div class="panel-heading">
|
|
|
1377 |
<h4 class="panel-title">
|
|
|
1378 |
<a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:slug_section}}" href="#collapse-{{:slug_section}}">
|
|
|
1379 |
<span class="section-name{{:slug_section}}">
|
|
|
1380 |
{{:name}}
|
|
|
1381 |
</span>
|
|
|
1382 |
</a>
|
|
|
1383 |
</h4>
|
|
|
1384 |
</div>
|
|
|
1385 |
<div id="collapse-{{:slug_section}}" class="panel-collapse in collapse show">
|
|
|
1386 |
<div class="panel-body">
|
|
|
1387 |
<div class="table-responsive">
|
|
|
1388 |
<table class="table table-bordered">
|
|
|
1389 |
<thead>
|
|
|
1390 |
<tr>
|
|
|
1391 |
<th style="width: 10%;">LABEL_ELEMENT</th>
|
|
|
1392 |
<th style="width: 50%;">LABEL_TEXT</th>
|
|
|
1393 |
<th style="width: 10%;">LABEL_VALUE</th>
|
|
|
1394 |
<th style="width: 10%;">LABEL_TYPE</th>
|
|
|
1395 |
<th style="width: 20%;">LABEL_ACTIONS</th>
|
|
|
1396 |
</tr>
|
|
|
1397 |
</thead>
|
|
|
1398 |
<tbody>
|
|
|
1399 |
<tr class="tr-section">
|
|
|
1400 |
<td class="text-left">LABEL_SECTION</td>
|
|
|
1401 |
<td class="text-left">{{:name}}</td>
|
|
|
1402 |
<td>{{:value}}</td>
|
|
|
1403 |
<td></td>
|
|
|
1404 |
<td>
|
|
|
1405 |
<button class="btn btn-default btn-edit-section" data-section="{{:slug_section}}" data-toggle="tooltip" data-original-title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button>
|
|
|
1406 |
<button class="btn btn-default btn-delete-section" data-section="{{:slug_section}}" data-toggle="tooltip" data-original-title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button>
|
997 |
geraldo |
1407 |
<button class="btn btn-default btn-add-section" data-section="{{:slug_section}}" data-toggle="tooltip" data-original-title="LABEL_ADD LABEL_SECTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_SECTION </button>
|
977 |
geraldo |
1408 |
</td>
|
|
|
1409 |
</tr>
|
997 |
geraldo |
1410 |
{{for sections}}
|
|
|
1411 |
<tr class="tr-section">
|
993 |
geraldo |
1412 |
<td class="text-left">--LABEL_SECTION</td>
|
977 |
geraldo |
1413 |
<td class="text-left">
|
|
|
1414 |
{{:~removeTags(text)}}
|
|
|
1415 |
</td>
|
|
|
1416 |
<td><font color="red">{{:value}}</font></td>
|
|
|
1417 |
<td class="text-capitalize">
|
|
|
1418 |
{{if type == 'open'}} LABEL_OPEN {{/if}}
|
|
|
1419 |
{{if type == 'simple'}} Simple {{/if}}
|
|
|
1420 |
{{if type == 'multiple'}} Multiple {{/if}}
|
|
|
1421 |
{{if type == 'rating-open'}} LABEL_RATING_OPEN {{/if}}
|
|
|
1422 |
{{if type == 'rating-range'}} LABEL_RATING_RANGE {{/if}}
|
|
|
1423 |
</td>
|
|
|
1424 |
<td>
|
997 |
geraldo |
1425 |
<button class="btn btn-default btn-edit-section" data-section="{{:slug_section}}" data-section="{{:slug_section}}" data-toggle="tooltip" data-original-title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION</button>
|
|
|
1426 |
<button class="btn btn-default btn-delete-section" data-section="{{:slug_section}}" data-section="{{:slug_section}}" data-toggle="tooltip" data-original-title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION</button>
|
977 |
geraldo |
1427 |
|
|
|
1428 |
{{if type == 'simple' || type == 'rating-open' || type=='multiple' }}
|
997 |
geraldo |
1429 |
<button class="btn btn-default btn-add-option" data-section="{{:slug_section}}" data-section="{{:slug_section}}" data-toggle="tooltip" data-original-title="LABEL_ADD LABEL_OPTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_OPTION</button>
|
977 |
geraldo |
1430 |
{{/if}}
|
|
|
1431 |
|
|
|
1432 |
</td>
|
|
|
1433 |
</tr>
|
|
|
1434 |
{{for options}}
|
|
|
1435 |
<tr class="tr-option">
|
|
|
1436 |
<td class="text-left">---LABEL_OPTION</td>
|
|
|
1437 |
<td class="text-left">
|
|
|
1438 |
{{:~removeTags(text)}}
|
|
|
1439 |
</td>
|
|
|
1440 |
<td>
|
|
|
1441 |
|
997 |
geraldo |
1442 |
{{if ~getType( slug_section, slug_section) == 'multiple' || ~getType( slug_section, slug_section) == 'rating-open' }}
|
977 |
geraldo |
1443 |
{{:value}}
|
|
|
1444 |
{{/if}}
|
|
|
1445 |
</td>
|
|
|
1446 |
<td class="text-left">
|
997 |
geraldo |
1447 |
{{if ~getType( slug_section, slug_section) != 'rating-open'}}
|
977 |
geraldo |
1448 |
{{if correct == 1}}
|
|
|
1449 |
<font color="green">LABEL_CORRECT</font>
|
|
|
1450 |
{{/if}}
|
|
|
1451 |
{{if correct == 0}}
|
|
|
1452 |
<font color="red">LABEL_FAIL</font>
|
|
|
1453 |
{{/if}}
|
|
|
1454 |
{{/if}}
|
|
|
1455 |
</td>
|
|
|
1456 |
<td>
|
997 |
geraldo |
1457 |
<button class="btn btn-default btn-edit-option" data-section="{{:slug_section}}" data-section="{{:slug_section}}" data-slug="{{:slug_option}}" data-toggle="tooltip" data-original-title="LABEL_EDIT LABEL_OPTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_OPTION</button>
|
|
|
1458 |
<button class="btn btn-default btn-delete-option" data-section="{{:slug_section}}" data-section="{{:slug_section}}" data-slug="{{:slug_option}}" data-toggle="tooltip" data-original-title="LABEL_DELETE LABEL_OPTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_OPTION</button>
|
977 |
geraldo |
1459 |
</td>
|
|
|
1460 |
</tr>
|
|
|
1461 |
{{/for}}
|
|
|
1462 |
{{/for}}
|
|
|
1463 |
</tbody>
|
|
|
1464 |
</table>
|
|
|
1465 |
</div>
|
|
|
1466 |
</div>
|
|
|
1467 |
</div>
|
|
|
1468 |
</div>
|
|
|
1469 |
</script>
|
|
|
1470 |
|
|
|
1471 |
<!-- End Template Sections-->
|
|
|
1472 |
|
|
|
1473 |
</section>
|