<div class="modal-header">
	<h3 class="modal-title"><i class="fa fa-user"></i> Manage user</h3>
</div>
<form name="userForm" class="form-horizontal" ng-submit="save()">
	<div class="modal-body">
		<div class="form-group">
			<label for="firstName" class="col-sm-3 control-label">First Name</label>
			<div class="col-sm-9">
				<input id="firstName" class="form-control" type="text" name="first_name" ng-model="data.first_name" autocomplete="off" required>
			</div>
		</div>
		<div class="form-group">
			<label for="lastName" class="col-sm-3 control-label">Last Name</label>
			<div class="col-sm-9">
				<input id="lastName" class="form-control" type="text" name="last_name" ng-model="data.last_name" autocomplete="off">
			</div>
		</div>
		<div class="form-group">
			<label for="Username" class="col-sm-3 control-label">Username</label>
			<div class="col-sm-9">
				<input id="Username" class="form-control" type="text" name="username" ng-model="data.username" autocomplete="off" required>
				<div ng-show="data.account_type == 'ldap'"><small><strong>WARNING:</strong> Changing the username here without changing it in the active directory will result in creating a new account when the user logs back in.</small></div>
			</div>
		</div>
		<div class="form-group">
			<label for="Email" class="col-sm-3 control-label">Email</label>
			<div class="col-sm-9">
				<input id="Email" class="form-control" type="email" name="email" ng-model="data.email" autocomplete="off" required>
			</div>
		</div>
		<div class="form-group">
			<label for="role" class="col-sm-3 control-label">Role</label>
			<div class="col-sm-9">
				<input id="role" class="form-control" type="text" name="role" ng-model="data.role">
			</div>
		</div>
		<div class="form-group">
			<label for="role" class="col-sm-3 control-label">Mobile</label>
			<div class="col-sm-9">
				<input id="SettingsMobile" class="form-control" type="text" name="mobile" ng-model="data.mobile">
			</div>
		</div>
		<div class="form-group">
			<label for="extension" class="col-sm-3 control-label">Extension</label>
			<div class="col-sm-9">
				<input id="extension" class="form-control" type="text" name="extension" ng-model="data.extension" placeholder="324" maxlength="10">
				<small class="text-muted">3CX extension for making calls (leave empty to use default from integration settings)</small>
			</div>
		</div>
		<div class="form-group">
			<label for="repair_target" class="col-sm-3 control-label">Repair Target</label>
			<div class="col-sm-9">
				<input id="repair_target" class="form-control" type="text" name="repair_target" ng-model="data.repair_target">
			</div>
		</div>
		<div class="headline">
			<h4>Password</h4>
		</div>
		<div class="alert alert-danger" ng-show="data.account_type == 'ldap'">
			<i class="fa fa-exclamation-triangle"></i> Passwords are not stored locally for this user. In order to change the password, connect to your active directory console and change it from there.
		</div>
		<div ng-hide="data.account_type == 'ldap'">
			<div class="form-group">
				<label for="Password" class="col-sm-3 control-label">Password</label>
				<div class="col-sm-9">
					<input id="Password" class="form-control" type="password" name="password" ng-model="data.password">
				</div>
			</div>
			<div class="form-group">
				<label for="Password2" class="col-sm-3 control-label">Re-type Password</label>
				<div class="col-sm-9">
					<input id="Password2" class="form-control" type="password" name="password_confirmation" ng-model="data.password_confirmation" ng-required="data.password">
				</div>
			</div>
		</div>
		<div class="headline">
			<h4>Advanced options</h4>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">Account type</label>
			<div class="col-sm-9">
				<select class="form-control" ng-model="data.account_type" ng-options="o.value as o.name for o in account_types" options-disabled="o.disabled for o in account_types" required></select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">Account Enabled</label>
			<div class="col-sm-9">
				<label class="radio-inline">
					<input type="radio" name="active" value="1" ng-model="data.active" required> Yes
				</label>
				<label class="radio-inline">
					<input type="radio" name="active" value="0" ng-model="data.active" required> No
				</label>
			</div>
		</div>
	</div>
	<div class="modal-footer">
		<button class="btn btn-default" ng-click="cancel()" data-eat-click>Cancel</button>
		<button class="btn btn-primary" ng-hide="data.id">Create user</button>
		<button class="btn btn-primary" ng-disabled="userForm.$pristine" ng-show="data.id">Save changes</button>
	</div>
</form>