<form class="{{cssClass}}" autocomplete="off">
  <header class="sheet-header">
    <img class="item-sheet-img" src="{{img}}" data-edit="img" title="{{name}}" />
    <div class="header-fields">
      <h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
    </div>
  </header>

  {{> systems/fvtt-te-deum/templates/items/partial-item-nav.hbs}}


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

    {{> systems/fvtt-te-deum/templates/items/partial-item-description.hbs}}

    <div class="tab details" data-group="primary" data-tab="details">

      <div class="tab" data-group="primary">
        <ul>
          <li class="flexrow">
            <label class="item-name-label-long">Etape</label>
            <select name="system.etape">
              {{selectOptions config.etapesEducation selected=system.etape labelAttr="label" blank=""}}
            </select>
          </li>

          {{#if hasMultiplier}}

          {{else}}

            {{#each system.accessible as |access accId|}}
            <li class="flexrow">
              <label class="item-name-label-long">{{getConfigLabel "origineSociale" accId}}</label>
              <input type="checkbox" name="system.accessible.{{accId}}.isaccessible" {{checked access.isaccessible}} />
            </li>
            {{/each}}
          {{/if}} 
          
          <li class="flexrow">
            <label class="item-name-label-long">Nombre de bonus de Caractéristiques</label>
            <input type="text" class="item-field-label-short " name="system.nbChoixCarac"
              value="{{system.nbChoixCarac}}" data-dtype="Number" />
          </li>
          {{#each system.caracteristiques as |carac caracKey|}}
          {{#if carac.valid}}
          <li class="flexrow">
            <label class="item-name-label-long">Caractéristique +1</label>
            <select name="system.caracteristiques.{{caracKey}}.caracId">
              <option value="none">Aucune</option>
              {{selectOptions @root.config.caracteristiques selected=carac.caracId labelAttr="label" blank=""}}
            </select>
          </li>
          {{/if}}
          {{/each}}

          {{#each system.competences as |comp compKey|}}
          {{#if comp.valid}}
          <li class="flexrow">
            <label class="item-name-label-long">Compétence +1</label>
            <select name="system.competences.{{compKey}}.compName">
              {{selectOptions @root.competences selected=comp.compName labelAttr="name" blank=""}}
            </select>
            <label class="item-name-label-long">A choisir?</label>
            <input type="checkbox" name="system.competences.{{compKey}}.toSelect" {{checked comp.toSelect}} />
          </li>
          {{/if}}
          {{/each}}

          {{#if canCompetencesOpt}}
          <li class="flexrow">
            <label class="item-name-label-long">Compétences à choisir ?</label>
            <input type="checkbox" name="system.hasCompetencesOpt" {{checked system.hasCompetencesOpt}} />
          </li>
            {{#if system.hasCompetencesOpt}}
            <li class="flexrow">
              <label class="item-name-label-long">Nombre de compétences à choisir</label>
              <input type="text" class="item-field-label-short" name="system.competencesOptNumber"
                  value="{{system.competencesOptNumber}}" data-dtype="Number" />
            </li>
              {{#each system.competencesOpt as |comp compKey|}}
              <li class="flexrow">
                <label class="item-name-label-long">Compétence +1</label>
                <select name="system.competencesOpt.{{compKey}}.compName">
                  {{selectOptions @root.competences selected=comp.compName labelAttr="name" blank=""}}
                </select>
              </li>
              {{/each}}
            {{/if}}
          {{/if}}


          {{#if hasMultiplier}}
          <li class="flexrow">
            <label class="item-name-label-long">Multiplicateur de cagnotte</label>
            <input type="text" class="item-field-label-short" name="system.cagnotteMultiplier"
              value="{{system.cagnotteMultiplier}}" data-dtype="Number" />
          </li>
          <li class="flexrow">
            <label class="item-name-label-long">Diviseur de cagnotte</label>
            <input type="text" class="item-field-label-short" name="system.cagnotteDivider"
              value="{{system.cagnotteDivider}}" data-dtype="Number" />
          </li>
          <li class="flexrow">
            <label>Trousseau</label>
            <textarea  name="system.trousseau" cols="30" rows="5"/>{{system.trousseau}} </textarea>
          </li>
          {{/if}}


          {{#if hasQuestionnaire}}
          {{#each system.questionnaire as |question quesKey|}}
          <hr>
          <input type="text" class="item-field-label-long2" name="system.questionnaire.{{quesKey}}.question"
            value="{{question.question}}" data-dtype="String" />
          {{#each question.reponses as |reponse repKey|}}
          <li class="flexrow">
            <label class="item-name-label-short item-name-label-text-margin">{{reponse.num}}</label>
            <input type="text" class="item-field-label-long2"
              name="system.questionnaire.{{quesKey}}.reponses.{{repKey}}.reponse" value="{{reponse.reponse}}"
              data-dtype="String" />

            <label class="item-name-label-long">Choix multiple?</label>
            <input type="checkbox" name="system.questionnaire.{{quesKey}}.reponses.{{repKey}}.toSelect" {{checked
              reponse.toSelect}} />
            {{#if reponse.toSelect}}
            {{#each reponse.compList as |comp compKey|}}
            <select class="item-name-label-medium"
              name="system.questionnaire.{{quesKey}}.reponses.{{repKey}}.compList.{{compKey}}.compName">
              {{selectOptions @root.competences selected=comp.compName labelAttr="name" blank=""}}
            </select>
            {{/each}}
            {{else}}
            <select class="item-name-label-medium" name="system.questionnaire.{{quesKey}}.reponses.{{repKey}}.compName">
              {{selectOptions @root.competences selected=reponse.compName labelAttr="name" blank=""}}
            </select>
            {{/if}}
            <label class="item-name-label-short item-name-label-text-margin">+1</label>
          </li>
          {{/each}}

          {{/each}}
          {{/if}}

          {{#if hasDebouches}}
          <label>Débouchés possibles à l'Age Viril</label>
          {{#each system.debouches as |debouche debKey|}}
          <li class="flexrow">
            <input type="text" name="system.debouches.{{debKey}}.debouche" value="{{debouche.debouche}}"/>
          </li>
          {{/each}}
          {{/if}}


        </ul>
      </div>
    </div>

  </section>
</form>