<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改商户审核')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-examine-edit" th:object="${companyExamine}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">企业名称：</label>
                <div class="col-sm-8">
                    <input name="companyName" th:field="*{companyName}" class="form-control" type="text" disabled="disabled">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">企业类型：</label>
                <div class="col-sm-8">
                    <select name="companyType" class="form-control m-b" th:with="type=${@dict.getType('company_type')}" readonly="readonly">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{companyType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">详细地址：</label>
                <div class="col-sm-8">
                    <textarea name="detailAddress" class="form-control" readonly="readonly">[[*{detailAddress}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">经度：</label>
                <div class="col-sm-8">
                    <input name="longitude" th:field="*{longitude}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">纬度：</label>
                <div class="col-sm-8">
                    <input name="latitude" th:field="*{latitude}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">企业法人：</label>
                <div class="col-sm-8">
                    <input name="legalPerson" th:field="*{legalPerson}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">联系电话：</label>
                <div class="col-sm-8">
                    <input name="contactNumber" th:field="*{contactNumber}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">成立日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="establishDate" th:field="*{establishDate}" class="form-control" readonly="readonly" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">统一社会信用代码：</label>
                <div class="col-sm-8">
                    <input name="unifiedSocialCreditCode" th:field="*{unifiedSocialCreditCode}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">营业执照：</label>
                <div class="col-sm-8">
                    <div class="fileinput-new thumbnail" style="width: 140px; height: 140px;">
                        <img th:src="@{businessLicenseUrl}">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">企业默认图片：</label>
                <div class="col-sm-8">
                    <div class="fileinput-new thumbnail" style="width: 140px; height: 140px;">
                        <img th:src="@{defaultImgUrl}">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">企业宣传图片：</label>
                <div class="col-sm-8">
                    <div class="fileinput-new thumbnail" style="width: 140px; height: 140px;">
                        <img th:src="@{propagandaImgUrl}">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">企业介绍：</label>
                <div class="col-sm-8">
                    <textarea name="companyIntroduce" class="form-control" readonly="readonly">[[*{companyIntroduce}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">审批状态：</label>
                <div class="col-sm-8">
                    <label class="radio-box"> <input type="radio" name="status" value="1" th:checked="true"/> 通过 </label>
                    <label class="radio-box"> <input type="radio" name="status" value="2" /> 驳回 </label>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">驳回理由：</label>
                <div class="col-sm-8">
                    <textarea name="rejectReason" class="form-control" maxlength="250"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "companyext/examine";
        $("#form-examine-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            var status = $('input[name="status"]:checked').val();
            var rejectReason = $("textarea[name='rejectReason']").val();
            if(status == 2 ){
                if(rejectReason==null || rejectReason.trim()==0){
                    $.modal.alertWarning("请填写驳回理由！");
                    return;
                }
            }
            $.operate.save(prefix + "/edit", "id="+$("input[name='id']").val()+"&status="+status+"&rejectReason="+rejectReason);

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