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

  {{!-- Sheet Header --}}
  <header class="sheet-header">
    <img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" />
    <div class="header-fields">
      <h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name" /></h1>
      <div class="flexrow">
        <div class="flexrow">
          <div class="flex-group-center">Blessures légères : {{data.nbLegeres}}</div>
          <div class="flex-group-center">Blessures graves : {{data.nbGraves}}</div>
          <div class="flex-group-center">Blessure critique : {{data.nbCritiques}}</div>
        </div>
      </div>
    </div>
  </header>

  {{!-- Sheet Tab Navigation --}}
  <nav class="sheet-tabs tabs" data-group="primary">
    <a class="item" data-tab="carac">Caractéristiques</a>
    <a class="item" data-tab="competences">Compétences</a>
    <a class="item" data-tab="blessures">Blessures</a>
    <a class="item" data-tab="description">Description</a>
  </nav>

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

    {{!-- Carac Tab --}}
    <div class="tab items" data-group="primary" data-tab="carac">
      <div class="grid grid-2col">
        <div class="flex-group-left flexcol">
          <ol class="carac-list">
            {{#each data.carac as |carac key|}}
            <li class="competence flexrow" data-attribute="{{key}}">
              {{#if carac.isTaille}}
              <span class="carac-label flexrow" name="data.carac.{{key}}.label">{{carac.label}}</span>
              {{else}}
              <span class="carac-label flexrow" name="data.carac.{{key}}.label"><a
                  name={{key}}>{{carac.label}}</a></span>
              {{/if}}
              <input class="competence-value flexrow" type="text" name="data.carac.{{key}}.value"
                value="{{carac.value}}" data-dtype="{{carac.type}}" />
            </li>
            {{/each}}
            <li class="competence flexrow">
              <span class="carac-label flexrow" name="carac-total">Total Caractéristiques</span>
              <span class="competence-value flexrow" name="carac-total-value">{{data.caracSum}}</span>
            </li>
          </ol>
        </div>
        <div class="flex-group-left flexcol">
          <ol class="carac-list">
            {{#each data.attributs as |attr key|}}
            <li class="competence flexrow" data-attribute="{{key}}">
              <span class="carac-label flexrow" name="data.attributs.{{key}}.label">{{attr.label}} : </span>
              <span><input class="attribut-value flexrow" type="text" name="data.attributs.{{key}}.value"
                  value="{{attr.value}}" data-dtype="{{attr.type}}" /></span>
            </li>
            {{/each}}
            <li class="competence flexrow" data-attribute="vie">
              <span class="competence-label flexrow" name="data.sante.vie.label">Vie : </span>
              <span><input class="sante-value flexrow" type="text" name="data.sante.vie.value"
                  value="{{data.sante.vie.value}}" data-dtype="Number" /></span><span>/ </span>
              <span><input class="sante-value flexrow" type="text" name="data.sante.vie.max"
                  value="{{data.sante.vie.max}}" data-dtype="Number" /></span>
            </li>
            <li class="competence flexrow" data-attribute="endurance">
              <span class="competence-label flexrow" name="data.sante.endurance.label">Endurance : </span>
              <span><input class="sante-value flexrow" type="text" name="data.sante.endurance.value"
                  value="{{data.sante.endurance.value}}" data-dtype="Number" /></span><span>/ </span>
              <span><input class="sante-value flexrow" type="text" name="data.sante.endurance.max"
                  value="{{data.sante.endurance.max}}" data-dtype="Number" /></span>
            </li>
            <li class="competence flexrow" data-attribute="sonne">
              <span class="competence-label flexrow" name="data.sante.sonne.label">Sonné : </span>
              <input class="resource-content" type="checkbox" name="data.sante.sonne.value"
                value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} />
            </li>
            <li class="competence flexrow" data-attribute="etat">
              <span class="competence-label flexrow" name="data.compteurs.etat.label">Etat Général : </span>
              <span>{{data.compteurs.etat.value}}</span>
            </li>
          </ol>
        </div>
      </div>
    </div>
    
    {{!-- Compétences Tab --}}
    <div class="tab competences" data-group="primary" data-tab="competences">
      <div class="flexcol">
        <div class="flex-group-left flexcol competence-column">
          <ol class="item-list">
            {{#each data.competencecreature  as |comp key|}}
            <li class="item flexrow" data-item-id="{{comp._id}}">
              <img class="sheet-competence-img" src="{{comp.img}}" />
              <span class="competence-label" name="data.competencecreature[{{key}}].name"><a>{{comp.name}}</a></span>
              <input class="competence-value creature-carac" type="text" 
                name="data.competencecreature[{{key}}].data.carac_value" compname="{{comp.name}}"
                value="{{comp.data.carac_value}}" data-dtype="number" />
              <input class="competence-value creature-niveau" type="text"
                name="data.competencecreature[{{key}}].data.niveau" compname="{{comp.name}}"
                value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" />
              <input class="competence-value creature-dommages" type="text"
                name="data.competencecreature[{{key}}]].data.dommages" compname="{{comp.name}}"
                value="{{numberFormat comp.data.dommages decimals=0 sign=true}}" data-dtype="number" />
              <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}}
          </ol>
        </div>
      </div>
    </div>
      
    {{!-- blessures Tab --}}
    <div class="tab blessures" data-group="primary" data-tab="blessures" style="height:200px">
        <span class="blessures-title">Blessures Légeres :</span>
        <div class="blessure-data">
          {{#each data.blessures.legeres.liste as |bless key|}}
          <li class="item flexrow blessure-data" data-blessure-type="legere" data-attribute={{key}}
            data-blessure-index="{{key}}">
            <a class="item-control blessure-control" title="Blessure Légère"
              data-blessure-active="{{bless.active}}">{{#if bless.active}}<i class="fas fa-circle"></i>{{else}}<i
                class="fas fa-genderless"></i>{{/if}}</a>
            Premiers soins <input class="blessures-soins" type="text" name='premiers_soins' data-dtype="number"
              value="{{this.premiers_soins}}" /> -
            Soins complets <input class="blessures-soins" type="text" name='soins_complets' data-dtype="number"
              value="{{this.soins_complets}}" /> -
            Jours <input class="blessures-soins" type="text" name='jours' data-dtype="number" value="{{this.jours}}" />
            -
            Loc. <input class="blessures-soins" type="text" name='localisation' data-dtype="String"
              value="{{this.localisation}}" />
          </li>
          {{/each}}
        </div>
        <span class="blessures-title">Blessures Graves :</span>
        <div>
          {{#each data.blessures.graves.liste as |bless key|}}
          <li class="item flexrow" data-blessure-type="grave" data-attribute={{key}} data-blessure-index="{{key}}">
            <a class="item-control blessure-control" title="Blessure Grave"
              data-blessure-active="{{bless.active}}">{{#if bless.active}}<i class="fas fa-circle"></i>{{else}}<i
                class="fas fa-genderless"></i>{{/if}}</a>
            Premiers soins <input class="blessures-soins" type="text" name="premiers_soins" data-dtype="number"
              value="{{bless.premiers_soins}}" /> -
            Soins complets <input class="blessures-soins" type="text" name="soins_complets" data-dtype="number"
              value="{{bless.soins_complets}}" /> -
            Jours <input class="blessures-soins" type="text" name="jours" data-dtype="number" value="{{bless.jours}}" />
            -
            Loc. <input class="blessures-soins" type="text" name="localisation" data-dtype="String"
              value="{{bless.localisation}}" />
          </li>
          {{/each}}
        </div>
        <span class="blessures-title">Blessure Critique :</span>
        <div>
          {{#each data.blessures.critiques.liste as |bless key|}}
          <li class="item flexrow" data-blessure-type="critique" data-attribute={{key}} data-blessure-index="{{key}}">
            <a class="item-control blessure-control" title="Blessure Critique"
              data-blessure-active="{{bless.active}}">{{#if bless.active}}<i class="fas fa-circle"></i>{{else}}<i
                class="fas fa-genderless"></i>{{/if}}</a>
            Premiers soins <input class="blessures-soins" type="text" name="premiers_soins" data-dtype="number"
              value="{{bless.premiers_soins}}" /> -
            Soins complets <input class="blessures-soins" type="text" name="soins_complets" data-dtype="number"
              value="{{bless.soins_complets}}" /> -
            Jours <input class="blessures-soins" type="text" name="jours" data-dtype="number" value="{{bless.jours}}" />
            -
            Loc. <input class="blessures-soins" type="text" name="localisation" data-dtype="String"
              value="{{bless.localisation}}" />
          </li>
          </li>
          {{/each}}
        </div>
      </div>
      
      {{!-- Biography Tab --}}
      <div class="tab description" data-group="primary" data-tab="description" style="height:400px !important;  min-height: 400px !important;">
        <div class="form-group editor" style="height:400px !important; min-height: 400px !important;">
          {{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
        </div>
      </div>
    
    </div>

  </section>
</form>