<form class="window flexcol" autocomplete="off" onsubmit="event.preventDefault();">
    {{#unless (any has_values has_placeholders)}}
    <header class="trait-header flexrow">
        <div class="header-search">
            <i class="fas fa-search"></i>
            <input type="text" name="search" value="{{searchString}}" placeholder="Search" autocomplete="off"/>
        </div>
    </header>
    {{/unless}}
    <ol class="trait-list">
        {{#each ordered_choices as |choice key|}}
        <li class="trait-item">
            <div class="form-group form-fields">
                <input type="checkbox" name="{{key}}" data-dtype="Boolean" {{checked choice.chosen}}>
                <label class="trait-label" style="margin-left: 5px; margin-right: 5px;">{{choice.label}}</label>
                {{#if ../has_placeholders}}
                    {{#each choice as |v k|}}
                        {{#if (eq k "chosen")}}
                            <input type="text" id="input_placeholder_{{key}}" name="{{key}}" value="{{v}}" placeholder="e.g. Medic Dedication" data-dtype="String"/>
                        {{/if}}
                    {{/each}}
                {{/if}}
                {{#if ../has_values}}
                    <input type="number" id="input_value_{{key}}" name="{{key}}" value="{{choice.value}}" placeholder="0" data-dtype="Number"/>
                {{/if}}
                {{#if ../has_exceptions}}
                    <label style="margin-left: 5px;">{{localize "PF2E.ResistancesExceptionLabel"}}</label>
                    <input type="text" id="input_exception_{{key}}" name="{{key}}" value="{{choice.exceptions}}" placeholder="{{localize "PF2E.ResistancesExceptionPlaceholder"}}" data-dtype="String"/>
                {{/if}}

            </div>
        </li>
        {{/each}}
    </ol>
    {{#unless (any has_values has_placeholders no_custom)}}
    <div class="form-group-stacked trait-footer">
        <label>{{localize "PF2E.SpecialLabel"}}:</label>
        <input type="text" name="custom" value="{{custom}}" data-dtype="String"/>
    </div>
    {{/unless}}
    <button class="trait-footer" type="submit"><i class="far fa-save"></i>{{localize "PF2E.UpdateActorLabel"}}</button>
</form>
