<template name="manageRoles">
    <div class="modal inmodal" id="manageRolesModal" tabindex="-1" role="dialog" aria-hidden="true"
         style="display: none;">
        <div class="modal-dialog modal-lg">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                            class="sr-only">Close</span></button>
                    <h4 class="modal-title">Manage Roles</h4>
                    <small class="font-bold">Database {{getDB}}
                    </small>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-12">
                            <table id="tblRoles"
                                   class="table table-striped table-bordered table-hover dataTables-example dataTable"
                                   style="width: 100%">
                                <thead>
                                <tr>
                                    <th>Role</th>
                                    <th>Database</th>
                                    <th>Is Builtin</th>
                                    <th>Edit/View</th>
                                    <th>Delete</th>
                                </tr>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>

                            <button id="btnAddNewRole" type="button"
                                    class="btn btn-block btn-outline btn-primary"
                                    style="margin-top: 10px"
                                    data-toggle="modal"
                                    data-target="#editRoleModal">Add Role
                            </button>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button id="btnCloseUMRoles" type="button"
                            data-style="contract"
                            class="btn btn-outline btn-primary ladda-button"
                            data-dismiss="modal">
                        Close
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- ADD/EDIT ROLE MODAL -->
    <div class="modal inmodal" id="editRoleModal" tabindex="-1" role="dialog" aria-hidden="true"
         style="display: none;">
        <div class="modal-dialog modal-lg">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                            class="sr-only">Close</span></button>
                    <h4 id="addEditRoleModalTitle" class="modal-title">Edit Role</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group"><label class="col-lg-2 control-label">Role</label>
                            <div class="col-lg-10">
                                <input id="inputRoleUM" value="{{getRole.role}}" required="true"
                                       type="text"
                                       placeholder="Role" class="form-control">
                            </div>
                        </div>
                    </form>

                    <div class="tabs-container">
                        <ul class="nav nav-tabs">
                            <li class="active"><a data-toggle="tab" href="#tab-1-role" aria-expanded="true">
                                Privileges</a>
                            </li>
                            <li class=""><a data-toggle="tab" href="#tab-2-role" aria-expanded="false">Roles To
                                Inherit</a>
                            </li>
                        </ul>
                        <div class="tab-content">
                            <div id="tab-1-role" class="tab-pane active">
                                <div class="panel-body no-borders modal-background">
                                    <table id="tblRolePrivileges"
                                           class="table table-striped table-bordered table-hover dataTables-example dataTable"
                                           style="width: 100%">
                                        <thead>
                                        <tr>
                                            <th>Actions</th>
                                            <th>Resource</th>
                                            <th>Edit</th>
                                            <th>Delete</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>

                                    <button id="btnAddNewPrivilegeToRole" type="button"
                                            class="btn btn-block btn-outline btn-primary"
                                            style="margin-bottom: 10px">Add Privilege
                                    </button>
                                </div>
                            </div>
                            <div id="tab-2-role" class="tab-pane">
                                <div class="panel-body no-borders modal-background">
                                    <table id="tblRolesToInherit"
                                           class="table table-striped table-bordered table-hover dataTables-example dataTable"
                                           style="width: 100%">
                                        <thead>
                                        <tr>
                                            <th>Role</th>
                                            <th>Database</th>
                                            <th>Delete</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>

                                    <button id="btnAddNewInheritRoleToRole" type="button"
                                            class="btn btn-block btn-outline btn-primary"
                                            style="margin-bottom: 10px">Add Role To Inherit
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <div class="pull-left">
                        <button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
                    </div>
                    <button id="btnApplyAddEditRole" type="button"
                            data-style="contract"
                            class="btn btn-outline btn-primary ladda-button">
                        Save
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- ADD/EDIT PRIVILEGE TO ROLE MODAL-->
    <div class="modal inmodal" id="addPrivilegeToRoleModal" tabindex="-1" role="dialog" aria-hidden="true"
         style="display: none;">
        <div class="modal-dialog modal-lg">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                            class="sr-only">Close</span></button>
                    <h4 id="addEditPrivilegeModalTitle" class="modal-title">Add Privilege</h4>
                    <small id="addEditPrivilegeModalText" class="font-bold">Role
                    </small>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group"><label class="col-lg-2 control-label">DB / Resource</label>
                            <div class="col-lg-10">
                                <select id="cmbPrivilegeResource"
                                        data-placeholder="Choose a database or enter one"
                                        class="chosen-select form-control"
                                        tabindex="-1">
                                    <option></option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group"><label class="col-lg-2 control-label">Collection</label>
                            <div class="col-lg-10">
                                <select id="cmbPrivilegeCollection"
                                        data-placeholder="Choose a collection or enter one"
                                        class="chosen-select form-control"
                                        tabindex="-1">
                                    <option></option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">Actions</label>
                            <div class="col-lg-10"><select id="cmbActionsOfPrivilege"
                                                           multiple="true"
                                                           data-placeholder="Choose an action"
                                                           class="chosen-select form-control"
                                                           tabindex="-1">
                            </select></div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <div class="pull-left">
                        <button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
                    </div>
                    <button id="btnApplyAddPrivilegeToRole"
                            type="button"
                            data-style="contract"
                            class="btn btn-outline btn-primary ladda-button">
                        Apply
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- ADD ROLE TO INHERIT MODAL-->
    <div class="modal inmodal" id="addRoleToInherit" tabindex="-1" role="dialog" aria-hidden="true"
         style="display: none;">
        <div class="modal-dialog modal-lg">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                            class="sr-only">Close</span></button>
                    <h4>Add Role to Inherit</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group"><label class="col-lg-2 control-label">Database</label>
                            <div class="col-lg-10">
                                <select id="cmbDatabasesForInheritRole"
                                        data-placeholder="Choose a database or enter one"
                                        class="chosen-select form-control"
                                        tabindex="-1">
                                    <option></option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group"><label class="col-lg-2 control-label">Role</label>
                            <div class="col-lg-10">
                                <select id="cmbRolesForDBForInheritedRole"
                                        data-placeholder="Choose a role or enter one"
                                        class="chosen-select form-control"
                                        tabindex="-1">
                                    <option></option>
                                </select>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <div class="pull-left">
                        <button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
                    </div>
                    <button id="btnAddInheritRole"
                            type="button"
                            data-style="contract"
                            class="btn btn-outline btn-primary ladda-button">
                        Add
                    </button>
                </div>
            </div>
        </div>
    </div>
</template>