<!doctype html>
<html class="no-js">
<head>

<include file="Common/head" />

    <style type="text/css">
        a.am-text-secondary:visited{color:#3bb4f2;}
        a.am-text-danger:visited{color:#dd514c;}
        .am-btn-default {background-color: #fff;}
        th {text-align:center;}
        tr td{text-align:center;}
        select{padding: 4px;border: 1px solid #ccc;}
        .am-popup-bd {background:#fff;}
        .am-popup-bd img {max-width: 100%}
        .am-u-sm-2 {border-top: 1px solid #ddd;margin-top: 10px;}
        .am-u-sm-10 {border-left: 1px solid #ddd;margin-top: 10px;}
    </style>
</head>
<body>

<include file="Common/header" />

<div class="am-cf admin">

    <!-- sidebar start -->
    <include file="Common/sidebar" nav="$nav"/>
    <!-- sidebar end -->

    <!-- Start right Content here -->
        <div class="content-page" style="background: white;">
            <!-- Start content -->
            <div class="content">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">Setting</strong> / <small>Personal Info Edit<span style="color: red;">(Logo 80*80)</span></small>
                </div>
            </div>
            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form" action="" method="POST" enctype="multipart/form-data">
                        <input type="hidden" name="id" value="{$info.id}"/>
                        <fieldset>
                            <legend>{$legend}</legend>

                        <?php if ($info['is_business'] == 1) : ?>
                            <div class="am-form-group">
                                <label for="business_name">Merchant Name</label>
                                <input type="text" name="business_name" class="" id="business_name" value="{$info.business_name}" required/>
                            </div>
                        <?php endif;?>

                        <?php if ($info['is_business'] == 1) : ?>
                            <div class="am-form-group">
                                <h3>Disable Takeaway Function?</h3>
                                <label class="am-radio-inline">
                                  <input type="radio" name="is_on_waimai" value="1" data-am-ucheck <?php if ($info['is_on_waimai'] == 1) : ?>checked<?php endif;?>>
                                  open
                                </label>
                                <label class="am-radio-inline">
                                  <input type="radio" name="is_on_waimai" value="2" data-am-ucheck <?php if ($info['is_on_waimai'] == 2) : ?>checked<?php endif;?>>
                                  close
                                </label>
                            </div>
                        <?php endif;?>

                            <div class="am-form-group">
                                <label for="username"><?php if ($info['is_business'] == 1) : ?>Contact Person<?php else : ?>username<?php endif;?></label>
                                <input type="text" name="username" class="" id="username" value="{$info.username}" required <?php if ($info['is_business'] == 1) : ?>readonly<?php endif;?>/>
                            </div>

                            <div class="am-form-group">
                                <label for="picture"><?php if ($info['is_business'] == 1) : ?>Logo(80*80)<?php else : ?>avatar<?php endif;?></label>
                                <input type="file" name="picture" class="" id="picture"/>
                                <?php if (!empty($info['picture'])) : ?>
                                <img src="__UPLOADS__/{$info.picture}" alt="" style="width:100px;height:100px" />
                                <?php endif;?>
                            </div>

                        <?php if ($info['is_business'] == 1) : ?>
                            <div class="am-form-group">
                                <label for="picture_environment">Store Environment Image(750*480)</label>
                                <input type="file" name="picture_environment" class="" id="picture_environment"/>
                                <?php if (!empty($info['picture_environment'])) : ?>
                                <img src="__UPLOADS__/{$info.picture_environment}" alt="" style="width:200px;height:125px" />
                                <?php endif;?>
                            </div>

                            <div class="am-form-group">
                                <label for="business_phone">Phone</label>
                                <input type="text" id="business_phone" name="business_phone" value="{$info.business_phone}" required/>
                            </div>

                            <div class="am-form-group">
                                <label for="delivery">Shipping Fee</label>
                                <input type="text" id="delivery" name="delivery" value="{$info.delivery}" required/>
                            </div>

                            <div class="am-form-group">
                                <label for="up_to_send">Delivery Fee</label>
                                <input type="number" step="0.01" id="up_to_send" name="up_to_send" value="{$info.up_to_send}" required/>
                            </div>

                            <div class="am-form-group">
                                <label for="boxes">Food Takeaway Box Fee</label>
                                <input type="number" step="0.01" id="boxes" name="boxes" value="{$info.boxes}" required/>
                            </div>

                            <div class="am-form-group">
                                <label for="business_des">Short Description</label>
                                <textarea id="business_des" name="business_des" minlength="10" maxlength="100">{$info.business_des}</textarea>
                            </div>
                            
                            <div class="am-form-group">
                                <label for="email" >Delivery Alerted Email</label>
                                <input type="email" id="email" name="send_email" value="{$info.send_email}"/>
                            </div>


                            <div class="am-form-group">
                                <label for="about_us">About Us</label>
                                <textarea id="about_us" name="about_us" minlength="10" maxlength="100" style="height: 300px;">{$info.about_us}</textarea>
                            </div>

                            <div class="am-form-group">
                                <label for="business_address">Address <span style="color: red;"></span></label>
                                <input type="text" id="business_address" name="business_address" value="{$info.business_address}" required placeholder="Please enter detailed address" />
                                
                            </div>
                            <div class="am-form-group">
                                <label for="about_us">Longitude Latitude(Please enter latitude and longitude and separate by (,))</label>
                                <input type="text" name="lnglat" id="lnglat" value="{$info.lnglat}" placeholder="Longitude Latitude,example:116.440719,23.252995" required="required">
                            </div>

                            <div class="am-form-group">
                                <label for="l_map"></label>
                                <!--<span>Longitude Latitude：<span class="map-tip-span address-longlat">{$info.lnglat}</span></span>-->
                                <div id="l_map" style="width: 100%; height: 400px;"></div>
                            </div>

                            <div class="am-form-group">
                                <label for="service_time">Business Hours</label>
                                <input type="text" name="service_time" id="service_time" value="{$info.service_time}" placeholder="例：9:00~23:00">
                            </div>

                        <?php endif;?>

                            <p>
                                <button type="submit" class="am-btn am-btn-success">Submit</button>
                                <input type="reset" class="am-btn am-btn-info" value="Reset" style="margin-left:20px" />
                                <a href="javascript:location.href=history.back();">
                                    <input type="button" class="am-btn am-btn-default" value="Back" style="margin-left:20px" />
                                </a>
                            </p>
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-- content end -->
</div>

<include file="Common/footer" />
</body>
<script type="text/javascript" src="__ASSETS__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__ASSETS__/ueditor/ueditor.all.min.js"></script>
<!--<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp"></script>
<!--<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0"></script>-->
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=ZVn62jvPQyvPLYim7yhbeASYFXD4dp6r"></script>
<script type="text/javascript">


    
   
    


    function init() {
        var map = new BMap.Map("l_map"); 
       

        // 创建地址解析器实例     
        /*var myGeo = new BMap.Geocoder(); 
        var adr = $('#business_address').val();     
        // 将地址解析结果显示在地图上，并调整地图视野 
       
        
        myGeo.getPoint(adr, function(point){      
            if (point) {
                var lng=point.lng;
                var lat=point.lat;
                var lnglat=lng+','+lat;
                $('.address-longlat').text(lnglat);
                $('#lnglat').val(lnglat);
                
                map.centerAndZoom(point, 16);      
                map.addOverlay(new BMap.Marker(point));      
            }      
         },      
        "");*/

        var lnglat = $('#lnglat').val();
        lnglat = lnglat.split(','); 

        var point = new BMap.Point(lnglat[0], lnglat[1]);  
        //var point = new BMap.Point(81.62356, 26.310484); 

        map.centerAndZoom(point, 11);

        var marker = new BMap.Marker(point);        // 创建标注    
        map.addOverlay(marker);

        var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角，添加比例尺
        var top_left_navigation = new BMap.NavigationControl();  //左上角，添加默认缩放平移控件
        map.addControl(top_left_control);        
        map.addControl(top_left_navigation);
            
        
       // map.enableScrollWheelZoom(true); 

    }



    init();
    $("#lnglat").change(function() {
            init();
    });
    /*$("#l_map").click(function() {
            init();
    });*/
    
    

</script>
<script type="text/javascript">
    //var map = new BMap.Map("l_map");          // 创建地图实例  
    //var point = new BMap.Point(116.404, 39.915);  // 创建点坐标  
   // map.centerAndZoom(point, 15);                 // 初始化地图，设置中心点坐标和地图级别
   // map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放  
    //window.onload = loadJScript;//异步加载地图
    //异步加载地图
    // function loadJScript() {
    //     var script = document.createElement("script");
    //     script.type = "text/javascript";
    //     script.src = "https://map.qq.com/api/js?v=2.exp&callback=init&key=RIGBZ-G5NLR-RHJWD-WR3YH-JUPE6-TSB56";
    //     document.body.appendChild(script);
    // }

    /*function init() {
        var adr = $('#business_address').val();
        var callbacks = {
            complete:function(results){
                //重置表单内容
                var lnglat = results.detail.location.lng+','+results.detail.location.lat;
                $('#lnglat').val(lnglat);
                $('.address-longlat').text(lnglat);
                var lnglat = $('#lnglat').val();
                lnglat = lnglat.split(',');
                var center = new qq.maps.LatLng(lnglat[1], lnglat[0]);
                //定义工厂模式函数
                var myOptions = {
                    zoom : 15,
                    center : center, 
                    mapTypeId : qq.maps.MapTypeId.ROADMAP
                }
                //创建地图
                $('#l_map').html('');
                var map = new qq.maps.Map(document.getElementById("l_map"), myOptions);

                //创建标注
                var marker = new qq.maps.Marker({
                    position: center,
                    map: map
                })
            },
        }
        //地址解析
        geocoder = new qq.maps.Geocoder(callbacks);
        geocoder.getLocation(adr);

        
    }
    init();
    $("#business_address").change(function() {
            init();
        });*/
    
    var editor = UE.getEditor('about_us');
</script>
</html>