{{!
  Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.

  WSO2 Inc. licenses this file to you under the Apache License,
  Version 2.0 (the "License"); you may not use this file except
  in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied. See the License for the
  specific language governing permissions and limitations
  under the License.
}}
<!-- content/body -->
<div class="row">
    <div class="col-md-12">
        <!-- content -->
        <div id="role-create-form" data-cloud={{isCloud}} class="container col-centered wr-content">
            <div class="wr-form">
                <p class="page-sub-title">Edit Role</p>
                <p>Please note that * sign represents required fields of data.</p>
                <hr/>
                <div class="row">
                    <div class="col-lg-8">
                        <div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
                            <i class="icon fw fw-error"></i><span></span>
                        </div>
                        <label class="wr-input-label">Domain</label>
                        <div class="wr-input-control">
                            <select id="domain" class="form-control select" disabled>
                                <option>{{userStore}}</option>
                            </select>
                        </div>
                        <label class="wr-input-label">
                            Role Name *
                        </label>
                        <br>
                        <label class="wr-input-label" id="roleNameValidationText">
                            ( {{roleNameHelpText}} )
                        </label>
                        {{#if isCloud}}
                        <div id="roleNameField" class="form-group wr-input-control input-group">
                            <!--suppress HtmlFormInputWithoutLabel -->
                            <span class="input-group-addon" id="basic-addon1">devicemgt</span>
                            <input aria-describedby="basic-addon1" type="text" id="rolename"
                                   data-regex="{{roleNameJSRegEx}}"
                                   data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control"
                                   data-currentrole="{{role.roleName}}"
                                   value="{{role.roleName}}"/>

                        {{else}}
                        <div id="roleNameField" class="form-group wr-input-control">
                            <input type="text" id="rolename" data-regex="{{roleNameJSRegEx}}"
                                   data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control"
                                   data-currentrole="{{role.roleName}}"
                                   value="{{role.roleName}}"/>
                        {{/if}}
                            <span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
                            <label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in
                                minimum 3 characters long and do not
                                include any whitespaces. </label>
                        </div>
                    </div>
                    </div>
                    <br>
                    <button id="add-role-btn" class="wr-btn">Update Role</button>
                </div>
            </div>
            <div id="role-created-msg" class="container col-centered wr-content hidden">
                <div class="wr-form">
                    <p class="page-sub-title">Role was updated successfully.</p>
                    <br>Please click <b>"View Updated Role"</b>, if you wish to view the updated role or click
                    <b>"View Role List"</b> to complete the process and go back to the role list.
                    <hr/>
                    <button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'">
                        View Role List
                    </button>
                    <a href="{{@app.context}}/roles/edit-role/{{role.roleName}}"
                       class="cu-btn-inner">
                        <span class="fw-stack">
                            <i class="fw fw-circle-outline fw-stack-2x"></i>
                            <i class="fw fw-add fw-stack-1x"></i>
                        </span>
                        View Updated Role
                    </a>
                </div>
            </div>
            <!-- /content -->
            <div id="app-context" data-app-context="{{@app.context}}" class="hidden"></div>
        </div>
    </div>
    <!-- /content/body -->
    {{#zone "bottomJs"}}
        {{js "js/bottomJs.js"}}
    {{/zone}}
