report fix
This commit is contained in:
@ -48,6 +48,11 @@ class ReportsSearch extends Reports
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
'sort' => [
|
||||
'defaultOrder' => [
|
||||
'created_at' => SORT_DESC,
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
$this->load($params);
|
||||
|
@ -3,9 +3,11 @@
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
/* @var $pages */
|
||||
|
||||
echo GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use kartik\date\DatePicker;
|
||||
use kartik\datetime\DateTimePicker;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
@ -10,18 +12,27 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<div class="reports-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
<?php $form = ActiveForm::begin();
|
||||
|
||||
<?= $form->field($model, 'created_at')->input(
|
||||
'date',
|
||||
[
|
||||
'placeholder' => 'Zadejte svůj Datum narození',
|
||||
'language' => 'en',
|
||||
"data-format" => "DD MMMM YYYY",
|
||||
'class' => 'form-control report-date'
|
||||
$now = time();
|
||||
$day = idate('d', $now);
|
||||
$month = idate('m', $now);
|
||||
$year = idate('Y', $now);
|
||||
$date = $year."-".$month."-".$day;
|
||||
|
||||
if(!$model->created_at)
|
||||
$model->created_at = $date;
|
||||
echo '<b>Дата заполнения отчета:</b>';
|
||||
echo DatePicker::widget([
|
||||
'model' => $model,
|
||||
'attribute' => 'created_at',
|
||||
'options' => [],
|
||||
'pluginOptions' => [
|
||||
'autoclose' => true,
|
||||
'format' => 'yyyy-mm-dd'
|
||||
]
|
||||
) ?>
|
||||
]).'<br>';
|
||||
?>
|
||||
|
||||
<?= $form->field($model, 'today')->textarea(['maxlength' => true]) ?>
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use backend\modules\reports\models\ReportsSearch;
|
||||
use kartik\grid\GridView;
|
||||
use yii\data\Pagination;
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
@ -38,6 +39,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
$searchReports = new ReportsSearch();
|
||||
$providerReports = $searchReports->search(Yii::$app->request->queryParams);
|
||||
$providerReports->query->andWhere(['user_card.id_user' => $model->id_user]);
|
||||
$providerReports->pagination->pageSize = 10;
|
||||
|
||||
return Yii::$app->controller->renderPartial('_expand-row-details', ['dataProvider' => $providerReports]);
|
||||
},
|
||||
|
@ -5,9 +5,9 @@ use yii\helpers\Html;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Reports */
|
||||
|
||||
$this->title = 'Редактировать отчет';
|
||||
$this->title = 'Редактировать отчет ' . $model->created_at;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Отчеты', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->created_at, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Редактировать';
|
||||
?>
|
||||
<div class="reports-update">
|
||||
|
@ -6,7 +6,7 @@ use yii\widgets\DetailView;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Reports */
|
||||
|
||||
$this->title = 'Отчет';
|
||||
$this->title = $model->created_at;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Отчеты', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
\yii\web\YiiAsset::register($this);
|
||||
|
Reference in New Issue
Block a user