<div id='melee' class='gga-table with-notes'>
  <div class='itemmenu header' readonly></div>
  <div class='desc header'>
    <div class='headermenu'>
      <span>{{localize 'GURPS.meleeWeapons'}}</span>
      <i class='fas fa-caret-square-down'></i>
    </div>
  </div>
  <div class='usage header'>{{localize 'GURPS.usage'}}</div>
  <div class='level header'>{{localize 'GURPS.level'}}</div>
  <div class='parry header'>{{localize 'GURPS.parry'}}</div>
  <div class='block header'>{{localize 'GURPS.block'}}</div>
  <div class='damage header'>{{localize 'GURPS.damage'}}</div>
  <div class='reach header'>{{localize 'GURPS.reach'}}</div>
  <div class='st header'>{{localize 'GURPS.attributesST'}}</div>

  {{#each (attackflatlist system.melee)}}
    {{#if ../isEditing}}
      <div class='itemmenu meleemenu' data-key='system.melee.{{@key}}'>
        <i class='fas fa-times'></i>
      </div>

      <div class='desc indent{{indent}}' data-key='system.melee.{{@key}}'>
        <input name='system.melee.{{@key}}.name' class='gcs-input-25' type='text' value='{{name}}' />
        <div class='list_note'>
          <input name='system.melee.{{@key}}.notes' class='gcs-input-25' type='text' value='{{notes}}' />
        </div>
      </div>

      <div class='usage' data-key='system.melee.{{@key}}'>
        <input name='system.melee.{{@key}}.mode' class='gcs-input' type='text' value='{{mode}}' />
      </div>
      <div class='level' data-key='system.melee.{{@key}}'>
        <input name='system.melee.{{@key}}.import' class='gcs-input-sm2' type='text' value='{{import}}' />
      </div>
      <div class='parry' data-key='system.melee.{{@key}}'>
        <input name='system.melee.{{@key}}.parry' class='gcs-input-sm4' type='text' value='{{parry}}' />
      </div>
      <div class='block' data-key='system.melee.{{@key}}'>
        <input name='system.melee.{{@key}}.block' class='gcs-input-sm4' type='text' value='{{block}}' />
      </div>
      <div class='damage' data-key='system.melee.{{@key}}'>
        <input name='system.melee.{{@key}}.damage' class='gcs-input' type='text' value='{{damage}}' />
      </div>
      <div class='reach' data-key='system.melee.{{@key}}'>
        <input name='system.melee.{{@key}}.reach' class='gcs-input-sm3' type='text' value='{{reach}}' />
      </div>
      <div class='st' data-key='system.melee.{{@key}}'>
        <input name='system.melee.{{@key}}.st' class='gcs-input-sm2' type='text' value='{{st}}' />
      </div>
    {{else}}
      {{#unless isCollapsed}}
        <div class='itemmenu' readonly></div>

        <div class='meleedraggable' data-key='system.melee.{{@key}}'>
          <div class='desc dblclkedit indent{{indent}}'>
            <div class='gga-desc-text'>
              <div>
                {{#if hasContains}}<i class='fas fa-caret-down expandcollapseicon'></i>{{/if}}
                {{#if hasCollapsed}}<i class='fas fa-caret-right expandcollapseicon'></i>{{/if}}
              </div>
              <div class='tooltip gga-manual'>
                {{{gurpslink name}}}
                {{#if (displayItemHover this)}}
                  <div class='tooltiptext gga-manual'><img src='{{img}}' /></div>
                {{/if}}
              </div>
              <div>
                {{#if (isFoundryItem this)}}
                  <i class='fas fa-star tooltip gga-item'>
                    <span class='tooltiptext'>{{localize 'GURPS.equipmentFoundryItem'}}</span>
                  </i>
                {{/if}}
              </div>
            </div>
            <div class='list_note'>
              {{{gurpslink notes}}}
            </div>
          </div>
        </div>

        <div class='usage rollable flex-center' data-name='{{name}} ({{mode}})' data-key='system.melee.{{@key}}'
          data-otf='{{quotedAttackName "M" this}}'>{{mode}}</div>
        <div class='level rollable flex-center' data-name='{{name}} ({{mode}})' data-key='system.melee.{{@key}}'
          data-otf='{{quotedAttackName "M" this}}'>{{level}}</div>
        <div class='parry flex-center' style='background-color: #ffffbe; width: 100%;'>
          {{#if (isNum parry)}}
            <span class='flex-center rollable' data-otf='{{quotedAttackName "P" this}}'>{{parry}}</span>
            {{#if (isNum ../system.defenses.parry.bonus)}}
              <span class='flex-center rollable bonus'
                data-otf='{{quotedAttackName "P" this}}" {{{displayNumber ../system.defenses.parry.bonus}}} DB'>
                {{{displayNumber ../system.defenses.parry.bonus}}}</span>
            {{/if}}
          {{/if}}
        </div>
        <div class='block flex-center' style='background-color: #ffffbe'>
          {{#if (isNum block)}}
            <span class='flex-center rollable' data-otf='{{quotedAttackName "B" this}}'>{{block}}</span>
            {{#if (isNum ../system.defenses.block.bonus)}}
              <span class='flex-center rollable bonus'
                data-otf='{{quotedAttackName "B" this}}" {{{displayNumber ../system.defenses.block.bonus}}} DB'>
                {{{displayNumber ../system.defenses.block.bonus}}}</span>
            {{/if}}
          {{/if}}
        </div>
        <div class='damage rollable flex-center' data-damage data-otf='{{damage}}'>{{damage}}</div>
        <div class='reach flex-center'>{{reach}}</div>
        <div class='st flex-center'>{{st}}</div>
      {{/unless}}
    {{/if}}
  {{/each}}
</div>