report task
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
namespace backend\modules\reports\controllers;
|
||||
|
||||
use backend\modules\card\models\UserCardSearch;
|
||||
use common\classes\Debug;
|
||||
use Yii;
|
||||
use common\models\Reports;
|
||||
use backend\modules\reports\models\ReportsSearch;
|
||||
@ -79,7 +80,8 @@ class ReportsController extends Controller
|
||||
{
|
||||
$model = new Reports();
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
if ($model->load(Yii::$app->request->post())) {
|
||||
$model->save();
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
}
|
||||
|
||||
|
12
backend/modules/reports/models/ReportsTaskSearch.php
Normal file
12
backend/modules/reports/models/ReportsTaskSearch.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace backend\modules\reports\models;
|
||||
|
||||
|
||||
use common\models\ReportsTask;
|
||||
|
||||
class ReportsTaskSearch extends ReportsTask
|
||||
{
|
||||
|
||||
}
|
@ -12,7 +12,21 @@ echo GridView::widget([
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'created_at',
|
||||
'today',
|
||||
[
|
||||
'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',
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
use kartik\date\DatePicker;
|
||||
use kartik\datetime\DateTimePicker;
|
||||
use Symfony\Component\Console\Input\Input;
|
||||
use unclead\multipleinput\MultipleInput;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
@ -34,7 +36,24 @@ use yii\widgets\ActiveForm;
|
||||
]).'<br>';
|
||||
?>
|
||||
|
||||
<?= $form->field($model, 'today')->textarea(['maxlength' => true]) ?>
|
||||
<?= $form->field($model, '_task')->widget(MultipleInput::class, [
|
||||
'cloneButton' => true,
|
||||
'max' => 10,
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 'task',
|
||||
'title' => 'Задача',
|
||||
],
|
||||
[
|
||||
'name' => 'hours_spent',
|
||||
'title' => 'Кол-во часов',
|
||||
'options' => [
|
||||
'type' => 'number',
|
||||
'style' => 'width:100px'
|
||||
],
|
||||
],
|
||||
],
|
||||
])->label('Какие задачаи были выполнены:'); ?>
|
||||
|
||||
<?= $form->field($model, 'difficulties')->textarea(['maxlength' => true]) ?>
|
||||
|
||||
|
@ -26,7 +26,21 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'created_at',
|
||||
'today',
|
||||
[
|
||||
'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',
|
||||
[
|
||||
|
@ -29,14 +29,30 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'attributes' => [
|
||||
// 'id',
|
||||
'created_at',
|
||||
'today',
|
||||
[
|
||||
'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',
|
||||
// 'user_card_id',
|
||||
[
|
||||
'format' => 'raw',
|
||||
'attribute' => 'ФИО',
|
||||
'value' => function ($data) { return \common\models\Reports::getFio($data); },
|
||||
'value' => function ($data) {
|
||||
return \common\models\Reports::getFio($data);
|
||||
},
|
||||
],
|
||||
],
|
||||
]) ?>
|
||||
|
Reference in New Issue
Block a user