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