diff --git a/assets/StockAsset.php b/assets/StockAsset.php index 3f130dc..2ac77d9 100644 --- a/assets/StockAsset.php +++ b/assets/StockAsset.php @@ -1,8 +1,9 @@ [ - 'class' => AccessControl::className(), - 'rules' => [ - [ - 'actions' => [ - 'login', - 'error', + /** + * @inheritdoc + */ + public function getViewPath() + { + return '@artbox/stock/views/shop'; + } + public function behaviors() + { + return [ + 'access' => [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'actions' => [ + 'login', + 'error', + ], + 'allow' => true, + ], + [ + 'allow' => true, + 'roles' => [ '@' ], ], - 'allow' => true, - ], - [ - 'allow' => true, - 'roles' => [ '@' ], ], ], - ], - 'verbs' => [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], ], - ], - ]; - } - - /** - * Lists all Shop models. - * @return mixed - */ - public function actionIndex() - { - $dataProvider = new ActiveDataProvider([ - 'query' => Shop::find(), - ]); - - return $this->render('index', [ - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single Shop model. - * @param integer $id - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new Shop model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new Shop(); - $model->generateLangs(); - $model->getCities(); - if ($model->loadWithLangs(\Yii::$app->request) && $model->saveWithLangs()) { - return $this->redirect( + ]; + } + + /** + * Lists all Shop models. + * + * @return mixed + */ + public function actionIndex() + { + $dataProvider = new ActiveDataProvider( + [ + 'query' => Shop::find(), + ] + ); + + return $this->render( + 'index', [ - 'view', - 'id' => $model->id, + 'dataProvider' => $dataProvider, ] ); } - return $this->render( - 'create', - [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ] - ); - - } - - /** - * Updates an existing Shop model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - $model->generateLangs(); - $model->getCities(); - $model->loadWithLangs(\Yii::$app->request); - //print_r(\Yii::$app->request); - if ($model->loadWithLangs(\Yii::$app->request) && $model->saveWithLangs()) { - return $this->redirect( + + /** + * Displays a single Shop model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render( + 'view', [ - 'view', - 'id' => $model->id, + 'model' => $this->findModel($id), ] ); } - return $this->render( - 'update', - [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ] - ); - } - - /** - * Deletes an existing Shop model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the Shop model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Shop the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Shop::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); + + /** + * Creates a new Shop model. + * If creation is successful, the browser will be redirected to the 'view' page. + * + * @return mixed + */ + public function actionCreate() + { + $model = new Shop(); + $model->generateLangs(); + $model->getCities(); + if ($model->loadWithLangs(\Yii::$app->request) && $model->saveWithLangs()) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } + return $this->render( + 'create', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); + + } + + /** + * Updates an existing Shop model. + * If update is successful, the browser will be redirected to the 'view' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + $model->generateLangs(); + $model->getCities(); + if ($model->loadWithLangs(\Yii::$app->request) && $model->saveWithLangs()) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); + } + + /** + * Deletes an existing Shop model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id) + ->delete(); + + return $this->redirect([ 'index' ]); + } + + /** + * Finds the Shop model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return Shop the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (( $model = Shop::findOne($id) ) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } } } -} diff --git a/messages/ru/stock.php b/messages/ru/stock.php index 4a7167e..3bf82bf 100644 --- a/messages/ru/stock.php +++ b/messages/ru/stock.php @@ -1,18 +1,25 @@ 'Города', - 'Shops' => 'Магазины/склады', - 'Title' => 'Название', - 'Sort' => 'Сортировка', - 'Status' => 'Статус', - 'Description' => 'Описание', - 'Create City' => 'Добавить город', - 'Alias' => 'Алиас', - 'Update' => 'Обновить', - 'Address' => 'Адрес', - 'Create Shop' => 'Добавить магазин', - 'Mode' => "Расписание работы", - 'Delete' => 'Удалить', - 'Create' => "Добавить", -] + return [ + 'Cities' => 'Города', + 'Shops' => 'Магазины/склады', + 'Title' => 'Название', + 'Sort' => 'Сортировка', + 'Status' => 'Статус', + 'Description' => 'Описание', + 'Create City' => 'Добавить город', + 'Alias' => 'Алиас', + 'Update' => 'Обновить', + 'Address' => 'Адрес', + 'Create Shop' => 'Добавить магазин', + 'Mode' => "Расписание работы", + 'Delete' => 'Удалить', + 'Create' => "Добавить", + 'Mon' => 'Пн', + 'Tue' => 'Вт', + 'Wed' => 'Ср', + 'Thu' => 'Чт', + 'Fri' => 'Пт', + 'Sat' => 'Сб', + 'Sun' => 'Вс', + ] ?> \ No newline at end of file diff --git a/models/Shop.php b/models/Shop.php index 4206a16..2633558 100644 --- a/models/Shop.php +++ b/models/Shop.php @@ -1,118 +1,156 @@ [ - 'class' => LanguageBehavior::className(), - ], - ]; - } - /** - * @inheritdoc - */ - public function rules() - { - return [ - [['city_id', 'sort'], 'integer'], - [['status'], 'boolean'], - [['mode', 'modeStr'], 'safe'], - [['coords', 'coordsArr'], 'safe'], - [['city_id'], 'exist', 'skipOnError' => true, 'targetClass' => City::className(), 'targetAttribute' => ['city_id' => 'id']], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'mode' => \Yii::t('stock', 'Mode'), - 'city_id' => 'City ID', - 'sort' => \Yii::t('stock', 'Sort'), - 'status' => \Yii::t('stock', 'Status'), - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getCity() - { - return $this->hasOne(City::className(), ['id' => 'city_id']); - } - - public function getCities(){ - $cities = City::find()->with(['lang'])->all(); - foreach($cities as $city){ - $this->cities[$city->id] = $city->lang->title; + /** + * @inheritdoc + */ + public $cities = []; + public static function tableName() + { + return 'shop'; } - - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getShopLangs() - { - return $this->hasMany(ShopLang::className(), ['shop_id' => 'id']); - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getLanguages() - { - return $this->hasMany(Language::className(), ['id' => 'language_id'])->viaTable('shop_lang', ['shop_id' => 'id']); - } - - public function setModeStr($value){ - $this->mode = Json::encode($value); - } - - public function getModeStr(){ - return Json::decode($this->mode); - } - - public function setCoordsArr($value){ - $this->coords = Json::encode($value); - } - - public function getCoordsArr(){ - return Json::decode($this->coords); + public function behaviors() + { + return [ + 'language' => [ + 'class' => LanguageBehavior::className(), + ], + ]; + } + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ + 'city_id', + 'sort', + ], + 'integer', + ], + [ + [ 'status' ], + 'boolean', + ], + [ + [ + 'mode', + 'modeStr', + ], + 'safe', + ], + [ + [ + 'coords', + 'coordsArr', + ], + 'safe', + ], + [ + [ 'city_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => City::className(), + 'targetAttribute' => [ 'city_id' => 'id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'mode' => \Yii::t('stock', 'Mode'), + 'city_id' => 'City ID', + 'sort' => \Yii::t('stock', 'Sort'), + 'status' => \Yii::t('stock', 'Status'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getCity() + { + return $this->hasOne(City::className(), [ 'id' => 'city_id' ]); + } + + public function getCities() + { + $cities = City::find() + ->with([ 'lang' ]) + ->all(); + foreach ($cities as $city) { + $this->cities[ $city->id ] = $city->lang->title; + } + + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getShopLangs() + { + return $this->hasMany(ShopLang::className(), [ 'shop_id' => 'id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLanguages() + { + return $this->hasMany(Language::className(), [ 'id' => 'language_id' ]) + ->viaTable('shop_lang', [ 'shop_id' => 'id' ]); + } + + public function setModeStr($value) + { + $this->mode = Json::encode($value); + } + + public function getModeStr() + { + return Json::decode($this->mode); + } + + public function setCoordsArr($value) + { + $this->coords = Json::encode($value); + } + + public function getCoordsArr() + { + return Json::decode($this->coords); + } + } - - -} diff --git a/models/ShopLang.php b/models/ShopLang.php index d038aff..157ca24 100644 --- a/models/ShopLang.php +++ b/models/ShopLang.php @@ -1,105 +1,151 @@ [ - 'class' => SlugBehavior::className(), - 'action' => 'shop/view', - 'params' => [ - 'id' => 'shop_id', + /** + * @inheritdoc + */ + public static function tableName() + { + return 'shop_lang'; + } + + /** + * @inheritdoc + */ + public function behaviors() + { + return [ + 'slug' => [ + 'class' => SlugBehavior::className(), + 'action' => 'shop/view', + 'params' => [ + 'id' => 'shop_id', + ], + 'fields' => [ + 'title' => \Yii::t('stock', 'Title'), + 'description' => \Yii::t('stock', 'Description'), + 'address' => \Yii::t('stock', 'Address'), + ], ], - 'fields' => [ - 'title' => \Yii::t('stock', 'Title'), - 'description' => \Yii::t('stock', 'Description'), - 'address' => \Yii::t('stock', 'Address'), + ]; + } + public function rules() + { + return [ + [ + [ + 'shop_id', + 'language_id', + 'title', + ], + 'required', ], - ], - ]; - } - public function rules() - { - return [ - [['shop_id', 'language_id', 'title'], 'required'], - [['shop_id', 'language_id', 'alias_id'], 'integer'], - [['description'], 'string'], - [['title'], 'string', 'max' => 255], - [['address'], 'string', 'max' => 255], - [['alias_id'], 'unique'], - [['alias_id'], 'exist', 'skipOnError' => true, 'targetClass' => Alias::className(), 'targetAttribute' => ['alias_id' => 'id']], - [['language_id'], 'exist', 'skipOnError' => true, 'targetClass' => Language::className(), 'targetAttribute' => ['language_id' => 'id']], - [['shop_id'], 'exist', 'skipOnError' => true, 'targetClass' => Shop::className(), 'targetAttribute' => ['shop_id' => 'id']], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'shop_id' => 'Shop ID', - 'language_id' => 'Language ID', - 'title' => \Yii::t('stock', 'Title'), - 'alias_id' => 'Alias ID', - 'description' => \Yii::t('stock', 'Description'), - 'address' => \Yii::t('stock', 'Address'), - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getAlias() - { - return $this->hasOne(Alias::className(), ['id' => 'alias_id']); - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getLanguage() - { - return $this->hasOne(Language::className(), ['id' => 'language_id']); - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getShop() - { - return $this->hasOne(Shop::className(), ['id' => 'shop_id']); + [ + [ + 'shop_id', + 'language_id', + 'alias_id', + ], + 'integer', + ], + [ + [ 'description' ], + 'string', + ], + [ + [ 'title' ], + 'string', + 'max' => 255, + ], + [ + [ 'address' ], + 'string', + 'max' => 255, + ], + [ + [ 'alias_id' ], + 'unique', + ], + [ + [ 'alias_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Alias::className(), + 'targetAttribute' => [ 'alias_id' => 'id' ], + ], + [ + [ 'language_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Language::className(), + 'targetAttribute' => [ 'language_id' => 'id' ], + ], + [ + [ 'shop_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Shop::className(), + 'targetAttribute' => [ 'shop_id' => 'id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'shop_id' => 'Shop ID', + 'language_id' => 'Language ID', + 'title' => \Yii::t('stock', 'Title'), + 'alias_id' => 'Alias ID', + 'description' => \Yii::t('stock', 'Description'), + 'address' => \Yii::t('stock', 'Address'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getAlias() + { + return $this->hasOne(Alias::className(), [ 'id' => 'alias_id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLanguage() + { + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getShop() + { + return $this->hasOne(Shop::className(), [ 'id' => 'shop_id' ]); + } } -} diff --git a/views/city/_form.php b/views/city/_form.php index 5221fb1..299ee28 100644 --- a/views/city/_form.php +++ b/views/city/_form.php @@ -1,16 +1,17 @@
- + $form, ] ) ?> - - field($model, 'sort')->textInput() ?> - - field($model, 'status')->checkbox() ?> - -
- isNewRecord ? \Yii::t('stock', 'Create'): \Yii::t('stock', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> -
- + + field($model, 'sort') + ->textInput() ?> + + field($model, 'status') + ->checkbox() ?> + +
+ isNewRecord ? \Yii::t('stock', 'Create') : \Yii::t('stock', 'Update'), + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] + ) ?> +
+
diff --git a/views/city/_form_language.php b/views/city/_form_language.php index 3e159e2..4addcd5 100755 --- a/views/city/_form_language.php +++ b/views/city/_form_language.php @@ -1,5 +1,5 @@ title = \Yii::t('stock', 'Create City'); -$this->params['breadcrumbs'][] = ['label' => \Yii::t('stock', 'Cities'), 'url' => ['index']]; -$this->params['breadcrumbs'][] = \Yii::t('stock', $this->title); + + use yii\helpers\Html; + use yiister\gentelella\widgets\Panel; + + /* @var $this yii\web\View */ + /* @var $model artbox\stock\models\City */ + /* @var $modelLangs artbox\stock\models\CityLang */ + + $this->title = \Yii::t('stock', 'Create City'); + $this->params[ 'breadcrumbs' ][] = [ + 'label' => \Yii::t('stock', 'Cities'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = \Yii::t('stock', $this->title); ?>
\Yii::t('stock', Html::encode($this->title)), + ] + ); + ?> +

title)) ?>

+ + render( + '_form', [ - 'header' => \Yii::t('stock', Html::encode($this->title)), + 'model' => $model, + 'modelLangs' => $modelLangs, ] - ); - ?> -

title)) ?>

- - render('_form', [ - 'model' => $model, - 'modelLangs' => $modelLangs, - ]) ?> - - + ) ?> + +
diff --git a/views/city/update.php b/views/city/update.php index 660e1e4..f587496 100644 --- a/views/city/update.php +++ b/views/city/update.php @@ -1,37 +1,41 @@ title = Yii::t( - 'catalog', - 'Update {modelClass}: ', - [ - 'modelClass' => 'City', - ] - ) . $model->lang->title; -$this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('stock', 'Cities'), - 'url' => [ 'index' ], -]; -$this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->lang->title, - 'url' => [ - 'view', - 'id' => $model->id, - ], -]; -$this->params[ 'breadcrumbs' ][] = Yii::t('stock', 'Update'); + + use yii\helpers\Html; + + /* @var $this yii\web\View */ + /* @var $model artbox\stock\models\City */ + /* @var $modelLangs artbox\stock\models\CityLang */ + + $this->title = Yii::t( + 'catalog', + 'Update {modelClass}: ', + [ + 'modelClass' => 'City', + ] + ) . $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('stock', 'Cities'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $model->lang->title, + 'url' => [ + 'view', + 'id' => $model->id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = Yii::t('stock', 'Update'); ?>
- -

title) ?>

- - render('_form', [ - 'model' => $model, - 'modelLangs' => $modelLangs, - ]) ?> + +

title) ?>

+ + render( + '_form', + [ + 'model' => $model, + 'modelLangs' => $modelLangs, + ] + ) ?>
diff --git a/views/city/view.php b/views/city/view.php index 4bd637d..7f6d8fc 100644 --- a/views/city/view.php +++ b/views/city/view.php @@ -1,53 +1,69 @@ title = $model->lang->title; -$this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('stock', 'Cities'), - 'url' => [ 'index' ], -]; -$this->params[ 'breadcrumbs' ][] = $this->title; + + use yii\helpers\Html; + use yii\widgets\DetailView; + use yiister\gentelella\widgets\Panel; + + /* @var $this yii\web\View */ + /* @var $model artbox\stock\models\City */ + + $this->title = $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('stock', 'Cities'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
Html::encode($this->title), - ] - ); - ?> -

title) ?>

