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

parent a197b57c
......@@ -7,6 +7,7 @@ use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use common\models\Settings;
use common\modules\support\models\redmine\Issue;
use common\modules\support\models\redmine\IssueSearch;
......@@ -46,20 +47,18 @@ class SupportController extends Controller
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();
$ratings = Issue::find()->me()->search($s)->rating()->all();
$tests = Issue::find()->me()->search($s)->test()->all();
$approves = Issue::find()->me()->search($s)->approve()->all();
$accepteds = Issue::find()->me()->search($s)->accepted()->all();
$works = $client->issue->all([
'author_id' => 23
]);
return $this->render('index', [
'works' => $works,
'ratings' => $ratings,
'tests' => $tests,
'approves' => $approves,
'accepteds' => $accepteds,
// 'ratings' => $ratings,
// 'tests' => $tests,
// 'approves' => $approves,
// 'accepteds' => $accepteds,
]);
}
......
......@@ -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 panel-default">
<div class="panel-heading table-responsive">
......@@ -34,7 +35,7 @@ use yii\helpers\Html;
</div>
<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">
<table class="w100pr">
<tbody>
......@@ -44,25 +45,24 @@ use yii\helpers\Html;
<a href=""><span class="caret caret_top"></span></a>
<a href=""><span class="caret"></span></a>
</div> -->
<span><?=$model->id?></span>
<span><?=$model['id']?></span>
</td>
<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 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 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 class="box_td">
<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">
<p class="pull-left"><strong><?=Yii::$app->formatter->asCurrency($model['price_for_customer'], 'RUR', [], [\NumberFormatter::CURRENCY_SYMBOL => '₽'])?></strong></p>
<!-- <div class="tooltip_wr pull-right">
<div class="tooltip_box">Счет был выставлен</div>
<span class="tooltip_cont"><img src="/images/score_icon.jpg" height="24" width="19" alt=""></span>
</div>
<?php endif; ?>
</div> -->
</td>
</tr>
</tbody>
......
......@@ -61,13 +61,13 @@ use yii\widgets\ActiveForm;
<tr>
<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>
</tr>
......
......@@ -221,10 +221,10 @@ class UserAdminController extends \common\components\AdminController
public function actionUpdate($id)
{
$model = $this->loadModel($id);
$old_password = $model->password;
$model->password_c = $model->password = null;
$model->scenario = User::SCENARIO_UPDATE;
$old_password = $model->password;
\yii::$app->controller->page_title = 'Редактирование пользователя <small>' . $model->name.'</small>';
\yii::$app->controller->tabs = [
......
......@@ -3,7 +3,6 @@
use \yii\helpers\ArrayHelper;
use common\modules\users\models\User;
use common\modules\support\models\redmine\User as RedmineUser;
$js = <<<JS
visibleSupport();
......@@ -14,21 +13,16 @@ $js = <<<JS
{
if($('#user-role').val() == 'support')
{
$('#user-support_id').closest('.form-group').show();
$('#user-redmine_key').closest('.form-group').show();
}
else
{
$('#user-support_id').closest('.form-group').hide();
$('#user-redmine_key').closest('.form-group').hide();
}
}
JS;
\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 [
'activeForm'=>[
'id' => 'user-form',
......@@ -55,9 +49,8 @@ return [
'items' => User::$role_list,
'class' => 'form-control',
],
'support_id' => [
'type' => 'dropdownlist',
'items' => ArrayHelper::map($redmineUsers, 'id', 'specialName'),
'redmine_key' => [
'type' => 'text',
'class' => 'form-control',
],
'password' => ['type' => 'password', 'class' => 'form-control', 'pwd-id' => 'passwordStrengthDiv'],
......
......@@ -113,7 +113,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
$attrs = array_merge(parent::attributeLabels(), array(
"password_c" => "Пароль еще раз",
"fio" => "Фамилия имя отчество",
'support_id' => 'Пользователь из Redmine',
'redmine_key' => 'API Key Redmine',
"name" => "Имя",
"surname" => "Фамилия",
"remember_me" => "Запомни меня",
......@@ -144,7 +144,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
self::SCENARIO_SEND_NEW_PASSWORD,
self::SCENARIO_RECOVER_PASSWORD
], 'message' => 'Пожалуйста, укажите корректный e-mail адрес'],
[['send_email', 'support_id'], 'safe'],
[['send_email', 'redmine_key'], 'safe'],
[['fio','name', 'surname'], 'safe', 'on' => [
self::SCENARIO_CREATE,
], 'message' => 'Пожалуйста, укажите Ваше имя'],
......@@ -496,17 +496,6 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
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) {
if (!parent::validate($attributeNames = null, $clearErrors = true))
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