diff --git a/controllers/BrandController.php b/controllers/BrandController.php new file mode 100755 index 0000000..2952bbf --- /dev/null +++ b/controllers/BrandController.php @@ -0,0 +1,172 @@ + [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'actions' => [ + 'login', + 'error', + ], + 'allow' => true, + ], + [ + 'actions' => [ + 'logout', + 'index', + 'create', + 'update', + 'view', + 'delete', + ], + 'allow' => true, + 'roles' => [ '@' ], + ], + ], + ], + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'logout' => [ 'post' ], + ], + ], + ]; + } + + /** + * Lists all Brand models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new BrandSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Brand model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Brand model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Brand(); + $model->generateLangs(); + if($model->load(Yii::$app->request->post())) { + $model->loadLangs(\Yii::$app->request); + if($model->save() && $model->transactionStatus) { + return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect([ + 'view', + 'id' => $model->id, + ]) : $this->redirect(array_merge([ 'create' ], Yii::$app->request->queryParams)); + } + } + return $this->render('create', [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ]); + } + + /** + * Updates an existing Brand 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(); + + if($model->load(Yii::$app->request->post())) { + $model->loadLangs(\Yii::$app->request); + if($model->save() && $model->transactionStatus) { + return $this->redirect([ + 'view', + 'id' => $model->id, + ]); + } + } + return $this->render('update', [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ]); + } + + /** + * Deletes an existing Brand 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 Brand model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return Brand the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if(( $model = Brand::find()->with('lang')->where(['id' => $id])->one() ) !== NULL) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/controllers/CategoryController.php b/controllers/CategoryController.php new file mode 100755 index 0000000..34b97eb --- /dev/null +++ b/controllers/CategoryController.php @@ -0,0 +1,235 @@ + [ + 'class' => AccessBehavior::className(), + 'rules' => [ + 'site' => [ + [ + 'actions' => [ + 'login', + 'error', + ], + 'allow' => true, + ], + ], + ], + ], + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'logout' => [ 'post' ], + ], + ], + ]; + } + + /** + * Lists all Category models. + * + * @return mixed + */ + public function actionIndex() + { + $searchModel = new CategorySearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ] + ); + } + + /** + * Displays a single Category model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + $model = $this->findModel($id); + $tree = $model->getParents() + ->with('lang') + ->all(); + return $this->render( + 'view', + [ + 'model' => $model, + 'tree' => $tree, + ] + ); + } + + /** + * Creates a new Category model. + * If creation is successful, the browser will be redirected to the 'view' page. + * + * @return mixed + */ + public function actionCreate() + { + $model = new Category(); + $model->generateLangs(); + if ($model->load(Yii::$app->request->post())) { + $model->loadLangs(\Yii::$app->request); + if ($model->save() && $model->transactionStatus) { + return is_null(Yii::$app->request->post('create_and_new')) ? $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ) : $this->redirect(array_merge([ 'create' ], Yii::$app->request->queryParams)); + } + } + if (!empty( Yii::$app->request->queryParams[ 'parent' ] )) { + $model->parent_id = Yii::$app->request->queryParams[ 'parent' ]; + } + + $parents = ArrayHelper::map( + Category::find() + ->joinWith('lang') + ->asArray() + ->all(), + 'id', + 'lang.title' + ); + + return $this->render( + 'create', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'categories' => ArtboxTreeHelper::treeMap( + Category::find() + ->getTree(), + 'id', + 'id', + '.' + ), + 'parents' => $parents, + ] + ); + } + + /** + * Updates an existing Category 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(); + if ($model->load(Yii::$app->request->post())) { + $model->loadLangs(\Yii::$app->request); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } + } + + $parents = ArrayHelper::map( + Category::find() + ->joinWith('lang') + ->where( + [ + '!=', + 'id', + $model->id, + ] + ) + ->asArray() + ->all(), + 'id', + 'lang.title' + ); + + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'categories' => ArtboxTreeHelper::treeMap( + Category::find() + ->getTree(), + 'id', + 'id', + '.' + ), + 'parents' => $parents, + ] + ); + } + + /** + * Deletes an existing Category 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 Category model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return Category the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (( $model = Category::find() + ->where([ 'id' => $id ]) + ->with('lang') + ->one() ) !== NULL + ) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/controllers/DeliveryController.php b/controllers/DeliveryController.php new file mode 100755 index 0000000..ddf3668 --- /dev/null +++ b/controllers/DeliveryController.php @@ -0,0 +1,164 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + ]; + } + + /** + * Lists all Delivery models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new DeliverySearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'dataProvider' => $dataProvider, + 'searchModel' => $searchModel, + ]); + } + + /** + * Displays a single Delivery model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Delivery model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Delivery(); + $model->generateLangs(); + $parent_items = Delivery::find() + ->with('lang') + ->all(); + $parent_items = ArrayHelper::map($parent_items, 'id', 'lang.title'); + if($model->load(Yii::$app->request->post())) { + $model->loadLangs(\Yii::$app->request); + if($model->save() && $model->transactionStatus) { + return $this->redirect([ + 'view', + 'id' => $model->id, + ]); + } + } + return $this->render('create', [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'parent_items' => $parent_items, + ]); + } + + /** + * Updates an existing Delivery 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(); + $parent_items = Delivery::find() + ->with('lang') + ->all(); + $parent_items = ArrayHelper::map($parent_items, 'id', 'lang.title'); + + if($model->load(Yii::$app->request->post())) { + $model->loadLangs(\Yii::$app->request); + if($model->save() && $model->transactionStatus) { + return $this->redirect([ + 'view', + 'id' => $model->id, + ]); + } + } + return $this->render('update', [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'parent_items' => $parent_items, + ]); + } + + /** + * Deletes an existing Delivery 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 Delivery model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return Delivery the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if(( $model = Delivery::find() + ->with('parent') + ->where([ + 'id' => $id, + ]) + ->one() ) !== NULL + ) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/controllers/LabelController.php b/controllers/LabelController.php new file mode 100755 index 0000000..ad9880e --- /dev/null +++ b/controllers/LabelController.php @@ -0,0 +1,150 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + ]; + } + + /** + * Lists all Label models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new LabelSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Label model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Label model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Label(); + $model->generateLangs(); + + if($model->load(Yii::$app->request->post())) { + $model->loadLangs(\Yii::$app->request); + if($model->save() && $model->transactionStatus) { + return $this->redirect([ + 'view', + 'id' => $model->id, + ]); + } + } + return $this->render('create', [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ]); + + } + + /** + * Updates an existing Label 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(); + + if($model->load(Yii::$app->request->post())) { + $model->loadLangs(\Yii::$app->request); + if($model->save() && $model->transactionStatus) { + return $this->redirect([ + 'view', + 'id' => $model->id, + ]); + } + } + return $this->render('update', [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ]); + + } + + /** + * Deletes an existing Label 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 Label model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return Label the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if(( $model = Label::findOne($id) ) !== NULL) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/models/Label.php b/models/Label.php new file mode 100755 index 0000000..bd2128d --- /dev/null +++ b/models/Label.php @@ -0,0 +1,65 @@ + [ + 'class' => LanguageBehavior::className(), + 'objectLang' => OrderLabelLang::className(), + 'ownerKey' => 'id', + 'langKey' => 'order_label_id', + ], + ]; + } + } diff --git a/models/LabelSearch.php b/models/LabelSearch.php new file mode 100755 index 0000000..0a10916 --- /dev/null +++ b/models/LabelSearch.php @@ -0,0 +1,110 @@ +joinWith('lang'); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'id', + 'label', + 'title' => [ + 'asc' => [ 'order_label_lang.title' => SORT_ASC ], + 'desc' => [ 'order_label_lang.title' => SORT_DESC ], + ], + ], + ], + ] + ); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere( + [ + 'id' => $this->id, + ] + ); + + $query->andFilterWhere( + [ + 'like', + 'label', + $this->label, + ] + ) + ->andFilterWhere( + [ + 'like', + 'order_label_lang.title', + $this->title, + ] + ); + + return $dataProvider; + } + } diff --git a/models/OrderLabelLang.php b/models/OrderLabelLang.php new file mode 100755 index 0000000..0ebdc99 --- /dev/null +++ b/models/OrderLabelLang.php @@ -0,0 +1,108 @@ + 255, + ], + [ + [ + 'order_label_id', + 'language_id', + ], + 'unique', + 'targetAttribute' => [ + 'order_label_id', + 'language_id', + ], + 'message' => 'The combination of order Label ID and Language ID has already been taken.', + ], + [ + [ 'language_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Language::className(), + 'targetAttribute' => [ 'language_id' => 'id' ], + ], + [ + [ 'order_label_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Label::className(), + 'targetAttribute' => [ 'order_label_id' => 'id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'order_label_id' => Yii::t('app', 'order Label ID'), + 'language_id' => Yii::t('app', 'Language ID'), + 'title' => Yii::t('app', 'Name'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLanguage() + { + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLabel() + { + return $this->hasOne(Label::className(), [ 'id' => 'order_label_id' ]); + } + } diff --git a/views/brand/_form.php b/views/brand/_form.php new file mode 100755 index 0000000..d7ba90e --- /dev/null +++ b/views/brand/_form.php @@ -0,0 +1,66 @@ + + +
+ + false, + 'options' => [ 'enctype' => 'multipart/form-data' ], + ]); ?> + + field($model, 'image') + ->widget(\kartik\file\FileInput::className(), [ + 'language' => 'ru', + 'options' => [ + 'accept' => 'image/*', + 'multiple' => false, + ], + 'pluginOptions' => [ + 'allowedFileExtensions' => [ + 'jpg', + 'gif', + 'png', + ], + 'initialPreview' => !empty( $model->imageUrl ) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '', + 'overwriteInitial' => true, + 'showRemove' => false, + 'showUpload' => false, + 'previewFileType' => 'image', + ], + ]); ?> + + field($model, 'in_menu')->dropDownList([\Yii::t('product', 'No'), \Yii::t('product', 'Yes')]); ?> + + $modelLangs, + 'formView' => '@backend/views/brand/_form_language', + 'form' => $form, + ]) ?> + +
+ isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> + isNewRecord) : ?> + 'create_and_new', + 'class' => 'btn btn-primary', + ]) ?> + +
+ + + +
diff --git a/views/brand/_form_language.php b/views/brand/_form_language.php new file mode 100755 index 0000000..9d4d675 --- /dev/null +++ b/views/brand/_form_language.php @@ -0,0 +1,30 @@ + +field($model_lang, '[' . $language->id . ']title') + ->textInput([ 'maxlength' => true ]); ?> + +field($model_lang, '[' . $language->id . ']alias') + ->textInput([ 'maxlength' => true ]); ?> + +field($model_lang, '[' . $language->id . ']meta_title') + ->textInput([ 'maxlength' => true ]) ?> + +field($model_lang, '[' . $language->id . ']meta_robots') + ->textInput([ 'maxlength' => true ]) ?> + +field($model_lang, '[' . $language->id . ']meta_description') + ->textInput([ 'maxlength' => true ]) ?> + +field($model_lang, '[' . $language->id . ']seo_text') + ->textarea([ 'rows' => 6 ]) ?> diff --git a/views/brand/create.php b/views/brand/create.php new file mode 100755 index 0000000..693b80b --- /dev/null +++ b/views/brand/create.php @@ -0,0 +1,30 @@ +title = Yii::t('product', 'Create Brand'); + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('product', 'Brands'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + 'modelLangs' => $modelLangs, + ]) ?> + +
diff --git a/views/brand/index.php b/views/brand/index.php new file mode 100755 index 0000000..0e2d0be --- /dev/null +++ b/views/brand/index.php @@ -0,0 +1,51 @@ +title = Yii::t('product', 'Brands'); + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
+ +

title) ?>

+ +

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

+ $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + 'id', + [ + 'attribute' => 'brandName', + 'value' => 'lang.title', + ], + 'imageUrl:image', + [ + 'attribute' => 'in_menu', + 'content' => function($model) { + /** + * @var Brand $model + */ + return Html::tag('span', '', [ + 'class' => 'glyphicon glyphicon-'.($model->in_menu?'ok':'remove'), + ]); + }, + ], + [ 'class' => 'yii\grid\ActionColumn', + ], + ], + ]); ?> +
diff --git a/views/brand/update.php b/views/brand/update.php new file mode 100755 index 0000000..e52b4f3 --- /dev/null +++ b/views/brand/update.php @@ -0,0 +1,39 @@ +title = Yii::t('product', 'Update {modelClass}: ', [ + 'modelClass' => 'Brand', + ]) . ' ' . $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('product', 'Brands'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $model->lang->title, + 'url' => [ + 'view', + 'id' => $model->id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = Yii::t('product', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + 'modelLangs' => $modelLangs, + ]) ?> + +
diff --git a/views/brand/view.php b/views/brand/view.php new file mode 100755 index 0000000..74e2556 --- /dev/null +++ b/views/brand/view.php @@ -0,0 +1,62 @@ +title = $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('product', 'Brands'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
+ +

title) ?>

+ +

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

+ + $model, + 'attributes' => [ + 'id', + 'lang.title', + 'lang.alias', + [ + 'attribute' => 'in_menu', + 'value' => Html::tag('span', '', [ + 'class' => 'glyphicon glyphicon-' . ( $model->in_menu ? 'ok' : 'remove' ), + ]), + 'format' => 'html', + ], + 'imageUrl:image', + 'lang.meta_title', + 'lang.meta_robots', + 'lang.meta_description', + 'lang.seo_text', + ], + ]) ?> + +
diff --git a/views/category/_form.php b/views/category/_form.php new file mode 100755 index 0000000..fdfd031 --- /dev/null +++ b/views/category/_form.php @@ -0,0 +1,97 @@ + + +
+ + false, + 'options' => [ 'enctype' => 'multipart/form-data' ], + ] + ); ?> + + field($model, 'parent_id') + ->dropDownList( + $parents, + [ + 'prompt' => Yii::t('rubrication', 'Root category'), + 'options' => [ + $model->id => [ 'disabled' => true ], + ], + ] + ) + ->label(Yii::t('product', 'Parent category')) ?> + + field($model, 'image') + ->widget( + \kartik\file\FileInput::className(), + [ + 'language' => 'ru', + 'options' => [ + 'accept' => 'image/*', + 'multiple' => false, + ], + 'pluginOptions' => [ + 'allowedFileExtensions' => [ + 'jpg', + 'gif', + 'png', + ], + 'initialPreview' => !empty( $model->imageUrl ) ? \common\components\artboximage\ArtboxImageHelper::getImage( + $model->imageUrl, + 'list' + ) : '', + 'overwriteInitial' => true, + 'showRemove' => false, + 'showUpload' => false, + 'previewFileType' => 'image', + ], + ] + ) + ->hint( + 'Для корректного отображения на сайте, размер изображения должен быть 262x144 либо соблюдать соотношение сторон примерно 2:1' + ); ?> + + $modelLangs, + 'formView' => '@backend/views/category/_form_language', + 'form' => $form, + ] + ) ?> + +
+ isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] + ) ?> + isNewRecord) : ?> + 'create_and_new', + 'class' => 'btn btn-primary', + ] + ) ?> + +
+ + + +
diff --git a/views/category/_form_language.php b/views/category/_form_language.php new file mode 100755 index 0000000..4f015d5 --- /dev/null +++ b/views/category/_form_language.php @@ -0,0 +1,33 @@ + +field($model_lang, '[' . $language->id . ']title') + ->textInput([ 'maxlength' => true ]); ?> + +field($model_lang, '[' . $language->id . ']alias') + ->textInput([ 'maxlength' => true ]); ?> + +field($model_lang, '[' . $language->id . ']meta_title') + ->textInput([ 'maxlength' => true ]) ?> + +field($model_lang, '[' . $language->id . ']meta_robots') + ->textInput([ 'maxlength' => true ]) ?> + +field($model_lang, '[' . $language->id . ']meta_description') + ->textInput([ 'maxlength' => true ]) ?> + +field($model_lang, '[' . $language->id . ']seo_text') + ->textarea([ 'rows' => 6 ]) ?> + +field($model_lang, '[' . $language->id . ']h1') + ->textInput([ 'maxlength' => true ]) ?> \ No newline at end of file diff --git a/views/category/create.php b/views/category/create.php new file mode 100755 index 0000000..ff49f7e --- /dev/null +++ b/views/category/create.php @@ -0,0 +1,37 @@ +title = Yii::t('product', 'Create Category'); + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('product', 'Categories'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
+ +

title) ?>

