<section>
  <div class="header">
    <img
      class="item-img"
      src="{{item.img}}"
      data-edit="img"
      data-action="editImage"
      data-tooltip="{{item.name}}"
    />
    {{formInput fields.name value=source.name}}
  </div>

  {{! Navigation des onglets }}
  <nav class="sheet-tabs tabs" data-group="primary">
    <a class="item {{tabs.details.cssClass}}" data-tab="details">{{localize "PRISMRPG.Label.details"}}</a>
    <a class="item {{tabs.description.cssClass}}" data-tab="description">{{localize "PRISMRPG.Label.description"}}</a>
    <a class="item {{tabs.effects.cssClass}}" data-tab="effects">{{localize "PRISMRPG.Label.effects"}}</a>
  </nav>

  {{! Onglet Details }}
  <div class="tab {{tabs.details.cssClass}}" data-group="primary" data-tab="details">
  <div class="flexrow">
    <div class="align-top">

      {{! Prism RPG: Weapon Type (Light/One-Handed/Heavy/Projectile) }}
      {{formField
        systemFields.weaponType
        value=system.weaponType
        localize=true
        label="PRISMRPG.Label.weaponType"
      }}

      {{! Prism RPG: Weapon Group (6 groups) }}
      {{formField
        systemFields.weaponGroup
        value=system.weaponGroup
        localize=true
        label="PRISMRPG.Label.weaponGroup"
      }}

      {{! Prism RPG: APC (Action Point Cost) }}
      {{formField
        systemFields.apc
        value=system.apc
        localize=true
        label="PRISMRPG.Label.apc"
      }}

      {{! Damage }}
      {{formField
        systemFields.damage
        value=system.damage
        localize=true
        label="PRISMRPG.Label.damage"
      }}

      {{formField
        systemFields.equipped
        value=system.equipped
        localize=true
        label="PRISMRPG.Label.equipped"
      }}

      {{formField
        systemFields.isImplement
        value=system.isImplement
        localize=true
        label="PRISMRPG.Label.isImplement"
      }}

    </div>
    <div class="align-top">

      {{formField
        systemFields.shortRange
        value=system.shortRange
        localize=true
        label="PRISMRPG.Label.shortRange"
      }}

      {{formField
        systemFields.longRange
        value=system.longRange
        localize=true
        label="PRISMRPG.Label.longRange"
      }}

      {{formField
        systemFields.reloadAPC
        value=system.reloadAPC
        localize=true
        label="PRISMRPG.Label.reloadAPC"
      }}

      {{formField
        systemFields.quantity
        value=system.quantity
        localize=true
        label="PRISMRPG.Label.quantity"
      }}

      {{formField
        systemFields.encLoad
        value=system.encLoad
        localize=true
        label="PRISMRPG.Label.encumbranceLoad"
      }}

      {{formField
        systemFields.cost
        value=system.cost
        localize=true
        label="PRISMRPG.Label.cost"
      }}
      {{formField systemFields.money value=system.money localize=true}}
    </div>
  </div>

  {{! Prism RPG: Weapon Passives }}
  <fieldset class="weapon-passives">
    <legend>
      {{localize "PRISMRPG.Label.weaponPassives"}}
      <button type="button" data-action="add-passive" data-tooltip="{{localize 'PRISMRPG.Label.addPassive'}}">
        <i class="fas fa-plus"></i>
      </button>
    </legend>

    {{#each enrichedPassives}}
      <div class="passive-item" data-passive-index="{{@index}}">
        <div class="passive-header">
          {{formInput
            ../systemFields.passives.element.fields.name
            value=this.name
            name=(concat "system.passives." @index ".name")
            placeholder=(localize "PRISMRPG.Label.passiveName")
          }}
          <button type="button" data-action="delete-passive" data-tooltip="{{localize 'PRISMRPG.Label.deletePassive'}}">
            <i class="fas fa-trash"></i>
          </button>
        </div>
        <label>{{localize "PRISMRPG.Label.passiveDescription"}}</label>
        {{formInput
          ../systemFields.passives.element.fields.description
          enriched=this.enrichedDescription
          value=this.description
          name=(concat "system.passives." @index ".description")
          toggled=true
        }}
      </div>
    {{/each}}

    {{#unless enrichedPassives.length}}
      <p class="hint">{{localize "PRISMRPG.Hint.noPassives"}}</p>
    {{/unless}}
  </fieldset>

  {{! Prism RPG: Weapon Maneuvers }}
  <fieldset class="weapon-maneuvers">
    <legend>
      {{localize "PRISMRPG.Label.weaponManeuvers"}}
      <button type="button" data-action="add-maneuver" data-tooltip="{{localize 'PRISMRPG.Label.addManeuver'}}">
        <i class="fas fa-plus"></i>
      </button>
    </legend>

    {{#each enrichedManeuvers}}
      <div class="maneuver-item" data-maneuver-index="{{@index}}">
        <div class="maneuver-header">
          {{formInput
            ../systemFields.maneuvers.element.fields.name
            value=this.name
            name=(concat "system.maneuvers." @index ".name")
            placeholder=(localize "PRISMRPG.Label.maneuverName")
          }}
          <button type="button" data-action="delete-maneuver" data-tooltip="{{localize 'PRISMRPG.Label.deleteManeuver'}}">
            <i class="fas fa-trash"></i>
          </button>
        </div>
        <label>{{localize "PRISMRPG.Label.maneuverDescription"}}</label>
        {{formInput
          ../systemFields.maneuvers.element.fields.description
          enriched=this.enrichedDescription
          value=this.description
          name=(concat "system.maneuvers." @index ".description")
          toggled=true
        }}
      </div>
    {{/each}}

    {{#unless enrichedManeuvers.length}}
      <p class="hint">{{localize "PRISMRPG.Hint.noManeuvers"}}</p>
    {{/unless}}
  </fieldset>
  </div>

  {{! Onglet Description }}
  <div class="tab {{tabs.description.cssClass}}" data-group="primary" data-tab="description">
    <fieldset>
      <legend>{{localize "PRISMRPG.Label.description"}}</legend>
      {{formInput
        systemFields.description
        enriched=enrichedDescription
        value=system.description
        name="system.description"
        toggled=true
      }}
    </fieldset>
  </div>

  {{! Onglet Effects }}
  <div class="tab {{tabs.effects.cssClass}}" data-group="primary" data-tab="effects">
    {{> systems/fvtt-prism-rpg/templates/partial-item-effects.hbs}}
  </div>

</section>