diff --git a/backend/modules/balance/controllers/BalanceController.php b/backend/modules/balance/controllers/BalanceController.php
index 56332c7..f0f04d0 100755
--- a/backend/modules/balance/controllers/BalanceController.php
+++ b/backend/modules/balance/controllers/BalanceController.php
@@ -73,9 +73,17 @@ class BalanceController extends Controller
],
]);
+ $changeDataProvider = new ActiveDataProvider([
+ 'query' => \common\models\ChangeHistory::find()->where(['type_id' => $this->findModel($id)->id]),
+ 'pagination' => [
+ 'pageSize' => 200,
+ ]
+ ]);
+
return $this->render('view',[
'model' => $this->findModel($id),
- 'dataProviderF' => $dataProviderF
+ 'dataProviderF' => $dataProviderF,
+ 'changeDataProvider' => $changeDataProvider,
]);
}
diff --git a/backend/modules/balance/models/Balance.php b/backend/modules/balance/models/Balance.php
index 98556a8..def26ea 100755
--- a/backend/modules/balance/models/Balance.php
+++ b/backend/modules/balance/models/Balance.php
@@ -20,5 +20,12 @@ use yii\helpers\ArrayHelper;
*/
class Balance extends \common\models\Balance
{
-
+ public function behaviors()
+ {
+ return [
+ 'log' => [
+ 'class' => \common\behaviors\LogBehavior::class,
+ ]
+ ];
+ }
}
\ No newline at end of file
diff --git a/backend/modules/balance/views/balance/view.php b/backend/modules/balance/views/balance/view.php
index daf144a..5413d98 100755
--- a/backend/modules/balance/views/balance/view.php
+++ b/backend/modules/balance/views/balance/view.php
@@ -54,4 +54,16 @@ $this->params['breadcrumbs'][] = $this->title;
],
]); ?>
+
+
= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
@@ -20,17 +20,28 @@ $this->params['breadcrumbs'][] = $this->title;
]) ?>
-= DetailView::widget([
- 'model' => $model,
- 'attributes' => [
- [
- 'label' => 'ФИО',
- 'value' => function($model)
- {
- return $model->users->fio;
- },
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ [
+ 'label' => 'ФИО',
+ 'value' => function ($model) {
+ return $model->users->fio;
+ },
+ ],
+ 'dt_start',
+ 'dt_end'
],
- 'dt_start',
- 'dt_end'
- ],
-]) ?>
\ No newline at end of file
+ ]) ?>
+
История изменений
+
+ = \yii\grid\GridView::widget([
+ 'dataProvider' => $changeDataProvider,
+ 'columns' => [
+ 'label',
+ 'old_value',
+ 'new_value',
+ 'created_at',
+ ],
+ ]);
+ ?>
diff --git a/backend/modules/notes/controllers/NotesController.php b/backend/modules/notes/controllers/NotesController.php
index 74bff12..dcdaf2e 100755
--- a/backend/modules/notes/controllers/NotesController.php
+++ b/backend/modules/notes/controllers/NotesController.php
@@ -91,9 +91,17 @@ class NotesController extends Controller
],
]);
+ $changeDataProvider = new ActiveDataProvider([
+ 'query' => \common\models\ChangeHistory::find()->where(['type_id' => $this->findModel($id)->id]),
+ 'pagination' => [
+ 'pageSize' => 200,
+ ]
+ ]);
+
return $this->render('view', [
'model' => Note::findOne($id),
- 'additionalDataProvider' => $additionalDataProvider
+ 'additionalDataProvider' => $additionalDataProvider,
+ 'changeDataProvider' => $changeDataProvider,
]);
}
diff --git a/backend/modules/notes/models/Note.php b/backend/modules/notes/models/Note.php
index 4dc2258..1e5ce46 100755
--- a/backend/modules/notes/models/Note.php
+++ b/backend/modules/notes/models/Note.php
@@ -44,6 +44,15 @@ class Note extends \common\models\Note
}
}
+ public function behaviors()
+ {
+ return [
+ 'log' => [
+ 'class' => \common\behaviors\LogBehavior::class,
+ ]
+ ];
+ }
+
public function afterSave($insert, $changedAttributes)
{
$post = \Yii::$app->request->post('Note');
diff --git a/backend/modules/notes/views/notes/view.php b/backend/modules/notes/views/notes/view.php
index dc27b37..c250b9a 100755
--- a/backend/modules/notes/views/notes/view.php
+++ b/backend/modules/notes/views/notes/view.php
@@ -52,4 +52,16 @@ $this->params['breadcrumbs'][] = $this->title;
],
]); ?>
+
История изменений
+
+ = GridView::widget([
+ 'dataProvider' => $changeDataProvider,
+ 'columns' => [
+ 'label',
+ 'old_value',
+ 'new_value',
+ 'created_at',
+ ],
+ ]); ?>
+
diff --git a/backend/modules/project/controllers/ProjectController.php b/backend/modules/project/controllers/ProjectController.php
index 1cdd5c7..b19086c 100755
--- a/backend/modules/project/controllers/ProjectController.php
+++ b/backend/modules/project/controllers/ProjectController.php
@@ -98,11 +98,19 @@ class ProjectController extends Controller
],
]);
+ $changeDataProvider = new ActiveDataProvider([
+ 'query' => \common\models\ChangeHistory::find()->where(['type_id' => $this->findModel($id)->id]),
+ 'pagination' => [
+ 'pageSize' => 200,
+ ]
+ ]);
+
return $this->render('view', [
'model' => $model,
'modelFildValue' => $dataProvider,
'modelUser' => $dataProviderUser,
'jobsProvider' => $jobsProvider,
+ 'changeDataProvider' => $changeDataProvider,
]);
}
diff --git a/backend/modules/project/models/Project.php b/backend/modules/project/models/Project.php
index 57fc08a..7613189 100755
--- a/backend/modules/project/models/Project.php
+++ b/backend/modules/project/models/Project.php
@@ -53,6 +53,15 @@ class Project extends \common\models\Project
}
}
+
+ public function behaviors()
+ {
+ return [
+ 'log' => [
+ 'class' => \common\behaviors\LogBehavior::class,
+ ]
+ ];
+ }
public function afterSave($insert, $changedAttributes)
{
diff --git a/backend/modules/project/views/project/view.php b/backend/modules/project/views/project/view.php
index fbaabb4..8b4676d 100755
--- a/backend/modules/project/views/project/view.php
+++ b/backend/modules/project/views/project/view.php
@@ -104,4 +104,16 @@ $this->params['breadcrumbs'][] = $this->title;
],
]); ?>
+
+
История изменений
+
+ = GridView::widget([
+ 'dataProvider' => $changeDataProvider,
+ 'columns' => [
+ 'label',
+ 'old_value',
+ 'new_value',
+ 'created_at',
+ ],
+ ]); ?>
diff --git a/common/models/ChangeHistory.php b/common/models/ChangeHistory.php
index 1c9c96e..88cf463 100644
--- a/common/models/ChangeHistory.php
+++ b/common/models/ChangeHistory.php
@@ -25,4 +25,14 @@ class ChangeHistory extends \yii\db\ActiveRecord
{
}
+
+ public function afterFind()
+ {
+ parent::afterFind(); // TODO: Change the autogenerated stub
+ //milliseconds to date
+ if ($this->field_name == 'dt_start' || $this->field_name == 'dt_end' || $this->field_name == 'dt_add') {
+ $this->old_value = date('d-m-Y', $this->old_value);
+ $this->new_value = date('d-m-Y', $this->new_value);
+ }
+ }
}
\ No newline at end of file