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

  {{> systems/fvtt-wasteland/templates/partial-item-header.hbs this}}

  {{> systems/fvtt-wasteland/templates/partial-item-nav.hbs this}}

  {{> systems/fvtt-wasteland/templates/partial-item-description.hbs this}}

  <div class="sheet-body scrollable" data-group="primary" data-tab="details">
    <div class="item-details">
      <div class="form-group">
        <label>Niveau</label>
        <select name="system.niveau" data-dtype="Number">
          {{selectOptions config.listeNiveauSkill selected=system.niveau}}
        </select>
      </div>

      <div class="form-group">
        <label>Attribut 1</label>
        <select name="system.attribut1" data-dtype="String">
          {{selectOptions config.attributs selected=system.attribut1}}
        </select>
      </div>

      <div class="form-group">
        <label>Attribut 2</label>
        <select name="system.attribut2" data-dtype="String">
          <option value="none">Aucun</option>
          {{#each config.attributs}}
          <option value="{{@key}}" {{#if (eq @key ../system.attribut2)}}selected{{/if}}>{{this}}</option>
          {{/each}}
        </select>
      </div>

      <div class="form-group">
        <label>Attribut 3</label>
        <select name="system.attribut3" data-dtype="String">
          <option value="none">Aucun</option>
          {{#each config.attributs}}
          <option value="{{@key}}" {{#if (eq @key ../system.attribut3)}}selected{{/if}}>{{this}}</option>
          {{/each}}
        </select>
      </div>

      <div class="form-group">
        <label>
          <input type="checkbox" name="system.doublebonus" {{checked system.doublebonus}} />
          Les bonus de Bonne Aventure et d'Eclat peuvent être doublés (cf. Métier)
        </label>
      </div>

      <div class="detail-section">
        <h3>Prédilections</h3>
        <div class="predilections-container">
          {{#if system.predilections.length}}
          <ul class="predilections-list">
            {{#each system.predilections as |predilection key|}}
            <li class="predilection-item flexrow" data-prediction-index="{{key}}">
              <div class="predilection-main">
                <input
                  type="text"
                  class="predilection-name"
                  name="system.predilections.{{key}}.name"
                  value="{{predilection.name}}"
                  placeholder="Nom de la prédilection"
                  data-dtype="String"
                />
              </div>
              <div class="predilection-controls">
                <label class="predilection-used" title="Marquer comme utilisée">
                  <input
                    type="checkbox"
                    name="system.predilections.{{key}}.used"
                    {{checked predilection.used}}
                  />
                  <span>Utilisée</span>
                </label>
                <a
                  class="predilection-delete"
                  title="Supprimer cette prédilection"
                  data-action="delete-predilection"
                  data-index="{{key}}"
                >
                  <i class="fas fa-trash"></i>
                </a>
              </div>
            </li>
            {{/each}}
          </ul>
          {{else}}
          <p class="no-predilections">Aucune prédilection définie.</p>
          {{/if}}
          <button type="button" class="add-predilection-btn" data-action="add-predilection">
            <i class="fas fa-plus"></i> Ajouter une prédilection
          </button>
        </div>
      </div>
    </div>
  </div>

</section>
