<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="include :: header('审核演出会员信息')"/>
</head>
<style>
    td {
        horiz-align: center;
        text-align: left;
        padding: 10px;
    }

</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-member-audit" th:object="${performanceMemberAuditDao}">
        <div class="form-group">
            <div class="col-sm-8">
                <input name="performancesId" th:field="*{performancesId}" class="form-control" type="hidden" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">演出名称：</label>
            <div class="col-sm-8">
                <input th:field="*{title}" class="form-control" type="text" required readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">该演出是否关联会员：</label>
            <div class="col-sm-8" th:if="*{isMember==1}">
                <div class="radio check-box">
                    <input type="radio" value="1" checked disabled> 关联会员</label>
                </div>
                <div class="radio check-box">
                    <input type="radio" value="0" disabled> 不关联会员</label>
                </div>
            </div>
            <div class="col-sm-8" th:if="*{isMember==0}">
                <div class="radio check-box">
                    <input type="radio" value="1" disabled> 关联会员</label>
                </div>
                <div class="radio check-box">
                    <input type="radio" value="0" checked disabled> 不关联会员</label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">该演出是否会员专属：</label>
            <div class="col-sm-8" th:if="*{isExclusive==1}">
                <div class="radio check-box">
                    <input type="radio" value=1 checked disabled> 会员专属</label>
                </div>
                <div class="radio check-box">
                    <input type="radio" value=0 disabled> 不专属</label>
                </div>
            </div>
            <div class="col-sm-8" th:if="*{isExclusive==0}">
                <div class="radio check-box">
                    <input type="radio" value=1 disabled> 会员专属</label>
                </div>
                <div class="radio check-box">
                    <input type="radio" value=0 checked disabled> 不专属</label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">票种列表：（限购数量0为不限购）：</label>
        </div>
        <div class="form-group">
            <table id="ticket-table" th:border="1">
                <tr>
                    <td>票种名</td>
                    <td>适用时间</td>
                    <td>售票状态</td>
                    <td>开售时间</td>
                    <td>普通票价</td>
                    <td>会员优惠</td>
                    <td>限购数</td>
                    <td>提前分钟</td>
                <tr/>
                <div th:each="ticket : ${performanceMemberAuditDao.ticketMemberAudit}">
                    <tr class="content-tr">
                        <td th:value="${ticket.title}" th:text="${ticket.title}">
                        </td>
                        <td th:value="${ticket.useStart}" th:text="${ticket.useStart}">
                        </td>

                        <td th:if="${ticket.status == 1}">审核中</td>
                        <td th:if="${ticket.status == 3}">审核通过</td>
                        <td th:if="${ticket.status == 4}">未通过</td>
                        <td th:if="${ticket.status == 6}">在售</td>
                        <td th:if="${ticket.status == 7}">下架</td>
                        <td th:if="${ticket.status == 8}">售罄</td>
                        <td th:if="${ticket.status == 9}">未开始</td>
                        <td th:if="${ticket.status == 10}">已结束</td>

                        <td th:value="${ticket.timeStart}" th:text="${ticket.timeStart}">
                        </td>
                        <td th:value="${ticket.price}" th:text="${ticket.price}">
                        </td>
                        <td th:text="${ticket.priceDiscountMember}">
                        </td>
                        <td th:text="${ticket.memberLimitCount}">
                        </td>
                        <td th:text="${ticket.advanceMinuteMember}">
                        </td>
                    </tr>
                </div>
            </table>
            <div class="panel-body" th:width="max" style="margin-top: 10px" name="auditBtn">
                <div class="radio check-box">
                    <input type="radio" value="3" name="status"> 同意</label>
                </div>
                <div class="radio check-box">
                    <input type="radio" value="4" name="status"> 拒绝</label>
                </div>
                <input name="rejectTxt" class="form-control" type="text" style="margin-top: 5px"/>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "kylin/performances/memberAudit";
    $("#form-performances-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            const auditStatus = document.getElementsByName("status")[0].checked ? 3 : 4;
            if (4 === auditStatus) {
                auditRejectTxt = document.getElementsByName("rejectTxt")[0].value;
            }if (4 === auditStatus && auditRejectTxt === "") {
                alert("请填写拒绝理由");
            } else {
                $.operate.save(prefix + "/save", $('#form-member-audit').serialize());
            }
        }
    }
</script>
</body>
</html>
