Compare commits

...

10 Commits

19 changed files with 828 additions and 81 deletions

View File

@ -3,6 +3,9 @@
namespace backend\modules\reports\controllers; namespace backend\modules\reports\controllers;
use backend\modules\card\models\UserCardSearch; use backend\modules\card\models\UserCardSearch;
use backend\modules\reports\models\ExtractForm;
use common\classes\Debug;
use common\models\ReportsTask;
use Yii; use Yii;
use common\models\Reports; use common\models\Reports;
use backend\modules\reports\models\ReportsSearch; use backend\modules\reports\models\ReportsSearch;
@ -58,7 +61,7 @@ class ReportsController extends Controller
return Reports::getFio($report); return Reports::getFio($report);
} }
], ],
]),'user_card_id', 'fio'); ]), 'user_card_id', 'fio');
$dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index'); return $this->render('index');
@ -74,7 +77,7 @@ class ReportsController extends Controller
return Reports::getFio($report); return Reports::getFio($report);
} }
], ],
]),'user_card_id', 'fio'); ]), 'user_card_id', 'fio');
$dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('list', [ return $this->render('list', [
@ -88,7 +91,7 @@ class ReportsController extends Controller
public function actionCalendar($user_id) public function actionCalendar($user_id)
{ {
$searchModel = new ReportsSearch(); $searchModel = new ReportsSearch();
$searchModel->user_card_id = $user_id; $searchModel->user_id = $user_id;
$dataProvider = $searchModel->search([]); $dataProvider = $searchModel->search([]);
@ -110,8 +113,8 @@ class ReportsController extends Controller
], ],
]); ]);
if (!$dataProvider->getCount()){ if (!$dataProvider->getCount()) {
return $this->render('non-exist_user_id', ['id' => $user_id]); return $this->render('non-exist_user_id', ['id' => $user_id]);
} }
return $this->render('calendarOneUser', [ return $this->render('calendarOneUser', [
'reports' => $reports_array, 'reports' => $reports_array,
@ -199,6 +202,44 @@ class ReportsController extends Controller
return $this->redirect(['index']); return $this->redirect(['index']);
} }
public function actionExtractForm(): string
{
$model = new ExtractForm();
return $this->render('extract-form', ['model' => $model]);
}
public function actionExtract()
{
$model = new ExtractForm();
if ($model->load(Yii::$app->request->post())) {
$query = ReportsTask::find()->joinWith('reports')
->where(['reports.user_id' => $model->user_id])
->andWhere(['between', 'reports.created_at', $model->date_from, $model->date_to]);
$file = \Yii::createObject([
'class' => 'codemix\excelexport\ExcelFile',
'sheets' => [
'Reports' => [
'class' => 'codemix\excelexport\ActiveExcelSheet',
'query' => $query,
'attributes' => [
'reports.created_at',
'task',
'hours_spent'
],
]
]
]);
$file->send('reports.xlsx');
} else {
return $this->render('extract-form', ['model' => $model]);
}
}
/** /**
* Finds the Reports model based on its primary key value. * Finds the Reports model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown. * If the model is not found, a 404 HTTP exception will be thrown.

View File

@ -0,0 +1,29 @@
<?php
namespace backend\modules\reports\models;
class ExtractForm extends \yii\base\Model
{
public $user_id;
public $date_from;
public $date_to;
public function rules()
{
return [
[['date_from', 'date_to', 'user_id'], 'required'],
[['date_from', 'date_to'], 'safe'],
[['user_id'], 'integer'],
];
}
public function attributeLabels()
{
return [
'user_id' => 'Пользователь',
'date_from' => 'Дата начала',
'date_to' => 'Дата окончания',
];
}
}

View File

@ -20,7 +20,7 @@ class ReportsSearch extends Reports
public function rules() public function rules()
{ {
return [ return [
[['id', 'created_at', 'user_card_id'], 'integer'], [['id', 'created_at', 'user_card_id', 'user_id'], 'integer'],
[['today', 'difficulties', 'tomorrow', 'fio'], 'safe'], [['today', 'difficulties', 'tomorrow', 'fio'], 'safe'],
]; ];
} }
@ -60,7 +60,7 @@ class ReportsSearch extends Reports
$this->load($params); $this->load($params);
if (isset($params['user_id'])) { if (isset($params['user_id'])) {
$this->user_card_id = $params['user_id']; $this->user_id = $params['user_id'];
} }
if (isset($params['year'])) { if (isset($params['year'])) {
$query->andFilterWhere(['=', 'YEAR(reports.created_at)', $params['year']]); $query->andFilterWhere(['=', 'YEAR(reports.created_at)', $params['year']]);

View File

@ -17,7 +17,7 @@ echo GridView::widget([
'attribute' => 'user_card_id', 'attribute' => 'user_card_id',
'value' => function ($model) { 'value' => function ($model) {
return Html::a(Reports::getFio($model) . ' ' . Html::tag('i', null, ['class' => 'far fa-calendar-alt']), return Html::a(Reports::getFio($model) . ' ' . Html::tag('i', null, ['class' => 'far fa-calendar-alt']),
\yii\helpers\Url::base(true) . '/reports/reports/calendar?user_id=' . $model['user_card_id'], ['data-pjax' => 0]); \yii\helpers\Url::base(true) . '/reports/reports/calendar?user_id=' . $model['user_id'], ['data-pjax' => 0]);
}, },
], ],
[ [

View File

@ -0,0 +1,42 @@
<?php
use kartik\date\DatePicker;
use kartik\select2\Select2;
use unclead\multipleinput\MultipleInput;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model \backend\modules\reports\models\ExtractForm */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="reports-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'user_id')->widget(
Select2::class,
[
'data' => \common\models\UserCard::getListUserWithUserId(),
'options' => ['placeholder' => '...', 'class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]
); ?>
<?= $form->field($model, 'date_from')->textInput(['type' => 'date']) ?>
<?= $form->field($model, 'date_to')->textInput(['type' => 'date']) ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -101,6 +101,7 @@
['label' => 'Заметки', 'icon' => 'sticky-note', 'url' => ['/notes/notes'], 'active' => \Yii::$app->controller->id == 'notes', 'visible' => Yii::$app->user->can('notes')], ['label' => 'Заметки', 'icon' => 'sticky-note', 'url' => ['/notes/notes'], 'active' => \Yii::$app->controller->id == 'notes', 'visible' => Yii::$app->user->can('notes')],
['label' => 'Календарь ДР', 'icon' => 'calendar-check-o', 'url' => ['/calendar/calendar'], 'active' => \Yii::$app->controller->id == 'calendar', 'visible' => Yii::$app->user->can('calendar')], ['label' => 'Календарь ДР', 'icon' => 'calendar-check-o', 'url' => ['/calendar/calendar'], 'active' => \Yii::$app->controller->id == 'calendar', 'visible' => Yii::$app->user->can('calendar')],
['label' => 'Отчеты', 'icon' => 'calendar', 'url' => ['/reports/reports'], 'active' => \Yii::$app->controller->id == 'reports', 'visible' => Yii::$app->user->can('reports')], ['label' => 'Отчеты', 'icon' => 'calendar', 'url' => ['/reports/reports'], 'active' => \Yii::$app->controller->id == 'reports', 'visible' => Yii::$app->user->can('reports')],
['label' => 'Экспорт отчетов', 'icon' => 'calendar', 'url' => ['/reports/reports/extract'], 'active' => \Yii::$app->controller->id == 'reports', 'visible' => Yii::$app->user->can('reports')],
['label' => 'Опции', 'icon' => 'list-alt', 'url' => ['/options/options'], 'active' => \Yii::$app->controller->id == 'options', 'visible' => Yii::$app->user->can('options')], ['label' => 'Опции', 'icon' => 'list-alt', 'url' => ['/options/options'], 'active' => \Yii::$app->controller->id == 'options', 'visible' => Yii::$app->user->can('options')],
[ [
'label' => 'Запрос интервью (' . \common\models\InterviewRequest::getNewCount() . ')', 'label' => 'Запрос интервью (' . \common\models\InterviewRequest::getNewCount() . ')',

View File

@ -8,6 +8,10 @@ class Entity
const ENTITY_TYPE_PROJECT = 1; const ENTITY_TYPE_PROJECT = 1;
const ENTITY_TYPE_TASK = 2; const ENTITY_TYPE_TASK = 2;
const ENTITY_TYPE_REQUEST = 3;
const ENTITY_TYPE_REPORT = 4;
/** /**
* @return string[] * @return string[]
*/ */
@ -16,6 +20,8 @@ class Entity
return [ return [
self::ENTITY_TYPE_PROJECT => "Проект", self::ENTITY_TYPE_PROJECT => "Проект",
self::ENTITY_TYPE_TASK => "Задача", self::ENTITY_TYPE_TASK => "Задача",
self::ENTITY_TYPE_REQUEST => "Запрос на создание проекта",
self::ENTITY_TYPE_REPORT => "Отчет",
]; ];
} }

View File

@ -88,6 +88,25 @@ class Project extends \yii\db\ActiveRecord
]; ];
} }
/**
* @param $insert
* @param $changedAttributes
* @return void
*/
public function afterSave($insert, $changedAttributes): void
{
if ($insert) {
$model = new ProjectUser();
$model->user_id = $this->owner_id;
$model->project_id = $this->id;
$model->status = 1;
if ($model->save()) {
}
}
parent::afterSave($insert, $changedAttributes);
}
/** /**
* @return ActiveQuery * @return ActiveQuery
*/ */

