#1044 - Натянуть верстку

parent a197b57c
...@@ -7,6 +7,7 @@ use yii\filters\AccessControl; ...@@ -7,6 +7,7 @@ use yii\filters\AccessControl;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use common\models\Settings;
use common\modules\support\models\redmine\Issue; use common\modules\support\models\redmine\Issue;
use common\modules\support\models\redmine\IssueSearch; use common\modules\support\models\redmine\IssueSearch;
...@@ -46,20 +47,18 @@ class SupportController extends Controller ...@@ -46,20 +47,18 @@ class SupportController extends Controller
public function actionIndex() public function actionIndex()
{ {
$s = Yii::$app->request->get('s'); $client = new \Redmine\Client('http://help-russia.ru', Yii::$app->support->identity->redmine_key);
$works = Issue::find()->me()->search($s)->work()->all(); $works = $client->issue->all([
$ratings = Issue::find()->me()->search($s)->rating()->all(); 'author_id' => 23
$tests = Issue::find()->me()->search($s)->test()->all(); ]);
$approves = Issue::find()->me()->search($s)->approve()->all();
$accepteds = Issue::find()->me()->search($s)->accepted()->all();
return $this->render('index', [ return $this->render('index', [
'works' => $works, 'works' => $works,
'ratings' => $ratings, // 'ratings' => $ratings,
'tests' => $tests, // 'tests' => $tests,
'approves' => $approves, // 'approves' => $approves,
'accepteds' => $accepteds, // 'accepteds' => $accepteds,
]); ]);
} }
......
...@@ -4,7 +4,8 @@ use yii\helpers\Html; ...@@ -4,7 +4,8 @@ use yii\helpers\Html;
?> ?>
<?php if($models) : ?> <?php if($output['issues']) : ?>
<div class="panel-group panel-group-2" id="accordion_2"> <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">
...@@ -34,7 +35,7 @@ use yii\helpers\Html; ...@@ -34,7 +35,7 @@ use yii\helpers\Html;
</div> </div>
<div id="collapse_1" class="panel-collapse collapse in"> <div id="collapse_1" class="panel-collapse collapse in">
<?php foreach ($models as $model) : ?> <?php foreach ($output['issues'] 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>
...@@ -44,25 +45,24 @@ use yii\helpers\Html; ...@@ -44,25 +45,24 @@ use yii\helpers\Html;
<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">
<p class="pull-left"><strong><?=Yii::$app->formatter->asCurrency($model->price_for_customer, 'RUR', [], [\NumberFormatter::CURRENCY_SYMBOL => '₽'])?></strong></p> <p class="pull-left"><strong><?=Yii::$app->formatter->asCurrency($model['price_for_customer'], 'RUR', [], [\NumberFormatter::CURRENCY_SYMBOL => '₽'])?></strong></p>
<?php if($model->paid) : ?>
<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> -->
<?php endif; ?>
</td> </td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -61,13 +61,13 @@ use yii\widgets\ActiveForm; ...@@ -61,13 +61,13 @@ use yii\widgets\ActiveForm;
<tr> <tr>
<td class="no_pad"> <td class="no_pad">
<?=$this->render('_loop', ['models' => $ratings, 'title' => 'Задачи на оценке']);?> <?=$this->render('_loop', ['output' => $ratings, 'title' => 'Задачи на оценке']);?>
<?=$this->render('_loop', ['models' => $works, 'title' => 'Задачи в работе']);?> <?=$this->render('_loop', ['output' => $works, 'title' => 'Задачи в работе']);?>
<?=$this->render('_loop', ['models' => $tests, 'title' => 'Задачи на тестировании']);?> <?=$this->render('_loop', ['output' => $tests, 'title' => 'Задачи на тестировании']);?>
<?=$this->render('_loop', ['models' => $approves, 'title' => 'Задачи ожидающие проверки']);?> <?=$this->render('_loop', ['output' => $approves, 'title' => 'Задачи ожидающие проверки']);?>
</td> </td>
</tr> </tr>
......
...@@ -221,10 +221,10 @@ class UserAdminController extends \common\components\AdminController ...@@ -221,10 +221,10 @@ class UserAdminController extends \common\components\AdminController
public function actionUpdate($id) public function actionUpdate($id)
{ {
$model = $this->loadModel($id); $model = $this->loadModel($id);
$old_password = $model->password;
$model->password_c = $model->password = null; $model->password_c = $model->password = null;
$model->scenario = User::SCENARIO_UPDATE; $model->scenario = User::SCENARIO_UPDATE;
$old_password = $model->password;
\yii::$app->controller->page_title = 'Редактирование пользователя <small>' . $model->name.'</small>'; \yii::$app->controller->page_title = 'Редактирование пользователя <small>' . $model->name.'</small>';
\yii::$app->controller->tabs = [ \yii::$app->controller->tabs = [
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
use \yii\helpers\ArrayHelper; use \yii\helpers\ArrayHelper;
use common\modules\users\models\User; use common\modules\users\models\User;
use common\modules\support\models\redmine\User as RedmineUser;
$js = <<<JS $js = <<<JS
visibleSupport(); visibleSupport();
...@@ -14,21 +13,16 @@ $js = <<<JS ...@@ -14,21 +13,16 @@ $js = <<<JS
{ {
if($('#user-role').val() == 'support') if($('#user-role').val() == 'support')
{ {
$('#user-support_id').closest('.form-group').show(); $('#user-redmine_key').closest('.form-group').show();
} }
else else
{ {
$('#user-support_id').closest('.form-group').hide(); $('#user-redmine_key').closest('.form-group').hide();
} }
} }
JS; JS;
\Yii::$app->view->registerJs($js, \yii\web\View::POS_READY, 'SupportID'); \Yii::$app->view->registerJs($js, \yii\web\View::POS_READY, 'SupportID');
$redmineUsers = RedmineUser::find()
->select(['*', "CONCAT(login, ' (', firstname, ' ', lastname, ')') AS specialName"])
->where(['type' => RedmineUser::TYPE_USER])
->all();
return [ return [
'activeForm'=>[ 'activeForm'=>[
'id' => 'user-form', 'id' => 'user-form',
...@@ -55,9 +49,8 @@ return [ ...@@ -55,9 +49,8 @@ return [
'items' => User::$role_list, 'items' => User::$role_list,
'class' => 'form-control', 'class' => 'form-control',
], ],
'support_id' => [ 'redmine_key' => [
'type' => 'dropdownlist', 'type' => 'text',
'items' => ArrayHelper::map($redmineUsers, 'id', 'specialName'),
'class' => 'form-control', 'class' => 'form-control',
], ],
'password' => ['type' => 'password', 'class' => 'form-control', 'pwd-id' => 'passwordStrengthDiv'], 'password' => ['type' => 'password', 'class' => 'form-control', 'pwd-id' => 'passwordStrengthDiv'],
......
...@@ -113,7 +113,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter ...@@ -113,7 +113,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
$attrs = array_merge(parent::attributeLabels(), array( $attrs = array_merge(parent::attributeLabels(), array(
"password_c" => "Пароль еще раз", "password_c" => "Пароль еще раз",
"fio" => "Фамилия имя отчество", "fio" => "Фамилия имя отчество",
'support_id' => 'Пользователь из Redmine', 'redmine_key' => 'API Key Redmine',
"name" => "Имя", "name" => "Имя",
"surname" => "Фамилия", "surname" => "Фамилия",
"remember_me" => "Запомни меня", "remember_me" => "Запомни меня",
...@@ -144,7 +144,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter ...@@ -144,7 +144,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
self::SCENARIO_SEND_NEW_PASSWORD, self::SCENARIO_SEND_NEW_PASSWORD,
self::SCENARIO_RECOVER_PASSWORD self::SCENARIO_RECOVER_PASSWORD
], 'message' => 'Пожалуйста, укажите корректный e-mail адрес'], ], 'message' => 'Пожалуйста, укажите корректный e-mail адрес'],
[['send_email', 'support_id'], 'safe'], [['send_email', 'redmine_key'], 'safe'],
[['fio','name', 'surname'], 'safe', 'on' => [ [['fio','name', 'surname'], 'safe', 'on' => [
self::SCENARIO_CREATE, self::SCENARIO_CREATE,
], 'message' => 'Пожалуйста, укажите Ваше имя'], ], 'message' => 'Пожалуйста, укажите Ваше имя'],
...@@ -496,17 +496,6 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter ...@@ -496,17 +496,6 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
return $url; return $url;
} }
public function beforeSave($insert){
if( strtolower($this->scenario) == 'update'){
if(isset($this->password) && empty($this->password))
unset($this->password);
}
return parent::beforeSave($insert);
}
public function validate($attributeNames = null, $clearErrors = true) { public function validate($attributeNames = null, $clearErrors = true) {
if (!parent::validate($attributeNames = null, $clearErrors = true)) if (!parent::validate($attributeNames = null, $clearErrors = true))
return false; return false;
......
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160304_091243_fix_user_table extends Migration
{
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
$this->alterColumn('users', 'support_id', Schema::TYPE_STRING . '(50) DEFAULT NULL');
$this->renameColumn('users', 'support_id', 'redmine_key');
}
public function safeDown()
{
$this->renameTable('users', 'redmine_key', 'support_id');
$this->renameColumn('users', 'support_id', Schema::TYPE_INTEGER . '(11) DEFAULT NULL');
}
}
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