gadael/gadael

View on GitHub
public/partials/admin/user-edit.html

Summary

Maintainability
Test Coverage
<h1 ng-if="undefined === user._id"><i class="fa fa-edit text-muted"></i> <span translate>Create a user</span></h1>
<h1 ng-if="undefined !== user._id"><i class="fa fa-edit text-muted"></i> <span translate>Modify a user</span></h1>


<form role="form" class="top30" name="userEdit">


    <div class="col-xs-12 col-md-4">
        <h3 translate>Roles:</h3>

            <div><input type="checkbox" id="user_isAccount" ng-model="user.isAccount" />
                <label for="user_isAccount" translate>Absences user account</label></div>
            <p><small translate>The user can have vacations rights, absences requests, time saving account ...</small><br /><br /></p>

            <div><input type="checkbox" id="user_isAdmin" ng-model="user.isAdmin" />
                <label for="user_isAdmin" translate>Application administrator</label></div>
            <p><small translate>The user can manager other users and departments, the application parameters ...</small><br /><br /></p>

            <div><input type="checkbox" id="user_isManager" ng-model="user.isManager" />
                <label for="user_isManager" translate>Department manager</label></div>
            <p><small translate>The user may be involved in the validation of requests by the members of his department</small></p>

            <br />
            <hr class="visible-xs-block visible-sm-block" />
            <br />
    </div>


    <div class="col-xs-12 col-md-8">

        <div class="row">
            <div class="col-xs-12" ng-include="'partials/utils/common/user/user-edit-head.html'">
            </div>
        </div>

        <div class="row">
            <div class="col-md-6 form-group">
                <label for="user_department" translate>Department</label>
                <select class="form-control" id="user_department" ng-model="user.department._id" ng-options="department._id as department.name for department in departments">
                    <option></option>
                </select>
            </div>

            <div ng-if="user.isAccount" ng-include="'partials/admin/user-edit-account.html'">
            </div>

            <div ng-if="user.isManager" ng-include="'partials/admin/user-edit-manager.html'">
            </div>


            <div ng-if="company.login.form" class="form-group col-md-12 top15">
                <input type="checkbox" id="user_setpassword" ng-model="user.setpassword" />
                <label for="user_setpassword" translate>Set a new password</label>
            </div>

            <div class="col-xs-12" ng-if="user.setpassword" ng-class="{true:'', false:'has-error'}[user.newpassword==user.newpassword2]">

                <div class="row">

                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="user_newpassword" translate>New password</label>
                            <input type="password" class="form-control" id="user_newpassword" ng-model="user.newpassword" />
                        </div>

                        <div class="form-group">
                            <label for="user_newpassword2" translate>Confirm new password</label>
                            <input type="password" class="form-control" id="user_newpassword2" ng-model="user.newpassword2" />
                        </div>

                    </div>
                    <div class="col-md-6 top30">
                        <div class="col-xs-8">
                            <small translate>Password Strength:</small><br />
                            <div style="border:#ccc 1px solid;padding:0;">
                                <div pw-width="{{ user.newpassword }}" style="background:green;height:5px;"></div>
                            </div>
                            <br />
                            <br />
                        </div>
                    </div>

                </div>
            </div>


            <div class="form-group col-md-12">
                <input type="checkbox" id="user_isActive" ng-model="user.isActive" />
                <label for="user_isActive" translate>The user is allowed to log in</label>
            </div>


            <div class="col-sm-12 text-center top30">
                <button class="btn btn-primary" ng-click="userEdit.$valid && saveUser()" translate>Save</button>
                <button class="btn btn-link" ng-click="cancel()" translate>Cancel</button>
            </div>
        </div>
    </div>


</form>