<!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-agent-edit" th:object="${kylinPerformancePayTxtVo}">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">performances_id：</label>
            <div class="col-sm-8">
                <input name="performancesId" th:field="*{performancesId}" class="form-control" type="text" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">演出名称：</label>
            <div class="col-sm-8">
                <input name="title" th:value="*{title}" class="form-control" type="text" readonly>
            </div>
        </div>
        <div th:each="ticket : ${kylinPerformancePayTxtVo.tickets}">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">票种名称：</label>
                <div class="col-sm-8">
                    <input name="title" th:value="${ticket.title}" class="form-control" type="text" readonly>
                    <input name="ticketsId" th:value="${ticket.ticketsId}" class="form-control" type="hidden" readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">支付文案：</label>
                <div class="col-sm-8">
                    <input name="payTxt" th:value="${ticket.payTxt}" class="form-control" type="text" maxlength="16">
                </div>
                <button type="button" class="btn btn-w-m btn-success" onclick="submitHandler(this)">
                    保存
                </button>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "kylin/performances";
    $("#form-performances-edit").validate({
        focusCleanup: true
    });

    function submitHandler(res) {
        var param = {
            "performancesId": '[[${kylinPerformancePayTxtVo.performancesId}]]'.replaceAll("\"", ""),
            "ticketsId": $(res).parent().parent().find("input[name^='ticketsId']").val(),
            "payTxt": $(res).parent().parent().find("input[name^='payTxt']").val()
        }
        $.operate.post(prefix + "/payTxt/change", param, function (res) {
            location.reload();
        });
    }


</script>
</body>
</html>
