Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 107 Rev 108
Línea 649... Línea 649...
649
    });
649
    });
Línea 650... Línea 650...
650
 
650
 
Línea 651... Línea 651...
651
    $(document).on('click','[data-action="delete"]',function(){
651
    $(document).on('click','[data-action="delete"]',function(){
652
 
652
 
653
    	bootbox.confirm({
653
    	bootbox.confirm({
654
		    title: "Delete Forms",
654
		    title: "LABEL_DELETE LABEL_FORMS_2",
655
		    message: "Are you sure?",
655
		    message: "LABEL_ARE_YOU_SURE",
656
		    buttons: {
656
		    buttons: {
657
		        cancel: {
657
		        cancel: {
658
		            label: '<i class="fa fa-times"></i> Cancel'
658
		            label: '<i class="fa fa-times"></i> LABEL_CANCEL'
659
		        },
659
		        },
660
		        confirm: {
660
		        confirm: {
661
		            label: '<i class="fa fa-check"></i> Confirm'
661
		            label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
662
		        }
662
		        }
663
		    },
663
		    },
664
		    callback: function (result) {
664
		    callback: function (result) {
Línea 881... Línea 881...
881
		    	
881
		    	
882
		    	for(i = 0; i < objFormGenerator.sections.length; i++) 
882
		    	for(i = 0; i < objFormGenerator.sections.length; i++) 
Línea 883... Línea 883...
883
		    	{
883
		    	{
884
		    		
884
		    		
885
		    		if(objFormGenerator.sections[i].questions.length == 0) {
885
		    		if(objFormGenerator.sections[i].questions.length == 0) {
886
		    			$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section has no questions');
886
		    			$.fn.showError('El "' + objFormGenerator.sections[i].name + '" no tiene preguntas');
Línea 887... Línea 887...
887
		    			break;
887
		    			break;
888
		    		}
888
		    		}
Línea 902... Línea 902...
902
		    				var questionNumber = j + 1;
902
		    				var questionNumber = j + 1;
903
		    				var numberCorrect = 0;
903
		    				var numberCorrect = 0;
Línea 904... Línea 904...
904
		    				
904
		    				
905
		    				
905
		    				
906
		    				if(objFormGenerator.sections[i].questions[j].options.length == 0) {
906
		    				if(objFormGenerator.sections[i].questions[j].options.length == 0) {
907
		    					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + ' has no options');
907
		    					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' no tiene opciones');
908
								error = true;
908
									error = true;
Línea 909... Línea 909...
909
								break;
909
									break;
910
		    				}
910
		    				}
Línea 924... Línea 924...
924
		    						totalOption = totalOption + parseInt(objFormGenerator.sections[i].questions[j].options[k].value);
924
		    						totalOption = totalOption + parseInt(objFormGenerator.sections[i].questions[j].options[k].value);
925
			    				}
925
			    				}
Línea 926... Línea 926...
926
 
926
 
927
		    					if(objFormGenerator.sections[i].questions[j].type == 'rating-open') {
927
		    					if(objFormGenerator.sections[i].questions[j].type == 'rating-open') {
928
		    						if(parseInt(objFormGenerator.sections[i].questions[j].options[k].value) > maxOption) {
928
		    						if(parseInt(objFormGenerator.sections[i].questions[j].options[k].value) > maxOption) {
929
										maxOption = parseInt(objFormGenerator.sections[i].questions[j].options[k].value);
929
											maxOption = parseInt(objFormGenerator.sections[i].questions[j].options[k].value);
930
					    			}
930
					    			}
Línea 931... Línea 931...
931
			    				}
931
			    				}
Línea 932... Línea 932...
932
			    				
932
			    				
Línea 933... Línea 933...
933
		    				}
933
		    				}
934
 
934
 
935
		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple' ) {
935
		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' || objFormGenerator.sections[i].questions[j].type == 'multiple' ) {
936
		    				
936
		    				
937
    		    				if(numberCorrect == 0) {
937
    		    				if(numberCorrect == 0) {
938
    		    					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + '  has no correct option');
938
    		    					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' no tiene una opcion correcta');
939
    		    					error = true;
939
    		    					error = true;
940
    		    					break;
940
    		    					break;
941
    		    				}
941
    		    				}
942
    		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' && numberCorrect > 1) {
942
    		    				if(objFormGenerator.sections[i].questions[j].type == 'simple' && numberCorrect > 1) {
943
    		    					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + '   has more than one correct option');
943
    		    					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' tiene más de una opción correcta');
944
    		    					error = true;
944
    		    					error = true;
945
    		    					break;
945
    		    					break;
946
    		    				}
946
    		    				}
947
    		    				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
947
    		    				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && numberCorrect == 1) {
948
    		    					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + '    has only one correct option');
