<div ng-controller="Umbraco.Editors.ItemPicker as vm">

    <umb-editor-view>

        <umb-editor-header
            name="model.title"
            name-locked="true"
            hide-alias="true"
            hide-icon="true"
            hide-description="true">
        </umb-editor-header>

        <umb-editor-container>
            <umb-box>
                <umb-box-content>

                    <div class="form-search mb3" ng-if="model.filter">
                        <umb-search-filter
                            input-id="itempicker-search"
                            model="searchTerm"
                            label-key="placeholders_filter"
                            text="Type to filter..."
                            css-class="w-100"
                            auto-focus="true">
                        </umb-search-filter>
                    </div>

                    <ul class="umb-card-grid -three-in-row">
                        <li ng-repeat="availableItem in model.availableItems | compareArrays:model.selectedItems:'alias' | orderBy:'name' | filter:searchTerm">
                            <button type="button" class="btn-reset umb-card-grid-item" title="{{ availableItem.name }}" ng-click="vm.selectItem(availableItem)">
                                <span>
                                    <umb-icon icon="{{availableItem.icon}}"></umb-icon>
                                    {{availableItem.name}}
                                </span>
                            </button>
                        </li>
                    </ul>
                </umb-box-content>
            </umb-box>
        </umb-editor-container>

        <umb-editor-footer>
            <umb-editor-footer-content-right>
                <umb-button
                    type="button"
                    button-style="link"
                    label-key="general_close"
                    shortcut="esc"
                    action="vm.close()">
                </umb-button>
            </umb-editor-footer-content-right>
        </umb-editor-footer>

    </umb-editor-view>

</div>
