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

    <umb-editor-view>

        <form novalidate name="copyNodesForm" class="form-horizontal" val-form-manager>
    
            <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>
                        <p class="abstract">
                            <localize key="actions_infiniteEditorChooseWhereToCopy">Choose where to copy the selected item(s)</localize>
                        </p>

                        <div ng-hide="miniListView">
                            <div class="umb-control-group">
                                <umb-tree-search-box
                                    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}}"
                                    section="{{model.section}}">
                                </umb-tree-search-box>
                            </div>
                    
                            <div class="umb-control-group" ng-show="vm.searchInfo.showSearch">
                                <umb-tree-search-results
                                    ng-if="vm.searchInfo.showSearch"
                                    results="vm.searchInfo.results"
                                    select-result-callback="vm.selectResult">
                                </umb-tree-search-results>
                            </div>
                    
                            <div class="umb-control-group -no-border" ng-hide="vm.searchInfo.showSearch">
                                <umb-tree
                                    section="{{model.section}}"
                                    hideheader="false"
                                    hideoptions="true"
                                    isdialog="true"
                                    api="dialogTreeApi"
                                    on-init="onTreeInit()"
                                    enablelistviewexpand="true"
                                    enablecheckboxes="true">
                                </umb-tree>
                            </div>
                    
                        </div>
                        
                        <div ng-if="miniListView" class="umb-control-group">
                            <umb-mini-list-view
                                node="miniListView"
                                entity-type="{{entityType}}"
                                on-select="selectListViewNode(node)"
                                on-close="closeMiniListView()">
                            </umb-mini-list-view>
                        </div>
                    
                        <umb-pane>
                            <umb-control-group localize="label" label="@defaultdialogs_relateToOriginalLabel">
                                <umb-toggle label-position="left" checked="model.relateToOriginal" on-click="vm.onToggle('relate')"></umb-toggle>
                            </umb-control-group>
                        </umb-pane>
                        <umb-pane>
                            <umb-control-group localize="label" label="@defaultdialogs_includeDescendants">
                                <umb-toggle label-position="left" checked="model.includeDescendants" on-click="vm.onToggle('descendants')"></umb-toggle>
                            </umb-control-group>
                        </umb-pane>
                    </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
                        type="button"
                        button-style="success"
                        label-key="general_submit"
                        state="vm.saveButtonState"
                        action="vm.submit(model)"
                        disabled="!model.target">
                    </umb-button>
                </umb-editor-footer-content-right>
            </umb-editor-footer>

        </form>

    </umb-editor-view>

</div>
