<form class="{{cssClass}}" autocomplete="off">

  {{!-- Sheet Header --}}
  <header class="sheet-header">
    <div class="header-fields">
      <h1 class="charname margin-right"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
      <div class="flexrow">
        <img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}" />
        <div class="flexcol">

          <div class="flexrow">
            <div class="stat-item">
              <ul>
                {{#each data.statistics as |stat key|}}
                {{#if (eq stat.col 1)}}
                {{> systems/fvtt-pegasus-rpg/templates/partial-actor-stat-block.html stat=stat key=key}}
                {{/if}}
                {{/each}}
                <li class="item flexrow list-item color-class-pool item-stat-roll" data-attr-key="pool">
                  <span class="stat-icon">
                    <img class="stat-icon" src="icons/dice/d12black.svg">
                  </span>
                  <span class="stat-label stat-margin" name="pool">
                    <h4 class="stat-text-white stat-margin"><a class="generic-pool-roll stat-margin"
                        data-stat-key="pool">Dice Pool</a></h4>
                  </span>
                </li>
              </ul>
            </div>

            <div class="stat-item">
              <ul>
                {{#each data.statistics as |stat key|}}
                {{#if (eq stat.col 2)}}
                {{> systems/fvtt-pegasus-rpg/templates/partial-actor-stat-block.html stat=stat key=key}}
                {{/if}}
                {{/each}}
                <li class="item flexrow list-item color-class-mr item-stat-roll" data-attr-key="mr">
                  <span class="stat-icon">
                    <img class="stat-icon" src="systems/fvtt-pegasus-rpg/images/icons/MR.webp">
                  </span>
                  <span class="stat-label stat-margin" name="mr">
                    <h4 class="stat-text-white stat-margin"><a class="roll-stat stat-margin" data-stat-key="mr">MR</a>
                    </h4>
                  </span>
                  <select class="status-small-label color-class-common" type="text" name="data.mr.value"
                    value="{{data.mr.value}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
                    {{#select data.mr.value}}
                    {{{@root.optionsDiceList}}}
                    {{/select}}
                  </select>
                  <input type="text" class="input-numeric-short padd-right status-small-label color-class-common"
                    name="data.mr.mod" value="{{data.mr.mod}}" data-dtype="Number" {{#unless
                    @root.editScore}}disabled{{/unless}} />
                </li>
              </ul>
            </div>

            <div class="stat-item status-block">
              {{> systems/fvtt-pegasus-rpg/templates/partial-actor-status.html}}
            </div>

            <!--
                            <label class="status-small-label">Active NRG</label> 
                          <input type="text" class="padd-right status-small-label no-grow" name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/>
                          -->

          </div>
        </div>
      </div>
    </div>
  </header>

  {{!-- Sheet Tab Navigation --}}
  <nav class="sheet-tabs tabs" data-group="primary">
    <a class="item" data-tab="combat">Combat</a>
    <a class="item" data-tab="specs">Specialisations</a>
    <a class="item" data-tab="powers">Powers/Abilities</a>
    <a class="item" data-tab="equipment">Equipment</a>
    <a class="item" data-tab="biodata">Biography</a>
  </nav>

  {{!-- Sheet Body --}}
  <section class="sheet-body">

    {{!-- Combat Tab --}}
    <div class="tab fight" data-group="primary" data-tab="combat">
      <div class="flexcol">

        <div class="flexrow">
          
          <div class="stat-item">
            <ul class="stat-list alternate-list">
              <li class="item flexrow list-item color-class-melee"><a class="combat-button attack-melee flexrow">
                  <span class="combat-icon flexrow">
                    <img class="combat-icon" src="systems/fvtt-pegasus-rpg/images/icons/COM.webp">
                  </span>
                  <span class="generic-label combat-margin stat-text-white">Melee Attack</span>
                </a>
              </li>
              <li class="item flexrow list-item color-class-meleedmg"><a class="combat-button damage-melee flexrow">
                  <span class="combat-icon flexrow">
                    <img class="combat-icon" src="systems/fvtt-pegasus-rpg/images/icons/STR.webp">
                  </span>
                  <span class="generic-label combat-margin stat-text-white">Melee/Thrown Damage</span>
                </a>
              </li>
            </ul>
          </div>

          <div class="stat-item">
            <ul class="stat-list alternate-list">
              <li class="item flexrow list-item color-class-ranged"><a class="combat-button attack-ranged flexrow">
                  <span class="combat-icon flexrow">
                    <img class="combat-icon" src="systems/fvtt-pegasus-rpg/images/icons/PER.webp">
                  </span>
                  <span class="generic-label combat-margin stat-text-white">Ranged Attack</span>
                </a>
              </li>
              <li class="item flexrow list-item color-class-range"><a class="combat-button damage-ranged flexrow">
                  <span class="combat-icon flexrow">
                    <img class="combat-icon" src="systems/fvtt-pegasus-rpg/images/icons/AGI.webp">
                  </span>
                  <span class="generic-label combat-margin stat-text-white">Ranged Damage</span>
                </a>
              </li>
            </ul>
          </div>

          <div class="stat-item">
            <ul class="stat-list alternate-list">
              <li class="item flexrow list-item color-class-defence"><a class="combat-button defense-roll flexrow">
                  <span class="combat-icon flexrow">
                    <img class="combat-icon" src="systems/fvtt-pegasus-rpg/images/icons/DEF.webp">
                  </span>
                  <span class="generic-label combat-margin stat-text-white">Defence</span>
                </a>
              </li>
              <li class="item flexrow list-item color-class-dmgres"><a class="combat-button damage-resistance flexrow">
                  <span class="combat-icon flexrow">
                    <img class="combat-icon" src="systems/fvtt-pegasus-rpg/images/icons/PHY.webp">
                  </span>
                  <span class="generic-label combat-margin stat-text-white">Damage Resistance</span>
                </a>
              </li>
            </ul>
          </div>


          <div class="stat-item">
            <span class="flexrow">
              <h3>Stun</h3>
              <span class="status-small-label no-grow">
                <a class="stun-plus plus-minus-button">+</a>
                <a class="stun-minus plus-minus-button">&nbsp;-</a>
              </span>        
            </span>
            <ul class="stat-list alternate-list">
              <li class="item stat flexrow list-item">
                <span class="generic-label small-label">Current</span>
                <input type="text" class="" name="data.combat.stunlevel" value="{{data.combat.stunlevel}}"
                  data-dtype="Number" />
                <span class="generic-label small-label">Threshold</span>
                <input type="text" class="" name="data.combat.stunthreshold" value="{{data.combat.stunthreshold}}"
                  data-dtype="Number" />
              </li>
            </ul>
          </div>
        </div>

        <div>
          <ul class="stat-list alternate-list">
            <li class="item flexrow list-item items-title-bg">
              <span class="item-name-label-header-long">
                <h3><label class="items-title-text">Perks</label></h3>
              </span>
              <span class="item-field-label-short">
                <label class="short-label">Level</label>
              </span>
              <span class="item-field-label-medium">
                <label class="short-label">Range</label>
              </span>
              <span class="item-field-label-short">
                <label class="short-label">#Targets</label>
              </span>
              <span class="item-field-label-long">
                <label class="short-label">Status</label>
              </span>
              <span class="item-field-label-short">
                <label class="short-label">Duration</label>
              </span>
              <span class="item-field-label-short">
                <label class="short-label">&nbsp;</label>
              </span>
              <span class="item-field-label-short">
                <label class="short-label">&nbsp;</label>
              </span>
              <span class="item-field-label-short">
                <label class="short-label">&nbsp;</label>
              </span>
            </li>
            {{#each perks as |perk key|}}
            <li class="item flexrow list-item list-item-shadow" data-item-id="{{perk._id}}">
              <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
                  src="{{perk.img}}" /></a>
              <span class="item-name-label-long">{{perk.name}}</span>

              <span class="item-field-label-short">{{perk.data.level}}</span>

              {{#if perk.data.features.range.flag}}
              <span class="item-field-label-medium">{{perk.data.features.range.value}}</span>
              {{else}}
              <span class="item-field-label-medium">&nbsp;-&nbsp;</span>

              {{/if}}
              {{#if perk.data.features.nbtargets.flag}}
              <span class="item-field-label-short">{{perk.data.features.nbtargets.value}}</span>
              {{else}}
              <span class="item-field-label-short">&nbsp;-&nbsp;</span>
              {{/if}}


              <span class="item-field-label-long">
                {{#if (eq @root.traumaState "severetrauma")}}
                  Disabled
                {{else}}
                  <select class="perk-status" type="text" value="{{perk.data.status}}" data-dtype="String">
                    {{#select perk.data.status}}
                    <option value="ready">Ready</option>
                    <option value="activated">Activated</option>
                    <option value="round2">2 Rounds left</option>
                    <option value="round1">1 Round left</option>
                    {{/select}}
                  </select>
                {{/if}}
              </span>

              {{#if (ne perk.data.status "ready")}}
              {{#if (eq perk.data.nbuse "next1action")}}
              <span class="item-field-label-short "><label
                  class="item-field-label-short attribute-value checkbox"><input type="checkbox" class="perk-used"
                    data-use-index="1" name="perk.data.used1" {{checked perk.data.used1}} /></label></span>
              <span class="item-field-label-short ">&nbsp;</span>
              <span class="item-field-label-short ">&nbsp;</span>
              {{/if}}
              {{#if (eq perk.data.nbuse "next2action")}}
              <span class="item-field-label-short "><label
                  class="item-field-label-short attribute-value checkbox"></label><input type="checkbox"
                  class="perk-used" data-use-index="1" name="perk.data.used1" {{checked
                  perk.data.used1}} /></label></span>
              <span class="item-field-label-short "><label
                  class="item-field-label-short attribute-value checkbox"></label><input type="checkbox"
                  class="perk-used" data-use-index="2" name="perk.data.used2" {{checked
                  perk.data.used2}} /></label></span>
              <span class="item-field-label-short ">&nbsp;</span>
              {{/if}}
              {{#if (eq perk.data.nbuse "next3action")}}
              <span class="item-field-label-short "><label
                  class="item-field-label-short attribute-value checkbox"></label><input type="checkbox"
                  class="perk-used" data-use-index="1" name="perk.data.used1" {{checked
                  perk.data.used1}} /></label></span>
              <span class="item-field-label-short "><label
                  class="item-field-label-short attribute-value checkbox"></label><input type="checkbox"
                  class="perk-used" data-use-index="2" name="perk.data.used2" {{checked
                  perk.data.used2}} /></label></span>
              <span class="item-field-label-short "><label
                  class="item-field-label-short attribute-value checkbox"></label><input type="checkbox"
                  class="perk-used" data-use-index="3" name="perk.data.used3" {{checked
                  perk.data.used3}} /></label></span>
              {{/if}}
              {{else}}
              <span class="item-field-label-short "><label class="item-field-label-short">&nbsp;</label></span>
              <span class="item-field-label-short "><label class="item-field-label-short">&nbsp;</label></span>
              <span class="item-field-label-short "><label class="item-field-label-short">&nbsp;</label></span>
              {{/if}}
              <div class="item-filler">&nbsp;</div>
              <div class="item-controls item-controls-fixed">
                <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
              </div>
            </li>
            {{/each}}
          </ul>
        </div>

        <ul class="stat-list alternate-list">
          <li class="item flexrow list-item items-title-bg">
            <span class="item-name-label-header-long2">
              <h3><label class="items-title-text">Effects</label></h3>
            </span>
            <span class="item-field-label-short">
              <label class="short-label">Level</label>
            </span>
            <span class="item-field-label-short">
              <label class="short-label">Type</label>
            </span>
            <span class="item-field-label-short">
              <label class="short-label">P/N</label>
            </span>
            <span class="item-field-label-long">
              <label class="short-label">Stat</label>
            </span>
          </li>

          {{#each effects as |effect key|}}
          <li class="item stat flexrow list-item list-item-shadow" data-arme-id="{{effect.id}}"
            data-item-id="{{effect._id}}">
            <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
                src="{{effect.img}}" /></a>
            <span class="item-name-label-long2">{{effect.name}}</span>
            <span class="item-field-label-short">{{effect.data.effectlevel}}</span>
            <span class="item-field-label-short">{{upperFirst effect.data.type}}</span>
            <span class="item-field-label-short">{{upperFirst effect.data.genre}}</span>
            <span class="item-field-label-short">{{upper effect.data.stataffected}}</span>
            <div class="item-filler">&nbsp;</div>
            <div class="item-controls item-controls-fixed">
              <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
            </div>
          </li>
          {{/each}}
        </ul>
      </div>
    </div>

    {{!-- Other Tab --}}
    <div class="tab items" data-group="primary" data-tab="specs">

      <ul class="stat-list alternate-list">
        <li class="item flexrow list-item items-title-bg">
          <span class="item-name-label-header">
            <h3><label class="items-title-text">Specialisations</label></h3>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">Stat</label>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">Dice</label>
          </span>
          <span class="item-field-label-long">
            <label class="short-label">Powergroup</label>
          </span>
        </li>
        {{#each specs as |spec key|}}
        <li class="item stat flexrow list-item list-item-shadow" data-item-id="{{spec._id}}">
          <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
              src="{{spec.img}}" /></a>
          <span class="item-name-label"><a class="roll-spec">{{spec.name}}</a></span>
          <span class="item-field-label-short">{{upper spec.data.statistic}}</span>
          <span class="item-field-label-short">{{spec.data.dice}}</span>
          {{#if spec.data.ispowergroup}}
          {{#if spec.data.powersactivated}}
          <span class="item-field-label-long"><a class="spec-group-deactivate">Deactivate</a></span>
          {{else}}
          <span class="item-field-label-long"><a class="spec-group-activate">Activate</a></span>
          {{/if}}
          {{else}}
          <span class="item-field-label-long">&nbsp;-&nbsp;</span>
          {{/if}}
          <div class="item-filler">&nbsp;</div>
          <div class="item-controls item-controls-fixed">
            <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
          </div>
        </li>
        {{/each}}
      </ul>
    </div>

    </div>

    </div>

    {{!-- Powers Tab --}}
    <div class="tab fight" data-group="primary" data-tab="powers">

      <div class="flexcol">

        <ul>
          <li class="item flexrow list-item" data-key="nrg">
            <span class="stat-label flexrow" name="nrg">
              <h4>{{data.nrg.label}}</h4>
            </span>
            <span class="small-label padd-right packed-left">Activated</span><input type="text"
              class="padd-right update-field" data-field-name="data.nrg.activated" value="{{data.nrg.activated}}"
              data-dtype="Number" />
            <span class="small-label padd-right packed-left">&nbsp;Current</span><input type="text"
              class="padd-right update-field" data-field-name="data.nrg.value" value="{{data.nrg.value}}"
              data-dtype="Number" />
              <a class="current-nrg-plus plus-minus-button">+</a>/<a class="current-nrg-minus plus-minus-button">&nbsp;-</a>
            <span class="small-label padd-right packed-left">&nbsp;Mod</span><input type="text"
              class="padd-right update-field" data-field-name="data.nrg.mod" value="{{data.nrg.mod}}"
              data-dtype="Number" />
            <span class="small-label padd-right packed-left">&nbsp;Max</span><input type="text"
              class="padd-right update-field" data-field-name="data.nrg.max" value="{{data.nrg.max}}"
              data-dtype="Number" />
            <span class="small-label padd-right packed-left"> / {{data.nrg.absolutemax}}</span>
          </li>
        </ul>

        <ul class="stat-list alternate-list">
          <li class="item flexrow list-item items-title-bg">
            <span class="item-name-label-header">
              <h3><label class="items-title-text">Powers</label></h3>
            </span>
            <span class="item-field-label-medium">
              <label class="short-label">Type</label>
            </span>
            <span class="item-field-label-short">
              <label class="short-label">Status</label>
            </span>
            <span class="item-field-label-medium">
              <label class="short-label">Action</label>
            </span>
            <span class="item-field-label-medium">
              <label class="short-label">DMG Roll</label>
            </span>
            <span class="item-field-label-medium">
              <label class="short-label">NRG Cost</label>
            </span>
            <span class="item-field-label-medium">
              <label class="short-label">NRG Spent</label>
            </span>
          </li>

          {{#each powers as |power key|}}
          <li class="item stat flexrow list-item list-item-shadow" data-item-id="{{power._id}}">
            <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
                src="{{power.img}}" /></a>
            <span class="item-name-label">
              {{#if power.data.rollneeded}}
              <a class="power-roll">{{power.name}}</a>
              {{else}}
              {{power.name}}
              {{/if}}
            </span>
            <span class="item-field-label-medium">{{upperFirst power.data.type}}</span>

            <span class="item-field-label-short"><label class="short-label">
                {{#if power.data.activated}}
                Activated
                {{else}}
                &nbsp;-&nbsp;
                {{/if}}
              </label>
            </span>

            <span class="item-field-label-medium">{{upperFirst power.data.action}}</span>

            <span class="item-field-label-medium"><a class="power-dmg-roll">
                {{#if power.data.dmgroll}}
                {{upper power.data.dmgstatistic}}
                {{else}}
                &nbsp;-&nbsp;
                {{/if}}
              </a></span>

            <span class="item-field-label-medium">{{power.data.cost}}</span>
            <span class="item-field-label-medium">
              <input type="text" class="padd-right input-numeric-short power-cost-spent"
                value="{{power.data.costspent}}" data-dtype="Number" />
            </span>

            <div class="item-filler">&nbsp;</div>
            <div class="item-controls item-controls-fixed">
              <a class="item-control power-activate" title="Activated">{{#if power.data.activated}}<i
                  class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
              <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
            </div>
          </li>
          {{/each}}
        </ul>

        <ul class="stat-list alternate-list">
          <li class="item flexrow list-item items-title-bg">
            <span class="item-name-label-header">
              <h3><label class="items-title-text">Abilities</label></h3>
            </span>
            <span class="item-field-label-long">
              <label class="short-label">Stat</label>
            </span>
            <span class="item-field-label-medium">
              <label class="short-label">Stat Modifier</label>
            </span>
            <span class="item-field-label-medium">
              <label class="short-label">Affected status</label>
            </span>
            <span class="item-field-label-medium">
              <label class="short-label">Status Modifier</label>
            </span>
          </li>
          {{#each abilities as |ability key|}}
          <li class="item stat flexrow list-item list-item-shadow" data-item-id="{{ability._id}}">
            <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
                src="{{ability.img}}" /></a>
            <span class="item-name-label">{{ability.name}}</span>

            <span class="item-field-label-long">{{upper ability.data.affectedstat}}</span>
            <span class="item-field-label-medium">{{ability.data.statmodifier}}</span>
            <span class="item-field-label-medium">{{upperFirst ability.data.statusaffected}}</span>
            <span class="item-field-label-medium">{{ability.data.statusmodifier}}</span>

            <div class="item-filler">&nbsp;</div>
            <div class="item-controls item-controls-fixed">
              <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
            </div>
          </li>
          {{/each}}
        </ul>

      </div>
    </div>

    {{!-- Equipement Tab --}}
    <div class="tab equipment" data-group="primary" data-tab="equipment">

      <div class="flexrow">
        <h3>Encumbrance</h3>
        <span class="small-label">Current : {{encCurrent}}</span>
        <span class="small-label">Capacity : {{encCapacity}}</span>
        <span class="small-label">Hindrance : {{encHindrance}}</span>
      </div>

      <ul class="item-list alternate-list">
        <li class="item flexrow list-item items-title-bg">
          <span class="item-name-label-header">
            <h3><label class="items-title-text">Money</label></h3>
          </span>
          <span class="item-field-label-long">
            <label class="short-label">Qty</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">Weight</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">IDR</label>
          </span>
          <div class="item-filler">&nbsp;</div>
          <div class="item-controls item-controls-fixed">
            <a class="item-control item-add" data-type="money" title="Create Item"><i class="fas fa-plus"></i></a>
          </div>
        </li>
        {{#each moneys as |money key|}}
        <li class="item flexrow list-item list-item-shadow" data-item-id="{{money._id}}">
          <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
              src="{{money.img}}" /></a>
          <span class="item-name-label">{{money.name}}</span>

          <span class="item-field-label-long"><label>
              {{money.data.quantity}}
              (<a class="quantity-minus plus-minus-button"> -</a>/<a class="quantity-plus plus-minus-button">+</a>)
            </label>
          </span>
          <span class="item-field-label-medium">
            <label>{{money.data.weight}}</label>
          </span>
          <span class="item-field-label-medium">
            {{#if money.data.idrDice}}
            <a class="roll-idr" data-dice-value="{{money.data.idrDice}}">{{money.data.idrDice}}</a>
            {{else}}
            &nbsp;-&nbsp;
            {{/if}}
          </span>

          <div class="item-filler">&nbsp;</div>
          <div class="item-controls item-controls-fixed">
            <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
          </div>
        </li>
        {{/each}}
      </ul>

      <ul class="item-list alternate-list">
        <li class="item flexrow list-item items-title-bg">
          <span class="item-name-label-header">
            <h3><label class="items-title-text">Weapons</label></h3>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">Attack</label>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">Damage</label>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">DMG</label>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">DMGT</label>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">DMGTLVL</label>
          </span>
          <span class="item-field-label-long">
            <label class="short-label">Ammo</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">Act/Deact</label>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">Weight</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">IDR</label>
          </span>
          <div class="item-controls item-controls-fixed">
            <a class="item-control item-add" data-type="weapon" title="Create Item"><i class="fas fa-plus"></i></a>
          </div>
        </li>
        {{#each weapons as |weapon key|}}
        <li class="item flexrow list-item list-item-shadow" data-item-id="{{weapon._id}}">
          <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
              src="{{weapon.img}}" /></a>
          <span class="item-name-label">{{weapon.name}}</span>
          <span class="item-field-label-short"><label>{{upper weapon.data.statistic}}</label></span>
          <span class="item-field-label-short"><label>{{upper weapon.data.damagestatistic}}</label></span>
          <span class="item-field-label-short"><label>{{weapon.data.damageDice}}</label></span>
          <span class="item-field-label-short"><label>{{weapon.data.damagetype}}</label></span>
          <span class="item-field-label-short"><label>{{weapon.data.damagetypelevel}}</label></span>

          {{#if (gt weapon.data.ammomax 0)}}
          <span class="item-field-label-long"><label>{{weapon.data.ammocurrent}}/{{weapon.data.ammomax}}
              (<a class="ammo-minus plus-minus-button"> -</a>/<a class="ammo-plus plus-minus-button">+</a>)
            </label></span>
          {{else}}
          <span class="item-field-label-long"><label>-</label>
          </span>
          {{/if}}

          <span class="item-field-label-medium">
            {{#if (count weapon.data.effects)}}
            {{#if weapon.data.activated}}
            <a class="equip-deactivate">Deactivate</a>
            {{else}}
            <a class="equip-activate">Activate</a>
            {{/if}}
            {{else}}
            &nbsp;-&nbsp;
            {{/if}}
          </span>
          <span class="item-field-label-short"><label>{{weapon.data.weight}}</label></span>

          <span class="item-field-label-medium">
            {{#if weapon.data.idrDice}}
            <a class="roll-idr" data-dice-value="{{weapon.data.idrDice}}">{{weapon.data.idrDice}}</a>
            {{else}}
            &nbsp;-&nbsp;
            {{/if}}
          </span>

          <div class="item-controls item-controls-fixed">
            <a class="item-control item-equip" title="Worn">{{#if weapon.data.equipped}}<i
                class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
            <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
          </div>
        </li>
        {{/each}}
      </ul>

      <ul class="item-list alternate-list">
        <li class="item flexrow list-item items-title-bg">
          <span class="item-name-label-header">
            <h3><label class="items-title-text">Armors</label></h3>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">Stat</label>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">DMG RES</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">Loc</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">Act/Deact</label>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">Weight</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">IDR</label>
          </span>

          <div class="item-filler">&nbsp;</div>
          <div class="item-controls item-controls-fixed">
            <a class="item-control item-add" data-type="armor" title="Create Item"><i class="fas fa-plus"></i></a>
          </div>
        </li>
        {{#each armors as |armor key|}}
        <li class="item list-item flexrow list-item-shadow" data-item-id="{{armor._id}}">
          <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
              src="{{armor.img}}" /></a>
          <span class="item-name-label">{{armor.name}}</span>
          <span class="item-field-label-short">{{upper armor.data.statistic}}</span>
          <span class="item-field-label-short">{{armor.data.resistanceDice}}</span>
          <span class="item-field-label-medium">{{armor.data.locationprotected}}</span>

          <span class="item-field-label-medium">
            {{#if (count armor.data.effects)}}
            {{#if armor.data.activated}}
            <a class="equip-deactivate">Deactivate</a>
            {{else}}
            <a class="equip-activate">Activate</a>
            {{/if}}
            {{else}}
            &nbsp;-&nbsp;
            {{/if}}
          </span>

          <span class="item-field-label-short">{{armor.data.weight}}</span>
          <span class="item-field-label-medium">
            {{#if armor.data.idrDice}}
            <a class="roll-idr" data-dice-value="{{armor.data.idrDice}}">{{armor.data.idrDice}}</a>
            {{else}}
            &nbsp;-&nbsp;
            {{/if}}
          </span>

          <div class="item-filler">&nbsp;</div>
          <div class="item-controls item-controls-fixed">
            <a class="item-control item-equip" title="Worn">{{#if armor.data.equipped}}<i
                class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
            <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
          </div>
        </li>
        {{/each}}
      </ul>

      <ul class="item-list alternate-list">
        <li class="item flexrow list-item items-title-bg">
          <span class="item-name-label-header">
            <h3><label class="items-title-text">Shields</label></h3>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">Dice</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">Act/Deact</label>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">Weight</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">IDR</label>
          </span>
          <div class="item-filler">&nbsp;</div>
          <div class="item-controls item-controls-fixed">
            <a class="item-control item-add" data-type="shield" title="Create Item"><i class="fas fa-plus"></i></a>
          </div>
        </li>
        {{#each shields as |shield key|}}
        <li class="item flexrow list-item list-item-shadow" data-item-id="{{shield._id}}">
          <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
              src="{{shield.img}}" /></a>
          <span class="item-name-label">{{shield.name}}</span>
          <span class="item-field-label-short">{{shield.data.levelDice}}</span>

          <span class="item-field-label-medium">
            {{#if (count shield.data.effects)}}
            {{#if shield.data.activated}}
            <a class="equip-deactivate">Deactivate</a>
            {{else}}
            <a class="equip-activate">Activate</a>
            {{/if}}
            {{else}}
            &nbsp;-&nbsp;
            {{/if}}
          </span>

          <span class="item-field-label-short">{{shield.data.weight}}</span>
          <span class="item-field-label-medium">
            {{#if shield.data.idrDice}}
            <a class="roll-idr" data-dice-value="{{shield.data.idrDice}}">{{shield.data.idrDice}}</a>
            {{else}}
            &nbsp;-&nbsp;
            {{/if}}
          </span>
          <div class="item-filler">&nbsp;</div>
          <div class="item-controls item-controls-fixed">
            <a class="item-control item-equip" title="Worn">{{#if shield.data.equipped}}<i
                class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
            <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
          </div>
        </li>
        {{/each}}
      </ul>

      <ul class="item-list alternate-list">
        <li class="item flexrow list-item items-title-bg">
          <span class="item-name-label-header">
            <h3><label class="items-title-text">Equipment</label></h3>
          </span>
          <span class="item-field-label-long">
            <label class="short-label">Quantity</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">Act/Deact</label>
          </span>
          <span class="item-field-label-short">
            <label class="short-label">Weight</label>
          </span>
          <span class="item-field-label-medium">
            <label class="short-label">IDR</label>
          </span>
          <div class="item-filler">&nbsp;</div>
          <div class="item-controls item-controls-fixed">
            <a class="item-control item-add" data-type="equipment" title="Create Item"><i class="fas fa-plus"></i></a>
          </div>

        </li>
        {{#each containersTree as |equip key|}}
        {{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=equip level=1}}
        <ul class="item-list list-item-shadow2 list-item-margin1">
          {{#each equip.data.contents as |subgear key|}}
          {{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=subgear level=2}}
          {{/each}}
        </ul>
        {{/each}}
      </ul>

      <hr>

    </div>

    {{!-- Biography Tab --}}
    <div class="tab biodata" data-group="primary" data-tab="biodata">
      <div class="grid grid-2col">
        <div>
          <ul class="item-list alternate-list">
            <li class="item flexrow">
              <label class="generic-label">Origin</label>
              <input type="text" class="" name="data.biodata.origin" value="{{data.biodata.origin}}"
                data-dtype="String" />
            </li>
            <li class="item flexrow">
              <label class="generic-label">Age</label>
              <input type="text" class="" name="data.biodata.age" value="{{data.biodata.age}}" data-dtype="String" />
            </li>
            <li class="item flexrow">
              <label class="generic-label">Height</label>
              <input type="text" class="" name="data.biodata.size" value="{{data.biodata.size}}" data-dtype="String" />
            </li>
            <li class="item flexrow">
              <label class="generic-label">Eyes</label>
              <input type="text" class="" name="data.biodata.eyes" value="{{data.biodata.eyes}}" data-dtype="String" />
            </li>
            <li class="item flexrow">
              <label class="generic-label">Hair</label>
              <input type="text" class="" name="data.biodata.hair" value="{{data.biodata.hair}}" data-dtype="String" />
            </li>
          </ul>
        </div>
       <div>
          <ul>
            <li class="flexrow item">
              <label class="generic-label">Weight</label>
              <input type="text" class="" name="data.biodata.weight" value="{{data.biodata.weight}}"
                data-dtype="String" />
            </li>
            <li class="flexrow item">
              <label class="generic-label">Sex</label>
              <input type="text" class="" name="data.biodata.sex" value="{{data.biodata.sex}}" data-dtype="String" />
            </li>
            <li class="flexrow item">
              <label class="generic-label">Preferred Hand</label>
              <input type="text" class="" name="data.biodata.preferredhand" value="{{data.biodata.preferredhand}}"
                data-dtype="String" />
            </li>
            <li class="flexrow item" data-item-id="{{race._id}}">
              <label class="generic-label">Race</label>
              <a class="item-edit"><img class="stat-icon" src="{{race.img}}"></a>
              <input type="text" class="" name="data.biodata.racename" value="{{race.name}}" disabled
                data-dtype="String" />
              <div class="item-controls">
                <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
              </div>
            </li>
            <li class="flexrow item" data-item-id="{{role._id}}">
              <label class="generic-label">Role</label>
              <a class="item-edit"><img class="stat-icon" src="{{role.img}}"></a>
              <input type="text" class="" name="data.biodata.rolename" value="{{role.name}}" disabled
                data-dtype="String" />
              <div class="item-controls">
                <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
              </div>
            </li>
          </ul>
        </div>
      </div>

      <div>
        <ul class="stat-list alternate-list">
        <li class="item flexrow list-item items-title-bg">
          <span class="item-name-label-header">
            <h3><label class="items-title-text">Virtues</label></h3>
          </span>
          <span class="item-field-label-short">Status</label></span>
        </li>
        {{#each virtues as |virtue key|}}
        <li class="item stat flexrow list-item list-item-shadow" data-arme-id="{{virtue.id}}"
          data-item-id="{{virtue._id}}">
          <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
              src="{{virtue.img}}" /></a>
          <span class="item-name-label">{{virtue.name}}</span>
          <span class="item-field-label-short"><label class="short-label">
            {{#if virtue.data.activated}}
            Activated
            {{else}}
            &nbsp;-&nbsp;
            {{/if}}
            </label>
          </span>
          <div class="item-filler">&nbsp;</div>
          <div class="item-controls item-controls-fixed">
            <a class="item-control vice-virtue-activate" title="Activated">{{#if virtue.data.activated}}<i
              class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
            <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
          </div>
        </li>
        {{/each}}
        </ul>
      </div>

      <div>
        <ul class="stat-list alternate-list">
        <li class="item flexrow list-item items-title-bg">
          <span class="item-name-label-header">
            <h3><label class="items-title-text">Vices</label></h3>
          </span>
          <span class="item-field-label-short">Status</label></span>
        </li>
        {{#each vices as |vice key|}}
        <li class="item stat flexrow list-item list-item-shadow" data-arme-id="{{vice.id}}"
          data-item-id="{{vice._id}}">
          <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
              src="{{vice.img}}" /></a>
          <span class="item-name-label">{{vice.name}}</span>
          <span class="item-field-label-short"><label class="short-label">
            {{#if vice.data.activated}}
            Activated
            {{else}}
            &nbsp;-&nbsp;
            {{/if}}
            </label>
          </span>

          <div class="item-filler">&nbsp;</div>
          <div class="item-controls item-controls-fixed">
            <a class="item-control vice-virtue-activate" title="Activated">{{#if vice.data.activated}}<i
              class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
            <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
          </div>
        </li>
        {{/each}}
        </ul>
      </div>

      <ul>
        <li class="item flexrow list-item items-title-bg">
          <span class="item-name-label-header">
            <h3><label class="items-title-text">Psychology</label></h3>
          </span>
        </li>
        <li class="flexrow">
          <label class="short-label">Worst Fear </label>
          <input type="text" class="" name="data.biodata.worstfear" value="{{data.biodata.worstfear}}"
            data-dtype="String" />
          <label class="attribute-value checkbox"><input type="checkbox" class="change-worstfear"
              name="data.biodata.worstfearactive" {{checked data.biodata.worstfearactive}} /> Active ?</label>
        </li>
        <li class="flexrow">
          <label class="short-label">Desires </label>
          <input type="text" class="" name="data.biodata.desires" value="{{data.biodata.desires}}"
            data-dtype="String" />
          <label class="attribute-value checkbox"><input type="checkbox" class="change-desires"
              name="data.biodata.desiresactive" {{checked data.biodata.desiresactive}} /> Active ?</label>
        </li>
      </ul>

      <h3>Catchphrase : </h3>
      <ul>
        <li class="flexrow">
          <label class="short-label">Catchphrase </label>
          <input type="text" class="" name="data.biodata.catchphrase" value="{{data.biodata.catchphrase}}"
            data-dtype="String" />
        </li>
        <li class="flexrow">
          <label class="short-label">Catchphrase Trigger : </label>
          <input type="text" class="" name="data.biodata.catchphrasetrigger" value="{{data.biodata.catchphrasetrigger}}"
            data-dtype="String" />
        </li>
        <li class="flexrow">
          <label class="short-label">Catchphrase used </label>
          <label class="attribute-value checkbox"><input type="checkbox" name="data.biodata.catchphraseused" {{checked
              data.biodata.catchphraseused}} /></label>
        </li>
      </ul>

      <ul>
        <li class="item flexrow list-item items-title-bg">
          <span class="item-name-label-header">
            <h3><label class="items-title-text">Development</label></h3>
          </span>
        </li>
        <li class="flexrow">
          <label class="short-label">Character Value : </label>
          <input type="text" class="" name="data.biodata.charactervalue" value="{{data.biodata.charactervalue}}"
            data-dtype="String" />
        </li>
        <li class="flexrow">
          <label class="short-label">Character Development Points Total (CDP total) : </label>
          <input type="text" class="" name="data.biodata.cdp" value="{{data.biodata.cdp}}" data-dtype="Number" />
        </li>
        <li class="flexrow">
          <label class="short-label">Morality : </label>
          <input type="text" class="" name="data.biodata.morality" value="{{data.biodata.morality}}" data-dtype="Number" />
        </li>
        <li class="flexrow">
          <label class="short-label">Morality threshold : </label>
          <input type="text" class="" name="data.biodata.moralitythreshold" value="{{data.biodata.moralitythreshold}}" disabled data-dtype="Number" />
        </li>
        <li class="flexrow">
          <label class="short-label">Hero Level (max) : </label>
          <select class="status-small-label color-class-common" type="text" name="data.biodata.maxlevelremaining" value="{{data.biodata.maxlevelremaining}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
            {{#select data.biodata.maxlevelremaining}}
            {{{@root.maxLevelRemainingList}}}
            {{/select}}
          </select>
        </li>
        <li class="flexrow">
          <label class="short-label">Hero Levels Remaining : </label>
          <select class="status-small-label color-class-common" type="text" name="data.biodata.currentlevelremaining" value="{{data.biodata.currentlevelremaining}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
            {{#select data.biodata.currentlevelremaining}}
            {{{@root.levelRemainingList}}}
            {{/select}}
          </select>
        </li>
        <li class="flexrow">
          <label class="short-label">Threat Level : </label>
          <input type="text" class="" name="data.biodata.threatlevel" value="{{data.biodata.threatlevel}}"
            data-dtype="Number" />
        </li>
      </ul>

      <hr>
      <h3>Background : </h3>
      <div class="form-group editor">
        {{editor content=data.biodata.description target="data.biodata.description" button=true owner=owner
        editable=editable}}
      </div>
      <hr>
      <h3>Notes : </h3>
      <div class="form-group editor">
        {{editor content=data.biodata.notes target="data.biodata.notes" button=true owner=owner editable=editable}}
      </div>
      <hr>
      </article>
    </div>

  </section>
</form>