@extends('dashboard::master')
{{--
    Autor: Giovanni López O.
    @gmlo_89
--}}
@section('head')
	
@stop

@section('content')
	<header>
		<h1 class="module-title"><span class="glyphicon glyphicon-user"></span>{{ $user->name }} <small>{{ trans('users::label.change_password') }}</small></h1>
    </header>
    {{ Alert::render() }}
    <div class="row btn-bar">
    	@if(isset($myPassword))
    		<div class="btn-group pull-left">
				<a href="{{ url('admin/users/my-profile') }}" class="btn btn-default">{{ trans('dashboard::label.go_back') }}</a>
			</div>
    	@else
    		<div class="btn-group pull-left">
				<a href="{{ url('admin/users/edit/'.$user->id) }}" class="btn btn-default">{{ trans('dashboard::label.go_back') }}</a>
			</div>
		@endif
		<button tyle="button" id="btn-submit" class="btn btn-info pull-right">{{ trans('dashboard::label.save') }}</button>
    </div>
   
    {{ Form::model($user, $formOptions) }}
	    <div class="row">
			<div class="col-md-8 col-md-offset-2">
			    <div class="panel panel-default">
					<div class="panel-heading"><span class="glyphicon glyphicon-lock"></span> {{ trans('users::label.access_info') }}</div>
					
					<div class="panel-body">
						<div class="form-group">
			    			<label for="inputUsername" class="col-md-3 control-label">{{ trans('users::label.username') }}</label>
			    			<div class="col-md-9">
			    				{{ Form::text('username', null, 
									array(
										"class" 		=> "form-control required",
										"id" 			=> "inputUsername",
										"placeholder"	=> trans('users::label.username'),
										"readonly"		=> "readonly",
										"disabled"		=> "disabled"
								)) }}
			    			</div>
			    		</div>
			    		<div class="form-group">
			    			<label for="password" class="col-md-3 control-label">{{ trans('users::label.password') }}</label>
			    			<div class="col-md-9">
			    				{{ Form::password('password',
									array(
										"class" 		=> "form-control required",
										"id" 			=> "password"
								)) }}
			    			</div>
			    		</div>
			    		<div class="form-group">
			    			<label for="password_confirmation" class="col-md-3 control-label">{{ trans('users::label.password_confirmation') }}</label>
			    			<div class="col-md-9">
			    				{{ Form::password('password_confirmation',
									array(
										"class" 		=> "form-control required",
										"id" 			=> "password_confirmation"
								)) }}
			    			</div>
			    		</div>
			    		
					</div>
			    </div>
			</div>
		</div>
	</form>
@stop

@section('scripts')
	<script>
		$('#frmPrincipal').validate({
			rules: {
				password: {
					required: true,
					minlength: 6
				},
				password_confirmation: {
					equalTo: "#password"
				}
			}
		});

		$('#btn-submit').click(function(event) {
			$('#frmPrincipal').submit();
		});
	</script>
@stop