+ + render( + '_form', + [ + 'model' => $model, + 'modelLangs' => $modelLangs, + 'categories' => $categories, + 'parents' => $parents, + ] + ) ?> + +
diff --git a/views/category/index.php b/views/category/index.php new file mode 100755 index 0000000..64b0d3f --- /dev/null +++ b/views/category/index.php @@ -0,0 +1,52 @@ +title = Yii::t('product', 'Categories'); + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
+ +

title) ?>

+ +

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

+ $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], + 'id', + [ + 'attribute' => 'categoryName', + 'content' => function($data) { + /** + * @var Category $data + */ + $op = []; + foreach($data->getParents()->with('lang') + ->all() as $parent) { + $op[] = $parent->lang->title; + } + $op[] = $data->lang->title; + return implode(' → ', $op); + }, + ], + 'imageUrl:image', + [ + 'class' => 'yii\grid\ActionColumn', + ], + ], + 'panel' => [ + 'type' => 'success', + ], + ]); ?> +
diff --git a/views/category/update.php b/views/category/update.php new file mode 100755 index 0000000..07cc108 --- /dev/null +++ b/views/category/update.php @@ -0,0 +1,50 @@ +title = Yii::t( + 'product', + 'Update {modelClass}: ', + [ + 'modelClass' => 'Category', + ] + ) . ' ' . $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('product', 'Categories'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $model->lang->title, + 'url' => [ + 'view', + 'id' => $model->id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = Yii::t('product', 'Update'); +?> +
+ +

title) ?>

+ + render( + '_form', + [ + 'model' => $model, + 'modelLangs' => $modelLangs, + 'categories' => $categories, + 'parents' => $parents, + ] + ) ?> + +
diff --git a/views/category/view.php b/views/category/view.php new file mode 100755 index 0000000..4e63298 --- /dev/null +++ b/views/category/view.php @@ -0,0 +1,79 @@ +title = $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => Yii::t('product', 'Categories'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; + $tree_links = []; + foreach($tree as $item) { + $tree_links[] = Html::a($item->lang->title, [ + 'view', + 'id' => $item->id, + ]); + } + if(empty($tree_links)) { + $tree_string = \Yii::t('product', 'No parent categories'); + } else { + $tree_string = implode(' → ', $tree_links); + } +?> +
+ +

title) ?>

+ +

+ $model->id, + ], [ 'class' => 'btn btn-primary' ]) ?> + $model->id, + ], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> + 'btn btn-success' ]) ?> + parent_id )) { + echo Html::a(Yii::t('product', 'Create category By {title}', [ 'title' => $model->parent->lang->title ]), [ 'category/create?parent=' . $model->parent->id ], [ 'class' => 'btn btn-success' ]); + } + ?> +