View File

@ -47,6 +47,9 @@ class ProjectTask extends ActiveRecord
const PRIORITY_MEDIUM = 1; const PRIORITY_MEDIUM = 1;
const PRIORITY_HIGH = 2; const PRIORITY_HIGH = 2;
const SCENARIO_UPDATE_TASK = 'update';
const DAY_IN_UNIX_TIME = 86340; // 23:59:59 const DAY_IN_UNIX_TIME = 86340; // 23:59:59
/** /**
@ -105,11 +108,11 @@ class ProjectTask extends ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['project_id', 'status', 'title', 'description',], 'required'], [['project_id', 'status', 'title', 'description'], 'required'],
[['project_id', 'status', 'column_id', 'user_id', 'executor_id', 'priority', 'execution_priority'], 'integer'], [['project_id', 'status', 'column_id', 'user_id', 'executor_id', 'priority', 'execution_priority'], 'integer'],
[['created_at', 'updated_at', 'dead_line'], 'safe'], [['created_at', 'updated_at', 'dead_line'], 'safe'],
['execution_priority', 'in', 'range' => [self::PRIORITY_LOW, self::PRIORITY_MEDIUM, self::PRIORITY_HIGH]], ['execution_priority', 'in', 'range' => [self::PRIORITY_LOW, self::PRIORITY_MEDIUM, self::PRIORITY_HIGH]],
['title', 'unique', 'targetAttribute' => ['title', 'project_id'], 'message' => 'Такая задача уже создана'], //['title', 'unique', 'targetAttribute' => ['title', 'project_id'], 'message' => 'Такая задача уже создана'],
[['title'], 'string', 'max' => 255], [['title'], 'string', 'max' => 255],
['status', 'in', 'range' => [self::STATUS_DISABLE, self::STATUS_ACTIVE, self::STATUS_ARCHIVE, self::STATUS_AT_WORK]], ['status', 'in', 'range' => [self::STATUS_DISABLE, self::STATUS_ACTIVE, self::STATUS_ARCHIVE, self::STATUS_AT_WORK]],
[['description'], 'string', 'max' => 1500], [['description'], 'string', 'max' => 1500],
@ -191,6 +194,16 @@ class ProjectTask extends ActiveRecord
]; ];
} }
/**
* @return array
*/
public function scenarios(): array
{
$scenarios = parent::scenarios();
$scenarios[self::SCENARIO_UPDATE_TASK] = ['id'];
return $scenarios;
}
/** /**
* @return bool|int|string|null * @return bool|int|string|null
*/ */

