<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="system.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="system.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="system.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-attack"><a class="combat-button attack-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 Attack</span>
                </a>
              </li>
              <li class="item flexrow list-item color-class-ranged-damage"><a class="combat-button damage-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 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="system.combat.stunlevel" value="{{data.combat.stunlevel}}"
                  data-dtype="Number" />
                <span class="generic-label small-label">Threshold</span>
                <input type="text" class="" name="system.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-long">
                <label class="short-label">Uses remaining</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.system.level}}</span>

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

              {{/if}}
              {{#if perk.system.features.nbtargets.flag}}
              <span class="item-field-label-short">{{perk.system.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.system.status}}" data-dtype="String">
                    {{#select perk.system.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.system.status "ready")}}
              {{#if (eq perk.system.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.system.used1" {{checked perk.system.used1}} /></label></span>
              <span class="item-field-label-short ">&nbsp;</span>
              <span class="item-field-label-short ">&nbsp;</span>
              {{/if}}
              {{#if (eq perk.system.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.system.used1" {{checked
                  perk.system.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.system.used2" {{checked
                  perk.system.used2}} /></label></span>
              <span class="item-field-label-short ">&nbsp;</span>
              {{/if}}
              {{#if (eq perk.system.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.system.used1" {{checked
                  perk.system.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.system.used2" {{checked
                  perk.system.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.system.used3" {{checked
                  perk.system.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}}">
            {{#if effect.system.locked}}
              {{#if @root.isGM}}
                <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img" src="{{effect.img}}" /></a>
              {{else}}
                <img class="sheet-competence-img" src="{{effect.img}}" />
              {{/if}}
            {{else}}
              <a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img" src="{{effect.img}}" /></a>
            {{/if}}
            <span class="item-name-label-long2">{{effect.name}}</span>
            <span class="item-field-label-short">{{effect.system.effectlevel}}</span>
            <span class="item-field-label-short">{{upperFirst effect.system.type}}</span>
            <span class="item-field-label-short">{{upperFirst effect.system.genre}}</span>
            <span class="item-field-label-short">{{upper effect.system.stataffected}}</span>
            <div class="item-filler">&nbsp;</div>
            <div class="item-controls item-controls-fixed">
              {{#if effect.system.locked}}
                {{#if  @root.isGM}}
                  <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
                {{/if}}
              {{else}}
                <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
              {{/if}}
            </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.system.statistic}}</span>
          <span class="item-field-label-short">{{spec.system.dice}}</span>
          {{#if spec.system.ispowergroup}}
          {{#if spec.system.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="system.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="system.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="system.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="system.nrg.max" value="{{data.nrg.max}}"
              data-dtype="Number" />
            <span class="small-label padd-right packed-left"> / {{data.nrg.absolutemax}}</span>
          </li>
          <li class="item flexrow list-item" data-key="nrg">
            <span class="stat-label flexrow" name="nrg">
              <h4>Power Purchase Points (PPP)</h4>
            </span>
            <span class="small-label padd-right packed-left">Available PPP</span><input type="text"
              class="padd-right input-numeric-short" name="system.ppp.available" value="{{data.ppp.available}}"
              data-dtype="Number" />            
            &nbsp;&nbsp;
            <span class="small-label padd-right packed-left">Spent PPP</span><input type="text"
              class="padd-right input-numeric-short" name="system.ppp.spentPPP" value="{{data.ppp.spentPPP}}" disabled  data-dtype="Number" />            
          </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>
            <span class="item-field-label-medium">
              <label class="short-label">PL</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.system.rollneeded}}
              <a class="power-roll">{{power.name}}</a>
              {{else}}
              {{power.name}}
              {{/if}}
            </span>
            <span class="item-field-label-medium">{{upperFirst power.system.type}}</span>

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

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

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

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

            <div class="item-filler">&nbsp;</div>
            <div class="item-controls item-controls-fixed">
              <a class="item-control power-activate" title="Activated">{{#if power.system.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.system.affectedstat}}</span>
            <span class="item-field-label-medium">{{ability.system.statmodifier}}</span>
            <span class="item-field-label-medium">{{upperFirst ability.system.statusaffected}}</span>
            <span class="item-field-label-medium">{{ability.system.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.system.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.system.weight}}</label>
          </span>
          <span class="item-field-label-medium">
            {{#if money.system.idrDice}}
            <a class="roll-idr" data-dice-value="{{money.system.idrDice}}">{{money.system.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-medium">
            <label class="short-label">DMGT</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-filler">&nbsp;</div>
          <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.system.statistic}}</label></span>
          <span class="item-field-label-short"><label>{{upper weapon.system.damagestatistic}}</label></span>
          <span class="item-field-label-short"><label>{{weapon.system.damageDice}}</label></span>
          <span class="item-field-label-medium"><label>{{weapon.system.damagetype}} ({{weapon.system.damagetypelevel}})</label></span>

          {{#if (gt weapon.system.ammomax 0)}}
          <span class="item-field-label-long"><label>{{weapon.system.ammocurrent}}/{{weapon.system.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.system.effects)}}
            {{#if weapon.system.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.system.weight}}</label></span>

          <span class="item-field-label-medium">
            {{#if weapon.system.idrDice}}
            <a class="roll-idr" data-dice-value="{{weapon.system.idrDice}}">{{weapon.system.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 weapon.system.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.system.statistic}}</span>
          <span class="item-field-label-short">{{armor.system.resistanceDice}}</span>
          <span class="item-field-label-medium">{{armor.system.locationprotected}}</span>

          <span class="item-field-label-medium">
            {{#if (count armor.system.effects)}}
            {{#if armor.system.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.system.weight}}</span>
          <span class="item-field-label-medium">
            {{#if armor.system.idrDice}}
            <a class="roll-idr" data-dice-value="{{armor.system.idrDice}}">{{armor.system.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.system.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.system.levelDice}}</span>

          <span class="item-field-label-medium">
            {{#if (count shield.system.effects)}}
            {{#if shield.system.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.system.weight}}</span>
          <span class="item-field-label-medium">
            {{#if shield.system.idrDice}}
            <a class="roll-idr" data-dice-value="{{shield.system.idrDice}}">{{shield.system.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.system.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.system.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">Sex</label>
              <input type="text" class="" name="system.biodata.sex" value="{{data.biodata.sex}}" data-dtype="String" />
            </li>
            <li class="item flexrow">
              <label class="generic-label">Age</label>
              <input type="text" class="" name="system.biodata.age" value="{{data.biodata.age}}" data-dtype="String" />
            </li>
            <li class="item flexrow">
              <label class="generic-label">Height/Weight</label>
              <input type="text" class="" name="system.biodata.weight" value="{{data.biodata.weight}}" data-dtype="String" />
            </li>
            <li class="item flexrow">
              <label class="generic-label">Eyes</label>
              <input type="text" class="" name="system.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="system.biodata.hair" value="{{data.biodata.hair}}" data-dtype="String" />
            </li>
            {{#if isGM}}
              <li class="item flexrow">
                <label class="generic-label">Manual bonuses only ?</label>
                <input type="checkbox" class="change-worstfear" name="system.biodata.noautobonus" {{checked data.biodata.noautobonus}} />
              </li>
            {{/if}}
          </ul>
        </div>
       <div>
          <ul>
            <li class="flexrow item">
              <label class="generic-label">Size</label>
              <input type="text" class="" name="system.biodata.sizenum" value="{{data.biodata.sizenum}}"
                data-dtype="Number" />
              <input type="text" class="" value="{{add data.biodata.sizenum data.biodata.sizebonus}}"
                data-dtype="Number" disabled />
            </li>
            <li class="flexrow item">
              <label class="generic-label">Origin</label>
              <input type="text" class="" name="system.biodata.origin" value="{{data.biodata.origin}}"
                data-dtype="String" />
            </li>
            <li class="flexrow item">
              <label class="generic-label">Preferred Hand</label>
              <input type="text" class="" name="system.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="system.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="system.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.system.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.system.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.system.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.system.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="system.biodata.worstfear" value="{{data.biodata.worstfear}}"
            data-dtype="String" />
          <label class="attribute-value checkbox"><input type="checkbox" class="change-worstfear"
              name="system.biodata.worstfearactive" {{checked data.biodata.worstfearactive}} /> Active ?</label>
        </li>
        <li class="flexrow">
          <label class="short-label">Desires </label>
          <input type="text" class="" name="system.biodata.desires" value="{{data.biodata.desires}}"
            data-dtype="String" />
          <label class="attribute-value checkbox"><input type="checkbox" class="change-desires"
              name="system.biodata.desiresactive" {{checked data.biodata.desiresactive}} /> Active ?</label>
        </li>
        <li class="flexrow">
          <label class="short-label">Morality : </label>
          <input type="text" class="" name="system.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="system.biodata.moralitythreshold" value="{{data.biodata.moralitythreshold}}" disabled data-dtype="Number" />
        </li>
      </ul>

      <h3>Catchphrase : </h3>
      <ul>
        <li class="flexrow">
          <label class="short-label">Catchphrase </label>
          <input type="text" class="" name="system.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="system.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="system.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="system.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="system.biodata.cdp" value="{{data.biodata.cdp}}" data-dtype="Number" />
        </li>
        <li class="flexrow">
          <label class="short-label">Bonus selection : </label>
          <input type="text" class="" name="system.biodata.bonusselection" value="{{data.biodata.bonusselection}}" data-dtype="String" />
        </li>        
        <li class="flexrow">
          <label class="short-label">Hero Level (max) : </label>
          <select class="status-small-label color-class-common" type="text" name="system.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="system.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="system.biodata.threatlevel" value="{{data.biodata.threatlevel}}"
            data-dtype="Number" />
        </li>
      </ul>

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

  </section>
</form>