report fix

This commit is contained in:
akosse
2020-02-05 16:28:37 +03:00
parent 3da2dd1543
commit 6d37a8ef18
14 changed files with 144 additions and 36 deletions

View File

@ -46,6 +46,11 @@ class ReportsSearch extends Reports
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => [
'defaultOrder' => [
'created_at' => SORT_DESC,
]
],
]);
$this->load($params);

View File

@ -1,5 +1,6 @@
<?php
use kartik\date\DatePicker;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
@ -12,22 +13,32 @@ use yii\widgets\ActiveForm;
<?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'
<?php
$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')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'today')->textarea(['maxlength' => true]) ?>
<?= $form->field($model, 'difficulties')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'difficulties')->textarea(['maxlength' => true]) ?>
<?= $form->field($model, 'tomorrow')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'tomorrow')->textarea(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>

View File

@ -24,13 +24,25 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [
['class' => 'yii\grid\SerialColumn'],
// 'id',
'created_at',
'today',
'difficulties',
'tomorrow',
// 'user_card_id',
//'status',
[
'format' => 'raw',
'attribute' => 'Что было сделано сегодня?',
'filter' => Html::activeTextInput($searchModel, 'today', ['class' => 'form-control']),
'value' => function ($data) { return '<div class="custom-text">'.$data->today.'</div>'; },
],
[
'format' => 'raw',
'attribute' => 'Какие сложности возникли?',
'filter' => Html::activeTextInput($searchModel, 'difficulties', ['class' => 'form-control']),
'value' => function ($data) { return '<div class="custom-text">'.$data->difficulties.'</div>'; },
],
[
'format' => 'raw',
'attribute' => 'Что планируется сделать завтра?',
'filter' => Html::activeTextInput($searchModel, 'tomorrow', ['class' => 'form-control']),
'value' => function ($data) { return '<div class="custom-text">'.$data->tomorrow.'</div>'; },
],
['class' => 'yii\grid\ActionColumn'],
],

View File

@ -7,7 +7,7 @@ use yii\helpers\Html;
$this->title = 'Редактировать отчет';
$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">

View File

@ -6,7 +6,7 @@ use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Reports */
$this->title = $model->id;
$this->title = $model->created_at;
$this->params['breadcrumbs'][] = ['label' => 'Отчеты', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);