<form class="{{cssClass}} flexcol" autocomplete="off">

    {{!-- Item Sheet Header --}}
    <header class="sheet-header flexrow">
        <img class="profile" src="{{item.img}}" data-tooltip="{{item.name}}" data-edit="img">

        <div class="header-details flexrow">
            <h1 class="charname">
                <input name="name" type="text" value="{{item.name}}" placeholder="{{ localize 'DND5E.ItemName' }}">
            </h1>

            <div class="item-subtitle">
                <h4 class="item-type">{{itemType}}</h4>
                <span class="item-status">{{itemStatus}}</span>
            </div>

            <ul class="summary flexrow">
                <li>
                    {{labels.featType}}
                </li>
                <li>
                    <input type="text" name="system.requirements" value="{{system.requirements}}" placeholder="{{ localize 'DND5E.Requirements' }}">
                </li>
                <li>
                    {{> "dnd5e.item-source"}}
                </li>
            </ul>
        </div>
    </header>

    {{!-- Item Sheet Navigation --}}
    <nav class="sheet-navigation tabs" data-group="primary">
        <a class="item active" data-tab="description">{{ localize "DND5E.Description" }}</a>
        <a class="item" data-tab="details">{{ localize "DND5E.Details" }}</a>
        <a class="item" data-tab="effects">{{ localize "DND5E.Effects" }}</a>
    </nav>

    {{!-- Item Sheet Body --}}
    <section class="sheet-body">

        {{!-- Description Tab --}}
        {{> "dnd5e.item-description" }}

        {{!-- Details Tab --}}
        <div class="tab details" data-group="primary" data-tab="details">
            <h3 class="form-header">{{ localize "DND5E.ItemFeatureDetails" }}</h3>

            {{!-- Feature Type --}}
            <div class="form-group">
                <label>{{ localize "DND5E.ItemFeatureType" }}</label>
                <select name="system.type.value">
                    {{ selectOptions config.featureTypes selected=system.type.value blank="" labelAttr="label" }}
                </select>
            </div>

            {{#if itemSubtypes}}
            <div class="form-group">
                <label>
                    {{ localize "DND5E.ItemFeatureSubtype"
                                category=(lookup (lookup config.featureTypes system.type.value) "label") }}
                </label>
                <select name="system.type.subtype">
                    {{ selectOptions itemSubtypes selected=system.type.subtype blank="" }}
                </select>
            </div>
            {{/if}}

            {{!-- Feature Properties --}}
            <div class="feature-properties form-group stacked">
                <label>{{ localize "DND5E.ItemFeatureProperties" }}</label>
                {{#each properties}}
                <label class="checkbox">
                    <input type="checkbox" name="system.properties.{{ @key }}" {{ checked selected }}> {{ label }}
                </label>
                {{/each}}
            </div>

            <h3 class="form-header">{{ localize "DND5E.Prerequisites.Header" }}</h3>

            <div class="form-group">
                <label>{{ localize "DND5E.Prerequisites.FIELDS.prerequisites.level.label" }}</label>
                {{ numberInput system.prerequisites.level name="system.prerequisites.level" step=1 }}
                <p class="hint">{{ localize "DND5E.Prerequisites.FIELDS.prerequisites.level.hint" }}</p>
            </div>

            {{#if system.isEnchantmentSource}}
            <h3 class="form-header">{{ localize "DND5E.ENCHANTMENT.Label" }}</h3>

            <div class="form-group">
                <label>{{ localize "DND5E.ENCHANTMENT.FIELDS.enchantment.items.max.label" }}</label>
                <input type="text" name="system.enchantment.items.max" value="{{ source.enchantment.items.max }}">
                <p class="hint">{{ localize "DND5E.ENCHANTMENT.FIELDS.enchantment.items.max.hint" }}</p>
            </div>

            <div class="form-group">
                <label>{{ localize "DND5E.ENCHANTMENT.FIELDS.enchantment.items.period.label" }}</label>
                <select name="system.enchantment.items.period">
                    {{ selectOptions config.enchantmentPeriods selected=system.enchantment.items.period
                                     labelAttr="label" blank=(localize "DND5E.ENCHANTMENT.Period.Never") }}
                </select>
                <p class="hint">{{ localize "DND5E.ENCHANTMENT.FIELDS.enchantment.items.period.hint" }}</p>
            </div>

            {{/if}}

            <h3 class="form-header">{{ localize "DND5E.FeatureUsage" }}</h3>

            {{!-- Item Activation Template --}}
            {{> "dnd5e.item-activation"}}

            {{!-- Recharge Requirement --}}
            {{#if system.activation.type}}
            <div class="form-group recharge">
                <label>{{ localize "DND5E.FeatureActionRecharge" }}</label>
                <div class="form-fields">
                    <span>{{ localize "DND5E.FeatureRechargeOn" }}</span>
                    {{numberInput system.recharge.value name="system.recharge.value"
                                  placeholder=(localize "DND5E.FeatureRechargeResult")}}
                    <label class="checkbox">
                        {{ localize "DND5E.Charged" }}
                        <input type="checkbox" name="system.recharge.charged" {{checked system.recharge.charged}}>
                    </label>
                </div>
            </div>
            {{/if}}

            <h3 class="form-header">{{ localize "DND5E.FeatureAttack" }}</h3>

            {{!-- Item Action Template --}}
            {{> "dnd5e.item-action"}}
        </div>

        {{!-- Effects Tab --}}
        <div class="tab effects flexcol" data-group="primary" data-tab="effects">
            {{> "dnd5e.active-effects"}}
        </div>
    </section>
</form>