948
    		    					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' solo tiene una opción correcta');
Línea 949... Línea 949...
949
    		    					error = true;
949
    		    					error = true;
Línea 950... Línea 950...
950
    		    					break;
950
    		    					break;
951
    		    				}
951
    		    				}
952
		    				}
952
		    				}
953
 
953
 
954
			    			//console.log('totalOption = ' + totalOption + ' valueQuestion = ' + valueQuestion );
954
			    			//console.log('totalOption = ' + totalOption + ' valueQuestion = ' + valueQuestion );
Línea 955... Línea 955...
955
			    			
955
			    			
Línea 956... Línea 956...
956
			 				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption > valueQuestion ) {
956
			 				if(objFormGenerator.sections[i].questions[j].type == 'multiple' && totalOption > valueQuestion ) {
957
		     					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + ' the sum of the values of the options is greater than the value of the question');
957
		     					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' la suma de los valores de las opciones es mayor que el valor de la pregunta');
958
		    					error = true;
958
		    					error = true;
959
		    					break;
959
		    					break;
960
			    			}
960
			    			}
961
 
961
 
Línea 962... Línea 962...
962
							//console.log('maxOption = ' + maxOption + ' valueQuestion = ' + valueQuestion );
962
							//console.log('maxOption = ' + maxOption + ' valueQuestion = ' + valueQuestion );
Línea 963... Línea 963...
963
			    			
963
			    			
964
		    				if(objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion ) {
964
		    				if(objFormGenerator.sections[i].questions[j].type == 'rating-open' && maxOption > valueQuestion ) {
965
		     					$.fn.showError('The "' + objFormGenerator.sections[i].name + '" section, questions #' + questionNumber + ' the value of an option is greater than the value of the question');
965
		     					$.fn.showError('El "' + objFormGenerator.sections[i].name + '" seccion, La pregunta #' + questionNumber + ' ');
966
		    					error = true;
966
		    					error = true;
967
		    					break;
967
		    					break;
968
			    			}
968
			    			}
