reports fix
This commit is contained in:
parent
790077ce55
commit
047912c3a4
@ -88,7 +88,7 @@ class ReportsController extends Controller
|
|||||||
public function actionCalendar($user_id)
|
public function actionCalendar($user_id)
|
||||||
{
|
{
|
||||||
$searchModel = new ReportsSearch();
|
$searchModel = new ReportsSearch();
|
||||||
$searchModel->user_card_id = $user_id;
|
$searchModel->user_id = $user_id;
|
||||||
$dataProvider = $searchModel->search([]);
|
$dataProvider = $searchModel->search([]);
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class ReportsSearch extends Reports
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['id', 'created_at', 'user_card_id'], 'integer'],
|
[['id', 'created_at', 'user_card_id', 'user_id'], 'integer'],
|
||||||
[['today', 'difficulties', 'tomorrow', 'fio'], 'safe'],
|
[['today', 'difficulties', 'tomorrow', 'fio'], 'safe'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ class ReportsSearch extends Reports
|
|||||||
$this->load($params);
|
$this->load($params);
|
||||||
|
|
||||||
if (isset($params['user_id'])) {
|
if (isset($params['user_id'])) {
|
||||||
$this->user_card_id = $params['user_id'];
|
$this->user_id = $params['user_id'];
|
||||||
}
|
}
|
||||||
if (isset($params['year'])) {
|
if (isset($params['year'])) {
|
||||||
$query->andFilterWhere(['=', 'YEAR(reports.created_at)', $params['year']]);
|
$query->andFilterWhere(['=', 'YEAR(reports.created_at)', $params['year']]);
|
||||||
|
@ -17,7 +17,7 @@ echo GridView::widget([
|
|||||||
'attribute' => 'user_card_id',
|
'attribute' => 'user_card_id',
|
||||||
'value' => function ($model) {
|
'value' => function ($model) {
|
||||||
return Html::a(Reports::getFio($model) . ' ' . Html::tag('i', null, ['class' => 'far fa-calendar-alt']),
|
return Html::a(Reports::getFio($model) . ' ' . Html::tag('i', null, ['class' => 'far fa-calendar-alt']),
|
||||||
\yii\helpers\Url::base(true) . '/reports/reports/calendar?user_id=' . $model['user_card_id'], ['data-pjax' => 0]);
|
\yii\helpers\Url::base(true) . '/reports/reports/calendar?user_id=' . $model['user_id'], ['data-pjax' => 0]);
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -137,7 +137,6 @@ class Reports extends \yii\db\ActiveRecord
|
|||||||
|
|
||||||
public static function getFio($data)
|
public static function getFio($data)
|
||||||
{
|
{
|
||||||
//Debug::dd($data);
|
|
||||||
$user_card = UserCard::findOne(['id_user' => $data->user_id]);
|
$user_card = UserCard::findOne(['id_user' => $data->user_id]);
|
||||||
return $user_card->fio ?? null;
|
return $user_card->fio ?? null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user