+ + $model, + 'attributes' => [ + 'id', + [ + 'label' => \Yii::t('product', 'Category tree'), + 'value' => $tree_string, + 'format' => 'html', + ], + 'imageUrl:image', + 'lang.alias', + 'lang.meta_title', + 'lang.meta_robots', + 'lang.meta_description', + 'lang.seo_text', + 'lang.h1', + ], + ]) ?> + +
diff --git a/views/delivery/_form.php b/views/delivery/_form.php new file mode 100755 index 0000000..73bf0f0 --- /dev/null +++ b/views/delivery/_form.php @@ -0,0 +1,43 @@ + + +
+ + + + field($model, 'parent_id') + ->dropDownList($parent_items, [ + 'prompt' => "Выберите вид доставки..." + ]) ?> + + field($model, 'value') + ->textInput() ?> + + field($model, 'sort') + ->textInput() ?> + + $modelLangs, + 'formView' => '@backend/views/delivery/_form_language', + 'form' => $form, + ]) ?> + +
+ isNewRecord ? 'Create' : 'Update', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> +
+ + + +
diff --git a/views/delivery/_form_language.php b/views/delivery/_form_language.php new file mode 100755 index 0000000..2f0795a --- /dev/null +++ b/views/delivery/_form_language.php @@ -0,0 +1,18 @@ + +field($model_lang, '[' . $language->id . ']title') + ->textInput([ 'maxlength' => true ]); ?> + +field($model_lang, '[' . $language->id . ']text') + ->textarea(); ?> diff --git a/views/delivery/create.php b/views/delivery/create.php new file mode 100755 index 0000000..16cc8fc --- /dev/null +++ b/views/delivery/create.php @@ -0,0 +1,32 @@ +title = \Yii::t('product', 'Create Delivery'); + $this->params[ 'breadcrumbs' ][] = [ + 'label' => \Yii::t('product', 'Deliveries'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + 'modelLangs' => $modelLangs, + 'parent_items' => $parent_items, + ]) ?> + +
diff --git a/views/delivery/index.php b/views/delivery/index.php new file mode 100755 index 0000000..d0568cf --- /dev/null +++ b/views/delivery/index.php @@ -0,0 +1,43 @@ +title = 'Deliveries'; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
+ +

