<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>直销报表</title>
</head>
<body>
<%-- <div class="row${fluid}">
    <div class="span6">
        <h2 class="page-title">营销日报列表</h2>
    </div>
    <div class="span6 header_buttons">
        <a href="${ctx}/reportmarketing?action=create" class="btn blue pull-right"><i class="icon-plus"></i></a>
    </div>
</div> --%>

<!-- 面包屑 begin -->
<div class="row-fluid">
    <div class="span12">
        <ul class="breadcrumb">
            <!-- <li><a href="/house365-hmc-web/">首页</a> <span class="divider"></span></li> -->
            <li class="active"><span class="divider" style="color:#26a0da;font-weight:bold;">/</span>直销报表</li>
        </ul>
    </div>
</div>
<!-- 面包屑 begin -->

<div class="page-container form-horizontal">
    <div class="row${fluid}">
        <form id="filterForm" class="form-inline filterForm" action="${ctx}/reportmarketing/report" method="get">
            <div class="row-fluid">
                <div class="span12 control-group">
                    <label class="control-label">数据日期:</label>
                    <div class="controls">
                        <input style="width: 6rem" type="text" name="search_GTE_createTimeStart"
                               id="search_GTE_createTimeStart"
                               value="${param['search_GTE_createTimeStart']}"
                               class="m-wrap small span2" placeholder="创建时间-起始">至
                        <input style="width: 6rem" type="text" name="search_LTE_createTimeEnd"
                               id="search_LTE_createTimeEnd"
                               value="${param['search_LTE_createTimeEnd']}"
                               class="m-wrap small span2" placeholder="创建时间-截止">
                        <font color="red"><form:errors path="userVo.entity.mobile"/></font>
                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span6 control-group">
                    <label class="control-label">日期类型:</label>
                    <div class="controls">
                        <input type="radio" name="time" value="1"/>日
                        <input type="radio" name="time" value="2"/>周
                        <input type="radio" name="time" value="3"/>月
                        <font color="red"><form:errors path="userVo.entity.mobile"/></font>
                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span6 control-group">
                    <label class="control-label">部门:</label>
                    <div class="controls">
                        <input type="checkbox" name="user" value="1"/>职员1
                        <input type="checkbox" name="user" value="2"/>职员2
                        <input type="checkbox" name="user" value="3"/>职员3
                        <font color="red"><form:errors path="userVo.entity.mobile"/></font>
                    </div>
                </div>
            </div>

            <div class="row-fluid">
                <div class="span6 control-group">
                    <label class="control-label">职员:</label>
                    <div class="controls">
                        <select name="search_EQ_status" class="form-inline chosen" data-placeholder="请输入职员姓名">
                            <option value=""
                                    <c:if test="${param['search_EQ_status']}">selected="selected"</c:if>></option>
                            <option value="1"
                                    <c:if test="${param['search_EQ_status'] eq 1 }">selected="selected"</c:if>>默认
                            </option>
                            <option value="2"
                                    <c:if test="${param['search_EQ_status'] eq 2 }">selected="selected"</c:if>>执行中
                            </option>
                            <option value="3"
                                    <c:if test="${param['search_EQ_status'] eq 3 }">selected="selected"</c:if>>办结
                            </option>
                            <option value="4"
                                    <c:if test="${param['search_EQ_status'] eq 4 }">selected="selected"</c:if>>
                                合同周期结束
                            </option>
                            <option value="5"
                                    <c:if test="${param['search_EQ_status'] eq 5 }">selected="selected"</c:if>>终止
                            </option>
                            <option value="6"
                                    <c:if test="${param['search_EQ_status'] eq 6 }">selected="selected"</c:if>>立项审核中
                            </option>
                            <option value="7"
                                    <c:if test="${param['search_EQ_status'] eq 7 }">selected="selected"</c:if>>删除
                            </option>
                        </select>
                        <font color="red"><form:errors path="userVo.entity.mobile"/></font>
                    </div>
                </div>
            </div>

            <div class="buttons pull-right" style="margin:3px 30px 0 0;">
                <i class="icon-search icon-2x pointer" onclick="$('#filterForm').submit();" title="搜索"></i>
            </div>
        </form>
    </div>
    <table class="table table-striped table-advance table-hover">
        <thead>
        <tr>
            <th width="40" style="text-align:center"><input id="memberCheckAll" type="checkbox"
                                                            onclick="checkAll(this)"/></th>
            <th width="100">id</th>
            <th width="100">电话接触量</th>
            <th width="100">电话接通量</th>
            <th width="100">意向沉淀量</th>
            <th width="100">到访量</th>
            <th width="100">认筹量</th>
            <th width="100">认筹项目</th>
            <th width="100">认购量</th>
            <th width="100">认购项目</th>
            <th width="100">创建时间</th>
            <th width="100">部门id</th>
            <th width="100">部门名称</th>
            <th width="100">职员id</th>
            <th width="100">职员姓名</th>
            <th width="150">操作</th>
        </tr>
        </thead>
        <c:forEach items="${reportMarketings}" var="reportMarketing">
            <tr>
                <td nowrap="nowrap" style="text-align:center">
                    <input type="checkbox" name="memberCheck" value="${reportMarketing.id}"
                           onclick="checkMember(this)"/>
                </td>
                <td nowrap="nowrap">
                    <a href="${ctx}/reportmarketing/${reportMarketing.id}"> <c:if
                            test="${null ne reportMarketing.id && '' ne reportMarketing.id}">
                        <c:out value="${reportMarketing.id}"/>
                    </c:if>
                        <c:if test="${null eq reportMarketing.id || '' eq reportMarketing.id}">
                            &nbsp;
                        </c:if>
                    </a>
                </td>
                <td nowrap="nowrap">${reportMarketing.callCount}</td>
                <td nowrap="nowrap">${reportMarketing.connectCount}</td>
                <td nowrap="nowrap">${reportMarketing.intentBuyCount}</td>
                <td nowrap="nowrap">${reportMarketing.visitedCount}</td>
                <td nowrap="nowrap">${reportMarketing.identificationChipsCount}</td>
                <td nowrap="nowrap">
                    <c:if test="${null ne reportMarketing.identificationChipsProject && '' ne reportMarketing.identificationChipsProject}">
                        ${reportMarketing.identificationChipsProject}
                    </c:if>
                    <c:if test="${null eq reportMarketing.identificationChipsProject || '' eq reportMarketing.identificationChipsProject}">
                        &nbsp;
                    </c:if>
                </td>
                <td nowrap="nowrap">
                        ${reportMarketing.subscriptionCount}
                </td>
                <td nowrap="nowrap">
                    <c:if test="${null ne reportMarketing.subscriptionProject && '' ne reportMarketing.subscriptionProject}">
                        ${reportMarketing.subscriptionProject}
                    </c:if>
                    <c:if test="${null eq reportMarketing.subscriptionProject || '' eq reportMarketing.subscriptionProject}">
                        &nbsp;
                    </c:if>
                </td>
                <td nowrap="nowrap">
                    <c:if test="${null ne reportMarketing.createTime && '' ne reportMarketing.createTime}">
                        <f:formatDate value='${reportMarketing.createTime}' pattern='yyyy-MM-dd HH:mm:ss'/>
                    </c:if>
                    <c:if test="${null eq reportMarketing.createTime || '' eq reportMarketing.createTime}">
                        &nbsp;
                    </c:if>
                </td>
                <td nowrap="nowrap">
                    <c:if test="${null ne reportMarketing.departmentId && '' ne reportMarketing.departmentId}">
                        <c:out value="${reportMarketing.departmentId}"/>
                    </c:if>
                    <c:if test="${null eq reportMarketing.departmentId || '' eq reportMarketing.departmentId}">
                        &nbsp;
                    </c:if>
                </td>
                <td nowrap="nowrap">
                    <c:if test="${null ne reportMarketing.departmentName && '' ne reportMarketing.departmentName}">
                        <c:out value="${reportMarketing.departmentName}"/>
                    </c:if>
                    <c:if test="${null eq reportMarketing.departmentName || '' eq reportMarketing.departmentName}">
                        &nbsp;
                    </c:if>
                </td>
                <td nowrap="nowrap">
                    <c:if test="${null ne reportMarketing.userId && '' ne reportMarketing.userId}">
                        <c:out value="${reportMarketing.userId}"/>
                    </c:if>
                    <c:if test="${null eq reportMarketing.userId || '' eq reportMarketing.userId}">
                        &nbsp;
                    </c:if>
                </td>
                <td nowrap="nowrap">
                    <c:if test="${null ne reportMarketing.userName && '' ne reportMarketing.userName}">
                        <c:out value="${reportMarketing.userName}"/>
                    </c:if>
                    <c:if test="${null eq reportMarketing.userName || '' eq reportMarketing.userName}">
                        &nbsp;
                    </c:if>
                </td>
                <td nowrap="nowrap">
                    <i class="icon-edit pointer icon-large"
                       onclick="window.location='${ctx}/reportmarketing/${reportMarketing.id}?action=edit'"></i>
                    &nbsp;&nbsp; <i
                        title="删除"
                        class="icon-minus pointer icon-large"
                        onclick="deleteById('${reportMarketing.id}')"> </i>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>