- -

- $model->id], ['class' => 'btn btn-primary']) ?> - $model->id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => 'Are you sure you want to delete this item?', - 'method' => 'post', - ], - ]) ?> -

- - $model, - 'attributes' => [ - 'id', - 'lang.title', + $xPanel = Panel::begin( [ - 'attribute' => 'lang.alias.value', - 'label' => \Yii::t('catalog', 'Alias'), + 'header' => Html::encode($this->title), + ] + ); + ?> +

title) ?>

+ +

+ $model->id, + ], + [ 'class' => 'btn btn-primary' ] + ) ?> + $model->id, + ], + [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Are you sure you want to delete this item?', + 'method' => 'post', + ], + ] + ) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'lang.title', + [ + 'attribute' => 'lang.alias.value', + 'label' => \Yii::t('catalog', 'Alias'), + ], + 'lang.description:html', + 'sort', + 'status:boolean', ], - 'lang.description:html', - 'sort', - 'status:boolean', - ], - ]) ?> + ] + ) ?>
diff --git a/views/shop/_form.php b/views/shop/_form.php index edc7073..7cc8f1a 100644 --- a/views/shop/_form.php +++ b/views/shop/_form.php @@ -8,14 +8,15 @@ /* @var $this yii\web\View */ /* @var $model artbox\stock\models\Shop */ /* @var $form yii\widgets\ActiveForm */ + /* @var $modelLangs artbox\stock\models\ShopLang */ $days = [ - \Yii::t('stock', 'Пн'), - "Вт", - "Ср", - "Чт", - "Пт", - "Сб", - "Вс", + \Yii::t('stock', 'Mon'), + \Yii::t('stock', 'Tue'), + \Yii::t('stock', 'Wed'), + \Yii::t('stock', 'Thu'), + \Yii::t('stock', 'Fri'), + \Yii::t('stock', 'Sat'), + \Yii::t('stock', 'Sun'), ]; \artbox\stock\assets\StockAsset::register($this); @@ -135,9 +136,4 @@ - - - - - - + diff --git a/views/shop/_form_language.php b/views/shop/_form_language.php index f276f50..c8f992e 100755 --- a/views/shop/_form_language.php +++ b/views/shop/_form_language.php @@ -1,18 +1,18 @@ shop->coordsArr); die(); ?> field($model_lang, '[' . $language->id . ']title') @@ -21,23 +21,31 @@ use yii\helpers\Html; ?> field($model_lang, '[' . $language->id . ']address') - ->textInput([ 'maxlength' => true ]); -echo $attributeField; + $attributeField = $form->field($model_lang, '[' . $language->id . ']address') + ->textInput([ 'maxlength' => true ]); + echo $attributeField; ?> - -shop->coordsArr['lat'])) ? $model_lang->shop->coordsArr['lat'] : '', [ - 'size' => 20, - 'type'=> 'text', - 'id' => 'lat', - -])?> -shop->coordsArr['lng'])) ? $model_lang->shop->coordsArr['lng'] : '', [ - 'size' => 20, - 'type'=> 'text', - 'id' => 'lng' -])?> -
+ +shop->coordsArr[ 'lat' ]) ) ? $model_lang->shop->coordsArr[ 'lat' ] : '', + [ + 'size' => 20, + 'type' => 'text', + 'id' => 'lat', + + ] +) ?> +shop->coordsArr[ 'lng' ]) ) ? $model_lang->shop->coordsArr[ 'lng' ] : '', + [ + 'size' => 20, + 'type' => 'text', + 'id' => 'lng', + ] +) ?> +
field($model_lang, '[' . $language->id . ']aliasValue'), diff --git a/views/shop/create.php b/views/shop/create.php index 014f0cf..31fcfaf 100644 --- a/views/shop/create.php +++ b/views/shop/create.php @@ -1,30 +1,37 @@ title = \Yii::t('stock', 'Create Shop'); -$this->params['breadcrumbs'][] = ['label' => \Yii::t('stock', 'Shops'), 'url' => ['index']]; -$this->params['breadcrumbs'][] = \Yii::t('stock', $this->title); + + use yii\helpers\Html; + use yiister\gentelella\widgets\Panel; + + /* @var $this yii\web\View */ + /* @var $model artbox\stock\models\Shop */ + /* @var $modelLangs artbox\stock\models\ShopLang */ + + $this->title = \Yii::t('stock', 'Create Shop'); + $this->params[ 'breadcrumbs' ][] = [ + 'label' => \Yii::t('stock', 'Shops'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = \Yii::t('stock', $this->title); ?>
\Yii::t('stock', Html::encode($this->title)), + ] + ); + ?> +

