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

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

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

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

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

      <span><a class="lock-unlock-sheet"><img class="small-button-container" 
        src="systems/fvtt-weapons-of-the-gods/images/icons/{{#if editScore}}unlocked.svg{{else}}locked.svg{{/if}}" alt="Unlocked/Locked"
        >{{#if editScore}}Unlocked{{else}}Locked{{/if}}</a>
      </span>
      
      <div class="grid grid-2col">
        <div class="">              
          <ul>
            {{#each data.statistics as |stat key|}}                
            <li class="item flexrow list-item" data-attr-key="{{key}}">
              <span class="stat-label flexrow" name="{{key}}"><h4><a class="roll-stat" data-stat-key="{{key}}"">{{stat.label}} [{{stat.abbrev}}]</a></h4></span>
              <select class="carac-base flexrow" type="text" name="data.statistics.{{key}}.value" value="{{stat.value}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
                {{#select stat.value}}
                {{{@root.optionsDiceList}}}
                {{/select}}
              </select> 
              <input type="text" class="input-numeric-short padd-right" name="data.statistics.{{key}}.mod" value="{{stat.mod}}" data-dtype="Number"  {{#unless @root.editScore}}disabled{{/unless}}/>
            </li>
            {{/each}}
          </ul>  
        </div>

        <div class="">
          <ul>
            {{#each data.secondary as |stat2 key|}}                
            <li class="item flexrow list-item" data-attr-key="{{key}}">
              <span class="stat-label flexrow" name="{{key}}"><h4>{{stat2.label}}</h4></span>
              <select class="carac-base flexrow" type="text" name="data.secondary.{{key}}.value" value="{{stat2.value}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
                {{#select stat2.value}}
                  {{#if (eq stat2.type "value")}}
                    {{{@root.optionsLevel}}}
                  {{else}}
                    {{{@root.optionsDiceList}}}
                  {{/if}}
                  {{/select}}
              </select> 
            </li>
            {{/each}}
          </ul>  
        </div>
      
      </div>

    </div>


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

      <div class="grid grid-2col">

        <div>
          <span class="generic-label"><h3>Specialisations</h3></span>
          <ul class="stat-list alternate-list">
            {{#each specs as |spec key|}}
            <li class="item stat flexrow list-item" data-item-id="{{spec._id}}">
              <img class="sheet-competence-img" src="{{spec.img}}"/>
              <span class="stat-label"><a class="roll-spec">{{spec.name}}</a></span>
              <span class="stat-label">{{spec.data.statistic}}</span>
              <span class="stat-label">{{spec.data.dice}}</span>
              <div class="item-controls">
                <a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
                <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
              </div>
            </li>
            {{/each}}                
          </ul>          
        </div>
  
        <div>
          <span class="generic-label"><h3>Perks</h3></span>
          <ul class="stat-list alternate-list">
            {{#each perks as |perk key|}}
            <li class="item stat flexrow list-item" data-item-id="{{perk._id}}">
              <img class="sheet-competence-img" src="{{perk.img}}"/>
              <span class="stat-label">{{perk.name}}</span>
              <span class="stat-label">{{perk.data.level}}</span>
              <div class="item-controls">
                <a class="item-control perk-active" title="active">{{#if perk.data.active}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
                <a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
                <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
              </div>
            </li>
            {{/each}}                
          </ul>          
        </div>
      </div>

    </div>
    
    {{!-- Combat Tab --}}
    <div class="tab fight" data-group="primary" data-tab="combat">
      <div class="flexcol">
    
        <span class="generic-label"><h3>Weapons</h3></span>
        <ul class="stat-list alternate-list">
          {{#each weapons as |weapon key|}}
          <li class="item stat flexrow list-item" data-arme-id="{{weapon.id}}" data-item-id="{{weapon._id}}">
            <img class="sheet-competence-img" src="{{weapon.img}}"/>
            <span class="generic-label"><a class="weapon-roll">{{weapon.name}}</a></span>
            <span class="generic-label">{{weapon.data.typeText}}</span>
            <span class="generic-label">Speed {{weapon.data.speed}}</span>
            <span class="generic-label">Damage {{weapon.data.damage}}</span>
            <div class="item-controls">
              <a class="item-control item-equip" title="Equip">{{#if weapon.data.equipped}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
              <a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
              <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
            </div>
          </li>
          {{/each}}                
        </ul>          
    
        <span class="generic-label"><h3>Armor</h3></span>
        <ul class="item-list alternate-list">
          {{#each armors as |armor key|}}
          <li class="item stat flexrow list-item" data-item-id="{{armor._id}}">
            <img class="sheet-competence-img" src="{{armor.img}}"/>
            <span class="stat-label outfit-label">{{armor.name}}</span>
            <div class="item-controls">
              <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-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
              <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
            </div>
          </li>
          {{/each}}
        </ul>
      </div>
    </div>
    
    {{!-- Powers Tab --}}
    <div class="tab fight" data-group="primary" data-tab="powers">
      
      <div class="flexcol">
    
        <span class="generic-label"><h3>Powers</h3></span>
        <ul class="stat-list alternate-list">
          {{#each powers as |power  key|}}
          <li class="item stat flexrow list-item" data-item-id="{{power._id}}">
            <img class="sheet-competence-img" src="{{power.img}}"/>
            <span class="stat-label"><a class="power-roll">{{power.name}}</a></span>
            <div class="item-controls">
              <a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
              <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><h4>Equipment</h4></div>
        <ul class="item-list alternate-list">
          <li class="item flexrow list-item">
            <span class="equipement-label">Name</span>
            <span class="equipement-label">Type</span>
            <div class="item-controls">
              <span class="equipement-label">&nbsp;</span>
              <span class="equipement-label">&nbsp;</span>
              <span class="equipement-label">&nbsp;</span>
            </div>
          </li>
          {{#each equipments as |equip key|}}
          <li class="item flexrow list-item" data-item-id="{{equip._id}}">
            <img class="sheet-competence-img" src="{{equip.img}}"/>
            <span class="equipement-label">{{equip.name}}</span>
            <span class="equipement-label">{{equip.type}}</span>
            <div class="item-controls">
              <a class="item-control item-equip" title="Worn">{{#if equip.data.equipped}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
              <a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
              <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
            </div>
          </li>                  
        {{/each}}
        </ul>
    </div>

    {{!-- Biography Tab --}}
    <div class="tab biodata" data-group="primary" data-tab="biodata">     
      <div class="grid grid-2col">
        <div>
          <ul>
            <li class="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="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="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="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="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">
              <label class="generic-label">Rank</label>
              <select class="competence-base flexrow" type="text" name="data.biodata.rank" value="{{data.biodata.rank}}" data-dtype="Number">
                {{#select data.biodata.rank}}
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
                {{/select}}
              </select>   
            </li>
            <li class="flexrow">
              <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">
              <label class="generic-label">Archetype</label>
              <input type="text" class="" name="data.biodata.archetype" value="{{data.biodata.archetype}}" data-dtype="String"/>
            </li>
            <li class="flexrow">
              <label class="generic-label">Sex</label>
              <input type="text" class="" name="data.biodata.sex" value="{{data.biodata.sex}}" data-dtype="String"/>
            </li>
          </ul>            
        </div>
      </div>
      <hr>
      <h3>Destiny : </h3>
      <ul>
        <li class="flexrow">
          <label class="short-label">Achieved (Total) : </label>
          <input type="text" class="" name="data.destiny.achieved" value="{{data.destiny.achieved}}" data-dtype="Number"/>
        </li>
        <li class="flexrow">
          <label class="short-label">Avanced (Spent) : </label>
          <input type="text" class="" name="data.destiny.advanced" value="{{data.destiny.advanced}}" data-dtype="Number"/>
        </li>
        <li class="flexrow">
          <label class="short-label">Held back (available) : </label>
          <input type="text" class="" name="data.destiny.available" value="{{data.destiny.available}}" data-dtype="Number"/>
        </li>
        </ul>
    
      <hr>
      <h3>Goals : </h3>
      <ul>
        <li class="flexrow">
          <label class="short-label">Immediate : </label>
          <input type="text" class="" name="data.biodata.goalimmediate" value="{{data.biodata.goalimmediate}}" data-dtype="String"/>
        </li>
        <li class="flexrow">
          <label class="short-label">Futur : </label>
          <input type="text" class="" name="data.biodata.goalfutur" value="{{data.biodata.goalfutur}}" data-dtype="String"/>
        </li>
        <li class="flexrow">
          <label class="short-label">Passion : </label>
          <input type="text" class="" name="data.biodata.passion" value="{{data.biodata.passion}}" data-dtype="String"/>
        </li>
        </ul>
    
        <hr>
        <h3>History : </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>

