<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF 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.
-->

<script type="text/ng-template" id="assignGroup.html">
  <ng-form name="group_create_form">
    <div class="modal-header">
      <h4>New Group</h4>
    </div>
    <div class="modal-body" style="background-color: white">
        <div class="container">
          <div class="row" style="margin-top:15px;">
        
            <!--No Instances-->
            <div ng-if="!loading && groupsTotal==0">
              <div no-result text="No user group"></div>
            </div>
            <!--Loading Instances-->
            <div ng-if="loading">
              <loading text="Loading user group ..."></loading>
            </div>
            <div class="row">
              <div class="col-xs-9">
                <label class="table-header-text">Group List</label>
              </div>
              <div class="col-xs-3">
              <form style="float:right;" >
                  <span class="input-icon input-icon-right nav-search">
                    <input type="text" placeholder="Search by group name" class="nav-search-input" ng-model="filter.name" />
                    <i class="ace-icon fa fa-search blue" ng-click="listEditGroups();"></i>
                  </span>
              </form>
              </div>
            </div>
            <table ng-if="groupsTotal > 0" style="margin-top:20px;table-layout:fixed;" class="table table-striped table-bordered table-hover dataTable no-footer">
              <thead>
              <tr style="cursor: pointer">
                <th width="7%">
                  <input type="checkbox" onchange="angular.element(this).scope().selectAllGroups(this)" ng-checked="isAllchecked(selectGroups,groups)" >
                </th>
                <th >
                  Group Name
                </th>
              </tr>
              </thead>
              <tbody class="odd table table-striped table-bordered table-hover dataTable no-footer">
              <tr ng-repeat="(group, val) in groups" style="cursor: pointer">
                <td>
                    <input type="checkbox" ng-model="selectGroups[group]" >
                </td>
                <td>
                  {{group}}
                </td>
              </tr>
              </tbody>
            </table>
            <div class="row" v-if="">
              <div class="col-xs-12">
                  <pagination total-items="groupsTotal" boundary-link-numbers="true" rotate="false" boundary-links="true" force-ellipses="true" page="editPage.curpage" max-size="10" items-per-page="editPage.limit" on-select-page="listEditGroups(page)"  class="pagination-sm"></pagination>
              </div>
            </div>
          </div>
        </div>
    </div>
    <div class="modal-footer">
      <button class="btn btn-primary" ng-click="cancel()">Close</button>
      <button class="btn btn-success" ng-click="saveAssignGroup()" ng-disabled="group_create_form.$invalid || dialogActionLoading">
        Submit
      </button>
    </div>
  </ng-form>
</script>

