index.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. use common\models\Compere;
  3. use yii\helpers\Html;
  4. use yii\grid\GridView;
  5. /* @var $this yii\web\View */
  6. /* @var $searchModel backend\models\search\CompereSearch */
  7. /* @var $dataProvider yii\data\ActiveDataProvider */
  8. $this->title = Yii::t('common', 'Comperes');
  9. $this->params['breadcrumbs'][] = $this->title;
  10. ?>
  11. <?php $this->beginBlock('content-header') ?>
  12. <?= $this->title . ' ' . Html::a(Yii::t('common', 'Create Compere'), ['create'], ['class' => 'btn btn-success']) ?>
  13. <?php $this->endBlock() ?>
  14. <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  15. <div class="box box-success">
  16. <div class="box-body">
  17. <?= GridView::widget([
  18. 'dataProvider' => $dataProvider,
  19. 'filterModel' => $searchModel,
  20. 'columns' => [
  21. 'id',
  22. 'name',
  23. 'desc',
  24. [
  25. 'attribute' => 'province',
  26. 'format' => 'raw',
  27. 'value' => function ($model) {
  28. return \common\models\Region::getNameById($model->province);
  29. },
  30. ],
  31. [
  32. 'attribute' => 'city',
  33. 'format' => 'raw',
  34. 'value' => function ($model) {
  35. return \common\models\Region::getNameById($model->city);
  36. },
  37. ],
  38. [
  39. 'attribute' => 'area',
  40. 'format' => 'raw',
  41. 'value' => function ($model) {
  42. return \common\models\Region::getNameById($model->area);
  43. },
  44. ],
  45. // 'address',
  46. 'title',
  47. 'works',
  48. 'tel',
  49. 'created_at',
  50. 'updated_at',
  51. [
  52. 'attribute' => 'status',
  53. 'value' => function ($model) {
  54. return Compere::getStatusList($model->status);
  55. },
  56. ],
  57. ['class' => 'yii\grid\ActionColumn'],
  58. ],
  59. ]); ?>
  60. </div>
  61. </div>