доработан виджет, добавлен календарь отчетов всех за месяц

This commit is contained in:
q6q9
2021-09-15 11:26:06 +03:00
parent d642e32811
commit 2dbc33a8f3
11 changed files with 248 additions and 130 deletions

View File

@ -0,0 +1,51 @@
<?php
use common\models\Reports;
use yii\grid\GridView;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'today',
'format' => 'raw',
'value' => function ($model) {
$text = '';
if ($model->task) {
$i = 1;
foreach ($model->task as $task) {
$text .= "<p>$i. ($task->hours_spent ч.) $task->task</p>";
$i++;
}
}
return $text;
}
],
'difficulties',
'tomorrow',
[
'format' => 'raw',
'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]);
},
],
[
'class' => 'yii\grid\ActionColumn',
'urlCreator' => function ($action, $model, $key, $index) {
return \yii\helpers\Url::base(true) . '/reports/reports/' . $action . '?id=' . $model->id;
}
],
],
]);
die();

View File

@ -3,6 +3,7 @@
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\reports\models\ReportsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
echo GridView::widget([
@ -27,7 +28,12 @@ echo GridView::widget([
],
'difficulties',
'tomorrow',
['class' => 'yii\grid\ActionColumn'],
[
'class' => 'yii\grid\ActionColumn',
'urlCreator' => function ($action, $model, $key, $index) {
return \yii\helpers\Url::base(true) . '/reports/reports/' . $action . '?id=' . $model->id;
}
],
],
]);
die();