Example #1
0
 /** @return \cubiclab\store\StoreCube|null Module instance */
 public function getModule()
 {
     if ($this->_module === null) {
         $module = StoreCube::getInstance();
         if ($module instanceof StoreCube) {
             $this->_module = $module;
         } else {
             $this->_module = Yii::$app->getModule('store');
         }
     }
     return $this->_module;
 }
Example #2
0
    <?php 
echo $form->field($model, 'description');
?>

    <?php 
echo $form->field($model, 'icon');
?>

    <?php 
// echo $form->field($model, 'status')
?>

    <?php 
// echo $form->field($model, 'order')
?>

    <div class="form-group">
        <?php 
echo Html::submitButton(StoreCube::t('admincube', 'BUTTON_SEARCH'), ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::resetButton(StoreCube::t('admincube', 'BUTTON_RESET'), ['class' => 'btn btn-default']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Example #3
0
}
if (Yii::$app->user->can('ACPPriceTypesView')) {
    $actions[] = '{view}';
}
$gridActionsColumn = ['class' => ActionColumn::className(), 'template' => implode(' ', $actions)];
$panelButtons = !empty($panelButtons) ? implode(' ', $panelButtons) : null;
?>

<?php 
Panel::begin(['title' => $this->title, 'buttonsTemplate' => $panelButtons, 'grid' => $gridId]);
?>

<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], 'name', 'currency_code', 'currency_symbol', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    switch ($model->status) {
        case $model::STATUS_INACTIVE:
            $class = 'label-danger';
            break;
        case $model::STATUS_ACTIVE:
            $class = 'label-success';
            break;
        case $model::STATUS_DEFAULT_PRICE:
            $class = 'label-primary';
            break;
        default:
            $class = 'label-default';
            break;
    }
    return '<span class="label ' . $class . '">' . $model->statusName . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', $statusArray, ['class' => 'form-control', 'prompt' => StoreCube::t('storecube', 'STATUS_PROMT')])], $gridActionsColumn]]);
Panel::end();
Example #4
0
<?php

use yii\helpers\Html;
use cubiclab\store\StoreCube;
use cubiclab\admin\widgets\Panel;
$this->title = StoreCube::t('storecube', 'PAGE_CREATE_PRICE_TYPES');
$this->params['breadcrumbs'][] = ['label' => StoreCube::t('storecube', 'PAGE_PRICE_TYPES'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
Panel::begin(['title' => $this->title]);
echo $this->render('_form', ['model' => $model, 'currencyCodeArray' => $currencyCodeArray, 'currencySymbolArray' => $currencySymbolArray, 'statusArray' => $statusArray]);
Panel::end();
Example #5
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => StoreCube::t('storecube', 'ATTR_ID'), 'product_id' => StoreCube::t('storecube', 'ATTR_PRODUCT_ID'), 'image_url' => StoreCube::t('storecube', 'ATTR_IMAGE_URL')];
 }
Example #6
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => StoreCube::t('storecube', 'ATTR_ID'), 'type' => StoreCube::t('storecube', 'ATTR_DAP_TYPE'), 'name' => StoreCube::t('storecube', 'ATTR_NAME'), 'description' => StoreCube::t('storecube', 'ATTR_DESCRIPTION'), 'price' => StoreCube::t('storecube', 'ATTR_PRICE'), 'discount' => StoreCube::t('storecube', 'ATTR_DISCOUNT'), 'icon' => StoreCube::t('storecube', 'ATTR_ICON'), 'status' => StoreCube::t('storecube', 'ATTR_STATUS'), 'order' => StoreCube::t('storecube', 'ATTR_ORDER')];
 }
Example #7
0
 /** @return array Status array. */
 public static function getStatusArray()
 {
     return [self::STATUS_BLANK => StoreCube::t('storecube', 'STATUS_BLANK'), self::STATUS_PENDING => StoreCube::t('storecube', 'STATUS_PENDING'), self::STATUS_PROCESSED => StoreCube::t('storecube', 'STATUS_PROCESSED'), self::STATUS_DECLINED => StoreCube::t('storecube', 'STATUS_DECLINED'), self::STATUS_SENDED => StoreCube::t('storecube', 'STATUS_SENDED'), self::STATUS_RETURNED => StoreCube::t('storecube', 'STATUS_RETURNED'), self::STATUS_ERROR => StoreCube::t('storecube', 'STATUS_ERROR'), self::STATUS_COMPLETED => StoreCube::t('storecube', 'STATUS_COMPLETED')];
 }
Example #8
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => StoreCube::t('storecube', 'ATTR_ID'), 'name' => StoreCube::t('storecube', 'ATTR_NAME'), 'description' => StoreCube::t('storecube', 'ATTR_DESCRIPTION'), 'units' => StoreCube::t('storecube', 'ATTR_UNITS'), 'digit' => StoreCube::t('storecube', 'ATTR_DIGIT'), 'is_range' => StoreCube::t('storecube', 'ATTR_IS_RANGE'), 'icon' => StoreCube::t('storecube', 'ATTR_ICON'), 'status' => StoreCube::t('storecube', 'ATTR_STATUS'), 'order' => StoreCube::t('storecube', 'ATTR_ORDER')];
 }
