<%@ page import="com.lightinit.hsdatashow.dictionary.DicEducationType" %>
<%@ page import="com.lightinit.hsdatashow.model.admin.DicFacilitiesType" %>
<%@ page import="com.lightinit.hsdatashow.dictionary.DicSanitationType" %>
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String basePath = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../../../common/admin/head.jsp"></jsp:include>
    <link  rel="stylesheet" type="text/css" href="<%=basePath%>/resource/css/admin/home/index.css">
    <style type="text/css">
        #allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
        #l-map{height:100%;width:78%;float:left;border-right:2px solid #bcbcbc;}
        #r-result{height:100%;width:20%;float:left;}
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=RleRpI1DQegNo17XGsVvUUS1e3oiubUG"></script>
</head>
<body>
    <jsp:include page="../../../common/admin/body_pre.jsp"></jsp:include>
    <div class="row hidden-print">
        <div class="col-lg-12">
            <div class="ibox">
                <div class="ibox-title">
                    <h2>环卫设施</h2>
                    <ol class="breadcrumb">
                        <li>
                            <a href="javascript:void(0);" >城市资产</a>
                        </li>
                        <li class="active">
                            <strong>环卫设施</strong>
                        </li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
    <div class="row hidden-print">
        <div class="col-lg-12 col-md-12">
                <div class="ibox-content-noline">
                <div id="allmap" style="width: 100%;height: 675px;"></div>
                    <input type="hidden" value=0 id="isFalg">
                </div>
        </div>
    </div>
    <jsp:include page="../../../common/admin/body_post.jsp"></jsp:include>
    <script type="text/javascript">
        // 百度地图API功能
        var map = new BMap.Map("allmap");
        var point = new BMap.Point(115.675402, 37.745191);
        map.centerAndZoom(point, 15);

        $.post("<%=basePath%>/admin/facilities/getSanitation.action",{categoryName : '<%=DicFacilitiesType.SANITATION%>'},function (datas) {
            if (datas.length>0){
                for (var i=0;i<datas.length;i++){
                    (function (x) {
                   if (datas[i].facilityType=='<%=DicSanitationType.TRASH_STATION%>'){
                       var fax= datas[i].fax==null?'暂无':datas[i].fax ;
                       var sContent =
                           "<h4 style='margin:0 0 5px 0;padding:0.2em 0'>管理单位：" + datas[i].shortName + "</h4>" +
                           "<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>名称：" + datas[i].orgName + "</p>" +
                           "<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>地址：" + fax + "</p>" +
                           "</div>";
                       var pt = new BMap.Point(datas[i].longitude, datas[i].latitude);
                       var myIcon = new BMap.Icon("<%=basePath%>/resource/images/sanitation/trash_station.png", new BMap.Size(40,40));
                       var marker = new BMap.Marker(pt,{icon:myIcon});  // 创建标注
                       var infoWindow = new BMap.InfoWindow(sContent) ;
                       map.centerAndZoom(point, 15);
                       marker.addEventListener("click", function(){
                           this.openInfoWindow(infoWindow);
                       });
                       map.addOverlay(marker);
                   }
                   if (datas[i].facilityType=='<%=DicSanitationType.TRASH%>'){
                       var fax= datas[i].fax==null?'暂无':datas[i].fax ;
                       var sContent =
                           "<h4 style='margin:0 0 5px 0;padding:0.2em 0'>管理单位：" + datas[i].shortName + "</h4>" +
                           "<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>名称：" + datas[i].orgName + "</p>" +
                           "<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>地址：" + fax + "</p>" +
                           "</div>";
                       var pt = new BMap.Point(datas[i].longitude, datas[i].latitude);
                       var myIcon = new BMap.Icon("<%=basePath%>/resource/images/sanitation/trash.png", new BMap.Size(40,40));
                       var marker = new BMap.Marker(pt,{icon:myIcon});  // 创建标注
                       var infoWindow = new BMap.InfoWindow(sContent) ;
                       map.centerAndZoom(point, 15);
                       marker.addEventListener("click", function(){
                           this.openInfoWindow(infoWindow);
                       });
                       map.addOverlay(marker);
                   }
                    })(i);
               }
            }
        },"json")
    </script>
</body>
</html>