Línea 147... |
Línea 147... |
147 |
$('[data-toggle="tooltip"]').tooltip();
|
147 |
$('[data-toggle="tooltip"]').tooltip();
|
148 |
},
|
148 |
},
|
149 |
/**
|
149 |
/**
|
150 |
* Add element to section array
|
150 |
* Add element to section array
|
151 |
*/
|
151 |
*/
|
152 |
this.addSection = function(name, text) {
|
152 |
this.addSection = function(name, text, value) {
|
153 |
var d = new Date();
|
153 |
var d = new Date();
|
154 |
var slug = 'section' + d.getTime();
|
154 |
var slug = 'section' + d.getTime();
|
155 |
var position = 0;
|
155 |
var position = 0;
|
156 |
$.each(this.sections, function(index, section) {
|
156 |
$.each(this.sections, function(index, section) {
|
157 |
if (position < section.position) {
|
157 |
if (position < section.position) {
|
Línea 161... |
Línea 161... |
161 |
position++;
|
161 |
position++;
|
162 |
var section = {
|
162 |
var section = {
|
163 |
'slug_section': slug,
|
163 |
'slug_section': slug,
|
164 |
'name': name,
|
164 |
'name': name,
|
165 |
'text': text,
|
165 |
'text': text,
|
166 |
//'value': value,
|
166 |
'value': value,
|
167 |
'position': position,
|
167 |
'position': position,
|
168 |
'questions': [],
|
168 |
'questions': [],
|
169 |
'status': 0
|
169 |
'status': 0
|
170 |
}
|
170 |
}
|
171 |
this.sections.push(section);
|
171 |
this.sections.push(section);
|
172 |
},
|
172 |
},
|
173 |
/**
|
173 |
/**
|
174 |
* Edit element to section array
|
174 |
* Edit element to section array
|
175 |
*/
|
175 |
*/
|
176 |
this.editSection = function(slug, name, text) {
|
176 |
this.editSection = function(slug, name, text, value) {
|
177 |
var renderTable = false;
|
177 |
var renderTable = false;
|
178 |
for (i = 0; i < this.sections.length; i++) {
|
178 |
for (i = 0; i < this.sections.length; i++) {
|
179 |
if (slug == this.sections[i].slug_section) {
|
179 |
if (slug == this.sections[i].slug_section) {
|
180 |
this.sections[i].name = name;
|
180 |
this.sections[i].name = name;
|
181 |
this.sections[i].text = text;
|
181 |
this.sections[i].text = text;
|
182 |
// this.sections[i].value = value;
|
182 |
this.sections[i].value = value;
|
183 |
renderTable = true;
|
183 |
renderTable = true;
|
184 |
break;
|
184 |
break;
|
185 |
}
|
185 |
}
|
186 |
}
|
186 |
}
|
187 |
if (renderTable) {
|
187 |
if (renderTable) {
|
Línea 205... |
Línea 205... |
205 |
}
|
205 |
}
|
206 |
},
|
206 |
},
|
207 |
/**
|
207 |
/**
|
208 |
* Add element to question array
|
208 |
* Add element to question array
|
209 |
*/
|
209 |
*/
|
210 |
this.addQuestion = function(slug_section, text, type, maxlength, multiline, range) {
|
210 |
this.addQuestion = function(slug_section, text, value, type, maxlength, multiline, range) {
|
211 |
var d = new Date();
|
211 |
var d = new Date();
|
212 |
var slug_question = 'question' + d.getTime();
|
212 |
var slug_question = 'question' + d.getTime();
|
213 |
var position = 0;
|
213 |
var position = 0;
|
214 |
var renderTable = false;
|
214 |
var renderTable = false;
|
215 |
for (i = 0; i < this.sections.length; i++) {
|
215 |
for (i = 0; i < this.sections.length; i++) {
|
Línea 222... |
Línea 222... |
222 |
position++;
|
222 |
position++;
|
223 |
var question = {
|
223 |
var question = {
|
224 |
'slug_section': slug_section,
|
224 |
'slug_section': slug_section,
|
225 |
'slug_question': slug_question,
|
225 |
'slug_question': slug_question,
|
226 |
'text': text,
|
226 |
'text': text,
|
227 |
// 'value': value,
|
227 |
'value': value,
|
228 |
'type': type,
|
228 |
'type': type,
|
229 |
'position': position,
|
229 |
'position': position,
|
230 |
'maxlength': maxlength,
|
230 |
'maxlength': maxlength,
|
231 |
'multiline': multiline,
|
231 |
'multiline': multiline,
|
232 |
'range': range,
|
232 |
'range': range,
|
Línea 243... |
Línea 243... |
243 |
}
|
243 |
}
|
244 |
},
|
244 |
},
|
245 |
/**
|
245 |
/**
|
246 |
* Add element to question array
|
246 |
* Add element to question array
|
247 |
*/
|
247 |
*/
|
248 |
this.editQuestion = function(slug_section, slug_question, text, type, maxlength, multiline, range) {
|
248 |
this.editQuestion = function(slug_section, slug_question, text, value, type, maxlength, multiline, range) {
|
249 |
var renderTable = false;
|
249 |
var renderTable = false;
|
250 |
for (i = 0; i < this.sections.length; i++) {
|
250 |
for (i = 0; i < this.sections.length; i++) {
|
251 |
if (slug_section == this.sections[i].slug_section) {
|
251 |
if (slug_section == this.sections[i].slug_section) {
|
252 |
for (j = 0; j < this.sections[i].questions.length; j++) {
|
252 |
for (j = 0; j < this.sections[i].questions.length; j++) {
|
253 |
if (slug_question == this.sections[i].questions[j].slug_question) {
|
253 |
if (slug_question == this.sections[i].questions[j].slug_question) {
|
254 |
this.sections[i].questions[j].text = text,
|
254 |
this.sections[i].questions[j].text = text,
|
255 |
// this.sections[i].questions[j].value = value,
|
255 |
this.sections[i].questions[j].value = value,
|
256 |
this.sections[i].questions[j].type = type;
|
256 |
this.sections[i].questions[j].type = type;
|
257 |
if (type == 'open') {
|
257 |
if (type == 'open') {
|
258 |
this.sections[i].questions[j].maxlength = maxlength;
|
258 |
this.sections[i].questions[j].maxlength = maxlength;
|
259 |
this.sections[i].questions[j].multiline = multiline;
|
259 |
this.sections[i].questions[j].multiline = multiline;
|
260 |
this.sections[i].questions[j].options = [];
|
260 |
this.sections[i].questions[j].options = [];
|
Línea 311... |
Línea 311... |
311 |
}
|
311 |
}
|
312 |
},
|
312 |
},
|
313 |
/**
|
313 |
/**
|
314 |
* Add element to option array
|
314 |
* Add element to option array
|
315 |
*/
|
315 |
*/
|
316 |
this.addOption = function(slug_section, slug_question, text, correct) {
|
316 |
this.addOption = function(slug_section, slug_question, text, correct, value) {
|
317 |
var d = new Date();
|
317 |
var d = new Date();
|
318 |
var slug_option = 'option' + d.getTime();
|
318 |
var slug_option = 'option' + d.getTime();
|
319 |
var position = 0;
|
319 |
var position = 0;
|
320 |
var renderTable = false;
|
320 |
var renderTable = false;
|
321 |
for (i = 0; i < this.sections.length; i++) {
|
321 |
for (i = 0; i < this.sections.length; i++) {
|
Línea 332... |
Línea 332... |
332 |
'slug_section': slug_section,
|
332 |
'slug_section': slug_section,
|
333 |
'slug_question': slug_question,
|
333 |
'slug_question': slug_question,
|
334 |
'slug_option': slug_option,
|
334 |
'slug_option': slug_option,
|
335 |
'text': text,
|
335 |
'text': text,
|
336 |
'correct': correct,
|
336 |
'correct': correct,
|
337 |
// 'value': value,
|
337 |
'value': value,
|
338 |
'checked': false
|
338 |
'checked': false
|
339 |
}
|
339 |
}
|
340 |
this.sections[i].questions[j].options.push(option);
|
340 |
this.sections[i].questions[j].options.push(option);
|
341 |
renderTable = true;
|
341 |
renderTable = true;
|
342 |
break;
|
342 |
break;
|
Línea 352... |
Línea 352... |
352 |
}
|
352 |
}
|
353 |
},
|
353 |
},
|
354 |
/**
|
354 |
/**
|
355 |
* Edit element to option array
|
355 |
* Edit element to option array
|
356 |
*/
|
356 |
*/
|
357 |
this.editOption = function(slug_section, slug_question, option_slug, text, correct) {
|
357 |
this.editOption = function(slug_section, slug_question, option_slug, text, correct, value) {
|
358 |
var renderTable = false;
|
358 |
var renderTable = false;
|
359 |
for (i = 0; i < this.sections.length; i++) {
|
359 |
for (i = 0; i < this.sections.length; i++) {
|
360 |
if (slug_section == this.sections[i].slug_section) {
|
360 |
if (slug_section == this.sections[i].slug_section) {
|
361 |
for (j = 0; j < this.sections[i].questions.length; j++) {
|
361 |
for (j = 0; j < this.sections[i].questions.length; j++) {
|
362 |
if (slug_question == this.sections[i].questions[j].slug_question) {
|
362 |
if (slug_question == this.sections[i].questions[j].slug_question) {
|
363 |
for (k = 0; k < this.sections[i].questions[j].options.length; k++) {
|
363 |
for (k = 0; k < this.sections[i].questions[j].options.length; k++) {
|
364 |
if (option_slug == this.sections[i].questions[j].options[k].slug_option) {
|
364 |
if (option_slug == this.sections[i].questions[j].options[k].slug_option) {
|
365 |
this.sections[i].questions[j].options[k].text = text;
|
365 |
this.sections[i].questions[j].options[k].text = text;
|
366 |
this.sections[i].questions[j].options[k].correct = correct;
|
366 |
this.sections[i].questions[j].options[k].correct = correct;
|
367 |
// this.sections[i].questions[j].options[k].value = value;
|
367 |
this.sections[i].questions[j].options[k].value = value;
|
368 |
renderTable = true;
|
368 |
renderTable = true;
|
369 |
break;
|
369 |
break;
|
370 |
}
|
370 |
}
|
371 |
}
|
371 |
}
|
372 |
}
|
372 |
}
|
Línea 708... |
Línea 708... |
708 |
for (i = 0; i < objFormGenerator.sections.length; i++) {
|
708 |
for (i = 0; i < objFormGenerator.sections.length; i++) {
|
709 |
if (objFormGenerator.sections[i].questions.length == 0) {
|
709 |
if (objFormGenerator.sections[i].questions.length == 0) {
|
710 |
$.fn.showError('ERROR_QUESTIONS'.replace('%s', objFormGenerator.sections[i].name));
|
710 |
$.fn.showError('ERROR_QUESTIONS'.replace('%s', objFormGenerator.sections[i].name));
|
711 |
return false;
|
711 |
return false;
|
712 |
}
|
712 |
}
|
713 |
// var valueSection = parseInt(objFormGenerator.sections[i].value);
|
713 |
var valueSection = parseInt(objFormGenerator.sections[i].value);
|
714 |
// var totalValueQuestion = 0;
|
714 |
var totalValueQuestion = 0;
|
715 |
for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
|
715 |
for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
|
716 |
// valueQuestion = parseInt(objFormGenerator.sections[i].questions[j].value);
|
716 |
valueQuestion = parseInt(objFormGenerator.sections[i].questions[j].value);
|
717 |
// totalValueQuestion = totalValueQuestion + valueQuestion;
|
717 |
totalValueQuestion = totalValueQuestion + valueQuestion;
|
718 |
if (objFormGenerator.sections[i].questions[j].type == 'simple' ||
|
718 |
if (objFormGenerator.sections[i].questions[j].type == 'simple' ||
|
719 |
objFormGenerator.sections[i].questions[j].type == 'multiple' ||
|
719 |
objFormGenerator.sections[i].questions[j].type == 'multiple' ||
|
720 |
objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
720 |
objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
721 |
var questionNumber = j + 1;
|
721 |
var questionNumber = j + 1;
|
722 |
var numberCorrect = 0;
|
722 |
var numberCorrect = 0;
|
Línea 754... |
Línea 754... |
754 |
if (objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
|
754 |
if (objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
|
755 |
$.fn.showError('ERROR_OPTIONS_ONE_CORRECT'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
|
755 |
$.fn.showError('ERROR_OPTIONS_ONE_CORRECT'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
|
756 |
return false;
|
756 |
return false;
|
757 |
}
|
757 |
}
|
758 |
}
|
758 |
}
|
759 |
// if (objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption != valueQuestion) {
|
759 |
if (objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption != valueQuestion) {
|
760 |
// $.fn.showError('ERROR_OPTIONS_SUM_VALUES'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
|
760 |
$.fn.showError('ERROR_OPTIONS_SUM_VALUES'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
|
761 |
// return false;
|
761 |
return false;
|
762 |
// }
|
762 |
}
|
763 |
// if (objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion) {
|
763 |
if (objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion) {
|
764 |
// $.fn.showError('ERROR_OPTIONS_MAX_OPTION'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
|
764 |
$.fn.showError('ERROR_OPTIONS_MAX_OPTION'.replace('%s', objFormGenerator.sections[i].name).replace('%n', questionNumber));
|
765 |
// return false;
|
765 |
return false;
|
766 |
// }
|
766 |
}
|
767 |
}
|
767 |
}
|
768 |
}
|
768 |
}
|
769 |
/*if (valueSection != totalValueQuestion) {
|
769 |
if (valueSection != totalValueQuestion) {
|
770 |
$.fn.showError('ERROR_VALUE_SECTIONS'.replace('%s', objFormGenerator.sections[i].name));
|
770 |
$.fn.showError('ERROR_VALUE_SECTIONS'.replace('%s', objFormGenerator.sections[i].name));
|
771 |
return false;
|
771 |
return false;
|
772 |
}*/
|
772 |
}
|
773 |
}
|
773 |
}
|
774 |
var formId = parseInt($('#form-main #form-id').val());
|
774 |
var formId = parseInt($('#form-main #form-id').val());
|
775 |
var formContinue = parseInt($('#form-main #form-continue').val());
|
775 |
var formContinue = parseInt($('#form-main #form-continue').val());
|
776 |
var data = {
|
776 |
var data = {
|
777 |
'id': formId,
|
777 |
'id': formId,
|
Línea 838... |
Línea 838... |
838 |
},
|
838 |
},
|
839 |
'section-text': {
|
839 |
'section-text': {
|
840 |
required: false,
|
840 |
required: false,
|
841 |
},
|
841 |
},
|
842 |
'section-value': {
|
842 |
'section-value': {
|
843 |
required: false,
|
843 |
required: true,
|
844 |
number: true,
|
844 |
number: true,
|
845 |
|
- |
|
- |
|
845 |
min: 1
|
846 |
},
|
846 |
},
|
847 |
},
|
847 |
},
|
848 |
highlight: function(element) {
|
848 |
highlight: function(element) {
|
849 |
$(element).closest('.form-group').addClass('has-error');
|
849 |
$(element).closest('.form-group').addClass('has-error');
|
850 |
},
|
850 |
},
|
Línea 872... |
Línea 872... |
872 |
if (slug) {
|
872 |
if (slug) {
|
873 |
objFormGenerator.editSection(
|
873 |
objFormGenerator.editSection(
|
874 |
$('#form-section #section-slug').val(),
|
874 |
$('#form-section #section-slug').val(),
|
875 |
$('#form-section #section-name').val(),
|
875 |
$('#form-section #section-name').val(),
|
876 |
$('#form-section #section-text').val(),
|
876 |
$('#form-section #section-text').val(),
|
877 |
// $('#form-section #section-value').val()
|
877 |
$('#form-section #section-value').val()
|
878 |
);
|
878 |
);
|
879 |
} else {
|
879 |
} else {
|
880 |
objFormGenerator.addSection(
|
880 |
objFormGenerator.addSection(
|
881 |
$('#form-section #section-name').val(),
|
881 |
$('#form-section #section-name').val(),
|
882 |
$('#form-section #section-text').val(),
|
882 |
$('#form-section #section-text').val(),
|
883 |
// $('#form-section #section-value').val()
|
883 |
$('#form-section #section-value').val()
|
884 |
);
|
884 |
);
|
885 |
}
|
885 |
}
|
886 |
renderSectionData(objFormGenerator.sections);
|
886 |
renderSectionData(objFormGenerator.sections);
|
887 |
$('#modal-section').modal('hide');
|
887 |
$('#modal-section').modal('hide');
|
888 |
return false;
|
888 |
return false;
|
Línea 904... |
Línea 904... |
904 |
rules: {
|
904 |
rules: {
|
905 |
'question-text': {
|
905 |
'question-text': {
|
906 |
required: true,
|
906 |
required: true,
|
907 |
},
|
907 |
},
|
908 |
'question-value': {
|
908 |
'question-value': {
|
909 |
required: false,
|
909 |
required: true,
|
910 |
number: true,
|
910 |
number: true,
|
911 |
min: 1
|
911 |
min: 1
|
912 |
},
|
912 |
},
|
913 |
'question-type': {
|
913 |
'question-type': {
|
914 |
required: true,
|
914 |
required: true,
|
Línea 948... |
Línea 948... |
948 |
if ($('#form-question #question-slug').val()) {
|
948 |
if ($('#form-question #question-slug').val()) {
|
949 |
objFormGenerator.editQuestion(
|
949 |
objFormGenerator.editQuestion(
|
950 |
$('#form-question #question-section').val(),
|
950 |
$('#form-question #question-section').val(),
|
951 |
$('#form-question #question-slug').val(),
|
951 |
$('#form-question #question-slug').val(),
|
952 |
$('#form-question #question-text').val(),
|
952 |
$('#form-question #question-text').val(),
|
953 |
// $('#form-question #question-value').val(),
|
953 |
$('#form-question #question-value').val(),
|
954 |
$('#form-question #question-type').val(),
|
954 |
$('#form-question #question-type').val(),
|
955 |
$('#form-question #question-max-length').val(),
|
955 |
$('#form-question #question-max-length').val(),
|
956 |
$('#form-question #question-multiline').val(),
|
956 |
$('#form-question #question-multiline').val(),
|
957 |
$('#form-question #question-range').val()
|
957 |
$('#form-question #question-range').val()
|
958 |
);
|
958 |
);
|
959 |
} else {
|
959 |
} else {
|
960 |
objFormGenerator.addQuestion(
|
960 |
objFormGenerator.addQuestion(
|
961 |
$('#form-question #question-section').val(),
|
961 |
$('#form-question #question-section').val(),
|
962 |
$('#form-question #question-text').val(),
|
962 |
$('#form-question #question-text').val(),
|
963 |
// $('#form-question #question-value').val(),
|
963 |
$('#form-question #question-value').val(),
|
964 |
$('#form-question #question-type').val(),
|
964 |
$('#form-question #question-type').val(),
|
965 |
$('#form-question #question-max-length').val(),
|
965 |
$('#form-question #question-max-length').val(),
|
966 |
$('#form-question #question-multiline').val(),
|
966 |
$('#form-question #question-multiline').val(),
|
967 |
$('#form-question #question-range').val()
|
967 |
$('#form-question #question-range').val()
|
968 |
);
|
968 |
);
|
Línea 988... |
Línea 988... |
988 |
rules: {
|
988 |
rules: {
|
989 |
'option-text': {
|
989 |
'option-text': {
|
990 |
required: true,
|
990 |
required: true,
|
991 |
},
|
991 |
},
|
992 |
'option-value': {
|
992 |
'option-value': {
|
993 |
required: false,
|
993 |
required: true,
|
994 |
number: true,
|
994 |
number: true,
|
995 |
min: 1
|
995 |
min: 1
|
996 |
}
|
996 |
}
|
997 |
},
|
997 |
},
|
998 |
highlight: function(element) {
|
998 |
highlight: function(element) {
|
Línea 1021... |
Línea 1021... |
1021 |
$('#form-option #option-section').val(),
|
1021 |
$('#form-option #option-section').val(),
|
1022 |
$('#form-option #option-question').val(),
|
1022 |
$('#form-option #option-question').val(),
|
1023 |
$('#form-option #option-slug').val(),
|
1023 |
$('#form-option #option-slug').val(),
|
1024 |
$('#form-option #option-text').val(),
|
1024 |
$('#form-option #option-text').val(),
|
1025 |
$('#form-option #option-correct').val(),
|
1025 |
$('#form-option #option-correct').val(),
|
1026 |
// $('#form-option #option-value').val()
|
1026 |
$('#form-option #option-value').val()
|
1027 |
);
|
1027 |
);
|
1028 |
} else {
|
1028 |
} else {
|
1029 |
objFormGenerator.addOption(
|
1029 |
objFormGenerator.addOption(
|
1030 |
$('#form-option #option-section').val(),
|
1030 |
$('#form-option #option-section').val(),
|
1031 |
$('#form-option #option-question').val(),
|
1031 |
$('#form-option #option-question').val(),
|
1032 |
$('#form-option #option-text').val(),
|
1032 |
$('#form-option #option-text').val(),
|
1033 |
$('#form-option #option-correct').val(),
|
1033 |
$('#form-option #option-correct').val(),
|
1034 |
// $('#form-option #option-value').val()
|
1034 |
$('#form-option #option-value').val()
|
1035 |
);
|
1035 |
);
|
1036 |
}
|
1036 |
}
|
1037 |
renderSectionData(objFormGenerator.sections);
|
1037 |
renderSectionData(objFormGenerator.sections);
|
1038 |
$('#modal-option').modal('hide');
|
1038 |
$('#modal-option').modal('hide');
|
1039 |
return false;
|
1039 |
return false;
|
Línea 1046... |
Línea 1046... |
1046 |
e.preventDefault();
|
1046 |
e.preventDefault();
|
1047 |
validatorFormSection.resetForm();
|
1047 |
validatorFormSection.resetForm();
|
1048 |
$('#form-section #section-slug').val('');
|
1048 |
$('#form-section #section-slug').val('');
|
1049 |
$('#form-section #section-name').val('');
|
1049 |
$('#form-section #section-name').val('');
|
1050 |
CKEDITOR.instances['section-text'].setData('');
|
1050 |
CKEDITOR.instances['section-text'].setData('');
|
1051 |
// $('#form-section #section-value').val('0');
|
1051 |
$('#form-section #section-value').val('0');
|
1052 |
$('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
|
1052 |
$('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
|
1053 |
$('#modal-section').modal('show');
|
1053 |
$('#modal-section').modal('show');
|
1054 |
});
|
1054 |
});
|
1055 |
/**
|
1055 |
/**
|
1056 |
* Clicked on edit section
|
1056 |
* Clicked on edit section
|
Línea 1065... |
Línea 1065... |
1065 |
if (slug == section.slug_section) {
|
1065 |
if (slug == section.slug_section) {
|
1066 |
validatorFormSection.resetForm();
|
1066 |
validatorFormSection.resetForm();
|
1067 |
$('#form-section #section-slug').val(section.slug_section);
|
1067 |
$('#form-section #section-slug').val(section.slug_section);
|
1068 |
$('#form-section #section-name').val(section.name);
|
1068 |
$('#form-section #section-name').val(section.name);
|
1069 |
CKEDITOR.instances['section-text'].setData(section.text);
|
1069 |
CKEDITOR.instances['section-text'].setData(section.text);
|
1070 |
// $('#form-section #section-value').val(section.value);
|
1070 |
$('#form-section #section-value').val(section.value);
|
1071 |
showForm = true;
|
1071 |
showForm = true;
|
1072 |
break;
|
1072 |
break;
|
1073 |
}
|
1073 |
}
|
1074 |
}
|
1074 |
}
|
1075 |
if (showForm) {
|
1075 |
if (showForm) {
|
Línea 1110... |
Línea 1110... |
1110 |
validatorFormQuestion.resetForm();
|
1110 |
validatorFormQuestion.resetForm();
|
1111 |
var slug = $(this).data('section');
|
1111 |
var slug = $(this).data('section');
|
1112 |
$('#form-question #question-section').val(slug);
|
1112 |
$('#form-question #question-section').val(slug);
|
1113 |
$('#form-question #question-slug').val('');
|
1113 |
$('#form-question #question-slug').val('');
|
1114 |
CKEDITOR.instances['question-text'].setData('');
|
1114 |
CKEDITOR.instances['question-text'].setData('');
|
1115 |
// $('#form-question #question-value').val('0');
|
1115 |
$('#form-question #question-value').val('0');
|
1116 |
$('#form-question #question-type').val($('#form-question #question-type option:first').val());
|
1116 |
$('#form-question #question-type').val($('#form-question #question-type option:first').val());
|
1117 |
$('#form-question #question-max-length').val('0');
|
1117 |
$('#form-question #question-max-length').val('0');
|
1118 |
$('#form-question #question-max-length').parent().show();
|
1118 |
$('#form-question #question-max-length').parent().show();
|
1119 |
$('#form-question #question-multiline').val('0');
|
1119 |
$('#form-question #question-multiline').val('0');
|
1120 |
$('#form-question #question-multiline').parent().show();
|
1120 |
$('#form-question #question-multiline').parent().show();
|
Línea 1137... |
Línea 1137... |
1137 |
if (slug == objFormGenerator.sections[i].questions[j].slug_question) {
|
1137 |
if (slug == objFormGenerator.sections[i].questions[j].slug_question) {
|
1138 |
validatorFormQuestion.resetForm();
|
1138 |
validatorFormQuestion.resetForm();
|
1139 |
$('#form-question #question-section').val(objFormGenerator.sections[i].slug_section);
|
1139 |
$('#form-question #question-section').val(objFormGenerator.sections[i].slug_section);
|
1140 |
$('#form-question #question-slug').val(objFormGenerator.sections[i].questions[j].slug_question);
|
1140 |
$('#form-question #question-slug').val(objFormGenerator.sections[i].questions[j].slug_question);
|
1141 |
CKEDITOR.instances['question-text'].setData(objFormGenerator.sections[i].questions[j].text);
|
1141 |
CKEDITOR.instances['question-text'].setData(objFormGenerator.sections[i].questions[j].text);
|
1142 |
// $('#form-question #question-value').val(objFormGenerator.sections[i].questions[j].value);
|
1142 |
$('#form-question #question-value').val(objFormGenerator.sections[i].questions[j].value);
|
1143 |
$('#form-question #question-type').val(objFormGenerator.sections[i].questions[j].type);
|
1143 |
$('#form-question #question-type').val(objFormGenerator.sections[i].questions[j].type);
|
1144 |
if (objFormGenerator.sections[i].questions[j].type == 'open') {
|
1144 |
if (objFormGenerator.sections[i].questions[j].type == 'open') {
|
1145 |
$('#form-question #question-max-length').val(objFormGenerator.sections[i].questions[j].maxlength);
|
1145 |
$('#form-question #question-max-length').val(objFormGenerator.sections[i].questions[j].maxlength);
|
1146 |
$('#form-question #question-max-length').parent().show();
|
1146 |
$('#form-question #question-max-length').parent().show();
|
1147 |
$('#form-question #question-multiline').val(objFormGenerator.sections[i].questions[j].multiline);
|
1147 |
$('#form-question #question-multiline').val(objFormGenerator.sections[i].questions[j].multiline);
|
Línea 1220... |
Línea 1220... |
1220 |
if (objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
1220 |
if (objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
1221 |
$('#form-option #option-correct').parent().hide();
|
1221 |
$('#form-option #option-correct').parent().hide();
|
1222 |
} else {
|
1222 |
} else {
|
1223 |
$('#form-option #option-correct').parent().show();
|
1223 |
$('#form-option #option-correct').parent().show();
|
1224 |
}
|
1224 |
}
|
1225 |
/* if (objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
1225 |
if (objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
1226 |
$('#form-option #option-value').val('0');
|
1226 |
$('#form-option #option-value').val('0');
|
1227 |
$('#form-option #option-value').parent().show();
|
1227 |
$('#form-option #option-value').parent().show();
|
1228 |
} else {
|
1228 |
} else {
|
1229 |
$('#form-option #option-value').val('1');
|
1229 |
$('#form-option #option-value').val('1');
|
1230 |
$('#form-option #option-value').parent().hide();
|
1230 |
$('#form-option #option-value').parent().hide();
|
1231 |
}*/
|
1231 |
}
|
1232 |
renderSectionData(objFormGenerator.sections);
|
1232 |
renderSectionData(objFormGenerator.sections);
|
1233 |
$('#modal-option h4[class="modal-title"]').html('LABEL_ADD LABEL_OPTION');
|
1233 |
$('#modal-option h4[class="modal-title"]').html('LABEL_ADD LABEL_OPTION');
|
1234 |
$('#modal-option').modal('show');
|
1234 |
$('#modal-option').modal('show');
|
1235 |
return true;
|
1235 |
return true;
|
1236 |
}
|
1236 |
}
|
Línea 1265... |
Línea 1265... |
1265 |
if (objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'simple') {
|
1265 |
if (objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'simple') {
|
1266 |
$('#form-option #option-correct').parent().show();
|
1266 |
$('#form-option #option-correct').parent().show();
|
1267 |
} else {
|
1267 |
} else {
|
1268 |
$('#form-option #option-correct').parent().hide();
|
1268 |
$('#form-option #option-correct').parent().hide();
|
1269 |
}
|
1269 |
}
|
1270 |
/* $('#form-option #option-value').val(objFormGenerator.sections[i].questions[j].options[k].value);
|
1270 |
$('#form-option #option-value').val(objFormGenerator.sections[i].questions[j].options[k].value);
|
1271 |
if (objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
1271 |
if (objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
|
1272 |
$('#form-option #option-value').parent().show();
|
1272 |
$('#form-option #option-value').parent().show();
|
1273 |
} else {
|
1273 |
} else {
|
1274 |
$('#form-option #option-value').parent().hide();
|
1274 |
$('#form-option #option-value').parent().hide();
|
1275 |
}*/
|
1275 |
}
|
1276 |
showForm = true;
|
1276 |
showForm = true;
|
1277 |
break;
|
1277 |
break;
|
1278 |
}
|
1278 |
}
|
1279 |
}
|
1279 |
}
|
1280 |
}
|
1280 |
}
|
Línea 1572... |
Línea 1572... |
1572 |
<label for="section-text">LABEL_TEXT</label>
|
1572 |
<label for="section-text">LABEL_TEXT</label>
|
1573 |
<!-- ckeditor -->
|
1573 |
<!-- ckeditor -->
|
1574 |
<textarea name="section-text" id="section-text" rows="5" class="ckeditor form-control"></textarea>
|
1574 |
<textarea name="section-text" id="section-text" rows="5" class="ckeditor form-control"></textarea>
|
1575 |
</div>
|
1575 |
</div>
|
1576 |
<div class="form-group">
|
1576 |
<div class="form-group">
|
1577 |
<label for="section-value" style="display:none;">LABEL_VALUE</label>
|
1577 |
<label for="section-value">LABEL_VALUE</label>
|
1578 |
<input type="text" style="display:none;" name="section-value" id="section-value" class="form-control" value="0" />
|
1578 |
<input type="text" name="section-value" id="section-value" class="form-control" value="0" />
|
1579 |
</div>
|
1579 |
</div>
|
1580 |
</div>
|
1580 |
</div>
|
1581 |
<div class="modal-footer">
|
1581 |
<div class="modal-footer">
|
1582 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
1582 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
1583 |
<button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
|
1583 |
<button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
|
Línea 1607... |
Línea 1607... |
1607 |
<label for="question-text">LABEL_TEXT</label>
|
1607 |
<label for="question-text">LABEL_TEXT</label>
|
1608 |
<!-- ckeditor -->
|
1608 |
<!-- ckeditor -->
|
1609 |
<textarea name="question-text" id="question-text" rows="5" class="ckeditor form-control"></textarea>
|
1609 |
<textarea name="question-text" id="question-text" rows="5" class="ckeditor form-control"></textarea>
|
1610 |
</div>
|
1610 |
</div>
|
1611 |
<div class="form-group">
|
1611 |
<div class="form-group">
|
1612 |
<label for="question-value" style="display:none;">LABEL_VALUE</label>
|
1612 |
<label for="question-value">LABEL_VALUE</label>
|
1613 |
<input type="text" style="display:none;" name="question-value" id="question-value" class="form-control" />
|
1613 |
<input type="text" name="question-value" id="question-value" class="form-control" />
|
1614 |
</div>
|
1614 |
</div>
|
1615 |
<div class="form-group">
|
1615 |
<div class="form-group">
|
1616 |
<label for="question-type">LABEL_TYPE</label>
|
1616 |
<label for="question-type">LABEL_TYPE</label>
|
1617 |
<select name="question-type" id="question-type" class="form-control">
|
1617 |
<select name="question-type" id="question-type" class="form-control">
|
1618 |
<option value="open">LABEL_OPEN</option>
|
1618 |
<option value="open">LABEL_OPEN</option>
|
Línea 1715... |
Línea 1715... |
1715 |
<table class="table table-bordered">
|
1715 |
<table class="table table-bordered">
|
1716 |
<thead>
|
1716 |
<thead>
|
1717 |
<tr>
|
1717 |
<tr>
|
1718 |
<th style="width: 10%;">LABEL_ELEMENT</th>
|
1718 |
<th style="width: 10%;">LABEL_ELEMENT</th>
|
1719 |
<th style="width: 50%;">LABEL_TEXT</th>
|
1719 |
<th style="width: 50%;">LABEL_TEXT</th>
|
- |
|
1720 |
<th style="width: 10%;">LABEL_VALUE</th>
|
1720 |
<th style="width: 10%;">LABEL_TYPE</th>
|
1721 |
<th style="width: 10%;">LABEL_TYPE</th>
|
1721 |
<th style="width: 20%;">LABEL_ACTIONS</th>
|
1722 |
<th style="width: 20%;">LABEL_ACTIONS</th>
|
1722 |
</tr>
|
1723 |
</tr>
|
1723 |
</thead>
|
1724 |
</thead>
|
1724 |
<tbody>
|
1725 |
<tbody>
|
1725 |
<tr class="tr-section">
|
1726 |
<tr class="tr-section">
|
1726 |
<td class="text-left">LABEL_SECTION</td>
|
1727 |
<td class="text-left">LABEL_SECTION</td>
|
1727 |
<td class="text-left">{{:name}}</td>
|
1728 |
<td class="text-left">{{:name}}</td>
|
- |
|
1729 |
<td>{{:value}}</td>
|
1728 |
<td></td>
|
1730 |
<td></td>
|
1729 |
<td>
|
1731 |
<td>
|
1730 |
<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>
|
1732 |
<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>
|
1731 |
<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>
|
1733 |
<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>
|
1732 |
<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>
|
1734 |
<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>
|
Línea 1736... |
Línea 1738... |
1736 |
<tr class="tr-question">
|
1738 |
<tr class="tr-question">
|
1737 |
<td class="text-left">--LABEL_QUESTION</td>
|
1739 |
<td class="text-left">--LABEL_QUESTION</td>
|
1738 |
<td class="text-left">
|
1740 |
<td class="text-left">
|
1739 |
{{:~removeTags(text)}}
|
1741 |
{{:~removeTags(text)}}
|
1740 |
</td>
|
1742 |
</td>
|
- |
|
1743 |
<td><font color="red">{{:value}}</font></td>
|
1741 |
<td class="text-capitalize">
|
1744 |
<td class="text-capitalize">
|
1742 |
{{if type == 'open'}} LABEL_OPEN {{/if}}
|
1745 |
{{if type == 'open'}} LABEL_OPEN {{/if}}
|
1743 |
{{if type == 'simple'}} Simple {{/if}}
|
1746 |
{{if type == 'simple'}} Simple {{/if}}
|
1744 |
{{if type == 'multiple'}} Multiple {{/if}}
|
1747 |
{{if type == 'multiple'}} Multiple {{/if}}
|
1745 |
{{if type == 'rating-open'}} LABEL_RATING_OPEN {{/if}}
|
1748 |
{{if type == 'rating-open'}} LABEL_RATING_OPEN {{/if}}
|
Línea 1762... |
Línea 1765... |
1762 |
{{:~removeTags(text)}}
|
1765 |
{{:~removeTags(text)}}
|
1763 |
</td>
|
1766 |
</td>
|
1764 |
<td>
|
1767 |
<td>
|
Línea 1765... |
Línea 1768... |
1765 |
|
1768 |
|
- |
|
1769 |
{{if ~getType( slug_section, slug_question) == 'multiple' || ~getType( slug_section, slug_question) == 'rating-open' }}
|
1766 |
{{if ~getType( slug_section, slug_question) == 'multiple' || ~getType( slug_section, slug_question) == 'rating-open' }}
|
1770 |
{{:value}}
|
1767 |
{{/if}}
|
1771 |
{{/if}}
|
1768 |
</td>
|
1772 |
</td>
|
1769 |
<td class="text-left">
|
1773 |
<td class="text-left">
|
1770 |
{{if ~getType( slug_section, slug_question) != 'rating-open'}}
|
1774 |
{{if ~getType( slug_section, slug_question) != 'rating-open'}}
|