<h3>User creation</h3>
<br/>
<form name="form" novalidate class="form-horizontal">

    <div class="control-group">
        <label for="user.uid" class="col-sm-2 control-label">user ID :</label>

        <div class="controls">
            <input type=text id="user.uid" ng-model="user.uid" placeholder="uid" required/>
        </div>
    </div>
    <div class="control-group">
        <label for="user.display_name" class="col-sm-2 control-label">display name : </label>

        <div class="controls">
            <input type=text id="user.display_name" ng-model="user.display_name" required/>
            &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>user name you want to be displayed</span></a>
        </div>
    </div>
    <div class="control-group">
        <label for="user.email" class="col-sm-2 control-label">email : </label>

        <div class="controls">
            <input type=text id="user.email" ng-model="user.email" required/> <!--email is needed to set acls-->

        </div>
    </div>

    <div class="control-group">
        <label for="suspended" class="col-sm-2 control-label">Suspended : </label>

        <div class="controls">
            <input type=checkbox id="suspended" ng-model="user.suspended" ng-init="user.suspended='False'"
                   ng-true-value="True" ng-false-value="False"/>
            &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>Specify whether the user should be suspended Example: False [False]</span></a>
        </div><br/>
        <label for="system" class="col-sm-2 control-label">System : </label>

        <div class="controls">
            <input type=checkbox id="system" ng-model="user.system" ng-init="user.system='False'" ng-true-value="True" ng-false-value="False"/>
            &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>Specify whether the user should be able to modify ACLs</span></a>
        </div>
    </div>

    <div class="control-group">
        <label for="user.max_buckets" class="col-sm-2 control-label">max-buckets : </label>

        <div class="controls">
            <input type=number id="user.max_buckets" ng-model="user.max_buckets"/>
            &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>Specify the maximum number of buckets the user can own</span></a>
        </div>
    </div>

    <div class="control-group">
        <label for="user.generate_key" class="col-sm-2 control-label">generate s3 key : </label>

        <div class="controls">
            <input type=checkbox id="user.generate_key" ng-model="user.generate_key" ng-init="user.generate_key='True'"
                   ng-true-value="True" ng-false-value="False"/>
            &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>Generate a new key pair and add to the existing keyring.</span></a>
        </div>
    </div>
    <div ng-show="user.generate_key=='False'">
    <div class="control-group">
        <label for="user.access_key" class="col-sm-2 control-label">access key : </label>

        <div class="controls">
            <input type=text id="user.access_key" ng-model="user.access_key" ng-required="user.generate_key=='False'"/>
            &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>user access key</span></a>
        </div>
    </div>
    <div class="control-group">
        <label for="user.secret_key" class="col-sm-2 control-label">secret key : </label>

        <div class="controls">
            <input type=text id="user.secret_key" ng-model="user.secret_key" ng-required="user.generate_key=='False'"/>
            &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>user secret key</span></a>
        </div>
    </div>
    </div>

    <div class="control-group">
        <label for="user.create_swift_subuser" class="col-sm-2 control-label">create swift subuser: </label>

        <div class="controls">
            <input type=checkbox id="user.create_swift_subuser" ng-model="user.create_swift_subuser" ng-init="user.create_swift_subuser='False'"
                   ng-true-value="True" ng-false-value="False"/>
            &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>Generate a subuser to be used with Swift API.</span></a>
        </div>
    </div>
    <div ng-show="user.create_swift_subuser=='True'">
        <div class="control-group">
            <label for="user.subuser" class="col-sm-2 control-label">subuser id : </label>
            <div class="controls">
                <input type=text id="user.subuser" ng-model="user.subuser" ng-required="user.create_swift_subuser=='True'"/>
                &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>subuser id</span></a>
            </div>
        </div>
        <div class="control-group">
            <label for="user.subuser_access" class="col-sm-2 control-label">subuser permissions : </label>
            <div class="controls">
                <select id="user.subuser_access" ng-model="user.subuser_access" ng-options="value for value in permissionValues"></select>
                &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>set access permission for subuser</span></a>
            </div>
        </div>
        <div class="control-group">
            <label for="user.subuser_generate_key" class="col-sm-2 control-label">generate swift key : </label>

            <div class="controls">
                <input type=checkbox id="user.subuser_generate_key" ng-model="user.subuser_generate_key" ng-init="user.subuser_generate_key='True'"
                       ng-true-value="True" ng-false-value="False"/>
                &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>Generate a new Swift key and add to the existing keyring.</span></a>
            </div>
        </div>
        <div ng-show="user.subuser_generate_key=='False'">
            <div class="control-group">
                <label for="user.subuser_secret_key" class="col-sm-2 control-label">swift key : </label>

                <div class="controls">
                    <input type=text id="user.subuser_secret_key" ng-model="user.subuser_secret_key" ng-required="user.create_swift_subuser=='True' && user.subuser_generate_key=='False'"/>
                    &nbsp;<a class="tooltips"><i class="icon-book"> </i><span>subuser swift key</span></a>
                </div>
            </div>
        </div>
    </div>

    <br>

    <div class="button-bar">
        <button ng-click="submit()" ng-disabled="form.$invalid || isUnchanged(user)" class="btn btn-success">Create</button>
        <button ng-click="reset()" ng-disabled="isUnchanged(user)" class="btn btn-default">
            Reset
        </button>
        <button ng-click="cancel()" class="btn btn-default">Cancel</button>

    </div>
</form>
