<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<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">
        <div class="form-group">
            <p>演出名称</p>
            <div class="row">
                <!--
                <input name="roadShowId" th:value="*{roadShowId}" type="hidden">
               <input name="ids" type="hidden">
               <div class="col-lg-6">
                   <div class="input-group">
                       <input type="text" class="form-control" id="suggest-demo-2" onkeyup="getPerformanceTitle()">
                       <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>
               -->
                <input name="roadShowId" th:value="*{roadShowId}" type="hidden">
                <div class="remote_wrapper" style="position: relative;">
                    <input name="ids" type="hidden">
                    <input type="text" id="remoteSearch">
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-suggest-js"/>
<script th:inline="javascript">
    var prefix = ctx + "kylin/performances/roadShow";
    var roadShowId = '[[${roadShowId}]]'.replaceAll("\"", "");

    $("#form-roadShow-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/roadShow/relation", $('#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>