title) ?>

+ +

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

+ $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + + 'id', + [ + 'attribute' => 'title', + 'value' => 'lang.title', + ], + [ + 'attribute' => 'parentTitle', + 'value' => 'parent.lang.title', + ], + 'value', + [ 'class' => 'yii\grid\ActionColumn' ], + ], + ]); ?> +
diff --git a/views/delivery/update.php b/views/delivery/update.php new file mode 100755 index 0000000..636c948 --- /dev/null +++ b/views/delivery/update.php @@ -0,0 +1,39 @@ +title = 'Update Delivery: ' . $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Deliveries', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $model->lang->title, + 'url' => [ + 'view', + 'id' => $model->id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = 'Update'; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + 'modelLangs' => $modelLangs, + 'parent_items' => $parent_items, + ]) ?> + +
diff --git a/views/delivery/view.php b/views/delivery/view.php new file mode 100755 index 0000000..5d7e28b --- /dev/null +++ b/views/delivery/view.php @@ -0,0 +1,65 @@ +title = $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Deliveries', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; + + $parent_link = ''; + if(!empty( $model->parent )) { + $parent_link = Html::a($model->parent->lang->title, [ + 'view', + 'id' => $model->parent->id, + ]); + } +?> +
+ +

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', + [ + 'label' => 'Вид доставки', + 'value' => $parent_link, + 'format' => 'html', + ], + 'lang.title', + 'lang.text', + 'value', + 'sort', + ], + ]) ?> + +
diff --git a/views/label/_form.php b/views/label/_form.php new file mode 100755 index 0000000..8a2a553 --- /dev/null +++ b/views/label/_form.php @@ -0,0 +1,36 @@ + + +
+ + + + field($model, 'label')->textInput(['maxlength' => true]) ?> + + $modelLangs, + 'formView' => '@backend/views/label/_form_language', + 'form' => $form, + ]) ?> + +
+ isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/views/label/_form_language.php b/views/label/_form_language.php new file mode 100755 index 0000000..5709fd1 --- /dev/null +++ b/views/label/_form_language.php @@ -0,0 +1,15 @@ + +field($model_lang, '[' . $language->id . ']title') + ->textInput([ 'maxlength' => true ]); ?> diff --git a/views/label/create.php b/views/label/create.php new file mode 100755 index 0000000..ea2e56a --- /dev/null +++ b/views/label/create.php @@ -0,0 +1,27 @@ +title = 'Create Label'; +$this->params['breadcrumbs'][] = ['label' => 'Labels', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + 'modelLangs' => $modelLangs, + ]) ?> + +
diff --git a/views/label/index.php b/views/label/index.php new file mode 100755 index 0000000..a4f9d03 --- /dev/null +++ b/views/label/index.php @@ -0,0 +1,39 @@ +title = 'Labels'; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

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

