merge
This commit is contained in:
commit
ed0cd2b124
2
.gitignore
vendored
2
.gitignore
vendored
@ -22,7 +22,7 @@ Thumbs.db
|
||||
|
||||
# composer itself is not needed
|
||||
composer.phar
|
||||
|
||||
/composer.lock
|
||||
# Mac DS_Store Files
|
||||
.DS_Store
|
||||
|
||||
|
@ -85,7 +85,7 @@ class UserCardSearch extends UserCard
|
||||
|
||||
$query->orderBy('user_card.updated_at DESC');
|
||||
|
||||
$query->groupBy('card_skill.card_id');
|
||||
// $query->groupBy('card_skill.card_id');
|
||||
|
||||
$sumQuery = clone $query;
|
||||
|
||||
|
@ -79,7 +79,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'data' => \common\models\UserCard::getNameSkills(),
|
||||
'options' => ['multiple' => true, 'placeholder' => 'Выбрать параметр', 'class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
'allowClear' => true,
|
||||
],
|
||||
]),
|
||||
],
|
||||
|
47
backend/modules/reports/controllers/AjaxController.php
Normal file
47
backend/modules/reports/controllers/AjaxController.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\reports\controllers;
|
||||
|
||||
use backend\modules\reports\models\Month;
|
||||
use common\classes\Debug;
|
||||
use Yii;
|
||||
use backend\modules\reports\models\ReportsSearch;
|
||||
use yii\web\JsonResponseFormatter;
|
||||
use yii\web\Response;
|
||||
|
||||
class AjaxController extends \yii\web\Controller
|
||||
{
|
||||
|
||||
public function actionGetReportsForMonthByIdYearMonth($id, $year=null, $month=null){
|
||||
if (!($year and $month)){
|
||||
$searchModel->month = date('m');
|
||||
$searchModel->year = date('Y');
|
||||
Debug::prn('Неверный год или месяц');
|
||||
}
|
||||
|
||||
$searchModel = new ReportsSearch();
|
||||
$searchModel->id = $id;
|
||||
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
$reports = $dataProvider->getModels();
|
||||
$reports_no_task = array_column($reports, 'attributes');
|
||||
for ($i = 0; $i<count($reports); $i++){
|
||||
$reports_no_task[$i]['today'] = array_column( $reports[$i]->task, 'attributes');
|
||||
}
|
||||
$reports = $reports_no_task;
|
||||
|
||||
$month = new Month($year.'-'.$month.'-01');
|
||||
|
||||
|
||||
$response = Yii::$app->response;
|
||||
|
||||
$response->format = Response::FORMAT_JSON;
|
||||
|
||||
$response->content = json_encode(array_merge(['reports' => $reports_no_task],
|
||||
['month'=>(array)$month]));
|
||||
$response->getHeaders()->set('Content-Type', 'application/json; charset=utf-8');
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
namespace backend\modules\reports\controllers;
|
||||
|
||||
use backend\modules\card\models\UserCardSearch;
|
||||
use common\classes\Debug;
|
||||
use backend\modules\reports\models\Month;
|
||||
use Yii;
|
||||
use common\models\Reports;
|
||||
use backend\modules\reports\models\ReportsSearch;
|
||||
@ -49,14 +49,55 @@ class ReportsController extends Controller
|
||||
public function actionIndex()
|
||||
{
|
||||
$searchModel = new ReportsSearch();
|
||||
$reports = $searchModel->search([])->getModels();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
$user_id__fio = [];
|
||||
for ($i=0; $i<count($reports);$i++){
|
||||
$user_id__fio[$reports[$i]->user_card_id] = \common\models\Reports::getFio($reports[$i]);
|
||||
}
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
'user_id__fio' => $user_id__fio,
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function actionUser($id, $date = null)
|
||||
{
|
||||
if (!(isset($date) and preg_match("/^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/", $date))) {
|
||||
$date = date('Y-m-01');
|
||||
}
|
||||
$date = date('Y-m-01', strtotime($date));
|
||||
|
||||
$searchModel = new ReportsSearch();
|
||||
$searchModel->id = $id;
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
$reports = $dataProvider->getModels();
|
||||
|
||||
$ID = $reports[0]->user_card_id;
|
||||
|
||||
$reports_no_task = array_column($reports, 'attributes');
|
||||
for ($i = 0; $i < count($reports); $i++) {
|
||||
$reports_no_task[$i]['today'] = array_column($reports[$i]->task, 'attributes');
|
||||
}
|
||||
$month = new Month($date);
|
||||
|
||||
if (!Yii::$app->request->isAjax) {
|
||||
return $this->render('user', [
|
||||
'ID' => $ID,
|
||||
'reports' => $reports,
|
||||
'reports_month' => json_encode(array_merge(['reports' => $reports_no_task],
|
||||
['month' => (array)$month])),
|
||||
'date' => $date
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionGroup()
|
||||
{
|
||||
$searchModel = new UserCardSearch();
|
||||
@ -66,6 +107,7 @@ class ReportsController extends Controller
|
||||
return $this->render('group', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
87
backend/modules/reports/models/Month.php
Normal file
87
backend/modules/reports/models/Month.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace backend\modules\reports\models;
|
||||
|
||||
use common\classes\Debug;
|
||||
use yii\base\Model;
|
||||
use function GuzzleHttp\Psr7\str;
|
||||
|
||||
class Month
|
||||
{
|
||||
|
||||
public $inactive_begin;
|
||||
public $inactive_end;
|
||||
public $active;
|
||||
public $days;
|
||||
|
||||
public function __construct($date = null)
|
||||
{
|
||||
$this->inactive_begin = [];
|
||||
$this->inactive_end = [];
|
||||
if (!$date and !self::is_date($date)) {
|
||||
$date = date('Y-m-d');
|
||||
}
|
||||
|
||||
$first_day_of_week = self::get_day_week(self::get_first_day($date));
|
||||
$quantity_days = self::get_days_month($date);
|
||||
|
||||
$day = 1;
|
||||
|
||||
for (
|
||||
$index = $first_day_of_week;
|
||||
$index < $first_day_of_week + $quantity_days;
|
||||
$index++, $day++
|
||||
) {
|
||||
$this->active[$index] = $day;
|
||||
}
|
||||
|
||||
$prev_month = date('Y-m-d', strtotime(self::get_first_day($date)) - 3600 * 37);
|
||||
|
||||
$day = self::get_days_month($prev_month);
|
||||
|
||||
for ($index = $first_day_of_week - 1; $index >= 1; $index--, $day--) {
|
||||
$this->inactive_begin[$index] = $day;
|
||||
}
|
||||
$day = 1;
|
||||
$index_end = (in_array($first_day_of_week, [6,7])?42:35);
|
||||
for ($index = $quantity_days + $first_day_of_week; $index <=$index_end; $index++, $day++) {
|
||||
$this->inactive_end[$index] = $day;
|
||||
}
|
||||
|
||||
$this->days = array_merge($this->inactive_end, $this->inactive_begin, $this->active);
|
||||
|
||||
}
|
||||
|
||||
public static function next_day($date, $number)
|
||||
{
|
||||
return date('Y-m-d', strtotime($date) + 3600 * 24 * $number);
|
||||
}
|
||||
|
||||
public static function get_first_day($date)
|
||||
{
|
||||
return date('Y-m-01', strtotime($date));
|
||||
}
|
||||
|
||||
public static function get_day_week($date)
|
||||
{
|
||||
$day = date('w', strtotime(date($date)));
|
||||
if($day==0)
|
||||
return 7;
|
||||
return $day;
|
||||
}
|
||||
|
||||
public static function is_date($date)
|
||||
{
|
||||
$date = date_parse($date);
|
||||
if ($date or checkdate($date['month'], $date['day'], $date['year']))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static function get_days_month($date)
|
||||
{
|
||||
return date("t", strtotime($date));
|
||||
}
|
||||
|
||||
}
|
@ -6,12 +6,14 @@ use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Reports;
|
||||
|
||||
|
||||
/**
|
||||
* ReportsSearch represents the model behind the search form of `common\models\Reports`.
|
||||
*/
|
||||
class ReportsSearch extends Reports
|
||||
{
|
||||
public $fio;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -57,16 +59,28 @@ class ReportsSearch extends Reports
|
||||
|
||||
$this->load($params);
|
||||
|
||||
if (!$this->validate()) {
|
||||
// uncomment the following line if you do not want to return any records when validation fails
|
||||
// $query->where('0=1');
|
||||
return $dataProvider;
|
||||
|
||||
if (isset($params['year'])) {
|
||||
$query->andFilterWhere(['=', 'YEAR(reports.created_at)', $params['year']]);
|
||||
}
|
||||
if (isset($params['month'])) {
|
||||
$query->andFilterWhere(['=', 'MONTH(reports.created_at)', $params['month']]);
|
||||
}
|
||||
|
||||
// if (!$this->validate()) {
|
||||
// // uncomment the following line if you do not want to return any records when validation fails
|
||||
// // $query->where('0=1');
|
||||
//
|
||||
// return $dataProvider;
|
||||
// }
|
||||
|
||||
// grid filtering conditions
|
||||
|
||||
|
||||
|
||||
$query->andFilterWhere([
|
||||
'id' => $this->id,
|
||||
'created_at' => $this->created_at,
|
||||
'user_card.id' => $this->id,
|
||||
'reports.created_at' => $this->created_at,
|
||||
'user_card_id' => $this->user_card_id,
|
||||
]);
|
||||
|
||||
@ -75,6 +89,7 @@ class ReportsSearch extends Reports
|
||||
->andFilterWhere(['like', 'tomorrow', $this->tomorrow])
|
||||
->andFilterWhere(['like', 'user_card.fio', $this->fio]);
|
||||
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
||||
|
1786
backend/modules/reports/views/reports/_user.php
Normal file
1786
backend/modules/reports/views/reports/_user.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,56 +1,151 @@
|
||||
<?php
|
||||
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\modules\reports\models\ReportsSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
/* @var $user_id__fio */
|
||||
|
||||
$this->title = 'Отчеты';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
define('TODAY', date('Y-m-d'));
|
||||
define('WEEK_AGO', date('Y-m-d', time() - 3600 * 24 * 7));
|
||||
function next_day($date, $number)
|
||||
{
|
||||
return date('Y-m-d', strtotime($date) + 3600 * 24 * $number);
|
||||
}
|
||||
?>
|
||||
<div class="reports-index">
|
||||
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
<?= Html::a('Сгрупированный по пользователям вид', ['group'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
if (!$_GET){
|
||||
$url = '../..'.Yii::$app->request->url .'?ReportsSearch[created_at]=';
|
||||
} else{
|
||||
$url = '../..'.Yii::$app->request->url .'&ReportsSearch[created_at]=';
|
||||
}
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
for ($date = TODAY;
|
||||
$date != WEEK_AGO;
|
||||
$date = next_day($date, -1)): ?>
|
||||
|
||||
'created_at',
|
||||
[
|
||||
'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',
|
||||
[
|
||||
'format' => 'raw',
|
||||
'attribute' => 'ФИО',
|
||||
'filter' => Html::activeTextInput($searchModel, 'fio', ['class' => 'form-control']),
|
||||
'value' => function ($data) { return \common\models\Reports::getFio($data); },
|
||||
],
|
||||
<?= Html::a($date, [$url. $date], ['class' => 'btn btn-primary']) ?>
|
||||
<?php endfor; ?></div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
|
||||
<form method="get" style="display: inline-flex;">
|
||||
<?php if(isset($_GET['ReportsSearch'])):?>
|
||||
<input name="ReportsSearch[today]" type="hidden" value="<?=($_GET['ReportsSearch']['today'])?>">
|
||||
<input name="ReportsSearch[difficulties]" type="hidden" value="<?=($_GET['ReportsSearch']['difficulties'])?>">
|
||||
<input name="ReportsSearch[tomorrow]" type="hidden" value="<?=($_GET['ReportsSearch']['tomorrow'])?>">
|
||||
<input name="ReportsSearch[user_card_id]" type="hidden">
|
||||
<?php if(isset($_GET['ReportsSearch']['user_card_id'])){
|
||||
foreach ($_GET['ReportsSearch']['user_card_id'] as $res)
|
||||
echo
|
||||
'<input name="ReportsSearch[user_card_id][]" type="hidden" value="'.$res.'">';
|
||||
}
|
||||
?>
|
||||
<?php endif;
|
||||
?>
|
||||
|
||||
<?= Html::input('date', 'ReportsSearch[created_at]',
|
||||
isset($_GET['ReportsSearch']['created_at']) ? $_GET['ReportsSearch']['created_at'] : date('Y-m-d'), [
|
||||
'class' => 'form-control',
|
||||
'style' => 'display:',
|
||||
'id' => 'date'
|
||||
|
||||
]) ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?= Html::button('Сортировка по дате', ['class' => 'btn btn-danger sort_by_date', 'type' => 'submit']) ?>
|
||||
|
||||
<?= Html::a('Все дни', ['index'], ['class' => 'btn btn-dark']) ?>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
</div>
|
||||
</p>
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
[
|
||||
'format' => 'raw',
|
||||
'attribute' => 'created_at',
|
||||
'filter' => Html::input('date', 'ReportsSearch[created_at]',
|
||||
null, [
|
||||
'class' => 'form-control',
|
||||
'style' => 'display:',
|
||||
'id' => 'date'
|
||||
|
||||
]) ,
|
||||
'value' => 'created_at',
|
||||
],
|
||||
[
|
||||
'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',
|
||||
[
|
||||
'format' => 'raw',
|
||||
'attribute' => 'user_card_id',
|
||||
'filter' => kartik\select2\Select2::widget([
|
||||
'model' => $searchModel,
|
||||
'attribute' => 'user_card_id',
|
||||
'data' => $user_id__fio,
|
||||
'options' => ['multiple' => true, 'class' => 'form-control'],
|
||||
'pluginOptions' => [
|
||||
|
||||
'multiple' => true,
|
||||
],
|
||||
]),
|
||||
'value' => function ($data) {
|
||||
return '<a href="'.Yii::getAlias('@web').'/reports/reports/user?id=' . $data['user_card_id'] . '">' . \common\models\Reports::getFio($data) . '</a>';
|
||||
},
|
||||
],
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]);
|
||||
$this->registerCssFile('../../css/site.css');
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.row * {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
</style>
|
747
backend/modules/reports/views/reports/user.php
Normal file
747
backend/modules/reports/views/reports/user.php
Normal file
@ -0,0 +1,747 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use common\models\Reports;
|
||||
use backend\modules\reports\models\Month;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\modules\reports\models\ReportsSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
/* @var $reports common\models\Reports */
|
||||
/* @var $ID */
|
||||
/* @var $reports_month */
|
||||
/* @var $date */
|
||||
|
||||
|
||||
|
||||
$month = new Month($date);
|
||||
$index_raw = 0;
|
||||
|
||||
function next_day($date, $number)
|
||||
{
|
||||
return date('Y-m-d', strtotime($date) + 3600 * 24 * $number);
|
||||
}
|
||||
|
||||
function get_dates_created_at(Reports $report)
|
||||
{
|
||||
return $report->created_at;
|
||||
}
|
||||
|
||||
function get_color($date, $dates_created_at)
|
||||
{
|
||||
if (in_array(Month::get_day_week($date), array(6, 7)))
|
||||
return;
|
||||
if (in_array($date, $dates_created_at)) {
|
||||
return 'success';
|
||||
} else
|
||||
return 'danger';
|
||||
}
|
||||
|
||||
$this->title = 'Календарь пользователя - ' . Reports::getFio($reports[0]);
|
||||
$dates_created_at = array_unique(array_map('get_dates_created_at', $reports));
|
||||
?>
|
||||
<section class="calendar-contain">
|
||||
<aside class="calendar__sidebar">
|
||||
<section class="title-bar">
|
||||
<?= Html::input('date', 'date', isset($_GET['date']) ? $_GET['date'] : date('Y-m-d'), [
|
||||
'class' => 'form-control',
|
||||
'style' => 'display:',
|
||||
'id' => 'date',
|
||||
]) ?>
|
||||
|
||||
</section>
|
||||
<h2 class="sidebar__heading"><?= date('l') ?><br><?= date('F d') ?></h2>
|
||||
<ul class="sidebar__list">
|
||||
|
||||
</ul>
|
||||
</aside>
|
||||
<section class="calendar__days">
|
||||
</section>
|
||||
|
||||
</section>
|
||||
<script>
|
||||
|
||||
class HtmlCalendar {
|
||||
|
||||
constructor(month, reports, before = '') {
|
||||
this.month = month;
|
||||
this.reports = reports;
|
||||
this.before = before;
|
||||
this.datePicker = datePicker;
|
||||
|
||||
this.classDay = 'calendar__day';
|
||||
|
||||
this.nameDate = document.querySelector('.sidebar__heading');
|
||||
|
||||
this.initBefore();
|
||||
}
|
||||
|
||||
getHtml() {
|
||||
this.getInactiveBegin();
|
||||
this.getActive();
|
||||
this.getInactiveEnd();
|
||||
return this.html;
|
||||
}
|
||||
|
||||
update(month, reports) {
|
||||
this.month = month;
|
||||
this.reports = reports;
|
||||
this.initBefore();
|
||||
|
||||
}
|
||||
|
||||
initBefore() {
|
||||
this.html = '';
|
||||
this.index = 1;
|
||||
this.indexRaw = 0;
|
||||
this.date = document.querySelector('#date').value.substr(0, 7);
|
||||
}
|
||||
|
||||
getInactiveBegin() {
|
||||
if (Object.keys(this.month['inactive_begin']).length > 0) {
|
||||
this.html += '<section class="calendar__week">';
|
||||
|
||||
for (; this.index <= Object.keys(this.month['inactive_begin']).length; this.index++, this.indexRaw++) {
|
||||
this.html += this.getCalendarDay('inactive_begin', 'inactive');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getActive() {
|
||||
for (; this.index <= this.getLastKey(this.month['active']); this.index++, this.indexRaw++) {
|
||||
if (this.indexRaw % 7 == 0) {
|
||||
if (this.index != 1) {
|
||||
this.html += '</section>';
|
||||
}
|
||||
this.html += '<section class="calendar__week">';
|
||||
}
|
||||
this.html += this.getCalendarDay('active')
|
||||
}
|
||||
}
|
||||
|
||||
getInactiveEnd() {
|
||||
for (; this.index <= this.getLastKey(this.month['inactive_end']); this.index++, this.indexRaw++) {
|
||||
if (this.indexRaw % 7 == 0) {
|
||||
this.html += `</section>
|
||||
<section class="calendar__week ">`;
|
||||
}
|
||||
this.html += this.getCalendarDay('inactive_end', 'inactive');
|
||||
}
|
||||
}
|
||||
|
||||
getCalendarDay(type, className = '') {
|
||||
return `<div class="${this.classDay} ${className}">
|
||||
<span class="calendar__date ${this.getColor(this.date + '-' + this.month[type][this.index])}">${this.month[type][this.index]}</span>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
getColor(date) {
|
||||
let d = new Date(date)
|
||||
if ([6, 0].includes(d.getDay()))
|
||||
return;
|
||||
for (let i in this.reports) {
|
||||
if (this.reports[i]['created_at'] == date) {
|
||||
return 'success';
|
||||
}
|
||||
}
|
||||
return 'danger';
|
||||
}
|
||||
|
||||
getLastKey(obj) {
|
||||
return Object.keys(obj)[Object.keys(obj).length - 1];
|
||||
}
|
||||
}
|
||||
|
||||
class HtmlReports {
|
||||
constructor(reports) {
|
||||
//TODO выходные дни - праздники
|
||||
this.reports = reports;
|
||||
}
|
||||
|
||||
getHtmlByDate(date) {
|
||||
|
||||
if ([0, 6].includes(new Date(date).getDay())) {
|
||||
return "Выходной день";
|
||||
}
|
||||
if (!this.reports)
|
||||
return 'Нет репортов за месяц';
|
||||
let j = 0;
|
||||
let html = `<ul class="sidebar__list">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th><a href="/secure/reports/reports/index?date=2021-08-31&sort=today" data-sort="today">Что
|
||||
было сделано
|
||||
сегодня?</a></th>
|
||||
<th><a href="/secure/reports/reports/index?date=2021-08-31&sort=difficulties"
|
||||
data-sort="difficulties">Какие
|
||||
сложности возникли?</a></th>
|
||||
<th><a href="/secure/reports/reports/index?date=2021-08-31&sort=tomorrow" data-sort="tomorrow">Что
|
||||
планируется сделать завтра?</a></th>
|
||||
<th class="action-column"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>`;
|
||||
for (let k = 0, i = 0, report = this.reports[i]; i < Object.keys(this.reports).length; i++) {
|
||||
report = this.reports[i];
|
||||
if (report['created_at'] == date) {
|
||||
k++;
|
||||
html += `<tr data-key="${report['id']}">
|
||||
<td>${k}</td><td>`;
|
||||
|
||||
for (j = 0; j < Object.keys(report['today']).length; j++) {
|
||||
html += `<p>${j + 1}. (${report['today'][j]['hours_spent']} ч.)
|
||||
${report['today'][j]['task']}</p>`
|
||||
}
|
||||
|
||||
html += `</td>
|
||||
<td>${report['difficulties']}</td>
|
||||
<td>${report['tomorrow']}</td>
|
||||
<td>
|
||||
<a href="/secure/reports/reports/view?id=${report['id']}" title="Просмотр" aria-label="Просмотр"
|
||||
data-pjax="0">
|
||||
<svg aria-hidden="true"
|
||||
style="display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em;width:1.125em"
|
||||
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512">
|
||||
<path fill="currentColor"
|
||||
d="M573 241C518 136 411 64 288 64S58 136 3 241a32 32 0 000 30c55 105 162 177 285 177s230-72 285-177a32 32 0 000-30zM288 400a144 144 0 11144-144 144 144 0 01-144 144zm0-240a95 95 0 00-25 4 48 48 0 01-67 67 96 96 0 1092-71z"></path>
|
||||
</svg>
|
||||
</a>
|
||||
<a href="/secure/reports/reports/update?id=${report['id']}" title="Редактировать"
|
||||
aria-label="Редактировать"
|
||||
data-pjax="0">
|
||||
<svg aria-hidden="true"
|
||||
style="display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em;width:1em"
|
||||
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<path fill="currentColor"
|
||||
d="M498 142l-46 46c-5 5-13 5-17 0L324 77c-5-5-5-12 0-17l46-46c19-19 49-19 68 0l60 60c19 19 19 49 0 68zm-214-42L22 362 0 484c-3 16 12 30 28 28l122-22 262-262c5-5 5-13 0-17L301 100c-4-5-12-5-17 0zM124 340c-5-6-5-14 0-20l154-154c6-5 14-5 20 0s5 14 0 20L144 340c-6 5-14 5-20 0zm-36 84h48v36l-64 12-32-31 12-65h36v48z"></path>
|
||||
</svg>
|
||||
</a>
|
||||
<a href="/secure/reports/reports/delete?id=${report['id']}" title="Удалить" aria-label="Удалить"
|
||||
data-pjax="0"
|
||||
data-confirm="Вы уверены, что хотите удалить этот элемент?" data-method="post">
|
||||
<svg aria-hidden="true"
|
||||
style="display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em;width:.875em"
|
||||
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
||||
<path fill="currentColor"
|
||||
d="M32 464a48 48 0 0048 48h288a48 48 0 0048-48V128H32zm272-256a16 16 0 0132 0v224a16 16 0 01-32 0zm-96 0a16 16 0 0132 0v224a16 16 0 01-32 0zm-96 0a16 16 0 0132 0v224a16 16 0 01-32 0zM432 32H312l-9-19a24 24 0 00-22-13H167a24 24 0 00-22 13l-9 19H16A16 16 0 000 48v32a16 16 0 0016 16h416a16 16 0 0016-16V48a16 16 0 00-16-16z"></path>
|
||||
</svg>
|
||||
</a></td>
|
||||
`;
|
||||
}
|
||||
}
|
||||
if (j == 0) {
|
||||
return "За этот день не было отчетов";
|
||||
}
|
||||
|
||||
|
||||
return html;
|
||||
}
|
||||
};
|
||||
|
||||
const CALENDAR_BAR = ` < section
|
||||
|
||||
class
|
||||
|
||||
= "calendar__top-bar" >
|
||||
< span
|
||||
|
||||
class
|
||||
|
||||
= "top-bar__days" > Mon < /span>
|
||||
<span class="top-bar__days">Tue</span>
|
||||
<span class="top-bar__days">Wed</span>
|
||||
<span class="top-bar__days">Thu</span>
|
||||
<span class="top-bar__days">Fri</span>
|
||||
<span class="top-bar__days">Sat</span>
|
||||
<span class="top-bar__days">Sun</span>
|
||||
</section>
|
||||
`;
|
||||
|
||||
let reports = (JSON.parse('<?=$reports_month?>'))['reports'];
|
||||
let month = (JSON.parse('<?=$reports_month?>'))['month'];
|
||||
let datePicker = document.querySelector('#date');
|
||||
let oldDate = datePicker.value.substr(0, 7);
|
||||
let nameDate = document.querySelector('.sidebar__heading');
|
||||
|
||||
let reportsBoard = document.querySelector('.sidebar__list');
|
||||
let htmlReports = new HtmlReports(reports);
|
||||
|
||||
let htmlCalendar = new HtmlCalendar(month, reports, CALENDAR_BAR);
|
||||
let calendar = document.querySelector('.calendar__days');
|
||||
|
||||
|
||||
calendar.load = async function () {
|
||||
|
||||
htmlCalendar.update(month, reports)
|
||||
calendar.innerHTML = htmlCalendar.getHtml();
|
||||
|
||||
htmlReports.reports = reports;
|
||||
htmlReports.getHtmlByDate('2021-08-31')
|
||||
|
||||
datePicker.onchange = function () {
|
||||
if (!isOldDatePicker(datePicker, oldDate)) {
|
||||
oldDate = datePicker.value.substr(0, 7);
|
||||
|
||||
updateMonthReports(datePicker.value)
|
||||
.then(reportsMonth => {
|
||||
reports = reportsMonth['reports'];
|
||||
month = reportsMonth['month'];
|
||||
|
||||
calendar.load();
|
||||
})
|
||||
|
||||
}
|
||||
let date = new Date(datePicker.value);
|
||||
let monthName = date.toLocaleString('default', {month: 'long'});
|
||||
let dayWeekName = date.toLocaleString('default', {weekday: 'long'});
|
||||
nameDate.innerHTML = `${dayWeekName} <br>${monthName} ${datePicker.value.substr(8, 2)}`;
|
||||
reportsBoard.innerHTML = htmlReports.getHtmlByDate(datePicker.value)
|
||||
}
|
||||
|
||||
let days = document.querySelectorAll('.calendar__day');
|
||||
for (let i = 0; i < Object.keys(days).length; i++) {
|
||||
let dateDay = parseInt(days[i].textContent);
|
||||
|
||||
if (days[i].classList.contains('inactive')) {
|
||||
days[i].onclick = function () {
|
||||
let date = getFutureDate(datePicker.value, parseInt(days[i].textContent))
|
||||
datePicker.value = date;
|
||||
datePicker.onchange()
|
||||
}
|
||||
} else {
|
||||
days[i].onclick = function () {
|
||||
datePicker.value = datePicker.value.substr(0, 8) + IntToDate(dateDay);
|
||||
datePicker.onchange()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
calendar.load()
|
||||
datePicker.onchange()
|
||||
|
||||
function isOldDatePicker(datePicker, oldDate) {
|
||||
if (datePicker.value.substr(0, 7) == oldDate)
|
||||
return true;
|
||||
return false
|
||||
}
|
||||
|
||||
async function updateMonthReports(date) {
|
||||
|
||||
let monthNumber = date.substr(5, 2);
|
||||
let yearNumber = date.substr(0, 4);
|
||||
|
||||
return fetch('../ajax/get-reports-for-month-by-id-year-month?id=<?=$ID?>' +
|
||||
'&month=' + monthNumber +
|
||||
'&year=' + yearNumber)
|
||||
.then((res) => {
|
||||
return res.json()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function getFutureDate(dat, value) {
|
||||
let date = new Date(dat);
|
||||
if (value < 8) {
|
||||
if (date.getMonth() == 11) {
|
||||
date = new Date(date.getFullYear() + 1, 0, value);
|
||||
} else {
|
||||
date = new Date(date.getFullYear(), date.getMonth() + 1, value);
|
||||
}
|
||||
} else {
|
||||
if (date.getMonth() == 0) {
|
||||
date = new Date(date.getFullYear() - 1, 11, value);
|
||||
} else {
|
||||
date = new Date(date.getFullYear(), date.getMonth() - 1, value);
|
||||
}
|
||||
}
|
||||
return date.getFullYear() + '-' + IntToDate(date.getMonth() + 1) + '-' + IntToDate(value);
|
||||
|
||||
}
|
||||
|
||||
function IntToDate(number_date) {
|
||||
if (Math.floor(number_date / 10) === 0)
|
||||
number_date = '0' + number_date;
|
||||
return number_date
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.calendar-contain {
|
||||
position: relative;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-radius: 0;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
max-width: 1920px;
|
||||
min-width: 450px;
|
||||
margin: 1rem auto;
|
||||
background-color: #f5f7f6;
|
||||
box-shadow: 5px 5px 72px rgba(30, 46, 50, 0.5);
|
||||
color: #040605;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 55em) {
|
||||
.calendar-contain {
|
||||
margin: auto;
|
||||
top: 5%;
|
||||
}
|
||||
}
|
||||
|
||||
.title-bar {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
display: table;
|
||||
text-align: right;
|
||||
background: #f5f7f6;
|
||||
padding: 0.5rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.title-bar:after {
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.title-bar__burger {
|
||||
display: block;
|
||||
position: relative;
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 38px;
|
||||
height: 30px;
|
||||
font-size: 0;
|
||||
text-indent: -9999px;
|
||||
appearance: none;
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.title-bar__burger:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.burger__lines {
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 18px;
|
||||
top: 15px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: auto;
|
||||
height: 1px;
|
||||
background: #040605;
|
||||
}
|
||||
|
||||
.burger__lines:before, .burger__lines:after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #040605;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.burger__lines:before {
|
||||
top: -5px;
|
||||
}
|
||||
|
||||
.burger__lines:after {
|
||||
bottom: -5px;
|
||||
}
|
||||
|
||||
.title-bar__year {
|
||||
display: block;
|
||||
position: relative;
|
||||
float: left;
|
||||
font-size: 1rem;
|
||||
line-height: 30px;
|
||||
width: 43%;
|
||||
padding: 0 0.5rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 55em) {
|
||||
.title-bar__year {
|
||||
width: 27%;
|
||||
}
|
||||
}
|
||||
|
||||
.title-bar__month {
|
||||
position: relative;
|
||||
/*float: center;*/
|
||||
font-size: 1rem;
|
||||
line-height: 30px;
|
||||
width: 22%;
|
||||
padding: 0 0.5rem;
|
||||
text-align: center;
|
||||
margin-right: 67px;
|
||||
word-spacing: 30px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 55em) {
|
||||
.title-bar__month {
|
||||
width: 12%;
|
||||
}
|
||||
}
|
||||
|
||||
.title-bar__minimize, .title-bar__maximize, .title-bar__close {
|
||||
position: relative;
|
||||
float: left;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.title-bar__minimize:before, .title-bar__maximize:before, .title-bar__close:before, .title-bar__minimize:after, .title-bar__maximize:after, .title-bar__close:after {
|
||||
top: 30%;
|
||||
right: 30%;
|
||||
bottom: 30%;
|
||||
left: 30%;
|
||||
content: " ";
|
||||
position: absolute;
|
||||
border-color: #8e8e8e;
|
||||
border-style: solid;
|
||||
border-width: 0 0 2px 0;
|
||||
}
|
||||
|
||||
.title-bar .title-bar__controls {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
position: relative;
|
||||
float: right;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.title-bar .title-bar__controls:before, .title-bar .title-bar__controls:after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
.title-bar .title-bar__minimize:before {
|
||||
border-bottom-width: 2px;
|
||||
}
|
||||
|
||||
.title-bar .title-bar__maximize:before {
|
||||
border-width: 1px 1px 2px 1px;
|
||||
}
|
||||
|
||||
.title-bar .title-bar__close:before, .title-bar .title-bar__close:after {
|
||||
bottom: 50%;
|
||||
top: 49.9%;
|
||||
}
|
||||
|
||||
.title-bar .title-bar__close:before {
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.title-bar .title-bar__close:after {
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
|
||||
.calendar__sidebar {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
float: none;
|
||||
background: linear-gradient(120deg, #eff3f3, #e1e7e8);
|
||||
padding-bottom: 0.7rem;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 55em) {
|
||||
.calendar__sidebar {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 50%;
|
||||
float: left;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.calendar__sidebar .content {
|
||||
padding: 2rem 1.5rem 2rem 4rem;
|
||||
color: #040605;
|
||||
}
|
||||
|
||||
.sidebar__nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
margin-bottom: 0.9rem;
|
||||
padding: 0.7rem 1rem;
|
||||
background-color: #f5f7f6;
|
||||
}
|
||||
|
||||
.sidebar__nav-item {
|
||||
display: inline-block;
|
||||
width: 22px;
|
||||
margin-right: 23px;
|
||||
padding: 0;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.sidebar__list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
.sidebar__list-item {
|
||||
margin: 1.2rem 0;
|
||||
color: #2d4338;
|
||||
font-weight: 100;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.list-item__time {
|
||||
display: inline-block;
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 55em) {
|
||||
.list-item__time {
|
||||
margin-right: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar__list-item--complete {
|
||||
color: rgba(4, 6, 5, 0.3);
|
||||
}
|
||||
|
||||
.sidebar__list-item--complete .list-item__time {
|
||||
color: rgba(4, 6, 5, 0.3);
|
||||
}
|
||||
|
||||
.sidebar__heading {
|
||||
font-size: 2.2rem;
|
||||
font-weight: bold;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
margin-bottom: 3rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.sidebar__heading span {
|
||||
float: right;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.calendar__heading-highlight {
|
||||
color: #2d444a;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.calendar__days {
|
||||
display: flex;
|
||||
flex-flow: column wrap;
|
||||
align-items: stretch;
|
||||
width: 100%;
|
||||
float: none;
|
||||
min-height: 580px;
|
||||
height: 100%;
|
||||
font-size: 12px;
|
||||
/*padding: 0.8rem 0 1rem 1rem;*/
|
||||
#b8cad6 background: #f5f7f6;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 55em) {
|
||||
.calendar__days {
|
||||
width: 50%;
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.calendar__top-bar {
|
||||
background: #b8cad6;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex: 56px 0 0;
|
||||
}
|
||||
|
||||
.top-bar__days {
|
||||
width: 100%;
|
||||
padding: 0 5px;
|
||||
color: #2d4338;
|
||||
font-weight: 100;
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.calendar__week {
|
||||
display: flex;
|
||||
flex: 1 1 0;
|
||||
}
|
||||
|
||||
.calendar__day {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-flow: column wrap;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
padding: 1.9rem 0.2rem 0.2rem;
|
||||
}
|
||||
|
||||
|
||||
.calendar__date {
|
||||
color: #040605;
|
||||
font-size: 1.7rem;
|
||||
font-weight: 600;
|
||||
line-height: 0.7;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 55em) {
|
||||
.calendar__date {
|
||||
font-size: 2.3rem;
|
||||
}
|
||||
}
|
||||
|
||||
.calendar__week .inactive .calendar__date, .calendar__week .inactive .task-count {
|
||||
color: #c6c6c6;
|
||||
}
|
||||
|
||||
.calendar__week .today .calendar__date {
|
||||
color: #fd588a;
|
||||
}
|
||||
|
||||
.calendar__task {
|
||||
color: #040605;
|
||||
display: flex;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 55em) {
|
||||
.calendar__task {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.calendar__task.calendar__task--today {
|
||||
color: #fd588a;
|
||||
}
|
||||
|
||||
|
||||
.danger {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.calendar__day:hover {
|
||||
color: #0a0a0a;
|
||||
background: #a6a6a6;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -49,7 +49,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
// 'user_card_id',
|
||||
[
|
||||
'format' => 'raw',
|
||||
'attribute' => 'ФИО',
|
||||
'attribute' => 'asdФИО',
|
||||
'value' => function ($data) {
|
||||
return \common\models\Reports::getFio($data);
|
||||
},
|
||||
|
@ -35,6 +35,8 @@ if (Yii::$app->controller->action->id === 'login') {
|
||||
<?= Html::csrfMetaTags() ?>
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<?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">
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body class="hold-transition skin-blue sidebar-mini">
|
||||
<?php $this->beginBody() ?>
|
||||
|
@ -1,3 +1,6 @@
|
||||
.body{
|
||||
display: none;
|
||||
}
|
||||
.media__upload_img{
|
||||
margin-bottom: 10px;
|
||||
float: left;
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
$(function(){
|
||||
$('#options').change(function(){
|
||||
month = $('#options :selected').val();
|
||||
|
@ -31,7 +31,9 @@
|
||||
"kartik-v/yii2-grid": "dev-master",
|
||||
"kartik-v/yii2-widget-datetimepicker": "dev-master",
|
||||
"edofre/yii2-fullcalendar-scheduler": "V1.1.12",
|
||||
"asmoday74/yii2-ckeditor5": "*"
|
||||
"asmoday74/yii2-ckeditor5": "*",
|
||||
"kavalar/telegram_bot": "^0.2.0",
|
||||
"kavalar/yii2-telegram-bot": "^0.1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"yiisoft/yii2-debug": "~2.0.0",
|
||||
|
2434
composer.lock
generated
2434
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -77,6 +77,19 @@ return [
|
||||
['class' => 'yii\rest\UrlRule', 'controller' => 'skills'],
|
||||
],
|
||||
],
|
||||
'telegram_bot' => [
|
||||
'class' => 'kavalar\TelegramBotApi',
|
||||
'templates' => [
|
||||
'interview_request' =>
|
||||
"Пришёл запрос на интервью.\n".
|
||||
"Профиль: ~profile_id~\n".
|
||||
"Телефон: ~phone~\n".
|
||||
"Email: ~email~\n".
|
||||
"Комментарий: ~comment~"
|
||||
],
|
||||
'telegramBotToken' => $params['telegramBotToken'],
|
||||
'telegramChatId' => $params['telegramBotChatId'],
|
||||
],
|
||||
|
||||
],
|
||||
'params' => $params,
|
||||
|
@ -7,6 +7,8 @@ use common\classes\Debug;
|
||||
use common\models\InterviewRequest;
|
||||
use common\models\User;
|
||||
use frontend\modules\api\models\ProfileSearchForm;
|
||||
use kavalar\BotNotificationTemplateProcessor;
|
||||
use kavalar\TelegramBotService;
|
||||
use yii\filters\auth\CompositeAuth;
|
||||
use yii\filters\auth\HttpBearerAuth;
|
||||
use yii\filters\auth\QueryParamAuth;
|
||||
@ -60,11 +62,14 @@ class ProfileController extends \yii\rest\Controller
|
||||
public function actionAddToInterview()
|
||||
{
|
||||
if (\Yii::$app->request->isPost) {
|
||||
$attributes = \Yii::$app->request->post();
|
||||
|
||||
$model = new InterviewRequest();
|
||||
$model->attributes = \Yii::$app->request->post();
|
||||
$model->attributes = $attributes;
|
||||
$model->created_at = time();
|
||||
$model->user_id = \Yii::$app->user->id;
|
||||
if ($model->save()) {
|
||||
\Yii::$app->telegram_bot->sendRenderedMessage('interview_request', $attributes);
|
||||
return ['status' => 'success'];
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,9 @@ class UserCardController extends Controller
|
||||
public function actionIndex()
|
||||
{
|
||||
$id_user = Yii::$app->user->id;
|
||||
echo $id_user;
|
||||
// die();
|
||||
$result = UserCard::find()->where(['id_user' => $id_user])->asArray()->all();
|
||||
|
||||
if($result) {
|
||||
$id = $result[0]['id'];
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
|
@ -50,7 +50,7 @@ class ReportsController extends Controller
|
||||
$dataProvider->query
|
||||
->where(['user_card.id_user' => Yii::$app->user->identity->id])
|
||||
->innerJoin('user_card', 'reports.user_card_id = user_card.id');
|
||||
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
|
Loading…
Reference in New Issue
Block a user