index.php 4.92 KB
<?php
use yii\helpers\Url;
use app\ht\widgets\LinkPager;
use common\models\Address;

$this->title =  "地址管理";
$this->params['breadcrumbs'][] = '系统管理';
$this->params['breadcrumbs'][] =  $this->title;

?>
<div class="panel panel-default">
    <div class="panel-body">
        <form action="" method="get" id="search-form" class="filter-form">
            <table width="100%" class="table table-bordered">
                <tbody>
                <tr >
                    <td class="text-right">城市:</td>
                    <td class="text-left"><input type="text" class="form-control" name="city" value="<?php if (!empty($gets['city'])){ echo $gets['city']; } ?>"></td>
                    <td class="text-right">地区:</td>
                    <td class="text-left"><input type="text" class="form-control" name="district" value="<?php if (!empty($gets['district'])){ echo $gets['district']; } ?>"></td>
                    <td class="text-right">关键字:</td>
                    <td class="text-left"><input type="text" class="form-control" name="keyword" value="<?php if (!empty($gets['keyword'])){ echo $gets['keyword']; } ?>"></td>
                </tr>
                <tr >
                    <td class="text-right">地址类型:</td>
                    <td class="text-left">
                        <select class="form-control" name="type">
                            <option value="">-- 全部 --</option>
                        <?php foreach ($typeLables as $key => $typeItem):?>
                            <option value="<?= $key ?>" <?php if ($gets['type'] == $key && $gets['type'] !== null) echo "selected"?> ><?= $typeItem ?></option>
                        <?php endforeach; ?>
                        </select>
                    </td>
                    <td class="text-right"></td>
                    <td class="text-left"></td>
                    <td class="text-right"></td>
                    <td class="text-left"></td>
                </tr>
                <tr class="search">
                    <td colspan="6"  class="text-center">
                        <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询  </button>
                        <a class="btn btn-default btncls" href="<?=Url::toRoute("/system/address/index")?>">重&nbsp;&nbsp;&nbsp;&nbsp;置</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>

<div class="panel panel-default">
    <div  class="panel-body">
        <table class="table table-striped table-bordered"  id="brand-table">
            <thead>
            <tr>
                <th width="4%">ID</th>
                <th width="20%">地址</th>
                <th width="20%">标题</th>
                <th width="8%">门牌号</th>
                <th width="5%">省</th>
                <th width="5%">市</th>
                <th width="5%">区</th>
                <th width="8%">坐标</th>
                <th width="8%">地址类型</th>
                <th width="6%">操作</th>
            </tr>
            </thead>

            <tbody>
            <?php foreach ($address as $addressItem) : ?>
                <tr>
                    <td>
                        <?= $addressItem['id'] ?>
                    </td>
                    <td>
                        <?php $addressInfo = $addressItem['address']; ?>
                        <?= empty($addressInfo) ? "暂无" : $addressItem['address'] ?>
                    </td>
                    <td>
                        <?= empty($addressItem['title']) ? "暂无" : $addressItem['title'] ?>
                    </td>
                    <td>
                        <?php $detail = $addressItem['detail'] ?>
                        <?= empty($detail) ? "暂无" : $detail ?>
                    </td>
                    <td>
                        <?= $addressItem['province'] ?>
                    </td>
                    <td>
                        <?= $addressItem['city'] ?>
                    </td>
                    <td>
                        <?= $addressItem['district'] ?>
                    </td>
                    <td>
                        <?= $addressItem['longitude'] ?>, <?= $addressItem['latitude'] ?>
                    </td>
                    <td>
                        <?= Address::typeLabels($addressItem['type']) ?>
                    </td>

                    <td>
                        <a href="<?php echo Url::toRoute(['/system/address/update', 'id' => $addressItem['id']]) ?>" class="btn btn-primary">查看详情</a>
                    </td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>

    <div class="panel-footer">
        <div class="hqy-panel-pager">
            <?= LinkPager::widget([
                'pagination' => $pages,
            ]); ?>
            <div class="clearfix"></div>
        </div>
    </div>
</div>