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

<head>
    <th:block th:include="include :: header('新增待审核')" />
</head>
<style>
    .form-control {
        border-top-right-radius: 10px;
        border-top-left-radius: 10px;
        border-bottom-right-radius: 10px;
        border-bottom-left-radius: 10px;
    }
</style>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-info-add"><!---->
            <input name="id" id="id" type="hidden"   th:value="${id}" />
            <input name="code" type="hidden" id="code"/>
            <div class="form-group">
                <label class="col-sm-1 control-label">统一社会信用代码：</label>
                <div class="col-sm-8">
                    <input style="margin-right: 10px;"  class="form-control" id="xycode"  name="xycode" type="text" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label">书文号：</label>
                <div class="col-sm-8">
                    <input style="margin-right: 10px;" class="form-control" id="book" name="book" type="text" value="(宁)2020" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label">注册号：</label>
                 <div class="col-sm-8">
                     <input style="margin-right: 10px;" id="reg" class="form-control" name="reg" type="text" />
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">注册日期：</label>
                <div class="col-sm-8">
                    <input style="margin-right: 10px;" id="reg"  name="regdate" type="text"
                           class="form-control required time-input"
                            th:value="${date}"/>
                </div>
            </div>

            <div class="form-group" id="erweima1" style="display: none;">
                <label class="col-sm-3 control-label">二维码：</label>
                <div class="col-sm-8">
                    <img  style=" height: 168px;width:164px; "id="qrcode"   name="qrcode" src="" class="form-control" width="40px" height="50px">
                </div>
            </div>


        </form>
    </div>
    <th: th:include="include :: footer" />

    <th:block th:include="include :: datetimepicker-css" />

    <th:block th:include="include :: datetimepicker-js" />
    <script th:src="@{/ajax/libs/bootstrap-fileinput/js/fileinput.js}"></script>
    <script th:src="@{/ajax/libs/bootstrap-fileinput/js/locales/zh.js}"></script>
    <script type="text/javascript" th:inline="javascript">

        function submitHandler() {
            if($('#xycode').val()<5){
                alert("统一社会信用代码不能少于5个字");
                return;
            }
            if($('#book').val()<5){
                alert("书文号不能少于5个字");
                return;
            }
            if($('#reg').val()<5){
                alert("注册号不能少于5个字");
                return;
            }
            var id =$("#id").val();
            var prefix="/company/tenant";
            if ($.validate.form()) {
                $.modal.closeAll();
                $.operate.save(prefix + "/pass/"+id, $('#form-info-add').serialize());

            }
        }



        //失去焦点
        $("#xycode").blur(function() {
            var xycode = $("#xycode").val();
            var data = {};
            data.name = xycode;
            $("#erweima1").attr("style","display:none;");

            if(xycode!=null && xycode !=""){
                $.ajax({
                    type:"post",
                    url:"/system/gtgsyw/auditpass",
                    data:{
                       xycode:xycode
                    },
                    async: false,
                    success:function (a) {
                        if(a!=null){
                            var b="data:image/jpeg;base64,"+a;
                            $("#qrcode").attr("src",b);erweima1;
                            $("#erweima1").attr("style","display:block;");

                        }
                    }
                })

            }
        })
    </script>
</body>
</html>
