Commit eb684e14 authored by Шакарим Сапа's avatar Шакарим Сапа

Merge remote-tracking branch 'origin/master'

parents f27c5ef5 6f50457e
...@@ -29,11 +29,11 @@ class SupportController extends Controller ...@@ -29,11 +29,11 @@ class SupportController extends Controller
'access' => [ 'access' => [
'class' => AccessControl::className(), 'class' => AccessControl::className(),
'user' => 'support', 'user' => 'support',
'only' => ['index', 'create', 'view', 'file'], 'only' => ['index', 'create', 'view', 'file', 'close'],
'rules' => [ 'rules' => [
[ [
'allow' => true, 'allow' => true,
'actions' => ['index', 'create', 'view', 'file'], 'actions' => ['index', 'create', 'view', 'file', 'close'],
'roles' => ['@'], 'roles' => ['@'],
], ],
], ],
...@@ -87,9 +87,34 @@ class SupportController extends Controller ...@@ -87,9 +87,34 @@ class SupportController extends Controller
'priority_id' => $model->priority_id, 'priority_id' => $model->priority_id,
'status_id' => $model->status_id, 'status_id' => $model->status_id,
'tracker_id' => $model->tracker_id, 'tracker_id' => $model->tracker_id,
'author_id' => $user['user']['id'] 'author_id' => $user['user']['id'],
'assigned_to_manager_id' => null
]; ];
$membership = $client->membership->all($model->project_id);
if(isset($membership))
{
foreach ($membership as $member)
{
if(isset($member['roles']))
{
foreach ($member['roles'] as $role)
{
if($role['id'] == RedmineHelper::MANAGER)
{
$params['assigned_to_manager_id'] = $member['user']['id'];
}
}
}
if($params['assigned_to_manager_id'])
{
break;
}
}
}
if($model->files) if($model->files)
{ {
$uploads = []; $uploads = [];
...@@ -125,6 +150,7 @@ class SupportController extends Controller ...@@ -125,6 +150,7 @@ class SupportController extends Controller
$client = $this->getClient(); $client = $this->getClient();
$user = $client->user->getCurrentUser(); $user = $client->user->getCurrentUser();
$model = $client->issue->show($id, [ $model = $client->issue->show($id, [
...@@ -177,6 +203,29 @@ class SupportController extends Controller ...@@ -177,6 +203,29 @@ class SupportController extends Controller
]); ]);
} }
public function actionClose($id)
{
$client = $this->getClient();
$user = $client->user->getCurrentUser();
$model = $client->issue->show($id);
if(empty($model['issue']) || $model['issue']['author']['id'] != $user['user']['id'])
{
throw new NotFoundHttpException('Доступ запрещен!');
}
if($model['issue']['status']['id'] == Issue::STATUS_APPROVE)
{
$client->issue->update($id, [
'status_id' => Issue::STATUS_ACCEPTED
]);
}
return $this->redirect(['/support/view/'.$id]);
}
public function actionFile() public function actionFile()
{ {
if(Yii::$app->request->isAjax) if(Yii::$app->request->isAjax)
......
...@@ -23,6 +23,8 @@ class Issue extends yii\base\Model ...@@ -23,6 +23,8 @@ class Issue extends yii\base\Model
const TRACKER_NONE = 14; // Не определено const TRACKER_NONE = 14; // Не определено
const STATUS_NEW = 7; const STATUS_NEW = 7;
const STATUS_APPROVE = 16;
const STATUS_ACCEPTED = 14;
const SCENARIO_CREATE = 'create'; const SCENARIO_CREATE = 'create';
const SCENARIO_UPDATE = 'update'; const SCENARIO_UPDATE = 'update';
......
...@@ -8,6 +8,10 @@ class RedmineHelper ...@@ -8,6 +8,10 @@ class RedmineHelper
{ {
const MAX_FILE_SIZE = 5242880; //5mb const MAX_FILE_SIZE = 5242880; //5mb
const OTHER_PROJECT = 75;
const MANAGER = 3;
public static $markupSet = [ public static $markupSet = [
[ [
'name' => 'Жирный', 'name' => 'Жирный',
...@@ -152,6 +156,15 @@ class RedmineHelper ...@@ -152,6 +156,15 @@ class RedmineHelper
} }
} }
$other[self::OTHER_PROJECT] = $output[self::OTHER_PROJECT];
unset($output[self::OTHER_PROJECT]);
$output = [
'Доступные проекты' => $output,
$other[self::OTHER_PROJECT] => $other
];
return $output; return $output;
} }
......
...@@ -5,8 +5,6 @@ use yii\helpers\Html; ...@@ -5,8 +5,6 @@ use yii\helpers\Html;
?> ?>
<?php if($output['models']) : ?> <?php if($output['models']) : ?>
<div class="panel-group panel-group-2" id="accordion_2">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading table-responsive"> <div class="panel-heading table-responsive">
...@@ -77,6 +75,4 @@ use yii\helpers\Html; ...@@ -77,6 +75,4 @@ use yii\helpers\Html;
</div> </div>
</div> </div>
</div>
<?php endif; ?> <?php endif; ?>
\ No newline at end of file
...@@ -63,6 +63,8 @@ use common\modules\support\models\redmine\RedmineHelper; ...@@ -63,6 +63,8 @@ use common\modules\support\models\redmine\RedmineHelper;
<tr> <tr>
<td class="no_pad"> <td class="no_pad">
<div class="panel-group panel-group-2" id="accordion_2">
<?php <?php
if($issues = RedmineHelper::sortIsuues($models['issues'])) if($issues = RedmineHelper::sortIsuues($models['issues']))
{ {
...@@ -80,6 +82,8 @@ use common\modules\support\models\redmine\RedmineHelper; ...@@ -80,6 +82,8 @@ use common\modules\support\models\redmine\RedmineHelper;
} }
?> ?>
</div>
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -27,6 +27,10 @@ $parser = new \Netcarver\Textile\Parser(); ...@@ -27,6 +27,10 @@ $parser = new \Netcarver\Textile\Parser();
<div class="row"> <div class="row">
<?php if($model['status']['id'] == Issue::STATUS_APPROVE) : ?>
<div class="col-md-2 col-md-offset-10"><?=Html::a('Закрыть', ['/support/close/'.$model['id']], ['class' => 'btn btn-primary pull-right']);?></div>
<?php endif; ?>
<div class="col-md-12"> <div class="col-md-12">
<div class="panel-body panel-body-ex-1 panel-body-ex-3 notifications_box color_on_cursor" <?=($model['priority']['id']==Issue::PRIORITY_SIMPLE?'style="border:0;"':'')?>> <div class="panel-body panel-body-ex-1 panel-body-ex-3 notifications_box color_on_cursor" <?=($model['priority']['id']==Issue::PRIORITY_SIMPLE?'style="border:0;"':'')?>>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment