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

    <form method="get" id="search_form">
        <input type="hidden" name="page" value="customerTrackingList">

        <div>
            {% include 'selectOrganization.html' %}
            <label for="status_type" class="hidden"></label>
            <select name="status_type" id="status_type">
                <option value="-1">跟进类型</option>
                {% for item in status %}
                <option
                {{ item.id == (req.status_type) ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
                {% endfor %}
            </select>
            <label for="search_consultant_name" class="hidden"></label>
            <input type="text" placeholder="请输入置业顾问" name="search_consultant_name" id="search_consultant_name"
                   value="{{ req.search_consultant_name }}">
            <label>日期:</label>
            <label for="search_min_time" class="hidden"></label>
            <input type="date" name="search_min_time" id="search_min_time" value="{{ req.search_min_time }}">
            —
            <label for="search_max_time" class="hidden"></label>
            <input type="date" name="search_max_time" id="search_max_time" value="{{ req.search_max_time }}">
            <input type="submit" id="submit" class="button action" value="搜索">
        </div>
    </form>
    <form method="post">
        {{ function("addCustomerTrackingTable") }}
    </form>
</div>
<script>
    $(document).ready(function () {
        search_form_set_page();

        $('form').submit(function () {
            var organization = getOrganization();
            var select = $('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>