<div class="tab totem sheet-part {{#if @root.tabs.totem.active}}active{{/if}}" data-group="sheet" data-tab="totem">
  {{#if system.identity.totem}}
  <div class="totem-details">
    <img
      class="img-totem"
      src="/systems/vermine2047/assets/images/ui/totems/{{system.identity.totem}}.webp"
      alt="{{smarttl 'TOTEMS' system.identity.totem 'name'}}"
      width="80"
      height="80" />
    <h4 class="align-center">
      {{smarttl "TOTEMS" system.identity.totem "name"}}
    </h4>
    <p style="font-size:80%;">{{smarttl "TOTEMS" system.identity.totem "description"}}</p>
    <div class="grid grid-2col">
      <div class>
        <div class="item-name"><strong>{{ localize 'IDENTITY.instincts' }}</strong><br />{{smarttl "TOTEMS" system.identity.totem "instincts"}}</div>
      </div>
      <div class>
        <div class="item-name"><strong>{{ localize 'IDENTITY.prohibits' }}</strong><br />{{smarttl "TOTEMS" system.identity.totem "bans"}}</div>
      </div>
    </div>
  </div>
  <hr />

  {{else}}

  <h3>choisissez un totem</h3>

  {{/if}}

  <div class="chaman-toggle flexrow flex-group-center">
    <label for="identity-chaman">{{ localize 'VERMINE.chaman' }}</label>
    <input type="checkbox" id="identity-chaman" name="system.identity.chaman" data-dtype="Boolean" {{#if system.identity.chaman}}checked{{/if}} />
  </div>

  {{!-- Abstract Items --}}
  <div class="grid grid-2col">
    <div>
      <h4>
        <span>{{localize "ITEMS.abilities"}}</span>
        {{#if isEditMode}}
        <a
          class="item-control item-create"
          title="Create item"
          data-action="create"
          data-type="ability"><i class="fas fa-plus"></i></a>
        {{/if}}
      </h4>
      <ol class="list-item">
        {{#each abilities as |item id|}}
        <li class="item flexrow" data-item-id="{{item._id}}">
          <div class="item-name flexrow" style="flex:4;">
            <a
              class="item-control item-edit"
              data-action="edit"
              data-item-id="{{item._id}}"
              data-tooltip="edit">{{item.name}}</a>
            <span class="hexa"
              data-tooltip="niveau">{{item.system.level.value}}</span>
            <span
              data-tooltip="apprentissage">
              {{item.system.learn.threshold}}{{#ifgt item.system.learn.hindrance 0}}/{{ roman item.system.learn.hindrance }}{{/ifgt}}
            </span>
          </div>
          <div class="item-controls flexrow">
            {{#if item.system.description}}
            <i
              class="fas fa-circle-question"
              data-tooltip="{{item.system.description}}"></i>
            {{/if}}
            {{#if @root.isEditMode}}
            <a class="item-control item-delete" data-action="delete" data-item-id="{{item._id}}" title="Delete Item"><i
                class="fas fa-trash"></i></a>
            {{/if}}
          </div>
        </li>
        {{/each}}
      </ol>
    </div>
    <div>
      <h4>
        <span>{{localize "ITEMS.specialties"}}</span>
        {{#if isEditMode}}
        <a
          class="item-control item-create"
          title="Create item"
          data-action="create"
          data-type="specialty"><i class="fas fa-plus"></i></a>
        {{/if}}
      </h4>
      <ol class="list-item">
        {{#each specialties as |item id|}}
        <li class="item flexrow" data-item-id="{{item._id}}">
          <div class="item-name" style="flex:4;">
            <a
              class="item-control item-edit"
              data-action="edit"
              data-item-id="{{item._id}}"
              title="Edit Item">{{item.name}}</a>
          </div>
          <div class="item-controls flexrow">
            {{#if item.system.description}}
            <i
              class="fas fa-circle-question"
              data-tooltip="{{item.system.description}}"></i>
            {{/if}}
            {{#if @root.isEditMode}}
            <a class="item-control item-delete" data-action="delete" data-item-id="{{item._id}}" title="Delete Item"><i
                class="fas fa-trash"></i></a>
            {{/if}}
          </div>
        </li>
        {{/each}}
      </ol>
    </div>
    <div>
      <h4>
        <span>{{localize "ITEMS.backgrounds"}}</span>
        {{#if isEditMode}}
        <a
          class="item-control item-create"
          title="Create item"
          data-action="create"
          data-type="background"><i class="fas fa-plus"></i></a>
        {{/if}}
      </h4>
      <ol class="list-item">
        {{#each backgrounds as |item id|}}
        <li class="item flexrow" data-item-id="{{item._id}}">
          <div class="item-name" style="flex:4;">
            <a
              class="item-control item-edit"
              data-action="edit"
              data-item-id="{{item._id}}"
              title="Edit Item">{{item.name}}</a>
          </div>
          <div class="item-controls flexrow">
            {{#if item.system.description}}
            <i
              class="fas fa-circle-question"
              data-tooltip="{{item.system.description}}"></i>
            {{/if}}
            {{#if @root.isEditMode}}
            <a class="item-control item-delete" data-action="delete" data-item-id="{{item._id}}" title="Delete Item"><i
                class="fas fa-trash"></i></a>
            {{/if}}
          </div>
        </li>
        {{/each}}
      </ol>
    </div>
    <div>
      <h4>
        <span>{{localize "ITEMS.traumas"}}</span>
        {{#if isEditMode}}
        <a
          class="item-control item-create"
          title="Create item"
          data-action="create"
          data-type="trauma"><i class="fas fa-plus"></i></a>
        {{/if}}
      </h4>
      <ol class="list-item">
        {{#each traumas as |item id|}}
        <li class="item flexrow" data-item-id="{{item._id}}">
          <div class="item-name" style="flex:4;">
            <a
              class="item-control item-edit"
              data-action="edit"
              data-item-id="{{item._id}}"
              title="Edit Item">{{item.name}}</a>
          </div>
          <div class="item-controls flexrow">
            {{#if item.system.description}}
            <i
              class="fas fa-circle-question"
              data-tooltip="{{item.system.description}}"></i>
            {{/if}}
            {{#if @root.isEditMode}}
            <a class="item-control item-delete" data-action="delete" data-item-id="{{item._id}}" title="Delete Item"><i
                class="fas fa-trash"></i></a>
            {{/if}}
          </div>
        </li>
        {{/each}}
      </ol>
    </div>
    <div>
      <h4>
        <span>{{localize "ITEMS.evolutions"}}</span>
        {{#if isEditMode}}
        <a
          class="item-control item-create"
          title="Buy evolution"
          data-action="buyEvolution"><i class="fas fa-cart-shopping"></i></a>
        {{/if}}
      </h4>
      <ol class="list-item">
        {{#each evolutions as |item id|}}
        <li class="item flexrow" data-item-id="{{item._id}}">
          <div class="item-name" style="flex:4;">
            <a
              class="item-control item-edit"
              data-action="edit"
              data-item-id="{{item._id}}"
              title="Edit Item">{{item.name}}</a>
            {{#if item.system.mutation}}
            <span class="evolution-badge mutation">{{ localize 'VERMINE.evolution_mutation' }}</span>
            {{else}}
            <span class="evolution-badge adaptation">{{ localize 'VERMINE.evolution_adaptation' }}</span>
            {{/if}}
          </div>
          <div class="item-controls flexrow">
            {{#if item.system.description}}
            <i
              class="fas fa-circle-question"
              data-tooltip="{{item.system.description}}"></i>
            {{/if}}
            {{#if @root.isEditMode}}
            <a class="item-control item-delete" data-action="delete" data-item-id="{{item._id}}" title="Delete Item"><i
                class="fas fa-trash"></i></a>
            {{/if}}
          </div>
        </li>
        {{/each}}
      </ol>
    </div>
    {{#if system.identity.chaman}}
    <div>
      <h4>
        <span>{{localize "ITEMS.rites"}}</span>
        {{#if isEditMode}}
        <a
          class="item-control item-create"
          title="Create item"
          data-action="create"
          data-type="rite"><i class="fas fa-plus"></i></a>
        {{/if}}
      </h4>
      <ol class="list-item">
        {{#each rites as |item id|}}
        <li class="item flexrow" data-item-id="{{item._id}}">
          <div class="item-name" style="flex:4;">
            <a
              class="item-control item-edit"
              data-action="edit"
              data-item-id="{{item._id}}"
              title="Edit Item">{{item.name}}</a>
          </div>
          <div class="item-controls flexrow">
            {{#if item.system.description}}
            <i
              class="fas fa-circle-question"
              data-tooltip="{{item.system.description}}"></i>
            {{/if}}
            {{#if @root.isEditMode}}
            <a class="item-control item-delete" data-action="delete" data-item-id="{{item._id}}" title="Delete Item"><i
                class="fas fa-trash"></i></a>
            {{/if}}
          </div>
        </li>
        {{/each}}
      </ol>
    </div>
    {{/if}}
  </div>
</div>