title) ?>

+ + render( + '_form', [ - 'header' => \Yii::t('stock', Html::encode($this->title)), + 'model' => $model, + 'modelLangs' => $modelLangs, ] - ); - ?> -

title) ?>

- - render('_form', [ - 'model' => $model, - 'modelLangs' => $modelLangs, - ]) ?> + ) ?>
diff --git a/views/shop/index.php b/views/shop/index.php index 73cf048..ae2c1bb 100644 --- a/views/shop/index.php +++ b/views/shop/index.php @@ -1,45 +1,47 @@ title = 'Shops'; -$this->params['breadcrumbs'][] = \Yii::t('stock', $this->title); + + use yii\helpers\Html; + use yii\grid\GridView; + use yiister\gentelella\widgets\Panel; + + /* @var $this yii\web\View */ + /* @var $dataProvider yii\data\ActiveDataProvider */ + + $this->title = 'Shops'; + $this->params[ 'breadcrumbs' ][] = \Yii::t('stock', $this->title); ?>
\Yii::t('stock', Html::encode($this->title)), - ] - ); - ?> -

title)) ?>

- -

- 'btn btn-success']) ?> -

- $dataProvider, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - - 'id', + $xPanel = Panel::begin( [ - 'attribute' => \Yii::t('stock', 'Address'), - 'value' => 'lang.address', + 'header' => \Yii::t('stock', Html::encode($this->title)), + ] + ); + ?> +

