index.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. use common\models\Store;
  3. use slavkovrn\lightbox\LightBoxWidget;
  4. use yii\helpers\Html;
  5. use yii\grid\GridView;
  6. /* @var $this yii\web\View */
  7. /* @var $searchModel backend\models\search\StoreSearch */
  8. /* @var $dataProvider yii\data\ActiveDataProvider */
  9. $this->title = Yii::t('common', 'Stores');
  10. $this->params['breadcrumbs'][] = $this->title;
  11. ?>
  12. <?php $this->beginBlock('content-header') ?>
  13. <?= $this->title . ' ' . Html::a(Yii::t('common', 'Create Store'), ['create'], ['class' => 'btn btn-success']) ?>
  14. <?php $this->endBlock() ?>
  15. <?php echo $this->render('_search', ['model' => $searchModel]); ?>
  16. <div class="box box-success">
  17. <div class="box-body">
  18. <?= GridView::widget([
  19. 'dataProvider' => $dataProvider,
  20. //'filterModel' => $searchModel,
  21. 'columns' => [
  22. 'id',
  23. 'user_id:user',
  24. 'proxy_user_id:user',
  25. 'name',
  26. 'code',
  27. 'address',
  28. [
  29. 'attribute' => 'logo',
  30. 'format' => 'raw',
  31. 'value' => function ($model) {
  32. $images = [ // images at popup window of prettyPhoto galary
  33. 1 => [
  34. 'src' => $model->logo,
  35. 'title' => '',
  36. ],
  37. ];
  38. return $model->logo ? LightBoxWidget::widget([
  39. 'id' => 'cover', // id of plugin should be unique at page
  40. 'class' => 'galary', // class of plugin to define style
  41. 'height' => '100px', // height of image visible in widget
  42. 'width' => '100px', // width of image visible in widget
  43. 'images' => $images,
  44. ]) : null;
  45. }
  46. ],
  47. [
  48. 'attribute' => 'license',
  49. 'format' => 'raw',
  50. 'value' => function ($model) {
  51. $images = [ // images at popup window of prettyPhoto galary
  52. 1 => [
  53. 'src' => $model->license,
  54. 'title' => '',
  55. ],
  56. ];
  57. return $model->license ? LightBoxWidget::widget([
  58. 'id' => 'cover', // id of plugin should be unique at page
  59. 'class' => 'galary', // class of plugin to define style
  60. 'height' => '100px', // height of image visible in widget
  61. 'width' => '100px', // width of image visible in widget
  62. 'images' => $images,
  63. ]) : null;
  64. }
  65. ],
  66. /*[
  67. 'attribute' => 'photos',
  68. 'format' => 'raw',
  69. 'value' => function ($model){
  70. $images = [];
  71. foreach ($model->photos as $index=>$photos) {
  72. $images[$index] = ['src'=>$photos, 'title'=>''];
  73. }
  74. return $model->photos ? LightBoxWidget::widget([
  75. 'id' =>'photos', // id of plugin should be unique at page
  76. 'class' =>'galary', // class of plugin to define style
  77. 'height' =>'100px', // height of image visible in widget
  78. 'width' =>'100px', // width of image visible in widget
  79. 'images' => $images,
  80. ]) : null;
  81. }
  82. ],*/
  83. 'contacts',
  84. 'tel',
  85. 'desc',
  86. 'created_at:datetime',
  87. 'updated_at:datetime',
  88. [
  89. 'attribute' => 'status',
  90. 'value' => function ($model) {
  91. return Store::getStatusList($model->status);
  92. },
  93. ],
  94. ['class' => 'common\helpers\DiyActionColumn'],
  95. ],
  96. ]); ?>
  97. </div>
  98. </div>