<section class="character-main character-main-{{ifThen isPlayMode 'play' 'edit'}}">
  {{!log "character-main" this}}
  <fieldset>
    <legend>{{localize "HAMALRON.Label.character"}}</legend>
    <div class="character-pc character-pc-{{ifThen isPlayMode 'play' 'edit'}}">
      <div class="character-left">
        <div class="character-left-image">
          <img class="character-img" src="{{actor.img}}" data-edit="img" data-action="editImage"
            data-tooltip="{{actor.name}}" />
        </div>

      </div>
      <div class="character-right">
        <div class="character-name">
          {{formInput fields.name value=source.name rootId=partId disabled=isPlayMode}}
          <a class="control" data-action="toggleSheet" data-tooltip="HAMALRON.ToggleSheet" data-tooltip-direction="UP">
            <i class="fa-solid fa-user-{{ifThen isPlayMode 'lock' 'pen'}}"></i>
          </a>
        </div>

  <fieldset class="character-definition">
    <div class="flexcol">
      {{#each system.biodata as |bioField key|}}
        {{#if (eq key "age")}}
          {{formField systemFields.biodata.fields.age value=system.biodata.age rootId=partId disabled=isPlayMode}}
        {{/if}}
        {{#if (eq key "gender")}}
          {{formField systemFields.biodata.fields.gender value=system.biodata.gender rootId=partId disabled=isPlayMode}}
        {{/if}}
      {{/each}}
    </div>
  </fieldset>

  <fieldset class="character-stats character-stats-{{ifThen isPlayMode 'play' 'edit'}}">
    <legend>{{localize "HAMALRON.Label.cartesSucces"}}</legend>
    {{#each system.cartesSucces as |carte symbole|}}
    <div class="character-stat">
      <label class="rollable" data-roll-type="carte" data-symbole-id="{{symbole}}"><i class="fa-regular fa-dice"></i>{{carte.label}}</label>
      {{formInput systemFields.cartesSucces.fields.[symbole].fields.value value=carte.value rootId=partId disabled=isPlayMode type="number" }}
      <span>/</span>
      {{formInput systemFields.cartesSucces.fields.[symbole].fields.max value=carte.max rootId=partId disabled=isPlayMode type="number" }}
    </div>
    {{/each}}
  </fieldset>

  <fieldset class="character-resistances">
    <legend>{{localize "HAMALRON.Label.resistances"}}</legend>
    <div class="resistances">
      {{#each system.resistances as |resistance symbole|}}
      <div class="resistance-stat">
        <label>{{resistance.label}}</label>
        {{formInput systemFields.resistances.fields.[symbole].fields.value value=resistance.value rootId=partId disabled=isPlayMode type="number" }}
        <span>/</span>
        {{formInput systemFields.resistances.fields.[symbole].fields.max value=resistance.max rootId=partId disabled=isPlayMode type="number" }}
      </div>
      {{/each}}
    </div>
  </fieldset>

</section>