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

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

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

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

            <ul class="summary flexrow">
                <li>
                    {{labels.level}}
                </li>
                <li>
                    {{labels.school}}
                </li>
                <li>
                    <input type="text" name="data.source" value="{{data.source}}" placeholder="{{ localize 'SW5E.Source' }}"/>
                </li>
            </ul>
        </div>
    </header>

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

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

        {{!-- Description Tab --}}
        {{> "systems/sw5e/templates/items/parts/item-description.html"}}

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

            {{!-- Power Level --}}
            <div class="form-group">
                <label>{{ localize "SW5E.PowerLevel" }}</label>
                <select name="data.level" data-dtype="Number">
                    {{#select data.level}}
                    {{#each config.powerLevels as |name lvl|}}
                    <option value="{{lvl}}">{{name}}</option>
                    {{/each}}
                    {{/select}}
                </select>
            </div>

            {{!-- Power School --}}
            <div class="form-group">
                <label>{{ localize "SW5E.PowerSchool" }}</label>
                <select name="data.school">
                    {{#select data.school}}
                    {{#each config.powerSchools as |name sch|}}
                    <option value="{{sch}}">{{name}}</option>
                    {{/each}}
                    {{/select}}
                </select>
            </div>

            {{!-- Power Components --}}
            <div class="power-components form-group stacked">
                <label>{{ localize "SW5E.PowerComponents" }}</label>
                <label class="checkbox">
                    <input type="checkbox" name="data.components.concentration" {{checked data.components.concentration}}/> {{ localize "SW5E.Concentration" }}
                </label>
            </div>

            {{!-- Material Components --}}
            <div class="form-group stacked">
                <label>{{ localize "SW5E.PowerMaterials" }}</label>
                <input class="materials" type="text" name="data.materials.value" value="{{data.materials.value}}"/>
                {{#if data.materials.value}}
                <div class="power-materials flexrow">
                    <label>{{ localize "SW5E.Supply" }}</label>
                    <input type="text" name="data.materials.supply" value="{{data.materials.supply}}" data-dtype="Number" Placeholder="0"/>
                    <label>{{ localize "SW5E.CostGP" }}</label>
                    <input type="text" name="data.materials.cost" value="{{data.materials.cost}}" data-dtype="Number" Placeholder="-"/>
                    <label>{{ localize "SW5E.Consumed" }}</label>
                    <input type="checkbox" name="data.materials.consumed" {{checked data.materials.consumed}}/>
                </div>
                {{/if}}
            </div>

            {{!-- Preparation Mode --}}
            <div class="form-group input-select">
                <label>{{ localize "SW5E.PowerPreparationMode" }}</label>
                <div class="form-fields">
                    <label class="checkbox prepared">
                        {{ localize "SW5E.PowerPrepared" }} <input type="checkbox" name="data.preparation.prepared" {{checked data.preparation.prepared}}/>
                    </label>
                    <select name="data.preparation.mode">
                        {{ selectOptions config.powerPreparationModes selected=data.preparation.mode }}
                    </select>
                </div>
            </div>

            <h3 class="form-header">{{ localize "SW5E.PowerCastingHeader" }}</h3>

            {{!-- Item Activation Template --}}
            {{> "systems/sw5e/templates/items/parts/item-activation.html"}}

            <h3 class="form-header">{{ localize "SW5E.PowerEffects" }}</h3>

            {{!-- Item Action Template --}}
            {{> "systems/sw5e/templates/items/parts/item-action.html"}}

            {{!-- Power Level Scaling --}}
            <div class="form-group">
                <label>{{ localize "SW5E.LevelScaling" }}</label>
                <div class="form-fields">
                    <select name="data.scaling.mode">
                        {{#select data.scaling.mode}}
                        {{#each config.powerScalingModes as |name key|}}
                        <option value="{{key}}">{{name}}</option>
                        {{/each}}
                        {{/select}}
                    </select>
                    <input type="text" name="data.scaling.formula" value="{{data.scaling.formula}}" placeholder="{{ localize 'SW5E.ScalingFormula' }}"/>
                </div>
            </div>
        </div>

        {{!-- Effects Tab --}}
        <div class="tab effects flexcol" data-group="primary" data-tab="effects">
            {{> "systems/sw5e/templates/actors/parts/active-effects.html"}}
        </div>
    </section>
</form>
