<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>

  <fieldset>
    {{formField systemFields.settings value=system.settings localize=true}}
    {{formField systemFields.weaponType value=system.weaponType localize=true}}
    {{#if (eq system.weaponType "rangedfirearm")}}
      {{formField systemFields.weaponSubtype value=system.weaponSubtype localize=true}}
    {{/if}}

    {{formField systemFields.state value=system.state localize=true}}
    {{formField systemFields.isStunning value=system.isStunning localize=true}}

    <div class="flexrow">
    {{formField systemFields.hasDirectSkill value=system.hasDirectSkill }}
    {{#if system.hasDirectSkill}}
      {{formField systemFields.directSkillValue value=system.directSkillValue }}
    {{/if}}
    </div>

    <div class="flexrow">
      {{formField systemFields.hasDamageDistance value=system.hasDamageDistance localize=true}}
    </div>

    {{#if system.hasDamageDistance}}
        {{#each system.damageDistance as |damageDistance idx|}}
          <div class="flexrow">
            <label class="damage-distance">Distance</label><input type="number" name="system.damageDistance.{{idx}}.distance" value="{{damageDistance.distance}}" min="0" />
            <label>Damage</label><input type="text" name="system.damageDistance.{{idx}}.damage" value="{{damageDistance.damage}}" />
          </div>
        {{/each}}
    {{else}}
      <div class="flexrow">
        {{formField systemFields.damage value=system.damage}}
        {{formField systemFields.applyDamageBonus value=system.applyDamageBonus}}
      </div>
      {{#if isRanged}}
          <div class="flexrow">
        {{formField systemFields.baseRange value=system.baseRange}}
        {{formField systemFields.rangeUnit value=system.rangeUnit localize=true}}
          </div>
      {{/if}}
    {{/if}}

    {{#if isFireArm}}
        <div class="flexrow">
      {{formField systemFields.hasSelectiveFire value=system.hasSelectiveFire}}
      {{formField systemFields.hasSight value=system.hasSight}}
      </div>
      <div class="flexrow">
      {{formField systemFields.ammo.fields.value value=system.ammo.value}}
      {{formField systemFields.ammo.fields.max value=system.ammo.max}}
      </div>
    {{/if}}

    <div class="flexrow">
      {{formField systemFields.lethality value=system.lethality}}
      {{formField systemFields.killRadius value=system.killRadius}}
    </div>

    <div class="flexrow">
    {{formField systemFields.armorPiercing value=system.armorPiercing}}
    {{formField systemFields.resourceLevel value=system.resourceLevel}}
    </div>

  </fieldset>

  <fieldset>
    <legend>{{localize "CTHULHUETERNAL.Label.description"}}</legend>
    {{formInput
    systemFields.description
    enriched=enrichedDescription
    value=system.description
    name="system.description"
    toggled=true
    }}
  </fieldset>
</section>