{template '_header'}

<div class="page-header">
    当前位置：<span class="text-primary">收货地址管理</span>
</div>

<div class="page-content">
    <form action="" method="get" class="form-horizontal form-search" role="form">
        <input type="hidden" name="c" value="address" />
        <input type="hidden" name="a" value="delivery" />
        
        
        <div class="page-toolbar">
             <div class="col-sm-4">
                <div class="input-group">
                      <input type="text" class="input-sm form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="请输入关键词">
                      <span class="input-group-btn">
                          <button class="btn btn-primary" type="submit"> 搜索</button>
                      </span>
                </div>
            </div>
        </div>
    </form>

    <form action="" method="post">
        <div class="row">
            <div class="col-md-12">
                <div class="page-table-header">
                    <input type='checkbox' />
                    <span class="pull-right">
                        <a href="{:U('config/address.adddelivery')}" class="btn btn-primary"><i class="fa fa-plus"></i> 添加收货地址</a>
                    </span>
                    <div class="btn-group">
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:U('config/address.deldelivery')}">
                            <i class="icow icow-shanchu1"></i>删除</button>
                    </div>
                </div>
                <?php if( count($list)>0){ ?>
                <table class="table table-responsive">
                    <thead class="navbar-inner">
                        <tr>
                            <th style="width:25px;"><input type='checkbox' /></th>
                            <th>名称</th>
                            <th style='width:80px;'>联系人</th>
                            <th style='width:100px;'>手机</th>
                            <th>地址</th>
                            <th style='width:60px;'>默认</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach( $list as  $item  ){ ?>
                        <tr>
                            <td>
                                <input type='checkbox' value="{$item['id']}"/>
                            </td>
                            <td>{$item['title']}</td>
                            <td>{$item['name']}</td>
                            <td>{$item['mobile']}</td>
                            <td>{$item['address']}</td>
                            <td>
                                <span class='label <?php if( $item['isdefault']==1){ ?>label-primary<?php  }else{  ?>label-default<?php } ?> defaults'
                                  data-toggle='ajaxSwitch'
                                  data-switch-value='{$item['isdefault']}'
                                  data-switch-value0='0|否|label label-default defaults|{:U('config/address.setdeliverydefault',array('isdefault'=>1,'id'=>$item['id']))}'
                                  data-switch-value1='1|是|label label-primary defaults|{:U('config/address.setdeliverydefault',array('isdefault'=>0,'id'=>$item['id']))}'
                                  data-switch-css='.defaults'
                                  data-switch-other = 'true'
                                  style="cursor: pointer;"
                                >
                                <?php if( $item['isdefault']==1){ ?>是<?php  }else{  ?>否<?php } ?></span>
                            </td>
                            <td style="text-align:left;">
                                <?php if( $item['uniacid']!=0){ ?>
                                    <a href="{:U('config/address.editdelivery', array('id' => $item['id']))}" class="btn btn-default btn-sm btn-operation btn-op">
                                        <span data-toggle="tooltip" data-placement="top" title="" data-original-title="修改">
                                            <i class="icow icow-bianji2"></i>
                                        </span>
                                    </a>
                                    <a data-toggle='ajaxRemove' href="{:U('config/address.deldelivery', array('id' => $item['id']))}"class="btn btn-default btn-sm btn-operation btn-op" data-confirm='确认要删除此退货地址吗?'>
                                        <span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
                                            <i class="icow icow-shanchu1"></i>
                                        </span>
                                    </a>
                                <?php } ?>
                            </td>
                        </tr>
                        <?php } ?>
                        <tr>
                            <td colspan='7'>
                                <div class='pagers' style='float:right;'>
                                    {$pager}
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>

                <?php  }else{  ?>
                <div class='panel panel-default'>
                    <div class='panel-body' style='text-align: center;padding:30px;'>
                        暂时没有任何收货地址!
                    </div>
                </div>
                <?php } ?>
            </div>
        </div>
    </form>
</div>

{template '_footer'}