View File

@ -98,10 +98,15 @@ class Reports extends \yii\db\ActiveRecord
return $this->hasOne(UserCard::className(), ['id' => 'user_card_id']); return $this->hasOne(UserCard::className(), ['id' => 'user_card_id']);
} }
public function getProject()
{
return $this->hasOne(Project::class, ['id' => 'project_id']);
}
/** /**
* @return \yii\db\ActiveQuery * @return \yii\db\ActiveQuery
*/ */
private function getUser(): \yii\db\ActiveQuery public function getUser(): \yii\db\ActiveQuery
{ {
return $this->hasOne(User::class, ['id' => 'user_id']); return $this->hasOne(User::class, ['id' => 'user_id']);
} }
@ -120,7 +125,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->minutes_spent = (int)$task['minutes_spent'];
$taskModel->status = 1; $taskModel->status = 1;
$taskModel->created_at = time(); $taskModel->created_at = time();
$taskModel->save(); $taskModel->save();
@ -137,7 +142,7 @@ class Reports extends \yii\db\ActiveRecord
public static function getFio($data) public static function getFio($data)
{ {
$user_card = UserCard::findOne(['id' => $data->user_card_id]); $user_card = UserCard::findOne(['id_user' => $data->user_id]);
return $user_card->fio ?? null; return $user_card->fio ?? null;
} }

