public function actionStageDelete($id)
 {
     if (Yii::$app->request->isPost === false) {
         throw new yii\web\BadRequestHttpException();
     }
     if ($id === null) {
         throw new yii\web\BadRequestHttpException();
     }
     /** @var OrderStage $model */
     $model = $this->loadModel(OrderStage::className(), $id);
     $model->delete();
     Yii::$app->session->setFlash('info', Yii::t('app', 'Stage successfully deleted. Check your stages and leafs for correct workflow!'));
     return $this->redirect('stage-index');
 }
 /**
  * Lists all Order models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModelConfig = ['defaultOrder' => ['id' => SORT_DESC], 'model' => Order::className(), 'relations' => ['user' => ['username']], 'partialMatchAttributes' => ['start_date', 'end_date', 'user_username'], 'additionalConditions' => []];
     if (intval($this->module->showDeletedOrders) === 0) {
         $searchModelConfig['additionalConditions'] = [['is_deleted' => 0]];
     }
     /** @var SearchModel $searchModel */
     $searchModel = new SearchModel($searchModelConfig);
     if (intval($this->module->defaultOrderStageFilterBackend) > 0) {
         $searchModel->order_stage_id = intval($this->module->defaultOrderStageFilterBackend);
     }
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['dataProvider' => $dataProvider, 'managers' => $this->getManagersList(), 'orderStages' => Helper::getModelMap(OrderStage::className(), 'id', 'name_short'), 'paymentTypes' => Helper::getModelMap(PaymentType::className(), 'id', 'name'), 'searchModel' => $searchModel, 'shippingOptions' => Helper::getModelMap(ShippingOption::className(), 'id', 'name')]);
 }
Esempio n. 3
0
echo $model->getAttributeLabel('end_date');
?>
</th>
                <td><?php 
echo $model->end_date;
?>
</td>
            </tr>
            <tr>
                <th><?php 
echo $model->getAttributeLabel('order_stage_id');
?>
</th>
                <td>
                    <?php 
echo $orderIsImmutable ? Html::encode($model->stage->name_short) : Editable::widget(['attribute' => 'order_stage_id', 'data' => \app\components\Helper::getModelMap(\app\modules\shop\models\OrderStage::className(), 'id', 'name_short'), 'displayValue' => $model->stage !== null ? Html::tag('span', $model->stage->name_short) : Html::tag('em', Yii::t('yii', '(not set)')), 'formOptions' => ['action' => ['update-stage', 'id' => $model->id]], 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'model' => $model]);
?>
                </td>
            </tr>
            <tr>
                <th><?php 
echo $model->getAttributeLabel('payment_type_id');
?>
</th>
                <td>
                    <?php 
echo $orderIsImmutable ? null !== $model->paymentType ? Html::encode($model->paymentType->name) : Html::tag('em', Yii::t('yii', '(not set)')) : Editable::widget(['attribute' => 'payment_type_id', 'data' => \app\components\Helper::getModelMap(\app\modules\shop\models\PaymentType::className(), 'id', 'name'), 'displayValue' => $model->paymentType !== null ? Html::tag('span', $model->paymentType->name) : Html::tag('em', Yii::t('yii', '(not set)')), 'formOptions' => ['action' => ['update-payment-type', 'id' => $model->id]], 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'model' => $model]);
?>
                </td>
            </tr>
            <?php 
Esempio n. 4
0
 /**
  * @return OrderStage|null
  */
 public function getStage()
 {
     if (null === $this->orderStage) {
         $this->orderStage = $this->hasOne(OrderStage::className(), ['id' => 'order_stage_id']);
     }
     return $this->orderStage;
 }
Esempio n. 5
0
?>

        <?php 
echo $form->field($model, 'countChildrenProducts')->widget(SwitchInput::className());
?>

        <?php 
echo $form->field($model, 'showDeletedOrders')->widget(SwitchInput::className());
?>

        <?php 
echo $form->field($model, 'defaultMeasureId')->dropDownList(Helper::getModelMap(\app\modules\shop\models\Measure::className(), 'id', 'name'));
?>

        <?php 
echo $form->field($model, 'defaultOrderStageFilterBackend')->dropDownList([0 => ''] + Helper::getModelMap(\app\modules\shop\models\OrderStage::className(), 'id', 'name_short'));
?>

        <?php 
BackendWidget::end();
?>
    </div>
    <?php 
/**
 * @var bool Allow to add same product in the order
 */
$allowToAddSameProduct = 0;
/**
 * @var bool Count only unique products in the order
 */
$countUniqueProductsOnly = 1;
Esempio n. 6
0
 /**
  * @return OrderStage|null
  */
 public function getStageTo()
 {
     return $this->hasOne(OrderStage::className(), ['id' => 'stage_to_id']);
 }
Esempio n. 7
0
echo Html::a('', '#', ['name' => 'orders']);
$searchModelConfig = ['defaultOrder' => ['id' => SORT_DESC], 'model' => \app\modules\shop\models\Order::className(), 'partialMatchAttributes' => ['start_date', 'end_date', 'user_username'], 'additionalConditions' => [['customer_id' => $model->id]]];
/** @var \app\components\SearchModel $searchModel */
$searchModel = new \app\components\SearchModel($searchModelConfig);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
echo \kartik\dynagrid\DynaGrid::widget(['options' => ['id' => 'orders-grid'], 'theme' => 'panel-default', 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'hover' => true, 'panel' => ['heading' => Html::tag('h3', 'Customer orders', ['class' => 'panel-title'])], 'rowOptions' => function ($model, $key, $index, $grid) {
    if ($model->is_deleted) {
        return ['class' => 'danger'];
    }
    return [];
}], 'columns' => [['attribute' => 'id'], ['attribute' => 'user_username', 'label' => Yii::t('app', 'User'), 'value' => function ($model, $key, $index, $column) {
    if ($model === null || $model->user === null) {
        return null;
    }
    return $model->user->username;
}], 'start_date', 'end_date', ['attribute' => 'order_stage_id', 'filter' => Helper::getModelMap(\app\modules\shop\models\OrderStage::className(), 'id', 'name_short'), 'value' => function ($model, $key, $index, $column) {
    if ($model === null || $model->stage === null) {
        return null;
    }
    return $model->stage->name_short;
}], ['attribute' => 'shipping_option_id', 'filter' => Helper::getModelMap(\app\modules\shop\models\ShippingOption::className(), 'id', 'name'), 'value' => function ($model, $key, $index, $column) {
    if ($model === null || $model->shippingOption === null) {
        return null;
    }
    return $model->shippingOption->name;
}], ['attribute' => 'payment_type_id', 'filter' => Helper::getModelMap(\app\modules\shop\models\PaymentType::className(), 'id', 'name'), 'value' => function ($model, $key, $index, $column) {
    if ($model === null || $model->paymentType === null) {
        return null;
    }
    return $model->paymentType->name;
}], 'items_count', 'total_price', ['class' => 'app\\backend\\components\\ActionColumn', 'buttons' => function ($model, $key, $index, $parent) {