title)) ?>

+ +

+ 'btn btn-success' ]) ?> +

+ $dataProvider, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], + + 'id', + [ + 'attribute' => \Yii::t('stock', 'Address'), + 'value' => 'lang.address', + ], + 'sort', + 'status:boolean', + + [ 'class' => 'yii\grid\ActionColumn' ], ], - 'sort', - 'status:boolean', - - ['class' => 'yii\grid\ActionColumn'], - ], - ]); ?> + ] + ); ?>
diff --git a/views/shop/update.php b/views/shop/update.php index c838cc6..4e208de 100644 --- a/views/shop/update.php +++ b/views/shop/update.php @@ -1,44 +1,49 @@ title = Yii::t( - 'catalog', - 'Update {modelClass}: ', - [ - 'modelClass' => 'Shop', - ] - ) . $model->lang->title; -$this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('stock', 'Shop'), - 'url' => [ 'index' ], -]; -$this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->lang->title, - 'url' => [ - 'view', - 'id' => $model->id, - ], -]; -$this->params[ 'breadcrumbs' ][] = Yii::t('stock', 'Update');?> + + use yii\helpers\Html; + use yiister\gentelella\widgets\Panel; + + /* @var $this yii\web\View */ + /* @var $model artbox\stock\models\Shop */ + /* @var $modelLangs artbox\stock\models\ShopLang */ + + $this->title = Yii::t( + 'catalog', + 'Update {modelClass}: ', + [ + 'modelClass' => 'Shop', + ] + ) . $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('stock', 'Shop'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $model->lang->title, + 'url' => [ + 'view', + 'id' => $model->id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = Yii::t('stock', 'Update'); ?>
\Yii::t('stock', Html::encode($this->title)), + ] + ); + ?> +

