コード例 #1
0
ファイル: index.php プロジェクト: Ellumilel/analitics
$this->title = 'Информационный продукт';
$this->params['breadcrumbs'][] = $this->title;
?>
<a href="<?php 
echo \Yii::$app->getUrlManager()->createUrl(['download/inform-product']);
?>
" class="btn btn-primary" >
    <i class="fa fa-download"></i> Выгрузка Инф.продукта
</a>
<div class="podruzka-product-index">
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'resizableColumns' => true, 'bordered' => false, 'rowOptions' => function ($model, $key, $index, $grid) {
    return ['id' => $model['id'], 'onclick' => '
            if ( !$(this).hasClass("success") ) {
                $(this).addClass("success");
            } else {
                $(this).removeClass("success");
            }'];
}, 'columns' => [['format' => 'raw', 'class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'article', 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '200px']], 'value' => function ($model, $key, $index, $widget) {
    return $model->article;
}, 'editableOptions' => function ($model, $key, $index) {
    return ['header' => 'l_id', 'size' => 'md', 'afterInput' => function ($form, $widget) use($model, $index) {
        return TextHelper::getArticleMatchingForm($model);
    }, 'formOptions' => ['action' => \Yii::$app->getUrlManager()->createUrl(['podruzka-product/article-update'])]];
}], 'title', ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'arrival', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListArrival($condition), 'arrival', 'arrival'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '80px']], 'value' => 'arrival'], ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'group', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListGroup($condition), 'group', 'group'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '170px']], 'value' => 'group'], ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'category', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListCategory($condition), 'category', 'category'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '200px']], 'value' => 'category'], ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'sub_category', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListSubCategory($condition), 'sub_category', 'sub_category'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '220px']], 'value' => 'sub_category'], ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'detail', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListDetail($condition), 'detail', 'detail'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '240px']], 'value' => 'detail'], ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'brand', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListBrand($condition), 'brand', 'brand'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '120px']], 'value' => 'brand'], ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'sub_brand', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListSubBrand($condition), 'sub_brand', 'sub_brand'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '120px']], 'value' => 'sub_brand'], ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'line', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListLine($condition), 'line', 'line'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '140px']], 'value' => 'line'], 'price', 'ma_price'], 'responsive' => true, 'hover' => true, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true, 'beforeGrid' => 'My fancy content before.', 'afterGrid' => 'My fancy content after.']]);
?>
</div>
コード例 #2
0
ファイル: new_product.php プロジェクト: Ellumilel/analitics
use app\helpers\TextHelper;
use yii\helpers\ArrayHelper;
/* @var $searchModel app\models\PodruzkaProductSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $product array */
/* @var $partner string */
$this->title = 'Статистика сбора данных по новинкам: ' . $partner;
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="box-body">
    <a href="<?php 
echo \Yii::$app->getUrlManager()->createUrl(['/statistic/index']);
?>
">
        <button class="btn btn-default btn-xs"><i class="fa fa-share"></i> Назад к статистике</button>
    </a>
</div>
<div class="product-index">
    <?php 
Pjax::begin();
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => array_merge(['article', ['attribute' => 'link', 'format' => 'raw', 'value' => function ($data) {
    return TextHelper::getImageLink($data->image_link, $data->link);
}], ['attribute' => 'group', 'filter' => ArrayHelper::map($model->getListGroup($condition), 'group', 'group')], ['attribute' => 'category', 'filter' => ArrayHelper::map($model->getListCategory($condition), 'category', 'category')], ['attribute' => 'sub_category', 'filter' => ArrayHelper::map($model->getListSubCategory($condition), 'sub_category', 'sub_category')], ['attribute' => 'brand', 'filter' => ArrayHelper::map($model->getListBrand($condition), 'brand', 'brand')], 'title', 'description', 'created_at'], $price)]);
?>
    <?php 