<script type="text/javascript">

    //全选
    function checkAll(btn) {
        if (btn.checked) {
            for (i = 0; i < document.all("memberCheck").length; i++) {
                document.all("memberCheck")[i].checked = "checked";
            }
        }
        else {
            for (i = 0; i < document.all("memberCheck").length; i++) {
                document.all("memberCheck")[i].checked = "";
            }
        }
    }

    //单选
    function checkMember(btn) {
        if (btn.checked) {
            var checkAll = true;
            for (i = 0; i < document.all("memberCheck").length; i++) {
                if (document.all("memberCheck")[i].checked == false) {
                    checkAll = false;
                }
            }

            if (checkAll) {
                document.getElementById("memberCheckAll").checked = true;
            }
        }
        else {
            document.getElementById("memberCheckAll").checked = false;
        }
    }

    var deleteById = function (selectedId) {
        /*
         id为空则是多选  判断是否为空
         为空 提示选择
         不为空 确认后删除
         不为空单选确认后删除
         */
        if (selectedId == "") {
            for (i = 0; i < document.getElementsByName('memberCheck').length; i++) {
                if (document.getElementsByName('memberCheck')[i].checked) {
                    selectedId += document.getElementsByName('memberCheck')[i].value + ",";
                }
            }

            var str = "";
            if (selectedId != "") {
                str = selectedId.split(",");

                if (str[str.length - 1] == "") {
                    selectedId = selectedId.substring(0, selectedId.length - 1);
                }
            }
        }

        if (selectedId == "") {
            House365Util.createModal("删除公告", "请至少选择一条公告!", function () {
            });
        }
        else {
            House365Util.createModal("删除公告", "确定要删除该公告？", function () {
                $.ajax({
                    url: '${ctx}/reportmarketing/' + selectedId,
                    type: "DELETE",
                    success: function () {
                        window.location.reload();
                    }
                });
            });
        }

    };

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