View File

@ -68,7 +68,15 @@ class ReportsTask extends \yii\db\ActiveRecord
/** /**
* @return \yii\db\ActiveQuery * @return \yii\db\ActiveQuery
*/ */
public function getReport() public function getReport(): \yii\db\ActiveQuery
{
return $this->hasOne(Reports::className(), ['id' => 'report_id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getReports(): \yii\db\ActiveQuery
{ {
return $this->hasOne(Reports::className(), ['id' => 'report_id']); return $this->hasOne(Reports::className(), ['id' => 'report_id']);
} }

View File

@ -39,7 +39,8 @@
"developeruz/yii2-db-rbac": "*", "developeruz/yii2-db-rbac": "*",
"zircote/swagger-php": "^4.7", "zircote/swagger-php": "^4.7",
"phpoffice/phpspreadsheet": "^1.29", "phpoffice/phpspreadsheet": "^1.29",
"kartik-v/yii2-widget-datepicker": "dev-master" "kartik-v/yii2-widget-datepicker": "dev-master",
"codemix/yii2-excelexport": "^2.8"
}, },
"require-dev": { "require-dev": {
"yiisoft/yii2-debug": "~2.0.0", "yiisoft/yii2-debug": "~2.0.0",

664
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "7b050e44358a7b626599eb2c7a4bdc8d", "content-hash": "8e89be2ca5c8e3bae416f660ae380a33",
"packages": [ "packages": [
{ {
"name": "2amigos/yii2-file-upload-widget", "name": "2amigos/yii2-file-upload-widget",
@ -584,6 +584,54 @@
}, },
"time": "2013-12-10T17:49:58+00:00" "time": "2013-12-10T17:49:58+00:00"
}, },
{
"name": "codemix/yii2-excelexport",
"version": "2.8.2",
"source": {
"type": "git",
"url": "https://github.com/codemix/yii2-excelexport.git",
"reference": "f25a1731314c1c4e0df5294ae05e5d5d71d3a55e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/codemix/yii2-excelexport/zipball/f25a1731314c1c4e0df5294ae05e5d5d71d3a55e",
"reference": "f25a1731314c1c4e0df5294ae05e5d5d71d3a55e",
"shasum": ""
},
"require": {
"mikehaertl/php-tmpfile": "^1.0.0",
"php": ">=7.4",
"phpoffice/phpspreadsheet": "^1.25.2",
"yiisoft/yii2": "~2.0.13"
},
"type": "yii2-extension",
"autoload": {
"psr-4": {
"codemix\\excelexport\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Härtl",
"email": "haertl.mike@gmail.com"
}
],
"description": "A utility to quickly create Excel files from query results or raw data",
"keywords": [
"excel",
"export",
"yii2"
],
"support": {
"issues": "https://github.com/codemix/yii2-excelexport/issues",
"source": "https://github.com/codemix/yii2-excelexport/tree/2.8.2"
},
"time": "2023-01-18T15:27:19+00:00"
},
{ {
"name": "developeruz/yii2-db-rbac", "name": "developeruz/yii2-db-rbac",
"version": "1.1.3", "version": "1.1.3",
@ -1482,6 +1530,65 @@
], ],
"time": "2022-09-19T18:31:07+00:00" "time": "2022-09-19T18:31:07+00:00"
}, },
{
"name": "kartik-v/yii2-widget-datepicker",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/kartik-v/yii2-widget-datepicker.git",
"reference": "a42d8f56efa4e37af609c466c6133acab1a5c21e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kartik-v/yii2-widget-datepicker/zipball/a42d8f56efa4e37af609c466c6133acab1a5c21e",
"reference": "a42d8f56efa4e37af609c466c6133acab1a5c21e",
"shasum": ""
},
"require": {
"kartik-v/yii2-krajee-base": ">=2.0.0"
},
"default-branch": true,
"type": "yii2-extension",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"psr-4": {
"kartik\\date\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kartik Visweswaran",
"email": "kartikv2@gmail.com",
"homepage": "http://www.krajee.com/"
}
],
"description": "Enhanced Yii2 wrapper for the bootstrap datepicker plugin (sub repo split from yii2-widgets).",
"homepage": "https://github.com/kartik-v/yii2-widget-datepicker",
"keywords": [
"date",
"extension",
"form",
"jquery",
"picker",
"plugin",
"select2",
"widget",
"yii2"
],
"support": {
"issues": "https://github.com/kartik-v/yii2-widget-datepicker/issues",
"source": "https://github.com/kartik-v/yii2-widget-datepicker/tree/master"
},
"time": "2023-07-28T07:45:11+00:00"
},
{ {
"name": "kartik-v/yii2-widget-depdrop", "name": "kartik-v/yii2-widget-depdrop",
"version": "dev-master", "version": "dev-master",
@ -1810,6 +1917,194 @@
], ],
"time": "2022-10-10T10:11:09+00:00" "time": "2022-10-10T10:11:09+00:00"
}, },
{
"name": "maennchen/zipstream-php",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-zlib": "*",
"php-64bit": "^8.1"
},
"require-dev": {
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.16",
"guzzlehttp/guzzle": "^7.5",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.5",
"phpunit/phpunit": "^10.0",
"vimeo/psalm": "^5.0"
},
"suggest": {
"guzzlehttp/psr7": "^2.4",
"psr/http-message": "^2.0"
},
"type": "library",
"autoload": {
"psr-4": {
"ZipStream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paul Duncan",
"email": "pabs@pablotron.org"
},
{
"name": "Jonatan Männchen",
"email": "jonatan@maennchen.ch"
},
{
"name": "Jesse Donat",
"email": "donatj@gmail.com"
},
{
"name": "András Kolesár",
"email": "kolesar@kolesar.hu"
}
],
"description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.",
"keywords": [
"stream",
"zip"
],
"support": {
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.0"
},
"funding": [
{
"url": "https://github.com/maennchen",
"type": "github"
},
{
"url": "https://opencollective.com/zipstream",
"type": "open_collective"
}
],
"time": "2023-06-21T14:59:35+00:00"
},
{
"name": "markbaker/complex",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPComplex.git",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Complex\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@lange.demon.co.uk"
}
],
"description": "PHP Class for working with complex numbers",
"homepage": "https://github.com/MarkBaker/PHPComplex",
"keywords": [
"complex",
"mathematics"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPComplex/issues",
"source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2"
},
"time": "2022-12-06T16:21:08+00:00"
},
{
"name": "markbaker/matrix",
"version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPMatrix.git",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpdocumentor/phpdocumentor": "2.*",
"phploc/phploc": "^4.0",
"phpmd/phpmd": "2.*",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"sebastian/phpcpd": "^4.0",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Matrix\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@demon-angel.eu"
}
],
"description": "PHP Class for working with matrices",
"homepage": "https://github.com/MarkBaker/PHPMatrix",
"keywords": [
"mathematics",
"matrix",
"vector"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPMatrix/issues",
"source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1"
},
"time": "2022-12-02T22:17:43+00:00"
},
{ {
"name": "mihaildev/yii2-ckeditor", "name": "mihaildev/yii2-ckeditor",
"version": "1.0.1", "version": "1.0.1",
@ -1921,6 +2216,50 @@
}, },
"time": "2019-06-07T20:43:53+00:00" "time": "2019-06-07T20:43:53+00:00"
}, },
{
"name": "mikehaertl/php-tmpfile",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/mikehaertl/php-tmpfile.git",
"reference": "70a5b70b17bc0d9666388e6a551ecc93d0b40a10"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mikehaertl/php-tmpfile/zipball/70a5b70b17bc0d9666388e6a551ecc93d0b40a10",
"reference": "70a5b70b17bc0d9666388e6a551ecc93d0b40a10",
"shasum": ""
},
"require-dev": {
"php": ">=5.3.0",
"phpunit/phpunit": ">4.0 <=9.4"
},
"type": "library",
"autoload": {
"psr-4": {
"mikehaertl\\tmp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Härtl",
"email": "haertl.mike@gmail.com"
}
],
"description": "A convenience class for temporary files",
"keywords": [
"files"
],
"support": {
"issues": "https://github.com/mikehaertl/php-tmpfile/issues",
"source": "https://github.com/mikehaertl/php-tmpfile/tree/1.2.1"
},
"time": "2021-03-01T18:26:25+00:00"
},
{ {
"name": "mirocow/yii2-eav", "name": "mirocow/yii2-eav",
"version": "v0.7.2", "version": "v0.7.2",
@ -2279,6 +2618,111 @@
}, },
"time": "2015-12-19T14:08:53+00:00" "time": "2015-12-19T14:08:53+00:00"
}, },
{
"name": "phpoffice/phpspreadsheet",
"version": "1.29.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
"ext-zip": "*",
"ext-zlib": "*",
"ezyang/htmlpurifier": "^4.15",
"maennchen/zipstream-php": "^2.1 || ^3.0",
"markbaker/complex": "^3.0",
"markbaker/matrix": "^3.0",
"php": "^7.4 || ^8.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-main",
"dompdf/dompdf": "^1.0 || ^2.0",
"friendsofphp/php-cs-fixer": "^3.2",
"mitoteam/jpgraph": "^10.3",
"mpdf/mpdf": "^8.1.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.0 || ^10.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5"
},
"suggest": {
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
"ext-intl": "PHP Internationalization Functions",
"mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
"tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "https://blog.maartenballiauw.be"
},
{
"name": "Mark Baker",
"homepage": "https://markbakeruk.net"
},
{
"name": "Franck Lefevre",
"homepage": "https://rootslabs.net"
},
{
"name": "Erik Tilt"
},
{
"name": "Adrien Crivelli"
}
],
"description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
"keywords": [
"OpenXML",
"excel",
"gnumeric",
"ods",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.0"
},
"time": "2023-06-14T22:48:31+00:00"
},
{ {
"name": "phpoffice/phpword", "name": "phpoffice/phpword",
"version": "0.18.3", "version": "0.18.3",
@ -2440,6 +2884,113 @@
}, },
"time": "2021-02-03T23:26:27+00:00" "time": "2021-02-03T23:26:27+00:00"
}, },
{
"name": "psr/http-client",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client"
},
"time": "2023-09-23T14:17:50+00:00"
},
{
"name": "psr/http-factory",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/master"
},
"time": "2019-04-30T12:38:16+00:00"
},
{ {
"name": "psr/http-message", "name": "psr/http-message",
"version": "1.0.1", "version": "1.0.1",
@ -2543,6 +3094,57 @@
}, },
"time": "2021-07-14T16:41:46+00:00" "time": "2021-07-14T16:41:46+00:00"
}, },
{
"name": "psr/simple-cache",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/simple-cache.git",
"reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865",
"reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\SimpleCache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interfaces for simple caching",
"keywords": [
"cache",
"caching",
"psr",
"psr-16",
"simple-cache"
],
"support": {
"source": "https://github.com/php-fig/simple-cache/tree/3.0.0"
},
"time": "2021-10-29T13:26:27+00:00"
},
{ {
"name": "rmrevin/yii2-fontawesome", "name": "rmrevin/yii2-fontawesome",
"version": "2.17.1", "version": "2.17.1",
@ -5670,61 +6272,6 @@
}, },
"time": "2019-01-08T18:20:26+00:00" "time": "2019-01-08T18:20:26+00:00"
}, },
{
"name": "psr/http-factory",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/master"
},
"time": "2019-04-30T12:38:16+00:00"
},
{ {
"name": "psy/psysh", "name": "psy/psysh",
"version": "v0.11.14", "version": "v0.11.14",
@ -7809,12 +8356,13 @@
"kartik-v/yii2-grid": 20, "kartik-v/yii2-grid": 20,
"kartik-v/yii2-widget-depdrop": 20, "kartik-v/yii2-widget-depdrop": 20,
"kartik-v/yii2-widget-fileinput": 20, "kartik-v/yii2-widget-fileinput": 20,
"kartik-v/yii2-mpdf": 20 "kartik-v/yii2-mpdf": 20,
"kartik-v/yii2-widget-datepicker": 20
}, },
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": ">=7.4.0", "php": ">=8.0",
"ext-json": "*" "ext-json": "*"
}, },
"platform-dev": [], "platform-dev": [],