Example #9
0
 public function validateStatus($attribute, $params)
 {
     if ($this->{$attribute} != self::STATUS_DEFAULT_PRICE && $this->{$attribute} != self::STATUS_ON_RBAC) {
         return;
     }
     $query = PriceTypes::find();
     if ($this->{$attribute} == self::STATUS_DEFAULT_PRICE) {
         $query->andWhere(['status' => self::STATUS_DEFAULT_PRICE]);
         $message = StoreCube::t('storecube', 'VALIDATE_DEFAULT_PRICE');
     }
     // in next version
     /*elseif($this->$attribute == self::STATUS_ON_RBAC) {
           $query->andWhere(['status' => self::STATUS_ON_RBAC]);
           //add data string conversions
           $message = StoreCube::t('storecube', 'VALIDATE_ON_RBAC');
       }*/
     if ($this->getIsNewRecord()) {
         $exists = $query->exists();
     } else {
         // if current $model is in the database already we can't use exists()
         $models = $query->limit(2)->all();
         $n = count($models);
         if ($n === 1) {
             $exists = $this->getOldPrimaryKey() != $this->getPrimaryKey();
         } else {
             $exists = $n > 1;
         }
     }
     if ($exists) {
         $this->addError($attribute, $message);
     }
 }
Example #10
0
<?php

use yii\helpers\Html;
use cubiclab\store\StoreCube;
use cubiclab\admin\widgets\Panel;
$this->title = StoreCube::t('storecube', 'PAGE_UPDATE_DAP') . ': ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => StoreCube::t('storecube', 'PAGE_DAP'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = StoreCube::t('admincube', 'BUTTON_UPDATE');
Panel::begin(['title' => $this->title]);
echo $this->render('_form', ['model' => $model]);
Panel::end();
Example #11
0
 /** @return array Status array. */
 public static function getStatusArray()
 {
     return [self::STATUS_INACTIVE => StoreCube::t('storecube', 'STATUS_INACTIVE'), self::STATUS_ACTIVE => StoreCube::t('storecube', 'STATUS_ACTIVE')];
 }
Example #12
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\grid\ActionColumn;
use cubiclab\store\StoreCube;
use cubiclab\admin\widgets\Panel;
$this->title = StoreCube::t('storecube', 'PAGE_PARAMETERS');
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
$gridId = 'parameters-grid';
$panelButtons = $actions = [];
if (Yii::$app->user->can('ACPParametersCreate')) {
    $panelButtons[] = '{create}';
}
if (Yii::$app->user->can('ACPParametersUpdate')) {
    $actions[] = '{update}';
}
if (Yii::$app->user->can('ACPParametersDelete')) {
    $panelButtons[] = '{mass-delete}';
    $actions[] = '{delete}';
}
if (Yii::$app->user->can('ACPParametersView')) {
    $actions[] = '{view}';
}
$gridActionsColumn = ['class' => ActionColumn::className(), 'template' => implode(' ', $actions)];
$panelButtons = !empty($panelButtons) ? implode(' ', $panelButtons) : null;
?>
Example #13
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['product_id' => StoreCube::t('storecube', 'ATTR_PRODUCT_ID'), 'price_type_id' => StoreCube::t('storecube', 'ATTR_PRICE TYPE_ID'), 'price' => StoreCube::t('storecube', 'ATTR_PRICE')];
 }
Example #14
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['order_id' => StoreCube::t('storecube', 'ATTR_ORDER_ID'), 'product_id' => StoreCube::t('storecube', 'ATTR_PRODUCT_ID'), 'quantity' => StoreCube::t('storecube', 'ATTR_QUANTITY'), 'options' => StoreCube::t('storecube', 'ATTR_OPTIONS'), 'price' => StoreCube::t('storecube', 'ATTR_PRICE'), 'discount' => StoreCube::t('storecube', 'ATTR_DISCOUNT')];
 }
Example #15
0
<?php

use yii\widgets\DetailView;
use cubiclab\store\StoreCube;
use cubiclab\admin\widgets\Panel;
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => StoreCube::t('storecube', 'PAGE_CATEGORIES'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$panelButtons = [];
if (Yii::$app->user->can('ACPCategoriesUpdate')) {
    $panelButtons[] = '{update}';
}
if (Yii::$app->user->can('ACPCategoriesDelete')) {
    $panelButtons[] = '{delete}';
}
$panelButtons = !empty($panelButtons) ? implode(' ', $panelButtons) : null;
Panel::begin(['title' => StoreCube::t('storecube', 'PAGE_CATEGORIES') . ': ' . $this->title, 'buttonsTemplate' => $panelButtons]);
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'parent', 'name', 'slug', 'description:ntext', 'icon', 'status', 'order']]);
Panel::end();
Example #16
0
 public static function t($category, $message, $params = [], $language = null)
 {
     StoreCube::registerTranslations();
     return Yii::t($category, $message, $params, $language);
 }
Example #17
0
echo $form->field($model, 'digit')->textInput();
?>

    <?php 
echo $form->field($model, 'is_range')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'icon')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'status')->textInput();
?>

    <?php 
echo $form->field($model, 'order')->textInput();
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? StoreCube::t('admincube', 'BUTTON_CREATE') : StoreCube::t('admincube', 'BUTTON_UPDATE'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Example #18
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\grid\ActionColumn;
use cubiclab\store\StoreCube;
use cubiclab\admin\widgets\Panel;
$this->title = StoreCube::t('storecube', 'PAGE_DAP');
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
$gridId = 'dap-grid';
$panelButtons = $actions = [];
if (Yii::$app->user->can('ACPDAPCreate')) {
    $panelButtons[] = '{create}';
}
if (Yii::$app->user->can('ACPDAPUpdate')) {
    $actions[] = '{update}';
}
if (Yii::$app->user->can('ACPDAPDelete')) {
    $panelButtons[] = '{mass-delete}';
    $actions[] = '{delete}';
}
if (Yii::$app->user->can('ACPDAPView')) {
    $actions[] = '{view}';
}
$gridActionsColumn = ['class' => ActionColumn::className(), 'template' => implode(' ', $actions)];
$panelButtons = !empty($panelButtons) ? implode(' ', $panelButtons) : null;
?>