<form class="{{cssClass}}" autocomplete="off">
    <header class="sheet-header">
        <img src="{{item.img}}" data-edit="img" title="{{item.name}}" height="64" width="64"/>
        <h1><input name="name" type="text" value="{{item.name}}" placeholder="{{ localize 'Name' }}"/></h1>
    </header>
    <div class="sheet-content">
        <div>
            <table>
                <tr>
                    <th>{{localize "rmfrp.weapon.equipped"}}</th>
                    <th>{{localize "rmfrp.item.quantity"}}</th>
                    <th>{{localize "rmfrp.weapon.cost"}}</th>
                    <th>{{localize "rmfrp.weapon.type"}}</th>
                    <th>{{localize "rmfrp.weapon.prod_time"}}</th>
                    <th>{{localize "rmfrp.weapon.weight"}}</th>
                    <th>{{localize "rmfrp.weapon.breakage_range"}}</th>
                    <th>{{localize "rmfrp.weapon.strength"}}</th>

                </tr>
                <td>
                    <input type="checkbox" name="system.equipped" {{checked system.equipped}}/>
                </td>
                <td>
                    <input name="system.quantity" type="text" value="{{system.quantity}}" data-dtype="Number"/>
                </td>
                <td>
                    <input name="system.cost" type="text" value="{{system.cost}}" data-dtype="String"/>
                </td>
                <td>
                    <input name="system.type" type="text" value="{{system.type}}" data-dtype="String"/>
                </td>                
                <td>
                    <input name="system.prod_time" type="text" value="{{system.prod_time}}" data-dtype="String"/>
                </td>
                <td>
                    <input name="system.weight" type="text" value="{{system.weight}}" data-dtype="Number"/>
                </td>
                <td>
                    <input name="system.breakage_range" type="text" value="{{system.breakage_range}}" data-dtype="String"/>
                </td>
                <td>
                    <input name="system.strength" type="text" value="{{system.strength}}" data-dtype="String"/>
                </td>
            </table>

            <table>
              <tr>
                  <th>{{localize "rmfrp.weapon.skill"}}</th>
                  <th>{{localize "rmfrp.weapon.weapon_bonus"}}</th>
              </tr>
              <td>
                  <select class="long-input" name="system.skill" type="text" value="{{system.skill}}" data-dtype="String">
                    {{selectOptions skills selected=system.skill }}
                  </select>
              </td>
              <td>
                  <input class="short-input"  name="system.weapon_bonus" type="text" value="{{system.weapon_bonus}}" data-dtype="Number"/>
              </td>
          </table>


            <table>
              <tr>
                  <th>{{localize "rmfrp.weapon.attack_table"}}</th>
                  <th>{{localize "rmfrp.weapon.max_rank_size"}}</th>
              </tr>
              <td>
                  <select class="long-input" name="system.attack_table" type="text" value="{{system.attack_table}}" data-dtype="String">
                    {{selectOptions attackTables selected=system.attack_table nameAttr="key" valueAttr="key" labelAttr="name"}}
                  </select>
              </td>
              <td>
                  <input class="short-input" name="system.max_rank_size" type="text" value="{{system.max_rank_size}}" data-dtype="Number"/>
              </td>
          </table>

          <table>
            <tr>
                <th>{{localize "rmfrp.weapon.fumble_value"}}</th>
                <th>{{localize "rmfrp.weapon.fumble_table"}}</th>
                <th>{{localize "rmfrp.weapon.fumble_column"}}</th>
            </tr>
            <td>
                <input class="short-input" name="system.fumble_value" type="text" value="{{system.fumble_value}}" data-dtype="Number"/>
            </td>
            <td>
              <select class="long-input" name="system.fumble_table" type="text" value="{{system.fumble_table}}" data-dtype="String">
                {{selectOptions fumbleTables selected=system.fumble_table nameAttr="key" valueAttr="key" labelAttr="name"}}
              </select>
              <td>
                {{#if (eq system.fumble_table "fumble_non_weapon")}}
                <select class="long-input" name="system.fumble_column" type="text" value="{{system.fumble_column}}" data-dtype="String">
                  {{selectOptions fumblesNonWeapon selected=system.fumble_column nameAttr="key" valueAttr="key" labelAttr="name"}}
                </select>
                {{else}}
                <select class="long-input" name="system.fumble_column" type="text" value="{{system.fumble_column}}" data-dtype="String">
                  {{selectOptions fumblesWeapon selected=system.fumble_column nameAttr="key" valueAttr="key" labelAttr="name"}}
                </select>
                {{/if}} 
            </td>
          </td>
      </table>

          <table>
            <tr>
                <th>{{localize "rmfrp.weapon.critical_table"}}</th>
                <th>{{localize "rmfrp.weapon.lsl_crit_column"}}</th>
            </tr>
            <td>
                <select class="long-input"  name="system.critical_table" type="text" value="{{system.critical_table}}" data-dtype="String">
                  {{selectOptions criticalTables selected=system.critical_table nameAttr="key" valueAttr="key" labelAttr="name"}}
                </select>
            </td>
            <td>
                <input class="short-input" name="system.lsl_crit_column" type="text" value="{{system.lsl_crit_column}}" data-dtype="Number"/>
            </td>
          </table>

          <table class="short-input">
            <th class="short-input">{{localize "rmfrp.weapon.range_modifier"}}</th>
            {{#each system.range_modifier as |range idx|}}
            <tr class="short-input">
              <td class="short-input">
                <input class="short-input" name="system.range_modifier.{{@index}}.range" type="text" value="{{range.range}}" data-dtype="Number"/>
              </td>
              <td class="short-input">
                <input class="short-input" name="system.range_modifier.{{@index}}.modifier" type="text" value="{{range.modifier}}" data-dtype="Number"/>  
              </td>
            </tr>
            {{/each}}
          </table>

            {{localize "rmfrp.item.description"}}
                {{editor enrichedDescription target="system.description" button=true owner=owner editable=editable}}
        </div>
    </div>
</form>
