<section data-tab="magic" data-group="{{tab.group}}" class="tab {{tab.cssClass}}">

  <fieldset>
    <legend>{{localize "OATHHAMMER.Label.Spells"}}
      {{#unless isPlayMode}}<a data-action="createSpell" class="create-btn"><i class="fa-solid fa-plus"></i></a>{{/unless}}
    </legend>
    {{#if spells.length}}
    <ul class="item-list item-list--spell">
      <li class="item-list-header">
        <span></span>
        <span class="col-name">{{localize "OATHHAMMER.Label.Name"}}</span>
        <span>DV</span>
        <span>{{localize "OATHHAMMER.Label.Tradition"}}</span>
        <span>{{localize "OATHHAMMER.Label.Range"}}</span>
        <span>{{localize "OATHHAMMER.Label.Duration"}}</span>
        <span>{{localize "OATHHAMMER.Label.SpellSave"}}</span>
        <span></span>
      </li>
      {{#each spells as |spell|}}
      <li class="item-entry" data-item-id="{{spell.id}}" data-item-uuid="{{spell.uuid}}">
        <img src="{{spell.img}}" class="item-img" />
        <span class="item-name" {{#if spell._descTooltip}}data-tooltip="{{spell._descTooltip}}"{{/if}}>{{spell.name}}</span>
        <span class="item-detail">{{spell.system.difficultyValue}}</span>
        <span class="item-type">{{spell.traditionLabel}}</span>
        <span class="item-detail item-detail--small">{{#if spell.system.range}}{{spell.system.range}}{{else}}—{{/if}}</span>
        <span class="item-detail item-detail--small">{{#if spell.system.duration}}{{spell.system.duration}}{{else}}—{{/if}}</span>
        <span class="item-detail item-detail--small">{{#if spell.system.spellSave}}{{spell.system.spellSave}}{{else}}—{{/if}}</span>
        <div class="item-actions">
          <a data-action="castNPCSpell" data-item-id="{{spell.id}}" data-tooltip="{{localize 'OATHHAMMER.Action.CastSpell'}}"><i class="fa-solid fa-wand-sparkles spell-cast-icon"></i></a>
          <a data-action="edit" data-item-id="{{spell.id}}" data-item-uuid="{{spell.uuid}}"><i class="fa-solid fa-edit"></i></a>
          <a data-action="delete" data-item-id="{{spell.id}}" data-item-uuid="{{spell.uuid}}"><i class="fa-solid fa-trash"></i></a>
        </div>
      </li>
      {{/each}}
    </ul>
    {{else}}
    <p class="no-items">{{localize "OATHHAMMER.Label.NoSpells"}}</p>
    {{/if}}
  </fieldset>

  <fieldset>
    <legend>{{localize "OATHHAMMER.Label.Miracles"}}
      {{#unless isPlayMode}}<a data-action="createMiracle" class="create-btn"><i class="fa-solid fa-plus"></i></a>{{/unless}}
    </legend>
    {{#if miracles.length}}
    <ul class="item-list item-list--miracle">
      <li class="item-list-header">
        <span></span>
        <span class="col-name">{{localize "OATHHAMMER.Label.Name"}}</span>
        <span>{{localize "OATHHAMMER.Label.DivineTradition"}}</span>
        <span></span>
      </li>
      {{#each miracles as |miracle|}}
      <li class="item-entry" data-item-id="{{miracle.id}}" data-item-uuid="{{miracle.uuid}}">
        <img src="{{miracle.img}}" class="item-img" />
        <span class="item-name" {{#if miracle._descTooltip}}data-tooltip="{{miracle._descTooltip}}"{{/if}}>{{miracle.name}}</span>
        <span class="item-detail">{{miracle.traditionLabel}}</span>
        <div class="item-actions">
          <a data-action="castNPCMiracle" data-item-id="{{miracle.id}}" data-tooltip="{{localize 'OATHHAMMER.Action.InvokeMiracle'}}"><i class="fa-solid fa-hands-praying miracle-cast-icon"></i></a>
          <a data-action="edit" data-item-id="{{miracle.id}}" data-item-uuid="{{miracle.uuid}}"><i class="fa-solid fa-edit"></i></a>
          <a data-action="delete" data-item-id="{{miracle.id}}" data-item-uuid="{{miracle.uuid}}"><i class="fa-solid fa-trash"></i></a>
        </div>
      </li>
      {{/each}}
    </ul>
    {{else}}
    <p class="no-items">{{localize "OATHHAMMER.Label.NoMiracles"}}</p>
    {{/if}}
  </fieldset>

</section>
