<?php $__env->startSection("content"); ?>
	<div>
		<ol class="breadcrumb">
		  <li><a href="<?php echo e(URL::route('user.home')); ?>"><?php echo trans('messages.home'); ?> </a></li>
		  <li><a href="<?php echo URL::route('user.index'); ?>"><?php echo Lang::choice('messages.user',1); ?></a></li>
		  <li class="active"><?php echo trans('messages.edit-user'); ?></li>
		</ol>
	</div>
	<div class="panel panel-default">
		<div class="panel-heading ">
			<span class="glyphicon glyphicon-edit"></span>
			<?php echo trans('messages.edit-user-details'); ?>

		</div>
		<div class="panel-body
			<?php echo (Auth::id() == $user->id || !Entrust::hasRole(Role::getAdminRole()->name)) ? 'user-profile': ''; ?>">
			<?php if($errors->all()): ?>
				<div class="alert alert-danger">
					<?php echo HTML::ul($errors->all()); ?>

				</div>
			<?php endif; ?>

			<div class="container-fluid">
				<div class="row">
					<div class="col-md-12">
						<!-- For Users to edit their own profiles -->
						<?php if(Auth::id() == $user->id || !Entrust::hasRole(Role::getAdminRole()->name)): ?>
						<ul class="nav nav-tabs" role="tablist">
							<li class="active">
								<a href="#edit-profile" role="tab" data-toggle="tab">
									<?php echo trans('messages.edit-profile'); ?></a></li>
							<li>
								<a href="#change-password" role="tab" data-toggle="tab">
									<?php echo trans('messages.change-password'); ?></a></li>
						</ul>
						<br />
						<?php endif; ?>
						<div class="tab-content">
							<div class="tab-pane fade in active" id="edit-profile">
								<?php echo Form::model($user, array(
									'route' => array('user.update', $user->id),
									'method' => 'PUT', 'role' => 'form', 'files' => true,
									'id' => 'form-edit-user'
								 )); ?>

								<div class="container-fluid">
									<div class="row">
										<div class="col-md-8">
											<div class="form-group">
												<?php echo Form::label('username', trans('messages.username')); ?>

												<?php echo Form::text('username', $user->username, ['class' => 'form-control']); ?>

											</div>
											<div class="form-group">
												<?php echo Form::label('full_name', trans('messages.full-name')); ?>

												<?php echo Form::text('full_name', $user->name, ["placeholder" => "",
													'class' => 'form-control']); ?>

											</div>
											<div class="form-group">
												<?php echo Form::label('email', trans('messages.email-address')); ?>

												<?php echo Form::email('email', Input::old('email'),
													["placeholder" => "",
													'class' => 'form-control']); ?>

											</div>
											<div class="form-group">
												<?php echo Form::label('designation', trans('messages.designation')); ?>

												<?php echo Form::text('designation', Input::old('designation'),
													["placeholder" => "Lab Technologist", 'class' => 'form-control']); ?>

											</div>
											<div class="form-group">
												<label for="age">Sex</label>
												<select name="gender" id="gender" class="form-control input-sm">
													<option value="1" disabled selected>Select user gender......</option>
													<option value="male">Male</option>
													<option value="female">Female</option>
												</select>
											</div>
											<?php if(Auth::id() != $user->id && Entrust::hasRole(Role::getAdminRole()->name)): ?>
												<!-- For the administrator to reset other users' passwords -->
								                <div class="form-group">
								                	<label for="reset-password"><a class="reset-password"
								                		href="javascript:void(0)"><?php echo trans('messages.reset-password'); ?>

								                		</label></a>
													<?php echo Form::password('reset-password',
														['class' => 'form-control reset-password hidden']); ?>

								                </div>
							                <?php endif; ?>
							                <div class="form-group actions-row">
												<?php echo Form::button('<span class="glyphicon glyphicon-save"></span> '.
													trans('messages.update'),
													['class' => 'btn btn-primary', 'onclick' => 'submit()']); ?>

											</div>
							            </div>
										<div class="col-md-4">
											<div class="profile-photo">
								                <div class="form-group">
								                	<?php echo Form::label('image', trans('messages.photo')); ?>

								                    <?php echo Form::file("image"); ?>

								                </div>
								                <div class="form-group">
								                	<img class="img-responsive img-thumbnail user-image"
								                		src="<?php echo $user->image; ?>"
								                		alt="<?php echo trans('messages.image-alternative'); ?>"></img>
								                </div>
											</div>
							            </div>
						            </div>
					            </div>
								<?php echo Form::close(); ?>

				            </div>
							<!-- For users to edit their own passwords -->
							<div class="tab-pane fade" id="change-password">
								<?php echo Form::open(array('route' => array('user.updateOwnPassword', $user->id),
									 'id' => 'form-edit-password', 'method' => 'PUT')); ?>

								<div class="form-group">
									<?php echo Form::label('current_password', trans('messages.current-password')); ?>

									<?php echo Form::password('current_password', ['class' => 'form-control']); ?>

									<span class="curr-pwd-empty hidden" ><?php echo trans('messages.field-required'); ?></span>
								</div>
								<div class="form-group">
									<?php echo Form::label('new_password', trans('messages.new-password')); ?>

									<?php echo Form::password('new_password', ['class' => 'form-control']); ?>

									<span class="new-pwd-empty hidden" ><?php echo trans('messages.field-required'); ?></span>
								</div>
								<div class="form-group">
									<?php echo Form::label('new_password_confirmation', trans('messages.repeat-password')); ?>

									<?php echo Form::password('new_password_confirmation', ['class' => 'form-control']); ?>

									<span class="new-pwdrepeat-empty hidden" ><?php echo trans('messages.field-required'); ?></span>
									<span class="new-pwdmatch-error hidden" ><?php echo trans('messages.password-mismatch'); ?></span>
								</div>
								<div class="form-group actions-row">
									<a class="btn btn-primary update-reset-password" href="javascript:void(0);">
										<span class="glyphicon glyphicon-save"></span><?php echo trans('messages.update'); ?>

									</a>
								</div>
								<?php echo Form::close(); ?>

							</div>
			            </div>
					</div>
		        </div>
			</div>
		</div>
	</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make("layout", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>