<div class="tab reserve sheet-part {{#if @root.tabs.reserve.active}}active{{/if}}" data-group="sheet" data-tab="reserve">
  <div class="grid grid-2col">
    {{!-- Réserve et Moral --}}
    <div class="grid-span-2">
      <h4>{{ localize 'VERMINE.reserve' }}</h4>
      <div class="reserve-control flexrow flex-group-center">
        <label>{{ localize 'VERMINE.pool' }}:</label>
        {{#if isEditMode}}
        <input type="number" name="system.reserve.value" value="{{system.reserve.value}}"
               data-dtype="Number" min="{{system.reserve.min}}" max="{{system.reserve.max}}" />
        {{else}}
        <span>{{system.reserve.value}}</span>
        {{/if}}
        <span>/ {{system.reserve.max}}D</span>
      </div>
      <div class="reserve-dice flexrow">
        {{#repeat system.reserve.max 1 "d"}}
        <div class="hexa {{#iflteq @d @root.system.reserve.value}}checked{{/iflteq}}">
          <input type="radio" data-dtype="Number" name="system.reserve.value" value="{{@d}}" data-action="clickRadio" />
        </div>
        {{/repeat}}
      </div>
      <div class="morale-control flexrow flex-group-center">
        <label>{{ localize 'VERMINE.morale' }}:</label>
        {{#if isEditMode}}
        <select name="system.morale.level">
          <option value="high" {{#if (eq system.morale.level "high")}}selected{{/if}}>{{ localize 'VERMINE.morale_high' }}</option>
          <option value="normal" {{#if (eq system.morale.level "normal")}}selected{{/if}}>{{ localize 'VERMINE.morale_normal' }}</option>
          <option value="low" {{#if (eq system.morale.level "low")}}selected{{/if}}>{{ localize 'VERMINE.morale_low' }}</option>
          <option value="crisis" {{#if (eq system.morale.level "crisis")}}selected{{/if}}>{{ localize 'VERMINE.morale_crisis' }}</option>
        </select>
        {{else}}
        <span>{{system.morale.level}}</span>
        {{/if}}
        {{#if isEditMode}}
        <input type="number" name="system.morale.value" value="{{system.morale.value}}"
               data-dtype="Number" min="{{system.morale.min}}" max="{{system.morale.max}}" />
        {{else}}
        <span>{{system.morale.value}}</span>
        {{/if}}
        <span>/ {{system.morale.max}}D</span>
      </div>
      <div class="experience-control flexrow flex-group-center">
        <label>{{ localize 'VERMINE.experience_dice' }}:</label>
        {{#if isEditMode}}
        <input type="number" name="system.experience.dice" value="{{system.experience.dice}}"
               data-dtype="Number" min="0" />
        {{else}}
        <span>{{system.experience.dice}}</span>
        {{/if}}
        <span>D</span>
      </div>
      <div class="group-experience-actions flexrow flex-group-center">
        <button type="button" data-action="openLearning"><i class="fas fa-graduation-cap"></i> {{ localize 'VERMINE.open_learning' }}</button>
        <button type="button" data-action="openExperiencePhase"><i class="fas fa-star"></i> {{ localize 'VERMINE.experience_phase' }}</button>
        <button type="button" data-action="validatePhase"><i class="fas fa-check"></i> {{ localize 'VERMINE.validate_phase' }}</button>
      </div>
    </div>

    {{!-- Membres --}}
    <div class="grid-span-2">
      <h4>{{ localize 'VERMINE.group_members' }}{{#if isEditMode}}<a class="item-control chooseActor" data-action="chooseActor" data-list="members" title="{{ localize 'UI.add' }}" data-type="members"><i class="fas fa-plus"></i></a>{{/if}}</h4>
      <ol class="group-list">
        {{#each system.members as |memberId|}}
          {{#with (lookup ../resolvedMembers memberId) as |member|}}
          <li class="actor" data-actor-id="{{memberId}}">
            <div class="actor-name">
              {{#if member}}
                <a class="item-control">{{member.name}}</a>
              {{else}}
                <a class="item-control" style="color: red;">ID: {{memberId}}</a>
              {{/if}}
            </div>
            <div class="item-controls">
              {{#if @root.isEditMode}}
              <a class="item-control member-delete" data-action="deleteMember" data-actor-id="{{memberId}}" title="{{ localize 'UI.effect_delete' }}"><i class="fas fa-trash"></i></a>
              {{/if}}
            </div>
          </li>
          {{/with}}
        {{/each}}
      </ol>
    </div>
  </div>
</div>
