<br>
<div class="row">
    <div class="col-md-10">
        <input type="checkbox" name="new_house" id="new_house" value="{{ result.new_house }}" style="margin: 0;"{% if
        result.new_house == 1 %} checked {% endif %}>
        <label for="new_house">新房</label>
        <input type="checkbox" name="secondHand_house" id="secondHand_house" value="{{ result.secondHand_house }}"
               style="margin: 0;"{% if result.secondHand_house == 1 %} checked {% endif %}>
        <label for="secondHand_house">二手房</label>
        <input type="checkbox" name="rent_house" id="rent_house" value="{{ result.rent_house }}" style="margin: 0;"{% if
        result.rent_house == 1 %} checked {% endif %}>
        <label for="rent_house">租房</label>
    </div>
</div>
<br>
<div class="row">
    <div class="col-md-6">
        <label for="character">性质：</label>
        <select name="character" id="character" class="form-control">
            <option value="公客">公客</option>
            <option value="私客">私客</option>
        </select>
    </div>
    <div class="col-md-6">
        <label for="origin">来源：</label>
        <select name="origin" id="origin" class="form-control">
            <option value="来电">来电</option>
            <option value="来访">来访</option>
            <option value="扫街">扫街</option>
            <option value="网络">网络</option>
            <option value="派单">派单</option>
            <option value="广告">广告</option>
            <option value="陌拜">陌拜</option>
            <option value="微信">微信</option>
            <option value="内部推荐">内部推荐</option>
            <option value="老带新">老带新</option>
            <option value="租转售">租转售</option>
            <option value="售转租">售转租</option>
            <option value="盘源">盘源</option>
            <option value="CALL客">CALL客</option>
            <option value="其他">其他</option>
        </select>
    </div>
</div>
<br>
<div id="new_secondHand_house_input">
    <div class="row">
        <div class="col-md-6">
            <label for="payment_mode">付款：</label>
            <select name="payment_mode" id="payment_mode" class="form-control" disabled="disabled">
                <option value="其它">其它</option>
                <option value="商业贷款">商业贷款</option>
                <option value="公积金贷款">公积金贷款</option>
                <option value="组合贷款">组合贷款</option>
                <option value="全款">全款</option>
            </select>
        </div>
        <br>
    </div>
    <br>

    <div class="row">
        <div class="col-md-6">
            <label>总价：</label>
            <label for="min_totalPrice" class="hidden"></label>
            <input type="text" name="min_totalPrice" id="min_totalPrice" value="{{ result.min_totalPrice }}"
                   class="form-control" disabled="disabled">
            —
            <label for="max_totalPrice" class="hidden"></label>
            <input type="text" name="max_totalPrice" id="max_totalPrice" value="{{ result.max_totalPrice }}"
                   class="form-control" disabled="disabled">
            万
        </div>
        <div class="col-md-6">
            <label>单价：</label>
            <label for="min_unitPrice" class="hidden"></label>
            <input type="text" name="min_unitPrice" id="min_unitPrice" value="{{ result.min_unitPrice }}"
                   class="form-control" disabled="disabled">
            —
            <label for="max_unitPrice" class="hidden"></label>
            <input type="text" name="max_unitPrice" id="max_unitPrice" value="{{ result.max_unitPrice }}"
                   class="form-control" disabled="disabled">
            元/m²
        </div>
    </div>
</div>
<br>
<div id="rent_house_input">
    <div class="row">
        <div class="col-md-6">
            <label>月租：</label>
            <label for="min_rent" class="hidden"></label>
            <input type="text" name="min_rent" id="min_rent" value="{{ result.min_rent }}" class="form-control"
                   disabled="disabled">
            —
            <label for="max_rent" class="hidden"></label>
            <input type="text" name="max_rent" id="max_rent" value="{{ result.max_rent }}" class="form-control"
                   disabled="disabled">
            元/月
        </div>
        <div class="col-md-3">
            <label for="rent">整租：</label>
            <select name="rent" id="rent" class="form-control" disabled="disabled">
                <option value="不限">不限</option>
                <option value="整租">整租</option>
                <option value="合租">合租</option>
            </select>
        </div>
        <div class="col-md-3">
            <label for="tenancy">租期：</label>
            <select name="tenancy" id="tenancy" class="form-control" disabled="disabled">
                <option value="不限">不限</option>
                <option value="一个月">一个月</option>
                <option value="三个月">三个月</option>
                <option value="半年">半年</option>
                <option value="一年">一年</option>
                <option value="一年以上">一年以上</option>
            </select>
        </div>
    </div>
</div>
<script>
    (function ($) {
        var new_house_checkbox, secondHand_house_checkbox, rent_house_checkbox;
        $(document).ready(function () {
            new_house_checkbox = $('input[name=new_house]');
            secondHand_house_checkbox = $('input[name=secondHand_house]');
            rent_house_checkbox = $('input[name=rent_house]');
            $('input[type=checkbox]').change(function () {
                if ($(this).is(':checked')) {
                    $(this).val(1);
                } else {
                    $(this).val(0);
                }
                changeCheckBox();
            });
            changeCheckBox();
        });

        function changeCheckBox() {
            if (new_house_checkbox.is(':checked') || secondHand_house_checkbox.is(':checked')) {
                $('#new_secondHand_house_input').find('select, input').removeAttr('disabled');
            } else if (!new_house_checkbox.is(':checked') && !secondHand_house_checkbox.is(':checked')) {
                $('#new_secondHand_house_input').find('select, input').attr('disabled', 'disabled');
            }
            if (rent_house_checkbox.is(':checked')) {
                $('#rent_house_input').find('select, input').removeAttr('disabled');
            } else {
                $('#rent_house_input').find('select, input').attr('disabled', 'disabled');
            }
        }
    })(jQuery);
</script>