
<div class="modal" ng-controller="IdmCreateUserPopupController">
    <div class="modal-dialog">
        <div class="modal-content">

            <div class="modal-header-wrapper">
                <div class="modal-header">
                    <button type="button" class="close" ng-click="$hide()">&times;</button>
                    <h2 class="modal-title" ng-if="model.mode == 'create'">
                        {{'IDM.USER-MGMT.POPUP.CREATE-TITLE' | translate}}
                    </h2>
                    <h2 class="modal-title" ng-if="model.mode == 'edit'">
                        {{'IDM.USER-MGMT.POPUP.EDIT-TITLE' | translate}}
                    </h2>
                </div>

            </div>

            <div  class="modal-body">

                <form name="newUserForm" class="row">

                    <div class="col-xs-12" ng-if="model.mode == 'create'">
                        <div class="form-group">
                            <label class="control-label">{{'IDM.USER-MGMT.POPUP.CREATE-ID' | translate}}</label>
                            <input name="idInput" type="text" class="form-control" auto-focus ng-model="model.user.id">
                        </div>
                    </div>
                    <div class="col-xs-12">
                        <div class="form-group">
                            <label class="control-label">{{'IDM.USER-MGMT.POPUP.CREATE-EMAIL' | translate}}</label>
                            <span style="color:white; background-color: red; padding: 0 5px 0 5px" ng-show="newUserForm.emailInput.$error.email">
                                {{'IDM.USER-MGMT.POPUP.CREATE-INVALID-EMAIL' | translate}}
                            </span>
                            <input name="emailInput" type="email" class="form-control" ng-model="model.user.email">
                        </div>
                    </div>
                    <div class="col-xs-12" ng-if="model.mode == 'create'">
                        <div class="form-group">
                            <label class="control-label">{{'IDM.USER-MGMT.POPUP.CREATE-PASSWORD' | translate}}</label>
                            <input type="password" class="form-control" ng-model="model.user.password">
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label">{{'IDM.USER-MGMT.POPUP.CREATE-FIRSTNAME' | translate}}</label>
                            <input type="text" class="form-control" ng-model="model.user.firstName">
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label">{{'IDM.USER-MGMT.POPUP.CREATE-LASTNAME' | translate}}</label>
                            <input type="text" class="form-control" ng-model="model.user.lastName">
                        </div>
                    </div>
                    <div class="col-xs-12">
                        <div class="form-group">
                            <label class="control-label">{{'IDM.USER-MGMT.POPUP.CREATE-TENANT' | translate}}</label>
                            <input type="text" class="form-control" ng-model="model.user.tenantId">
                        </div>
                    </div>

                </form>

                <div class="alert error" ng-if="model.errorMessage">
                    {{model.errorMessage}}
                </div>

            </div>

            <div class="modal-footer-wrapper">
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" ng-click="$hide()">{{'IDM.GENERAL.ACTION.CANCEL' | translate}}</button>
                    <button ng-if="model.mode == 'create'"
                            type="button"
                            class="btn btn-primary"
                            ng-disabled="model.loading || !model.user.id || !model.user.password || !model.user.firstName"
                            ng-click="createNewUser();">{{'IDM.GENERAL.ACTION.SAVE' | translate}}
                    </button>
                    <button ng-if="model.mode == 'edit'"
                            type="button"
                            class="btn btn-primary"
                            ng-disabled="model.loading || !model.user.id || !model.user.lastName"
                            ng-click="editUserDetails();">{{'IDM.GENERAL.ACTION.SAVE' | translate}}
                    </button>
                </div>
            </div>

        </div>

    </div>
</div>

