Commit 20cfd47674475e084087fe70b9814d0f51675368
1 parent
670c5a28
-Sizes in process
Showing
8 changed files
with
413 additions
and
186 deletions
Show diff stats
controllers/BrandController.php
| ... | ... | @@ -2,9 +2,11 @@ |
| 2 | 2 | |
| 3 | 3 | namespace artweb\artbox\ecommerce\controllers; |
| 4 | 4 | |
| 5 | + use artweb\artbox\ecommerce\models\BrandSize; | |
| 5 | 6 | use Yii; |
| 6 | 7 | use artweb\artbox\ecommerce\models\Brand; |
| 7 | 8 | use artweb\artbox\ecommerce\models\BrandSearch; |
| 9 | + use yii\data\ActiveDataProvider; | |
| 8 | 10 | use yii\web\Controller; |
| 9 | 11 | use yii\web\NotFoundHttpException; |
| 10 | 12 | use yii\filters\VerbFilter; |
| ... | ... | @@ -172,11 +174,35 @@ |
| 172 | 174 | return $this->redirect([ 'index' ]); |
| 173 | 175 | } |
| 174 | 176 | |
| 177 | + public function actionSize($id) | |
| 178 | + { | |
| 179 | + $model = $this->findModel($id); | |
| 180 | + | |
| 181 | + $dataProvider = new ActiveDataProvider( | |
| 182 | + [ | |
| 183 | + 'query' => BrandSize::find() | |
| 184 | + ->where( | |
| 185 | + [ | |
| 186 | + 'brand_id' => $id, | |
| 187 | + ] | |
| 188 | + ), | |
| 189 | + ] | |
| 190 | + ); | |
| 191 | + | |
| 192 | + return $this->render( | |
| 193 | + 'size', | |
| 194 | + [ | |
| 195 | + 'model' => $model, | |
| 196 | + 'dataProvider' => $dataProvider, | |
| 197 | + ] | |
| 198 | + ); | |
| 199 | + } | |
| 200 | + | |
| 175 | 201 | public function actionDeleteImage($id) |
| 176 | 202 | { |
| 177 | 203 | $model = $this->findModel($id); |
| 178 | - $model->image = null; | |
| 179 | - $model->updateAttributes(['image']); | |
| 204 | + $model->image = NULL; | |
| 205 | + $model->updateAttributes([ 'image' ]); | |
| 180 | 206 | return true; |
| 181 | 207 | } |
| 182 | 208 | |
| ... | ... | @@ -194,7 +220,7 @@ |
| 194 | 220 | if (( $model = Brand::find() |
| 195 | 221 | ->with('lang') |
| 196 | 222 | ->where([ 'id' => $id ]) |
| 197 | - ->one() ) !== null | |
| 223 | + ->one() ) !== NULL | |
| 198 | 224 | ) { |
| 199 | 225 | return $model; |
| 200 | 226 | } else { | ... | ... |
controllers/BrandSizeController.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | -namespace artweb\artbox\ecommerce\controllers; | |
| 4 | - | |
| 5 | -use Yii; | |
| 6 | -use artweb\artbox\ecommerce\models\BrandSize; | |
| 7 | -use artweb\artbox\ecommerce\models\BrandSizeSearch; | |
| 8 | -use yii\web\Controller; | |
| 9 | -use yii\web\NotFoundHttpException; | |
| 10 | -use yii\filters\VerbFilter; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * BrandSizeController implements the CRUD actions for BrandSize model. | |
| 14 | - */ | |
| 15 | -class BrandSizeController extends Controller | |
| 16 | -{ | |
| 2 | + | |
| 3 | + namespace artweb\artbox\ecommerce\controllers; | |
| 4 | + | |
| 5 | + use artweb\artbox\ecommerce\models\Brand; | |
| 6 | + use artweb\artbox\ecommerce\models\Category; | |
| 7 | + use Yii; | |
| 8 | + use artweb\artbox\ecommerce\models\BrandSize; | |
| 9 | + use artweb\artbox\ecommerce\models\BrandSizeSearch; | |
| 10 | + use yii\helpers\ArrayHelper; | |
| 11 | + use yii\web\Controller; | |
| 12 | + use yii\web\NotFoundHttpException; | |
| 13 | + use yii\filters\VerbFilter; | |
| 14 | + | |
| 17 | 15 | /** |
| 18 | - * @inheritdoc | |
| 16 | + * BrandSizeController implements the CRUD actions for BrandSize model. | |
| 19 | 17 | */ |
| 20 | - public function behaviors() | |
| 18 | + class BrandSizeController extends Controller | |
| 21 | 19 | { |
| 22 | - return [ | |
| 23 | - 'verbs' => [ | |
| 24 | - 'class' => VerbFilter::className(), | |
| 25 | - 'actions' => [ | |
| 26 | - 'delete' => ['POST'], | |
| 20 | + /** | |
| 21 | + * @inheritdoc | |
| 22 | + */ | |
| 23 | + public function behaviors() | |
| 24 | + { | |
| 25 | + return [ | |
| 26 | + 'verbs' => [ | |
| 27 | + 'class' => VerbFilter::className(), | |
| 28 | + 'actions' => [ | |
| 29 | + 'delete' => [ 'POST' ], | |
| 30 | + ], | |
| 27 | 31 | ], |
| 28 | - ], | |
| 29 | - ]; | |
| 30 | - } | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * Lists all BrandSize models. | |
| 34 | - * @return mixed | |
| 35 | - */ | |
| 36 | - public function actionIndex() | |
| 37 | - { | |
| 38 | - $searchModel = new BrandSizeSearch(); | |
| 39 | - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 40 | - | |
| 41 | - return $this->render('index', [ | |
| 42 | - 'searchModel' => $searchModel, | |
| 43 | - 'dataProvider' => $dataProvider, | |
| 44 | - ]); | |
| 45 | - } | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * Displays a single BrandSize model. | |
| 49 | - * @param integer $id | |
| 50 | - * @return mixed | |
| 51 | - */ | |
| 52 | - public function actionView($id) | |
| 53 | - { | |
| 54 | - return $this->render('view', [ | |
| 55 | - 'model' => $this->findModel($id), | |
| 56 | - ]); | |
| 57 | - } | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * Creates a new BrandSize model. | |
| 61 | - * If creation is successful, the browser will be redirected to the 'view' page. | |
| 62 | - * @return mixed | |
| 63 | - */ | |
| 64 | - public function actionCreate() | |
| 65 | - { | |
| 66 | - $model = new BrandSize(); | |
| 67 | - | |
| 68 | - if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 69 | - return $this->redirect(['view', 'id' => $model->id]); | |
| 70 | - } else { | |
| 71 | - return $this->render('create', [ | |
| 72 | - 'model' => $model, | |
| 73 | - ]); | |
| 32 | + ]; | |
| 74 | 33 | } |
| 75 | - } | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * Updates an existing BrandSize model. | |
| 79 | - * If update is successful, the browser will be redirected to the 'view' page. | |
| 80 | - * @param integer $id | |
| 81 | - * @return mixed | |
| 82 | - */ | |
| 83 | - public function actionUpdate($id) | |
| 84 | - { | |
| 85 | - $model = $this->findModel($id); | |
| 86 | - | |
| 87 | - if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 88 | - return $this->redirect(['view', 'id' => $model->id]); | |
| 89 | - } else { | |
| 90 | - return $this->render('update', [ | |
| 91 | - 'model' => $model, | |
| 92 | - ]); | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * Lists all BrandSize models. | |
| 37 | + * | |
| 38 | + * @return mixed | |
| 39 | + */ | |
| 40 | + public function actionIndex() | |
| 41 | + { | |
| 42 | + $searchModel = new BrandSizeSearch(); | |
| 43 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 44 | + | |
| 45 | + return $this->render( | |
| 46 | + 'index', | |
| 47 | + [ | |
| 48 | + 'searchModel' => $searchModel, | |
| 49 | + 'dataProvider' => $dataProvider, | |
| 50 | + ] | |
| 51 | + ); | |
| 93 | 52 | } |
| 94 | - } | |
| 95 | - | |
| 96 | - /** | |
| 97 | - * Deletes an existing BrandSize model. | |
| 98 | - * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 99 | - * @param integer $id | |
| 100 | - * @return mixed | |
| 101 | - */ | |
| 102 | - public function actionDelete($id) | |
| 103 | - { | |
| 104 | - $this->findModel($id)->delete(); | |
| 105 | - | |
| 106 | - return $this->redirect(['index']); | |
| 107 | - } | |
| 108 | - | |
| 109 | - /** | |
| 110 | - * Finds the BrandSize model based on its primary key value. | |
| 111 | - * If the model is not found, a 404 HTTP exception will be thrown. | |
| 112 | - * @param integer $id | |
| 113 | - * @return BrandSize the loaded model | |
| 114 | - * @throws NotFoundHttpException if the model cannot be found | |
| 115 | - */ | |
| 116 | - protected function findModel($id) | |
| 117 | - { | |
| 118 | - if (($model = BrandSize::findOne($id)) !== null) { | |
| 119 | - return $model; | |
| 120 | - } else { | |
| 121 | - throw new NotFoundHttpException('The requested page does not exist.'); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * Displays a single BrandSize model. | |
| 56 | + * | |
| 57 | + * @param integer $id | |
| 58 | + * | |
| 59 | + * @return mixed | |
| 60 | + */ | |
| 61 | + public function actionView($id) | |
| 62 | + { | |
| 63 | + return $this->render( | |
| 64 | + 'view', | |
| 65 | + [ | |
| 66 | + 'model' => $this->findModel($id), | |
| 67 | + ] | |
| 68 | + ); | |
| 69 | + } | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * Creates a new BrandSize model. | |
| 73 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 74 | + * | |
| 75 | + * @return mixed | |
| 76 | + */ | |
| 77 | + public function actionCreate() | |
| 78 | + { | |
| 79 | + $model = new BrandSize(); | |
| 80 | + | |
| 81 | + $categories = ArrayHelper::map( | |
| 82 | + Category::find() | |
| 83 | + ->with('lang') | |
| 84 | + ->asArray() | |
| 85 | + ->all(), | |
| 86 | + 'id', | |
| 87 | + 'lang.title' | |
| 88 | + ); | |
| 89 | + | |
| 90 | + $brands = ArrayHelper::map( | |
| 91 | + Brand::find() | |
| 92 | + ->with('lang') | |
| 93 | + ->asArray() | |
| 94 | + ->all(), | |
| 95 | + 'id', | |
| 96 | + 'lang.title' | |
| 97 | + ); | |
| 98 | + | |
| 99 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 100 | + return $this->redirect( | |
| 101 | + [ | |
| 102 | + 'view', | |
| 103 | + 'id' => $model->id, | |
| 104 | + ] | |
| 105 | + ); | |
| 106 | + } else { | |
| 107 | + return $this->render( | |
| 108 | + 'create', | |
| 109 | + [ | |
| 110 | + 'model' => $model, | |
| 111 | + 'categories' => $categories, | |
| 112 | + 'brands' => $brands, | |
| 113 | + ] | |
| 114 | + ); | |
| 115 | + } | |
| 116 | + } | |
| 117 | + | |
| 118 | + /** | |
| 119 | + * Updates an existing BrandSize model. | |
| 120 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 121 | + * | |
| 122 | + * @param integer $id | |
| 123 | + * | |
| 124 | + * @return mixed | |
| 125 | + */ | |
| 126 | + public function actionUpdate($id) | |
| 127 | + { | |
| 128 | + $model = $this->findModel($id); | |
| 129 | + | |
| 130 | + $categories = ArrayHelper::map( | |
| 131 | + Category::find() | |
| 132 | + ->with('lang') | |
| 133 | + ->asArray() | |
| 134 | + ->all(), | |
| 135 | + 'id', | |
| 136 | + 'lang.title' | |
| 137 | + ); | |
| 138 | + | |
| 139 | + $brands = ArrayHelper::map( | |
| 140 | + Brand::find() | |
| 141 | + ->with('lang') | |
| 142 | + ->asArray() | |
| 143 | + ->all(), | |
| 144 | + 'id', | |
| 145 | + 'lang.title' | |
| 146 | + ); | |
| 147 | + | |
| 148 | + if (!empty(\Yii::$app->request->post('BrandSize')[ 'categories' ])) { | |
| 149 | + $model->unlinkAll('categories', true); | |
| 150 | + foreach (\Yii::$app->request->post('BrandSize')[ 'categories' ] as $item) { | |
| 151 | + if ($category = Category::findOne($item)) { | |
| 152 | + $model->link('categories', $category); | |
| 153 | + } | |
| 154 | + } | |
| 155 | + } | |
| 156 | + | |
| 157 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 158 | + return $this->redirect( | |
| 159 | + [ | |
| 160 | + 'view', | |
| 161 | + 'id' => $model->id, | |
| 162 | + ] | |
| 163 | + ); | |
| 164 | + } else { | |
| 165 | + return $this->render( | |
| 166 | + 'update', | |
| 167 | + [ | |
| 168 | + 'model' => $model, | |
| 169 | + 'categories' => $categories, | |
| 170 | + 'brands' => $brands, | |
| 171 | + ] | |
| 172 | + ); | |
| 173 | + } | |
| 174 | + } | |
| 175 | + | |
| 176 | + /** | |
| 177 | + * Deletes an existing BrandSize model. | |
| 178 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 179 | + * | |
| 180 | + * @param integer $id | |
| 181 | + * | |
| 182 | + * @return mixed | |
| 183 | + */ | |
| 184 | + public function actionDelete($id) | |
| 185 | + { | |
| 186 | + $this->findModel($id) | |
| 187 | + ->delete(); | |
| 188 | + | |
| 189 | + return $this->redirect([ 'index' ]); | |
| 190 | + } | |
| 191 | + | |
| 192 | + /** | |
| 193 | + * Finds the BrandSize model based on its primary key value. | |
| 194 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 195 | + * | |
| 196 | + * @param integer $id | |
| 197 | + * | |
| 198 | + * @return BrandSize the loaded model | |
| 199 | + * @throws NotFoundHttpException if the model cannot be found | |
| 200 | + */ | |
| 201 | + protected function findModel($id) | |
| 202 | + { | |
| 203 | + if (( $model = BrandSize::findOne($id) ) !== NULL) { | |
| 204 | + return $model; | |
| 205 | + } else { | |
| 206 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 207 | + } | |
| 122 | 208 | } |
| 123 | 209 | } |
| 124 | -} | ... | ... |
models/BrandSize.php
| ... | ... | @@ -59,8 +59,8 @@ class BrandSize extends \yii\db\ActiveRecord |
| 59 | 59 | { |
| 60 | 60 | return [ |
| 61 | 61 | 'id' => Yii::t('app', 'ID'), |
| 62 | - 'brand_id' => Yii::t('app', 'Brand ID'), | |
| 63 | - 'image' => Yii::t('app', 'Image'), | |
| 62 | + 'brand_id' => Yii::t('app', 'Брэнд'), | |
| 63 | + 'image' => Yii::t('app', 'Сетка'), | |
| 64 | 64 | ]; |
| 65 | 65 | } |
| 66 | 66 | ... | ... |
views/brand-size/_form.php
| ... | ... | @@ -9,9 +9,11 @@ |
| 9 | 9 | use artweb\artbox\components\artboximage\ArtboxImageHelper; |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * @var View $this | |
| 13 | - * @var BrandSize $model | |
| 12 | + * @var View $this | |
| 13 | + * @var BrandSize $model | |
| 14 | 14 | * @var ActiveForm $form |
| 15 | + * @var array $categories | |
| 16 | + * @var array $brands | |
| 15 | 17 | */ |
| 16 | 18 | ?> |
| 17 | 19 | |
| ... | ... | @@ -20,7 +22,20 @@ |
| 20 | 22 | <?php $form = ActiveForm::begin(); ?> |
| 21 | 23 | |
| 22 | 24 | <?= $form->field($model, 'brand_id') |
| 23 | - ->textInput() ?> | |
| 25 | + ->widget( | |
| 26 | + Select2::className(), | |
| 27 | + [ | |
| 28 | + 'data' => $brands, | |
| 29 | + 'language' => 'ru', | |
| 30 | + 'options' => [ | |
| 31 | + 'placeholder' => Yii::t('product', 'Select categories'), | |
| 32 | + 'multiple' => false, | |
| 33 | + ], | |
| 34 | + 'pluginOptions' => [ | |
| 35 | + 'allowClear' => true, | |
| 36 | + ], | |
| 37 | + ] | |
| 38 | + ) ?> | |
| 24 | 39 | |
| 25 | 40 | <?= $form->field($model, 'image') |
| 26 | 41 | ->widget( |
| ... | ... | @@ -65,7 +80,7 @@ |
| 65 | 80 | ->widget( |
| 66 | 81 | Select2::className(), |
| 67 | 82 | [ |
| 68 | - 'data' => [], | |
| 83 | + 'data' => $categories, | |
| 69 | 84 | 'language' => 'ru', |
| 70 | 85 | 'options' => [ |
| 71 | 86 | 'placeholder' => Yii::t('product', 'Select categories'), |
| ... | ... | @@ -75,7 +90,8 @@ |
| 75 | 90 | 'allowClear' => true, |
| 76 | 91 | ], |
| 77 | 92 | ] |
| 78 | - )->label(\Yii::t('app', 'Категории')) ?> | |
| 93 | + ) | |
| 94 | + ->label(\Yii::t('app', 'Категории')) ?> | |
| 79 | 95 | |
| 80 | 96 | <div class="form-group"> |
| 81 | 97 | <?= Html::submitButton( | ... | ... |
views/brand-size/create.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | -use yii\helpers\Html; | |
| 4 | - | |
| 5 | - | |
| 6 | -/* @var $this yii\web\View */ | |
| 7 | -/* @var $model artweb\artbox\ecommerce\models\BrandSize */ | |
| 8 | - | |
| 9 | -$this->title = Yii::t('app', 'Create Brand Size'); | |
| 10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Brand Sizes'), 'url' => ['index']]; | |
| 11 | -$this->params['breadcrumbs'][] = $this->title; | |
| 2 | + | |
| 3 | + use artweb\artbox\ecommerce\models\BrandSize; | |
| 4 | + use yii\helpers\Html; | |
| 5 | + use yii\web\View; | |
| 6 | + | |
| 7 | + /** | |
| 8 | + * @var View $this | |
| 9 | + * @var BrandSize $model | |
| 10 | + * @var array $categories | |
| 11 | + * @var array $brands | |
| 12 | + */ | |
| 13 | + | |
| 14 | + $this->title = Yii::t('app', 'Create Brand Size'); | |
| 15 | + $this->params[ 'breadcrumbs' ][] = [ | |
| 16 | + 'label' => Yii::t('app', 'Brand Sizes'), | |
| 17 | + 'url' => [ 'index' ], | |
| 18 | + ]; | |
| 19 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
| 12 | 20 | ?> |
| 13 | 21 | <div class="brand-size-create"> |
| 14 | 22 | |
| 15 | - <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | - | |
| 17 | - <?= $this->render('_form', [ | |
| 18 | - 'model' => $model, | |
| 19 | - ]) ?> | |
| 23 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 24 | + | |
| 25 | + <?= $this->render( | |
| 26 | + '_form', | |
| 27 | + [ | |
| 28 | + 'model' => $model, | |
| 29 | + 'categories' => $categories, | |
| 30 | + 'brands' => $brands, | |
| 31 | + ] | |
| 32 | + ) ?> | |
| 20 | 33 | |
| 21 | 34 | </div> | ... | ... |
views/brand-size/update.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | -use yii\helpers\Html; | |
| 4 | - | |
| 5 | -/* @var $this yii\web\View */ | |
| 6 | -/* @var $model artweb\artbox\ecommerce\models\BrandSize */ | |
| 7 | - | |
| 8 | -$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 9 | - 'modelClass' => 'Brand Size', | |
| 10 | -]) . $model->id; | |
| 11 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Brand Sizes'), 'url' => ['index']]; | |
| 12 | -$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; | |
| 13 | -$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | |
| 2 | + | |
| 3 | + use artweb\artbox\ecommerce\models\BrandSize; | |
| 4 | + use yii\helpers\Html; | |
| 5 | + use yii\web\View; | |
| 6 | + | |
| 7 | + /** | |
| 8 | + * @var View $this | |
| 9 | + * @var BrandSize $model | |
| 10 | + * @var array $categories | |
| 11 | + * @var array $brands | |
| 12 | + */ | |
| 13 | + | |
| 14 | + $this->title = Yii::t( | |
| 15 | + 'app', | |
| 16 | + 'Update {modelClass}: ', | |
| 17 | + [ | |
| 18 | + 'modelClass' => 'Brand Size', | |
| 19 | + ] | |
| 20 | + ) . $model->id; | |
| 21 | + $this->params[ 'breadcrumbs' ][] = [ | |
| 22 | + 'label' => Yii::t('app', 'Brand Sizes'), | |
| 23 | + 'url' => [ 'index' ], | |
| 24 | + ]; | |
| 25 | + $this->params[ 'breadcrumbs' ][] = [ | |
| 26 | + 'label' => $model->id, | |
| 27 | + 'url' => [ | |
| 28 | + 'view', | |
| 29 | + 'id' => $model->id, | |
| 30 | + ], | |
| 31 | + ]; | |
| 32 | + $this->params[ 'breadcrumbs' ][] = Yii::t('app', 'Update'); | |
| 14 | 33 | ?> |
| 15 | 34 | <div class="brand-size-update"> |
| 16 | 35 | |
| 17 | - <h1><?= Html::encode($this->title) ?></h1> | |
| 18 | - | |
| 19 | - <?= $this->render('_form', [ | |
| 20 | - 'model' => $model, | |
| 21 | - ]) ?> | |
| 36 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 37 | + | |
| 38 | + <?= $this->render( | |
| 39 | + '_form', | |
| 40 | + [ | |
| 41 | + 'model' => $model, | |
| 42 | + 'categories' => $categories, | |
| 43 | + 'brands' => $brands, | |
| 44 | + ] | |
| 45 | + ) ?> | |
| 22 | 46 | |
| 23 | 47 | </div> | ... | ... |
views/brand-size/view.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | -use yii\helpers\Html; | |
| 4 | -use yii\widgets\DetailView; | |
| 5 | - | |
| 6 | -/* @var $this yii\web\View */ | |
| 7 | -/* @var $model artweb\artbox\ecommerce\models\BrandSize */ | |
| 8 | - | |
| 9 | -$this->title = $model->id; | |
| 10 | -$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Brand Sizes'), 'url' => ['index']]; | |
| 11 | -$this->params['breadcrumbs'][] = $this->title; | |
| 2 | + | |
| 3 | + use artweb\artbox\ecommerce\models\BrandSize; | |
| 4 | + use yii\helpers\Html; | |
| 5 | + use yii\web\View; | |
| 6 | + use yii\widgets\DetailView; | |
| 7 | + | |
| 8 | + /** | |
| 9 | + * @var View $this | |
| 10 | + * @var BrandSize $model | |
| 11 | + */ | |
| 12 | + | |
| 13 | + $this->title = $model->id; | |
| 14 | + $this->params[ 'breadcrumbs' ][] = [ | |
| 15 | + 'label' => Yii::t('app', 'Brand Sizes'), | |
| 16 | + 'url' => [ 'index' ], | |
| 17 | + ]; | |
| 18 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
| 12 | 19 | ?> |
| 13 | 20 | <div class="brand-size-view"> |
| 14 | 21 | |
| 15 | - <h1><?= Html::encode($this->title) ?></h1> | |
| 22 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | 23 | |
| 17 | - <p> | |
| 18 | - <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
| 19 | - <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [ | |
| 20 | - 'class' => 'btn btn-danger', | |
| 21 | - 'data' => [ | |
| 22 | - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | |
| 23 | - 'method' => 'post', | |
| 24 | + <p> | |
| 25 | + <?= Html::a( | |
| 26 | + Yii::t('app', 'Update'), | |
| 27 | + [ | |
| 28 | + 'update', | |
| 29 | + 'id' => $model->id, | |
| 30 | + ], | |
| 31 | + [ 'class' => 'btn btn-primary' ] | |
| 32 | + ) ?> | |
| 33 | + <?= Html::a( | |
| 34 | + Yii::t('app', 'Delete'), | |
| 35 | + [ | |
| 36 | + 'delete', | |
| 37 | + 'id' => $model->id, | |
| 38 | + ], | |
| 39 | + [ | |
| 40 | + 'class' => 'btn btn-danger', | |
| 41 | + 'data' => [ | |
| 42 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | |
| 43 | + 'method' => 'post', | |
| 44 | + ], | |
| 45 | + ] | |
| 46 | + ) ?> | |
| 47 | + </p> | |
| 48 | + | |
| 49 | + <?= DetailView::widget( | |
| 50 | + [ | |
| 51 | + 'model' => $model, | |
| 52 | + 'attributes' => [ | |
| 53 | + 'id', | |
| 54 | + 'brand_id', | |
| 55 | + 'image', | |
| 24 | 56 | ], |
| 25 | - ]) ?> | |
| 26 | - </p> | |
| 27 | - | |
| 28 | - <?= DetailView::widget([ | |
| 29 | - 'model' => $model, | |
| 30 | - 'attributes' => [ | |
| 31 | - 'id', | |
| 32 | - 'brand_id', | |
| 33 | - 'image', | |
| 34 | - ], | |
| 35 | - ]) ?> | |
| 57 | + ] | |
| 58 | + ) ?> | |
| 36 | 59 | |
| 37 | 60 | </div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | + use artweb\artbox\ecommerce\models\Brand; | |
| 4 | + use yii\data\ActiveDataProvider; | |
| 5 | + use yii\helpers\Html; | |
| 6 | + use yii\grid\GridView; | |
| 7 | + use yii\web\View; | |
| 8 | + | |
| 9 | + /** | |
| 10 | + * @var View $this | |
| 11 | + * @var Brand $model | |
| 12 | + * @var ActiveDataProvider $dataProvider | |
| 13 | + */ | |
| 14 | + | |
| 15 | + $this->title = Yii::t('app', 'Brand Sizes'); | |
| 16 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
| 17 | +?> | |
| 18 | +<div class="brand-size-index"> | |
| 19 | + | |
| 20 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 21 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
| 22 | + | |
| 23 | + <p> | |
| 24 | + <?= Html::a(Yii::t('app', 'Create Brand Size'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
| 25 | + </p> | |
| 26 | + <?= GridView::widget( | |
| 27 | + [ | |
| 28 | + 'dataProvider' => $dataProvider, | |
| 29 | + 'columns' => [ | |
| 30 | + [ 'class' => 'yii\grid\SerialColumn' ], | |
| 31 | + | |
| 32 | + 'id', | |
| 33 | + 'brand_id', | |
| 34 | + 'image', | |
| 35 | + | |
| 36 | + [ 'class' => 'yii\grid\ActionColumn' ], | |
| 37 | + ], | |
| 38 | + ] | |
| 39 | + ); ?> | |
| 40 | +</div> | ... | ... |