<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改商户信息')"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-merchantinfo-edit" th:object="${merchaninfo}">
        <input name="merchantId" th:field="*{merchantId}" type="hidden">
        <div class="form-group">
            <label class="col-sm-2 control-label"><span
                    style="color: red;">*</span>商户名称：</label>
            <div class="col-sm-4">
                <input name="merchantName" class="form-control" type="text"
                       required maxlength="20" th:field="*{merchantName}">
            </div>
            <label class="col-sm-2 control-label"><span
                    style="color: red;">*</span>商户地址：</label>
            <div class="col-sm-4">
                <input name="merchantAddress" class="form-control" type="text"
                       required maxlength="30" th:field="*{merchantAddress}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"><span
                    style="color: red;">*</span>所属部门：</label>
            <div class="col-sm-4">
                <input name="deptId" class="form-control" type="text" required th:field="*{merchantAddress}">
            </div>

            <label class="col-sm-2 control-label">信用代码：</label>
            <div class="col-sm-4">
                <input name="merchantCreditCode" class="form-control" type="text"
                       maxlength="50" th:field="*{merchantCreditCode}">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span
                    style="color: red;">*</span>商户属性：</label>
            <div class="col-sm-4">
                <select name="merchantAttribute" class="form-control m-b"
                        th:with="type=${@dict.getType('t_merchant_attribute')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}" th:field="*{merchantAttribute}"></option>
                </select>
            </div>

            <label class="col-sm-2 control-label"><span
                    style="color: red;">*</span>商户状态：</label>
            <div class="col-sm-4">
                <div class="radio-box"
                     th:each="dict : ${@dict.getType('t_merchant_status')}">
                    <input type="radio" th:id="${'merchantStatus_' + dict.dictCode}"
                           name="merchantStatus" th:value="${dict.dictValue}"
                           required th:field="*{merchantStatus}"> <label
                        th:for="${'merchantStatus_' + dict.dictCode}"
                        th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"><span
                    style="color: red;">*</span>所在省份：</label>
            <div class="col-sm-4">
                <input name="provinceId" class="form-control" type="text" required th:field="*{provinceId}">
            </div>
            <label class="col-sm-2 control-label"><span
                    style="color: red;">*</span>所在城市：</label>
            <div class="col-sm-4">
                <input name="cityCode" class="form-control" type="text" required th:field="*{cityCode}">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span
                    style="color: red;">*</span>商户简介：</label>
            <div class="col-sm-4">
                <textarea name="merchantBrief" class="form-control" required>[[*{merchantBrief}]]</textarea>

            </div>
            <label class="col-sm-2 control-label"><span
                    style="color: red;">*</span>商户介绍：</label>
            <div class="col-sm-4">
                <textarea name="merchantIntroduce" class="form-control" required>[[*{merchantIntroduce}]]</textarea>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span
                    style="color: red;">*</span>商户图片：</label>
            <div class="col-sm-4">
                <input class="file" type="file" multiple data-min-file-count="1"
                       accept="image/*" data-theme="fas" id="pic_file" name="pic_file">
            </div>
            <label class="col-sm-2 control-label">商户营业执照：</label>
            <div class="col-sm-4">
                <input class="file" type="file" multiple data-min-file-count="1"
                       accept="image/*" data-theme="fas" id="pic_file" name="pic_file">
                <span class="help-block m-b-none"><i
                        class="fa fa-info-circle"></i> 提示：请上传正确的营业执照，否则将无法通过审核</span>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script type="text/javascript">
    var prefix = ctx + "bussiness/merchantinfo";
    $("#form-merchantinfo-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-merchantinfo-edit').serialize());
        }
    }
</script>
</body>
</html>