<!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('钱包信息修改审批')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>关键字：</label>
                                <input type="text" name="keyword" placeholder="请输入企业名称/证件号"/>
                            </li>
                            <li>
                                <label>审批状态：</label>
                                <select name="approveStatus" th:with="type=${@dict.getType('approveStatus')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                        </ul>
                        <ul>
                            <li>
                                <label>提交日期：</label>
                                <input type="text" class="time-input" id="startTime" name="startTime"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" name="endTime"/>
                            </li>
                        </ul>
                        <ul>
                            <li>
                                <label>审批日期：</label>
                                <input type="text" class="time-input" id="verifyStartTime" name="verifyStartTime"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="verifyEndTime" name="verifyEndTime"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <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 :: bootstrap-select-js" />
    <th:block th:include="include :: jquery-cxselect-js" />
    <script th:inline="javascript">
        var removeFlag = [[${@permission.hasPermi('per-wallet:remove')}]];
        var prefix = ctx + "manage/com-wallet";

        $(function() {
            var options = {
                url: prefix + "/page-com-wallet-approve-list",
                columns: [
                    {field: 'comWalletChangeEventId', title: '序号'},
                    {field: 'comName', title: '名称'},
                    {field: 'walletAccountNo', title: '钱包账户号'},
                    {field: 'typeName', title: '修改类型'},
                    {field: 'createTime', title: '申请时间'},
                    {field: 'approveTime', title: '审批时间'},
                    {field: 'statusName', title: '状态'},
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function(value, row, index) {
                            var actions = [];
                            var comWalletInfoClick = "comWalletInfo('" + row.comWalletChangeEventId + "')";
                            actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="' + comWalletInfoClick + '"><i class="fa fa-edit"></i>详情</a> ');
                            return actions.join('');
                        }
                    }
                ]
            };
            var _n = new Date();
            var initStart = new Date(_n.getTime()-2592000000);
            $('#startTime').val(initStart.format("yyyy-MM-dd"));
            $('#endTime').val(_n.format("yyyy-MM-dd"));
            $.table.init(options);
        });

        //钱包信息详情
        function comWalletInfoView(_eventId) {
            $.modal.open('钱包信息详情', prefix+'/com-wallet-approve-detail-view/'+_eventId, '900', '600');
        }

        //点击编辑弹窗
        function comWalletInfo(_eventId) {
            comWalletInfoView(_eventId);
        }

        layui.use('laydate', function() {
            var laydate = layui.laydate;
            var startDate = laydate.render({
                elem: '#verifyStartTime',
                max: $('#verifyEndTime').val(),
                theme: 'molv',
                trigger: 'click',
                done: function(value, date) {
                    // 结束时间大于开始时间
                    if (value !== '') {
                        endDate.config.min.year = date.year;
                        endDate.config.min.month = date.month - 1;
                        endDate.config.min.date = date.date;
                    } else {
                        endDate.config.min.year = '';
                        endDate.config.min.month = '';
                        endDate.config.min.date = '';
                    }
                }
            });
            var endDate = laydate.render({
                elem: '#verifyEndTime',
                min: $('#verifyStartTime').val(),
                theme: 'molv',
                trigger: 'click',
                done: function(value, date) {
                    // 开始时间小于结束时间
                    if (value !== '') {
                        startDate.config.max.year = date.year;
                        startDate.config.max.month = date.month - 1;
                        startDate.config.max.date = date.date;
                    } else {
                        startDate.config.max.year = '2099';
                        startDate.config.max.month = '12';
                        startDate.config.max.date = '31';
                    }
                }
            });
        });
    </script>
</body>
</html>