><a href="<?php echo Url::toRoute(['category/index', 'view' => 'tree']); ?> ">Деревом</a></li> <li role="presentation" <?php if (yii::$app->request->get('view') == 'list') { echo ' class="active"'; } ?> ><a href="<?php echo Url::toRoute(['category/index', 'view' => 'list']); ?> ">Списком</a></li> </ul> <br style="clear: both;"> <?php if (isset($_GET['view']) && $_GET['view'] == 'list') { $categories = \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'id', 'filter' => false, 'options' => ['style' => 'width: 55px;']], 'name', ['attribute' => 'image', 'format' => 'image', 'filter' => false, 'content' => function ($image) { if ($image = $image->getImage()->getUrl('50x50')) { return "<img src=\"{$image}\" class=\"thumb\" />"; } }], ['attribute' => 'parent_id', 'filter' => Html::activeDropDownList($searchModel, 'parent_id', Category::buildTextTree(), ['class' => 'form-control', 'prompt' => 'Категория']), 'value' => 'parent.name'], ['class' => 'app\\modules\\admin\\components\\grid\\ActionColumn']]]); } else { $categories = \app\modules\tree\widgets\Tree::widget(['model' => new \app\modules\shop\models\Category()]); } echo $categories; ?> </div>
<div class="row"> <div class="col-lg-6 col-xs-6"> <?php echo $form->field($model, 'category_id')->widget(Select2::classname(), ['data' => Category::buildTextTree(), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите категорию ...'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'producer_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Producer::find()->all(), 'id', 'name'), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите бренд ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-lg-6 col-xs-6"> <?php echo $form->field($model, 'category_ids')->label('Прочие категории')->widget(Select2::classname(), ['data' => Category::buildTextTree(), 'language' => 'ru', 'options' => ['multiple' => true, 'placeholder' => 'Доп. категории ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> </div> <?php echo $form->field($model, 'text')->widget(\app\widgets\Editor::className()); ?> <?php echo $form->field($model, 'short_text')->textInput(['maxlength' => true]); ?> <?php echo Gallery::widget(['model' => $model]); ?>
if ($amount = $dataProvider->query->sum('amount')) { ?> <div class="summary"> Всего остатков: Всего товаров: <?php echo $amount; ?> </div> на сумму <?php echo Price::find()->joinWith('product')->sum("shop_price.price*shop_product.amount"); ?> руб. </div> <?php } ?> <br style="clear: both;"></div> <?php echo \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'id', 'filter' => false, 'options' => ['style' => 'width: 55px;']], 'name', 'code', ['label' => 'Остаток', 'content' => function ($model) { return "<p>{$model->amount} (" . $model->amount * $model->price . ")</p>"; }], ['attribute' => 'images', 'format' => 'images', 'filter' => false, 'content' => function ($image) { if ($image = $image->getImage()->getUrl('50x50')) { return "<img src=\"{$image}\" class=\"thumb\" />"; } }], ['label' => 'Цена', 'value' => 'price'], ['attribute' => 'category_id', 'filter' => Html::activeDropDownList($searchModel, 'category_id', Category::buildTextTree(), ['class' => 'form-control', 'prompt' => 'Категория']), 'value' => 'category.name'], ['attribute' => 'producer_id', 'filter' => Html::activeDropDownList($searchModel, 'producer_id', ArrayHelper::map(Producer::find()->all(), 'id', 'name'), ['class' => 'form-control', 'prompt' => 'Производитель']), 'value' => 'producer.name'], ['class' => 'app\\modules\\admin\\components\\grid\\ActionColumn', 'translatable' => true]]]); ?> </div>