* добавил минуты

* исправил баг в календаре с 12 месяцем ('yyyy-00-dd' => 'yyyy-12-dd')
This commit is contained in:
anatolidew 2021-11-23 10:55:41 +03:00
parent b497c000f6
commit 45fcfe16d1
10 changed files with 33 additions and 8 deletions

View File

@ -18,7 +18,7 @@ echo GridView::widget([
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->minutes_spent мин.) $task->task</p>";
$i++; $i++;
} }
} }

View File

@ -20,7 +20,7 @@ echo GridView::widget([
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->minutes_spent мин.) $task->task</p>";
$i++; $i++;
} }
} }

View File

@ -10,6 +10,8 @@ use yii\widgets\ActiveForm;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\Reports */ /* @var $model common\models\Reports */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
$this->registerCss('.list-cell__task{width:73%}')
?> ?>
<div class="reports-form"> <div class="reports-form">
@ -52,6 +54,13 @@ use yii\widgets\ActiveForm;
'style' => 'width:100px' 'style' => 'width:100px'
], ],
], ],
[
'name' => 'minutes_spent',
'title' => 'Кол-во минут',
'options' => [
'type' => 'number',
],
],
], ],
])->label('Какие задачаи были выполнены:'); ?> ])->label('Какие задачаи были выполнены:'); ?>

View File

@ -37,7 +37,7 @@ $this->params['breadcrumbs'][] = $this->title;
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->minutes_spent мин.) $task->task</p>";
$i++; $i++;
} }
} }

View File

@ -68,7 +68,7 @@ class DateHelper {
static dateToString(date) { static dateToString(date) {
let year = date.getFullYear() let year = date.getFullYear()
let day = this.intToDate(date.getDate()) let day = this.intToDate(date.getDate())
let month = this.intToDate(this.isDecember(date) ? 0 : date.getMonth() + 1) let month = this.intToDate(date.getMonth() + 1)
return year + '-' + month + '-' + day return year + '-' + month + '-' + day
} }

View File

@ -102,6 +102,7 @@ class Reports extends \yii\db\ActiveRecord
$taskModel->report_id = $this->id; $taskModel->report_id = $this->id;
$taskModel->task = $task['task']; $taskModel->task = $task['task'];
$taskModel->hours_spent = (float)$task['hours_spent']; $taskModel->hours_spent = (float)$task['hours_spent'];
$taskModel->minutes_spent = (int) $task['minutes_spent'];
$taskModel->status = 1; $taskModel->status = 1;
$taskModel->created_at = time(); $taskModel->created_at = time();
$taskModel->save(); $taskModel->save();

View File

@ -12,6 +12,7 @@ use Yii;
* @property string $task * @property string $task
* @property int $created_at * @property int $created_at
* @property int $status * @property int $status
* @property int $minutes_spent
* @property float $hours_spent * @property float $hours_spent
* *
* @property Reports $report * @property Reports $report
@ -33,8 +34,9 @@ class ReportsTask extends \yii\db\ActiveRecord
{ {
return [ return [
[['report_id'], 'required'], [['report_id'], 'required'],
[['report_id', 'created_at', 'status'], 'integer'], [['report_id', 'created_at', 'status', 'minutes_spent'], 'integer'],
[['hours_spent'], 'number'], [['hours_spent'], 'number'],
['minutes_spent', 'compare', 'compareValue' => 60, 'operator' => '<'],
[['task'], 'string'], [['task'], 'string'],
[['report_id'], 'exist', 'skipOnError' => true, 'targetClass' => Reports::className(), 'targetAttribute' => ['report_id' => 'id']], [['report_id'], 'exist', 'skipOnError' => true, 'targetClass' => Reports::className(), 'targetAttribute' => ['report_id' => 'id']],
]; ];

View File

@ -8,6 +8,8 @@ use yii\widgets\ActiveForm;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\Reports */ /* @var $model common\models\Reports */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
$this->registerCss('.list-cell__task{width:73%}')
?> ?>
<div class="reports-form"> <div class="reports-form">
@ -42,13 +44,24 @@ use yii\widgets\ActiveForm;
[ [
'name' => 'task', 'name' => 'task',
'title' => 'Задача', 'title' => 'Задача',
'options' => [
],
], ],
[ [
'name' => 'hours_spent', 'name' => 'hours_spent',
'title' => 'Кол-во часов', 'title' => 'Кол-во часов',
'options' => [ 'options' => [
'type' => 'number', 'type' => 'number',
'style' => 'width:100px' 'min' => '0'
],
],
[
'name' => 'minutes_spent',
'title' => 'Кол-во минут',
'options' => [
'type' => 'number',
'min' => '0',
'max' => '59'
], ],
], ],
], ],

View File

@ -34,7 +34,7 @@ $this->params['breadcrumbs'][] = $this->title;
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->minutes_spent мин.) $task->task</p>";
$i++; $i++;
} }
} }

View File

@ -39,7 +39,7 @@ $this->params['breadcrumbs'][] = $this->title;
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->minutes_spent мин.) $task->task</p>";
$i++; $i++;
} }
} }