report fix
This commit is contained in:
parent
ed0cd2b124
commit
415d8e4ee9
@ -19,6 +19,7 @@ function next_day($date, $number)
|
|||||||
{
|
{
|
||||||
return date('Y-m-d', strtotime($date) + 3600 * 24 * $number);
|
return date('Y-m-d', strtotime($date) + 3600 * 24 * $number);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="reports-index">
|
<div class="reports-index">
|
||||||
|
|
||||||
@ -28,33 +29,35 @@ function next_day($date, $number)
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
if (!$_GET){
|
if (!$_GET) {
|
||||||
$url = '../..'.Yii::$app->request->url .'?ReportsSearch[created_at]=';
|
$url = '../..' . Yii::$app->request->url . '?ReportsSearch[created_at]=';
|
||||||
} else{
|
} else {
|
||||||
$url = '../..'.Yii::$app->request->url .'&ReportsSearch[created_at]=';
|
$url = '../..' . Yii::$app->request->url . '&ReportsSearch[created_at]=';
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($date = TODAY;
|
for ($date = TODAY;
|
||||||
$date != WEEK_AGO;
|
$date != WEEK_AGO;
|
||||||
$date = next_day($date, -1)): ?>
|
$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>
|
<?php endfor; ?></div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6">
|
<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;">
|
<form method="get" style="display: inline-flex;">
|
||||||
<?php if(isset($_GET['ReportsSearch'])):?>
|
<?php if (isset($_GET['ReportsSearch'])): ?>
|
||||||
<input name="ReportsSearch[today]" type="hidden" value="<?=($_GET['ReportsSearch']['today'])?>">
|
<input name="ReportsSearch[today]" type="hidden" value="<?= $searchModel->today ?>">
|
||||||
<input name="ReportsSearch[difficulties]" type="hidden" value="<?=($_GET['ReportsSearch']['difficulties'])?>">
|
<input name="ReportsSearch[difficulties]" type="hidden" value="<?= $searchModel->difficulties ?>">
|
||||||
<input name="ReportsSearch[tomorrow]" type="hidden" value="<?=($_GET['ReportsSearch']['tomorrow'])?>">
|
<input name="ReportsSearch[tomorrow]" type="hidden" value="<?= $searchModel->tomorrow ?>">
|
||||||
<input name="ReportsSearch[user_card_id]" type="hidden">
|
<input name="ReportsSearch[user_card_id]" type="hidden">
|
||||||
<?php if(isset($_GET['ReportsSearch']['user_card_id'])){
|
<?php if (isset($_GET['ReportsSearch']['user_card_id'])) {
|
||||||
foreach ($_GET['ReportsSearch']['user_card_id'] as $res)
|
foreach ($_GET['ReportsSearch']['user_card_id'] as $res)
|
||||||
echo
|
echo
|
||||||
'<input name="ReportsSearch[user_card_id][]" type="hidden" value="'.$res.'">';
|
'<input name="ReportsSearch[user_card_id][]" type="hidden" value="' . $res . '">';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -71,7 +74,7 @@ function next_day($date, $number)
|
|||||||
|
|
||||||
<?= Html::button('Сортировка по дате', ['class' => 'btn btn-danger sort_by_date', 'type' => 'submit']) ?>
|
<?= 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>
|
</form>
|
||||||
@ -89,33 +92,33 @@ function next_day($date, $number)
|
|||||||
[
|
[
|
||||||
'format' => 'raw',
|
'format' => 'raw',
|
||||||
'attribute' => 'created_at',
|
'attribute' => 'created_at',
|
||||||
'filter' => Html::input('date', 'ReportsSearch[created_at]',
|
'filter' => Html::input('date', 'ReportsSearch[created_at]',
|
||||||
null, [
|
null, [
|
||||||
'class' => 'form-control',
|
'class' => 'form-control',
|
||||||
'style' => 'display:',
|
'style' => 'display:',
|
||||||
'id' => 'date'
|
'id' => 'date'
|
||||||
|
|
||||||
]) ,
|
]),
|
||||||
'value' => 'created_at',
|
'value' => 'created_at',
|
||||||
],
|
],
|
||||||
[
|
// [
|
||||||
'attribute' => 'today',
|
// 'attribute' => 'today',
|
||||||
'format' => 'raw',
|
// 'format' => 'raw',
|
||||||
'value' => function ($model) {
|
// 'value' => function ($model) {
|
||||||
|
//
|
||||||
$text = '';
|
// $text = '';
|
||||||
if ($model->task) {
|
// if ($model->task) {
|
||||||
$i = 1;
|
// $i = 1;
|
||||||
foreach ($model->task as $task) {
|
// foreach ($model->task as $task) {
|
||||||
$text .= "<p>$i. ($task->hours_spent ч.) $task->task</p>";
|
// $text .= "<p>$i. ($task->hours_spent ч.) $task->task</p>";
|
||||||
$i++;
|
// $i++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return $text;
|
// return $text;
|
||||||
}
|
// }
|
||||||
],
|
// ],
|
||||||
'difficulties',
|
//'difficulties',
|
||||||
'tomorrow',
|
//'tomorrow',
|
||||||
[
|
[
|
||||||
'format' => 'raw',
|
'format' => 'raw',
|
||||||
'attribute' => 'user_card_id',
|
'attribute' => 'user_card_id',
|
||||||
@ -130,7 +133,7 @@ function next_day($date, $number)
|
|||||||
],
|
],
|
||||||
]),
|
]),
|
||||||
'value' => function ($data) {
|
'value' => function ($data) {
|
||||||
return '<a href="'.Yii::getAlias('@web').'/reports/reports/user?id=' . $data['user_card_id'] . '">' . \common\models\Reports::getFio($data) . '</a>';
|
return '<a href="' . Yii::getAlias('@web') . '/reports/reports/user?id=' . $data['user_card_id'] . '">' . \common\models\Reports::getFio($data) . '</a>';
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ if (Yii::$app->controller->action->id === 'login') {
|
|||||||
<?= Html::csrfMetaTags() ?>
|
<?= Html::csrfMetaTags() ?>
|
||||||
<title><?= Html::encode($this->title) ?></title>
|
<title><?= Html::encode($this->title) ?></title>
|
||||||
<?php $this->head() ?>
|
<?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">
|
<!-- <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>
|
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>-->
|
||||||
</head>
|
</head>
|
||||||
<body class="hold-transition skin-blue sidebar-mini">
|
<body class="hold-transition skin-blue sidebar-mini">
|
||||||
<?php $this->beginBody() ?>
|
<?php $this->beginBody() ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user