diff --git a/backend/controllers/CurrencyController.php b/backend/controllers/CurrencyController.php
index 61c59a8..efd27fd 100755
--- a/backend/controllers/CurrencyController.php
+++ b/backend/controllers/CurrencyController.php
@@ -5,6 +5,7 @@ namespace backend\controllers;
use Yii;
use common\models\Currency;
use common\models\CurrencySearch;
+use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
@@ -50,11 +51,13 @@ class CurrencyController extends Controller
*/
public function actionIndex()
{
- $searchModel = new CurrencySearch();
- $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+ $dataProvider = new ActiveDataProvider([
+ 'query' => Currency::find(),
+ 'sort' => false,
+
+ ]);
return $this->render('index', [
- 'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
diff --git a/backend/models/Currency.php b/backend/models/Currency.php
deleted file mode 100755
index 819067c..0000000
--- a/backend/models/Currency.php
+++ /dev/null
@@ -1,55 +0,0 @@
- 50],
- [['name'], 'unique'],
- [['is_default'], 'unique']
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'name' => 'Name',
- 'rate' => 'Rate',
- 'is_default' => 'Is Default',
- 'timestamp' => 'Timestamp',
- ];
- }
-}
diff --git a/backend/views/currency/_form.php b/backend/views/currency/_form.php
index 79a296c..2c95ed2 100755
--- a/backend/views/currency/_form.php
+++ b/backend/views/currency/_form.php
@@ -17,7 +17,7 @@ use yii\widgets\ActiveForm;
= $form->field($model, 'rate')->textInput() ?>
- = Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
+ = Html::submitButton($model->isNewRecord ? 'Добавить' : 'Обновить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
diff --git a/backend/views/currency/create.php b/backend/views/currency/create.php
index 1f35158..83e6dd9 100755
--- a/backend/views/currency/create.php
+++ b/backend/views/currency/create.php
@@ -6,7 +6,7 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Currency */
-$this->title = 'Create Currency';
+$this->title = 'Добавить валюту';
$this->params['breadcrumbs'][] = ['label' => 'Currencies', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
@@ -18,4 +18,5 @@ $this->params['breadcrumbs'][] = $this->title;
'model' => $model,
]) ?>
+ = Html::a('Вернуться', ['index'], ['class' => 'btn btn-primary']) ?>
diff --git a/backend/views/currency/index.php b/backend/views/currency/index.php
index 7f2a2cb..e9aa22d 100755
--- a/backend/views/currency/index.php
+++ b/backend/views/currency/index.php
@@ -7,7 +7,7 @@ use yii\grid\GridView;
/* @var $searchModel common\models\CurrencySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
-$this->title = 'Currencies';
+$this->title = 'Курс валют';
$this->params['breadcrumbs'][] = $this->title;
?>
@@ -16,20 +16,18 @@ $this->params['breadcrumbs'][] = $this->title;
render('_search', ['model' => $searchModel]); ?>
- = Html::a('Create Currency', ['create'], ['class' => 'btn btn-success']) ?>
+ = Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
= GridView::widget([
'dataProvider' => $dataProvider,
- 'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
-
'name',
'rate',
'timestamp',
-
- ['class' => 'yii\grid\ActionColumn'],
+ ['class' => 'yii\grid\ActionColumn',
+ 'template' => '{update}'],
],
]); ?>
diff --git a/backend/views/currency/update.php b/backend/views/currency/update.php
index 004ef97..1faea2d 100755
--- a/backend/views/currency/update.php
+++ b/backend/views/currency/update.php
@@ -5,7 +5,7 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Currency */
-$this->title = 'Update Currency: ' . ' ' . $model->name;
+$this->title = 'Обновить валюту: ' . ' ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Currencies', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
@@ -18,4 +18,5 @@ $this->params['breadcrumbs'][] = 'Update';
'model' => $model,
]) ?>
+ = Html::a('Вернуться', ['index'], ['class' => 'btn btn-primary']) ?>
diff --git a/backend/views/importers/_form.php b/backend/views/importers/_form.php
index d3d6c60..7469f81 100755
--- a/backend/views/importers/_form.php
+++ b/backend/views/importers/_form.php
@@ -3,7 +3,7 @@
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
-use backend\models\Currency;
+use common\models\Currency;
/* @var $this yii\web\View */
/* @var $model backend\models\Importers */
diff --git a/backend/views/layouts/column.php b/backend/views/layouts/column.php
index bb6f654..a0b0b89 100755
--- a/backend/views/layouts/column.php
+++ b/backend/views/layouts/column.php
@@ -325,7 +325,6 @@ $this->beginContent('@app/views/layouts/main.php');
['label' => 'Vin коды', 'url' => ['currency/index']],
['label' => 'Запросы по номеру', 'url' => ['currency/index']],
['label' => 'Офисы', 'url' => ['offices/index']],
- ['label' => 'Валюты', 'url' => ['currency/index']],
],
],
['label' => 'Анализ', 'url' => ['#'], 'items' => [
diff --git a/common/models/Currency.php b/common/models/Currency.php
index db06b0b..555f3f5 100755
--- a/common/models/Currency.php
+++ b/common/models/Currency.php
@@ -30,7 +30,9 @@ class Currency extends \yii\db\ActiveRecord
{
return [
[['name', 'rate'], 'required'],
- [['rate'], 'number'],
+ [['rate'], 'filter','filter' => function($value){
+ return (float) str_replace( ',', '.', $value );}
+ ],
[['is_default'], 'integer'],
[['timestamp'], 'safe'],
[['name'], 'string', 'max' => 50],
--
libgit2 0.21.4