<form autocomplete="off">

    <!-- Effect Header -->
    <header class="sheet-header">
        <img class="effect-icon" src="{{ effect.icon }}" data-edit="icon">
        <h1 class="effect-title">{{ effect.label }}</h1>
    </header>

    <!-- Effect Configuration Tabs -->
    <nav class="sheet-tabs tabs">
        <a class="item" data-tab="details"><i class="fas fa-book"></i> {{localize "EFFECT.TabDetails"}}</a>
        <a class="item" data-tab="duration"><i class="fas fa-clock"></i> {{localize "EFFECT.TabDuration"}}</a>
        <a class="item" data-tab="effects"><i class="fas fa-cogs"></i> {{localize "EFFECT.TabEffects"}}</a>
    </nav>

    <!-- Details Tab -->
    <section class="tab" data-tab="details">

        <div class="form-group">
            <label>{{ localize "EFFECT.Label" }}</label>
            <div class="form-fields">
                <input type="text" name="label" value="{{ effect.label }}"/>
            </div>
        </div>

        <div class="form-group">
            <label>{{ localize "EFFECT.Icon" }}</label>
            <div class="form-fields">
                {{filePicker target="icon" type="image"}}
                <input class="image" type="text" name="icon" placeholder="path/image.png" value="{{effect.icon}}"/>
            </div>
        </div>

        <div class="form-group">
            <label>{{ localize "EFFECT.IconTint" }}</label>
            <div class="form-fields">
                <input class="color" type="text" name="tint" value="{{effect.tint}}"/>
                <input type="color" value="{{effect.tint}}" data-edit="tint"/>
            </div>
        </div>

        <div class="form-group">
            <label>{{ localize "EFFECT.Disabled" }}</label>
            <input type="checkbox" name="disabled" {{ checked effect.disabled }}/>
        </div>

        <div class="form-group">
            <label>{{ localize "EFFECT.Origin" }}</label>
            <div class="form-fields">
                <input type="text" name="origin" value="{{ effect.origin }}" disabled/>
            </div>
        </div>
    </section>

    <!-- Duration Tab -->
    <section class="tab" data-tab="duration">
        <div class="form-group">
            <label>{{ localize "EFFECT.DurationSecs" }}</label>
            <div class="form-fields">
                <input type="number" name="duration.startTime" value="{{ effect.duration.seconds }}"/>
            </div>
        </div>
        <div class="form-group">
            <label>{{ localize "EFFECT.StartTime" }}</label>
            <div class="form-fields">
                <input type="number" name="duration.startTime" value="{{ effect.duration.startTime }}"/>
            </div>
        </div>
        <hr/>
        <div class="form-group">
            <label>{{ localize "EFFECT.DurationTurns" }}</label>
            <div class="form-fields">
                <label>{{ localize "COMBAT.Rounds" }}</label>
                <input type="number" name="duration.rounds" value="{{ effect.duration.rounds }}"/>
                <label>{{ localize "COMBAT.Turns" }}</label>
                <input type="number" name="duration.turns" value="{{ effect.duration.turns }}"/>
            </div>
        </div>
        <div class="form-group">
            <label>{{ localize "EFFECT.Combat" }}</label>
            <div class="form-fields">
                <input type="text" name="duration.combat" value="{{ effect.duration.combat }}" disabled/>
            </div>
        </div>

        <div class="form-group">
            <label>{{ localize "EFFECT.StartTurns" }}</label>
            <div class="form-fields">
                <label>{{ localize "COMBAT.Round" }}</label>
                <input type="number" name="duration.startRound" value="{{ effect.duration.startRound }}"/>
                <label>{{ localize "COMBAT.Turn" }}</label>
                <input type="number" name="duration.startTurn" value="{{ effect.duration.startTurn }}"/>
            </div>
        </div>
    </section>

    <!-- Effects Tab -->
    <section class="tab" data-tab="effects">
        <header class="effect-change effects-header flexrow">
            <div class="key">{{ localize "EFFECT.ChangeKey" }}</div>
            <div class="mode">{{ localize "EFFECT.ChangeMode" }}</div>
            <div class="value">{{ localize "EFFECT.ChangeValue" }}</div>
            <div class="effect-controls">
                <a class="effect-control" data-action="add"><i class="far fa-plus-square"></i></a>
            </div>
        </header>
        <ol class="changes-list">
            {{#each effect.changes as |change i|}}
            <li class="effect-change flexrow" data-index="{{i}}">
                <div class="key">
                    <input type="text" name="changes.{{i}}.key" value="{{change.key}}"/>
                </div>
                <div class="mode">
                    <select name="changes.{{i}}.mode" data-dtype="Number">
                        {{selectOptions ../modes selected=change.mode}}
                    </select>
                </div>
                <div class="value">
                    <input type="text" name="changes.{{i}}.value" value="{{change.value}}"/>
                </div>
                <div class="effect-controls">
                    <a class="effect-control" data-action="delete"><i class="fas fa-trash"></i></a>
                </div>
            </li>
            {{/each}}
        </ol>
    </section>

    <footer class="sheet-footer">
        <button type="submit"><i class="fas fa-save"></i> {{localize submitText}}</button>
    </footer>
</form>