diff --git a/backend/views/delivery/create.php b/backend/views/delivery/create.php
index 1f54616..4f0a208 100755
--- a/backend/views/delivery/create.php
+++ b/backend/views/delivery/create.php
@@ -1,22 +1,31 @@
title = 'Create Delivery';
-$this->params['breadcrumbs'][] = ['label' => 'Deliveries', 'url' => ['index']];
-$this->params['breadcrumbs'][] = $this->title;
+
+ use common\models\Delivery;
+ use common\models\OrdersDeliveryLang;
+ use yii\helpers\Html;
+ use yii\web\View;
+
+ /**
+ * @var View $this
+ * @var Delivery $model
+ * @var OrdersDeliveryLang[] $model_langs
+ * @var array $parent_items
+ */
+
+ $this->title = \Yii::t('product', 'Create Delivery');
+ $this->params[ 'breadcrumbs' ][] = [
+ 'label' => \Yii::t('product', 'Deliveries'),
+ 'url' => [ 'index' ],
+ ];
+ $this->params[ 'breadcrumbs' ][] = $this->title;
?>
-
+
= Html::encode($this->title) ?>
-
+
= $this->render('_form', [
- 'model' => $model,
- 'model_langs' => $model_langs,
+ 'model' => $model,
+ 'model_langs' => $model_langs,
'parent_items' => $parent_items,
]) ?>
diff --git a/common/modules/product/controllers/ProductUnitController.php b/common/modules/product/controllers/ProductUnitController.php
index 960b618..1977d40 100755
--- a/common/modules/product/controllers/ProductUnitController.php
+++ b/common/modules/product/controllers/ProductUnitController.php
@@ -137,7 +137,11 @@
*/
protected function findModel($id)
{
- if(( $model = ProductUnit::findOne($id) ) !== NULL) {
+ if(( $model = ProductUnit::find()
+ ->where([ 'product_unit_id' => $id ])
+ ->with('lang')
+ ->one() ) !== NULL
+ ) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
diff --git a/common/modules/product/models/ProductUnitSearch.php b/common/modules/product/models/ProductUnitSearch.php
index 4ccadee..d920aa8 100755
--- a/common/modules/product/models/ProductUnitSearch.php
+++ b/common/modules/product/models/ProductUnitSearch.php
@@ -1,72 +1,109 @@
$query,
- ]);
-
- $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');
+
+ public $name;
+
+ public function behaviors()
+ {
+ return [];
+ }
+
+ public function attributeLabels()
+ {
+ $labels = parent::attributeLabels();
+ $new_labels = [
+ 'name' => \Yii::t('product', 'Product Unit Name'),
+ ];
+ return array_merge($labels, $new_labels);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function rules()
+ {
+ return [
+ [
+ [ 'name' ],
+ 'safe',
+ ],
+ [
+ [ 'product_unit_id' ],
+ 'integer',
+ ],
+ [
+ [ 'is_default' ],
+ 'boolean',
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function scenarios()
+ {
+ // bypass scenarios() implementation in the parent class
+ return Model::scenarios();
+ }
+
+ /**
+ * Creates data provider instance with search query applied
+ *
+ * @param array $params
+ *
+ * @return ActiveDataProvider
+ */
+ public function search($params)
+ {
+ $query = ProductUnit::find()->joinWith('lang');
+
+ // add conditions that should always apply here
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ 'sort' => [
+ 'attributes' => [
+ 'product_unit_id',
+ 'is_defaut',
+ 'name' => [
+ 'asc' => [ 'product_unit_lang.name' => SORT_ASC ],
+ 'desc' => [ 'product_unit_lang.name' => 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([
+ 'product_unit_id' => $this->product_unit_id,
+ 'is_default' => $this->is_default,
+ ])
+ ->andFilterWhere([
+ 'ilike',
+ 'product_unit_lang.name',
+ $this->name,
+ ]);
+
return $dataProvider;
}
-
- // grid filtering conditions
- $query->andFilterWhere([
- 'product_unit_id' => $this->product_unit_id,
- 'is_default' => $this->is_default,
- ]);
-
- return $dataProvider;
}
-}
diff --git a/common/modules/product/views/manage/export-process.php b/common/modules/product/views/manage/export-process.php
index ac250ed..1ec16d0 100755
--- a/common/modules/product/views/manage/export-process.php
+++ b/common/modules/product/views/manage/export-process.php
@@ -3,10 +3,7 @@
* @var View $this
*/
-use yii\helpers\Html;
use yii\web\View;
- use yii\widgets\ActiveForm;
-
?>
registerJs("var in_process=true;
@@ -102,5 +99,5 @@ $this->registerJs("var in_process=true;
],
]);?>
-
Получай ВАСЯ!
+
diff --git a/common/modules/product/views/manage/export.php b/common/modules/product/views/manage/export.php
index 7338173..80018d7 100755
--- a/common/modules/product/views/manage/export.php
+++ b/common/modules/product/views/manage/export.php
@@ -37,21 +37,8 @@
->indexBy('language_id')
->column()) ?>
- field($model, 'file')->widget(\kartik\file\FileInput::classname(), [
- 'language' => 'ru',
- 'options' => [
- 'multiple' => false,
- ],
- 'pluginOptions' => [
- 'allowedFileExtensions' => ['csv'],
- 'overwriteInitial' => true,
- 'showRemove' => false,
- 'showUpload' => false,
- ],
- ])*/ ?>
-
- = Html::submitButton(Yii::t('product', 'Import'), [ 'class' => 'btn btn-primary' ]) ?>
+ = Html::submitButton(Yii::t('product', 'Export'), [ 'class' => 'btn btn-success' ]) ?>
diff --git a/common/modules/product/views/product-unit/index.php b/common/modules/product/views/product-unit/index.php
index fab830e..f3e67e4 100755
--- a/common/modules/product/views/product-unit/index.php
+++ b/common/modules/product/views/product-unit/index.php
@@ -1,11 +1,16 @@
title = Yii::t('product', 'Product Units');
$this->params[ 'breadcrumbs' ][] = $this->title;
@@ -21,9 +26,17 @@
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
- [ 'class' => 'yii\grid\SerialColumn' ],
'product_unit_id',
- 'is_default:boolean',
+ [
+ 'attribute' => 'is_default',
+ 'format' => 'boolean',
+ 'filter' => [\Yii::$app->formatter->asBoolean(false), \Yii::$app->formatter->asBoolean(true)],
+ ],
+ [
+ 'attribute' => 'name',
+ 'value' => 'lang.name',
+ ],
+ 'lang.short',
[ 'class' => 'yii\grid\ActionColumn' ],
],
]); ?>
diff --git a/common/modules/product/views/product-unit/update.php b/common/modules/product/views/product-unit/update.php
index 36e7ddb..0c676b8 100755
--- a/common/modules/product/views/product-unit/update.php
+++ b/common/modules/product/views/product-unit/update.php
@@ -13,13 +13,13 @@
$this->title = Yii::t('product', 'Update {modelClass}: ', [
'modelClass' => 'Product Unit',
- ]) . $model->product_unit_id;
+ ]) . $model->lang->name;
$this->params[ 'breadcrumbs' ][] = [
'label' => Yii::t('product', 'Product Units'),
'url' => [ 'index' ],
];
$this->params[ 'breadcrumbs' ][] = [
- 'label' => $model->product_unit_id,
+ 'label' => $model->lang->name,
'url' => [
'view',
'id' => $model->product_unit_id,
diff --git a/common/modules/product/views/product-unit/view.php b/common/modules/product/views/product-unit/view.php
index 6df4e49..0c29ac9 100755
--- a/common/modules/product/views/product-unit/view.php
+++ b/common/modules/product/views/product-unit/view.php
@@ -1,12 +1,16 @@
title = $model->product_unit_id;
+ $this->title = $model->lang->name;
$this->params[ 'breadcrumbs' ][] = [
'label' => Yii::t('product', 'Product Units'),
'url' => [ 'index' ],
@@ -39,6 +43,8 @@
'attributes' => [
'product_unit_id',
'is_default:boolean',
+ 'lang.name',
+ 'lang.short',
],
]) ?>
diff --git a/common/modules/rubrication/views/tax-group/index.php b/common/modules/rubrication/views/tax-group/index.php
index f9110ed..a196425 100755
--- a/common/modules/rubrication/views/tax-group/index.php
+++ b/common/modules/rubrication/views/tax-group/index.php
@@ -1,11 +1,15 @@
title = Yii::t('rubrication', 'Groups');
$this->params[ 'breadcrumbs' ][] = $this->title;
--
libgit2 0.21.4