{% extends 'base.html.twig' %}

{% block container %}

    <div class="sui-container">
        <form id="cv_search_form" method="post" class="sui-form form-dark cv-mt-20">
            <div class="input-control control-right">
                <input  name="k" value="{{ keyword }}" type="text" class="input-xfat input-xxlarge"><i class="sui-icon icon-touch-magnifier"></i>
                <input id="search_t" type="hidden" name="t" value="{{ type }}" />
                <input id="search_p" type="hidden" name="p" value="1" />
            </div>
        </form>
    </div>
    <div class="cv-search-box">
        <div class="title">
            <div class="sui-container">
                <a id="art" href="javascript:switchT('art')">新闻</a>
                <a id="pro" href="javascript:switchT('pro')">产品</a>
                <a id="cas" href="javascript:switchT('cas')">案例</a>
            </div>
        </div>

        <div class="sui-container">
            <p class="total">找到<span>{{ total }}</span>个结果</p>
            <div class="list-box">
                <ul>
                    {% for item in items %}
                        <li><a href="{{ item.url }}">{{ item.title }} <span class="s-date">{{ item.create_time|date('Y-m-d H:i:s') }}</span></a></li>
                    {% endfor %}
                </ul>
            </div>

            <div class="sui-pagination pagination-large cv-center">
                <ul>
                    {% if has_last_page %}
                        <li class="prev"><a href="javascript:page({{ last_page }})">«上一页</a></li>
                    {% endif %}
                    {% if has_next_page %}
                        <li class="next"><a href="javascript:page({{ next_page }})">下一页»</a></li>
                    {% endif %}
                </ul>
            </div>

        </div>
    </div>
{% endblock %}

{% block js %}
    <script type="text/javascript">
        function switchT(v) {
            var t = $('#search_t');
            t.val(v);
            $('#search_p').val(1);
            $('#cv_search_form').submit();
        }
        $(function () {
            $('#{{ type }}').addClass('sc')
        });
        function page(v) {
            $('#search_p').val(v);
            $('#cv_search_form').submit();
        }

    </script>
{% endblock %}