<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\search\AddressSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('common', 'Addresses');
$this->params['breadcrumbs'][] = $this->title;
?>
<?php $this->beginBlock('content-header') ?>
<?= $this->title  ?>
<?php $this->endBlock() ?>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>

<div class="box box-success">
    <div class="box-body">
        <?= GridView::widget([
            'dataProvider' => $dataProvider,
            'filterModel' => $searchModel,
            'columns' => [
//                    'id',
                'user_id:user',
                'name',
                'tel',
                [
                    'label' => '地址',
                    'value' => function ($model) {
                        /* @var  $model \common\models\Address */

                        return $model->getFullAddress();
                    }
                ],
                [
                    'attribute' => 'is_default',
                    'value' => function ($model) {
                        /* @var  $model \common\models\Address */

                        return $model->is_default ? '是' : '否';
                    }
                ],


                // 'city',
                // 'area',
                // 'detail',
                // 'created_at',
                // 'updated_at',
                // 'status',


            ],
        ]); ?>
    </div>
</div>
