Merge branch 'add_minutes' of https://github.com/q6q9/guild into add_minutes
This commit is contained in:
commit
8e490ce518
@ -19,7 +19,7 @@ echo GridView::widget([
|
||||
if ($model->task) {
|
||||
$i = 1;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ echo GridView::widget([
|
||||
if ($model->task) {
|
||||
$i = 1;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ use yii\widgets\ActiveForm;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Reports */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
|
||||
$this->registerCss('.list-cell__task{width:73%}')
|
||||
?>
|
||||
|
||||
<div class="reports-form">
|
||||
@ -52,6 +54,13 @@ use yii\widgets\ActiveForm;
|
||||
'style' => 'width:100px'
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'minutes_spent',
|
||||
'title' => 'Кол-во минут',
|
||||
'options' => [
|
||||
'type' => 'number',
|
||||
],
|
||||
],
|
||||
],
|
||||
])->label('Какие задачаи были выполнены:'); ?>
|
||||
|
||||
|
@ -37,7 +37,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
if ($model->task) {
|
||||
$i = 1;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class DateHelper {
|
||||
static dateToString(date) {
|
||||
let year = date.getFullYear()
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,7 @@ class Reports extends \yii\db\ActiveRecord
|
||||
$taskModel->report_id = $this->id;
|
||||
$taskModel->task = $task['task'];
|
||||
$taskModel->hours_spent = (float)$task['hours_spent'];
|
||||
$taskModel->minutes_spent = (int) $task['minutes_spent'];
|
||||
$taskModel->status = 1;
|
||||
$taskModel->created_at = time();
|
||||
$taskModel->save();
|
||||
|
@ -12,6 +12,7 @@ use Yii;
|
||||
* @property string $task
|
||||
* @property int $created_at
|
||||
* @property int $status
|
||||
* @property int $minutes_spent
|
||||
* @property float $hours_spent
|
||||
*
|
||||
* @property Reports $report
|
||||
@ -33,8 +34,9 @@ class ReportsTask extends \yii\db\ActiveRecord
|
||||
{
|
||||
return [
|
||||
[['report_id'], 'required'],
|
||||
[['report_id', 'created_at', 'status'], 'integer'],
|
||||
[['report_id', 'created_at', 'status', 'minutes_spent'], 'integer'],
|
||||
[['hours_spent'], 'number'],
|
||||
['minutes_spent', 'compare', 'compareValue' => 60, 'operator' => '<'],
|
||||
[['task'], 'string'],
|
||||
[['report_id'], 'exist', 'skipOnError' => true, 'targetClass' => Reports::className(), 'targetAttribute' => ['report_id' => 'id']],
|
||||
];
|
||||
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles adding columns to table `{{%reports_task}}`.
|
||||
*/
|
||||
class m211122_144548_add_column_to_reports_task_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->addColumn('reports_task', 'minutes_spent', $this->integer()->defaultValue(0)->notNull());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropColumn('reports_task', 'minutes_spent' );
|
||||
}
|
||||
}
|
@ -8,6 +8,8 @@ use yii\widgets\ActiveForm;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Reports */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
|
||||
$this->registerCss('.list-cell__task{width:73%}')
|
||||
?>
|
||||
|
||||
<div class="reports-form">
|
||||
@ -48,7 +50,16 @@ use yii\widgets\ActiveForm;
|
||||
'title' => 'Кол-во часов',
|
||||
'options' => [
|
||||
'type' => 'number',
|
||||
'style' => 'width:100px'
|
||||
'min' => '0'
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'minutes_spent',
|
||||
'title' => 'Кол-во минут',
|
||||
'options' => [
|
||||
'type' => 'number',
|
||||
'min' => '0',
|
||||
'max' => '59'
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -34,7 +34,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
if ($model->task) {
|
||||
$i = 1;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
if ($model->task) {
|
||||
$i = 1;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user