Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 149 Rev 150
Línea 884... Línea 884...
884
			'url'       :  action,
884
			'url'       :  action,
885
		}).done(function(response) {
885
		}).done(function(response) {
886
			if(response['success']) {
886
			if(response['success']) {
887
					validatorForm.resetForm();
887
					validatorForm.resetForm();
Línea 888... Línea 888...
888
 
888
 
889
					$('#form-main #form-id' ).val(response['id']),
889
					$('#main #id' ).val(response['id']),
890
					$('#form-main #form-continue').val('0');
890
					$('#main #continue').val('0');
Línea 891... Línea 891...
891
					$('#form-main #form-name' ).val(response['name']),
891
					$('#main #name' ).val(response['name']),
892
 
892
 
893
 
893
 
Línea 899... Línea 899...
899
					
899
					
900
					
900
					
Línea 901... Línea 901...
901
					instanceName = 'form-text'; 
901
					instanceName = 'form-text'; 
902
					CKEDITOR.instances[instanceName ].setData(response['text']);
902
					CKEDITOR.instances[instanceName ].setData(response['text']);
Línea 903... Línea 903...
903
 
903
 
904
					$('#form-main #form-language' ).val(response['language']),
904
					$('#main #language' ).val(response['language']),
905
					$('#form-main #form-status' ).val(response['status']);
905
					$('#main #status' ).val(response['status']);
906
 
906
 
907
					objFormGenerator.clear();
907
					objFormGenerator.clear();
Línea 908... Línea 908...
908
					objFormGenerator.sections = response['sections'] || [];
908
					objFormGenerator.sections = response['sections'] || [];
Línea 909... Línea 909...
909
					objFormGenerator.render();
909
					objFormGenerator.render();
910
					$('#row-forms').hide();
910
					$('#row-forms').hide();
911
					$('#row-edit').show();
911
					$('#row-edit').show();
912
 
912
 
Línea 972... Línea 972...
972
	    var form3 = $('#form_sample_3');
972
	    var form3 = $('#form_sample_3');
973
        var error3 = $('.alert-danger', form3);
973
        var error3 = $('.alert-danger', form3);
974
        var success3 = $('.alert-success', form3);
974
        var success3 = $('.alert-success', form3);
Línea 975... Línea 975...
975
 
975
 
976
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
976
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
977
 	$( "#form-main" ).on('submit', function() {
977
 	$( "#main" ).on('submit', function() {
978
		for(var instanceName in CKEDITOR.instances) {
978
		for(var instanceName in CKEDITOR.instances) {
979
			CKEDITOR.instances[instanceName].updateElement();
979
			CKEDITOR.instances[instanceName].updateElement();
980
		}
980
		}
Línea 981... Línea 981...
981
	})
981
	})
982
	    
982
	    
983
	var validatorForm = $( "#form-main" ).validate( {
983
	var validatorForm = $( "#main" ).validate( {
984
        ignore: [],
984
        ignore: [],
985
        errorClass: 'help-block',
985
        errorClass: 'help-block',
986
        errorElement: 'span',
986
        errorElement: 'span',
Línea 1131... Línea 1131...
1131
    			if(error) {
1131
    			if(error) {
1132
    				return false;
1132
    				return false;
1133
    			} else {
1133
    			} else {
Línea 1134... Línea 1134...
1134
 
1134
 
1135
 
1135
 
Línea 1136... Línea 1136...
1136
    				var formId		= parseInt($('#form-main #form-id' ).val());
1136
    				var formId		= parseInt($('#main #id' ).val());
1137
    				var formContinue = parseInt($('#form-main #form-continue' ).val());
1137
    				var formContinue = parseInt($('#main #continue' ).val());
1138
        			
1138
        			
1139
    				var data = {
1139
    				var data = {
1140
    	    			'id'	: formId,
1140
    	    			'id'	: formId,
1141
        				'name' : $('#form-main #form-name' ).val(),
1141
        				'name' : $('#main #name' ).val(),
1142
        				'description' : $('#form-main #form-description' ).val(),
1142
        				'description' : $('#main #description' ).val(),
1143
        				'text' : $('#form-main #form-text' ).val(),
1143
        				'text' : $('#main #text' ).val(),
1144
        				'language' : $('#form-main #form-language' ).val(),
1144
        				'language' : $('#main #language' ).val(),
1145
        				'status' : $('#form-main #form-status' ).val(),
1145
        				'status' : $('#main #status' ).val(),
1146
        				'sections' : objFormGenerator.sections
1146
        				'sections' : objFormGenerator.sections
1147
    				}
1147
    				}
Línea 1152... Línea 1152...
1152
						'data' : data,
1152
						'data' : data,
1153
					}).done(function(response) {
1153
					}).done(function(response) {
1154
						if(response['success']) {
1154
						if(response['success']) {
1155
							$.fn.showSuccess(response['message']);
1155
							$.fn.showSuccess(response['message']);
1156
							if(formContinue == 1) {
1156
							if(formContinue == 1) {
1157
								$('#form-main #form-id').val(response['form-id']);
1157
								$('#main #id').val(response['form-id']);
1158
								$('#form-main #form-continue').val(0);
1158
								$('#main #continue').val(0);
1159
							} else {
1159
							} else {
1160
								$('#row-edit').hide();
1160
								$('#row-edit').hide();
1161
								$('#row-forms').show();
1161
								$('#row-forms').show();
1162
							}
1162
							}
1163
							tableForm.fnDraw();
1163
							tableForm.fnDraw();
Línea 1174... Línea 1174...
1174
 
1174
 
1175
		}
1175
		}
Línea 1176... Línea 1176...
1176
	});
1176
	});
1177
 
1177
 
1178
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
1178
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
1179
 	$( "#form-section" ).on('submit', function() {
1179
 	$( "#section" ).on('submit', function() {
1180
		for(var instanceName in CKEDITOR.instances) {
1180
		for(var instanceName in CKEDITOR.instances) {
1181
			CKEDITOR.instances[instanceName].updateElement();
1181
			CKEDITOR.instances[instanceName].updateElement();
Línea 1182... Línea 1182...
1182
		}
1182
		}
1183
	})
1183
	})
1184
	
1184
	
1185
	var validatorFormSection = $( "#form-section" ).validate( {
1185
	var validatorFormSection = $( "#section" ).validate( {
1186
        ignore: [],
1186
        ignore: [],
1187
        errorClass: 'help-block',
1187
        errorClass: 'help-block',
Línea 1223... Línea 1223...
1223
        },
1223
        },
1224
		submitHandler: function(form) {
1224
		submitHandler: function(form) {
1225
		    // do other things for a valid form
1225
		    // do other things for a valid form
1226
		    //form.submit();
1226
		    //form.submit();
Línea 1227... Línea 1227...
1227
 
1227
 
1228
		    var slug = $('#form-section #section-slug').val();
1228
		    var slug = $('#section #section-slug').val();
1229
		    if(slug) {
1229
		    if(slug) {
1230
		    	objFormGenerator.editSection(
1230
		    	objFormGenerator.editSection(
1231
		    		$('#form-section #section-slug').val(), 
1231
		    		$('#section #section-slug').val(), 
1232
			    	$('#form-section #section-name').val(), 
1232
			    	$('#section #section-name').val(), 
1233
			    	$('#form-section #section-text').val(),
1233
			    	$('#section #section-text').val(),
1234
			    	$('#form-section #section-value').val()
1234
			    	$('#section #section-value').val()
1235
			  	);	
1235
			  	);	
1236
		    } else {
1236
		    } else {
1237
		    	objFormGenerator.addSection(
1237
		    	objFormGenerator.addSection(
1238
		    		$('#form-section #section-name').val(), 
1238
		    		$('#section #section-name').val(), 
1239
		    		$('#form-section #section-text').val(),
1239
		    		$('#section #section-text').val(),
1240
		    		$('#form-section #section-value').val()
1240
		    		$('#section #section-value').val()
1241
		    	);	
1241
		    	);	
Línea 1247... Línea 1247...
1247
			return false;
1247
			return false;
1248
		  }
1248
		  }
1249
	} );
1249
	} );
Línea 1250... Línea 1250...
1250
 
1250
 
1251
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
1251
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
1252
 	$( "#form-question" ).on('submit', function() {
1252
 	$( "#question" ).on('submit', function() {
1253
		for(var instanceName in CKEDITOR.instances) {
1253
		for(var instanceName in CKEDITOR.instances) {
1254
			CKEDITOR.instances[instanceName].updateElement();
1254
			CKEDITOR.instances[instanceName].updateElement();
1255
		}
1255
		}
Línea 1256... Línea 1256...
1256
	})
1256
	})
1257
	
1257
	
1258
	
1258
	
1259
	var validatorFormQuestion = $( "#form-question" ).validate( {
1259
	var validatorFormQuestion = $( "#question" ).validate( {
1260
        ignore: [],
1260
        ignore: [],
1261
        errorClass: 'help-block',
1261
        errorClass: 'help-block',
Línea 1306... Línea 1306...
1306
            }, 1000);
1306
            }, 1000);
1307
        },
1307
        },
1308
		submitHandler: function(form) {
1308
		submitHandler: function(form) {
Línea 1309... Línea 1309...
1309
		    
1309
		    
Línea 1310... Línea 1310...
1310
		
1310
		
1311
		    if($('#form-question #question-slug').val()) {
1311
		    if($('#question #question-slug').val()) {
1312
		    
1312
		    
1313
			
1313
			
1314
		    	objFormGenerator.editQuestion(
1314
		    	objFormGenerator.editQuestion(
1315
		    		$('#form-question #question-section').val(), 
1315
		    		$('#question #question-section').val(), 
1316
		    		$('#form-question #question-slug').val(),
1316
		    		$('#question #question-slug').val(),
1317
		    		$('#form-question #question-text').val(), 
1317
		    		$('#question #question-text').val(), 
1318
		    		$('#form-question #question-value').val(),
1318
		    		$('#question #question-value').val(),
1319
			    	$('#form-question #question-type').val(),
1319
			    	$('#question #question-type').val(),
1320
			    	$('#form-question #question-max-length').val(),
1320
			    	$('#question #question-max-length').val(),
Línea 1321... Línea 1321...
1321
	    			$('#form-question #question-multiline').val(),
1321
	    			$('#question #question-multiline').val(),
1322
	    			$('#form-question #question-range').val()
1322
	    			$('#question #question-range').val()
1323
			  	);	
1323
			  	);	
1324
		    } else {
1324
		    } else {
1325
			    
1325
			    
1326
		    	objFormGenerator.addQuestion(
1326
		    	objFormGenerator.addQuestion(
1327
			    	$('#form-question #question-section').val(), 
1327
			    	$('#question #question-section').val(), 
1328
			    	$('#form-question #question-text').val(), 
1328
			    	$('#question #question-text').val(), 
1329
			    	$('#form-question #question-value').val(),
1329
			    	$('#question #question-value').val(),
1330
				    $('#form-question #question-type').val(),
1330
				    $('#question #question-type').val(),
Línea 1331... Línea 1331...
1331
				    $('#form-question #question-max-length').val(),
1331
				    $('#question #question-max-length').val(),
1332
		    		$('#form-question #question-multiline').val(),
1332
		    		$('#question #question-multiline').val(),
1333
		    		$('#form-question #question-range').val()
1333
		    		$('#question #question-range').val()
1334
		    	);	
1334
		    	);	
Línea 1335... Línea 1335...
1335
		    }
1335
		    }
1336
		    
1336
		    
1337
			$('#modal-question').modal('hide');
1337
			$('#modal-question').modal('hide');
1338
			return false;
1338
			return false;
1339
		  }
1339
		  }
1340
	} );
1340
	} );
