<div class="wrap">
    <h2>签约-房客跟进</h2>

    <form method="get" id="search_form">
        <input type="hidden" name="page" value="customerTrackingList">
        {% if role != 'zygw' %}
        {% import "selectOrganization.html" as macro %}
        {{ macro.selectOrganization("customerTracking") }}
        {% endif %}
        <div class="row">
            <div class="col-md-2">
                <div class="input-group">
                    <span class="input-group-addon">跟进类型</span>
                    <label for="status_type" class="hidden"></label>
                    <select name="status_type" id="status_type" class="form-control widthAuto">
                        <option value="-1">请选择</option>
                        {% for item in status %}
                        <option
                        {{ item.id == (req.status_type) ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            <div class="col-md-2">
                <div class="input-group">
                    <span class="input-group-addon">置业顾问</span>
                    <label for="status_type" class="hidden"></label>
                    <label for="search_consultant_name" class="hidden"></label>
                    <input class="form-control" type="text" name="search_consultant_name" id="search_consultant_name"
                           value="{{ req.search_consultant_name }}">
                </div>
            </div>
            <div class="col-md-4">
                <div class="input-group">
                    <span class="input-group-addon">日期</span>
                    <label for="search_min_time" class="hidden"></label>
                    <input class="form-control" type="date" name="search_min_time" id="search_min_time" value="{{ req.search_min_time }}">
                    <span class="input-group-addon">~</span>
                    <label for="search_max_time" class="hidden"></label>
                    <input class="form-control" type="date" name="search_max_time" id="search_max_time" value="{{ req.search_max_time }}">
                </div>
            </div>
            <input type="submit" id="submit" class="btn btn-success" value="搜索">
        </div>
    </form>
    <form method="post">
        {{ function("addCustomerTrackingTable") }}
    </form>
</div>
<script>
    $(document).ready(function () {
        search_form_set_page();

        $('form').submit(function () {
            var organization = getOrganization('customerTracking');
            var select = $('#customerTracking_organization').find('select[data-depth]:not(.hidden)');
            if (select.length > 1 && organization == -1) {
                alert('请选择门店');
                return false;
            } else {
                $(this).append('<input type="hidden" name="organization" value="' + organization + '">');
            }
        });
    });
</script>