report fix

This commit is contained in:
andrey 2021-09-07 17:05:10 +03:00
parent ed0cd2b124
commit 415d8e4ee9
2 changed files with 44 additions and 41 deletions

View File

@ -19,6 +19,7 @@ function next_day($date, $number)
{
return date('Y-m-d', strtotime($date) + 3600 * 24 * $number);
}
?>
<div class="reports-index">
@ -38,16 +39,18 @@ function next_day($date, $number)
$date != WEEK_AGO;
$date = next_day($date, -1)): ?>
<?= Html::a($date, [$url. $date], ['class' => 'btn btn-primary']) ?>
<?= Html::a($date, ['index', 'ReportsSearch[created_at]' => $date], ['class' => 'btn btn-primary']) ?>
<?php endfor; ?></div>
<div class="row">
<div class="col-xs-6">
<?php $form = \yii\widgets\ActiveForm::begin() ?>
<?= $form->field($searchModel, 'today')->hiddenInput()->label(false) ?>
<?php \yii\widgets\ActiveForm::end() ?>
<form method="get" style="display: inline-flex;">
<?php if (isset($_GET['ReportsSearch'])): ?>
<input name="ReportsSearch[today]" type="hidden" value="<?=($_GET['ReportsSearch']['today'])?>">
<input name="ReportsSearch[difficulties]" type="hidden" value="<?=($_GET['ReportsSearch']['difficulties'])?>">
<input name="ReportsSearch[tomorrow]" type="hidden" value="<?=($_GET['ReportsSearch']['tomorrow'])?>">
<input name="ReportsSearch[today]" type="hidden" value="<?= $searchModel->today ?>">
<input name="ReportsSearch[difficulties]" type="hidden" value="<?= $searchModel->difficulties ?>">
<input name="ReportsSearch[tomorrow]" type="hidden" value="<?= $searchModel->tomorrow ?>">
<input name="ReportsSearch[user_card_id]" type="hidden">
<?php if (isset($_GET['ReportsSearch']['user_card_id'])) {
foreach ($_GET['ReportsSearch']['user_card_id'] as $res)
@ -71,7 +74,7 @@ function next_day($date, $number)
<?= Html::button('Сортировка по дате', ['class' => 'btn btn-danger sort_by_date', 'type' => 'submit']) ?>
<?= Html::a('Все дни', ['index'], ['class' => 'btn btn-dark']) ?>
<?= Html::a('Все дни', ['index'], ['class' => 'btn btn-primary']) ?>
</form>
@ -98,24 +101,24 @@ function next_day($date, $number)
]),
'value' => 'created_at',
],
[
'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',
// [
// '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',

View File

@ -35,8 +35,8 @@ if (Yii::$app->controller->action->id === 'login') {
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">-->
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<?php $this->beginBody() ?>