public function run() { $options = CJavaScript::encode($this->options); echo CHtml::openTag('div', ['id' => $this->id]); echo CHtml::openTag('ul'); $this->createHtmlTree(StoreCategoryHelper::tree()); echo CHtml::closeTag('ul'); echo CHtml::closeTag('div'); Yii::app()->getClientScript()->registerScript('JsTreeScript', "\$('#{$this->id}').jstree({$options})"); }
</small> </h1> </div> <?php $this->widget('yupe\\widgets\\CustomGridView', ['id' => 'product-grid', 'sortableRows' => true, 'sortableAjaxSave' => true, 'sortableAttribute' => 'position', 'sortableAction' => '/store/productBackend/sortable', 'type' => 'condensed', 'dataProvider' => $model->search(), 'filter' => $model, 'actionsButtons' => ['add' => CHtml::link(Yii::t('StoreModule.store', 'Add'), ['/store/productBackend/create'], ['class' => 'btn btn-sm btn-success pull-right']), 'copy' => CHtml::link(Yii::t('StoreModule.store', 'Copy'), '#', ['id' => 'copy-products', 'class' => 'btn btn-sm btn-default pull-right', 'style' => 'margin-right: 4px;'])], 'columns' => [['type' => 'raw', 'value' => function ($data) { return CHtml::image(StoreImage::product($data, 40, 40), $data->name, ["width" => 40, "height" => 40, "class" => "img-thumbnail"]); }], ['name' => 'name', 'type' => 'raw', 'value' => function ($data) { return CHtml::link(\yupe\helpers\YText::wordLimiter($data->name, 5), ["/store/productBackend/update", "id" => $data->id]); }], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'sku', 'editable' => ['emptytext' => '---', 'url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'sku', ['class' => 'form-control'])], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'producer_id', 'url' => $this->createUrl('/store/productBackend/inline'), 'source' => CMap::mergeArray(['' => '---'], Producer::model()->getFormattedList()), 'editable' => ['emptytext' => '---']], ['name' => 'category_id', 'value' => function ($data) { $categoryList = '<span class="label label-primary">' . (isset($data->category) ? $data->category->name : '---') . '</span>'; foreach ($data->categories as $category) { $categoryList .= '<br>' . $category->name; } return $categoryList; }, 'type' => 'raw', 'filter' => CHtml::activeDropDownList($model, 'category_id', StoreCategoryHelper::formattedList(), ['encode' => false, 'empty' => '', 'class' => 'form-control']), 'htmlOptions' => ['width' => '220px']], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'price', 'value' => function (Product $data) { return round($data->getBasePrice(), 2); }, 'editable' => ['url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'price', ['class' => 'form-control'])], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'discount_price', 'header' => Yii::t('StoreModule.store', 'New price'), 'value' => function (Product $data) { return round($data->getDiscountPrice(), 2); }, 'editable' => ['emptytext' => '---', 'url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'discount_price', ['class' => 'form-control'])], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'in_stock', 'header' => Yii::t('StoreModule.store', 'Availability'), 'url' => $this->createUrl('/store/productBackend/inline'), 'source' => $model->getInStockList(), 'options' => [Product::STATUS_IN_STOCK => ['class' => 'label-success'], Product::STATUS_NOT_IN_STOCK => ['class' => 'label-danger']]], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'quantity', 'value' => function (Product $data) { return $data->quantity; }, 'header' => Yii::t('StoreModule.store', 'Rest'), 'editable' => ['url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'price', ['class' => 'form-control'])], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'status', 'url' => $this->createUrl('/store/productBackend/inline'), 'source' => $model->getStatusList(), 'options' => [Product::STATUS_ACTIVE => ['class' => 'label-success'], Product::STATUS_NOT_ACTIVE => ['class' => 'label-info'], Product::STATUS_ZERO => ['class' => 'label-default']]], ['class' => 'yupe\\widgets\\CustomButtonColumn', 'buttons' => ['front_view' => ['visible' => function ($row, $data) { return $data->status == Product::STATUS_ACTIVE; }]]]]]); ?> <?php $url = Yii::app()->createUrl('/store/productBackend/copy'); $tokenName = Yii::app()->getRequest()->csrfTokenName; $token = Yii::app()->getRequest()->csrfToken; Yii::app()->getClientScript()->registerScript(__FILE__, <<<JS
?> <span class="required">*</span> <?php echo Yii::t('StoreModule.store', 'are required'); ?> </div> <?php echo $form->errorSummary($model); ?> <div class='row'> <div class="col-sm-3"> <?php echo $form->dropDownListGroup($model, 'parent_id', ['widgetOptions' => ['data' => StoreCategoryHelper::formattedList(), 'htmlOptions' => ['empty' => Yii::t('StoreModule.store', '--no--'), 'encode' => false]]]); ?> </div> <div class="col-sm-4"> <?php echo $form->dropDownListGroup($model, 'status', ['widgetOptions' => ['data' => $model->getStatusList()]]); ?> </div> </div> <div class='row'> <div class="col-sm-7"> <?php echo $form->textFieldGroup($model, 'name'); ?> </div> </div>
<div class="col-sm-3"> <?php echo $form->dropDownListGroup($model, 'status', ['widgetOptions' => ['data' => $model->getStatusList()]]); ?> </div> <div class="col-sm-3"> <br/> <?php echo $form->checkBoxGroup($model, 'is_special'); ?> </div> </div> <div class="row"> <div class="col-sm-4"> <?php echo $form->dropDownListGroup($model, 'category_id', ['widgetOptions' => ['data' => StoreCategoryHelper::formattedList(), 'htmlOptions' => ['empty' => '---', 'encode' => false]]]); ?> </div> <div class="col-sm-3"> <?php echo $form->dropDownListGroup($model, 'producer_id', ['widgetOptions' => ['data' => Producer::model()->getFormattedList(), 'htmlOptions' => ['empty' => '---']]]); ?> </div> </div> <div class="row"> <div class="col-sm-7"> <?php echo $form->textFieldGroup($model, 'name'); ?> </div> </div>
$this->breadcrumbs = [Yii::t('StoreModule.store', 'Categories') => ['/store/categoryBackend/index'], Yii::t('StoreModule.store', 'Manage')]; $this->pageTitle = Yii::t('StoreModule.store', 'Categories - manage'); $this->menu = [['icon' => 'fa fa-fw fa-list-alt', 'label' => Yii::t('StoreModule.store', 'Manage categories'), 'url' => ['/store/categoryBackend/index']], ['icon' => 'fa fa-fw fa-plus-square', 'label' => Yii::t('StoreModule.store', 'Create category'), 'url' => ['/store/categoryBackend/create']]]; ?> <div class="page-header"> <h1> <?php echo Yii::t('StoreModule.store', 'Categories'); ?> <small><?php echo Yii::t('StoreModule.store', 'administration'); ?> </small> </h1> </div> <?php $this->widget('yupe\\widgets\\CustomGridView', ['id' => 'category-grid', 'sortableRows' => true, 'sortableAjaxSave' => true, 'sortableAttribute' => 'sort', 'sortableAction' => '/store/categoryBackend/sortable', 'type' => 'condensed', 'dataProvider' => $model->search(), 'filter' => $model, 'actionsButtons' => [CHtml::link(Yii::t('YupeModule.yupe', 'Add'), ['/store/categoryBackend/create'], ['class' => 'btn btn-success pull-right btn-sm'])], 'columns' => [['name' => 'image', 'type' => 'raw', 'value' => function ($data) { return CHtml::image(StoreImage::category($data, 40, 40), $data->name, ["width" => 40, "height" => 40, "class" => "img-thumbnail"]); }, 'filter' => false], ['name' => 'name', 'type' => 'raw', 'value' => function ($data) { return CHtml::link($data->name, array("/store/categoryBackend/update", "id" => $data->id)); }], ['name' => 'slug', 'type' => 'raw', 'value' => function ($data) { return CHtml::link($data->slug, array("/store/categoryBackend/update", "id" => $data->id)); }], ['name' => 'parent_id', 'value' => function ($data) { return $data->getParentName(); }, 'filter' => CHtml::activeDropDownList($model, 'parent_id', StoreCategoryHelper::formattedList(), ['encode' => false, 'empty' => '', 'class' => 'form-control'])], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'status', 'url' => $this->createUrl('/store/categoryBackend/inline'), 'source' => $model->getStatusList(), 'options' => [StoreCategory::STATUS_PUBLISHED => ['class' => 'label-success'], StoreCategory::STATUS_DRAFT => ['class' => 'label-default']]], ['header' => Yii::t('StoreModule.store', 'Products'), 'value' => function ($data) { return CHtml::link($data->productCount, ['/store/productBackend/index', "Product[category_id]" => $data->id], ['class' => 'badge']); }, 'type' => 'raw'], ['class' => 'yupe\\widgets\\CustomButtonColumn', 'buttons' => ['front_view' => ['visible' => function ($row, $data) { return $data->status == StoreCategory::STATUS_PUBLISHED; }]]]]]);