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

    <form name="propertySettingsForm" novalidate val-form-manager>

        <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 ng-hide="vm.miniListView">

                                <div class="umb-language-picker" ng-if="vm.showLanguageSelector && vm.languages.length > 1" on-outside-click="vm.page.languageSelectorIsOpen = false" style="padding-bottom: 5px">
                                    <div class="umb-language-picker__toggle" ng-click="vm.toggleLanguageSelector()">
                                        <div>{{vm.selectedLanguage.name}}</div>
                                        <ins class="umb-language-picker__expand" ng-class="{'icon-navigation-down': !vm.languageSelectorIsOpen, 'icon-navigation-up': vm.languageSelectorIsOpen}" class="icon-navigation-right">&nbsp;</ins>
                                    </div>
                                    <div class="umb-language-picker__dropdown" ng-if="vm.languageSelectorIsOpen">
                                        <a ng-click="vm.selectLanguage(language)" ng-repeat="language in vm.languages" href="">{{language.name}}</a>
                                    </div>
                                </div>

                                <div class="umb-control-group">
                                    <umb-tree-search-box
                                        ng-if="vm.enableSearh"
                                        hide-search-callback="vm.hideSearch"
                                        search-callback="vm.onSearchResults"
                                        search-from-id="{{vm.searchInfo.searchFromId}}"
                                        search-from-name="{{vm.searchInfo.searchFromName}}"
                                        show-search="{{vm.searchInfo.showSearch}}"
                                        datatype-key="{{vm.searchInfo.dataTypeKey}}"
                                        section="{{vm.section}}">
                                    </umb-tree-search-box>
                                </div>

                                <umb-tree-search-results ng-if="vm.searchInfo.showSearch"
                                                            results="vm.searchInfo.results"
                                                            select-result-callback="vm.selectResult">
                                </umb-tree-search-results>

                                <umb-empty-state ng-if="!vm.hasItems && vm.emptyStateMessage" position="center">
                                    {{ vm.emptyStateMessage }}
                                </umb-empty-state>

                                <div ng-if="vm.treeReady" ng-hide="vm.searchInfo.showSearch" ng-animate="'tree-fade-out'">
                                    <umb-tree
                                        section="{{vm.section}}"
                                        treealias="{{vm.treeAlias}}"
                                        hideheader="{{vm.hideHeader}}"
                                        hideoptions="true"
                                        isdialog="true"
                                        customtreeparams="{{vm.customTreeParams}}"
                                        enablelistviewsearch="true"
                                        enablelistviewexpand="true"
                                        enablecheckboxes="{{vm.multiPicker}}"
                                        on-init="vm.initDialogTree()"
                                        api="vm.dialogTreeApi">
                                    </umb-tree>
                                </div>

                            </div>

                            <umb-mini-list-view
                                ng-if="vm.miniListView"
                                node="vm.miniListView"
                                entity-type="{{vm.entityType}}"
                                start-node-id="vm.startNodeId"
                                on-select="vm.selectListViewNode(node)"
                                on-close="vm.closeMiniListView()"
                                entity-type-filter="vm.filter">
                            </umb-mini-list-view>

                        </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-button
                        ng-if="vm.multiPicker"
                        type="button"
                        button-style="success"
                        label-key="general_submit"
                        action="vm.submit(model)">
                    </umb-button>

                </umb-editor-footer-content-right>

            </umb-editor-footer>

        </umb-editor-view>

    </form>

</div>
