66 |
efrain |
1 |
<?php
|
|
|
2 |
use LeadersLinked\Model\CompanyService;
|
|
|
3 |
use LeadersLinked\Model\Company;
|
|
|
4 |
|
|
|
5 |
|
16822 |
efrain |
6 |
//$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
|
|
|
7 |
//$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
|
66 |
efrain |
8 |
|
16822 |
efrain |
9 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
|
|
|
10 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
|
66 |
efrain |
11 |
|
16822 |
efrain |
12 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
|
|
|
13 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
|
|
|
14 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
|
|
|
15 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
|
|
|
16 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/jquery.validate.js'));
|
|
|
17 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/additional-methods.js'));
|
|
|
18 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/localization/messages_es.js'));
|
|
|
19 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-input-number/input-number-format.jquery.js'));
|
|
|
20 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/ckeditor/ckeditor.js'));
|
89 |
steven |
21 |
|
66 |
efrain |
22 |
$this->inlineScript()->captureStart();
|
|
|
23 |
echo <<<JS
|
84 |
steven |
24 |
const classFormGenerator = function() {
|
|
|
25 |
this.id = 0,
|
|
|
26 |
this.table = '',
|
|
|
27 |
this.name = '',
|
|
|
28 |
this.text = '',
|
|
|
29 |
this.status = 'a',
|
|
|
30 |
this.sections = [],
|
|
|
31 |
this.clear = function()
|
|
|
32 |
{
|
|
|
33 |
this.sections = [];
|
|
|
34 |
this.render();
|
|
|
35 |
},
|
|
|
36 |
this.renderSection = function(section_slug)
|
|
|
37 |
{
|
|
|
38 |
|
|
|
39 |
var s = '';
|
|
|
40 |
for(i = 0; i < this.sections.length; i++)
|
|
|
41 |
{
|
|
|
42 |
if(section_slug != this.sections[i].slug) {
|
|
|
43 |
continue;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
$('span.section-name' + section_slug).html(this.sections[i].name);
|
|
|
47 |
|
|
|
48 |
let table = 'table-section-question-option' + this.sections[i].slug;
|
|
|
49 |
$('#' + table + ' tbody').empty();
|
|
|
50 |
|
|
|
51 |
s = '<tr class="tr-section" data-slug="' + this.sections[i].slug + '">';
|
97 |
steven |
52 |
s = s + '<td class="text-left">Seccion</td>';
|
84 |
steven |
53 |
s = s + '<td class="text-left">' + this.sections[i].name + '</td>';
|
|
|
54 |
s = s + '<td class="text-right">' + this.sections[i].value + '</td>';
|
|
|
55 |
s = s + '<td> </td>';
|
|
|
56 |
s = s + '<td>';
|
100 |
steven |
57 |
s = s + '<button class="btn btn-default btn-edit-section" data-slug="' + this.sections[i].slug + '" data-toggle="tooltip" title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button> ';
|
|
|
58 |
s = s + '<button class="btn btn-default btn-delete-section" data-slug="' + this.sections[i].slug + '" data-toggle="tooltip" title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button> ';
|
|
|
59 |
s = s + '<button class="btn btn-default btn-add-question" data-slug="' + this.sections[i].slug + '" data-toggle="tooltip" title="LABEL_ADD LABEL_QUESTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_QUESTION </button> ';
|
84 |
steven |
60 |
s = s + '</td>';
|
|
|
61 |
s = s + '</tr>';
|
|
|
62 |
$('#' + table + ' tbody').append(s);
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
for(j = 0; j < this.sections[i].questions.length; j++)
|
|
|
67 |
{
|
|
|
68 |
this.sections[i].questions[j].position = j;
|
|
|
69 |
|
|
|
70 |
this.drawQuestion( this.sections[i].slug, this.sections[i].questions[j].slug, this.sections[i].questions[j].text, this.sections[i].questions[j].value , this.sections[i].questions[j].type);
|
|
|
71 |
if(this.sections[i].questions[j].type == 'simple' || this.sections[i].questions[j].type == 'multiple'|| this.sections[i].questions[j].type == 'rating-open') {
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
this.sections[i].questions[j].options.sort(function(a, b) {
|
|
|
75 |
if (a.position > b.position) {
|
|
|
76 |
return 1;
|
|
|
77 |
}
|
|
|
78 |
if (a.position < b.position) {
|
|
|
79 |
return -1;
|
|
|
80 |
}
|
|
|
81 |
return 0;
|
|
|
82 |
});
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
for(k = 0; k < this.sections[i].questions[j].options.length; k++)
|
|
|
86 |
{
|
|
|
87 |
this.sections[i].questions[j].options[k].position = j;
|
|
|
88 |
this.drawOption(
|
|
|
89 |
this.sections[i].slug,
|
|
|
90 |
this.sections[i].questions[j].slug,
|
|
|
91 |
this.sections[i].questions[j].type,
|
|
|
92 |
this.sections[i].questions[j].options[k].slug,
|
|
|
93 |
this.sections[i].questions[j].options[k].text,
|
|
|
94 |
this.sections[i].questions[j].options[k].type,
|
|
|
95 |
this.sections[i].questions[j].options[k].correct,
|
|
|
96 |
this.sections[i].questions[j].options[k].value
|
|
|
97 |
);
|
|
|
98 |
}
|
|
|
99 |
}
|
|
|
100 |
}
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
$('[data-toggle="tooltip"]').tooltip();
|
|
|
104 |
},
|
|
|
105 |
this.drawSection = function(section_slug, section_name, section_value)
|
|
|
106 |
{
|
|
|
107 |
let table = 'table-section-question-option' + section_slug;
|
|
|
108 |
let collapse = 'collapse-' + section_slug;
|
|
|
109 |
|
|
|
110 |
s = '<div class="panel panel-default" id="panel' + section_slug + '">';
|
|
|
111 |
s = s + ' <div class="panel-heading">';
|
|
|
112 |
s = s + ' <h4 class="panel-title">';
|
|
|
113 |
s = s + ' <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#' + collapse + '"><span class="section-name' + section_slug + '">' + section_name + '</span></a>';
|
16845 |
efrain |
114 |
s = s + ' </h6>';
|
84 |
steven |
115 |
s = s + ' </div>';
|
|
|
116 |
s = s + ' <div id="' + collapse + '" class="panel-collapse collapse">';
|
|
|
117 |
s = s + ' <div class="panel-body">';
|
|
|
118 |
s = s + ' <div class="table-responsive">';
|
|
|
119 |
s = s + ' <table class="table table-bordered" id="' + table + '">';
|
|
|
120 |
s = s + ' <thead>';
|
|
|
121 |
s = s + ' <tr>';
|
100 |
steven |
122 |
s = s + ' <th>LABEL_ELEMENT</th>';
|
|
|
123 |
s = s + ' <th>LABEL_TEXT</th>';
|
|
|
124 |
s = s + ' <th>LABEL_VALUE</th>';
|
|
|
125 |
s = s + ' <th>LABEL_TYPE</th>';
|
|
|
126 |
s = s + ' <th>LABEL_ACTIONS</th>';
|
84 |
steven |
127 |
s = s + ' </tr>';
|
|
|
128 |
s = s + ' </thead>';
|
|
|
129 |
s = s + ' <tbody>';
|
|
|
130 |
s = s + ' </tbody>';
|
|
|
131 |
s = s + ' </table>';
|
|
|
132 |
s = s + ' </div>';
|
|
|
133 |
s = s + ' </div>';
|
|
|
134 |
s = s + ' </div>';
|
|
|
135 |
s = s + '</div>';
|
|
|
136 |
|
|
|
137 |
$('#accordion').append(s);
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
s = '<tr class="tr-section" data-slug="' + section_slug + '">';
|
100 |
steven |
141 |
s = s + '<td class="text-left">LABEL_SECTION</td>';
|
84 |
steven |
142 |
s = s + '<td class="text-left">' + section_name + '</td>';
|
|
|
143 |
s = s + '<td class="text-right">' + section_value + '</td>';
|
|
|
144 |
s = s + '<td> </td>';
|
|
|
145 |
s = s + '<td>';
|
100 |
steven |
146 |
s = s + '<button class="btn btn-default btn-edit-section" data-slug="' + section_slug + '" data-toggle="tooltip" title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button> ';
|
|
|
147 |
s = s + '<button class="btn btn-default btn-delete-section" data-slug="' + section_slug + '" data-toggle="tooltip" title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button> ';
|
|
|
148 |
s = s + '<button class="btn btn-default btn-add-question" data-slug="' + section_slug + '" data-toggle="tooltip" title="LABEL_ADD LABEL_SECTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_SECTION </button> ';
|
84 |
steven |
149 |
s = s + '</td>';
|
|
|
150 |
s = s + '</tr>';
|
|
|
151 |
$('#' + table + ' tbody').append(s);
|
|
|
152 |
},
|
|
|
153 |
|
|
|
154 |
this.drawQuestion = function(section_slug, question_slug, question_text, question_value, question_type)
|
|
|
155 |
{
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
s = '<tr class="tr-question" data-slug="' + question_slug + '">';
|
106 |
steven |
159 |
s = s + '<td class="text-left">--LABEL_QUESTION</td>';
|
84 |
steven |
160 |
s = s + '<td class="text-left">' + question_text + '</td>';
|
|
|
161 |
s = s + '<td class="text-right"><font color="red">' + question_value + '</font></td>';
|
|
|
162 |
s = s + '<td>' + question_type.substr(0,1).toUpperCase() + question_type.substr(1) + '</td>';
|
|
|
163 |
s = s + '<td>';
|
106 |
steven |
164 |
s = s + '<button class="btn btn-default btn-edit-question" data-section="' + section_slug + '" data-slug="' + question_slug + '" data-toggle="tooltip" title="LABEL_EDIT LABEL_QUESTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_QUESTION</button> ';
|
|
|
165 |
s = s + '<button class="btn btn-default btn-delete-question" data-section="' + section_slug + '" data-slug="' + question_slug + '" data-toggle="tooltip" title="LABEL_DELETE LABEL_QUESTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_QUESTION</button> ';
|
84 |
steven |
166 |
if(question_type == 'simple' || question_type == 'multiple' || question_type == 'rating-open') {
|
106 |
steven |
167 |
s = s + '<button class="btn btn-default btn-add-option" data-section="' + section_slug + '" data-slug="' + question_slug + '" data-toggle="tooltip" title="LABEL_ADD LABEL_OPTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_OPTION</button> ';
|
84 |
steven |
168 |
}
|
|
|
169 |
|
|
|
170 |
s = s + '</td>';
|
|
|
171 |
|
|
|
172 |
let table = 'table-section-question-option' + section_slug;
|
|
|
173 |
$('#' + table + ' tbody').append(s);
|
|
|
174 |
},
|
|
|
175 |
|
|
|
176 |
this.drawOption = function(section_slug, question_slug, question_type, option_slug, option_text, option_type, option_correct, option_value)
|
|
|
177 |
{
|
|
|
178 |
|
|
|
179 |
|
|
|
180 |
s = '<tr class="tr-option" data-slug="' + option_slug + '">';
|
106 |
steven |
181 |
s = s + '<td class="text-left">---LABEL_OPTION</td>';
|
84 |
steven |
182 |
s = s + '<td class="text-left">' + option_text + '</td>';
|
|
|
183 |
if(question_type == 'multiple' || question_type == 'rating-open') {
|
|
|
184 |
|
|
|
185 |
if(question_type == 'multiple') {
|
|
|
186 |
if(option_correct == 1) {
|
|
|
187 |
s = s + '<td class="text-right">' + option_value + '</td>';
|
|
|
188 |
} else {
|
|
|
189 |
s = s + '<td> </td>';
|
|
|
190 |
}
|
|
|
191 |
} else {
|
|
|
192 |
s = s + '<td class="text-right">' + option_value + '</td>';
|
|
|
193 |
}
|
|
|
194 |
} else {
|
|
|
195 |
s = s + '<td> </td>';
|
|
|
196 |
}
|
|
|
197 |
|
|
|
198 |
if(question_type == 'simple' || question_type == 'multiple') {
|
|
|
199 |
if(option_correct == 1) {
|
106 |
steven |
200 |
s = s + '<td class="text-left"><font color="green">LABEL_CORRECT</font></td>';
|
84 |
steven |
201 |
} else {
|
106 |
steven |
202 |
s = s + '<td class="text-left"><font color="red">LABEL_FAIL</font></td>';
|
84 |
steven |
203 |
|
|
|
204 |
}
|
|
|
205 |
} else {
|
|
|
206 |
s = s + '<td> </td>';
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
s = s + '<td>';
|
106 |
steven |
211 |
s = s + '<button class="btn btn-default btn-edit-option" data-section="' + section_slug + '" data-question="' + question_slug + '" data-slug="' + option_slug + '" data-toggle="tooltip" title="LABEL_EDIT LABEL_OPTION"><i class="fa fa-edit" aria-hidden="true"></i></button> ';
|
|
|
212 |
s = s + '<button class="btn btn-default btn-delete-option" data-section="' + section_slug + '" data-question="' + question_slug + '" data-slug="' + option_slug + '" data-toggle="tooltip" title="LABEL_DELETE LABEL_OPTION"><i class="fa fa-ban" aria-hidden="true"></i></button> ';
|
84 |
steven |
213 |
s = s + '</td>';
|
|
|
214 |
|
|
|
215 |
let table = 'table-section-question-option' + section_slug;
|
|
|
216 |
$('#' + table + ' tbody').append(s);
|
|
|
217 |
|
|
|
218 |
},
|
|
|
219 |
|
|
|
220 |
this.render = function()
|
|
|
221 |
{
|
|
|
222 |
$('#accordion').empty();
|
|
|
223 |
|
|
|
224 |
this.sections.sort(function(a, b) {
|
|
|
225 |
if (a.position > b.position) {
|
|
|
226 |
return 1;
|
|
|
227 |
}
|
|
|
228 |
if (a.position < b.position) {
|
|
|
229 |
return -1;
|
|
|
230 |
}
|
|
|
231 |
return 0;
|
|
|
232 |
});
|
|
|
233 |
|
|
|
234 |
var s = '';
|
|
|
235 |
for(i = 0; i < this.sections.length; i++)
|
|
|
236 |
{
|
|
|
237 |
this.sections[i].position = i;
|
|
|
238 |
|
|
|
239 |
|
|
|
240 |
this.drawSection(this.sections[i].slug, this.sections[i].name, this.sections[i].value);
|
|
|
241 |
|
|
|
242 |
|
|
|
243 |
this.sections[i].questions.sort(function(a, b) {
|
|
|
244 |
if (a.position > b.position) {
|
|
|
245 |
return 1;
|
|
|
246 |
}
|
|
|
247 |
if (a.position < b.position) {
|
|
|
248 |
return -1;
|
|
|
249 |
}
|
|
|
250 |
return 0;
|
|
|
251 |
});
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
for(j = 0; j < this.sections[i].questions.length; j++)
|
|
|
255 |
{
|
|
|
256 |
this.sections[i].questions[j].position = j;
|
|
|
257 |
|
|
|
258 |
this.drawQuestion( this.sections[i].slug, this.sections[i].questions[j].slug, this.sections[i].questions[j].text, this.sections[i].questions[j].value , this.sections[i].questions[j].type);
|
|
|
259 |
if(this.sections[i].questions[j].type == 'simple' || this.sections[i].questions[j].type == 'multiple'|| this.sections[i].questions[j].type == 'rating-open') {
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
this.sections[i].questions[j].options.sort(function(a, b) {
|
|
|
263 |
if (a.position > b.position) {
|
|
|
264 |
return 1;
|
|
|
265 |
}
|
|
|
266 |
if (a.position < b.position) {
|
|
|
267 |
return -1;
|
|
|
268 |
}
|
|
|
269 |
return 0;
|
|
|
270 |
});
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
for(k = 0; k < this.sections[i].questions[j].options.length; k++)
|
|
|
274 |
{
|
|
|
275 |
this.sections[i].questions[j].options[k].position = j;
|
|
|
276 |
this.drawOption(
|
|
|
277 |
this.sections[i].slug,
|
|
|
278 |
this.sections[i].questions[j].slug,
|
|
|
279 |
this.sections[i].questions[j].type,
|
|
|
280 |
this.sections[i].questions[j].options[k].slug,
|
|
|
281 |
this.sections[i].questions[j].options[k].text,
|
|
|
282 |
this.sections[i].questions[j].options[k].type,
|
|
|
283 |
this.sections[i].questions[j].options[k].correct,
|
|
|
284 |
this.sections[i].questions[j].options[k].value
|
|
|
285 |
);
|
|
|
286 |
}
|
|
|
287 |
}
|
|
|
288 |
|
|
|
289 |
}
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
}
|
|
|
293 |
|
|
|
294 |
|
|
|
295 |
$('[data-toggle="tooltip"]').tooltip();
|
|
|
296 |
|
|
|
297 |
},
|
|
|
298 |
|
|
|
299 |
this.addSection = function (name, text, value)
|
|
|
300 |
{
|
|
|
301 |
var d = new Date();
|
|
|
302 |
var slug = 'section' + d.getTime();
|
|
|
303 |
|
|
|
304 |
var position = 0;
|
|
|
305 |
$.each(this.sections, function(index, section) {
|
|
|
306 |
if(position < section.position) {
|
|
|
307 |
position = section.position;
|
|
|
308 |
}
|
|
|
309 |
});
|
|
|
310 |
position++;
|
|
|
311 |
|
|
|
312 |
var section = {
|
|
|
313 |
'slug' : slug,
|
|
|
314 |
'name' : name,
|
|
|
315 |
'text' : text,
|
|
|
316 |
'value' : value,
|
|
|
317 |
'position' : position,
|
|
|
318 |
'questions' : [],
|
|
|
319 |
}
|
|
|
320 |
|
|
|
321 |
this.sections.push(section);
|
|
|
322 |
this.drawSection(slug, name, text);
|
|
|
323 |
},
|
|
|
324 |
this.editSection = function (slug, name, text, value)
|
|
|
325 |
{
|
|
|
326 |
var renderTable = false;
|
|
|
327 |
for(i = 0; i < this.sections.length; i++)
|
|
|
328 |
{
|
|
|
329 |
if(slug == this.sections[i].slug) {
|
|
|
330 |
this.sections[i].name = name;
|
|
|
331 |
this.sections[i].text = text;
|
|
|
332 |
this.sections[i].value = value;
|
|
|
333 |
renderTable = true;
|
|
|
334 |
|
|
|
335 |
break;
|
|
|
336 |
}
|
|
|
337 |
}
|
|
|
338 |
if(renderTable) {
|
|
|
339 |
this.renderSection(slug);
|
|
|
340 |
}
|
|
|
341 |
|
|
|
342 |
|
|
|
343 |
},
|
|
|
344 |
this.deleteSection = function(slug)
|
|
|
345 |
{
|
|
|
346 |
var renderTable = false;
|
|
|
347 |
for(i = 0; i < this.sections.length; i++)
|
|
|
348 |
{
|
|
|
349 |
if(slug == this.sections[i].slug) {
|
|
|
350 |
this.sections.splice(i, 1);
|
|
|
351 |
|
|
|
352 |
renderTable = true;
|
|
|
353 |
break;
|
|
|
354 |
}
|
|
|
355 |
|
|
|
356 |
|
|
|
357 |
}
|
|
|
358 |
if(renderTable) {
|
|
|
359 |
$('#panel' + slug).remove();
|
|
|
360 |
}
|
|
|
361 |
},
|
|
|
362 |
this.addQuestion = function (section_slug, text, value, type, maxlength, multiline, range)
|
|
|
363 |
{
|
|
|
364 |
var d = new Date();
|
|
|
365 |
var slug = 'question' + d.getTime();
|
|
|
366 |
|
|
|
367 |
var position = 0;
|
|
|
368 |
var renderTable = false;
|
|
|
369 |
for(i = 0; i < this.sections.length; i++)
|
|
|
370 |
{
|
|
|
371 |
if(section_slug == this.sections[i].slug) {
|
|
|
372 |
$.each(this.sections[i].questions, function(index, question) {
|
|
|
373 |
if(position < question.position) {
|
|
|
374 |
position = question.position;
|
|
|
375 |
}
|
|
|
376 |
});
|
|
|
377 |
position++;
|
|
|
378 |
|
|
|
379 |
var question = {
|
|
|
380 |
'slug' : slug,
|
|
|
381 |
'text' : text,
|
|
|
382 |
'value' : value,
|
|
|
383 |
'type' : type,
|
|
|
384 |
'position' : position,
|
|
|
385 |
'maxlength' :maxlength,
|
|
|
386 |
'multiline' : multiline,
|
|
|
387 |
'range' : range,
|
|
|
388 |
'options' : [],
|
|
|
389 |
}
|
|
|
390 |
|
|
|
391 |
this.sections[i].questions.push(question);
|
|
|
392 |
renderTable = true;
|
|
|
393 |
break;
|
|
|
394 |
}
|
|
|
395 |
}
|
|
|
396 |
|
|
|
397 |
if(renderTable) {
|
|
|
398 |
this.renderSection(section_slug);
|
|
|
399 |
}
|
|
|
400 |
},
|
|
|
401 |
this.editQuestion = function(section_slug, question_slug, text, value, type, maxlength, multiline, range)
|
|
|
402 |
{
|
|
|
403 |
var renderTable = false;
|
|
|
404 |
for(i = 0; i < this.sections.length; i++)
|
|
|
405 |
{
|
|
|
406 |
if(section_slug == this.sections[i].slug) {
|
|
|
407 |
for(j = 0; j < this.sections[i].questions.length; j++) {
|
|
|
408 |
if(question_slug == this.sections[i].questions[j].slug) {
|
|
|
409 |
this.sections[i].questions[j].text = text,
|
|
|
410 |
this.sections[i].questions[j].value = value,
|
|
|
411 |
this.sections[i].questions[j].type = type;
|
|
|
412 |
|
|
|
413 |
if(type == 'open') {
|
|
|
414 |
this.sections[i].questions[j].maxlength = maxlength;
|
|
|
415 |
this.sections[i].questions[j].multiline = multiline;
|
|
|
416 |
this.sections[i].questions[j].options = [];
|
|
|
417 |
} else {
|
|
|
418 |
this.sections[i].questions[j].maxlength = 0;
|
|
|
419 |
this.sections[i].questions[j].multiline = 0;
|
|
|
420 |
}
|
|
|
421 |
|
|
|
422 |
if(type == 'rating-range') {
|
|
|
423 |
this.sections[i].questions[j].range = range;
|
|
|
424 |
} else {
|
|
|
425 |
this.sections[i].questions[j].range = 0;
|
|
|
426 |
}
|
|
|
427 |
renderTable = true;
|
|
|
428 |
break;
|
|
|
429 |
}
|
|
|
430 |
}
|
|
|
431 |
}
|
|
|
432 |
if(renderTable) {
|
|
|
433 |
break;
|
|
|
434 |
}
|
|
|
435 |
}
|
|
|
436 |
if(renderTable) {
|
|
|
437 |
this.renderSection(section_slug);
|
|
|
438 |
}
|
|
|
439 |
},
|
|
|
440 |
this.deleteQuestion = function(section_slug, question_slug)
|
|
|
441 |
{
|
|
|
442 |
var renderTable = false;
|
|
|
443 |
for(i = 0; i < this.sections.length; i++)
|
|
|
444 |
{
|
|
|
445 |
if(section_slug == this.sections[i].slug) {
|
|
|
446 |
for(j = 0; j < this.sections[i].questions.length; j++) {
|
|
|
447 |
if(question_slug == this.sections[i].questions[j].slug) {
|
|
|
448 |
this.sections[i].questions.splice(j, 1);
|
|
|
449 |
renderTable = true;
|
|
|
450 |
break;
|
|
|
451 |
}
|
|
|
452 |
}
|
|
|
453 |
}
|
|
|
454 |
|
|
|
455 |
if(renderTable) {
|
|
|
456 |
break;
|
|
|
457 |
}
|
|
|
458 |
}
|
|
|
459 |
if(renderTable) {
|
|
|
460 |
this.renderSection(section_slug);
|
|
|
461 |
}
|
|
|
462 |
},
|
|
|
463 |
this.addOption = function (section_slug, question_slug, text, correct, value)
|
|
|
464 |
{
|
|
|
465 |
var d = new Date();
|
|
|
466 |
var slug = 'option' + d.getTime();
|
|
|
467 |
|
|
|
468 |
var position = 0;
|
|
|
469 |
var renderTable = false;
|
|
|
470 |
for(i = 0; i < this.sections.length; i++)
|
|
|
471 |
{
|
|
|
472 |
if(section_slug == this.sections[i].slug) {
|
|
|
473 |
for(j = 0; j < this.sections[i].questions.length; j++) {
|
|
|
474 |
if(question_slug == this.sections[i].questions[j].slug) {
|
|
|
475 |
$.each(this.sections[i].questions[j].options, function(index, option) {
|
|
|
476 |
if(position < option.position) {
|
|
|
477 |
position = option.position;
|
|
|
478 |
}
|
|
|
479 |
});
|
|
|
480 |
position++;
|
|
|
481 |
|
|
|
482 |
var option = {
|
|
|
483 |
'slug' : slug,
|
|
|
484 |
'text' : text,
|
|
|
485 |
'correct' : correct,
|
|
|
486 |
'value' : value
|
|
|
487 |
}
|
|
|
488 |
|
|
|
489 |
this.sections[i].questions[j].options.push(option);
|
|
|
490 |
renderTable = true;
|
|
|
491 |
break;
|
|
|
492 |
}
|
|
|
493 |
|
|
|
494 |
if(renderTable) {
|
|
|
495 |
break;
|
|
|
496 |
}
|
|
|
497 |
}
|
|
|
498 |
}
|
|
|
499 |
}
|
|
|
500 |
if(renderTable) {
|
|
|
501 |
this.renderSection(section_slug);
|
|
|
502 |
}
|
|
|
503 |
},
|
|
|
504 |
this.editOption = function(section_slug, question_slug, option_slug, text, correct, value)
|
|
|
505 |
{
|
|
|
506 |
var renderTable = false;
|
|
|
507 |
for(i = 0; i < this.sections.length; i++)
|
|
|
508 |
{
|
|
|
509 |
if(section_slug == this.sections[i].slug) {
|
|
|
510 |
for(j = 0; j < this.sections[i].questions.length; j++) {
|
|
|
511 |
if(question_slug == this.sections[i].questions[j].slug) {
|
|
|
512 |
for(k = 0; k < this.sections[i].questions[j].options.length; k++) {
|
|
|
513 |
if(option_slug == this.sections[i].questions[j].options[k].slug) {
|
|
|
514 |
this.sections[i].questions[j].options[k].text = text;
|
|
|
515 |
this.sections[i].questions[j].options[k].correct = correct;
|
|
|
516 |
this.sections[i].questions[j].options[k].value = value;
|
|
|
517 |
renderTable = true;
|
|
|
518 |
break;
|
|
|
519 |
}
|
|
|
520 |
}
|
|
|
521 |
}
|
|
|
522 |
if(renderTable) {
|
|
|
523 |
break;
|
|
|
524 |
}
|
|
|
525 |
}
|
|
|
526 |
}
|
|
|
527 |
if(renderTable) {
|
|
|
528 |
break;
|
|
|
529 |
}
|
|
|
530 |
}
|
|
|
531 |
|
|
|
532 |
if(renderTable) {
|
|
|
533 |
this.renderSection(section_slug);
|
|
|
534 |
}
|
|
|
535 |
},
|
|
|
536 |
this.deleteOption = function(section_slug, question_slug, option_slug)
|
|
|
537 |
{
|
|
|
538 |
var renderTable = false;
|
|
|
539 |
for(i = 0; i < this.sections.length; i++)
|
|
|
540 |
{
|
|
|
541 |
if(section_slug == this.sections[i].slug) {
|
|
|
542 |
for(j = 0; j < this.sections[i].questions.length; j++) {
|
|
|
543 |
if(question_slug == this.sections[i].questions[j].slug) {
|
|
|
544 |
for(k = 0; k < this.sections[i].questions[j].options.length; k++) {
|
|
|
545 |
if(option_slug == this.sections[i].questions[j].options[k].slug) {
|
|
|
546 |
this.sections[i].questions[j].options.splice(k, 1);
|
|
|
547 |
renderTable = true;
|
|
|
548 |
break;
|
|
|
549 |
}
|
|
|
550 |
}
|
|
|
551 |
}
|
|
|
552 |
if(renderTable) {
|
|
|
553 |
break;
|
|
|
554 |
}
|
|
|
555 |
}
|
|
|
556 |
}
|
|
|
557 |
|
|
|
558 |
if(renderTable) {
|
|
|
559 |
break;
|
|
|
560 |
}
|
|
|
561 |
}
|
|
|
562 |
if(renderTable) {
|
|
|
563 |
this.renderSection(section_slug);
|
|
|
564 |
}
|
|
|
565 |
}
|
|
|
566 |
}
|
|
|
567 |
|
|
|
568 |
function htmlEntities(str) {
|
|
|
569 |
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
|
570 |
}
|
66 |
efrain |
571 |
jQuery( document ).ready(function( $ ) {
|
84 |
steven |
572 |
var objFormGenerator = new classFormGenerator();
|
|
|
573 |
objFormGenerator.render();
|
66 |
efrain |
574 |
|
84 |
steven |
575 |
|
|
|
576 |
var tableForm = $('#table-form').dataTable({
|
|
|
577 |
select :true,
|
|
|
578 |
bProcessing: true,
|
|
|
579 |
bServerSide: true,
|
243 |
geraldo |
580 |
sAjaxSource: "ajax.<?php echo $this->module; ?>.php?action=gridview",
|
84 |
steven |
581 |
fnServerData: function (sSource, aoData, fnCallback) {
|
|
|
582 |
$.ajax({
|
|
|
583 |
dataType: 'json',
|
|
|
584 |
type: "POST",
|
|
|
585 |
url: sSource,
|
|
|
586 |
data: aoData,
|
|
|
587 |
success: fnCallback
|
|
|
588 |
});
|
|
|
589 |
},
|
|
|
590 |
aaSorting : [],
|
|
|
591 |
aoColumns: [
|
85 |
steven |
592 |
{sName: "checkbox", sTitle : '<input type="checkbox" value="all" data-type="select_all" name="select_all" id="select_all">',bSortable:false,bSearchable:false},
|
106 |
steven |
593 |
{sName: "name", sTitle: 'LABEL_FIRST_NAME'},
|
|
|
594 |
{sName: "language", sTitle: 'LABEL_LANGUAGE'},
|
|
|
595 |
{sName: "added_on", sTitle : 'LABEL_ADDED_ON'},
|
|
|
596 |
{sName: "status", sTitle: 'LABEL_STATUS', bSortable:false, bSearchable:false},
|
|
|
597 |
{sName: "operation", sTitle: 'LABEL_OPERATION', bSortable: false, bSearchable: false},
|
84 |
steven |
598 |
],
|
87 |
steven |
599 |
// fnServerParams: function(aoData){
|
|
|
600 |
// setTitle(aoData, this)
|
|
|
601 |
// },
|
84 |
steven |
602 |
fnDrawCallback: function(oSettings) {
|
85 |
steven |
603 |
$('.make-switch-form').bootstrapSwitch();
|
84 |
steven |
604 |
$('.make-switch-form').bootstrapSwitch('setOnClass', 'success');
|
|
|
605 |
$('.make-switch-form').bootstrapSwitch('setOffClass', 'danger');
|
|
|
606 |
}
|
|
|
607 |
});
|
66 |
efrain |
608 |
|
84 |
steven |
609 |
$('body').on('click', 'a.btn-delete-form',function(e) {
|
|
|
610 |
e.preventDefault();
|
|
|
611 |
form_id = $(this).data('id')
|
16822 |
efrain |
612 |
|
|
|
613 |
swal.fire({
|
|
|
614 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
615 |
message: "LABEL_DELETE LABEL_FORM",
|
|
|
616 |
icon: 'question',
|
|
|
617 |
cancelButtonText: 'LABEL_NO',
|
|
|
618 |
showCancelButton: true,
|
|
|
619 |
confirmButtonText: 'LABEL_YES'
|
|
|
620 |
}).then((result) => {
|
|
|
621 |
if (result.isConfirmed) {
|
|
|
622 |
}
|
|
|
623 |
});
|
|
|
624 |
|
|
|
625 |
swal.fire({
|
|
|
626 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
627 |
icon: 'question',
|
|
|
628 |
cancelButtonText: 'LABEL_NO',
|
|
|
629 |
showCancelButton: true,
|
|
|
630 |
confirmButtonText: 'LABEL_YES'
|
|
|
631 |
}).then((result) => {
|
|
|
632 |
if (result.isConfirmed) {
|
|
|
633 |
|
|
|
634 |
$.ajax({
|
84 |
steven |
635 |
'dataType': 'json',
|
|
|
636 |
'method': 'post',
|
|
|
637 |
'url' : 'ajax.<?php echo $this->module; ?>.php?action=delete',
|
|
|
638 |
'data' :{
|
|
|
639 |
'form-id' : form_id
|
|
|
640 |
},
|
|
|
641 |
}).done(function(response) {
|
|
|
642 |
|
|
|
643 |
if(response['success']) {
|
94 |
steven |
644 |
$.fn.showSuccess(response['message']);
|
84 |
steven |
645 |
tableForm.fnDraw();
|
|
|
646 |
} else {
|
94 |
steven |
647 |
$.fn.showError(response['message']);
|
84 |
steven |
648 |
}
|
|
|
649 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
94 |
steven |
650 |
$.fn.showError(textStatus);
|
84 |
steven |
651 |
});
|
16822 |
efrain |
652 |
|
|
|
653 |
}
|
|
|
654 |
});
|
84 |
steven |
655 |
|
16822 |
efrain |
656 |
|
|
|
657 |
|
66 |
efrain |
658 |
|
84 |
steven |
659 |
});
|
66 |
efrain |
660 |
|
84 |
steven |
661 |
$(document).on('click','[data-action="delete"]',function(){
|
|
|
662 |
|
16822 |
efrain |
663 |
swal.fire({
|
|
|
664 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
665 |
message: "LABEL_DELETE LABEL_FORMS_2",
|
|
|
666 |
icon: 'question',
|
|
|
667 |
cancelButtonText: 'LABEL_NO',
|
|
|
668 |
showCancelButton: true,
|
|
|
669 |
confirmButtonText: 'LABEL_YES'
|
|
|
670 |
}).then((result) => {
|
|
|
671 |
if (result.isConfirmed) {
|
|
|
672 |
|
|
|
673 |
var d = currentSelected();
|
84 |
steven |
674 |
$.ajax({
|
|
|
675 |
'dataType': 'json',
|
|
|
676 |
'method': 'post',
|
|
|
677 |
'url' : 'ajax.<?php echo $this->module; ?>.php?action=delete-selected',
|
|
|
678 |
'data' :{
|
|
|
679 |
selected : d
|
|
|
680 |
},
|
|
|
681 |
}).done(function(response) {
|
|
|
682 |
|
|
|
683 |
if(response['success']) {
|
94 |
steven |
684 |
$.fn.showSuccess(response['message']);
|
84 |
steven |
685 |
tableForm.fnDraw();
|
|
|
686 |
} else {
|
94 |
steven |
687 |
$.fn.showError(response['message']);
|
84 |
steven |
688 |
}
|
|
|
689 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
94 |
steven |
690 |
$.fn.showError(textStatus);
|
84 |
steven |
691 |
});
|
16822 |
efrain |
692 |
|
|
|
693 |
}
|
|
|
694 |
});
|
|
|
695 |
|
84 |
steven |
696 |
|
66 |
efrain |
697 |
});
|
84 |
steven |
698 |
|
|
|
699 |
|
|
|
700 |
$('body').on('switch-change', 'input[type="checkbox"].make-switch-form', function(e) {
|
|
|
701 |
e.preventDefault();
|
|
|
702 |
e.stopPropagation();
|
|
|
703 |
|
|
|
704 |
form_id = $(this).data('id')
|
|
|
705 |
form_status = $(this).prop('checked') ? 'A' : 'D';
|
|
|
706 |
|
|
|
707 |
|
|
|
708 |
$.ajax({
|
|
|
709 |
'dataType': 'json',
|
|
|
710 |
'method': 'post',
|
|
|
711 |
'url' : 'ajax.<?php echo $this->module; ?>.php?action=status',
|
|
|
712 |
'data' :{
|
|
|
713 |
'form-id' : form_id,
|
|
|
714 |
'form-status' : form_status
|
|
|
715 |
},
|
|
|
716 |
}).done(function(response) {
|
|
|
717 |
if(response['success']) {
|
94 |
steven |
718 |
$.fn.showSuccess(response['message']);
|
84 |
steven |
719 |
} else {
|
94 |
steven |
720 |
$.fn.showError(response['message']);
|
84 |
steven |
721 |
}
|
|
|
722 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
94 |
steven |
723 |
$.fn.showError(textStatus);
|
84 |
steven |
724 |
})
|
|
|
725 |
});
|
|
|
726 |
|
|
|
727 |
$('body').on('click', 'a.btn-edit-form',function(e) {
|
|
|
728 |
e.preventDefault();
|
|
|
729 |
form_id = $(this).data('id')
|
|
|
730 |
|
|
|
731 |
$.ajax({
|
93 |
steven |
732 |
'dataType': 'json',
|
|
|
733 |
'method': 'post',
|
|
|
734 |
'url' : '/test/method-one',
|
|
|
735 |
'data' :{
|
|
|
736 |
'form-id' : form_id
|
|
|
737 |
},
|
|
|
738 |
}).done(function(response) {
|
|
|
739 |
if(response['success']) {
|
|
|
740 |
validatorForm.resetForm();
|
84 |
steven |
741 |
|
93 |
steven |
742 |
$('#form-main #form-id' ).val(response['id']),
|
|
|
743 |
$('#form-main #form-continue').val('0');
|
|
|
744 |
$('#form-main #form-name' ).val(response['name']),
|
84 |
steven |
745 |
|
|
|
746 |
|
93 |
steven |
747 |
instanceName = 'form-description';
|
|
|
748 |
let editor = CKEDITOR.instances[instanceName ];
|
|
|
749 |
editor.setData(response['description'], function() {
|
|
|
750 |
editor.focus();
|
|
|
751 |
});
|
|
|
752 |
|
|
|
753 |
|
|
|
754 |
instanceName = 'form-text';
|
|
|
755 |
CKEDITOR.instances[instanceName ].setData(response['text']);
|
84 |
steven |
756 |
|
93 |
steven |
757 |
$( '#form-main #form-language' ).val(response['language']),
|
|
|
758 |
$( '#form-main #form-status' ).val(response['status']);
|
84 |
steven |
759 |
|
93 |
steven |
760 |
objFormGenerator.clear();
|
|
|
761 |
objFormGenerator.sections = response['sections'];
|
|
|
762 |
objFormGenerator.render();
|
|
|
763 |
$('#row-forms').hide();
|
|
|
764 |
$('#row-edit').show();
|
84 |
steven |
765 |
|
93 |
steven |
766 |
$('#form-main #form-name').focus();
|
|
|
767 |
|
|
|
768 |
} else {
|
94 |
steven |
769 |
$.fn.showError(response['message']);
|
93 |
steven |
770 |
}
|
|
|
771 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
94 |
steven |
772 |
$.fn.showError(textStatus);
|
93 |
steven |
773 |
});
|
84 |
steven |
774 |
});
|
|
|
775 |
|
|
|
776 |
$(document).on('click','[data-type="select_all"]',function(){
|
|
|
777 |
|
|
|
778 |
if($('input[name="select_all"]:checked').val() == 'all'){
|
|
|
779 |
$('[data-type="select"]').prop('checked', true);
|
|
|
780 |
$('[data-action="delete"]').removeClass('hide');
|
|
|
781 |
}else{
|
|
|
782 |
$('[data-type="select"]').prop('checked', false);
|
|
|
783 |
$('[data-action="delete"]').addClass('hide');
|
|
|
784 |
}
|
|
|
785 |
});
|
|
|
786 |
|
|
|
787 |
function getLength(){
|
|
|
788 |
return $('[data-type="select"]').length;
|
|
|
789 |
}
|
|
|
790 |
|
|
|
791 |
function currentSelected(){
|
|
|
792 |
var selected = [];
|
|
|
793 |
$.each($("input[name='select[]']:checked"), function(){
|
|
|
794 |
selected.push($(this).val());
|
|
|
795 |
});
|
|
|
796 |
|
|
|
797 |
return selected;
|
|
|
798 |
}
|
|
|
799 |
|
|
|
800 |
$(document).on('change',"input[name='select[]']",function(){
|
|
|
801 |
var c = currentSelected();
|
|
|
802 |
var cc = getLength();
|
|
|
803 |
|
|
|
804 |
|
|
|
805 |
if(c.length == cc){
|
|
|
806 |
if($('[data-action="delete"]').hasClass('hide')){
|
|
|
807 |
$('[data-action="delete"]').removeClass('hide');
|
|
|
808 |
}
|
|
|
809 |
return true;
|
|
|
810 |
}else{
|
|
|
811 |
$('input[name="select_all"]').prop('checked', false);
|
|
|
812 |
}
|
|
|
813 |
|
|
|
814 |
if(c.length > 0){
|
|
|
815 |
if($('[data-action="delete"]').hasClass('hide')){
|
|
|
816 |
$('[data-action="delete"]').removeClass('hide');
|
|
|
817 |
}
|
|
|
818 |
}else{
|
|
|
819 |
if(!$('[data-action="delete"]').hasClass('hide')){
|
|
|
820 |
$('[data-action="delete"]').addClass('hide');
|
|
|
821 |
}
|
|
|
822 |
}
|
|
|
823 |
});
|
|
|
824 |
|
|
|
825 |
var form3 = $('#form_sample_3');
|
|
|
826 |
var error3 = $('.alert-danger', form3);
|
|
|
827 |
var success3 = $('.alert-success', form3);
|
|
|
828 |
|
|
|
829 |
//IMPORTANT: update CKEDITOR textarea with actual content before submit
|
|
|
830 |
$( "#form-main" ).on('submit', function() {
|
|
|
831 |
for(var instanceName in CKEDITOR.instances) {
|
|
|
832 |
CKEDITOR.instances[instanceName].updateElement();
|
|
|
833 |
}
|
|
|
834 |
})
|
|
|
835 |
|
|
|
836 |
var validatorForm = $( "#form-main" ).validate( {
|
|
|
837 |
ignore: [],
|
|
|
838 |
errorClass: 'help-block',
|
|
|
839 |
errorElement: 'span',
|
|
|
840 |
rules: {
|
|
|
841 |
'form-name': {
|
|
|
842 |
required: true,
|
|
|
843 |
minlength: 2,
|
|
|
844 |
maxlength: 50
|
|
|
845 |
},
|
|
|
846 |
'form-description' : {
|
|
|
847 |
required: true,
|
|
|
848 |
},
|
|
|
849 |
'form-text' : {
|
|
|
850 |
required: true,
|
|
|
851 |
},
|
|
|
852 |
'form-language' : {
|
|
|
853 |
required: true,
|
|
|
854 |
},
|
|
|
855 |
'forrm-status' : {
|
|
|
856 |
required: true,
|
|
|
857 |
},
|
|
|
858 |
},
|
|
|
859 |
highlight: function (element) {
|
|
|
860 |
$(element).closest('.form-group').addClass('has-error');
|
|
|
861 |
},
|
|
|
862 |
unhighlight: function (element) {
|
|
|
863 |
$(element).closest('.form-group').removeClass('has-error');
|
|
|
864 |
},
|
|
|
865 |
errorPlacement: function (error, element) {
|
|
|
866 |
if (element.attr("data-error-container")) {
|
|
|
867 |
error.appendTo(element.attr("data-error-container"));
|
|
|
868 |
} else {
|
|
|
869 |
error.insertAfter(element);
|
|
|
870 |
}
|
|
|
871 |
},
|
|
|
872 |
invalidHandler: function(form, validator) {
|
|
|
873 |
if (!validator.numberOfInvalids())
|
|
|
874 |
return;
|
|
|
875 |
$('html, body').animate({
|
|
|
876 |
scrollTop: $(validator.errorList[0].element).offset().top - 100
|
|
|
877 |
}, 1000);
|
|
|
878 |
},
|
|
|
879 |
submitHandler: function(form) {
|
|
|
880 |
// do other things for a valid form
|
|
|
881 |
//form.submit();
|
|
|
882 |
|
|
|
883 |
|
|
|
884 |
var error = false;
|
|
|
885 |
if(objFormGenerator.sections.length == 0) {
|
94 |
steven |
886 |
$.fn.showError('There are no sections');
|
84 |
steven |
887 |
error = true;
|
|
|
888 |
} else {
|
|
|
889 |
|
|
|
890 |
for(i = 0; i < objFormGenerator.sections.length; i++)
|
|
|
891 |
{
|
|
|
892 |
|
|
|
893 |
if(objFormGenerator.sections[i].questions.length == 0) {
|
108 |
steven |
894 |
$.fn.showError('El "' + objFormGenerator.sections[i].name + '" no tiene preguntas');
|
84 |
steven |
895 |
break;
|
|
|
896 |
}
|
|
|
897 |
|
|
|
898 |
var valueSection = parseInt(objFormGenerator.sections[i].value);
|
|
|
899 |
var totalValueQuestion = 0;
|
|
|
900 |
|
|
|
901 |
|
|
|
902 |
for(j = 0; j < objFormGenerator.sections[i].questions.length; j++)
|
|
|
903 |
{
|
|
|
904 |
valueQuestion = parseInt(objFormGenerator.sections[i].questions[j].value);
|
|
|
905 |
totalValueQuestion = totalValueQuestion + valueQuestion;
|
|
|
906 |
if(objFormGenerator.sections[i].questions[j].type == 'simple'
|
|
|
907 |
|| objFormGenerator.sections[i].questions[j].type == 'multiple'
|
|
|
908 |
|| objFormGenerator.sections[i].questions[j].type == 'rating-open' ) {
|
|
|
909 |
|
|
|
910 |
var questionNumber = j + 1;
|
|
|
911 |
var numberCorrect = 0;
|
|
|
912 |
|
|
|
913 |
|
|
|
914 |
if(objFormGenerator.sections[i].questions[j].options.length == 0) {
|
108 |
steven |
915 |
$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' no tiene opciones');
|
|
|
916 |
error = true;
|
|
|
917 |
break;
|
84 |
steven |
918 |
}
|
|
|
919 |
|
|
|
920 |
|
|
|
921 |
var totalOption = 0;
|
|
|
922 |
var maxOption = 0;
|
|
|
923 |
for(k = 0; k < objFormGenerator.sections[i].questions[j].options.length; k++)
|
|
|
924 |
{
|
|
|
925 |
if(objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple' ) {
|
|
|
926 |
if(objFormGenerator.sections[i].questions[j].options[k].correct == 1) {
|
|
|
927 |
numberCorrect++;
|
|
|
928 |
}
|
|
|
929 |
}
|
|
|
930 |
|
|
|
931 |
if(objFormGenerator.sections[i].questions[j].type == 'multiple' && objFormGenerator.sections[i].questions[j].options[k].correct == 1) {
|
|
|
932 |
totalOption = totalOption + parseInt(objFormGenerator.sections[i].questions[j].options[k].value);
|
|
|
933 |
}
|
|
|
934 |
|
|
|
935 |
if(objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
|
|
936 |
if(parseInt(objFormGenerator.sections[i].questions[j].options[k].value) > maxOption) {
|
108 |
steven |
937 |
maxOption = parseInt(objFormGenerator.sections[i].questions[j].options[k].value);
|
84 |
steven |
938 |
}
|
|
|
939 |
}
|
|
|
940 |
|
|
|
941 |
}
|
|
|
942 |
|
|
|
943 |
if(objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple' ) {
|
|
|
944 |
|
|
|
945 |
if(numberCorrect == 0) {
|
108 |
steven |
946 |
$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' no tiene una opcion correcta');
|
84 |
steven |
947 |
error = true;
|
|
|
948 |
break;
|
|
|
949 |
}
|
|
|
950 |
if(objFormGenerator.sections[i].questions[j].type == 'simple' && numberCorrect > 1) {
|
108 |
steven |
951 |
$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' tiene más de una opción correcta');
|
84 |
steven |
952 |
error = true;
|
|
|
953 |
break;
|
|
|
954 |
}
|
|
|
955 |
if(objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
|
108 |
steven |
956 |
$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' solo tiene una opción correcta');
|
84 |
steven |
957 |
error = true;
|
|
|
958 |
break;
|
|
|
959 |
}
|
|
|
960 |
}
|
|
|
961 |
|
|
|
962 |
//console.log('totalOption = ' + totalOption + ' valueQuestion = ' + valueQuestion );
|
|
|
963 |
|
|
|
964 |
if(objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption > valueQuestion ) {
|
108 |
steven |
965 |
$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' la suma de los valores de las opciones es mayor que el valor de la pregunta');
|
84 |
steven |
966 |
error = true;
|
|
|
967 |
break;
|
|
|
968 |
}
|
|
|
969 |
|
|
|
970 |
//console.log('maxOption = ' + maxOption + ' valueQuestion = ' + valueQuestion );
|
|
|
971 |
|
|
|
972 |
if(objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion ) {
|
108 |
steven |
973 |
$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' ');
|
84 |
steven |
974 |
error = true;
|
|
|
975 |
break;
|
|
|
976 |
}
|
|
|
977 |
}
|
|
|
978 |
|
|
|
979 |
|
|
|
980 |
}
|
|
|
981 |
|
|
|
982 |
if(valueSection != totalValueQuestion) {
|
108 |
steven |
983 |
$.fn.showError('El "' + objFormGenerator.sections[i].name + '" sección y las preguntas no son las mismas');
|
84 |
steven |
984 |
error = true;
|
|
|
985 |
break;
|
|
|
986 |
}
|
|
|
987 |
}
|
|
|
988 |
|
|
|
989 |
|
|
|
990 |
|
|
|
991 |
if(error) {
|
|
|
992 |
return false;
|
|
|
993 |
} else {
|
|
|
994 |
|
|
|
995 |
|
|
|
996 |
var formId = parseInt($( '#form-main #form-id' ).val());
|
|
|
997 |
var formContinue = parseInt($( '#form-main #form-continue' ).val());
|
|
|
998 |
|
|
|
999 |
var data = {
|
|
|
1000 |
'form-id' : formId,
|
|
|
1001 |
'form-name' : $( '#form-main #form-name' ).val(),
|
|
|
1002 |
'form-description' : $( '#form-main #form-description' ).val(),
|
|
|
1003 |
'form-text' : $( '#form-main #form-text' ).val(),
|
|
|
1004 |
'form-language' : $( '#form-main #form-language' ).val(),
|
|
|
1005 |
'form-status' : $( '#form-main #form-status' ).val(),
|
|
|
1006 |
'sections' : objFormGenerator.sections
|
|
|
1007 |
}
|
|
|
1008 |
|
|
|
1009 |
|
|
|
1010 |
$.ajax({
|
|
|
1011 |
'dataType': 'json',
|
|
|
1012 |
'method': 'post',
|
93 |
steven |
1013 |
'url' : '/test/method-one',
|
84 |
steven |
1014 |
'data' : data,
|
|
|
1015 |
}).done(function(response) {
|
|
|
1016 |
|
|
|
1017 |
if(response['success']) {
|
94 |
steven |
1018 |
$.fn.showSuccess(response['message']);
|
84 |
steven |
1019 |
if(formContinue == 1) {
|
|
|
1020 |
$('#form-main #form-id').val(response['form-id']);
|
|
|
1021 |
$('#form-main #form-continue').val(0);
|
|
|
1022 |
} else {
|
|
|
1023 |
$('#row-edit').hide();
|
|
|
1024 |
$('#row-forms').show();
|
|
|
1025 |
}
|
|
|
1026 |
|
|
|
1027 |
|
|
|
1028 |
tableForm.fnDraw();
|
|
|
1029 |
|
|
|
1030 |
} else {
|
94 |
steven |
1031 |
$.fn.showError(response['message']);
|
84 |
steven |
1032 |
}
|
|
|
1033 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
94 |
steven |
1034 |
$.fn.showError(textStatus);
|
84 |
steven |
1035 |
});
|
|
|
1036 |
|
|
|
1037 |
return false;
|
|
|
1038 |
|
|
|
1039 |
|
|
|
1040 |
}
|
|
|
1041 |
}
|
|
|
1042 |
|
|
|
1043 |
|
|
|
1044 |
}
|
|
|
1045 |
});
|
|
|
1046 |
|
|
|
1047 |
//IMPORTANT: update CKEDITOR textarea with actual content before submit
|
|
|
1048 |
$( "#form-section" ).on('submit', function() {
|
|
|
1049 |
for(var instanceName in CKEDITOR.instances) {
|
|
|
1050 |
CKEDITOR.instances[instanceName].updateElement();
|
|
|
1051 |
}
|
|
|
1052 |
})
|
|
|
1053 |
|
|
|
1054 |
var validatorFormSection = $( "#form-section" ).validate( {
|
|
|
1055 |
ignore: [],
|
|
|
1056 |
errorClass: 'help-block',
|
|
|
1057 |
errorElement: 'span',
|
|
|
1058 |
rules: {
|
|
|
1059 |
'section-name': {
|
|
|
1060 |
required: true,
|
|
|
1061 |
minlength: 2,
|
|
|
1062 |
maxlength: 50
|
|
|
1063 |
},
|
|
|
1064 |
'section-text' : {
|
|
|
1065 |
required: false,
|
|
|
1066 |
},
|
|
|
1067 |
'section-value' : {
|
|
|
1068 |
required: true,
|
|
|
1069 |
number: true,
|
|
|
1070 |
min: 1
|
|
|
1071 |
},
|
|
|
1072 |
},
|
|
|
1073 |
highlight: function (element) {
|
|
|
1074 |
$(element).closest('.form-group').addClass('has-error');
|
|
|
1075 |
},
|
|
|
1076 |
unhighlight: function (element) {
|
|
|
1077 |
$(element).closest('.form-group').removeClass('has-error');
|
|
|
1078 |
},
|
|
|
1079 |
errorPlacement: function (error, element) {
|
|
|
1080 |
if (element.attr("data-error-container")) {
|
|
|
1081 |
error.appendTo(element.attr("data-error-container"));
|
|
|
1082 |
} else {
|
|
|
1083 |
error.insertAfter(element);
|
|
|
1084 |
}
|
|
|
1085 |
},
|
|
|
1086 |
invalidHandler: function(form, validator) {
|
|
|
1087 |
if (!validator.numberOfInvalids())
|
|
|
1088 |
return;
|
|
|
1089 |
$('html, body').animate({
|
|
|
1090 |
scrollTop: $(validator.errorList[0].element).offset().top - 100
|
|
|
1091 |
}, 1000);
|
|
|
1092 |
},
|
|
|
1093 |
submitHandler: function(form) {
|
|
|
1094 |
// do other things for a valid form
|
|
|
1095 |
//form.submit();
|
|
|
1096 |
|
|
|
1097 |
var slug = $('#form-section #section-slug').val();
|
|
|
1098 |
if(slug) {
|
|
|
1099 |
objFormGenerator.editSection(
|
|
|
1100 |
$('#form-section #section-slug').val(),
|
|
|
1101 |
$('#form-section #section-name').val(),
|
|
|
1102 |
$('#form-section #section-text').val(),
|
|
|
1103 |
$('#form-section #section-value').val()
|
|
|
1104 |
);
|
|
|
1105 |
} else {
|
|
|
1106 |
objFormGenerator.addSection(
|
|
|
1107 |
$('#form-section #section-name').val(),
|
|
|
1108 |
$('#form-section #section-text').val(),
|
|
|
1109 |
$('#form-section #section-value').val()
|
|
|
1110 |
);
|
|
|
1111 |
}
|
|
|
1112 |
|
|
|
1113 |
|
|
|
1114 |
|
|
|
1115 |
$('#modal-section').modal('hide');
|
|
|
1116 |
return false;
|
|
|
1117 |
}
|
|
|
1118 |
} );
|
|
|
1119 |
|
|
|
1120 |
//IMPORTANT: update CKEDITOR textarea with actual content before submit
|
|
|
1121 |
$( "#form-question" ).on('submit', function() {
|
|
|
1122 |
for(var instanceName in CKEDITOR.instances) {
|
|
|
1123 |
CKEDITOR.instances[instanceName].updateElement();
|
|
|
1124 |
}
|
|
|
1125 |
})
|
|
|
1126 |
|
|
|
1127 |
|
|
|
1128 |
var validatorFormQuestion = $( "#form-question" ).validate( {
|
|
|
1129 |
ignore: [],
|
|
|
1130 |
errorClass: 'help-block',
|
|
|
1131 |
errorElement: 'span',
|
|
|
1132 |
rules: {
|
|
|
1133 |
'question-text' : {
|
|
|
1134 |
required: true,
|
|
|
1135 |
},
|
|
|
1136 |
'question-value' : {
|
|
|
1137 |
required: true,
|
|
|
1138 |
number: true,
|
|
|
1139 |
min: 1
|
|
|
1140 |
},
|
|
|
1141 |
'question-type': {
|
|
|
1142 |
required: true,
|
|
|
1143 |
},
|
|
|
1144 |
'question-max-length' : {
|
|
|
1145 |
required: true,
|
|
|
1146 |
digits: true,
|
|
|
1147 |
min: 0
|
|
|
1148 |
},
|
|
|
1149 |
'question-range' : {
|
|
|
1150 |
required: true,
|
|
|
1151 |
number: true,
|
|
|
1152 |
min: 1
|
|
|
1153 |
},
|
|
|
1154 |
},
|
|
|
1155 |
highlight: function (element) {
|
|
|
1156 |
$(element).closest('.form-group').addClass('has-error');
|
|
|
1157 |
},
|
|
|
1158 |
unhighlight: function (element) {
|
|
|
1159 |
$(element).closest('.form-group').removeClass('has-error');
|
|
|
1160 |
},
|
|
|
1161 |
errorPlacement: function (error, element) {
|
|
|
1162 |
if (element.attr("data-error-container")) {
|
|
|
1163 |
error.appendTo(element.attr("data-error-container"));
|
|
|
1164 |
} else {
|
|
|
1165 |
error.insertAfter(element);
|
|
|
1166 |
}
|
|
|
1167 |
},
|
|
|
1168 |
invalidHandler: function(form, validator) {
|
|
|
1169 |
|
|
|
1170 |
//console.log(validator);
|
|
|
1171 |
|
|
|
1172 |
if (!validator.numberOfInvalids())
|
|
|
1173 |
return;
|
|
|
1174 |
$('html, body').animate({
|
|
|
1175 |
scrollTop: $(validator.errorList[0].element).offset().top - 100
|
|
|
1176 |
}, 1000);
|
|
|
1177 |
},
|
|
|
1178 |
submitHandler: function(form) {
|
|
|
1179 |
// do other things for a valid form
|
|
|
1180 |
//form.submit();
|
|
|
1181 |
|
|
|
1182 |
/*console.log('submitHandler');
|
|
|
1183 |
console.log('question-section = ' + $('#form-question #question-section').val());
|
|
|
1184 |
console.log('question-text = ' + $('#form-question #question-text').val());
|
|
|
1185 |
console.log('question-value = ' + $('#form-question #question-value').val());
|
|
|
1186 |
console.log('question-type = ' + $('#form-question #question-type').val());
|
|
|
1187 |
console.log('question-max-length = ' + $('#form-question #question-max-length').val());
|
|
|
1188 |
console.log('question-multiline = ' + $('#form-question #question-multiline').val());
|
|
|
1189 |
console.log('question-range = ' + $('#form-question #question-range').val());*/
|
|
|
1190 |
|
|
|
1191 |
|
|
|
1192 |
|
|
|
1193 |
if($('#form-question #question-slug').val()) {
|
|
|
1194 |
console.log('editQuestion');
|
|
|
1195 |
|
|
|
1196 |
objFormGenerator.editQuestion(
|
|
|
1197 |
$('#form-question #question-section').val(),
|
|
|
1198 |
$('#form-question #question-slug').val(),
|
|
|
1199 |
$('#form-question #question-text').val(),
|
|
|
1200 |
$('#form-question #question-value').val(),
|
|
|
1201 |
$('#form-question #question-type').val(),
|
|
|
1202 |
$('#form-question #question-max-length').val(),
|
|
|
1203 |
$('#form-question #question-multiline').val(),
|
|
|
1204 |
$('#form-question #question-range').val()
|
|
|
1205 |
);
|
|
|
1206 |
} else {
|
|
|
1207 |
console.log('addQuestion');
|
|
|
1208 |
|
|
|
1209 |
objFormGenerator.addQuestion(
|
|
|
1210 |
$('#form-question #question-section').val(),
|
|
|
1211 |
$('#form-question #question-text').val(),
|
|
|
1212 |
$('#form-question #question-value').val(),
|
|
|
1213 |
$('#form-question #question-type').val(),
|
|
|
1214 |
$('#form-question #question-max-length').val(),
|
|
|
1215 |
$('#form-question #question-multiline').val(),
|
|
|
1216 |
$('#form-question #question-range').val()
|
|
|
1217 |
);
|
|
|
1218 |
}
|
|
|
1219 |
|
|
|
1220 |
$('#modal-question').modal('hide');
|
|
|
1221 |
return false;
|
|
|
1222 |
}
|
|
|
1223 |
} );
|
|
|
1224 |
|
|
|
1225 |
//IMPORTANT: update CKEDITOR textarea with actual content before submit
|
|
|
1226 |
$( "#form-option" ).on('submit', function() {
|
|
|
1227 |
for(var instanceName in CKEDITOR.instances) {
|
|
|
1228 |
CKEDITOR.instances[instanceName].updateElement();
|
|
|
1229 |
}
|
|
|
1230 |
})
|
|
|
1231 |
|
|
|
1232 |
var validatorFormOption = $( "#form-option" ).validate( {
|
|
|
1233 |
ignore: [],
|
|
|
1234 |
errorClass: 'help-block',
|
|
|
1235 |
errorElement: 'span',
|
|
|
1236 |
rules: {
|
|
|
1237 |
'option-text' : {
|
|
|
1238 |
required: true,
|
|
|
1239 |
},
|
|
|
1240 |
'option-value' : {
|
|
|
1241 |
required: true,
|
|
|
1242 |
number: true,
|
|
|
1243 |
min: 1
|
|
|
1244 |
}
|
|
|
1245 |
},
|
|
|
1246 |
highlight: function (element) {
|
|
|
1247 |
$(element).closest('.form-group').addClass('has-error');
|
|
|
1248 |
},
|
|
|
1249 |
unhighlight: function (element) {
|
|
|
1250 |
$(element).closest('.form-group').removeClass('has-error');
|
|
|
1251 |
},
|
|
|
1252 |
errorPlacement: function (error, element) {
|
|
|
1253 |
if (element.attr("data-error-container")) {
|
|
|
1254 |
error.appendTo(element.attr("data-error-container"));
|
|
|
1255 |
} else {
|
|
|
1256 |
error.insertAfter(element);
|
|
|
1257 |
}
|
|
|
1258 |
},
|
|
|
1259 |
invalidHandler: function(form, validator) {
|
|
|
1260 |
if (!validator.numberOfInvalids())
|
|
|
1261 |
return;
|
|
|
1262 |
$('html, body').animate({
|
|
|
1263 |
scrollTop: $(validator.errorList[0].element).offset().top - 100
|
|
|
1264 |
}, 1000);
|
|
|
1265 |
},
|
|
|
1266 |
submitHandler: function(form) {
|
|
|
1267 |
// do other things for a valid form
|
|
|
1268 |
//form.submit();
|
|
|
1269 |
|
|
|
1270 |
|
|
|
1271 |
if($('#form-option #option-slug').val()) {
|
|
|
1272 |
objFormGenerator.editOption(
|
|
|
1273 |
$('#form-option #option-section').val(),
|
|
|
1274 |
$('#form-option #option-question').val(),
|
|
|
1275 |
$('#form-option #option-slug').val(),
|
|
|
1276 |
$('#form-option #option-text').val(),
|
|
|
1277 |
$('#form-option #option-correct').val(),
|
|
|
1278 |
$('#form-option #option-value').val()
|
|
|
1279 |
);
|
|
|
1280 |
} else {
|
|
|
1281 |
objFormGenerator.addOption(
|
|
|
1282 |
$('#form-option #option-section').val(),
|
|
|
1283 |
$('#form-option #option-question').val(),
|
|
|
1284 |
$('#form-option #option-text').val(),
|
|
|
1285 |
$('#form-option #option-correct').val(),
|
|
|
1286 |
$('#form-option #option-value').val()
|
|
|
1287 |
);
|
|
|
1288 |
}
|
|
|
1289 |
|
|
|
1290 |
|
|
|
1291 |
|
|
|
1292 |
|
|
|
1293 |
$('#modal-option').modal('hide');
|
|
|
1294 |
return false;
|
|
|
1295 |
}
|
|
|
1296 |
} );
|
|
|
1297 |
|
|
|
1298 |
$('body').on('click', 'button[id="btn-add-section"]', function(e){
|
|
|
1299 |
e.preventDefault();
|
|
|
1300 |
|
|
|
1301 |
validatorFormSection.resetForm();
|
|
|
1302 |
$('#form-section #section-slug').val('');
|
|
|
1303 |
$('#form-section #section-name').val('');
|
|
|
1304 |
|
|
|
1305 |
instanceName = 'section-text';
|
|
|
1306 |
let editor = CKEDITOR.instances[instanceName ];
|
|
|
1307 |
editor.setData( '', function() {
|
|
|
1308 |
editor.focus();
|
|
|
1309 |
});
|
|
|
1310 |
|
|
|
1311 |
|
|
|
1312 |
$('#form-section #section-value').val('0');
|
|
|
1313 |
$('#modal-section h4[class="modal-title"]').html('New Section');
|
|
|
1314 |
$('#modal-section').modal('show');
|
|
|
1315 |
});
|
|
|
1316 |
|
|
|
1317 |
$('body').on('click', 'button.btn-edit-section', function(e){
|
|
|
1318 |
e.preventDefault();
|
|
|
1319 |
|
|
|
1320 |
var slug = $(this).data('slug');
|
|
|
1321 |
var section;
|
|
|
1322 |
var showForm = false;
|
|
|
1323 |
|
|
|
1324 |
for(i = 0; i < objFormGenerator.sections.length; i++) {
|
|
|
1325 |
section = objFormGenerator.sections[i];
|
|
|
1326 |
|
|
|
1327 |
if(slug == section.slug) {
|
|
|
1328 |
|
|
|
1329 |
//console.log('btn-edit-section');
|
|
|
1330 |
//console.log(section);
|
|
|
1331 |
|
|
|
1332 |
validatorFormSection.resetForm();
|
|
|
1333 |
$('#form-section #section-slug').val(section.slug);
|
|
|
1334 |
$('#form-section #section-name').val(section.name);
|
|
|
1335 |
|
|
|
1336 |
instanceName = 'section-text';
|
|
|
1337 |
let editor = CKEDITOR.instances[instanceName ];
|
|
|
1338 |
editor.setData( section.text, function() {
|
|
|
1339 |
editor.focus();
|
|
|
1340 |
});
|
|
|
1341 |
|
|
|
1342 |
$('#form-section #section-value').val(section.value);
|
|
|
1343 |
|
|
|
1344 |
showForm = true;
|
|
|
1345 |
break;
|
|
|
1346 |
}
|
|
|
1347 |
}
|
|
|
1348 |
|
|
|
1349 |
if(showForm) {
|
|
|
1350 |
$('#modal-section h4[class="modal-title"]').html('Edit Section');
|
|
|
1351 |
$('#modal-section').modal('show');
|
|
|
1352 |
}
|
|
|
1353 |
|
|
|
1354 |
});
|
|
|
1355 |
|
|
|
1356 |
$('body').on('click', 'button.btn-delete-section', function(e){
|
|
|
1357 |
e.preventDefault();
|
|
|
1358 |
var slug = $(this).data('slug');
|
|
|
1359 |
|
16822 |
efrain |
1360 |
swal.fire({
|
|
|
1361 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
1362 |
message: "LABEL_DELETE LABEL_SECTION",
|
|
|
1363 |
icon: 'question',
|
|
|
1364 |
cancelButtonText: 'LABEL_NO',
|
|
|
1365 |
showCancelButton: true,
|
|
|
1366 |
confirmButtonText: 'LABEL_YES'
|
|
|
1367 |
}).then((result) => {
|
|
|
1368 |
if (result.isConfirmed) {
|
|
|
1369 |
}
|
|
|
1370 |
});
|
|
|
1371 |
|
84 |
steven |
1372 |
|
16822 |
efrain |
1373 |
|
84 |
steven |
1374 |
|
|
|
1375 |
|
|
|
1376 |
});
|
|
|
1377 |
|
|
|
1378 |
|
|
|
1379 |
$('body').on('click', 'button.btn-add-question', function(e){
|
|
|
1380 |
e.preventDefault();
|
|
|
1381 |
|
|
|
1382 |
validatorFormQuestion.resetForm();
|
|
|
1383 |
var slug = $(this).data('slug');
|
|
|
1384 |
|
|
|
1385 |
$('#form-question #question-section').val(slug);
|
|
|
1386 |
$('#form-question #question-slug').val('');
|
|
|
1387 |
|
|
|
1388 |
instanceName = 'question-text';
|
|
|
1389 |
let editor = CKEDITOR.instances[instanceName ];
|
|
|
1390 |
editor.setData( '', function() {
|
|
|
1391 |
editor.focus();
|
|
|
1392 |
});
|
|
|
1393 |
|
|
|
1394 |
|
|
|
1395 |
$('#form-question #question-value').val('0');
|
|
|
1396 |
$('#form-question #question-type').val($('#form-question #question-type option:first').val());
|
|
|
1397 |
|
|
|
1398 |
$('#form-question #question-max-length').val('0');
|
|
|
1399 |
$('#form-question #question-max-length').parent().show();
|
|
|
1400 |
|
|
|
1401 |
$('#form-question #question-multiline').val('0');
|
|
|
1402 |
$('#form-question #question-multiline').parent().show();
|
|
|
1403 |
|
|
|
1404 |
$('#form-question #question-range').val('10');
|
|
|
1405 |
$('#form-question #question-range').parent().hide();
|
|
|
1406 |
|
|
|
1407 |
$('#modal-question h4[class="modal-title"]').html('New Question');
|
|
|
1408 |
$('#modal-question').modal('show');
|
|
|
1409 |
|
|
|
1410 |
});
|
|
|
1411 |
|
|
|
1412 |
|
|
|
1413 |
|
|
|
1414 |
$('body').on('click', 'button.btn-edit-question', function(e){
|
|
|
1415 |
e.preventDefault();
|
|
|
1416 |
|
|
|
1417 |
var slug_section = $(this).data('section');
|
|
|
1418 |
var slug = $(this).data('slug');
|
|
|
1419 |
var showForm = false;
|
|
|
1420 |
|
|
|
1421 |
for(i = 0; i < objFormGenerator.sections.length; i++) {
|
|
|
1422 |
|
|
|
1423 |
if(slug_section == objFormGenerator.sections[i].slug) {
|
|
|
1424 |
|
|
|
1425 |
for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
|
|
|
1426 |
|
|
|
1427 |
if(slug == objFormGenerator.sections[i].questions[j].slug) {
|
|
|
1428 |
validatorFormQuestion.resetForm();
|
|
|
1429 |
|
|
|
1430 |
$('#form-question #question-section').val(objFormGenerator.sections[i].slug);
|
|
|
1431 |
$('#form-question #question-slug').val(objFormGenerator.sections[i].questions[j].slug);
|
|
|
1432 |
|
|
|
1433 |
instanceName = 'question-text';
|
|
|
1434 |
let editor = CKEDITOR.instances[instanceName ];
|
|
|
1435 |
editor.setData( objFormGenerator.sections[i].questions[j].text, function() {
|
|
|
1436 |
editor.focus();
|
|
|
1437 |
});
|
|
|
1438 |
|
|
|
1439 |
|
|
|
1440 |
$('#form-question #question-value').val(objFormGenerator.sections[i].questions[j].value);
|
|
|
1441 |
$('#form-question #question-type').val(objFormGenerator.sections[i].questions[j].type);
|
|
|
1442 |
|
|
|
1443 |
|
|
|
1444 |
|
|
|
1445 |
if(objFormGenerator.sections[i].questions[j].type == 'open') {
|
|
|
1446 |
$('#form-question #question-max-length').val(objFormGenerator.sections[i].questions[j].maxlength);
|
|
|
1447 |
$('#form-question #question-max-length').parent().show();
|
|
|
1448 |
|
|
|
1449 |
$('#form-question #question-multiline').val(objFormGenerator.sections[i].questions[j].multiline);
|
|
|
1450 |
$('#form-question #question-multiline').parent().show();
|
|
|
1451 |
} else {
|
|
|
1452 |
$('#form-question #question-max-length').val('0');
|
|
|
1453 |
$('#form-question #question-max-length').parent().hide();
|
|
|
1454 |
|
|
|
1455 |
$('#form-question #question-multiline').val('0');
|
|
|
1456 |
$('#form-question #question-multiline').parent().hide();
|
|
|
1457 |
}
|
|
|
1458 |
|
|
|
1459 |
if(objFormGenerator.sections[i].questions[j].type == 'rating-range') {
|
|
|
1460 |
$('#form-question #question-range').val(objFormGenerator.sections[i].questions[j].range);
|
|
|
1461 |
$('#form-question #question-range').parent().show();
|
|
|
1462 |
|
|
|
1463 |
} else {
|
|
|
1464 |
$('#form-question #question-range').val('10');
|
|
|
1465 |
$('#form-question #question-range').parent().hide();
|
|
|
1466 |
}
|
|
|
1467 |
|
|
|
1468 |
showForm = true;
|
|
|
1469 |
break;
|
|
|
1470 |
|
|
|
1471 |
}
|
|
|
1472 |
|
|
|
1473 |
}
|
|
|
1474 |
|
|
|
1475 |
break;
|
|
|
1476 |
}
|
|
|
1477 |
}
|
|
|
1478 |
|
|
|
1479 |
if(showForm) {
|
108 |
steven |
1480 |
$('#modal-question h4[class="modal-title"]').html('LABEL_EDIT LABEL_QUESTION');
|
|
|
1481 |
$('#modal-question').modal('show');
|
84 |
steven |
1482 |
}
|
|
|
1483 |
|
|
|
1484 |
});
|
|
|
1485 |
|
|
|
1486 |
|
|
|
1487 |
|
|
|
1488 |
|
|
|
1489 |
$('body').on('click', 'button.btn-delete-question', function(e){
|
|
|
1490 |
e.preventDefault();
|
|
|
1491 |
|
|
|
1492 |
var slug_section = $(this).data('section');
|
|
|
1493 |
var slug = $(this).data('slug');
|
|
|
1494 |
|
16822 |
efrain |
1495 |
swal.fire({
|
|
|
1496 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
1497 |
message: "LABEL_DELETE LABEL_QUESTION",
|
|
|
1498 |
icon: 'question',
|
|
|
1499 |
cancelButtonText: 'LABEL_NO',
|
|
|
1500 |
showCancelButton: true,
|
|
|
1501 |
confirmButtonText: 'LABEL_YES'
|
|
|
1502 |
}).then((result) => {
|
|
|
1503 |
if (result.isConfirmed) {
|
|
|
1504 |
objFormGenerator.deleteQuestion(slug_section, slug);
|
|
|
1505 |
}
|
|
|
1506 |
});
|
|
|
1507 |
|
|
|
1508 |
|
84 |
steven |
1509 |
});
|
|
|
1510 |
|
|
|
1511 |
|
|
|
1512 |
$('body').on('click', 'button.btn-add-option', function(e){
|
|
|
1513 |
e.preventDefault();
|
|
|
1514 |
var slug_section = $(this).data('section');
|
|
|
1515 |
var slug_question = $(this).data('slug');
|
|
|
1516 |
var showForm = false;
|
|
|
1517 |
|
|
|
1518 |
for(i = 0; i < objFormGenerator.sections.length; i++) {
|
|
|
1519 |
if(slug_section == objFormGenerator.sections[i].slug) {
|
|
|
1520 |
for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
|
|
|
1521 |
if(slug_question == objFormGenerator.sections[i].questions[j].slug) {
|
|
|
1522 |
|
|
|
1523 |
validatorFormOption.resetForm();
|
|
|
1524 |
$('#form-option #option-section').val(slug_section);
|
|
|
1525 |
$('#form-option #option-question').val(slug_question);
|
|
|
1526 |
$('#form-option #option-slug').val('');
|
|
|
1527 |
|
|
|
1528 |
instanceName = 'option-text';
|
|
|
1529 |
let editor = CKEDITOR.instances[instanceName ];
|
|
|
1530 |
editor.setData( '', function() {
|
|
|
1531 |
editor.focus();
|
|
|
1532 |
});
|
|
|
1533 |
|
|
|
1534 |
|
|
|
1535 |
$('#form-option #option-correct').val('0');
|
|
|
1536 |
if(objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
|
|
1537 |
$('#form-option #option-correct').parent().hide();
|
|
|
1538 |
} else {
|
|
|
1539 |
$('#form-option #option-correct').parent().show();
|
|
|
1540 |
}
|
|
|
1541 |
|
|
|
1542 |
if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
|
|
1543 |
$('#form-option #option-value').val('0');
|
|
|
1544 |
$('#form-option #option-value').parent().show();
|
|
|
1545 |
} else {
|
|
|
1546 |
$('#form-option #option-value').val('1');
|
|
|
1547 |
$('#form-option #option-value').parent().hide();
|
|
|
1548 |
|
|
|
1549 |
}
|
|
|
1550 |
showForm = true;
|
|
|
1551 |
}
|
|
|
1552 |
}
|
|
|
1553 |
}
|
|
|
1554 |
}
|
|
|
1555 |
|
|
|
1556 |
if(showForm) {
|
|
|
1557 |
$('#modal-option h4[class="modal-title"]').html('New Option');
|
|
|
1558 |
$('#modal-option').modal('show');
|
|
|
1559 |
}
|
|
|
1560 |
|
|
|
1561 |
});
|
|
|
1562 |
|
|
|
1563 |
|
|
|
1564 |
|
|
|
1565 |
$('body').on('click', 'button.btn-edit-option', function(e){
|
|
|
1566 |
e.preventDefault();
|
|
|
1567 |
|
|
|
1568 |
var slug_section = $(this).data('section');
|
|
|
1569 |
var slug_question = $(this).data('question');
|
|
|
1570 |
var slug = $(this).data('slug');
|
|
|
1571 |
var showForm = false;
|
|
|
1572 |
|
|
|
1573 |
for(i = 0; i < objFormGenerator.sections.length; i++) {
|
|
|
1574 |
if(slug_section == objFormGenerator.sections[i].slug) {
|
|
|
1575 |
for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
|
|
|
1576 |
if(slug_question == objFormGenerator.sections[i].questions[j].slug) {
|
|
|
1577 |
for(k = 0; k < objFormGenerator.sections[i].questions[j].options.length; k++) {
|
|
|
1578 |
if(slug == objFormGenerator.sections[i].questions[j].options[k].slug) {
|
|
|
1579 |
validatorFormOption.resetForm();
|
|
|
1580 |
$('#form-option #option-section').val(objFormGenerator.sections[i].slug);
|
|
|
1581 |
$('#form-option #option-question').val(objFormGenerator.sections[i].questions[j].slug);
|
|
|
1582 |
$('#form-option #option-slug').val(objFormGenerator.sections[i].questions[j].options[k].slug);
|
|
|
1583 |
|
|
|
1584 |
instanceName = 'option-text';
|
|
|
1585 |
let editor = CKEDITOR.instances[instanceName ];
|
|
|
1586 |
editor.setData( objFormGenerator.sections[i].questions[j].options[k].text, function() {
|
|
|
1587 |
editor.focus();
|
|
|
1588 |
});
|
|
|
1589 |
|
|
|
1590 |
|
|
|
1591 |
$('#form-option #option-correct').val(objFormGenerator.sections[i].questions[j].options[k].correct);
|
|
|
1592 |
if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'simple') {
|
|
|
1593 |
$('#form-option #option-correct').parent().show();
|
|
|
1594 |
} else {
|
|
|
1595 |
$('#form-option #option-correct').parent().hide();
|
|
|
1596 |
}
|
|
|
1597 |
|
|
|
1598 |
$('#form-option #option-value').val(objFormGenerator.sections[i].questions[j].options[k].value);
|
|
|
1599 |
|
|
|
1600 |
if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
|
|
1601 |
$('#form-option #option-value').parent().show();
|
|
|
1602 |
} else {
|
|
|
1603 |
$('#form-option #option-value').parent().hide();
|
|
|
1604 |
}
|
|
|
1605 |
|
|
|
1606 |
|
|
|
1607 |
|
|
|
1608 |
showForm = true;
|
|
|
1609 |
break;
|
|
|
1610 |
}
|
|
|
1611 |
}
|
|
|
1612 |
}
|
|
|
1613 |
if(showForm) {
|
|
|
1614 |
break;
|
|
|
1615 |
}
|
|
|
1616 |
}
|
|
|
1617 |
}
|
|
|
1618 |
if(showForm) {
|
|
|
1619 |
break;
|
|
|
1620 |
}
|
|
|
1621 |
}
|
|
|
1622 |
|
|
|
1623 |
if(showForm) {
|
108 |
steven |
1624 |
$('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
|
|
|
1625 |
$('#modal-option').modal('show');
|
84 |
steven |
1626 |
}
|
|
|
1627 |
});
|
|
|
1628 |
|
|
|
1629 |
$('body').on('click', 'button.btn-delete-option', function(e){
|
|
|
1630 |
e.preventDefault();
|
|
|
1631 |
var slug_section = $(this).data('section');
|
|
|
1632 |
var slug_question = $(this).data('question');
|
|
|
1633 |
var slug = $(this).data('slug');
|
|
|
1634 |
|
16822 |
efrain |
1635 |
swal.fire({
|
|
|
1636 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
1637 |
message: "LABEL_DELETE LABEL_OPTION",
|
|
|
1638 |
icon: 'question',
|
|
|
1639 |
cancelButtonText: 'LABEL_NO',
|
|
|
1640 |
showCancelButton: true,
|
|
|
1641 |
confirmButtonText: 'LABEL_YES'
|
|
|
1642 |
}).then((result) => {
|
|
|
1643 |
if (result.isConfirmed) {
|
|
|
1644 |
}
|
|
|
1645 |
});
|
84 |
steven |
1646 |
|
16822 |
efrain |
1647 |
|
84 |
steven |
1648 |
})
|
|
|
1649 |
|
|
|
1650 |
$('#form-section #section-value').inputNumberFormat({'decimal' : 2});
|
|
|
1651 |
|
|
|
1652 |
$('#form-question #question-value').inputNumberFormat({'decimal' : 2});
|
|
|
1653 |
$('#form-question #question-max-length').inputNumberFormat({'decimal' : 0});
|
|
|
1654 |
|
|
|
1655 |
$('#form-option #option-value').inputNumberFormat({'decimal' : 2});
|
|
|
1656 |
|
|
|
1657 |
$('#form-question #question-type').change(function(e) {
|
|
|
1658 |
e.preventDefault();
|
|
|
1659 |
|
|
|
1660 |
if($('#form-question #question-type').val() == 'open') {
|
|
|
1661 |
$('#form-question #question-max-length').parent().show();
|
|
|
1662 |
$('#form-question #question-multiline').parent().show();
|
|
|
1663 |
|
|
|
1664 |
} else {
|
|
|
1665 |
$('#form-question #question-max-length').val('0');
|
|
|
1666 |
$('#form-question #question-max-length').parent().hide();
|
|
|
1667 |
|
|
|
1668 |
$('#form-question #question-multiline').val('0');
|
|
|
1669 |
$('#form-question #question-multiline').parent().hide();
|
|
|
1670 |
}
|
|
|
1671 |
|
|
|
1672 |
$('#form-question #question-range').val('10');
|
|
|
1673 |
if($('#form-question #question-type').val() == 'rating-range') {
|
|
|
1674 |
$('#form-question #question-range').parent().show();
|
|
|
1675 |
} else {
|
|
|
1676 |
$('#form-question #question-range').parent().hide();
|
|
|
1677 |
}
|
|
|
1678 |
|
|
|
1679 |
|
|
|
1680 |
|
|
|
1681 |
});
|
|
|
1682 |
|
|
|
1683 |
$('button.btn-add-form').click(function(e) {
|
|
|
1684 |
e.preventDefault();
|
|
|
1685 |
|
|
|
1686 |
objFormGenerator.clear();
|
|
|
1687 |
objFormGenerator.render();
|
|
|
1688 |
validatorForm.resetForm();
|
|
|
1689 |
|
|
|
1690 |
$('#form-main #form-id').val('0');
|
|
|
1691 |
$('#form-main #form-continue').val('0');
|
|
|
1692 |
$('#form-main #form-name').val('');
|
|
|
1693 |
|
|
|
1694 |
instanceName = 'form-text';
|
|
|
1695 |
let editor = CKEDITOR.instances[instanceName ];
|
|
|
1696 |
editor.setData('', function() {
|
|
|
1697 |
editor.focus();
|
|
|
1698 |
});
|
|
|
1699 |
|
|
|
1700 |
|
|
|
1701 |
instanceName = 'form-description';
|
|
|
1702 |
CKEDITOR.instances[instanceName ].setData('');
|
|
|
1703 |
|
|
|
1704 |
$( '#form-main #form-language' ).val('EN'),
|
|
|
1705 |
$( '#form-main #form-status' ).val('D');
|
|
|
1706 |
|
|
|
1707 |
$('#row-forms').hide();
|
|
|
1708 |
$('#row-edit').show();
|
|
|
1709 |
$('#form-main #form-name').focus();
|
|
|
1710 |
|
|
|
1711 |
/*$('html, body').animate({
|
|
|
1712 |
scrollTop: $('#form-main #form-name').offset().top - 100
|
|
|
1713 |
}, 1000);*/
|
|
|
1714 |
});
|
|
|
1715 |
|
|
|
1716 |
$('button.btn-edit-cancel').click(function(e) {
|
|
|
1717 |
e.preventDefault();
|
|
|
1718 |
$('#row-edit').hide();
|
|
|
1719 |
$('#row-forms').show();
|
|
|
1720 |
|
|
|
1721 |
});
|
|
|
1722 |
|
|
|
1723 |
|
|
|
1724 |
$('button.btn-form-save-continue').click(function(e) {
|
|
|
1725 |
e.preventDefault();
|
|
|
1726 |
$('#form-main #form-continue').val('1')
|
|
|
1727 |
$('#form-main').submit();
|
|
|
1728 |
});
|
|
|
1729 |
|
|
|
1730 |
$('button.btn-form-save-close').click(function(e) {
|
|
|
1731 |
e.preventDefault();
|
|
|
1732 |
$('#form-main #form-continue').val('0')
|
|
|
1733 |
$('#form-main').submit();
|
|
|
1734 |
|
|
|
1735 |
});
|
|
|
1736 |
|
|
|
1737 |
$('#modal-section, #modal-question, #modal-option').modal({
|
108 |
steven |
1738 |
backdrop: 'static',
|
|
|
1739 |
keyboard: false,
|
|
|
1740 |
show: false
|
|
|
1741 |
});
|
84 |
steven |
1742 |
});
|
66 |
efrain |
1743 |
JS;
|
|
|
1744 |
$this->inlineScript()->captureEnd();
|
|
|
1745 |
?>
|
83 |
steven |
1746 |
<style type="text/css">
|
|
|
1747 |
/*#uniform-select_all{0
|
|
|
1748 |
margin-left: 15px;
|
|
|
1749 |
}*/
|
66 |
efrain |
1750 |
|
83 |
steven |
1751 |
tbody input[type="checkbox"]{
|
|
|
1752 |
margin-left: 14px;
|
|
|
1753 |
}
|
|
|
1754 |
|
101 |
steven |
1755 |
.panel-heading .accordion-toggle:after {
|
83 |
steven |
1756 |
/* symbol for "opening" panels */
|
100 |
steven |
1757 |
display: inline-block;
|
|
|
1758 |
font: normal normal normal 14px/1 FontAwesome;
|
|
|
1759 |
font-size: inherit;
|
105 |
steven |
1760 |
content: "\f077" ;
|
101 |
steven |
1761 |
float: right; /* adjust as needed */
|
|
|
1762 |
color: grey; /* adjust as needed */
|
102 |
steven |
1763 |
text-rendering: auto;
|
100 |
steven |
1764 |
-webkit-font-smoothing: antialiased;
|
83 |
steven |
1765 |
}
|
102 |
steven |
1766 |
.panel-heading .accordion-toggle.collapsed:after {
|
|
|
1767 |
/* symbol for "collapsed" panels */
|
105 |
steven |
1768 |
content: "\f078"; /* adjust as needed, taken from bootstrap.css */
|
102 |
steven |
1769 |
}
|
83 |
steven |
1770 |
|
|
|
1771 |
|
|
|
1772 |
</style>
|
66 |
efrain |
1773 |
<!-- Content Header (Page header) -->
|
|
|
1774 |
<section class="content-header">
|
|
|
1775 |
<div class="container-fluid">
|
|
|
1776 |
<div class="row mb-2">
|
|
|
1777 |
<div class="col-sm-12">
|
|
|
1778 |
<h1>LABEL_TEST</h1>
|
|
|
1779 |
</div>
|
|
|
1780 |
</div>
|
|
|
1781 |
</div><!-- /.container-fluid -->
|
|
|
1782 |
</section>
|
|
|
1783 |
|
|
|
1784 |
<section class="content">
|
|
|
1785 |
<div class="container-fluid">
|
|
|
1786 |
<div class="row">
|
|
|
1787 |
<div class="col-md-12 col-sm-12">
|
79 |
steven |
1788 |
<!-- Content -->
|
|
|
1789 |
<div class="row" id="row-forms">
|
|
|
1790 |
<div class="col-md-12">
|
|
|
1791 |
<!-- Begin: life time stats -->
|
80 |
steven |
1792 |
<div class="portlet box blue-dark">
|
|
|
1793 |
<div class="portlet-title ">
|
|
|
1794 |
<div class="caption">
|
109 |
steven |
1795 |
<i class="fa fa-dot-circle-o"></i>LABEL_PERFORMANCE_EVALUATION
|
80 |
steven |
1796 |
</div>
|
|
|
1797 |
<div class="actions portlet-toggler">
|
113 |
steven |
1798 |
<button class="btn blue btn-add-form" data-toggle="tooltip" title="LABEL_ADD">
|
109 |
steven |
1799 |
<i class="fa fa-plus"></i> LABEL_ADD
|
80 |
steven |
1800 |
</button>
|
118 |
steven |
1801 |
<button class="btn red hide btn-delete-forms" data-action="delete" data-toggle="tooltip" title="LABEL_DELETE LABEL_SELECTED">
|
|
|
1802 |
<i class="fa fa-minus"></i> LABEL_DELETE LABEL_SELECTED
|
|
|
1803 |
</button>
|
80 |
steven |
1804 |
<div class="btn-group"></div>
|
|
|
1805 |
</div>
|
79 |
steven |
1806 |
|
80 |
steven |
1807 |
</div>
|
|
|
1808 |
<div class="portlet-body portlet-toggler">
|
16912 |
efrain |
1809 |
<table id="table-form" class="table table-bordered table-bordered">
|
80 |
steven |
1810 |
|
|
|
1811 |
</table>
|
|
|
1812 |
</div>
|
|
|
1813 |
<div class="portlet-body portlet-toggler pageform" style="display:none;"></div>
|
|
|
1814 |
</div>
|
|
|
1815 |
</div>
|
|
|
1816 |
</div>
|
|
|
1817 |
<!-- End Content -->
|
|
|
1818 |
<!-- Row Edit -->
|
91 |
steven |
1819 |
<div class="row" id="row-edit" style="display: none">
|
80 |
steven |
1820 |
<div class="col-xs-12 col-md-12">
|
|
|
1821 |
<form action="#" name="form-main" id="form-main">
|
|
|
1822 |
<input type="hidden" name="form-id" id="form-id" value="0" />
|
|
|
1823 |
<input type="hidden" name="form-continue" id="form-continue" value="0" />
|
|
|
1824 |
<div class="form-group">
|
109 |
steven |
1825 |
<label for="form-name">LABEL_FIRST_NAME</label>
|
80 |
steven |
1826 |
<input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
|
79 |
steven |
1827 |
</div>
|
80 |
steven |
1828 |
<div class="form-group">
|
109 |
steven |
1829 |
<label for="form-description">LABEL_DESCRIPTION</label>
|
80 |
steven |
1830 |
<!-- ckeditor -->
|
|
|
1831 |
<textarea name="form-description" id="form-description" rows="5" class="ckeditor form-control"></textarea>
|
|
|
1832 |
</div>
|
|
|
1833 |
<div class="form-group">
|
109 |
steven |
1834 |
<label for="form-text">LABEL_TEXT</label>
|
80 |
steven |
1835 |
<!-- ckeditor -->
|
|
|
1836 |
<textarea name="form-text" id="form-text" rows="5" class="ckeditor form-control"></textarea>
|
79 |
steven |
1837 |
</div>
|
80 |
steven |
1838 |
<div class="form-group">
|
109 |
steven |
1839 |
<label for="form-language">LABEL_LANGUAGES</label>
|
80 |
steven |
1840 |
<select name="form-language" id="form-language" class="form-control">
|
109 |
steven |
1841 |
<option value="EN">LABEL_ENGLISH</option>
|
|
|
1842 |
<option value="SP">LABEL_SPANISH</option>
|
80 |
steven |
1843 |
</select>
|
|
|
1844 |
</div>
|
|
|
1845 |
<div class="form-group">
|
109 |
steven |
1846 |
<label for="form-status">LABEL_STATUS</label>
|
80 |
steven |
1847 |
<select name="form-status" id="form-status" class="form-control">
|
109 |
steven |
1848 |
<option value="D">LABEL_INACTIVE</option>
|
|
|
1849 |
<option value="A">LABEL_ACTIVE</option>
|
80 |
steven |
1850 |
</select>
|
|
|
1851 |
</div>
|
|
|
1852 |
<br/>
|
|
|
1853 |
<div class="row">
|
|
|
1854 |
<div class="col-xs-12 col-md-12 text-right">
|
111 |
steven |
1855 |
<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>
|
80 |
steven |
1856 |
</div>
|
79 |
steven |
1857 |
</div>
|
85 |
steven |
1858 |
<br />
|
80 |
steven |
1859 |
<div class="row">
|
|
|
1860 |
<div class="col-xs-12 col-md-12">
|
|
|
1861 |
<div class="panel-group" id="accordion">
|
|
|
1862 |
|
|
|
1863 |
|
|
|
1864 |
|
|
|
1865 |
</div>
|
|
|
1866 |
</div>
|
|
|
1867 |
</div>
|
|
|
1868 |
|
|
|
1869 |
|
|
|
1870 |
<div class="form-group">
|
109 |
steven |
1871 |
<button type="submit" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
|
|
|
1872 |
<button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
|
16822 |
efrain |
1873 |
<button type="button" class="btn btn-light btn-edit-cancel">LABEL_CANCEL</button>
|
80 |
steven |
1874 |
</div>
|
|
|
1875 |
</form>
|
79 |
steven |
1876 |
</div>
|
|
|
1877 |
</div>
|
80 |
steven |
1878 |
<!-- End Row Edit -->
|
82 |
steven |
1879 |
<!-- Modals -->
|
119 |
steven |
1880 |
<!-- Section Modal -->
|
82 |
steven |
1881 |
<div id="modal-section" class="modal" tabindex="-1" role="dialog">
|
|
|
1882 |
<div class="modal-dialog" role="document">
|
|
|
1883 |
<form action="#" name="form-section" id="form-section">
|
|
|
1884 |
<input type="hidden" name="section-slug" id="section-slug" value="" />
|
|
|
1885 |
<div class="modal-content">
|
|
|
1886 |
<div class="modal-header">
|
16845 |
efrain |
1887 |
<!-- <h6 class="modal-title">Modal title</h6> -->
|
16864 |
efrain |
1888 |
<!-- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
|
82 |
steven |
1889 |
<span aria-hidden="true">×</span>
|
|
|
1890 |
</button> -->
|
|
|
1891 |
</div>
|
|
|
1892 |
<div class="modal-body">
|
|
|
1893 |
<div class="form-group">
|
109 |
steven |
1894 |
<label for="section-name">LABEL_FIRST_NAME</label>
|
82 |
steven |
1895 |
<input type="text" name="section-name" id="section-name" class="form-control" maxlength="50" value="" />
|
|
|
1896 |
</div>
|
|
|
1897 |
<div class="form-group">
|
109 |
steven |
1898 |
<label for="section-text">LABEL_TEXT</label>
|
82 |
steven |
1899 |
<!-- ckeditor -->
|
|
|
1900 |
<textarea name="section-text" id="section-text" rows="5" class="ckeditor form-control"></textarea>
|
|
|
1901 |
</div>
|
|
|
1902 |
<div class="form-group">
|
109 |
steven |
1903 |
<label for="section-value">LABEL_VALUE</label>
|
82 |
steven |
1904 |
<input type="text" name="section-value" id="section-value" class="form-control" value="0" />
|
|
|
1905 |
</div>
|
|
|
1906 |
</div>
|
16891 |
efrain |
1907 |
<div class="modal-footer text-right">
|
109 |
steven |
1908 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
16864 |
efrain |
1909 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close">LABEL_CLOSE</button>
|
82 |
steven |
1910 |
</div>
|
|
|
1911 |
</div>
|
|
|
1912 |
</form>
|
|
|
1913 |
</div>
|
|
|
1914 |
</div>
|
|
|
1915 |
<!-- End Modal Section -->
|
|
|
1916 |
<!-- Question Modal -->
|
|
|
1917 |
<div id="modal-question" class="modal" tabindex="-1" role="dialog">
|
|
|
1918 |
<div class="modal-dialog" role="document">
|
|
|
1919 |
<form action="#" name="form-question" id="form-question">
|
|
|
1920 |
<input type="hidden" name="question-section" id="question-section" />
|
|
|
1921 |
<input type="hidden" name="question-slug" id="question-slug" />
|
|
|
1922 |
<div class="modal-content">
|
|
|
1923 |
<div class="modal-header">
|
16845 |
efrain |
1924 |
<h6 class="modal-title">LABEL_ADD LABEL_QUESTION</h6>
|
16864 |
efrain |
1925 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
|
109 |
steven |
1926 |
<span aria-hidden="true">×</span>
|
82 |
steven |
1927 |
</button>
|
|
|
1928 |
</div>
|
|
|
1929 |
<div class="modal-body">
|
|
|
1930 |
<div class="form-group">
|
109 |
steven |
1931 |
<label for="question-text">LABEL_TEXT</label>
|
82 |
steven |
1932 |
<!-- ckeditor -->
|
|
|
1933 |
<textarea name="question-text" id="question-text" rows="5" class="ckeditor form-control"></textarea>
|
|
|
1934 |
</div>
|
|
|
1935 |
<div class="form-group">
|
109 |
steven |
1936 |
<label for="question-value">LABEL_VALUE</label>
|
82 |
steven |
1937 |
<input type="text" name="question-value" id="question-value" class="form-control" />
|
|
|
1938 |
</div>
|
|
|
1939 |
<div class="form-group">
|
109 |
steven |
1940 |
<label for="question-type">LABEL_TYPE</label>
|
82 |
steven |
1941 |
<select name="question-type" id="question-type" class="form-control">
|
109 |
steven |
1942 |
<option value="open">LABEL_OPEN</option>
|
82 |
steven |
1943 |
<option value="simple">Simple</option>
|
|
|
1944 |
<option value="multiple">Multiple</option>
|
109 |
steven |
1945 |
<option value="rating-open">LABEL_RATING_OPEN</option>
|
|
|
1946 |
<option value="rating-range">LABEL_RATING_RANGE</option>
|
82 |
steven |
1947 |
</select>
|
|
|
1948 |
</div>
|
|
|
1949 |
<div class="form-group">
|
109 |
steven |
1950 |
<label for="question-max-length">LABEL_MAXLENGTH</label>
|
82 |
steven |
1951 |
<input type="text" name="question-max-length" id="question-max-length" class="form-control" />
|
|
|
1952 |
</div>
|
|
|
1953 |
<div class="form-group">
|
109 |
steven |
1954 |
<label for="question-multiline">LABEL_MULTI_LINE</label>
|
82 |
steven |
1955 |
<select name="question-multiline" id="question-multiline" class="form-control">
|
109 |
steven |
1956 |
<option value="1">LABEL_YES</option>
|
82 |
steven |
1957 |
<option value="0">No</option>
|
|
|
1958 |
</select>
|
|
|
1959 |
</div>
|
|
|
1960 |
<div class="form-group">
|
109 |
steven |
1961 |
<label for="question-range">LABEL_RANGE</label>
|
82 |
steven |
1962 |
<select name="question-range" id="question-range" class="form-control">
|
|
|
1963 |
<option value="10">1-10</option>
|
|
|
1964 |
<option value="6">1-6</option>
|
|
|
1965 |
<option value="5">1-5</option>
|
|
|
1966 |
</select>
|
|
|
1967 |
</div>
|
|
|
1968 |
</div>
|
16891 |
efrain |
1969 |
<div class="modal-footer text-right">
|
109 |
steven |
1970 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
16864 |
efrain |
1971 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close">LABEL_CLOSE</button>
|
82 |
steven |
1972 |
</div>
|
|
|
1973 |
</div>
|
|
|
1974 |
</form>
|
|
|
1975 |
</div>
|
|
|
1976 |
</div>
|
|
|
1977 |
<!-- End Modal Question -->
|
83 |
steven |
1978 |
<!-- MOdal Options -->
|
|
|
1979 |
<div id="modal-option" class="modal" tabindex="-1" role="dialog">
|
|
|
1980 |
<div class="modal-dialog" role="document">
|
|
|
1981 |
<form action="#" name="form-option" id="form-option">
|
|
|
1982 |
<input type="hidden" name="option-section" id="option-section" value="" />
|
|
|
1983 |
<input type="hidden" name="option-question" id="option-question" value="" />
|
|
|
1984 |
<input type="hidden" name="option-slug" id="option-slug" value="" />
|
|
|
1985 |
<div class="modal-content">
|
|
|
1986 |
<div class="modal-header">
|
16845 |
efrain |
1987 |
<h6 class="modal-title">LABEL_OPTION</h6>
|
16864 |
efrain |
1988 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
|
110 |
steven |
1989 |
<span aria-hidden="true">×</span>
|
83 |
steven |
1990 |
</button>
|
|
|
1991 |
</div>
|
|
|
1992 |
<div class="modal-body">
|
|
|
1993 |
<div class="form-group">
|
110 |
steven |
1994 |
<label for="option-text">LABEL_TEXT</label>
|
83 |
steven |
1995 |
<!-- ckeditor -->
|
|
|
1996 |
<textarea name="option-text" id="option-text" rows="5" class="ckeditor form-control"></textarea>
|
|
|
1997 |
</div>
|
|
|
1998 |
<div class="form-group">
|
110 |
steven |
1999 |
<label for="option-correct">LABEL_ANSWER_CORRECT</label>
|
83 |
steven |
2000 |
<select name="option-correct" id="option-correct" class="form-control">
|
110 |
steven |
2001 |
<option value="1">LABEL_YES</option>
|
83 |
steven |
2002 |
<option value="0">No</option>
|
|
|
2003 |
</select>
|
|
|
2004 |
</div>
|
|
|
2005 |
<div class="form-group">
|
110 |
steven |
2006 |
<label for="option-value">LABEL_VALUE</label>
|
|
|
2007 |
<input type="text" name="option-value" id="option-value" class="form-control" />
|
83 |
steven |
2008 |
</div>
|
|
|
2009 |
</div>
|
16891 |
efrain |
2010 |
<div class="modal-footer text-right">
|
110 |
steven |
2011 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
16864 |
efrain |
2012 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close">LABEL_CLOSE</button>
|
83 |
steven |
2013 |
</div>
|
|
|
2014 |
</div>
|
|
|
2015 |
</form>
|
|
|
2016 |
</div>
|
|
|
2017 |
</div>
|
|
|
2018 |
<!-- End Modal Options -->
|
82 |
steven |
2019 |
<!-- End Modals -->
|
66 |
efrain |
2020 |
</div>
|
|
|
2021 |
</div>
|
|
|
2022 |
</div>
|
|
|
2023 |
</section>
|