Commit 031b4e2bb9891a9e90a6c93665743257700f0fa0
1 parent
77d77c34
filter
Showing
10 changed files
with
730 additions
and
22 deletions
Show diff stats
| 1 | +<?php | |
| 2 | + | |
| 3 | + namespace artbox\stock\controllers; | |
| 4 | + | |
| 5 | + use artbox\stock\models\Shop; | |
| 6 | + use Yii; | |
| 7 | + use artbox\stock\models\VariantToShop; | |
| 8 | + use yii\data\ActiveDataProvider; | |
| 9 | + use yii\web\Controller; | |
| 10 | + use yii\web\NotFoundHttpException; | |
| 11 | + use yii\filters\VerbFilter; | |
| 12 | + use artbox\catalog\models\Variant; | |
| 13 | + use yii\web\Response; | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * VariantCountController implements the CRUD actions for VariantToShop model. | |
| 17 | + */ | |
| 18 | + class VariantCountController extends Controller | |
| 19 | + { | |
| 20 | + /** | |
| 21 | + * @inheritdoc | |
| 22 | + */ | |
| 23 | + public function getViewPath() | |
| 24 | + { | |
| 25 | + return '@artbox/stock/views/variant-count'; | |
| 26 | + } | |
| 27 | + public function behaviors() | |
| 28 | + { | |
| 29 | + return [ | |
| 30 | + 'verbs' => [ | |
| 31 | + 'class' => VerbFilter::className(), | |
| 32 | + 'actions' => [ | |
| 33 | + 'delete' => [ 'POST' ], | |
| 34 | + ], | |
| 35 | + ], | |
| 36 | + ]; | |
| 37 | + } | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * Lists all VariantToShop models. | |
| 41 | + * @param int|null $shop_id | |
| 42 | + * @return mixed | |
| 43 | + */ | |
| 44 | + public function actionIndex($shop_id) | |
| 45 | + { | |
| 46 | + $dataProvider = new ActiveDataProvider( | |
| 47 | + [ | |
| 48 | + 'query' => VariantToShop::find() | |
| 49 | + ->with( | |
| 50 | + [ | |
| 51 | + 'variant', | |
| 52 | + 'variant.lang', | |
| 53 | + 'shop', | |
| 54 | + 'shop.lang', | |
| 55 | + ] | |
| 56 | + ) | |
| 57 | + ->where([ 'shop_id' => $shop_id ]), | |
| 58 | + ] | |
| 59 | + ); | |
| 60 | + | |
| 61 | + return $this->render( | |
| 62 | + 'index', | |
| 63 | + [ | |
| 64 | + 'dataProvider' => $dataProvider, | |
| 65 | + 'shop_id' => $shop_id, | |
| 66 | + ] | |
| 67 | + ); | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * Displays a single VariantToShop model. | |
| 72 | + * | |
| 73 | + * @param integer $variant_id | |
| 74 | + * @param integer $shop_id | |
| 75 | + * | |
| 76 | + * @return mixed | |
| 77 | + */ | |
| 78 | + public function actionView($variant_id, $shop_id) | |
| 79 | + { | |
| 80 | + return $this->render( | |
| 81 | + 'view', | |
| 82 | + [ | |
| 83 | + 'model' => $this->findModel($variant_id, $shop_id), | |
| 84 | + ] | |
| 85 | + ); | |
| 86 | + } | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * Creates a new VariantToShop model. | |
| 90 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 91 | + * @param int|null $shop_id | |
| 92 | + * @return mixed | |
| 93 | + */ | |
| 94 | + public function actionCreate($shop_id) | |
| 95 | + { | |
| 96 | + $model = new VariantToShop(); | |
| 97 | + $shop = Shop::find() | |
| 98 | + ->with([ 'lang' ]) | |
| 99 | + ->where([ 'id' => $shop_id ]) | |
| 100 | + ->one(); | |
| 101 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 102 | + return $this->redirect( | |
| 103 | + [ | |
| 104 | + 'view', | |
| 105 | + 'variant_id' => $model->variant_id, | |
| 106 | + 'shop_id' => $model->shop_id, | |
| 107 | + ] | |
| 108 | + ); | |
| 109 | + } else { | |
| 110 | + return $this->render( | |
| 111 | + 'create', | |
| 112 | + [ | |
| 113 | + 'model' => $model, | |
| 114 | + 'shop' => $shop, | |
| 115 | + ] | |
| 116 | + ); | |
| 117 | + } | |
| 118 | + } | |
| 119 | + | |
| 120 | + /** | |
| 121 | + * Updates an existing VariantToShop model. | |
| 122 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 123 | + * | |
| 124 | + * @param integer $variant_id | |
| 125 | + * @param integer $shop_id | |
| 126 | + * | |
| 127 | + * @return mixed | |
| 128 | + */ | |
| 129 | + public function actionUpdate($variant_id, $shop_id) | |
| 130 | + { | |
| 131 | + $model = $this->findModel($variant_id, $shop_id); | |
| 132 | + $shop = Shop::find() | |
| 133 | + ->with([ 'lang' ]) | |
| 134 | + ->where([ 'id' => $shop_id ]) | |
| 135 | + ->one(); | |
| 136 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 137 | + return $this->redirect( | |
| 138 | + [ | |
| 139 | + 'view', | |
| 140 | + 'variant_id' => $model->variant_id, | |
| 141 | + 'shop_id' => $model->shop_id, | |
| 142 | + ] | |
| 143 | + ); | |
| 144 | + } else { | |
| 145 | + return $this->render( | |
| 146 | + 'update', | |
| 147 | + [ | |
| 148 | + 'model' => $model, | |
| 149 | + 'shop' => $shop, | |
| 150 | + ] | |
| 151 | + ); | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * Deletes an existing VariantToShop model. | |
| 157 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 158 | + * | |
| 159 | + * @param integer $variant_id | |
| 160 | + * @param integer $shop_id | |
| 161 | + * | |
| 162 | + * @return mixed | |
| 163 | + */ | |
| 164 | + public function actionDelete($variant_id, $shop_id) | |
| 165 | + { | |
| 166 | + $this->findModel($variant_id, $shop_id) | |
| 167 | + ->delete(); | |
| 168 | + | |
| 169 | + return $this->redirect([ 'index' ]); | |
| 170 | + } | |
| 171 | + | |
| 172 | + /** | |
| 173 | + * Finds the VariantToShop model based on its primary key value. | |
| 174 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 175 | + * | |
| 176 | + * @param integer $variant_id | |
| 177 | + * @param integer $shop_id | |
| 178 | + * | |
| 179 | + * @return VariantToShop the loaded model | |
| 180 | + * @throws NotFoundHttpException if the model cannot be found | |
| 181 | + */ | |
| 182 | + protected function findModel($variant_id, $shop_id) | |
| 183 | + { | |
| 184 | + if (( $model = VariantToShop::findOne( | |
| 185 | + [ | |
| 186 | + 'variant_id' => $variant_id, | |
| 187 | + 'shop_id' => $shop_id, | |
| 188 | + ] | |
| 189 | + ) ) !== null | |
| 190 | + ) { | |
| 191 | + return $model; | |
| 192 | + } else { | |
| 193 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 194 | + } | |
| 195 | + } | |
| 196 | + | |
| 197 | + /** | |
| 198 | + * @param string $q | |
| 199 | + * @param int|null $shop_id | |
| 200 | + * | |
| 201 | + * @return array | |
| 202 | + */ | |
| 203 | + | |
| 204 | + public function actionList(string $q = null, $shop_id) | |
| 205 | + { | |
| 206 | + \Yii::$app->response->format = Response::FORMAT_JSON; | |
| 207 | + $out = [ | |
| 208 | + 'results' => [ | |
| 209 | + 'id' => '', | |
| 210 | + 'text' => '', | |
| 211 | + ], | |
| 212 | + ]; | |
| 213 | + if (!is_null($q)) { | |
| 214 | + $not = VariantToShop::find() | |
| 215 | + ->select('variant_id') | |
| 216 | + ->where([ 'shop_id' => $shop_id ]); | |
| 217 | + $out[ 'results' ] = Variant::find() | |
| 218 | + ->select( | |
| 219 | + [ | |
| 220 | + 'variant.id as id', | |
| 221 | + 'variant.sku as text', | |
| 222 | + ] | |
| 223 | + ) | |
| 224 | + ->where( | |
| 225 | + [ | |
| 226 | + 'like', | |
| 227 | + 'variant.sku', | |
| 228 | + $q, | |
| 229 | + ] | |
| 230 | + ) | |
| 231 | + ->where( | |
| 232 | + [ | |
| 233 | + 'NOT IN', | |
| 234 | + 'variant.id', | |
| 235 | + $not, | |
| 236 | + ] | |
| 237 | + ) | |
| 238 | + ->limit(20) | |
| 239 | + ->asArray() | |
| 240 | + ->all(); | |
| 241 | + } | |
| 242 | + return $out; | |
| 243 | + } | |
| 244 | + } | ... | ... |
messages/ru/stock.php
| 1 | 1 | <?php |
| 2 | 2 | return [ |
| 3 | - 'Cities' => 'Города', | |
| 4 | - 'Shops' => 'Магазины/склады', | |
| 5 | - 'Title' => 'Название', | |
| 6 | - 'Sort' => 'Сортировка', | |
| 7 | - 'Status' => 'Статус', | |
| 8 | - 'Description' => 'Описание', | |
| 9 | - 'Create City' => 'Добавить город', | |
| 10 | - 'Alias' => 'Алиас', | |
| 11 | - 'Update' => 'Обновить', | |
| 12 | - 'Address' => 'Адрес', | |
| 13 | - 'Create Shop' => 'Добавить магазин', | |
| 14 | - 'Mode' => "Расписание работы", | |
| 15 | - 'Delete' => 'Удалить', | |
| 16 | - 'Create' => "Добавить", | |
| 17 | - 'Mon' => 'Пн', | |
| 18 | - 'Tue' => 'Вт', | |
| 19 | - 'Wed' => 'Ср', | |
| 20 | - 'Thu' => 'Чт', | |
| 21 | - 'Fri' => 'Пт', | |
| 22 | - 'Sat' => 'Сб', | |
| 23 | - 'Sun' => 'Вс', | |
| 3 | + 'Cities' => 'Города', | |
| 4 | + 'Shops' => 'Магазины/склады', | |
| 5 | + 'Title' => 'Название', | |
| 6 | + 'Sort' => 'Сортировка', | |
| 7 | + 'Status' => 'Статус', | |
| 8 | + 'Description' => 'Описание', | |
| 9 | + 'Create City' => 'Добавить город', | |
| 10 | + 'Alias' => 'Алиас', | |
| 11 | + 'Update' => 'Обновить', | |
| 12 | + 'Address' => 'Адрес', | |
| 13 | + 'Create Shop' => 'Добавить магазин', | |
| 14 | + 'Mode' => "Расписание работы", | |
| 15 | + 'Delete' => 'Удалить', | |
| 16 | + 'Create' => "Добавить", | |
| 17 | + 'Mon' => 'Пн', | |
| 18 | + 'Tue' => 'Вт', | |
| 19 | + 'Wed' => 'Ср', | |
| 20 | + 'Thu' => 'Чт', | |
| 21 | + 'Fri' => 'Пт', | |
| 22 | + 'Sat' => 'Сб', | |
| 23 | + 'Sun' => 'Вс', | |
| 24 | + 'Import' => 'Импорт', | |
| 25 | + 'Variant Count' => 'Количество товаров', | |
| 26 | + 'Sku' => 'Код товара', | |
| 27 | + 'Count' => 'Количество', | |
| 28 | + 'Add Product' => 'Добавить товар', | |
| 29 | + 'Update Count' => 'Обновить количество', | |
| 24 | 30 | ] |
| 25 | 31 | ?> |
| 26 | 32 | \ No newline at end of file | ... | ... |
migrations/m170727_081025_create_variant_to_shop_table.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\db\Migration; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Handles the creation of table `variant_to_shop`. | |
| 7 | + */ | |
| 8 | +class m170727_081025_create_variant_to_shop_table extends Migration | |
| 9 | +{ | |
| 10 | + /** | |
| 11 | + * @inheritdoc | |
| 12 | + */ | |
| 13 | + public function up() | |
| 14 | + { | |
| 15 | + $this->createTable('variant_to_shop', [ | |
| 16 | + 'variant_id' => $this->integer() | |
| 17 | + ->notNull(), | |
| 18 | + 'shop_id' => $this->integer() | |
| 19 | + ->notNull(), | |
| 20 | + 'count' => $this->integer()->defaultValue(0), | |
| 21 | + ]); | |
| 22 | + | |
| 23 | + | |
| 24 | + $this->addPrimaryKey( | |
| 25 | + 'variant_to_shop_pk', | |
| 26 | + 'variant_to_shop', | |
| 27 | + [ | |
| 28 | + 'variant_id', | |
| 29 | + 'shop_id', | |
| 30 | + ] | |
| 31 | + ); | |
| 32 | + | |
| 33 | + $this->addForeignKey( | |
| 34 | + 'variant_to_shop_variant_id_to_variant_fk', | |
| 35 | + 'variant_to_shop', | |
| 36 | + 'variant_id', | |
| 37 | + 'variant', | |
| 38 | + 'id', | |
| 39 | + 'CASCADE', | |
| 40 | + 'CASCADE' | |
| 41 | + ); | |
| 42 | + | |
| 43 | + $this->addForeignKey( | |
| 44 | + 'variant_to_shop_shop_id_to_shop_fk', | |
| 45 | + 'variant_to_shop', | |
| 46 | + 'shop_id', | |
| 47 | + 'shop', | |
| 48 | + 'id', | |
| 49 | + 'CASCADE', | |
| 50 | + 'CASCADE' | |
| 51 | + ); | |
| 52 | + } | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * @inheritdoc | |
| 56 | + */ | |
| 57 | + public function down() | |
| 58 | + { | |
| 59 | + $this->dropForeignKey( | |
| 60 | + 'variant_to_shop_variant_id_to_variant_fk', | |
| 61 | + 'variant_to_shop' | |
| 62 | + ); | |
| 63 | + $this->dropForeignKey( | |
| 64 | + 'variant_to_shop_shop_id_to_shop_fk', | |
| 65 | + 'variant_to_shop' | |
| 66 | + ); | |
| 67 | + $this->dropTable('variant_to_shop'); | |
| 68 | + | |
| 69 | + } | |
| 70 | +} | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | + namespace artbox\stock\models; | |
| 4 | + | |
| 5 | + use yii\db\ActiveRecord; | |
| 6 | + use artbox\catalog\models\Variant; | |
| 7 | + | |
| 8 | + /** | |
| 9 | + * This is the model class for table "variant_to_shop". | |
| 10 | + * | |
| 11 | + * @property integer $variant_id | |
| 12 | + * @property integer $shop_id | |
| 13 | + * @property integer $count | |
| 14 | + * @property Shop $shop | |
| 15 | + * @property Variant $variant | |
| 16 | + */ | |
| 17 | + class VariantToShop extends ActiveRecord | |
| 18 | + { | |
| 19 | + /** | |
| 20 | + * @inheritdoc | |
| 21 | + */ | |
| 22 | + public static function tableName() | |
| 23 | + { | |
| 24 | + return 'variant_to_shop'; | |
| 25 | + } | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * @inheritdoc | |
| 29 | + */ | |
| 30 | + public function rules() | |
| 31 | + { | |
| 32 | + return [ | |
| 33 | + [ | |
| 34 | + [ | |
| 35 | + 'variant_id', | |
| 36 | + 'shop_id', | |
| 37 | + ], | |
| 38 | + 'required', | |
| 39 | + ], | |
| 40 | + [ | |
| 41 | + [ | |
| 42 | + 'variant_id', | |
| 43 | + 'shop_id', | |
| 44 | + 'count', | |
| 45 | + ], | |
| 46 | + 'integer', | |
| 47 | + ], | |
| 48 | + [ | |
| 49 | + [ 'shop_id' ], | |
| 50 | + 'exist', | |
| 51 | + 'skipOnError' => true, | |
| 52 | + 'targetClass' => Shop::className(), | |
| 53 | + 'targetAttribute' => [ 'shop_id' => 'id' ], | |
| 54 | + ], | |
| 55 | + [ | |
| 56 | + [ 'variant_id' ], | |
| 57 | + 'exist', | |
| 58 | + 'skipOnError' => true, | |
| 59 | + 'targetClass' => Variant::className(), | |
| 60 | + 'targetAttribute' => [ 'variant_id' => 'id' ], | |
| 61 | + ], | |
| 62 | + ]; | |
| 63 | + } | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * @inheritdoc | |
| 67 | + */ | |
| 68 | + public function attributeLabels() | |
| 69 | + { | |
| 70 | + return [ | |
| 71 | + 'variant_id' => 'Variant ID', | |
| 72 | + 'shop_id' => 'Shop ID', | |
| 73 | + 'count' => \Yii::t('stock', 'Count'), | |
| 74 | + ]; | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * @return \yii\db\ActiveQuery | |
| 79 | + */ | |
| 80 | + public function getShop() | |
| 81 | + { | |
| 82 | + return $this->hasOne(Shop::className(), [ 'id' => 'shop_id' ]); | |
| 83 | + } | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * @return \yii\db\ActiveQuery | |
| 87 | + */ | |
| 88 | + public function getVariant() | |
| 89 | + { | |
| 90 | + return $this->hasOne(Variant::className(), [ 'id' => 'variant_id' ]); | |
| 91 | + } | |
| 92 | + | |
| 93 | + } | ... | ... |
views/shop/index.php
| ... | ... | @@ -3,6 +3,8 @@ |
| 3 | 3 | use yii\helpers\Html; |
| 4 | 4 | use yii\grid\GridView; |
| 5 | 5 | use yiister\gentelella\widgets\Panel; |
| 6 | + use yii\helpers\Url; | |
| 7 | + | |
| 6 | 8 | |
| 7 | 9 | /* @var $this yii\web\View */ |
| 8 | 10 | /* @var $dataProvider yii\data\ActiveDataProvider */ |
| ... | ... | @@ -37,7 +39,18 @@ |
| 37 | 39 | 'sort', |
| 38 | 40 | 'status:boolean', |
| 39 | 41 | |
| 40 | - [ 'class' => 'yii\grid\ActionColumn' ], | |
| 42 | + [ 'class' => 'yii\grid\ActionColumn', | |
| 43 | + 'template' => '{view} {update} {delete}{link}', | |
| 44 | + 'buttons' => [ | |
| 45 | + 'link' => function ($url,$model,$key) { | |
| 46 | + return Html::a('Товары', Url::to([ | |
| 47 | + '/variant-count/index', | |
| 48 | + 'shop_id' => $model->id | |
| 49 | + ])); | |
| 50 | + }, | |
| 51 | + 'icon' => 'gift', | |
| 52 | + ], | |
| 53 | + ], | |
| 41 | 54 | ], |
| 42 | 55 | ] |
| 43 | 56 | ); ?> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | + use yii\helpers\Html; | |
| 4 | + use yii\widgets\ActiveForm; | |
| 5 | + use kartik\select2\Select2; | |
| 6 | + use yii\helpers\Url; | |
| 7 | + use yii\web\JsExpression; | |
| 8 | + | |
| 9 | + /* @var $this yii\web\View */ | |
| 10 | + /* @var $model artbox\stock\models\VariantToShop */ | |
| 11 | + /* @var $form yii\widgets\ActiveForm */ | |
| 12 | + /* @var $shop artbox\stock\models\Shop */ | |
| 13 | +?> | |
| 14 | + | |
| 15 | +<div class="variant-to-shop-form"> | |
| 16 | + | |
| 17 | + <?php $form = ActiveForm::begin(); ?> | |
| 18 | + | |
| 19 | + <?= Select2::widget( | |
| 20 | + [ | |
| 21 | + 'name' => 'VariantToShop[variant_id]', | |
| 22 | + 'value' => ( isset($model->variant->id) ) ? array_keys([ $model->variant->id ]) : [], | |
| 23 | + 'data' => ( isset($model->variant->sku) ) ? [ $model->variant->sku ] : [], | |
| 24 | + 'options' => [ | |
| 25 | + 'placeholder' => 'Выберите товар по коду ...', | |
| 26 | + 'multiple' => false, | |
| 27 | + 'disabled' => ( isset($model->variant->id) and isset($model->variant->sku) ) ? true : false, | |
| 28 | + ], | |
| 29 | + 'pluginOptions' => [ | |
| 30 | + 'allowClear' => true, | |
| 31 | + 'ajax' => [ | |
| 32 | + 'url' => Url::to([ '/variant-count/list' ]), | |
| 33 | + 'dataType' => 'json', | |
| 34 | + 'data' => new JsExpression( | |
| 35 | + 'function(params) { | |
| 36 | + return { | |
| 37 | + q:params.term,shop_id:' . $shop->id . ' | |
| 38 | + }; | |
| 39 | + }' | |
| 40 | + ), | |
| 41 | + ], | |
| 42 | + 'escapeMarkup' => new JsExpression( | |
| 43 | + 'function (markup) { | |
| 44 | + return markup; | |
| 45 | + }' | |
| 46 | + ), | |
| 47 | + 'templateResult' => new JsExpression( | |
| 48 | + 'function (variant) { | |
| 49 | + return variant.text; | |
| 50 | + }' | |
| 51 | + ), | |
| 52 | + 'templateSelection' => new JsExpression( | |
| 53 | + 'function (variant) { | |
| 54 | + return variant.text; | |
| 55 | + }' | |
| 56 | + ), | |
| 57 | + ], | |
| 58 | + ] | |
| 59 | + ); ?> | |
| 60 | + | |
| 61 | + <?= $form->field($model, 'shop_id') | |
| 62 | + ->hiddenInput( | |
| 63 | + [ | |
| 64 | + 'value' => $shop->id, | |
| 65 | + 'id' => 'shop_id', | |
| 66 | + ] | |
| 67 | + ) | |
| 68 | + ->label(false); ?> | |
| 69 | + | |
| 70 | + <?= $form->field($model, 'count') | |
| 71 | + ->textInput() ?> | |
| 72 | + | |
| 73 | + <div class="form-group"> | |
| 74 | + <?= Html::submitButton( | |
| 75 | + $model->isNewRecord ? \Yii::t('stock', 'Create') : \Yii::t('stock', 'Update'), | |
| 76 | + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] | |
| 77 | + ) ?> | |
| 78 | + </div> | |
| 79 | + | |
| 80 | + <?php ActiveForm::end(); ?> | |
| 81 | + | |
| 82 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | + use yii\helpers\Html; | |
| 4 | + use yiister\gentelella\widgets\Panel; | |
| 5 | + | |
| 6 | + /* @var $this yii\web\View */ | |
| 7 | + /* @var $model artbox\stock\models\VariantToShop */ | |
| 8 | + | |
| 9 | + /* @var $shop \artbox\stock\models\Shop */ | |
| 10 | + $this->title = \Yii::t('stock', 'Add Product') . ': ' . $shop->lang->address; | |
| 11 | + $this->params[ 'breadcrumbs' ][] = [ 'label' => \Yii::t('stock', 'Variant Count'), | |
| 12 | + 'url' => [ | |
| 13 | + 'index', | |
| 14 | + 'shop_id' => $shop->id, | |
| 15 | + ], | |
| 16 | + ]; | |
| 17 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
| 18 | +?> | |
| 19 | +<div class="variant-to-shop-create"> | |
| 20 | + <?php | |
| 21 | + $xPanel = Panel::begin( | |
| 22 | + [ | |
| 23 | + 'header' => \Yii::t('stock', Html::encode($this->title)), | |
| 24 | + ] | |
| 25 | + ); | |
| 26 | + ?> | |
| 27 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 28 | + | |
| 29 | + <?= $this->render( | |
| 30 | + '_form', | |
| 31 | + [ | |
| 32 | + 'model' => $model, | |
| 33 | + 'shop' => $shop, | |
| 34 | + ] | |
| 35 | + ) ?> | |
| 36 | + <?php | |
| 37 | + $xPanel::end(); | |
| 38 | + ?> | |
| 39 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | + use yii\helpers\Html; | |
| 4 | + use yii\grid\GridView; | |
| 5 | + use yiister\gentelella\widgets\Panel; | |
| 6 | + | |
| 7 | + /* @var $this yii\web\View */ | |
| 8 | + /* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 9 | + /* @var $shop_id integer */ | |
| 10 | + | |
| 11 | + $this->title = \Yii::t('stock', 'Variant Count'); | |
| 12 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
| 13 | +?> | |
| 14 | +<div class="variant-to-shop-index"> | |
| 15 | + <?php | |
| 16 | + $xPanel = Panel::begin( | |
| 17 | + [ | |
| 18 | + 'header' => \Yii::t('stock', Html::encode($this->title)), | |
| 19 | + ] | |
| 20 | + ); | |
| 21 | + ?> | |
| 22 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 23 | + | |
| 24 | + <p> | |
| 25 | + <?= Html::a(\Yii::t('stock', 'Create'), | |
| 26 | + [ | |
| 27 | + 'create', | |
| 28 | + 'shop_id' => $shop_id, | |
| 29 | + ], | |
| 30 | + [ 'class' => 'btn btn-success' ] | |
| 31 | + ) ?> | |
| 32 | + </p> | |
| 33 | + <?= GridView::widget( | |
| 34 | + [ | |
| 35 | + 'dataProvider' => $dataProvider, | |
| 36 | + 'columns' => [ | |
| 37 | + [ 'class' => 'yii\grid\SerialColumn' ], | |
| 38 | + [ | |
| 39 | + 'attribute' => \Yii::t('stock', 'Address'), | |
| 40 | + 'value' => 'shop.lang.address', | |
| 41 | + ], | |
| 42 | + [ | |
| 43 | + 'attribute' => \Yii::t('stock', 'Sku'), | |
| 44 | + 'value' => 'variant.sku', | |
| 45 | + ], | |
| 46 | + 'count', | |
| 47 | + | |
| 48 | + [ 'class' => 'yii\grid\ActionColumn' ], | |
| 49 | + ], | |
| 50 | + ] | |
| 51 | + ); ?> | |
| 52 | + <?php | |
| 53 | + $xPanel::end(); | |
| 54 | + ?> | |
| 55 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | + use yii\helpers\Html; | |
| 4 | + | |
| 5 | + /* @var $this yii\web\View */ | |
| 6 | + /* @var $model artbox\stock\models\VariantToShop */ | |
| 7 | + /* @var $shop artbox\stock\models\Shop */ | |
| 8 | + | |
| 9 | + $this->title = \Yii::t('stock', "Update Count") . ': ' . $model->variant->sku; | |
| 10 | + $this->params[ 'breadcrumbs' ][] = [ | |
| 11 | + 'label' => 'Variant To Shops', | |
| 12 | + 'url' => [ 'index' ], | |
| 13 | + ]; | |
| 14 | + $this->params[ 'breadcrumbs' ][] = [ | |
| 15 | + 'label' => $model->variant->sku, | |
| 16 | + 'url' => [ | |
| 17 | + 'view', | |
| 18 | + 'variant_id' => $model->variant_id, | |
| 19 | + 'shop_id' => $model->shop_id, | |
| 20 | + ], | |
| 21 | + ]; | |
| 22 | + $this->params[ 'breadcrumbs' ][] = \Yii::t('stock', 'Update'); | |
| 23 | +?> | |
| 24 | +<div class="variant-to-shop-update"> | |
| 25 | + | |
| 26 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 27 | + | |
| 28 | + <?= $this->render( | |
| 29 | + '_form', | |
| 30 | + [ | |
| 31 | + 'model' => $model, | |
| 32 | + 'shop' => $shop, | |
| 33 | + ] | |
| 34 | + ) ?> | |
| 35 | + | |
| 36 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | + use yii\helpers\Html; | |
| 4 | + use yii\widgets\DetailView; | |
| 5 | + use yiister\gentelella\widgets\Panel; | |
| 6 | + | |
| 7 | + /* @var $this yii\web\View */ | |
| 8 | + /* @var $model artbox\stock\models\VariantToShop */ | |
| 9 | + | |
| 10 | + $this->title = $model->variant->sku; | |
| 11 | + $this->params[ 'breadcrumbs' ][] = [ | |
| 12 | + 'label' => \Yii::t('stock', 'Variant Count'), | |
| 13 | + 'url' => [ | |
| 14 | + 'index', | |
| 15 | + 'shop_id' => $model->shop_id, | |
| 16 | + ], | |
| 17 | + ]; | |
| 18 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
| 19 | +?> | |
| 20 | +<div class="variant-to-shop-view"> | |
| 21 | + <?php | |
| 22 | + $xPanel = Panel::begin( | |
| 23 | + [ | |
| 24 | + 'header' => \Yii::t('stock', Html::encode($this->title)), | |
| 25 | + ] | |
| 26 | + ); | |
| 27 | + ?> | |
| 28 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 29 | + | |
| 30 | + <p> | |
| 31 | + <?= Html::a( | |
| 32 | + \Yii::t('stock', 'Update'), | |
| 33 | + [ | |
| 34 | + 'update', | |
| 35 | + 'variant_id' => $model->variant_id, | |
| 36 | + 'shop_id' => $model->shop_id, | |
| 37 | + ], | |
| 38 | + [ 'class' => 'btn btn-primary' ] | |
| 39 | + ) ?> | |
| 40 | + <?= Html::a( | |
| 41 | + \Yii::t('stock', 'Delete'), | |
| 42 | + [ | |
| 43 | + 'delete', | |
| 44 | + 'variant_id' => $model->variant_id, | |
| 45 | + 'shop_id' => $model->shop_id, | |
| 46 | + ], | |
| 47 | + [ | |
| 48 | + 'class' => 'btn btn-danger', | |
| 49 | + 'data' => [ | |
| 50 | + 'confirm' => 'Are you sure you want to delete this item?', | |
| 51 | + 'method' => 'post', | |
| 52 | + ], | |
| 53 | + ] | |
| 54 | + ) ?> | |
| 55 | + </p> | |
| 56 | + | |
| 57 | + <?= DetailView::widget( | |
| 58 | + [ | |
| 59 | + 'model' => $model, | |
| 60 | + 'attributes' => [ | |
| 61 | + 'variant.sku', | |
| 62 | + 'shop.lang.address', | |
| 63 | + 'count', | |
| 64 | + ], | |
| 65 | + ] | |
| 66 | + ) ?> | |
| 67 | + <?php | |
| 68 | + $xPanel::end(); | |
| 69 | + ?> | |
| 70 | +</div> | ... | ... |