<div class="flexrow-coc7 combat-header" style="border-bottom: 1px groove;text-align: center;font-weight: bold;">
  <div class="flex2" style="border-right: 1px groove; padding-left: 2px;">{{localize 'CoC7.WeaponName'}}</div>
  <div class="flex4 flexrow-coc7" style="border-right: 1px groove; padding-left: 2px;">
    <div class="flex1">{{localize 'CoC7.WeaponSkill'}}</div>
    <div class="flex1">{{localize 'CoC7.WeaponSkillAlt'}}</div>
  </div>
  <div class=" flex2" style="padding-left: 2px;">{{localize 'CoC7.WeaponDamage'}}</div>
</div>
<ol class="weapons-list" style="padding: 0; margin: 0;">
  {{#each weapons as |weapon id|}}
    {{#if ../data.system.flags.locked}}
      <li class="item weapon flexcol-coc7" data-item-id="{{weapon._id}}">
        <div class="flexrow-coc7" style="align-items: center;">
          <div class="flex2 weapon-name combat rollable" style="border-right: 1px groove;">{{weapon.name}}</div>
          <div class="flexrow-coc7 flex4 weapon-skills" style="border-right: 1px groove; padding-left: 2px;">
            {{#if weapon.skillSet}}
              <div class="item-tag weapon-skill rollable" style="flex: 0 0 49%" data-skill-id="{{weapon.system.skill.main.id}}" title="Roll {{weapon.system.skill.main.name}} skill">{{weapon.system.skill.main.name}} ({{weapon.system.skill.main.value}}%)</div>
              {{#if weapon.usesAlternateSkill}}
                <div class="item-tag weapon-skill rollable" style="flex: 0 0 49%" data-skill-id="{{weapon.system.skill.alternativ.id}}" title="Roll {{weapon.system.skill.alternativ.name}} skill">{{weapon.system.skill.alternativ.name}} ({{weapon.system.skill.alternativ.value}}%)</div>
              {{/if}}
            {{else}}
              <div class="item-tag weapon-skil" style="flex: 0 0 49%; background-color: red;" title="{{ localize 'CoC7.SelectSkill' }}">{{ localize 'CoC7.NoSkill' }}</div>
              {{#if weapon.usesAlternateSkill}}
                <div class="item-tag weapon-skill" style="flex: 0 0 49%; background-color: red" title="{{ localize 'CoC7.SelectSkill' }}">{{ localize 'CoC7.NoSkill' }}</div>
              {{/if}}
            {{/if}}
          </div>
          <div class="flexrow-coc7 flex2" style="font-size: 10px; padding-left: 2px;">
            {{#if weapon.system.properties.rngd}}
              {{#if weapon.system.properties.shotgun}}
                {{#each weapon.system.range as |range key|}}
                  <div class="flex1 weapon-damage" data-range="{{key}}">
                    <a class="roll" data-mode="roll" title="{{range.value}}" data-formula="{{range.damage}}"><i class="fas fa-dice-d20"></i> {{range.damage}}</a>
                  </div>
                {{/each}}
              {{else}}
                <div class="flex1 weapon-damage" data-range="normal">
                  <a class="roll" data-mode="roll" title="{{weapon.system.range.normal.value}}" data-formula="{{weapon.system.range.normal.damage}}"><i class="fas fa-dice-d20"></i> {{weapon.system.range.normal.damage}}</a>
                </div>
              {{/if}}
              <div class='flexrow-coc7' style='flex: 0 0 35px;'>
                <span class="tag" style='line-height: 16px;font-size: 10px;'>{{weapon.system.ammo}}</span>
                <div class='flexcol-coc7' style='font-size: 9px;'>
                  <i class="fas fa-redo-alt reload-weapon" title="Reload"></i>
                  <i class="far fa-plus-square add-ammo" title="Add 1 ammunition"></i>
                </div>
              </div>
            {{else}}
              <div class="flex1 weapon-damage" data-range="normal">
                <a class="roll" data-mode="roll" data-formula="{{weapon.system.range.normal.damage}}" title="{{weapon.system.range.normal.value}}"><i class="fas fa-dice-d20"></i> {{weapon.system.range.normal.damage}}</a>
              </div>
            {{/if}}
            <div class="flex0">
              {{#if weapon.system.properties.addb}}<span class="tag" title="Add DB">{{localize 'CoC7.WeaponAddb'}}</span>{{/if}}
              {{#if weapon.system.properties.ahdb}}<span class="tag" title="Add DB">{{localize 'CoC7.WeaponAhdb'}}</span>{{/if}}
            </div>
          </div>

        </div>
      </li>
    {{else}}
      <li class="item flexcol-coc7" style="border-bottom: 1px groove; margin-bottom: 2px; padding-bottom: 2px;" data-item-id="{{weapon._id}}">
        <div class="flexrow-coc7" style="align-items: center;">
          <div class="flex2">
            <input class="weapon-name" style="display: flex; height: fit-content;padding: 0 1px;text-align: left;" type="text" value="{{weapon.name}}">
          </div>
          <div class="flexrow-coc7 flex4 weapon-skills" style="flex-wrap: nowrap;">

            <div class="flex1 flexrow-coc7">
              <select class="item-tag weapon-skill {{#unless weapon.skillSet}}no-skill-set{{/unless}}" data-skill="main" data-skill-id="{{weapon.system.skill.main.id}}">
                {{#unless weapon.skillSet}}
                  <option></option>
                {{/unless}}
                {{selectOptions ../weaponSkillGroups selected=weapon.system.skill.main.id localize=true valueAttr="id" nameAttr="id" labelAttr="name"}}
              </select>
            </div>
            <div class="flex1 flexrow-coc7">
              {{#if weapon.usesAlternateSkill}}
                <select class="item-tag weapon-skill {{#unless weapon.skillSet}}no-skill-set{{/unless}}" data-skill="alternativ" data-skill-id="{{weapon.system.skill.alternativ.id}}">
                  {{#unless weapon.skillSet}}
                    <option></option>
                  {{/unless}}
                  {{selectOptions ../weaponSkillGroups selected=weapon.system.skill.alternativ.id localize=true valueAttr="id" nameAttr="id" labelAttr="name"}}
                </select>
              {{/if}}
            </div>

          </div>
          <div class="flexrow-coc7 flex2" style="font-size: 10px;">
            {{#if weapon.system.properties.shotgun}}
              {{#each weapon.system.range as |range key|}}
                <div class="flex1">
                  <input class="damage-formula" style="display: flex; height: fit-content;padding: 0 1px;text-align: left;border: 1px solid whitesmoke;" type="text" data-range="{{key}}" value="{{range.damage}}">
                </div>
              {{/each}}
            {{else}}
              <div class="flex1">
                <input class="damage-formula" style="display: flex; height: fit-content;padding: 0 1px;text-align: left;border: 1px solid whitesmoke;" type="text" data-range="normal" value="{{weapon.system.range.normal.damage}}">
              </div>
            {{/if}}
          </div>
          <div class="item-controls">
            <a class="item-control item-edit" title="{{localize 'CoC7.EditWeapon'}}"><i class="fas fa-edit"></i></a>
            <a class="item-control item-delete" title="{{localize 'CoC7.DeleteWeapon'}}"><i class="fas fa-trash"></i></a>
          </div>
        </div>
        <div class="skill-attributes" style="margin-left: 2px;  display: block;" data-set="properties">
          {{#each weapon.system._properties as | property key|}}
            <span class="toggle-switch {{#if property.value}} switched-on {{/if}}" data-property="{{property.id}}">{{localize property.name}}</span>
          {{/each}}
        </div>
      </li>
    {{/if}}
  {{/each}}
</ol>