+ $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + 'id', + 'label', + [ + 'attribute' => 'title', + 'value' => 'lang.title', + ], + [ 'class' => 'yii\grid\ActionColumn' ], + ], + ]); ?> +
diff --git a/views/label/update.php b/views/label/update.php new file mode 100755 index 0000000..30712b1 --- /dev/null +++ b/views/label/update.php @@ -0,0 +1,37 @@ +title = 'Update Label: ' . $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Labels', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $model->lang->title, + 'url' => [ + 'view', + 'id' => $model->id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = 'Update'; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + 'modelLangs' => $modelLangs, + ]) ?> + +
diff --git a/views/label/view.php b/views/label/view.php new file mode 100755 index 0000000..f517a6f --- /dev/null +++ b/views/label/view.php @@ -0,0 +1,53 @@ +title = $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Labels', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $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', + 'label', + [ + 'label' => 'Name', + 'value' => $model->lang->title, + ], + ], + ]) ?> + +
diff --git a/views/manage/_form.php b/views/manage/_form.php index 7a9af09..535a184 100755 --- a/views/manage/_form.php +++ b/views/manage/_form.php @@ -125,7 +125,7 @@ $modelLangs, - 'formView' => '@common/modules/product/views/manage/_form_language', + 'formView' => '@artweb/artbox/ecommerce/views/manage/_form_language', 'form' => $form, ] ) ?> diff --git a/views/product-unit/_form.php b/views/product-unit/_form.php index 2920d09..a2ab0ce 100755 --- a/views/product-unit/_form.php +++ b/views/product-unit/_form.php @@ -25,7 +25,7 @@ $modelLangs, 'form' => $form, - 'formView' => '@common/modules/product/views/product-unit/_form_language', + 'formView' => '@artweb/artbox/ecommerce/views/product-unit/_form_language', ]) ?>
diff --git a/views/tax-group/_form.php b/views/tax-group/_form.php index 9815d4c..89a6eb6 100755 --- a/views/tax-group/_form.php +++ b/views/tax-group/_form.php @@ -42,7 +42,7 @@ $modelLangs, - 'formView' => '@common/modules/rubrication/views/tax-group/_form_language', + 'formView' => '@artweb/artbox/ecommerce/views/tax-group/_form_language', 'form' => $form, ]); ?> diff --git a/views/tax-option/_form.php b/views/tax-option/_form.php index f471e5b..53fa991 100755 --- a/views/tax-option/_form.php +++ b/views/tax-option/_form.php @@ -75,7 +75,7 @@ echo LanguageForm::widget( [ 'modelLangs' => $modelLangs, - 'formView' => '@common/modules/rubrication/views/tax-option/_form_language', + 'formView' => '@artweb/artbox/ecommerce/views/tax-option/_form_language', 'form' => $form, ] ); diff --git a/views/variant/_form.php b/views/variant/_form.php index 2f3169b..00bf20b 100755 --- a/views/variant/_form.php +++ b/views/variant/_form.php @@ -87,7 +87,7 @@ $(".dynamicform_wrapper").on("limitReached", function(e, item) { $modelLangs, - 'formView' => '@common/modules/product/views/variant/_form_language', + 'formView' => '@artweb/artbox/ecommerce/views/variant/_form_language', 'form' => $form, ] ) ?> -- libgit2 0.21.4