Pjax::end();
?>
</div>
コード例 #3
0
        if ( !$(this).hasClass("success") ) {
            $(this).addClass("success");
        } else {
            $(this).removeClass("success");
        }'];
}, 'columns' => [['format' => 'raw', 'class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'article', 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '200px']], 'value' => function ($model, $key, $index, $widget) {
    return $model->article;
}, 'editableOptions' => function ($model, $key, $index) {
    return ['header' => 'l_id', 'size' => 'md', 'afterInput' => function ($form, $widget) use($model, $index) {
        return TextHelper::getArticleMatchingForm($model);
    }, 'formOptions' => ['action' => \Yii::$app->getUrlManager()->createUrl(['podruzka-product/article-update'])]];
}], 'title', ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'arrival', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListArrival($condition), 'arrival', 'arrival'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '90px']], 'value' => 'arrival'], ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'category', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListCategory($condition, true), 'category', 'category'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '190px']], 'value' => 'category'], ['filterInputOptions' => ['placeholder' => ''], 'attribute' => 'brand', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map((new PodruzkaProduct())->getListBrand($condition, true), 'brand', 'brand'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => '120px']], 'value' => 'brand'], 'price', 'ma_price', ['attribute' => 'l_old_price', 'label' => 'let.price', 'format' => 'raw', 'value' => function ($data) {
    return !empty($data->l->old_price) ? TextHelper::getPriceMatchLink($data->price, $data->l->old_price, $data->l->link) : '';
}], ['attribute' => 'l_new_price', 'label' => 'let.new_price', 'format' => 'raw', 'value' => function ($data) {
    return !empty($data->l->new_price) ? TextHelper::getPriceMatchLink($data->price, $data->l->new_price, $data->l->link) : '';
}], ['attribute' => 'r_price', 'label' => 'rive.r_price', 'format' => 'raw', 'value' => function ($data) {
    return !empty($data->r->price) ? TextHelper::getPriceMatchLink($data->price, $data->r->price, $data->r->link) : '';
}], ['attribute' => 'r_gold_price', 'label' => 'rive.r_gold_price', 'format' => 'raw', 'value' => function ($data) {
    return !empty($data->r->gold_price) ? TextHelper::getPriceMatchLink($data->price, $data->r->gold_price, $data->r->link) : '';
}], ['attribute' => 'e_old_price', 'label' => 'eli.old_price', 'format' => 'raw', 'value' => function ($data) {
    return !empty($data->e->old_price) ? TextHelper::getPriceMatchLink($data->price, $data->e->old_price, $data->e->link) : '';
}], ['attribute' => 'e_new_price', 'label' => 'eli.new_price', 'format' => 'raw', 'value' => function ($data) {
    return !empty($data->e->new_price) ? TextHelper::getPriceMatchLink($data->price, $data->e->new_price, $data->e->link) : '';
}], ['attribute' => 'i_old_price', 'label' => 'ile.old_price', 'format' => 'raw', 'value' => function ($data) {
    return !empty($data->i->old_price) ? TextHelper::getPriceMatchLink($data->price, $data->i->old_price, $data->i->link) : '';
}], ['attribute' => 'i_new_price', 'label' => 'ile.new_price', 'format' => 'raw', 'value' => function ($data) {
    return !empty($data->i->new_price) ? TextHelper::getPriceMatchLink($data->price, $data->i->new_price, $data->i->link) : '';
}]], 'responsive' => true, 'hover' => true, 'pjax' => true, 'floatHeader' => true, 'headerRowOptions' => ['class' => 'kartik-sheet-style'], 'panel' => ['type' => GridView::TYPE_PRIMARY, 'heading' => 'Сравнение цен по сопоставленным артикулам '], 'floatOverflowContainer' => true, 'export' => false, 'toolbar' => false, 'id' => 'price-matching', 'pjaxSettings' => ['neverTimeout' => true, 'options' => ['id' => 'price-matching']]]);
?>
</div>