<!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-account-edit">
            <input id="comId" name="comId" th:value="${comWalletApprove.comId}"  type="hidden">
            <input id="comWalletChangeEventId" name="comWalletChangeEventId" th:value="${comWalletApprove.comWalletChangeEventId}"  type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">企业名称：</label>
                <div class="col-sm-8">
                    <input th:value="${comWalletApprove.comName}" 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 th:value="${comWalletApprove.walletAccountNo}" 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 th:value="${comWalletApprove.typeName}" 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 th:value="${comWalletApprove.createTime}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">审批状态：</label>
                <input th:value="${comWalletApprove.approveStatus}" id="approveStatus" hidden>
                <div class="col-sm-8">
                    <div th:if="${comWalletApprove.approveStatus eq '0'}">
                        <div class="radio-box">
                            <input type="radio" id="status1" name="approveStatus" value="1" checked>
                            <label for="status1">通过</label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="status2" name="approveStatus" value="2">
                            <label for="status2">不通过</label>
                        </div>
                    </div>
                    <div th:if="${comWalletApprove.approveStatus != '0'}">
                        <input th:value="${comWalletApprove.statusName}" class="form-control" type="text" readonly>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">审批原因：</label>
                <div class="col-sm-8">
                    <div th:if="${comWalletApprove.approveStatus eq '0'}">
                        <input th:value="${comWalletApprove.approveContent}" name="approveContent" class="form-control" type="text">
                    </div>
                    <div th:if="${comWalletApprove.approveStatus != '0'}">
                        <input th:value="${comWalletApprove.approveContent}" class="form-control" type="text" readonly>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">审批时间：</label>
                <div class="col-sm-8">
                    <input th:value="${comWalletApprove.approveTime}" class="form-control" type="text" readonly>
                </div>
            </div>
            <input id="img1" th:value="${comWalletApprove.changeProveUrl}" hidden>
            <input id="img2" th:value="${comWalletApprove.bankCardUrl}" hidden>
            <div id="viewer">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">钱包信息修改证明：</label>
                <div class="col-sm-8" id="changeProveUrl">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">卡图片：</label>
                <div class="col-sm-8" id="bankCardUrl">
                </div>
            </div>
                <input id="bcUrl" name="bankCardUrl" hidden>
            </div>
    	</form>
    </div>
    <div class="col-sm-12 select-table table-striped">
        <table id="bootstrap-table1"></table>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
	    var prefix = ctx + "manage/com-wallet";

	    $(function(){
            var img1 = $('#img1').val();
            var img2 = $('#img2').val();
            //预览
            if(img1){
                $("#changeProveUrl").html('<img src="'+img1+'" width="200px" data-original="'+img1+'">');
            }
            if(img2){
                $("#bankCardUrl").html('<img src="'+img2+'" width="200px" data-original="'+img2+'">');
                $("#bcUrl").val(img2);
            }
            $('#viewer').viewer({url:"data-original"});

            var options1 = {
                id: "bootstrap-table1",
                url: prefix + "/page-com-wallet-change-list?q="+$("#comWalletChangeEventId").val(),
                columns: [
                    {field:'changeCode',title:'变更项目'},
                    {field:'changeCodeCn',title:'描述'},
                    {field:'changeBeforeInfo',title:'变更前信息'},
                    {field:'changeBeforeShowInfo',title:'变更前展示信息'},
                    {field:'changeAfterInfo',title:'变更后信息'},
                    {field:'changeAfterShowInfo',title:'变更后展示信息'}
                ]
            };
            $.table.init(options1);
        })

        $("#form-account-edit").validate({
            onkeyup: false,
            rules:{
                approveContent:{
                    required:true
                }
            },
            focusCleanup: true
        });

	    function submitHandler() {
	        var _approveStatus = $('#approveStatus').val();
	        if(_approveStatus == '0'){
                if ($.validate.form()) {
                    $.operate.save(prefix + "/update-com-wallet-approve-status", $('#form-account-edit').serialize());
                }
            }else{
                $.modal.alertError("该信息已完成审批操作，按钮操作无效");
            }
	    }
    </script>
</body>
</html>
