var exId = getUrlParam("id");
$(function () {
    $.ajax({
        type: "POST",
        url: "/manage_exhibitions/edit",
        data: JSON.stringify({
            id: Number(exId)
        }),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (exData) {
            formContent =
                `<div class="cover-panel">
            <div class="cover-frame">
                <img class="cover" id="cover" src="${exData.Cover}">
            </div>
        </div>
        <div class="title-panel">
            <h3 class="text-title">${exData.Title}</h3>
        </div>
        <div class="subtitle-panel">
            <h3 class="text-subtitle">${exData.Subtitle}</h3>
        </div>
        <div class="time-panel">
            <div>
                <label>${conertToHtmlDate(exData.StartTime).replace('T', ' ')} - </label><label>${conertToHtmlDate(exData.EndTime).replace('T', ' ')}</label>
            </div>
        </div>`
            $('#base-content').html(formContent)

            // 开幕式、展厅、演播厅等
            content =
                `<div>
                    <input class="visit-statistics-btn" type="button" value="访问记录" onclick="visitStatistics()">
                    <input class="orders-btn" type="button" value="订单详情" onclick="orders()">
                </div>`
            $('#statistics-panel').html(content)
        },
        error: function (xhr, textStatus, error) {
            var msg = JSON.parse(xhr.responseText);
            alert(msg.error);
        }
    });
})

function visitStatistics() {
    window.location.assign("/view/html/visit_statistics.html?id=" + exId);
}

function orders() {
    window.location.assign("/view/html/view_exhibits_with_orders.html?id=" + exId);
}

function back() {
    history.back();
}

function selectState(a, b) {
    if (a == b) {
        return "selected"
    }
    return ""
}