View File

@ -197,7 +197,7 @@ class ProjectController extends ApiController
->one(); ->one();
if (empty($projectTaskCategory)) { if (empty($projectTaskCategory)) {
throw new NotFoundHttpException('The project not found'); throw new BadRequestHttpException('This user cannot be added to the project');
} }
$projectTaskCategory->title = Yii::$app->request->post('new_title'); $projectTaskCategory->title = Yii::$app->request->post('new_title');

View File

@ -82,8 +82,8 @@ class RequestController extends ApiController
/** /**
* *
* @OA\Get(path="/request/get-request-list", * @OA\Get(path="/request/get-request-list",
* summary="Создать запрос", * summary="Получить список запросов",
* description="Метод для создания запроса, если параметр user_id не передан, то запрос создается от имени текущего пользователя.", * description="Метод для получения списка запросов, если параметр user_id не передан, то запрос создается от имени текущего пользователя.",
* security={ * security={
* {"bearerAuth": {}} * {"bearerAuth": {}}
* }, * },
@ -108,7 +108,7 @@ class RequestController extends ApiController
* ), * ),
* @OA\Response( * @OA\Response(
* response=200, * response=200,
* description="Возвращает объект Запроса", * description="Возвращает массив объектов Запроса",
* @OA\MediaType( * @OA\MediaType(
* mediaType="application/json", * mediaType="application/json",
* @OA\Schema(ref="#/components/schemas/RequestsExample"), * @OA\Schema(ref="#/components/schemas/RequestsExample"),

View File

@ -2,6 +2,7 @@
namespace frontend\modules\api\controllers; namespace frontend\modules\api\controllers;
use common\classes\Debug;
use common\models\ProjectTask; use common\models\ProjectTask;
use common\models\ProjectTaskUser; use common\models\ProjectTaskUser;
use common\models\User; use common\models\User;

View File

@ -4,8 +4,9 @@
namespace frontend\modules\api\models; namespace frontend\modules\api\models;
use common\classes\Debug; use common\classes\Debug;
use common\models\Reports;
use yii\base\Model; use yii\base\Model;
use yii\db\ActiveQuery;
use yii\db\ActiveRecord;
/** */ /** */
class ReportSearchForm extends Model class ReportSearchForm extends Model
@ -43,9 +44,12 @@ class ReportSearchForm extends Model
]; ];
} }
public function byParams() /**
* @return array|ActiveRecord
*/
public function byParams(): array | ActiveRecord
{ {
$queryBuilder = Reports::find()->with('task'); $queryBuilder = Reports::find();
if ($this->fromDate && $this->toDate) { if ($this->fromDate && $this->toDate) {
$queryBuilder->andWhere(['between', 'reports.created_at', $this->fromDate, $this->toDate]); $queryBuilder->andWhere(['between', 'reports.created_at', $this->fromDate, $this->toDate]);
@ -58,7 +62,7 @@ class ReportSearchForm extends Model
// $queryBuilder->limit($this->limit) // $queryBuilder->limit($this->limit)
// ->offset($this->offset); // ->offset($this->offset);
return $queryBuilder->asArray()->all(); return $queryBuilder->all();
} }
public function findByDate() public function findByDate()

View File

@ -136,6 +136,10 @@ namespace frontend\modules\api\models;
* property="task", * property="task",
* ref="#/components/schemas/ProjectTaskReportsExample", * ref="#/components/schemas/ProjectTaskReportsExample",
* ), * ),
* @OA\Property(
* property="project",
* ref="#/components/schemas/ProjectExample",
* ),
* ), * ),
*) *)
* *
@ -143,4 +147,23 @@ namespace frontend\modules\api\models;
class Reports extends \common\models\Reports class Reports extends \common\models\Reports
{ {
/**
* @return string[]
*/
public function fields(): array
{
return [
'difficulties',
'tomorrow',
'created_at',
'status',
'user_card_id',
'user_id',
'project_id',
'project',
'company_id',
'task',
];
}
} }

View File

@ -112,6 +112,12 @@ class Project extends \common\models\Project
return $this->hh; return $this->hh;
}, },
'owner_id', 'owner_id',
'owner_info' => function(){
return [
"fio" => $this->owner->userCard->fio ?? ($this->user->id ?? ''),
"avatar" => $this->owner->userCard->photo ?? '',
];
},
'company' => function() { 'company' => function() {
return $this->company; return $this->company;
}, },