{{!-- Header --}}
<div class="dialog-header">
  {{#if img}}
  <img class="actor-icon" src="{{img}}" alt="{{name}}" />
  {{/if}}
  <div class="dialog-title">
    <h3>{{name}}</h3>
    {{#if competence}}
      <div class="competence-name">
        {{competence.name}}
        {{#if arme}}
          - {{arme.name}}
          {{#if attackType}}
            <span style="color: #8b6914; font-weight: bold;"> ({{attackType}})</span>
          {{/if}}
        {{/if}}
      </div>
    {{else if pouvoir}}
      <div class="competence-name">
        {{pouvoir.name}}
      </div>
    {{else if sort}}
      <div class="competence-name">
        {{sort.name}}
      </div>
    {{else if title}}
      <div class="competence-name">
        {{title}}
      </div>
    {{/if}}
  </div>
</div>

{{!-- Main Content --}}
<div class="dialog-content">

    {{#if (eq mode "rang")}}
  <div class="form-group">
    <label>{{rang.label}}</label>
    <input type="text" value="{{rang.value}}" disabled />
  </div>
  {{/if}}

  {{#if (eq mode "carac")}}
  <div class="form-group">
    <label>Caractéristique</label>
    <input type="text" value="{{carac.label}} ({{carac.value}})" disabled />
  </div>
  {{else}}
  <div class="form-group">
    <label>Caractéristique</label>
    <select id="caracKey" name="caracKey">
      {{selectOptions caracList selected=caracKey valueAttr="abbrev" nameAttr="abbrev" labelAttr="label"}}
    </select>
  </div>
  {{/if}}

  {{#if caracMessage}}
  <div class="info-message">
    {{caracMessage}}
  </div>
  {{/if}}

  {{#if competence}}
  <div class="form-group">
    <label>{{competence.name}}</label>
    <input type="text" value="{{competence.system.niveau}}" disabled />
  </div>
  {{#if competence.nbSpec}}
  <div class="info-message">
    Spécialités : {{competence.specList}}
  </div>
  <div class="form-group">
    <label>Bonus de spécialité ?</label>
    <input type="checkbox" id="useSpecialite" {{checked useSpecialite}} />
  </div>
  {{/if}}
  {{/if}}

  {{#if pouvoir}}
  <div class="form-group weapon-section">
    <div class="form-group">
      <label>Pouvoir</label>
      <input type="text" value="{{pouvoir.name}}" disabled />
    </div>
    <div class="form-group">
      <label>Activation</label>
      <input type="text" value="{{pouvoir.system.activation}}" disabled />
    </div>
    {{#if pouvoirBase}}
    <div class="form-group">
      <label>{{pouvoirBase.label}}</label>
      <input type="text" value="{{pouvoirBase.value}}" disabled />
    </div>
    {{/if}}
    <div class="form-group">
      <label>Points d'usage consommés</label>
      <select id="pouvoirPointsUsage" name="pouvoirPointsUsage">
        {{selectOptions config.pointsUsageList selected=pouvoirPointsUsage}}
      </select>
    </div>
  </div>
  {{/if}}

  {{#each rulesMalus as |malus key|}}
  <div class="form-group">
    <label>{{malus.name}}</label>
    <input type="text" value="{{malus.value}}" disabled />
  </div>
  {{/each}}

  {{#if (and arme arme.system.isMelee)}}
  <div class="combat-modifiers">
    <div class="form-group">
      <label>Attaque à plusieurs</label>
      <select id="bonus-attaque-plusieurs" name="bonus-attaque-plusieurs">
        {{selectOptions config.attaquePlusieursList selected=bonusAttaquePlusieurs}}
      </select>
    </div>
    <div class="form-group">
      <label>Attaque dans le dos ?</label>
      <input type="checkbox" id="attaqueDos" {{checked attaqueDos}} />
    </div>
    <div class="form-group">
      <label>Attaque à deux armes</label>
      <select id="bonus-attaque-deux-armes" name="bonus-attaque-deux-armes">
        {{selectOptions config.attaque2ArmesListe selected=attaqueDeuxArmes valueAttr="value" nameAttr="value" labelAttr="label"}}
      </select>
    </div>
    <div class="form-group">
      <label>Seconde arme</label>
      <select id="bonus-attaque-seconde-arme" name="bonus-attaque-seconde-arme">
        {{selectOptions armes selected=secondeArme valueAttr="id" nameAttr="id" labelAttr="name"}}
      </select>
    </div>
  </div>
  {{/if}}

  {{#if arme}}
  <div class="form-group">
    <label>Attaque ciblée</label>
    <select id="attaque-cible" name="attaque-cible">
      {{selectOptions config.attaqueCible selected=attaqueCible}}
    </select>
  </div>
  {{/if}}

  {{#if sort}}
  <div class="form-group weapon-section">
    <div class="form-group">
      <label>Sort</label>
      <input type="text" value="{{sort.name}} ({{sort.system.niveau}})" disabled />
    </div>
    <div class="form-group">
      <label>Durée</label>
      <input type="text" value="{{sort.system.duree}}" disabled />
    </div>
    <div class="form-group">
      <label>Portée</label>
      <input type="text" value="{{sort.system.portee}}" disabled />
    </div>
    <div class="form-group">
      <label>Ingrédients</label>
      <input type="text" value="{{sort.system.ingredients}}" disabled />
    </div>
  </div>
  {{/if}}

  <div class="form-group">
    <label>Bonus/Malus</label>
    <select id="bonus-malus-context" name="bonus-malus-context">
      {{selectOptions config.bonusMalusContext selected=bonusMalusContext valueAttr="value" nameAttr="value" labelAttr="label"}}
    </select>
  </div>

  {{#if cacheDifficulte}}
  <div class="info-message">
    Difficulté Cachée/Inconnue
  </div>
  {{else}}
  <div class="form-group">
    <label>Difficulté</label>
    <select id="sdValue" name="sdValue">
      {{selectOptions sdList selected=sdValue}}
    </select>
  </div>
  {{/if}}

</div>