<div ng:controller="UserEditController" class="row-fluid" id="body-main" qn:fillheight>
    <div class="toolbar cfix">
        <div class="toolbar-group">
            <button title="{{$resource('utility.home')}}" class="button tooltip" ng:click="back()"><i class="icon-angle-left"></i></button>
        </div>
        <div class="toolbar-group">
            <h3>
                <span ng:click="back()" class="circle circle-small blue"><span class="icon li_user"></span></span>
                {{user.FullName()}}
            </h3>
        </div>
    </div>
    <div class="form  cfix">
        <div class="col2 sidebar">
            <div  class="profile">
                <span ng:click="changeImge()" class="change">{{$resource('users.change_image')}}</span>
                <img ng:src="{{profilePhoto}}" />
            </div>
            <ul class="nav">
                <li ng:class="{active:view == 'basic'}" class="active" ng:click="setView('basic')"><a>{{$resource('users.basic_info')}}</a></li>
                <li ng:class="{active:view == 'changePassword'}" ng:click="setView('changePassword')"><a>{{$resource('users.change_password')}}</a></li>
            </ul>
        </div>
        <div class="col10">
            <form name="User" class="form-horizontal" ng:show="view == 'basic'">
                <div class="control-group required">
                    <label class="control-label">{{$resource('users.first_name')}}</label>
                    <div class="controls">
                        <input type="text" class="col6" name="FirstName" ng:model="user.FirstName" required />
                        <div ng:show="errors['model.LastName'][0]" class="error" >{{$resource(errors['model.LastName'][0])}}</div>
                    </div>
                </div>
                <div class="control-group required">
                    <label class="control-label">{{$resource('users.last_name')}}</label>
                    <div class="controls">
                        <input type="text" class="col6" name="LastName" ng:model="user.LastName" required />
                        <div ng:show="errors['model.LastName'][0]" class="error" >{{$resource(errors['model.LastName'][0])}}</div>
                    </div>
                </div>
                <div class="control-group required">
                    <label class="control-label">{{$resource('users.email')}}</label>
                    <div class="controls">
                        <input class="col6" type="text" name="Email" ng:model="user.Email" required />
                        <div ng:show="errors['model.Email'][0]" class="error" >{{$resource(errors['model.Email'][0])}}</div>
                    </div>
                </div>
                <div class="control-group required">
                    <label class="control-label">{{$resource('users.roles')}}</label>
                    <div class="controls"  > 
                        <select qn:multiselect="" multiple="multiple" ng:model="user.Roles" ng:options="role.Value as role.Name for role in roles" required></select>
                        <!--<div ng:show="errors['password.CurrentPass'][0]" class="error" >{{$resource(errors['password.CurrentPass'][0])}}</div>-->
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">{{$resource('users.teams')}}</label>
                    <div class="controls">
                        <input qn:Treeselector="treeOptions" qn:Treedata="classification" ng:model="Labels[classification.Alias]" />
                    </div>
                </div>
                <br/>
                <div class="control-group">
                    <label class="control-label"></label>
                    <div class="controls">
                        <button class="button green" ng:click="update()">{{$resource('users.save')}}</button>
                        <button type="button" class="button" ng:click="back()">{{$resource('users.cancel')}}</button>
                    </div>
                </div> 
            </form>
            <form name="Password" class="form-horizontal" ng:show="view == 'changePassword'">
                <div class="control-group required">
                    <label class="control-label">{{$resource('users.current_pass')}}</label>
                    <div class="controls">
                        <input type="password" class="col6" name="Current" ng:model="password.CurrentPass" required />
                        <div ng:show="errors['password.CurrentPass'][0]" class="error" >{{$resource(errors['password.CurrentPass'][0])}}</div>
                    </div>
                </div>
                <div class="control-group required">
                    <label class="control-label">{{$resource('users.new_pass')}}</label>
                    <div class="controls">
                        <input type="password" class="col6" name="New" ng:model="password.NewPass" required />
                        <div ng:show="errors['password.NewPass'][0]" class="error" >{{$resource(errors['password.NewPass'][0])}}</div>
                    </div>
                </div>

                <div class="control-group required">
                    <label class="control-label">{{$resource('users.confirm_new_pass')}}</label>
                    <div class="controls">
                        <input type="password" class="col6" name="ConfirmNew" ng:model="password.ConfirmNewPass" required />
                        <div ng:show="errors['password.ConfirmNewPass'][0]" class="error" >{{$resource(errors['password.ConfirmNewPass'][0])}}</div>
                    </div>
                </div>
                <br/>
                <div class="control-group">
                    <label class="control-label"></label>
                    <div class="controls">
                        <button class="button green" ng:click="changePassword()">{{$resource('users.save')}}</button>
                        <button type="button" class="button" ng:click="back()">{{$resource('users.cancel')}}</button>
                    </div>
                </div> 
            </form>
        </div>
    </div>
    <div qn:dialog="ui.uploadDialog">
        <div style="text-align: center; margin:30px 0">
            <form name="changePhoto">
                <input  type="hidden" name="ID" value="{{user.ID}}" />
                <input qn:upload="uploadOption" ng:Model="upload" id="photo" type="file" name="photo" data-url="/qusion/Image/changephoto" />
            </form>
        </div>
        <button class="btn lightblue" ng:click="upload.send()">{{$resource('users.save')}}</button>
        <button class="btn lightblue" ng:click="zatvori()">{{$resource('utility.upload')}}</button>
        <button ng:Click="cancelEdit()" class="btn btn-link">{{$resource('users.cancel')}}</button>
    </div>
</div>