<div id="newsSearch" ng-controller="Wizdom365NoticeboardSharepointSearchController as vm">
    <div class="lt-module-page__top lt-module-page-top">
        <div class="lt-module-page-top__title">
            <h1>SharePoint Search</h1>
        </div>
        <div class="lt-module-page-top__actions">
            <div class="lt-module-page--paddingleft">
                <button class="btn btn-primary"
                        ng-disabled="vm.saving"
                        ng-click="vm.saveConfig()">
                    {{saving ? 'Saving' : 'Save configuration' | translate}}
                </button>
            </div>
        </div>
    </div>

    <div class="panel panel-default lt-module-page__content-panel">
        <div class="panel-heading">{{'Search centers' | translate}}</div>
        <div class="row">
            <h5 class="col-xs-12 col-md-6">{{'Search Center url' | translate}}</h5>
            <h5 class="col-xs-12 col-md-6">
                {{'Noticeboard results redirect url' | translate}}
                <i class="glyphicon glyphicon-info-sign" ng-hide="showInfo" ng-click="showInfo = true" style="cursor:pointer"></i>
                <i class="glyphicon glyphicon-menu-up" ng-show="showInfo" ng-click="showInfo = false" style="cursor:pointer"></i>
                <div ng-show="showInfo">
                    <i style="font-size:smaller">{{'Enter URL of the page you want to display the Noticeboard news. Ex. "https://wizdom365.sharepoint.com/sites/intranet"' | translate}}</i>
                </div>
            </h5>
        </div>
        <div class="wizdom-controls">
            <div class="row wizdom-controls-row" ng-repeat="searchCenter in vm.searchCenters">
                <label class="col-xs-12 col-md-6 control-label">
                    <input type="text" class="form-control" ng-change="vm.searchCenterChange(searchCenter)" ng-model-options="::{ updateOn: 'default blur', debounce: { 'default': 100, 'blur': 0 } }" ng-model="searchCenter.url" placeholder="{{'https://' | translate}}">
                </label>
                <div class="col-xs-12 col-md-6">
                    <input type="text" class="form-control" ng-change="vm.searchCenterChange(searchCenter)" ng-model-options="::{ updateOn: 'default blur', debounce: { 'default': 100, 'blur': 0 } }" ng-model="searchCenter.redirectUrl" placeholder="{{'https://' | translate}}">
                </div>
            </div>
        </div>
    </div>

    <div class="panel panel-default lt-module-page__content-panel">
        <div class="panel-heading">{{'Index' | translate}}</div>
        <div class="panel-body">
            <p>All Noticeboard news posts can be syncronized to SharePoint to make them discoverable through SharePoint Search.</p>
            <div class="container-fluid">
                <div class="wizdom-controls">
                    <div class="row wizdom-controls-row noborder">
                        <h3>{{'Keep search results' | translate}}</h3>
                        <p>By default only active Noticebpard news posts will be kept in SharePoint. Enable this will keep the news posts in SharePoint even after they are expired.</p>
                        <div class="checkbox">
                            <label>
                                <input id="keepNews" type="checkbox" ng-model="vm.keepNews" ng-disabled="vm.saving"/>
                                Keep expired news posts in SharePoint
                            </label>
                        </div>                        
                    </div>
                    <div class="row wizdom-controls-row noborder">
                        <h3>{{'Remove index' | translate}}</h3>
                        <p>Remove all Noticeboard news posts from SharePoint will force the next syncronization to be a full syncronization. SharePoint needs to reindex the syncronized content.</p>
                        <button class="btn btn-warning wide-config-btn"
                                ng-disabled="vm.saving"
                                ng-click="vm.clearIndex()">
                            {{'Remove all' | translate}}
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="panel panel-default lt-module-page__content-panel">
        <div class="panel-heading">{{'Search Configurations' | translate}}</div>
        <div class="panel-body">
            <p>Importing these configurations or manually configuring search are required to instantiate the relevant managed properties and provide the best search result experience.</p>
            <div class="container-fluid">
                <div class="wizdom-controls">
                    <div class="row wizdom-controls-row noborder">
                        <h3>{{'Search center' | translate}}</h3>
                        <p>{{'Download search configuration for search center. This configuration should be imported on search center site or site collection.' | translate}}</p>
                        <a class="btn btn-warning wide-config-btn" download href="/Modules/Noticeboard/Search Configurations/SearchConfigurationNoticeboard.xml">Download</a>
                    </div>
                    <div class="row wizdom-controls-row noborder">
                        <h3>{{'Tenant' | translate}}</h3>
                        <p>{{'Download search configuration for tenant. This configuration should be imported on tenant.' | translate}}</p>
                        <a class="btn btn-warning wide-config-btn" download href="/Modules/Noticeboard/Search Configurations/SearchConfigurationNoticeboardTenant.xml">Download</a>
                    </div>
                </div>
            </div>                        
        </div>
    </div>
</div>