<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var $block \Magento\Backend\Block\GlobalSearch */
?>
<div class="search-global" data-mage-init='{"globalSearch": {}}'>
    <form action="#" id="form-search">
        <div class="search-global-field">
            <label class="search-global-label" for="search-global"></label>
            <input
                    type="text"
                    class="search-global-input"
                    id="search-global"
                    name="query"
                    data-mage-init='<?= /* @noEscape */ $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getWidgetInitOptions()) ?>'>
            <button
                type="submit"
                class="search-global-action"
                title="<?= /* @escapeNotVerified */ __('Search') ?>"
                ></button>
        </div>
    </form>
    <script data-template="search-suggest" type="text/x-magento-template">
        <ul class="search-global-menu">
        <li class="item">
            <a id="searchPreviewProducts" href="<?= /* @escapeNotVerified */ $block->getUrl('catalog/product/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a>
        </li>
        <li class="item">
            <a id="searchPreviewOrders" href="<?= /* @escapeNotVerified */ $block->getUrl('sales/order/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a>
        </li>
        <li class="item">
            <a id="searchPreviewCustomers" href="<?= /* @escapeNotVerified */ $block->getUrl('customer/index/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a>
        </li>
        <li class="item">
            <a id="searchPreviewPages" href="<?= /* @escapeNotVerified */ $block->getUrl('cms/page/index/') ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a>
        </li>
            <% if (data.items.length) { %>
            <% _.each(data.items, function(value){ %>
            <li class="item"
                <%= data.optionData(value) %>
                >
                <a href="<%- value.url %>" class="title"><%- value.name %></a>
                <span class="type"><%- value.type %></span>
                <%- value.description || "" %>
            </li>
            <% }); %>
        <% } else { %>
            <li>
                <span class="mage-suggest-no-records">
                    <?= /* @escapeNotVerified */ __('No records found.') ?>
                </span>
            </li>
        <% } %>
        </ul>
    </script>
</div>
