{{!
* 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.
}}

<div class="panel panel-default panel-capacity">
  <div class="panel-heading">
    <div class="panel-title">
    Capacity
  <div class="total">
<div class="level-total-label">Level Total</div>
{{capacity-bar capacityValue=totalCapacity maxCapacityValue=totalCapacity warn=leafQueues.firstObject.overCapacity}}
  </div>
    </div>
  </div>
  <div class="panel-body total">
  <div class="panel-body queues">
    {{#each leafQueues}}
      {{#if this.isCurrent}}
      <div {{bind-attr class=":queue-capacity this.isCurrent:active"}}>
          <div class="queue-label">{{this.name}}</div>
        {{render "capacityEditForm" this}}
  <a href="#" {{action toggleProperty "showPeerQueues"}}>
    <div class="peer-toggle">
Show/Hide Peer Level Queues
    </div>
  </a>
      </div>
      {{/if}}
    {{/each}}  
{{#if showPeerQueues}}
    {{#each leafQueues}}
      {{#unless this.isCurrent}}
      <div {{bind-attr class=":queue-capacity :queue-capacity-peer"}}>
        <p>
          <div class="queue-label">{{this.name}}</div>
        </p>
        {{render "capacityEditForm" this}}
      </div>
      {{/unless}}
    {{/each}}
{{/if}}
    {{#each newLeafQueues}}
      <div {{bind-attr class=":queue-capacity :queue-capacity-peer :new-queue this.isCurrent:active"}} >
        <div class="input-row row" >
          <div class="col-md-5">
            {{#each this.errors.path}}
              <p class="help-block red">{{this.message}}</p>
            {{/each}}
          </div>
        </div>
        {{render "capacityEditForm" this}}
      </div>
    {{/each}}
  </div>
</div>