title) ?>

+ + render( + '_form', [ - 'header' => \Yii::t('stock', Html::encode($this->title)), + 'model' => $model, + 'modelLangs' => $modelLangs, ] - ); - ?> -

title) ?>

- - render('_form', [ - 'model' => $model, - 'modelLangs' => $modelLangs, - ]) ?> + ) ?>
diff --git a/views/shop/view.php b/views/shop/view.php index ea97724..8090d85 100644 --- a/views/shop/view.php +++ b/views/shop/view.php @@ -1,55 +1,72 @@ title = $model->lang->title; -$this->params[ 'breadcrumbs' ][] = [ - 'label' => Yii::t('stock', 'Shops'), - 'url' => [ 'index' ], -]; -$this->params[ 'breadcrumbs' ][] = $this->title; + + use yii\helpers\Html; + use yii\widgets\DetailView; + use yiister\gentelella\widgets\Panel; + + /* @var $this yii\web\View */ + /* @var $model artbox\stock\models\Shop */ + + $this->title = $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('stock', 'Shops'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
\Yii::t('stock', Html::encode($this->title)), - ] - ); - ?> -

title) ?>

- -

- $model->id], ['class' => 'btn btn-primary']) ?> - $model->id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => 'Are you sure you want to delete this item?', - 'method' => 'post', - ], - ]) ?> -

- - $model, - 'attributes' => [ - 'id', - 'lang.title', + $xPanel = Panel::begin( [ - 'attribute' => 'lang.alias.value', - 'label' => \Yii::t('catalog', 'Alias'), + 'header' => \Yii::t('stock', Html::encode($this->title)), + ] + ); + ?> +

title) ?>

+ +

+ $model->id, + ], + [ 'class' => 'btn btn-primary' ] + ) ?> + $model->id, + ], + [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Are you sure you want to delete this item?', + 'method' => 'post', + ], + ] + ) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'lang.title', + [ + 'attribute' => 'lang.alias.value', + 'label' => \Yii::t('catalog', 'Alias'), + ], + 'lang.description:html', + 'lang.address', + 'sort', + 'status:boolean', ], - 'lang.description:html', - 'lang.address', - 'sort', - 'status:boolean', - ], - ]) ?> + ] + ) ?>
-- libgit2 0.21.4