<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
<head>
    <th:block th:include="include :: header('新增推荐演出')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-roadShow-add">
        <p>演出名称：</p>
        <!--
        <div class="row">
            <input name="ids" type="hidden">
            <div class="input-group">
                <input type="text" class="form-control" id="suggest-demo-2" onkeyup="getPerformanceTitle()" required>
                <div class="input-group-btn">
                    <button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu dropdown-menu-right" role="menu">
                    </ul>
                </div>
            </div>
        </div>
        -->
        <div class="remote_wrapper" style="position: relative;">
            <input name="ids" type="hidden">
            <input type="text" id="remoteSearch">
        </div>
        </br>
        <p>推荐排序：</p>
        <div class="row">
            <div class="input-group">
                <div class="input-group date">
                    <input name="isRecommend" class="form-control" type="text" required>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-suggest-js"/>
<script th:src="@{/js/remote-search-performance.js}"></script>

<script th:inline="javascript">
    var prefix = ctx + "kylin/performances/recommend";
    $("#form-roadShow-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/change", $('#form-roadShow-add').serialize());
        }
    }

    // function getPerformanceTitle() {
    //     var testBsSuggest = $("#suggest-demo-2").bsSuggest({
    //         url: prefix + "/performance/status?status=(3,6,7,9,10)&title=" + document.getElementById("suggest-demo-2").value,
    //         showBtn: false,
    //         idField: "performancesId",
    //         keyField: "title"
    //     }).on('onDataRequestSuccess', function (e, result) {
    //     }).on('onSetSelectValue', function (e, keyword) {
    //         document.getElementsByName("ids")[0].value = keyword.id;
    //     }).on('onUnsetSelectValue', function (e) {
    //     });
    // }

    $('#remoteSearch').remoteSearchPerformance({
        ajax:{
            url: prefix + "/performance/status?status=(3,6,7,9,10)",
            type: "get"
        },
        chose: function(text,val){
            document.getElementsByName("ids")[0].value = val;
        },
        success: function(){
        }
    })
</script>
</body>
</html>