Línea 1348... Línea 1348...
1348
	$('body').on('click', 'button.btn-delete-section', function(e){
1348
	$('body').on('click', 'button.btn-delete-section', function(e){
1349
		e.preventDefault();
1349
		e.preventDefault();
1350
		var slug = $(this).data('slug');
1350
		var slug = $(this).data('slug');
Línea 1351... Línea 1351...
1351
 
1351
 
1352
		bootbox.confirm({
1352
		bootbox.confirm({
1353
		    title: "Delete Section?",
1353
		    title: "LABEL_DELETE LABEL_SECTION?",
1354
		    message: "Are you sure?",
1354
		    message: "LABEL_ARE_YOU_SURE",
1355
		    buttons: {
1355
		    buttons: {
1356
		        cancel: {
1356
		        cancel: {
1357
		            label: '<i class="fa fa-times"></i> Cancel'
1357
		            label: '<i class="fa fa-times"></i> LABEL_CANCEL'
1358
		        },
1358
		        },
1359
		        confirm: {
1359
		        confirm: {
1360
		            label: '<i class="fa fa-check"></i> Confirm'
1360
		            label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
1361
		        }
1361
		        }
1362
		    },
1362
		    },
1363
		    callback: function (result) {
1363
		    callback: function (result) {
1364
		    	if (result) {
1364
		    	if (result) {
Línea 1471... Línea 1471...
1471
	    		break;
1471
	    		break;
1472
	    	}
1472
	    	}
1473
	    }
1473
	    }
Línea 1474... Línea 1474...
1474
	    
1474
	    
1475
	    if(showForm) {
1475
	    if(showForm) {
1476
	    	$('#modal-question h4[class="modal-title"]').html('Edit Question');
1476
	    	$('#modal-question h4[class="modal-title"]').html('LABEL_EDIT LABEL_QUESTION');
1477
			$('#modal-question').modal('show');
1477
				$('#modal-question').modal('show');
Línea 1478... Línea 1478...
1478
	    }
1478
	    }
Línea 1487... Línea 1487...
1487
		
1487
		
1488
		var slug_section	= $(this).data('section');
1488
		var slug_section	= $(this).data('section');
Línea 1489... Línea 1489...
1489
		var slug 			= $(this).data('slug');
1489
		var slug 			= $(this).data('slug');
1490
 
1490
 
1491
		bootbox.confirm({
1491
		bootbox.confirm({
1492
			title: "Delete Question?",
1492
			title: "LABEL_DELETE LABEL_QUESTION?",
1493
			message: "Are you sure?",
1493
			message: "LABEL_ARE_YOU_SURE",
1494
			buttons: {
1494
			buttons: {
1495
				cancel: {
1495
				cancel: {
1496
   					label: '<i class="fa fa-times"></i> Cancel'
1496
   					label: '<i class="fa fa-times"></i> LABEL_CANCEL'
1497
    			},
1497
    			},
1498
			    confirm: {
1498
			    confirm: {
1499
			    	label: '<i class="fa fa-check"></i> Confirm'
1499
			    	label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
1500
			    }
1500
			    }
1501
			},
1501
			},
1502
			callback: function (result) {
1502
			callback: function (result) {
Línea 1618... Línea 1618...
1618
    			break;
1618
    			break;
1619
    		}
1619
    		}
1620
	    }
1620
	    }
Línea 1621... Línea 1621...
1621
	    
1621
	    
1622
	    if(showForm) {
1622
	    if(showForm) {
1623
	    	$('#modal-option h4[class="modal-title"]').html('Edit Option');
1623
	    	$('#modal-option h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
1624
			$('#modal-option').modal('show');
1624
				$('#modal-option').modal('show');
1625
	    }
1625
	    }
Línea 1626... Línea 1626...
1626
	});
1626
	});
1627
	
1627
	
Línea 1631... Línea 1631...
1631
		var slug_question	= $(this).data('question');
1631
		var slug_question	= $(this).data('question');
1632
		    var slug 			= $(this).data('slug');
1632
		    var slug 			= $(this).data('slug');
Línea 1633... Línea 1633...
1633
 
1633
 
1634
 
1634
 
1635
		bootbox.confirm({
1635
		bootbox.confirm({
1636
			title: "Delete Option?",
1636
			title: "LABEL_DELETE LABEL_OPTION?",
1637
			message: "Are you sure?",
1637
			message: "LABEL_ARE_YOU_SURE",
1638
			buttons: {
1638
			buttons: {
1639
				cancel: {
1639
				cancel: {
1640
	   				label: '<i class="fa fa-times"></i> Cancel'
1640
	   				label: '<i class="fa fa-times"></i> LABEL_CANCEL'
1641
	    		},
1641
	    		},
1642
				confirm: {
1642
				confirm: {
1643
					label: '<i class="fa fa-check"></i> Confirm'
1643
					label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
1644
				}
1644
				}
1645
			},
1645
			},
1646
			callback: function (result) {
1646
			callback: function (result) {
Línea 1737... Línea 1737...
1737
		$('#form-main').submit();
1737
		$('#form-main').submit();
Línea 1738... Línea 1738...
1738
		
1738
		
Línea 1739... Línea 1739...
1739
	});
1739
	});
1740
 
1740
 
1741
	$('#modal-section, #modal-question, #modal-option').modal({
1741
	$('#modal-section, #modal-question, #modal-option').modal({
1742
	    backdrop: 'static',
1742
			backdrop: 'static',
-
 
1743
			keyboard: false,
1743
	    keyboard: false,
1744
			show: false
1744
	    show: false
-
 
1745
	});
1745
		});
1746
    });
1746
	});
1747
JS;
1747
JS;
1748
$this->inlineScript()->captureEnd();
1748
$this->inlineScript()->captureEnd();
1749
?>
1749
?>