<form id="weapon-creator" class="dialog-v2">
  <div class="header">
    <span>{{localize "dc20rpg.dialog.weaponCreator.title"}}</span>
  </div>

  {{PARTIAL "Tooltip"}}
  <div class="row margin-top-5">
    <span>{{localize "dc20rpg.dialog.weaponCreator.weaponType"}}</span>
    <select class="selectable" data-path="blueprint.weaponType">
      {{selectOptions config.weaponTypes selected=blueprint.weaponType}}
    </select>
  </div>

  {{#ifCond blueprint.weaponType '===' "ranged"}}
    <div class="row margin-top-5">
      <span>{{localize "dc20rpg.dialog.weaponCreator.weaponStyle"}}</span>
      <select class="selectable" data-path="blueprint.weaponStyle">
        {{selectOptions config.rangedWeaponStyles selected=blueprint.weaponStyle}}
      </select>
    </div>
    <div class="row margin-top-5">
      <span>{{localize "dc20rpg.dialog.weaponCreator.dmgType"}}</span>
      <select class="selectable" data-path="blueprint.stats.dmgType">
        {{selectOptions config.dmgTypes selected=blueprint.stats.dmgType}}
      </select>
    </div>
  {{else}}
    <div class="row margin-top-5">
      <span>{{localize "dc20rpg.dialog.weaponCreator.weaponStyle"}}</span>
      <select class="selectable" data-path="blueprint.weaponStyle">
        {{selectOptions config.meleeWeaponStyles selected=blueprint.weaponStyle}}
      </select>
    </div>
    <div class="row margin-top-5">
      <span>{{localize "dc20rpg.dialog.weaponCreator.dmgType"}}</span>
      <select class="selectable" data-path="blueprint.stats.dmgType">
        {{selectOptions config.dmgTypes selected=blueprint.stats.dmgType}}
      </select>
    </div>
    {{#if blueprint.properties.melee.multiFaceted.active}}
    <div class="row margin-top-5">
      <span>{{localize "dc20rpg.dialog.weaponCreator.secondWeaponStyle"}}</span>
      <select class="selectable" data-path="blueprint.secondWeaponStyle">
        {{selectOptions config.meleeWeaponStyles selected=blueprint.secondWeaponStyle}}
      </select>
    </div>
    <div class="row margin-top-5">
      <span>{{localize "dc20rpg.dialog.weaponCreator.secondDmgType"}}</span>
      <select class="selectable" data-path="blueprint.stats.secondDmgType">
        {{selectOptions config.dmgTypes selected=blueprint.stats.secondDmgType}}
      </select>
    </div>
    {{/if}}
  {{/ifCond}}

  {{!-- Properties --}} 
  <div class="grid grid-4col grid-gap-5 margin-top-10">
    {{#ifCond blueprint.weaponType '===' "ranged"}}
    {{#each blueprint.properties.ranged as |property key|}} 
      <a class="activable-box activable {{#if property.active}} active {{/if}} journal-tooltip" data-header="{{labelFromKey key @root.config.properties}}"
            data-path="blueprint.properties.ranged.{{key}}.active" data-uuid="{{labelFromKey key @root.config.propertiesJournal}}"
      >{{labelFromKey key @root.config.properties}}
      </a>
    {{/each}}
    {{else}}
      {{#ifCond blueprint.weaponType '===' "special"}}
      {{#each blueprint.properties.special as |property key|}}
      <a class="activable-box activable {{#if property.active}} active {{/if}} journal-tooltip" data-header="{{labelFromKey key @root.config.properties}}"
            data-path="blueprint.properties.special.{{key}}.active" data-uuid="{{labelFromKey key @root.config.propertiesJournal}}"
      >{{labelFromKey key @root.config.properties}}
      </a>
      {{/each}}
      {{/ifCond}}
    {{#each blueprint.properties.melee as |property key|}}
    <a class="activable-box activable {{#if property.active}} active {{/if}} journal-tooltip" data-header="{{labelFromKey key @root.config.properties}}"
          data-path="blueprint.properties.melee.{{key}}.active" data-uuid="{{labelFromKey key @root.config.propertiesJournal}}"
    >{{labelFromKey key @root.config.properties}}
    </a>
    {{/each}}
    {{/ifCond}}
  </div>

  {{!-- Weapon --}}
  <div class="row stats margin-top-10">
    <span>{{localize "dc20rpg.dialog.weaponCreator.pointsCost"}}</span>
    <span class="range">{{blueprint.stats.pointsCost}}</span>
  </div>
  {{#if blueprint.stats.range.normal}}
  <div class="row stats">
    <span>{{localize "dc20rpg.dialog.weaponCreator.range"}}</span>
    <span class="range">{{blueprint.stats.range.normal}} / {{blueprint.stats.range.max}} {{localize "dc20rpg.item.sheet.target.spaces"}}</span>
  </div>
  {{/if}}
  <div class="row stats">
    <span>{{localize "dc20rpg.dialog.weaponCreator.damage"}}</span>
    <span class="range">{{blueprint.stats.damage}} {{varLocalize 'dc20rpg.reductions.' blueprint.stats.dmgType ''}}</span>
  </div>

  <button class="close create-weapon button margin-top-10">{{localize "dc20rpg.dialog.weaponCreator.create"}}</button>
</form>