{{!-- Action Type --}}
<div class="form-group select">
    <label>{{ localize "DND5E.ItemActionType" }}</label>
    <select name="system.actionType">
        {{selectOptions config.itemActionTypes selected=system.actionType blank=""}}
    </select>
</div>
{{#if system.actionType}}

{{!-- Ability Modifier --}}
<div class="form-group select">
    <label>{{ localize "DND5E.AbilityModifier" }}</label>
    <select name="system.ability">
        {{selectOptions config.abilities selected=system.ability labelAttr="label" blank=(localize "DND5E.Default")}}
    </select>
</div>

{{#if system.hasAttack}}
{{!-- Attack Roll Bonus --}}
<div class="form-group">
    <label>{{ localize "DND5E.ItemAttackBonus" }}</label>
    <div class="form-fields">
        <input type="text" name="system.attackBonus" value="{{system.attackBonus}}" data-formula-editor/>
    </div>
</div>

{{!-- Critical Hit Threshold --}}
<div class="form-group">
    <label>{{ localize "DND5E.ItemCritThreshold" }}</label>
    <div class="form-fields">
        {{numberInput system.critical.threshold name="system.critical.threshold" placeholder="20" max=20 min=1 step=1}}
    </div>
</div>

{{!-- Critical Hit Damage --}}
<div class="form-group">
    <label>{{ localize "DND5E.ItemCritExtraDamage" }}</label>
    <div class="form-fields">
        <input type="text" name="system.critical.damage" value="{{system.critical.damage}}">
    </div>
</div>
{{/if}}

{{!-- Damage Formula --}}
<h4 class="damage-header">
    {{#unless isHealing}}{{ localize "DND5E.Damage" }}{{ else }}{{ localize "DND5E.Healing" }}{{/unless}}
    {{ localize "DND5E.Formula" }}
    <a class="damage-control add-damage"><i class="fas fa-plus"></i></a>
</h4>
<ol class="damage-parts form-group">
    {{#each system.damage.parts as |part i| }}
    <li class="damage-part flexrow" data-damage-part="{{i}}">
        <input type="text" name="system.damage.parts.{{i}}.0" value="{{lookup this "0"}}" data-formula-editor/>
        <select name="system.damage.parts.{{i}}.1">
            {{#select (lookup this "1")}}
                <option value="">{{ localize "DND5E.None" }}</option>
                <optgroup label="{{localize 'DND5E.Damage'}}">
                    {{selectOptions @root.config.damageTypes}}
                </optgroup>
                <optgroup label="{{localize 'DND5E.Healing'}}">
                    {{selectOptions @root.config.healingTypes}}
                </optgroup>
            {{/select}}
        </select>
        <a class="damage-control delete-damage"><i class="fas fa-minus"></i></a>
    </li>
    {{/each}}
</ol>

{{!-- Versatile Damage --}}
{{#if system.damage.parts.length }}
<div class="form-group">
    <label>{{ localize "DND5E.VersatileDamage" }}</label>
    <div class="form-fields">
        <input type="text" name="system.damage.versatile" value="{{system.damage.versatile}}"
               placeholder="{{ localize 'DND5E.Formula' }}" data-formula-editor>
    </div>
</div>
{{/if}}

{{!-- Other Formula --}}
<div class="form-group">
    <label>{{ localize "DND5E.OtherFormula" }}</label>
    <div class="form-fields">
        <input type="text" name="system.formula" value="{{system.formula}}"
               placeholder="{{ localize 'DND5E.Formula' }}" data-formula-editor>
    </div>
</div>

{{!-- Saving Throw --}}
<div class="form-group input-select">
    <label>{{ localize "DND5E.ActionSave" }}</label>
    <div class="form-fields">
        <select name="system.save.ability">
            {{selectOptions config.abilities selected=system.save.ability labelAttr="label" blank=""}}
        </select>
        <span>{{ localize "DND5E.VsDC" }}</span>
        <input type="number" step="any" name="system.save.dc"
            value="{{#if system.save.dc}}{{system.save.dc}}{{/if}}"
            placeholder="{{ localize 'DND5E.AbbreviationDC' }}" {{#unless isFlatDC}}disabled{{/unless}}>
        <select name="system.save.scaling">
            {{#select system.save.scaling}}
                <option value="spell">{{ localize "DND5E.Spellcasting" }}</option>
                {{selectOptions config.abilities labelAttr="label"}}
                <option value="flat">{{ localize "DND5E.Flat" }}</option>
            {{/select}}
        </select>
    </div>
</div>

{{!-- Chat Message Flavor --}}
<div class="form-group stacked">
    <label>{{ localize "DND5E.ChatFlavor" }}</label>
    <input type="text" name="system.chatFlavor" value="{{system.chatFlavor}}"/>
</div>
{{/if}}
