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,78 +5,74 @@ use yii\helpers\Html; ...@@ -5,78 +5,74 @@ use yii\helpers\Html;
?> ?>
<?php if($output['models']) : ?> <?php if($output['models']) : ?>
<div class="panel panel-default">
<div class="panel-group panel-group-2" id="accordion_2"> <div class="panel-heading table-responsive">
<div class="panel panel-default">
<div class="panel-heading table-responsive">
<table class="w100pr table_header"> <table class="w100pr table_header">
<tbody> <tbody>
<tr> <tr>
<td> <td>
<p class="panel-title2 pull-left"> <p class="panel-title2 pull-left">
<!-- <a href=""><span class="glyphicon glyphicon-align-justify"></span></a>&nbsp;&nbsp; --> <!-- <a href=""><span class="glyphicon glyphicon-align-justify"></span></a>&nbsp;&nbsp; -->
<strong><?=$title?></strong>&nbsp;&nbsp; <strong><?=$title?></strong>&nbsp;&nbsp;
</p> </p>
</td> </td>
<td class="box_td"> <td class="box_td">
<p><strong>Дата <br> поступления</strong></p> <p><strong>Дата <br> поступления</strong></p>
</td> </td>
<td class="box_td"> <td class="box_td">
<p><strong>Срок <br> исполнения</strong></p> <p><strong>Срок <br> исполнения</strong></p>
</td> </td>
<td class="box_td"> <td class="box_td">
<p><strong>Стоимость <br> руб.</strong></p> <p><strong>Стоимость <br> руб.</strong></p>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div id="collapse_1" class="panel-collapse collapse in"> <div id="collapse_1" class="panel-collapse collapse in">
<?php foreach ($output['models'] as $model) : ?> <?php foreach ($output['models'] as $model) : ?>
<div class="panel-body panel-body-ex-1 color_on_cursor gray_box_2"> <div class="panel-body panel-body-ex-1 color_on_cursor gray_box_2">
<table class="w100pr"> <table class="w100pr">
<tbody> <tbody>
<tr> <tr>
<td class="box_td_fir"> <td class="box_td_fir">
<!-- <div class="arrov_poz pull-left"> <!-- <div class="arrov_poz pull-left">
<a href=""><span class="caret caret_top"></span></a> <a href=""><span class="caret caret_top"></span></a>
<a href=""><span class="caret"></span></a> <a href=""><span class="caret"></span></a>
</div> --> </div> -->
<span><?=$model['id']?></span> <span><?=$model['id']?></span>
</td> </td>
<td class="box_td_cont"> <td class="box_td_cont">
<p><strong><?=Html::a($model['subject'], ['/support/view/'.$model['id']])?></strong></p> <p><strong><?=Html::a($model['subject'], ['/support/view/'.$model['id']])?></strong></p>
</td> </td>
<td class="box_td"> <td class="box_td">
<span><?=date('d.m.Y', strtotime($model['created_on']))?></span> <span><?=date('d.m.Y', strtotime($model['created_on']))?></span>
</td> </td>
<td class="box_td"> <td class="box_td">
<span><?=($model->due_date?date('d.m.Y', strtotime($model['due_date'])):'Не установлено')?></span> <span><?=($model->due_date?date('d.m.Y', strtotime($model['due_date'])):'Не установлено')?></span>
</td> </td>
<td class="box_td"> <td class="box_td">
<?php if(!$output['rating'] && $model['price_for_customer'] == 0) : ?> <?php if(!$output['rating'] && $model['price_for_customer'] == 0) : ?>
<p class="green_text align_right"><strong>Гарантия</strong></p> <p class="green_text align_right"><strong>Гарантия</strong></p>
<?php else : ?> <?php else : ?>
<p class="pull-left"><strong><?=($model['price_for_customer']!=0 ? Yii::$app->formatter->asCurrency($model['price_for_customer'], 'RUR', [], [\NumberFormatter::CURRENCY_SYMBOL => '₽']) : 'Не установлено')?></strong></p> <p class="pull-left"><strong><?=($model['price_for_customer']!=0 ? Yii::$app->formatter->asCurrency($model['price_for_customer'], 'RUR', [], [\NumberFormatter::CURRENCY_SYMBOL => '₽']) : 'Не установлено')?></strong></p>
<?php endif; ?> <?php endif; ?>
<!-- <div class="tooltip_wr pull-right"> <!-- <div class="tooltip_wr pull-right">
<div class="tooltip_box">Счет был выставлен</div> <div class="tooltip_box">Счет был выставлен</div>
<span class="tooltip_cont"><img src="/images/score_icon.jpg" height="24" width="19" alt=""></span> <span class="tooltip_cont"><img src="/images/score_icon.jpg" height="24" width="19" alt=""></span>
</div> --> </div> -->
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
\ No newline at end of file
...@@ -63,23 +63,27 @@ use common\modules\support\models\redmine\RedmineHelper; ...@@ -63,23 +63,27 @@ use common\modules\support\models\redmine\RedmineHelper;
<tr> <tr>
<td class="no_pad"> <td class="no_pad">
<?php <div class="panel-group panel-group-2" id="accordion_2">
if($issues = RedmineHelper::sortIsuues($models['issues']))
{ <?php
foreach ($issues as $issue) if($issues = RedmineHelper::sortIsuues($models['issues']))
{ {
if(!isset($issue['close'])) foreach ($issues as $issue)
{
echo $this->render('_loop', ['output' => $issue, 'title' => $issue['title']]);
}
else
{ {
$accepteds = $issue['models']; if(!isset($issue['close']))
{
echo $this->render('_loop', ['output' => $issue, 'title' => $issue['title']]);
}
else
{
$accepteds = $issue['models'];
}
} }
} }
} ?>
?>
</div>
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -26,7 +26,11 @@ $parser = new \Netcarver\Textile\Parser(); ...@@ -26,7 +26,11 @@ $parser = new \Netcarver\Textile\Parser();
</div> </div>
<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