Línea 1341... Línea 1341...
1341
 
1341
 
1342
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
1342
	//IMPORTANT: update CKEDITOR textarea with actual content before submit
1343
 	$( "#form-option" ).on('submit', function() {
1343
 	$( "#option" ).on('submit', function() {
1344
		for(var instanceName in CKEDITOR.instances) {
1344
		for(var instanceName in CKEDITOR.instances) {
1345
			CKEDITOR.instances[instanceName].updateElement();
1345
			CKEDITOR.instances[instanceName].updateElement();
1346
		}
1346
		}
Línea 1381... Línea 1381...
1381
            }, 1000);
1381
            }, 1000);
1382
        },
1382
        },
1383
		submitHandler: function(form) {
1383
		submitHandler: function(form) {
Línea 1384... Línea 1384...
1384
		    
1384
		    
1385
 
1385
 
1386
		    if($('#form-option #option-slug').val()) {
1386
		    if($('#option #option-slug').val()) {
1387
		    	objFormGenerator.editOption(
1387
		    	objFormGenerator.editOption(
1388
		    		$('#form-option #option-section').val(), 
1388
		    		$('#option #option-section').val(), 
1389
		    		$('#form-option #option-question').val(), 
1389
		    		$('#option #option-question').val(), 
1390
		    		$('#form-option #option-slug').val(),
1390
		    		$('#option #option-slug').val(),
1391
		    		$('#form-option #option-text').val(), 
1391
		    		$('#option #option-text').val(), 
1392
		    		$('#form-option #option-correct').val(),
1392
		    		$('#option #option-correct').val(),
1393
		    		$('#form-option #option-value').val()
1393
		    		$('#option #option-value').val()
1394
			  	);	
1394
			  	);	
1395
		    } else {
1395
		    } else {
1396
		    	objFormGenerator.addOption(
1396
		    	objFormGenerator.addOption(
1397
			    	$('#form-option #option-section').val(), 
1397
			    	$('#option #option-section').val(), 
1398
			    	$('#form-option #option-question').val(), 
1398
			    	$('#option #option-question').val(), 
1399
			    	$('#form-option #option-text').val(), 
1399
			    	$('#option #option-text').val(), 
1400
			    	$('#form-option #option-correct').val(),
1400
			    	$('#option #option-correct').val(),
1401
			    	$('#form-option #option-value').val()
1401
			    	$('#option #option-value').val()
Línea 1402... Línea 1402...
1402
		    	);	
1402
		    	);	
1403
		    }
1403
		    }
Línea 1409... Línea 1409...
1409
	
1409
	
1410
	$('body').on('click', 'button[id="btn-add-section"]', function(e){
1410
	$('body').on('click', 'button[id="btn-add-section"]', function(e){
Línea 1411... Línea 1411...
1411
		e.preventDefault();
1411
		e.preventDefault();
1412
		
1412
		
1413
		validatorFormSection.resetForm();
1413
		validatorFormSection.resetForm();
Línea 1414... Línea 1414...
1414
		$('#form-section #section-slug').val('');
1414
		$('#section #section-slug').val('');
1415
		$('#form-section #section-name').val('');
1415
		$('#section #section-name').val('');
1416
 
1416
 
1417
		instanceName = 'section-text'; 
1417
		instanceName = 'section-text'; 
1418
		let editor = CKEDITOR.instances[instanceName ];
1418
		let editor = CKEDITOR.instances[instanceName ];
Línea 1419... Línea 1419...
1419
		editor.setData('', function() {
1419
		editor.setData('', function() {
1420
		    editor.focus();
1420
		    editor.focus();
1421
		});
1421
		});
1422
 
1422
 
Línea 1423... Línea 1423...
1423
	
1423
	
Línea 1437... Línea 1437...
1437
	        section = objFormGenerator.sections[i];
1437
	        section = objFormGenerator.sections[i];
Línea 1438... Línea 1438...
1438
	    	
1438
	    	
Línea 1439... Línea 1439...
1439
	    	if(slug == section.slug) {
1439
	    	if(slug == section.slug) {
1440
 
1440
 
1441
				validatorFormSection.resetForm();
1441
				validatorFormSection.resetForm();
Línea 1442... Línea 1442...
1442
	    		$('#form-section #section-slug').val(section.slug);
1442
	    		$('#section #section-slug').val(section.slug);
1443
	    		$('#form-section #section-name').val(section.name);
1443
	    		$('#section #section-name').val(section.name);
1444
	
1444
	
1445
	    		instanceName = 'section-text'; 
1445
	    		instanceName = 'section-text'; 
1446
	    		let editor = CKEDITOR.instances[instanceName ];
1446
	    		let editor = CKEDITOR.instances[instanceName ];
Línea 1447... Línea 1447...
1447
	    		editor.setData( section.text, function() {
1447
	    		editor.setData( section.text, function() {
Línea 1448... Línea 1448...
1448
	    		    editor.focus();
1448
	    		    editor.focus();
1449
	    		});
1449
	    		});
1450
	    	    		
1450
	    	    		
1451
				$('#form-section #section-value').val(section.value);
1451
				$('#section #section-value').val(section.value);
Línea 1493... Línea 1493...
1493
		e.preventDefault();
1493
		e.preventDefault();
Línea 1494... Línea 1494...
1494
		
1494
		
1495
		validatorFormQuestion.resetForm();
1495
		validatorFormQuestion.resetForm();
Línea 1496... Línea 1496...
1496
		var slug = $(this).data('slug');
1496
		var slug = $(this).data('slug');
1497
		
1497
		
Línea 1498... Línea 1498...
1498
		$('#form-question #question-section').val(slug);
1498
		$('#question #question-section').val(slug);
1499
		$('#form-question #question-slug').val('');
1499
		$('#question #question-slug').val('');
1500
 
1500
 
1501
		instanceName = 'question-text'; 
1501
		instanceName = 'question-text'; 
1502
		let editor = CKEDITOR.instances[instanceName ];
1502
		let editor = CKEDITOR.instances[instanceName ];
Línea 1503... Línea 1503...
1503
		editor.setData('', function() {
1503
		editor.setData('', function() {
1504
		    editor.focus();
1504
		    editor.focus();
Línea 1505... Línea 1505...
1505
		});
1505
		});
1506
 
1506
 
Línea 1507... Línea 1507...
1507
 
1507
 
1508
		$('#form-question #question-value').val('0');
1508
		$('#question #question-value').val('0');
Línea 1509... Línea 1509...
1509
		$('#form-question #question-type').val($('#form-question #question-type option:first').val());
1509
		$('#question #question-type').val($('#question #question-type option:first').val());
1510
		
1510
		
Línea 1511... Línea 1511...
1511
		$('#form-question #question-max-length').val('0');
1511
		$('#question #question-max-length').val('0');
1512
		$('#form-question #question-max-length').parent().show();
1512
		$('#question #question-max-length').parent().show();
Línea 1513... Línea 1513...
1513
		
1513
		
Línea 1538... Línea 1538...
1538
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1538
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
Línea 1539... Línea 1539...
1539
	    			
1539
	    			
1540
	    			if(slug == objFormGenerator.sections[i].questions[j].slug) {
1540
	    			if(slug == objFormGenerator.sections[i].questions[j].slug) {
Línea 1541... Línea 1541...
1541
	    				validatorFormQuestion.resetForm();
1541
	    				validatorFormQuestion.resetForm();
1542
	    				
1542
	    				
Línea 1543... Línea 1543...
1543
	    				$('#form-question #question-section').val(objFormGenerator.sections[i].slug);
1543
	    				$('#question #question-section').val(objFormGenerator.sections[i].slug);
1544
	    				$('#form-question #question-slug').val(objFormGenerator.sections[i].questions[j].slug);
1544
	    				$('#question #question-slug').val(objFormGenerator.sections[i].questions[j].slug);
1545
 
1545
 
1546
	    	    		instanceName = 'question-text'; 
1546
	    	    		instanceName = 'question-text'; 
1547
	    	    		let editor = CKEDITOR.instances[instanceName ];
1547
	    	    		let editor = CKEDITOR.instances[instanceName ];
Línea 1548... Línea 1548...
1548
	    	    		editor.setData( objFormGenerator.sections[i].questions[j].text, function() {
1548
	    	    		editor.setData( objFormGenerator.sections[i].questions[j].text, function() {
1549
	    	    		    editor.focus();
1549
	    	    		    editor.focus();
Línea 1550... Línea 1550...
1550
	    	    		});
1550
	    	    		});
1551
 
1551
 
1552
 
1552
 
Línea 1553... Línea 1553...
1553
	        			$('#form-question #question-value').val(objFormGenerator.sections[i].questions[j].value);
1553
	        			$('#question #question-value').val(objFormGenerator.sections[i].questions[j].value);
1554
	        			$('#form-question #question-type').val(objFormGenerator.sections[i].questions[j].type);
1554
	        			$('#question #question-type').val(objFormGenerator.sections[i].questions[j].type);
1555
	        			
1555
	        			
1556
	        			
1556
	        			
1557
	        
1557
	        
Línea 1558... Línea 1558...
1558
	        			if(objFormGenerator.sections[i].questions[j].type == 'open') {
1558
	        			if(objFormGenerator.sections[i].questions[j].type == 'open') {
1559
		        			$('#form-question #question-max-length').val(objFormGenerator.sections[i].questions[j].maxlength);
1559
		        			$('#question #question-max-length').val(objFormGenerator.sections[i].questions[j].maxlength);
1560
		        			$('#form-question #question-max-length').parent().show();
1560
		        			$('#question #question-max-length').parent().show();
Línea 1561... Línea 1561...
1561
		        			
1561
		        			
1562
		        			$('#form-question #question-multiline').val(objFormGenerator.sections[i].questions[j].multiline);
1562
		        			$('#question #question-multiline').val(objFormGenerator.sections[i].questions[j].multiline);
1563
							$('#form-question #question-multiline').parent().show();
1563
							$('#question #question-multiline').parent().show();
Línea 1564... Línea 1564...
1564
	        			} else {
1564
	        			} else {
1565
		        			$('#form-question #question-max-length').val('0');
1565
		        			$('#question #question-max-length').val('0');
1566
		        			$('#form-question #question-max-length').parent().hide();
1566
		        			$('#question #question-max-length').parent().hide();
1567
		        			
1567
		        			
Línea 1568... Línea 1568...
1568
		        			$('#form-question #question-multiline').val('0');
1568
		        			$('#question #question-multiline').val('0');
1569
							$('#form-question #question-multiline').parent().hide();
1569
							$('#question #question-multiline').parent().hide();
Línea 1635... Línea 1635...
1635
	    	if(slug_section == objFormGenerator.sections[i].slug) {
1635
	    	if(slug_section == objFormGenerator.sections[i].slug) {
1636
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1636
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1637
	    			if(slug_question == objFormGenerator.sections[i].questions[j].slug) {
1637
	    			if(slug_question == objFormGenerator.sections[i].questions[j].slug) {
Línea 1638... Línea 1638...
1638
 
1638
 
1639
                		validatorFormOption.resetForm();
1639
                		validatorFormOption.resetForm();
1640
                		$('#form-option #option-section').val(slug_section);
1640
                		$('#option #option-section').val(slug_section);
1641
                		$('#form-option #option-question').val(slug_question);
1641
                		$('#option #option-question').val(slug_question);
Línea 1642... Línea 1642...
1642
                		$('#form-option #option-slug').val('');
1642
                		$('#option #option-slug').val('');
1643
						
1643
						
1644
                		instanceName = 'option-text'; 
1644
                		instanceName = 'option-text'; 
1645
	    	    		let editor = CKEDITOR.instances[instanceName ];
1645
	    	    		let editor = CKEDITOR.instances[instanceName ];
1646
	    	    		editor.setData('', function() {
1646
	    	    		editor.setData('', function() {
Línea 1647... Línea 1647...
1647
	    	    		    editor.focus();
1647
	    	    		    editor.focus();
1648
	    	    		});
1648
	    	    		});
1649
 
1649
 
1650
 
1650
 
1651
	    	    		$('#form-option #option-correct').val('0');
1651
	    	    		$('#option #option-correct').val('0');
1652
                		if(objFormGenerator.sections[i].questions[j].type == 'rating-open') {
1652
                		if(objFormGenerator.sections[i].questions[j].type == 'rating-open') {
Línea 1653... Línea 1653...
1653
                    		$('#form-option #option-correct').parent().hide();
1653
                    		$('#option #option-correct').parent().hide();
1654
                        } else {
1654
                        } else {
1655
                    		$('#form-option #option-correct').parent().show();
1655
                    		$('#option #option-correct').parent().show();
1656
                        }
1656
                        }
1657
                		
1657
                		
1658
                		if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
1658
                		if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
Línea 1659... Línea 1659...
1659
                			$('#form-option #option-value').val('0');
1659
                			$('#option #option-value').val('0');
1660
                			$('#form-option #option-value').parent().show();
1660
                			$('#option #option-value').parent().show();
1661
                		} else {
1661
                		} else {
1662
                			$('#form-option #option-value').val('1');
1662
                			$('#option #option-value').val('1');
Línea 1691... Línea 1691...
1691
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1691
	    		for(j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1692
	    			if(slug_question == objFormGenerator.sections[i].questions[j].slug) {
1692
	    			if(slug_question == objFormGenerator.sections[i].questions[j].slug) {
1693
	    				for(k = 0; k < objFormGenerator.sections[i].questions[j].options.length; k++) {
1693
	    				for(k = 0; k < objFormGenerator.sections[i].questions[j].options.length; k++) {
1694
	    					if(slug == objFormGenerator.sections[i].questions[j].options[k].slug) {
1694
	    					if(slug == objFormGenerator.sections[i].questions[j].options[k].slug) {
1695
	    						validatorFormOption.resetForm();
1695
	    						validatorFormOption.resetForm();
1696
	    						$('#form-option #option-section').val(objFormGenerator.sections[i].slug);
1696
	    						$('#option #option-section').val(objFormGenerator.sections[i].slug);
1697
	    						$('#form-option #option-question').val(objFormGenerator.sections[i].questions[j].slug);
1697
	    						$('#option #option-question').val(objFormGenerator.sections[i].questions[j].slug);
1698
    		    				$('#form-option #option-slug').val(objFormGenerator.sections[i].questions[j].options[k].slug);
1698
    		    				$('#option #option-slug').val(objFormGenerator.sections[i].questions[j].options[k].slug);
Línea 1699... Línea 1699...
1699
 
1699
 
1700
    		    				instanceName = 'option-text'; 
1700
    		    				instanceName = 'option-text'; 
1701
    		    	    		let editor = CKEDITOR.instances[instanceName ];
1701
    		    	    		let editor = CKEDITOR.instances[instanceName ];
1702
    		    	    		editor.setData( objFormGenerator.sections[i].questions[j].options[k].text, function() {
1702
    		    	    		editor.setData( objFormGenerator.sections[i].questions[j].options[k].text, function() {
1703
    		    	    		    editor.focus();
1703
    		    	    		    editor.focus();
Línea 1704... Línea 1704...
1704
    		    	    		});
1704
    		    	    		});
1705
    	    		    	    		
1705
    	    		    	    		
1706
    		    				
1706
    		    				
1707
    		    				$('#form-option #option-correct').val(objFormGenerator.sections[i].questions[j].options[k].correct);
1707
    		    				$('#option #option-correct').val(objFormGenerator.sections[i].questions[j].options[k].correct);
1708
    		    				if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'simple') {
1708
    		    				if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'simple') {
1709
    		    					$('#form-option #option-correct').parent().show();
1709
    		    					$('#option #option-correct').parent().show();
Línea 1710... Línea 1710...
1710
    		    				} else {
1710
    		    				} else {
Línea 1711... Línea 1711...
1711
    		    					$('#form-option #option-correct').parent().hide();
1711
    		    					$('#option #option-correct').parent().hide();
1712
            		    		}
1712
            		    		}
1713
 
1713
 
1714
    		    				$('#form-option #option-value').val(objFormGenerator.sections[i].questions[j].options[k].value);
1714
    		    				$('#option #option-value').val(objFormGenerator.sections[i].questions[j].options[k].value);
1715
 
1715
 
Línea 1716... Línea 1716...
1716
								if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
1716
								if(objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'rating-open') {
Línea 1766... Línea 1766...
1766
				}
1766
				}
1767
			}
1767
			}
1768
		});			    
1768
		});			    
1769
	})
1769
	})
Línea 1770... Línea 1770...
1770
 
1770
 
Línea 1771... Línea 1771...
1771
	$('#form-section #section-value').inputNumberFormat({'decimal' : 2});
1771
	$('#section #section-value').inputNumberFormat({'decimal' : 2});
1772
 
1772
 
Línea 1773... Línea 1773...
1773
	$('#form-question #question-value').inputNumberFormat({'decimal' : 2});
1773
	$('#question #question-value').inputNumberFormat({'decimal' : 2});
Línea 1774... Línea 1774...
1774
	$('#form-question #question-max-length').inputNumberFormat({'decimal' : 0});
1774
	$('#question #question-max-length').inputNumberFormat({'decimal' : 0});
1775
 
1775
 
Línea 1776... Línea 1776...
1776
	$('#form-option #option-value').inputNumberFormat({'decimal' : 2});
1776
	$('#option #option-value').inputNumberFormat({'decimal' : 2});
1777
	
1777
	
1778
	$('#form-question #question-type').change(function(e) {
1778
	$('#question #question-type').change(function(e) {
Línea 1779... Línea 1779...
1779
		e.preventDefault();
1779
		e.preventDefault();
1780
		
1780
		
1781
		if($('#form-question #question-type').val() == 'open') {
1781
		if($('#question #question-type').val() == 'open') {
Línea 1782... Línea 1782...
1782
			$('#form-question #question-max-length').parent().show();
1782
			$('#question #question-max-length').parent().show();
1783
			$('#form-question #question-multiline').parent().show();
1783
			$('#question #question-multiline').parent().show();
1784
			
1784
			
Línea 1785... Línea 1785...
1785
		} else {
1785
		} else {
1786
			$('#form-question #question-max-length').val('0');
1786
			$('#question #question-max-length').val('0');
1787
			$('#form-question #question-max-length').parent().hide();
1787
			$('#question #question-max-length').parent().hide();
1788
 
1788
 
1789
			$('#form-question #question-multiline').val('0');
1789
			$('#question #question-multiline').val('0');
1790
			$('#form-question #question-multiline').parent().hide();
1790
			$('#question #question-multiline').parent().hide();
Línea 1791... Línea 1791...
1791
		}
1791
		}
Línea 1806... Línea 1806...
1806
 
1806
 
1807
		objFormGenerator.clear();
1807
		objFormGenerator.clear();
1808
		objFormGenerator.render();
1808
		objFormGenerator.render();
Línea 1809... Línea 1809...
1809
		validatorForm.resetForm();
1809
		validatorForm.resetForm();
1810
 
1810
 
1811
		$('#form-main #form-id').val('0');
1811
		$('#main #id').val('0');
Línea 1812... Línea 1812...
1812
		$('#form-main #form-continue').val('0');
1812
		$('#main #continue').val('0');
1813
		$('#form-main #form-name').val('');
1813
		$('#main #name').val('');
1814
 
1814
 
1815
		instanceName = 'form-text'; 
1815
		instanceName = 'form-text'; 
Línea 1820... Línea 1820...
1820
 
1820
 
1821
 
1821
 
Línea 1822... Línea 1822...
1822
		instanceName = 'form-description'; 
1822
		instanceName = 'form-description'; 
1823
		CKEDITOR.instances[instanceName ].setData('');
1823
		CKEDITOR.instances[instanceName ].setData('');
Línea 1824... Línea 1824...
1824
		
1824
		
1825
		$('#form-main #form-language' ).val('$lang_es'),
1825
		$('#main #language' ).val('$lang_es'),
1826
		$('#form-main #form-status' ).val('$status_inactive');
1826
		$('#main #status' ).val('$status_inactive');
Línea 1827... Línea 1827...
1827
		
1827
		
Línea 1828... Línea 1828...
1828
		$('#row-forms').hide();
1828
		$('#row-forms').hide();
1829
		$('#row-edit').show();
1829
		$('#row-edit').show();
Línea 1839... Línea 1839...
1839
	});
1839
	});
Línea 1840... Línea 1840...
1840
 
1840
 
1841
 
1841
 
1842
	$('button.btn-form-save-continue').click(function(e) {
1842
	$('button.btn-form-save-continue').click(function(e) {
1843
		e.preventDefault();
1843
		e.preventDefault();
1844
		$('#form-main #form-continue').val('1')
1844
		$('#main #continue').val('1')
Línea 1845... Línea 1845...
1845
		$('#form-main').submit();
1845
		$('#main').submit();
1846
	});
1846
	});
1847
	
1847
	
1848
	$('button.btn-form-save-close').click(function(e) {
1848
	$('button.btn-form-save-close').click(function(e) {
Línea 1849... Línea 1849...
1849
		e.preventDefault();
1849
		e.preventDefault();
Línea 1850... Línea 1850...
1850
		$('#form-main #form-continue').val('0')
1850
		$('#main #continue').val('0')
1851
		$('#form-main').submit();
1851
		$('#main').submit();
Línea 1882... Línea 1882...
1882
        content: "\f078";    /* adjust as needed, taken from bootstrap.css */
1882
        content: "\f078";    /* adjust as needed, taken from bootstrap.css */
1883
    }
1883
    }
1884
</style>
1884
</style>
Línea 1885... Línea 1885...
1885
 
1885
 
1886
<script id="formTmpl" type="text/x-jsrender">
1886
<script id="formTmpl" type="text/x-jsrender">
1887
                                <tr>
1887
<tr>
1888
                                    <td>{{:name}}</td>
1888
   <td>{{:name}}</td>
1889
                                    <td>{{:language}}</td>
1889
   <td>{{:language}}</td>
1890
                                    <td>
1890
   <td>
1891
									<div class="checkbox checkbox-success">
1891
      <div class="checkbox checkbox-success">
1892
									{{if(status =='a' )}}
1892
         {{if status =='a' }}
1893
											<input class="styled" type="checkbox" checked="checked" disabled="disabled">
1893
         <input class="styled" type="checkbox" checked="checked" disabled="disabled">
1894
											{{/if}}
-
 
1895
 
1894
         {{/if}}
1896
											{{if (status !='a' )}}
1895
         {{if status !='a' }}
1897
											<input class="styled" type="checkbox"  disabled="disabled">
1896
         <input class="styled" type="checkbox"  disabled="disabled">
1898
											{{/if}}
-
 
1899
 
1897
         {{/if}}
1900
											<label></label>
1898
         <label></label>
1901
										</div>
1899
      </div>
1902
									</td>
1900
   </td>
1903
                                    <td>
1901
   <td>
1904
									{{if (allowEdit)}}
1902
      {{if allowEdit }}
1905
										<button class="btn btn-primary btn-edit-form" data-href="{{:actions.link_edit}}" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>
1903
      <button class="btn btn-primary btn-edit-form" data-href="{{:actions.link_edit}}" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>
1906
										{{/if}}
1904
      {{/if}}
1907
										{{if(allowDelete)}}
1905
      {{if allowDelete}}
1908
										<button class="btn btn-danger btn-delete" data-href="{{:actions.link_delete}}" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>
1906
      <button class="btn btn-danger btn-delete" data-href="{{:actions.link_delete}}" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>
1909
										{{/if}}
1907
      {{/if}}
1910
									</td>
1908
   </td>
1911
</tr>
1909
</tr>
Línea 1912... Línea 1910...
1912
                            </script>
1910
</script>
1913
 
1911
 
1914
<!-- Content Header (Page header) -->
1912
<!-- Content Header (Page header) -->
1915
<section class="content-header">
1913
<section class="content-header">