Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 156 | Rev 158 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 156 Rev 157
Línea 78... Línea 78...
78
			{
78
			{
Línea 79... Línea 79...
79
			
79
			
80
				var s = '';
80
				var s = '';
81
				for(i = 0; i < this.sections.length; i++)
81
				for(i = 0; i < this.sections.length; i++)
82
				{
82
				{
83
					if(section_slug !=  this.sections[i].slug) {
83
					if(section_slug !=  this.sections[i].slug_section) {
84
						continue;
84
						continue;
Línea 85... Línea 85...
85
					}
85
					}
Línea 86... Línea 86...
86
 
86
 
87
					$('span.section-name' + section_slug).html(this.sections[i].name);
87
					$('span.section-name' + section_slug).html(this.sections[i].name);
Línea 88... Línea 88...
88
 
88
 
89
					let table = 'table-section-question-option' + this.sections[i].slug; 
89
					let table = 'table-section-question-option' + this.sections[i].slug_section; 
90
					$('#' + table  + ' tbody').empty();
90
					$('#' + table  + ' tbody').empty();
91
					
91
					
92
					s = '<tr class="tr-section" data-slug="' + this.sections[i].slug + '">';
92
					s = '<tr class="tr-section" data-slug="' + this.sections[i].slug_section + '">';
93
					s = s  + '<td class="text-left">LABEL_SECTION</td>';
93
					s = s  + '<td class="text-left">LABEL_SECTION</td>';
94
					s = s  + '<td class="text-left">' + this.sections[i].name +  '</td>';
94
					s = s  + '<td class="text-left">' + this.sections[i].name +  '</td>';
95
					s = s  + '<td class="text-right">' + this.sections[i].value + '</td>';
95
					s = s  + '<td class="text-right">' + this.sections[i].value + '</td>';
96
					s = s  + '<td>&nbsp</td>';
96
					s = s  + '<td>&nbsp</td>';
97
					s = s  + '<td>';
97
					s = s  + '<td>';
98
					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>&nbsp';
98
					s = s  + '<button class="btn btn-default btn-edit-section" data-slug="' + this.sections[i].slug_section + '" data-toggle="tooltip" title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button>&nbsp';
99
					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>&nbsp';
99
					s = s  + '<button class="btn btn-default btn-delete-section" data-slug="' + this.sections[i].slug_section + '" data-toggle="tooltip" title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button>&nbsp';
Línea 100... Línea 100...
100
					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>&nbsp';
100
					s = s  + '<button class="btn btn-default btn-add-question" data-slug="' + this.sections[i].slug_section + '" data-toggle="tooltip" title="LABEL_ADD LABEL_QUESTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_QUESTION </button>&nbsp';
101
					s = s  + '</td>';
101
					s = s  + '</td>';
102
					s = s  + '</tr>';
102
					s = s  + '</tr>';
Línea 103... Línea 103...
103
					$('#' + table + ' tbody').append(s);
103
					$('#' + table + ' tbody').append(s);
104
					
104
					
Línea 105... Línea 105...
105
					
105
					
106
 
106
 
Línea 125... Línea 125...
125
							
125
							
126
							for(k = 0; k < this.sections[i].questions[j].options.length; k++)
126
							for(k = 0; k < this.sections[i].questions[j].options.length; k++)
127
							{
127
							{
128
								this.sections[i].questions[j].options[k].position = j;
128
								this.sections[i].questions[j].options[k].position = j;
129
								this.drawOption(
129
								this.drawOption(
130
									this.sections[i].slug, 
130
									this.sections[i].slug_section, 
131
									this.sections[i].questions[j].slug,  
131
									this.sections[i].questions[j].slug_question,  
132
									this.sections[i].questions[j].type, 
132
									this.sections[i].questions[j].type, 
133
									this.sections[i].questions[j].options[k].slug, 
133
									this.sections[i].questions[j].options[k].slug_option, 
134
									this.sections[i].questions[j].options[k].text, 
134
									this.sections[i].questions[j].options[k].text, 
135
									this.sections[i].questions[j].options[k].type, 
135
									this.sections[i].questions[j].options[k].type, 
136
									this.sections[i].questions[j].options[k].correct, 
136
									this.sections[i].questions[j].options[k].correct, 
137
									this.sections[i].questions[j].options[k].value
137
									this.sections[i].questions[j].options[k].value
Línea 276... Línea 276...
276
				for(i = 0; i < this.sections.length; i++)
276
				for(i = 0; i < this.sections.length; i++)
277
				{
277
				{
278
					this.sections[i].position = i;
278
					this.sections[i].position = i;
Línea 279... Línea 279...
279
 
279
 
Línea 280... Línea 280...
280
 
280
 
281
					this.drawSection(this.sections[i].slug, this.sections[i].name, this.sections[i].value);
281
					this.drawSection(this.sections[i].slug_section, this.sections[i].name, this.sections[i].value);
282
					
282
					
Línea 294... Línea 294...
294
					
294
					
295
					for(j = 0; j < this.sections[i].questions.length; j++)
295
					for(j = 0; j < this.sections[i].questions.length; j++)
296
					{
296
					{
Línea 297... Línea 297...
297
						this.sections[i].questions[j].position = j;
297
						this.sections[i].questions[j].position = j;
298
 
298
 
Línea 299... Línea 299...
299
						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);
299
						this.drawQuestion( this.sections[i].slug_section, this.sections[i].questions[j].slug_question, this.sections[i].questions[j].text, this.sections[i].questions[j].value , this.sections[i].questions[j].type);
300
						if(this.sections[i].questions[j].type == 'simple' || this.sections[i].questions[j].type == 'multiple'|| this.sections[i].questions[j].type == 'rating-open') {
300
						if(this.sections[i].questions[j].type == 'simple' || this.sections[i].questions[j].type == 'multiple'|| this.sections[i].questions[j].type == 'rating-open') {
Línea 313... Línea 313...
313
							
313
							
314
							for(k = 0; k < this.sections[i].questions[j].options.length; k++)
314
							for(k = 0; k < this.sections[i].questions[j].options.length; k++)
315
							{
315
							{
316
								this.sections[i].questions[j].options[k].position = j;
316
								this.sections[i].questions[j].options[k].position = j;
317
								this.drawOption(
317
								this.drawOption(
318
									this.sections[i].slug, 
318
									this.sections[i].slug_section, 
319
									this.sections[i].questions[j].slug,  
319
									this.sections[i].questions[j].slug_question,  
320
									this.sections[i].questions[j].type, 
320
									this.sections[i].questions[j].type, 
321
									this.sections[i].questions[j].options[k].slug, 
321
									this.sections[i].questions[j].options[k].slug_option, 
322
									this.sections[i].questions[j].options[k].text, 
322
									this.sections[i].questions[j].options[k].text, 
323
									this.sections[i].questions[j].options[k].type, 
323
									this.sections[i].questions[j].options[k].type, 
324
									this.sections[i].questions[j].options[k].correct, 
324
									this.sections[i].questions[j].options[k].correct, 
325
									this.sections[i].questions[j].options[k].value
325
									this.sections[i].questions[j].options[k].value
Línea 349... Línea 349...
349
						}
349
						}
350
					});
350
					});
351
					position++;
351
					position++;
Línea 352... Línea 352...
352
 
352
 
353
				var section = {
353
				var section = {
354
					'slug' 		: slug,
354
					'slug_section' 		: slug,
355
					'name' 		: name,
355
					'name' 		: name,
356
					'text' 		: text,
356
					'text' 		: text,
357
					'value' 	: value,
357
					'value' 	: value,
358
					'position' 	: position,
358
					'position' 	: position,
Línea 365... Línea 365...
365
			this.editSection = function (slug, name, text, value)
365
			this.editSection = function (slug, name, text, value)
366
			{
366
			{
367
				var renderTable = false;
367
				var renderTable = false;
368
				for(i = 0; i < this.sections.length; i++) 
368
				for(i = 0; i < this.sections.length; i++) 
369
				{
369
				{
370
						if(slug == this.sections[i].slug) {
370
						if(slug == this.sections[i].slug_section) {
371
							this.sections[i].name = name;
371
							this.sections[i].name = name;
372
							this.sections[i].text = text;
372
							this.sections[i].text = text;
373
							this.sections[i].value = value;
373
							this.sections[i].value = value;
374
							renderTable = true;
374
							renderTable = true;
Línea 385... Línea 385...
385
			this.deleteSection = function(slug)
385
			this.deleteSection = function(slug)
386
			{
386
			{
387
				var renderTable = false;
387
				var renderTable = false;
388
				for(i = 0; i < this.sections.length; i++) 
388
				for(i = 0; i < this.sections.length; i++) 
389
				{
389
				{
390
						if(slug == this.sections[i].slug) {
390
						if(slug == this.sections[i].slug_section) {
391
							this.sections.splice(i, 1);
391
							this.sections.splice(i, 1);
Línea 392... Línea 392...
392
							
392
							
393
							renderTable = true;
393
							renderTable = true;
394
							break;
394
							break;
Línea 407... Línea 407...
407
					
407
					
408
				var position = 0;
408
				var position = 0;
409
				var renderTable = false;
409
				var renderTable = false;
410
				for(i = 0; i < this.sections.length; i++)
410
				for(i = 0; i < this.sections.length; i++)
411
				{
411
				{
412
					if(section_slug == this.sections[i].slug) {
412
					if(section_slug == this.sections[i].slug_section) {
413
						$.each(this.sections[i].questions, function(index, question) {
413
						$.each(this.sections[i].questions, function(index, question) {
414
							if(position < question.position) {
414
							if(position < question.position) {
415
								position = question.position;
415
								position = question.position;
416
							}
416
							}
417
						});
417
						});
Línea 418... Línea 418...
418
						position++;
418
						position++;
419
							
419
							
420
						var question = {
420
						var question = {
421
							'slug' : slug,
421
							'slug_question' : slug,
422
								'text' : text,
422
								'text' : text,
423
								'value' : value,
423
								'value' : value,
424
								'type' : type,
424
								'type' : type,
425
								'position' : position,
425
								'position' : position,
426
								'maxlength' :maxlength,
426
								'maxlength' :maxlength,
427
								'multiline' : multiline,
427
								'multiline' : multiline,
428
								'range' : range,
428
								'range' : range,
429
								'options' : [],
-
 
430
							}
429
								'options' : [],
431
 
430
							}
432
						this.sections[i].questions.push(question);
431
						this.sections[i].questions.push(question);
433
						renderTable = true;
432
						renderTable = true;
434
						break;
433
						break;
Línea 442... Línea 441...
442
			this.editQuestion = function(section_slug, question_slug, text, value, type, maxlength, multiline, range) 
441
			this.editQuestion = function(section_slug, question_slug, text, value, type, maxlength, multiline, range) 
443
			{
442
			{
444
				var renderTable = false;
443
				var renderTable = false;
445
				for(i = 0; i < this.sections.length; i++)
444
				for(i = 0; i < this.sections.length; i++)
446
				{
445
				{
447
					if(section_slug == this.sections[i].slug) {
446
					if(section_slug == this.sections[i].slug_section) {
448
						for(j = 0; j < this.sections[i].questions.length; j++) {
447
						for(j = 0; j < this.sections[i].questions.length; j++) {
449
							if(question_slug == this.sections[i].questions[j].slug) {
448
							if(question_slug == this.sections[i].questions[j].slug_question) {
450
								this.sections[i].questions[j].text 	= text,
449
								this.sections[i].questions[j].text 	= text,
451
								this.sections[i].questions[j].value	= value,
450
								this.sections[i].questions[j].value	= value,
452
								this.sections[i].questions[j].type 	= type;
451
								this.sections[i].questions[j].type 	= type;
Línea 453... Línea 452...
453
									
452
									
Línea 481... Línea 480...
481
			this.deleteQuestion = function(section_slug, question_slug)
480
			this.deleteQuestion = function(section_slug, question_slug)
482
			{
481
			{
483
				var renderTable = false;
482
				var renderTable = false;
484
				for(i = 0; i < this.sections.length; i++) 
483
				for(i = 0; i < this.sections.length; i++) 
485
				{
484
				{
486
						if(section_slug == this.sections[i].slug) {
485
						if(section_slug == this.sections[i].slug_section) {
487
							for(j = 0; j < this.sections[i].questions.length; j++) {
486
							for(j = 0; j < this.sections[i].questions.length; j++) {
488
							if(question_slug == this.sections[i].questions[j].slug) {
487
							if(question_slug == this.sections[i].questions[j].slug_question) {
489
									this.sections[i].questions.splice(j, 1);
488
									this.sections[i].questions.splice(j, 1);
490
										renderTable = true;
489
										renderTable = true;
491
										break;
490
										break;
492
							}
491
							}
493
						}
492
						}
Línea 508... Línea 507...
508
				
507
				
509
				var position = 0;
508
				var position = 0;
510
				var renderTable = false;
509
				var renderTable = false;
511
				for(i = 0; i < this.sections.length; i++)
510
				for(i = 0; i < this.sections.length; i++)
512
				{
511
				{
513
					if(section_slug == this.sections[i].slug) {
512
					if(section_slug == this.sections[i].slug_section) {
514
						for(j = 0; j < this.sections[i].questions.length; j++) {
513
						for(j = 0; j < this.sections[i].questions.length; j++) {
515
							if(question_slug == this.sections[i].questions[j].slug) {
514
							if(question_slug == this.sections[i].questions[j].slug_question) {
516
								$.each(this.sections[i].questions[j].options, function(index, option) {
515
								$.each(this.sections[i].questions[j].options, function(index, option) {
517
										if(position < option.position) {
516
										if(position < option.position) {
518
											position = option.position;
517
											position = option.position;
519
										}
518
										}
520
									});
519
									});
Línea 521... Línea 520...
521
									position++;
520
									position++;
522
										
521
										
523
									var option = {
522
									var option = {
524
										'slug' : slug,
523
										'slug_option' : slug,
525
											'text' : text,
524
											'text' : text,
526
											'correct' : correct,
525
											'correct' : correct,
Línea 545... Línea 544...
545
			this.editOption = function(section_slug, question_slug, option_slug, text, correct, value) 
544
			this.editOption = function(section_slug, question_slug, option_slug, text, correct, value) 
546
			{
545
			{
547
				var renderTable = false;
546
				var renderTable = false;
548
				for(i = 0; i < this.sections.length; i++)
547
				for(i = 0; i < this.sections.length; i++)
549
				{
548
				{
550
					if(section_slug == this.sections[i].slug) {
549
					if(section_slug == this.sections[i].slug_section) {
551
						for(j = 0; j < this.sections[i].questions.length; j++) {
550
						for(j = 0; j < this.sections[i].questions.length; j++) {
552
							if(question_slug == this.sections[i].questions[j].slug) {
551
							if(question_slug == this.sections[i].questions[j].slug_question) {
553
								for(k = 0; k < this.sections[i].questions[j].options.length; k++) {
552
								for(k = 0; k < this.sections[i].questions[j].options.length; k++) {
554
									if(option_slug == this.sections[i].questions[j].options[k].slug) {
553
									if(option_slug == this.sections[i].questions[j].options[k].slug_option) {
555
										this.sections[i].questions[j].options[k].text = text;
554
										this.sections[i].questions[j].options[k].text = text;
556
										this.sections[i].questions[j].options[k].correct = correct;
555
										this.sections[i].questions[j].options[k].correct = correct;
557
										this.sections[i].questions[j].options[k].value = value;
556
										this.sections[i].questions[j].options[k].value = value;
558
										renderTable = true;
557
										renderTable = true;
559
												break;
558
												break;
Línea 577... Línea 576...
577
			this.deleteOption = function(section_slug, question_slug, option_slug)
576
			this.deleteOption = function(section_slug, question_slug, option_slug)
578
			{
577
			{
579
				var renderTable = false;
578
				var renderTable = false;
580
				for(i = 0; i < this.sections.length; i++) 
579
				for(i = 0; i < this.sections.length; i++) 
581
				{
580
				{
582
						if(section_slug == this.sections[i].slug) {
581
						if(section_slug == this.sections[i].slug_section) {
583
							for(j = 0; j < this.sections[i].questions.length; j++) {
582
							for(j = 0; j < this.sections[i].questions.length; j++) {
584
							if(question_slug == this.sections[i].questions[j].slug) {
583
							if(question_slug == this.sections[i].questions[j].slug_question) {
585
								for(k = 0; k < this.sections[i].questions[j].options.length; k++) {
584
								for(k = 0; k < this.sections[i].questions[j].options.length; k++) {
586
									if(option_slug == this.sections[i].questions[j].options[k].slug) {
585
									if(option_slug == this.sections[i].questions[j].options[k].slug_option) {
587
										this.sections[i].questions[j].options.splice(k, 1);
586
										this.sections[i].questions[j].options.splice(k, 1);
588
										renderTable = true;
587
										renderTable = true;
589
												break;
588
												break;
590
									}
589
									}
591
								}
590
								}
Línea 1236... Línea 1235...
1236
		    		$('#form-section #section-text').val(),
1235
		    		$('#form-section #section-text').val(),
1237
		    		$('#form-section #section-value').val()
1236
		    		$('#form-section #section-value').val()
1238
		    	);	
1237
		    	);	
1239
		    }
1238
		    }
Línea 1240... Línea -...
1240
		    
-
 
-
 
1239
		    
Línea 1241... Línea 1240...
1241
		    
1240
		    renderData(objFormGenerator.sections);
1242
		    
1241
		    
1243
			$('#modal-section').modal('hide');
1242
			$('#modal-section').modal('hide');
1244
			return false;
1243
			return false;
Línea 1328... Línea 1327...
1328
				    $('#form-question #question-max-length').val(),
1327
				    $('#form-question #question-max-length').val(),
1329
		    		$('#form-question #question-multiline').val(),
1328
		    		$('#form-question #question-multiline').val(),
1330
		    		$('#form-question #question-range').val()
1329
		    		$('#form-question #question-range').val()
1331
		    	);	
1330
		    	);	
1332
		    }
1331
		    }
1333
		    
-
 
-
 
1332
		    renderData(objFormGenerator.sections);
1334
			$('#modal-question').modal('hide');
1333
			$('#modal-question').modal('hide');
1335
			return false;
1334
			return false;
1336
		  }
1335
		  }
1337
	} );
1336
	} );
Línea 1396... Línea 1395...
1396
			    	$('#form-option #option-text').val(), 
1395
			    	$('#form-option #option-text').val(), 
1397
			    	$('#form-option #option-correct').val(),
1396
			    	$('#form-option #option-correct').val(),
1398
			    	$('#form-option #option-value').val()
1397
			    	$('#form-option #option-value').val()
1399
		    	);	
1398
		    	);	
1400
		    }
1399
		    }
1401
 
-
 
-
 
1400
			renderData(objFormGenerator.sections);
1402
			$('#modal-option').modal('hide');
1401
			$('#modal-option').modal('hide');
1403
			return false;
1402
			return false;
1404
		  }
1403
		  }
1405
	} );
1404
	} );
Línea 1445... Línea 1444...
1445
	    		    editor.focus();
1444
	    		    editor.focus();
1446
	    		});
1445
	    		});
Línea 1447... Línea 1446...
1447
	    	    		
1446
	    	    		
Línea 1448... Línea -...
1448
				$('#form-section #section-value').val(section.value);
-
 
1449
 
1447
				$('#form-section #section-value').val(section.value);
1450
				console.log(objFormGenerator)
1448
 
1451
				
1449
		
1452
				showForm = true;
1450
				showForm = true;
1453
				break;
1451
				break;
Línea 1477... Línea 1475...
1477
		        }
1475
		        }
1478
		    },
1476
		    },
1479
		    callback: function (result) {
1477
		    callback: function (result) {
1480
		    	if (result) {
1478
		    	if (result) {
1481
					objFormGenerator.deleteSection(slug);
1479
					objFormGenerator.deleteSection(slug);
-
 
1480
					renderData(objFormGenerator.sections);
1482
				}
1481
				}
1483
		    }
1482
		    }
1484
		});
1483
		});
Línea 1530... Línea 1529...
1530
	    var slug 			= $(this).data('slug');
1529
	    var slug 			= $(this).data('slug');
1531
	    var showForm 		= false;
1530
	    var showForm 		= false;
Línea 1532... Línea 1531...
1532
	    
1531
	    
Línea 1533... Línea 1532...
1533
	    for(i = 0; i < objFormGenerator.sections.length; i++) {
1532
	    for(i = 0; i < objFormGenerator.sections.length; i++) {
Línea 1534... Línea 1533...
1534
	    	
1533
	    	
Línea 1535... Línea 1534...
1535
	    	if(slug_section == objFormGenerator.sections[i].slug) {
1534
	    	if(slug_section == objFormGenerator.sections[i].slug_section) {
1536
	    		
1535
	    		
Línea 1537... Línea 1536...
1537
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1536
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1538
	    			
1537
	    			
Línea 1539... Línea 1538...
1539
	    			if(slug == objFormGenerator.sections[i].questions[j].slug) {
1538
	    			if(slug == objFormGenerator.sections[i].questions[j].slug_question) {
1540
	    				validatorFormQuestion.resetForm();
1539
	    				validatorFormQuestion.resetForm();
1541
	    				
1540
	    				
1542
	    				$('#form-question #question-section').val(objFormGenerator.sections[i].slug);
1541
	    				$('#form-question #question-section').val(objFormGenerator.sections[i].slug_section);
Línea 1618... Línea 1617...
1618
			    }
1617
			    }
1619
			},
1618
			},
1620
			callback: function (result) {
1619
			callback: function (result) {
1621
				if (result) {
1620
				if (result) {
1622
					objFormGenerator.deleteQuestion(slug_section, slug);
1621
					objFormGenerator.deleteQuestion(slug_section, slug);
-
 
1622
					renderData(objFormGenerator.sections);
1623
				}
1623
				}
1624
			}
1624
			}
1625
		});		    
1625
		});		    
1626
	});
1626
	});
Línea 1631... Línea 1631...
1631
	    var slug_section	= $(this).data('section');
1631
	    var slug_section	= $(this).data('section');
1632
		var slug_question 	= $(this).data('slug');
1632
		var slug_question 	= $(this).data('slug');
1633
		var showForm 		= false;
1633
		var showForm 		= false;
Línea 1634... Línea 1634...
1634
 
1634
 
1635
	    for(i = 0; i < objFormGenerator.sections.length; i++) {
1635
	    for(i = 0; i < objFormGenerator.sections.length; i++) {
1636
	    	if(slug_section == objFormGenerator.sections[i].slug) {
1636
	    	if(slug_section == objFormGenerator.sections[i].slug_section) {
1637
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1637
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
Línea 1638... Línea 1638...
1638
	    			if(slug_question == objFormGenerator.sections[i].questions[j].slug) {
1638
	    			if(slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
1639
 
1639
 
1640
                		validatorFormOption.resetForm();
1640
                		validatorFormOption.resetForm();
1641
                		$('#form-option #option-section').val(slug_section);
1641
                		$('#form-option #option-section').val(slug_section);
Línea 1663... Línea 1663...
1663
                			$('#form-option #option-value').val('1');
1663
                			$('#form-option #option-value').val('1');
1664
                			$('#form-option #option-value').parent().hide();
1664
                			$('#form-option #option-value').parent().hide();
Línea 1665... Línea 1665...
1665
                			
1665
                			
Línea 1666... Línea 1666...
1666
                       	}
1666
                       	}
1667
 
1667
 
1668
						   console.log(console.log(objFormGenerator));
1668
						   renderData(objFormGenerator.sections);
1669
                		showForm = true;
1669
                		showForm = true;
1670
	    			}
1670
	    			}
1671
	    		}
1671
	    		}
Línea 1676... Línea 1676...
1676
    		$('#modal-option h4[class="modal-title"]').html('LABEL_ADD LABEL_OPTION');
1676
    		$('#modal-option h4[class="modal-title"]').html('LABEL_ADD LABEL_OPTION');
1677
    		$('#modal-option').modal('show');
1677
    		$('#modal-option').modal('show');
1678
		}
1678
		}
Línea 1679... Línea 1679...
1679
		
1679
		
-
 
1680
	});
-
 
1681
 
-
 
1682
    /**
-
 
1683
	 * Render Sections data
-
 
1684
	 */
-
 
1685
	//const renderData = (data) => $("#rows").html($("#sectionTemplate").render(data));
-
 
1686
 
Línea 1680... Línea 1687...
1680
	});
1687
	const renderData = (data) => console.log(data);
1681
	
1688
	
Línea 1688... Línea 1695...
1688
	    var slug_question	= $(this).data('question');
1695
	    var slug_question	= $(this).data('question');
1689
	    var slug 			= $(this).data('slug');
1696
	    var slug 			= $(this).data('slug');
1690
	    var showForm 		= false;
1697
	    var showForm 		= false;
Línea 1691... Línea 1698...
1691
	    
1698
	    
1692
	    for(i = 0; i < objFormGenerator.sections.length; i++) {
1699
	    for(i = 0; i < objFormGenerator.sections.length; i++) {
1693
	    	if(slug_section == objFormGenerator.sections[i].slug) {
1700
	    	if(slug_section == objFormGenerator.sections[i].slug_section) {
1694
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1701
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1695
	    			if(slug_question == objFormGenerator.sections[i].questions[j].slug) {
1702
	    			if(slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
1696
	    				for(k = 0; k < objFormGenerator.sections[i].questions[j].options.length; k++) {
1703
	    				for(k = 0; k < objFormGenerator.sections[i].questions[j].options.length; k++) {
1697
	    					if(slug == objFormGenerator.sections[i].questions[j].options[k].slug) {
1704
	    					if(slug == objFormGenerator.sections[i].questions[j].options[k].slug_option) {
1698
	    						validatorFormOption.resetForm();
1705
	    						validatorFormOption.resetForm();
1699
	    						$('#form-option #option-section').val(objFormGenerator.sections[i].slug);
1706
	    						$('#form-option #option-section').val(objFormGenerator.sections[i].slug_section);
1700
	    						$('#form-option #option-question').val(objFormGenerator.sections[i].questions[j].slug);
1707
	    						$('#form-option #option-question').val(objFormGenerator.sections[i].questions[j].slug_question);
Línea 1701... Línea 1708...
1701
    		    				$('#form-option #option-slug').val(objFormGenerator.sections[i].questions[j].options[k].slug);
1708
    		    				$('#form-option #option-slug').val(objFormGenerator.sections[i].questions[j].options[k].slug_option);
1702
 
1709
 
1703
    		    				instanceName = 'option-text'; 
1710
    		    				instanceName = 'option-text'; 
1704
    		    	    		let editor = CKEDITOR.instances[instanceName ];
1711
    		    	    		let editor = CKEDITOR.instances[instanceName ];
Línea 1764... Línea 1771...
1764
				}
1771
				}
1765
			},
1772
			},
1766
			callback: function (result) {
1773
			callback: function (result) {
1767
				if (result) {
1774
				if (result) {
1768
					objFormGenerator.deleteOption(slug_section, slug_question, slug);
1775
					objFormGenerator.deleteOption(slug_section, slug_question, slug);
-
 
1776
					renderData(objFormGenerator.sections);
1769
				}
1777
				}
1770
			}
1778
			}
1771
		});			    
1779
		});			    
1772
	})
1780
	})