forked from Coded/SIPRP
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							167 lines
						
					
					
						
							4.6 KiB
						
					
					
				
			
		
		
	
	
							167 lines
						
					
					
						
							4.6 KiB
						
					
					
				$( window ).load(function( )
 | 
						|
{
 | 
						|
	$( "#dashboard-form" ).validate(
 | 
						|
	{
 | 
						|
		rules :
 | 
						|
		{
 | 
						|
			fullname :
 | 
						|
			{
 | 
						|
				required : true
 | 
						|
			},
 | 
						|
			password :
 | 
						|
			{
 | 
						|
				required : true,
 | 
						|
				minlength : 5,
 | 
						|
				alphanumeric : true,
 | 
						|
				nowhitespace : true
 | 
						|
			},
 | 
						|
			email :
 | 
						|
			{
 | 
						|
				required : true,
 | 
						|
				email : true
 | 
						|
			}
 | 
						|
		},
 | 
						|
		submitHandler : function( form )
 | 
						|
		{
 | 
						|
			form.submit( );
 | 
						|
		},
 | 
						|
		focusCleanup : true,
 | 
						|
		messages :
 | 
						|
		{
 | 
						|
			fullname :
 | 
						|
			{
 | 
						|
				required : "Por favor introduza o seu nome completo."
 | 
						|
			},
 | 
						|
			password :
 | 
						|
			{
 | 
						|
				required : "Por favor introduza a sua nova palavra passe de utilizador.",
 | 
						|
				minlength : "Por favor introduza uma palavra passe com no mínimo cinco caracteres.",
 | 
						|
				alphanumeric : "Por favor introduza uma palavra passe utilizando apenas números ou letras.",
 | 
						|
				nowhitespace : "Por favor introduza uma palavra passe sem espaços."
 | 
						|
			},
 | 
						|
			email :
 | 
						|
			{
 | 
						|
				email : "Por favor introduza um email válido."
 | 
						|
			}
 | 
						|
		},
 | 
						|
		highlight : function( element )
 | 
						|
		{
 | 
						|
			$( element ).closest( '.form-group' ).addClass( 'has-error' );
 | 
						|
		},
 | 
						|
		unhighlight : function( element )
 | 
						|
		{
 | 
						|
			$( element ).closest( '.form-group' ).removeClass( 'has-error' );
 | 
						|
		},
 | 
						|
		errorElement : 'span',
 | 
						|
		errorClass : 'help-block',
 | 
						|
		errorPlacement : function( error, element )
 | 
						|
		{
 | 
						|
			if( element.parent( '.input-group' ).length )
 | 
						|
			{
 | 
						|
				error.insertAfter( element.parent( ) );
 | 
						|
			}
 | 
						|
			else
 | 
						|
			{
 | 
						|
				error.insertAfter( element );
 | 
						|
			}
 | 
						|
		}
 | 
						|
	} );
 | 
						|
 | 
						|
	$( "#telephone-group" ).click( function( )
 | 
						|
	{
 | 
						|
			$( "#info-phone" ).attr( "title", "Insira o novo número de telefone de contacto do utilizador." );
 | 
						|
			$( "#telephone" ).removeAttr( "readonly" );
 | 
						|
			var value = $( "#hiddenfield" ).attr( "value" ).concat( ",telephone" );
 | 
						|
			$( "#hiddenfield" ).attr( "value", value );
 | 
						|
	} );
 | 
						|
	$( "#email-group" ).click( function( )
 | 
						|
	{
 | 
						|
			$( "#info-email" ).attr( "title", "Insira o novo email do utilizador." );
 | 
						|
			$( "#email" ).removeAttr( "readonly" );
 | 
						|
			var value = $( "#hiddenfield" ).attr( "value" ).concat( ",email" );
 | 
						|
			$( "#hiddenfield" ).attr( "value", value );
 | 
						|
	} );
 | 
						|
	$( "#fullname-group" ).click( function( )
 | 
						|
	{
 | 
						|
			$( "#info-fullname" ).attr( "title", "Insira o novo nome completo do utilizador." );
 | 
						|
			$( "#fullname" ).removeAttr( "readonly" );
 | 
						|
			var value = $( "#hiddenfield" ).attr( "value" ).concat( ",fullname" );
 | 
						|
			$( "#hiddenfield" ).attr( "value", value );
 | 
						|
	} );
 | 
						|
	$( "#password-group" ).click(function( )
 | 
						|
	{
 | 
						|
		$( "#info-password" ).attr("title", 
 | 
						|
				"Insira a nova palavra passe do utilizador, com no mínimo cinco caracteres e utilizando apenas números ou letras sem espaços." );
 | 
						|
			$( "#password" ).removeAttr( "readonly" );
 | 
						|
			var value = $( "#hiddenfield" ).attr( "value" ).concat( ",password" );
 | 
						|
			$( "#hiddenfield" ).attr( "value", value );
 | 
						|
	} );
 | 
						|
	$( "#telephone" ).change(function( )
 | 
						|
	{
 | 
						|
		if( ( $( "#submit-button" ).attr( "disabled" ) !== undefined ) )
 | 
						|
		{
 | 
						|
			$( "#submit-button" ).removeAttr( "disabled" );
 | 
						|
		}
 | 
						|
	} );
 | 
						|
	$( "#email" ).change(function( )
 | 
						|
	{
 | 
						|
		if( ( $( "#submit-button" ).attr( "disabled" ) !== undefined ) )
 | 
						|
		{
 | 
						|
			$( "#submit-button" ).removeAttr( "disabled" );
 | 
						|
		}
 | 
						|
	} );
 | 
						|
	$( "#fullname" ).change(function( )
 | 
						|
	{
 | 
						|
		if( ( $( "#submit-button" ).attr( "disabled" ) !== undefined ) )
 | 
						|
		{
 | 
						|
			$( "#submit-button" ).removeAttr( "disabled" );
 | 
						|
		}
 | 
						|
	} );
 | 
						|
	$( "#password" ).change(function( )
 | 
						|
	{
 | 
						|
		if( ( $( "#submit-button" ).attr( "disabled" ) !== undefined ) )
 | 
						|
		{
 | 
						|
			$( "#submit-button" ).removeAttr( "disabled" );
 | 
						|
		}
 | 
						|
	} );
 | 
						|
	$( "#admin" ).change(function( )
 | 
						|
	{
 | 
						|
		if( ( $( "#submit-button" ).attr( "disabled" ) !== undefined ) )
 | 
						|
		{
 | 
						|
			$( "#submit-button" ).removeAttr( "disabled" );
 | 
						|
		}
 | 
						|
		if( $( "#admin" )[ 0 ].checked )
 | 
						|
		{
 | 
						|
			$( "#editor" ).removeAttr( "disabled" );
 | 
						|
			$( "#editor" )[ 0 ].checked = true;
 | 
						|
		}
 | 
						|
	} );
 | 
						|
	$( "#admin-group" ).click( function( )
 | 
						|
	{
 | 
						|
			$( "#admin" ).removeAttr( "disabled" );
 | 
						|
			$( "#info-admin" ).attr( "title", "Preencha o campo se o utilizador deve de ser administrador." );
 | 
						|
			var value = $( "#hiddenfield" ).attr( "value" ).concat( ",admin" );
 | 
						|
			$( "#hiddenfield" ).attr( "value", value );
 | 
						|
	} );
 | 
						|
	
 | 
						|
	$( "#editor" ).change(function( )
 | 
						|
	{
 | 
						|
		if( ( $( "#submit-button" ).attr( "disabled" ) !== undefined ) )
 | 
						|
		{
 | 
						|
			$( "#submit-button" ).removeAttr( "disabled" );
 | 
						|
		}
 | 
						|
		if( !$( "#editor" )[ 0 ].checked )
 | 
						|
		{
 | 
						|
			$( "#admin" ).removeAttr( "disabled" );
 | 
						|
			$( "#admin" )[ 0 ].checked = false;
 | 
						|
		}
 | 
						|
	} );
 | 
						|
	$( "#editor-group" ).click(function( )
 | 
						|
	{
 | 
						|
			$( "#editor" ).removeAttr( "disabled" );
 | 
						|
			$( "#info-editor" ).attr( "title", 
 | 
						|
					"Preencha o campo se o utilizador pode editar a legislação." );
 | 
						|
			var value = $( "#hiddenfield" ).attr( "value" ).concat( ",editor" );
 | 
						|
			$( "#hiddenfield" ).attr( "value", value );
 | 
						|
	} );
 | 
						|
} ); |