reports fix

This commit is contained in:
Kavalar 2024-02-09 15:29:13 +03:00
parent 790077ce55
commit 047912c3a4
4 changed files with 4 additions and 5 deletions

View File

@ -88,7 +88,7 @@ class ReportsController extends Controller
public function actionCalendar($user_id)
{
$searchModel = new ReportsSearch();
$searchModel->user_card_id = $user_id;
$searchModel->user_id = $user_id;
$dataProvider = $searchModel->search([]);

View File

@ -20,7 +20,7 @@ class ReportsSearch extends Reports
public function rules()
{
return [
[['id', 'created_at', 'user_card_id'], 'integer'],
[['id', 'created_at', 'user_card_id', 'user_id'], 'integer'],
[['today', 'difficulties', 'tomorrow', 'fio'], 'safe'],
];
}
@ -60,7 +60,7 @@ class ReportsSearch extends Reports
$this->load($params);
if (isset($params['user_id'])) {
$this->user_card_id = $params['user_id'];
$this->user_id = $params['user_id'];
}
if (isset($params['year'])) {
$query->andFilterWhere(['=', 'YEAR(reports.created_at)', $params['year']]);

View File

@ -17,7 +17,7 @@ echo GridView::widget([
'attribute' => 'user_card_id',
'value' => function ($model) {
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]);
},
],
[

View File

@ -137,7 +137,6 @@ class Reports extends \yii\db\ActiveRecord
public static function getFio($data)
{
//Debug::dd($data);
$user_card = UserCard::findOne(['id_user' => $data->user_id]);
return $user_card->fio ?? null;
}