<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('会员卡列表')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('adam:member:view:edit')}]];
    var prefix = ctx + "adam/member";

    $(function() {
        var options = {
            url: prefix + "/list",
            updateUrl: prefix + "/info/{id}",
            sortName: "memberId",
            sortOrder: "asc",
            modalName: "设置",
            columns: [{
                checkbox: true
            },
                {
                    field: 'memberId',
                    title: '会员卡ID'
                },
                {
                    field: 'icon',
                    title: 'ICON',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push($.common.sprintf("<img class='img-circle img-xs' src='%s' />", value));
                        return actions;
                    }
                },
                {
                    field: 'title',
                    title: '会员卡标题',
                    align: 'center',
                },
                {
                    field: 'subTitle',
                    title: '会员卡说明',
                },
                {
                    field: 'onsale',
                    title: '开售状态',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        var listClass = "badge badge-" + (value === 1 ? 'primary' : 'danger');
                        actions.push($.common.sprintf("<span class='%s'>%s</span>", listClass, value === 1 ? '开售' : '停售'));
                        return actions;
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.memberId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>