<div class="col-lg-12 col-md-12 col-sm-12">
	<form method="POST" name="form_user" id="formedit" enctype="multipart/form-data">
		<div class="row">
			<div class="col-lg-9 col-xs-8">
				<h1><a href="/<?php echo $folder; ?>/users"><i class="fa fa-fw fa-angle-double-left" aria-hidden="true" title="Вернуться к списку"></i></a> 
				<?php if(isset($_GET['new'])) {?>Добавление <span class="hidden-xs">сотрудника</span><?php } ?>
				<?php if(isset($_GET['edit'])) {?>Редактирование <span class="hidden-xs">сотрудника</span><?php } ?>
				</h1>
			</div>
			<div class="col-lg-3 col-xs-4">
				<div class="btn-group btn-fixed" style="float:right;">
					<?php if(isset($_GET['new'])) {?>
					<button type="submit" name="UserAdd" class="btn btn-md btn-info" style="color:#fff;"><span class="hidden-lg hidden-md hidden-sm"><i class="fa fa-fw fa-plus" aria-hidden="true"></i></span><span class="hidden-xs">Добавить</span></button>
					<?php } ?>
					<?php if(isset($_GET['edit'])) {?>
					<a href="/<?php echo $folder; ?>/users/?view=<?php echo $UserId; ?>" class="btn btn-md btn-default"><span class="hidden-lg hidden-md hidden-sm"><i class="fa fa-fw fa-eye" aria-hidden="true"></i></span><span class="hidden-xs">Просмотр</span></a>
					<button type="submit" name="UserEdit" class="btn btn-md btn-info" style="color:#fff;"><span class="hidden-lg hidden-md hidden-sm"><i class="fa fa-fw fa-save" aria-hidden="true"></i></span><span class="hidden-xs">Сохранить</span></button>
					<?php } ?>
				</div>
			</div>	
		</div>




	<div class="row">
		<div class="col-lg-3">
			<?php 
			if(isset($_GET['new'])) {
				echo '<div class="big-photo empty satur50" style="background:#555a68;"><i class="fa fa-fw fa-user" aria-hidden="true"></i></div>';
			} else {
				if(file_exists('./crmdata/upload/_user-photo/' . $UserPhoto) and $UserPhoto != ''){
					echo '<div class="big-photo" style="background:url(\'/'. $folder . '/crmdata/upload/_user-photo/' . $UserPhoto . '?'.rand(1,1000).'\') center center;"><img id="qrImage" src=""/></div>';
				} else {
					echo '<div class="big-photo empty satur50" style="background:' . get_color2($Uinitials) . ';">' . $Uinitials . '</div>';
				}
			}
			?>
		</div>
		<div class="col-lg-9">
				<div class="row">
					<div class="form-group col-lg-6">
						<div class="input-group">
							<span class="input-group-addon" title="Логин"><i class="fa fa-fw fa-user" aria-hidden="true"></i></span>
							<input type="text" class="form-control" name="inputLogin" placeholder="Логин" value="<?php if(isset($Login)){echo $Login;} ?>" maxlength="150" readonly onfocus="this.removeAttribute('readonly')" required>
							<?php if(isset($_GET['edit'])) {?>
							<span class="input-group-btn">
								<?php if(isset($UserPhoto) AND $UserPhoto != ''){ ?> 
									<button type="submit" name="DelPhoto" class="btn btn-md btn-danger" style="color:#fff;" title="Удалить фото"><i class="fa fa-times"></i> Фото</button>
								<?php } else { ?>
									<span class="btn btn-default btn-file" title="Выбрать фото | JPG | PNG | GIF">
										<i class="fa fa-camera fa-fw"></i> Выбрать фото
										<input type="file" name="inputFile">
										<select class="hide" name="file_type">
											<option value="1" selected>Эскиз</option>
											<option value="2">Оригинал</option>
										</select>
										<input class="hide" type="text" name="file_rotate" value=""/>
									</span>
								<?php } ?>
							</span>
							<?php } ?>
						</div>
						<input type="text" class="hide" name="inputPhoto" value="<?php if(isset($UserPhoto)){echo $UserPhoto;} ?>"/>
					</div>
					<div class="form-group col-lg-3">
						<div class="input-group">
							<span class="input-group-addon" title="Текущий пароль"><i class="fa fa-fw fa-unlock-alt" aria-hidden="true"></i></span>
							<input type="password" class="form-control" name="inputPassword" placeholder="Текущий пароль" value="<?php if(isset($Password)){echo $Password;} ?>" maxlength="150" readonly>
						</div>
					</div>
					<div class="form-group col-lg-3"> 
						<div class="input-group">
							<span class="input-group-addon" title="Новый пароль"><i class="fa fa-fw fa-unlock-alt" aria-hidden="true"></i></span>
							<input type="password" class="form-control" name="inputPasswordNew" placeholder="Новый пароль" maxlength="150" readonly onfocus="this.removeAttribute('readonly')" <?php if(isset($_GET['new'])) {?>required<?php } ?> />
						</div>
					</div>
					<div class="form-group col-lg-6">
						<div class="input-group">
							<span class="input-group-addon" title="Имя"><i class="fa fa-fw fa-address-card" aria-hidden="true"></i></span>
							<input type="text" class="form-control" name="inputName" placeholder="Имя" value="<?php if(isset($UserName)){echo $UserName;} ?>" maxlength="150" required>
						</div>
						<input type="text" class="hidden" name="inputId" value="<?php if(isset($UserId)){echo $UserId;} ?>">
					</div>
					<div class="form-group col-lg-6">
						<div class="input-group">
							<span class="input-group-addon" title="Фамилия"><i class="fa fa-fw fa-address-card-o" aria-hidden="true"></i></span>
							<input type="text" class="form-control" name="inputSurName" placeholder="Фамилия" value="<?php if(isset($UserSurName)){echo $UserSurName;} ?>" maxlength="150" required>
						</div>
					</div>
					<div class="form-group col-lg-6">
						<div class="input-group">
							<span class="input-group-addon" title="Должность"><i class="fa fa-fw fa-graduation-cap" aria-hidden="true"></i></span>
							<input type="text" class="form-control" name="inputPosition" placeholder="Должность" value="<?php if(isset($UserPosition)){echo $UserPosition;} ?>">
						</div>
					</div>
					<div class="form-group col-lg-6">
						<div class="input-group">
							<span class="input-group-addon" title="Группа"><i class="fa fa-fw fa-users" aria-hidden="true"></i></span>
							<select class="form-control" name="selectGroup" required>
								<option value="guest"><?php echo $nCRMgrguest; ?></option>
								<?php if ($GroupCheck != 'guest') { ?><option value="user"><?php echo $nCRMgruser; ?></option><?php } ?>
								<?php if ($GroupCheck != 'guest' and $GroupCheck != 'user') { ?><option value="manager"><?php echo $nCRMgrmanager; ?></option><?php } ?>
								<?php if ($GroupCheck == 'admin') { ?><option value="admin"><?php echo $nCRMgradmin; ?></option><?php } ?>
							</select>
						</div>
					</div>
					<div class="form-group col-lg-6">
						<div class="input-group">
							<span class="input-group-addon" title="E-mail"><i class="fa fa-fw fa-envelope" aria-hidden="true"></i></span>
							<input type="email" class="form-control" name="inputEmail" placeholder="E-mail" value="<?php if(isset($UserEmail)){echo $UserEmail;} ?>" maxlength="150" required>
						</div>
					</div>
					<div class="form-group col-lg-3">
						<div class="input-group">
							<span class="input-group-addon" title="Телефон основной"><i class="fa fa-fw fa-phone" aria-hidden="true"></i></span>
							<input type="text" class="form-control" name="inputPhoneW" placeholder="Телефон основной" value="<?php if(isset($UserPhoneW)){echo $UserPhoneW;} ?>" maxlength="150" required>
						</div>
					</div>
					<div class="form-group col-lg-3">
						<div class="input-group">
							<span class="input-group-addon" title="Телефон дополнительный"><i class="fa fa-fw fa-phone" aria-hidden="true"></i></span>
							<input type="text" class="form-control" name="inputPhone" placeholder="Телефон дополнительный" value="<?php if(isset($UserPhone)){echo $UserPhone;} ?>" maxlength="150">
						</div>
					</div>
					<div class="form-group col-lg-12">
						<div class="input-group">
							<span class="input-group-addon" title="Профиль соцсети"><i class="fa fa-fw fa-comment" aria-hidden="true"></i></span>
							<input type="text" class="form-control" name="inputSocial" placeholder="Профиль соцсети" value="<?php if(isset($UserSocial)){echo $UserSocial;} ?>">
						</div>
					</div>
				</div>
				<small style="color:#aaa;">Допустимые форматы файлов: jpeg, png, gif. Максимальная ширина / высота изображения: 450px</small>
		
			</div>
		</div>
	</form>
	
</div>
<?php if(isset($_GET['edit'])) {?>
	<script type="text/javascript">
		$(document).ready(function() {
			$('form[name=form_user] select[name=selectGroup]').val('<?php echo $Group;?>');
		});
	</script>
<?php } ?>