Commit be9d05ee9329674f3ee2a19700a2f3e2e8b17cc8

Authored by Mihail
2 parents 62dba7d8 47ef95dc

Merge branch 'master' of gitlab.artweb.com.ua:root/test_1

backend/views/user/_form.php
@@ -34,7 +34,6 @@ use yii\helpers\ArrayHelper; @@ -34,7 +34,6 @@ use yii\helpers\ArrayHelper;
34 34
35 35
36 <?= \backend\components\ImageUploader::widget([ 36 <?= \backend\components\ImageUploader::widget([
37 - 'form'=>$form,  
38 'model'=> $model, 37 'model'=> $model,
39 'field'=>'photo', 38 'field'=>'photo',
40 'width'=>200, 39 'width'=>200,
backend/web/.gitignore
1 /index.php 1 /index.php
2 /index-test.php 2 /index-test.php
3 -uploads/ 3 +/assets
common/models/Accounts.php
@@ -51,6 +51,9 @@ use yii\db\ActiveRecord; @@ -51,6 +51,9 @@ use yii\db\ActiveRecord;
51 class Accounts extends ActiveRecord implements IdentityInterface 51 class Accounts extends ActiveRecord implements IdentityInterface
52 { 52 {
53 53
  54 + /**
  55 + * @var
  56 + */
54 public $re_pass; 57 public $re_pass;
55 public $surname; 58 public $surname;
56 public $country_region; 59 public $country_region;
@@ -69,6 +72,9 @@ class Accounts extends ActiveRecord implements IdentityInterface @@ -69,6 +72,9 @@ class Accounts extends ActiveRecord implements IdentityInterface
69 } 72 }
70 73
71 74
  75 + /**
  76 + * @return bool
  77 + */
72 public function beforeSave() 78 public function beforeSave()
73 { 79 {
74 $this->dt = time(); 80 $this->dt = time();
@@ -84,7 +90,7 @@ class Accounts extends ActiveRecord implements IdentityInterface @@ -84,7 +90,7 @@ class Accounts extends ActiveRecord implements IdentityInterface
84 { 90 {
85 return [ 91 return [
86 [['if_manager', 'margin_id', 'country', 'city', 'rating', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'], 92 [['if_manager', 'margin_id', 'country', 'city', 'rating', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'],
87 - [['company','email', 'pass', 'name','surname', 'phones',], 'required'], 93 + [['company','email', 'pass', 'name', 'phones',], 'required'],
88 [['comment'], 'string'], 94 [['comment'], 'string'],
89 [['balance'], 'number'], 95 [['balance'], 'number'],
90 [['email', 'name','surname', 'firm_site'], 'string', 'max' => 150], 96 [['email', 'name','surname', 'firm_site'], 'string', 'max' => 150],
@@ -95,9 +101,6 @@ class Accounts extends ActiveRecord implements IdentityInterface @@ -95,9 +101,6 @@ class Accounts extends ActiveRecord implements IdentityInterface
95 [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255], 101 [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255],
96 [['email'], 'unique'], 102 [['email'], 'unique'],
97 [['email'], 'email'], 103 [['email'], 'email'],
98 - ['re_pass', 'compare', 'compareAttribute' => 'pass'],  
99 - ['verifyCode', 'captcha'],  
100 - ['dt', 'date', 'format' => 'Y.m.d'],  
101 [['rating','if_manager','set_manager_id','balance'], 'default', 'value' => '0'], 104 [['rating','if_manager','set_manager_id','balance'], 'default', 'value' => '0'],
102 [['is_active','margin_id','office_id','is_scribe'], 'default', 'value' => '1'], 105 [['is_active','margin_id','office_id','is_scribe'], 'default', 'value' => '1'],
103 [['comment'], 'default', 'value' => 'Новый пользователь'], 106 [['comment'], 'default', 'value' => 'Новый пользователь'],
@@ -27,7 +27,8 @@ @@ -27,7 +27,8 @@
27 "mihaildev/yii2-ckeditor": "^1.0", 27 "mihaildev/yii2-ckeditor": "^1.0",
28 "kartik-v/yii2-widget-fileinput": "@dev", 28 "kartik-v/yii2-widget-fileinput": "@dev",
29 "phpmailer/phpmailer": "^5.2", 29 "phpmailer/phpmailer": "^5.2",
30 - "mihaildev/yii2-elfinder": "*" 30 + "mihaildev/yii2-elfinder": "*",
  31 + "yiisoft/yii2-apidoc": "*"
31 }, 32 },
32 "require-dev": { 33 "require-dev": {
33 "yiisoft/yii2-codeception": "*", 34 "yiisoft/yii2-codeception": "*",
frontend/.gitignore
1 -/temp 1 +/tmp
  2 +/runtime/temp
frontend/controllers/AccountsController.php
1 <?php 1 <?php
2 namespace frontend\controllers; 2 namespace frontend\controllers;
3 3
4 -  
5 -use common\models\Accounts;  
6 use Yii; 4 use Yii;
  5 +use common\models\Accounts;
  6 +use frontend\models\ChangePasswordForm;
7 use common\models\News; 7 use common\models\News;
8 use yii\data\ActiveDataProvider; 8 use yii\data\ActiveDataProvider;
9 use yii\filters\AccessControl; 9 use yii\filters\AccessControl;
@@ -16,6 +16,7 @@ use yii\web\NotFoundHttpException; @@ -16,6 +16,7 @@ use yii\web\NotFoundHttpException;
16 */ 16 */
17 class AccountsController extends Controller 17 class AccountsController extends Controller
18 { 18 {
  19 +
19 public $layout = '/internal'; 20 public $layout = '/internal';
20 21
21 22
@@ -26,7 +27,7 @@ class AccountsController extends Controller @@ -26,7 +27,7 @@ class AccountsController extends Controller
26 'class' => AccessControl::className(), 27 'class' => AccessControl::className(),
27 'rules' => [ 28 'rules' => [
28 [ 29 [
29 - 'actions' => ['cabinet',], 30 + 'actions' => ['cabinet','change-password'],
30 'allow' => true, 31 'allow' => true,
31 'roles' => ['@'], 32 'roles' => ['@'],
32 ], 33 ],
@@ -39,9 +40,22 @@ class AccountsController extends Controller @@ -39,9 +40,22 @@ class AccountsController extends Controller
39 public function actionCabinet() 40 public function actionCabinet()
40 { 41 {
41 42
42 - return $this->render('cabinet',[  
43 - 'model' => $this->findModel(Yii::$app->user->identity->id) 43 +
  44 + $model = $this->findModel(Yii::$app->user->identity->id);
  45 +
  46 +
  47 + if ($model->load(Yii::$app->request->post()) && $model->validate()) {
  48 +
  49 + $model->save();
  50 +
  51 + }
  52 +
  53 + return $this->render('cabinet', [
  54 + 'model' => $model
44 ]); 55 ]);
  56 +
  57 +
  58 +
45 } 59 }
46 60
47 public function actionIndex() 61 public function actionIndex()
@@ -83,6 +97,31 @@ class AccountsController extends Controller @@ -83,6 +97,31 @@ class AccountsController extends Controller
83 } 97 }
84 98
85 99
  100 + public function actionChangePassword(){
  101 +
  102 +
  103 + $form = new ChangePasswordForm();
  104 +
  105 +
  106 + if ($form->load(Yii::$app->request->post()) && $form->validate()) {
  107 +
  108 + $model = Accounts::findOne(Yii::$app->user->identity->id);
  109 +
  110 + $model->load(Yii::$app->request->post(), 'ChangePasswordForm');
  111 +
  112 + $model->save();
  113 +
  114 + return $this->redirect(['cabinet']);
  115 +
  116 + } else {
  117 +
  118 + return $this->render('change-password', [
  119 + 'model' => $form
  120 + ]);
  121 +
  122 + }
  123 + }
  124 +
86 125
87 126
88 127
frontend/controllers/SiteController.php
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 namespace frontend\controllers; 2 namespace frontend\controllers;
3 3
4 use common\models\Accounts; 4 use common\models\Accounts;
  5 +use frontend\models\AccountsForm;
5 use common\models\News; 6 use common\models\News;
6 use common\models\Slider; 7 use common\models\Slider;
7 use common\models\Team; 8 use common\models\Team;
@@ -338,15 +339,21 @@ class SiteController extends Controller @@ -338,15 +339,21 @@ class SiteController extends Controller
338 339
339 $this->layout = '/internal'; 340 $this->layout = '/internal';
340 341
341 - $model = new Accounts(); 342 + $model = new AccountsForm();
342 343
343 - if ($model->load(Yii::$app->request->post()) ) { 344 + if ($model->load(Yii::$app->request->post()) && $model->validate() ) {
344 345
345 - $model->generateAuthKey();  
346 346
347 - $model->save();  
348 347
349 - if (Yii::$app->getUser()->login($model)) { 348 + $accounts = new Accounts();
  349 +
  350 + $accounts->load(Yii::$app->request->post());
  351 +
  352 + $accounts->generateAuthKey();
  353 +
  354 + $accounts->save();
  355 +
  356 + if (Yii::$app->getUser()->login($accounts)) {
350 357
351 return $this->goHome(); 358 return $this->goHome();
352 359
@@ -369,13 +376,16 @@ class SiteController extends Controller @@ -369,13 +376,16 @@ class SiteController extends Controller
369 $this->layout = '/internal'; 376 $this->layout = '/internal';
370 377
371 $model = new PasswordResetRequestForm(); 378 $model = new PasswordResetRequestForm();
  379 +
372 if ($model->load(Yii::$app->request->post()) && $model->validate()) { 380 if ($model->load(Yii::$app->request->post()) && $model->validate()) {
373 381
374 if ($model->sendEmail()) { 382 if ($model->sendEmail()) {
  383 +
375 Yii::$app->session->setFlash('success', 'Для того, чтобы изменить пароль, перейдите по ссылке, которая придет Вам на email'); 384 Yii::$app->session->setFlash('success', 'Для того, чтобы изменить пароль, перейдите по ссылке, которая придет Вам на email');
376 385
377 return $this->goHome(); 386 return $this->goHome();
378 } else { 387 } else {
  388 + die('here2');
379 Yii::$app->session->setFlash('error', 'Пользователя с таким e-mail в базе не существует'); 389 Yii::$app->session->setFlash('error', 'Пользователя с таким e-mail в базе не существует');
380 } 390 }
381 } 391 }
frontend/models/AccountsForm.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace frontend\models;
  4 +
  5 +use common\models\Accounts;
  6 +use yii\base\Model;
  7 +use Yii;
  8 +/**
  9 + * This is the model class for table "w_accounts".
  10 + *
  11 + *
  12 + * @property integer $id
  13 + * @property integer $if_manager
  14 + * @property string $email
  15 + * @property string $auth_key
  16 + * @property string $pass
  17 + * @property integer $margin_id
  18 + * @property string $name
  19 + * @property string $phones
  20 + * @property integer $country
  21 + * @property integer $city
  22 + * @property string $address
  23 + * @property string $comment
  24 + * @property integer $rating
  25 + * @property string $dt
  26 + * @property integer $is_active
  27 + * @property integer $is_firm
  28 + * @property string $last_loginin
  29 + * @property string $firm_inn
  30 + * @property string $firm_bank
  31 + * @property double $balance
  32 + * @property integer $office_id
  33 + * @property integer $is_scribe
  34 + * @property integer $set_manager_id
  35 + * @property string $phones2
  36 + * @property string $phones3
  37 + * @property integer $car
  38 + * @property integer $mod
  39 + * @property string $snumb
  40 + * @property integer $deliveries
  41 + * @property integer $scode
  42 + * @property string $firm_ur_adr
  43 + * @property string $firm_fiz_adr
  44 + * @property string $firm_code_eg
  45 + * @property string $firm_rs
  46 + * @property string $firm_mfo
  47 + * @property string $firm_site
  48 + * @property string $company
  49 + */
  50 +class AccountsForm extends Accounts
  51 +{
  52 +
  53 +
  54 + public $re_pass;
  55 + public $surname;
  56 + public $country_region;
  57 + public $verifyCode;
  58 + public $auth_key;
  59 + public $password_hash;
  60 + public $password_reset_token;
  61 +
  62 +
  63 +
  64 + /**
  65 + * @inheritdoc
  66 + */
  67 + public function rules()
  68 + {
  69 + return [
  70 + [['if_manager', 'margin_id', 'country', 'city', 'rating', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'],
  71 + [['company','email', 'pass', 'name','surname', 'phones'], 'required'],
  72 + [['comment'], 'string'],
  73 + [['balance'], 'number'],
  74 + [['email', 'name','surname', 'firm_site'], 'string', 'max' => 150],
  75 + [['pass','re_pass'], 'string', 'max' => 30],
  76 + [['phones', 'phones2', 'phones3'], 'string', 'max' => 50],
  77 + [['address', 'firm_inn', 'firm_bank'], 'string', 'max' => 254],
  78 + [['last_loginin'], 'string', 'max' => 15],
  79 + [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255],
  80 + [['email'], 'unique'],
  81 + [['email'], 'email'],
  82 + ['re_pass', 'compare', 'compareAttribute' => 'pass'],
  83 + ['verifyCode', 'captcha'],
  84 + ['dt', 'date', 'format' => 'Y.m.d'],
  85 + [['rating','if_manager','set_manager_id','balance'], 'default', 'value' => '0'],
  86 + [['is_active','margin_id','office_id','is_scribe'], 'default', 'value' => '1'],
  87 + [['comment'], 'default', 'value' => 'Новый пользователь'],
  88 + ];
  89 + }
  90 +
  91 + /**
  92 + * @inheritdoc
  93 + */
  94 + public function attributeLabels()
  95 + {
  96 + return [
  97 + 'id' => 'ID',
  98 + 'if_manager' => 'Статус менеджера',
  99 + 'email' => 'E-mail (Логин)',
  100 + 'pass' => 'Пароль',
  101 + 're_pass' => 'Повторите пароль',
  102 + 'margin_id' => 'Тип цены',
  103 + 'name' => 'Имя',
  104 + 'phones' => 'Телефоны',
  105 + 'country' => Yii::t('app', 'Country'),
  106 + 'city' =>'Город',
  107 + 'address' => 'Адрес',
  108 + 'comment' => 'Комментарий',
  109 + 'rating' => Yii::t('app', 'Rating'),
  110 + 'dt' =>'Дата регистрации',
  111 + 'is_active' => 'Активный',
  112 + 'is_firm' => 'Юридическое лицо',
  113 + 'last_loginin' => Yii::t('app', 'Last Loginin'),
  114 + 'firm_inn' => 'ИНН',
  115 + 'firm_bank' => 'Банк',
  116 + 'balance' => Yii::t('app', 'Balance'),
  117 + 'office_id' => Yii::t('app', 'Office ID'),
  118 + 'is_scribe' => 'Подписка',
  119 + 'set_manager_id' => 'Персональный менеджер',
  120 + 'phones2' => 'Телефоны 2',
  121 + 'phones3' => 'Телефоны 3',
  122 + 'car' => Yii::t('app', 'Car'),
  123 + 'mod' => Yii::t('app', 'Mod'),
  124 + 'snumb' => 'snumb',
  125 + 'deliveries' => Yii::t('app', 'Deliveries'),
  126 + 'scode' => 'Код в 1С',
  127 + 'firm_ur_adr' => 'Юридический адрес',
  128 + 'firm_fiz_adr' => 'Физический адрес',
  129 + 'firm_code_eg' => 'Код ЭГ',
  130 + 'firm_rs' => 'Расчётный счёт',
  131 + 'firm_mfo' => 'МФО',
  132 + 'firm_site' => 'Сайт',
  133 + 'company' => 'Название фирмы',
  134 + 'country_region' => 'Регион'
  135 + ];
  136 + }
  137 +
  138 +
  139 +
  140 +
  141 +
  142 +
  143 +
  144 +}
frontend/models/ChangePasswordForm.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace frontend\models;
  4 +
  5 +use common\models\Accounts;
  6 +use yii\base\Model;
  7 +use Yii;
  8 +/**
  9 + * @property string $old_pass
  10 + * @property string $new_pass
  11 + * @property string $re_pass
  12 + */
  13 +class ChangePasswordForm extends Accounts
  14 +{
  15 +
  16 +
  17 + public $re_pass;
  18 + public $old_pass;
  19 +
  20 +
  21 +
  22 + /**
  23 + * @inheritdoc
  24 + */
  25 + public function rules()
  26 + {
  27 + return [
  28 + [['old_pass','pass', 're_pass'], 'required'],
  29 + [['old_pass','pass', 're_pass'], 'string', 'max' => 30],
  30 + ['re_pass', 'compare', 'compareAttribute' => 'pass'],
  31 + ['old_pass', 'validatePassword'],
  32 + ];
  33 + }
  34 +
  35 + public function validatePassword($attribute, $params)
  36 + {
  37 + if (!$this->hasErrors()) {
  38 + $user = Accounts::findOne(Yii::$app->user->identity->id);
  39 + if (!$user || $user->pass != $this->old_pass) {
  40 + $this->addError($attribute, 'Неправильный логин или пароль');
  41 + }
  42 + }
  43 + }
  44 +
  45 + /**
  46 + * @inheritdoc
  47 + */
  48 + public function attributeLabels()
  49 + {
  50 + return [
  51 + 'old_pass' => 'Старый пароль',
  52 + 'pass' => 'Новый пароль',
  53 + 're_pass' => 'Повторите пароль',
  54 + ];
  55 + }
  56 +
  57 +
  58 +
  59 +
  60 +
  61 +
  62 +
  63 +}
frontend/models/PasswordResetRequestForm.php
@@ -45,11 +45,15 @@ class PasswordResetRequestForm extends Model @@ -45,11 +45,15 @@ class PasswordResetRequestForm extends Model
45 $user->generatePasswordResetToken(); 45 $user->generatePasswordResetToken();
46 } 46 }
47 47
  48 +
  49 +
48 if ($user->save()) { 50 if ($user->save()) {
  51 +
49 $form = array(); 52 $form = array();
50 $form ['email'] = $user->email; 53 $form ['email'] = $user->email;
51 $form ['name'] = $user->name; 54 $form ['name'] = $user->name;
52 $form ['pass'] = $user->pass; 55 $form ['pass'] = $user->pass;
  56 +
53 return Emails::get('remide',$form,$form ['email']); 57 return Emails::get('remide',$form,$form ['email']);
54 58
55 } 59 }
frontend/views/accounts/cabinet.php
@@ -3,6 +3,7 @@ use \yii\widgets\ActiveForm; @@ -3,6 +3,7 @@ use \yii\widgets\ActiveForm;
3 use \yii\helpers\ArrayHelper; 3 use \yii\helpers\ArrayHelper;
4 use \common\models\DicCities; 4 use \common\models\DicCities;
5 use \common\models\Deliveries; 5 use \common\models\Deliveries;
  6 +use \yii\helpers\Html;
6 use \yii\helpers\Url; 7 use \yii\helpers\Url;
7 8
8 $this->registerCssFile('/css/about_company.css'); 9 $this->registerCssFile('/css/about_company.css');
@@ -35,9 +36,10 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -35,9 +36,10 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
35 <div role="tabpanel" class="tab-pane active" id="profile"> 36 <div role="tabpanel" class="tab-pane active" id="profile">
36 <p class="tab-content_header">Личные данные</p> 37 <p class="tab-content_header">Личные данные</p>
37 <div class="myprofile"> 38 <div class="myprofile">
38 - <button class="purple top">Изменить пароль</button>  
39 39
40 - <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data','class'=>'my_profile'], 'method'=>'post','action' => '/site/signup',]); ?> 40 + <?= Html::a( 'Изменить пароль', Url::toRoute('accounts/change-password'),['class'=>'purple top'])?>
  41 +
  42 + <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data','class'=>'my_profile'], 'method'=>'post',]); ?>
41 43
42 <?= $form->field($model, 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?> 44 <?= $form->field($model, 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?>
43 45
@@ -45,16 +47,10 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -45,16 +47,10 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
45 47
46 <?= $form->field($model, 'name',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Имя']) ?> 48 <?= $form->field($model, 'name',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Имя']) ?>
47 49
48 - <?= $form->field($model, 'surname',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Фамилия']) ?>  
49 -  
50 <?= $form->field($model, 'phones',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Телефон']) ?> 50 <?= $form->field($model, 'phones',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Телефон']) ?>
51 51
52 <?= $form->field($model, 'email',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration']) ?> 52 <?= $form->field($model, 'email',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration']) ?>
53 53
54 - <?= $form->field($model, 'pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?>  
55 -  
56 - <?= $form->field($model, 're_pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?>  
57 -  
58 <?= $form->field($model, 'country',['options'=>['class'=>'selectize_item2 input2' ]])->dropDownList( 54 <?= $form->field($model, 'country',['options'=>['class'=>'selectize_item2 input2' ]])->dropDownList(
59 ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'), 55 ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'),
60 ['prompt' => 'Выберите область'] 56 ['prompt' => 'Выберите область']
@@ -72,10 +68,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -72,10 +68,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
72 ['prompt' => 'Выберите тип перевозки'] 68 ['prompt' => 'Выберите тип перевозки']
73 ); 69 );
74 ?> 70 ?>
75 -  
76 -  
77 - <button class="purple_white">Отмена</button>  
78 - <button class="purple">Изменить</button> 71 + <?= Html::a( 'Отмена', Url::toRoute('/'),['class'=>'purple_white'])?>
  72 + <button type="submit" class="purple">Изменить</button>
79 <?php ActiveForm::end(); ?> 73 <?php ActiveForm::end(); ?>
80 74
81 75
frontend/views/accounts/change-password.php 0 → 100644
  1 +<?php
  2 +use \yii\widgets\ActiveForm;
  3 +use \yii\helpers\Url;
  4 +use \yii\helpers\Html;
  5 +
  6 +$this->registerCssFile('/css/about_company.css');
  7 +$this->registerCssFile('/css/style/my_profile.css');
  8 +
  9 +$this->title = 'Смена пароля';
  10 +$this->params['breadcrumbs'][] = $this->title;
  11 +?>
  12 +
  13 +<div class="vin">
  14 + <p class="vin_article">Мой профиль</p>
  15 + <div class='side_menu'>
  16 + <?php
  17 + echo \yii\widgets\Menu::widget([
  18 + 'options' => ['class' => 'side_menu-list'],
  19 + 'items' => [
  20 + ['label' => 'Личные данные', 'url' => Url::toRoute(['/accounts/cabinet'])],
  21 + ['label' => 'Блокнот', 'url' => Url::toRoute(['/accounts/cabinet'])],
  22 + ['label' => 'Корзина', 'url' => Url::toRoute(['/accounts/cabinet'])],
  23 + ['label' => 'Заказы', 'url' => Url::toRoute(['/accounts/cabinet'])],
  24 + ['label' => 'Выйти', 'url' => Url::toRoute(['/site/logout'])],
  25 +
  26 + ],
  27 + ]);
  28 + ?>
  29 + <div class="tab-content">
  30 + <div role="tabpanel" class="tab-pane active" id="profile">
  31 + <p class="tab-content_header">Личные данные</p>
  32 + <div class="myprofile">
  33 + <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data','class'=>'my_profile'], 'method'=>'post',]); ?>
  34 +
  35 + <?= $form->field($model, 'old_pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?>
  36 +
  37 + <?= $form->field($model, 'pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?>
  38 +
  39 + <?= $form->field($model, 're_pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?>
  40 +
  41 +
  42 + <?= Html::a( 'Отмена', Url::toRoute('/'),['class'=>'purple_white'])?>
  43 + <button type="submit" class="purple">Изменить</button>
  44 + <?php ActiveForm::end(); ?>
  45 +
  46 +
  47 +
  48 + </div>
  49 +
  50 +
  51 +
  52 + </div>
  53 +
  54 +
  55 +
  56 + </div>
  57 + </div>
  58 + <img src="/images/lonh_line.png" class='long_line'>
  59 +</div>
frontend/views/layouts/main.php
@@ -8,7 +8,7 @@ use yii\widgets\ActiveForm; @@ -8,7 +8,7 @@ use yii\widgets\ActiveForm;
8 use \yii\widgets\Menu; 8 use \yii\widgets\Menu;
9 use \yii\helpers\Url; 9 use \yii\helpers\Url;
10 use common\models\Callback; 10 use common\models\Callback;
11 -use \common\models\Accounts; 11 +use \frontend\models\AccountsForm;
12 use \yii\helpers\ArrayHelper; 12 use \yii\helpers\ArrayHelper;
13 use \common\models\DicCities; 13 use \common\models\DicCities;
14 use \common\models\Deliveries; 14 use \common\models\Deliveries;
@@ -410,41 +410,41 @@ use \common\models\UserLoginForm; @@ -410,41 +410,41 @@ use \common\models\UserLoginForm;
410 <div class="registration_for_person"> 410 <div class="registration_for_person">
411 <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data'], 'method'=>'post','action' => '/site/signup']); ?> 411 <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data'], 'method'=>'post','action' => '/site/signup']); ?>
412 412
413 - <?= $form->field(new Accounts(), 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?> 413 + <?= $form->field(new AccountsForm(), 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?>
414 414
415 - <?= $form->field(new Accounts(), 'company')->hiddenInput(['value'=>'Частное лицо'])->label(false) ?> 415 + <?= $form->field(new AccountsForm(), 'company')->hiddenInput(['value'=>'Частное лицо'])->label(false) ?>
416 416
417 - <?= $form->field(new Accounts(), 'name')->textInput(['maxlength' => 45,'placeholder'=>'Имя'])->label(false) ?> 417 + <?= $form->field(new AccountsForm(), 'name')->textInput(['maxlength' => 45,'placeholder'=>'Имя'])->label(false) ?>
418 418
419 - <?= $form->field(new Accounts(), 'surname')->textInput(['maxlength' => 45,'placeholder'=>'Фамилия'])->label(false) ?> 419 + <?= $form->field(new AccountsForm(), 'surname')->textInput(['maxlength' => 45,'placeholder'=>'Фамилия'])->label(false) ?>
420 420
421 - <?= $form->field(new Accounts(), 'phones')->textInput(['maxlength' => 45,'placeholder'=>'Телефон'])->label(false) ?> 421 + <?= $form->field(new AccountsForm(), 'phones')->textInput(['maxlength' => 45,'placeholder'=>'Телефон'])->label(false) ?>
422 422
423 - <?= $form->field(new Accounts(), 'email')->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration'])->label(false) ?> 423 + <?= $form->field(new AccountsForm(), 'email')->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration'])->label(false) ?>
424 424
425 - <?= $form->field(new Accounts(), 'pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?> 425 + <?= $form->field(new AccountsForm(), 'pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?>
426 426
427 - <?= $form->field(new Accounts(), 're_pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?> 427 + <?= $form->field(new AccountsForm(), 're_pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?>
428 428
429 - <?= $form->field(new Accounts(), 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList( 429 + <?= $form->field(new AccountsForm(), 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
430 ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'), 430 ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'),
431 ['prompt' => 'Выберите область'] 431 ['prompt' => 'Выберите область']
432 )->label(false); 432 )->label(false);
433 ?> 433 ?>
434 434
435 - <?= $form->field(new Accounts(), 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList( 435 + <?= $form->field(new AccountsForm(), 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
436 [], 436 [],
437 ['prompt' => 'Выберите город'] 437 ['prompt' => 'Выберите город']
438 )->label(false); 438 )->label(false);
439 ?> 439 ?>
440 440
441 - <?= $form->field(new Accounts(), 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList( 441 + <?= $form->field(new AccountsForm(), 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
442 ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'), 442 ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'),
443 ['prompt' => 'Выберите тип перевозки'] 443 ['prompt' => 'Выберите тип перевозки']
444 )->label(false); 444 )->label(false);
445 ?> 445 ?>
446 446
447 - <?= $form->field(new Accounts(), 'verifyCode')->widget(Captcha::className(), [ 447 + <?= $form->field(new AccountsForm(), 'verifyCode')->widget(Captcha::className(), [
448 'options'=>['placeholder'=>'Введите код' ], 448 'options'=>['placeholder'=>'Введите код' ],
449 'template' => '<div>{input}</div><div class="row"><div class="col-lg-3">{image}</div></div>', 449 'template' => '<div>{input}</div><div class="row"><div class="col-lg-3">{image}</div></div>',
450 ])->label(false); ?> 450 ])->label(false); ?>
@@ -457,142 +457,6 @@ use \common\models\UserLoginForm; @@ -457,142 +457,6 @@ use \common\models\UserLoginForm;
457 </div> 457 </div>
458 458
459 459
460 -  
461 -  
462 -  
463 -  
464 -<!---->  
465 -<!---->  
466 -<!-- <form action="" method="post" id="registration_form">-->  
467 -<!-- <h3>Заявка на регистрацию</h3>-->  
468 -<!-- <div class="purple_registration active_button" style=" border-radius:12px 0 0 0 " id="person"><p>Частное лицо</p></div><div id="company" class="purple_registration"><p>Оптовик</p></div>-->  
469 -<!-- <div class="registration_holder">-->  
470 -<!---->  
471 -<!-- <div class="registration_for_person">-->  
472 -<!---->  
473 -<!---->  
474 -<!-- <input type="text" name="familyname" id="family_name" placeholder="Фамилия-->  
475 -<!-- " minlength="2" required=""><span class='star'>*</span>-->  
476 -<!---->  
477 -<!-- <input name="name" id="name" placeholder="Имя" minlength="2" type="text" required=""><span class='star1'>*</span>-->  
478 -<!-- <input type="email" name="email" id="email_registration" placeholder="email" minlength="10" required=""><span class='star2'>*</span>-->  
479 -<!---->  
480 -<!-- <input type="phone" name="telephone" id="telephone_registration" placeholder="Телефон" minlength="7" required=""><span class='star3'>*</span>-->  
481 -<!-- <input type="telephone" name="telephone" id="telephone_registration_add" placeholder="Телефон"><span class='star4'>*</span>-->  
482 -<!-- <p class="add_telephone" style="font-size: 14px;-->  
483 -<!-- margin-right: 12px;-->  
484 -<!-- margin-top: 10px;">добавить еще 1 телефон</p>-->  
485 -<!-- <p>Фактический адрес</p>-->  
486 -<!-- <div class="selectize_item2">-->  
487 -<!---->  
488 -<!---->  
489 -<!-- <select class="area">-->  
490 -<!-- <option value="" disabled="" selected="">Выберите область</option>-->  
491 -<!-- <option value="2">Выбери меня!</option>-->  
492 -<!-- <option value="3">Выбери меня!</option>-->  
493 -<!-- <option value="5">Меня!</option>-->  
494 -<!-- <option value="4">Меня</option>-->  
495 -<!-- </select>-->  
496 -<!---->  
497 -<!-- </div>-->  
498 -<!-- <div class="selectize_item2">-->  
499 -<!---->  
500 -<!---->  
501 -<!-- <select class="city">-->  
502 -<!-- <option value="" disabled="" selected="">Выберите город</option>-->  
503 -<!-- <option value="2">Выбери меня!</option>-->  
504 -<!-- <option value="3">Выбери меня!</option>-->  
505 -<!-- <option value="5">Меня!</option>-->  
506 -<!-- <option value="4">Меня</option>-->  
507 -<!-- </select>-->  
508 -<!---->  
509 -<!-- </div>-->  
510 -<!-- <div class="selectize_item2">-->  
511 -<!---->  
512 -<!---->  
513 -<!-- <select class="steel1">-->  
514 -<!-- <option value="" disabled="" selected="">Перевозчик</option>-->  
515 -<!-- <option value="2">Выбери меня!</option>-->  
516 -<!-- <option value="3">Выбери меня!</option>-->  
517 -<!-- <option value="5">Меня!</option>-->  
518 -<!-- <option value="4">Меня</option>-->  
519 -<!-- </select>-->  
520 -<!---->  
521 -<!-- </div>-->  
522 -<!---->  
523 -<!-- <input type="text" placeholder="Введите код" id="code_input" required="4"><span class='star5'>*</span>-->  
524 -<!-- <div class="code_generate">-->  
525 -<!-- <img src="/images/code_generator.png">-->  
526 -<!-- </div>-->  
527 -<!-- <button class="purple" type="submit" value="Submit">Зарегистрироваться</button>-->  
528 -<!---->  
529 -<!---->  
530 -<!-- </div>-->  
531 -<!-- <div class="registration_for_company">-->  
532 -<!---->  
533 -<!-- <input type="text" name="fullname" id="company_name" placeholder="Компания-->  
534 -<!-- " minlength="2" required="">-->  
535 -<!-- <input type="text" name="fullname" id="family_name" placeholder="Фамилия-->  
536 -<!-- " minlength="2" required=""><span class='star'>*</span>-->  
537 -<!---->  
538 -<!-- <input type="" name="name" id="name" placeholder="Имя" minlength="2" required=""><span class='star1'>*</span>-->  
539 -<!-- <input type="email" name="email" id="email_registration" placeholder="email" minlength="10" required=""><span class='star3'>*</span>-->  
540 -<!---->  
541 -<!-- <input type="telephone" name="telephone" id="telephone_registration" placeholder="Телефон" minlength="7" required=""><span class='star4'>*</span><span class='star6'>*</span>-->  
542 -<!-- <input type="telephone" name="telephone" id="telephone_registration_add1" placeholder="Телефон" style="display:none">-->  
543 -<!-- <p class="add_telephone1" style="font-size: 14px;-->  
544 -<!-- margin-right: 12px;-->  
545 -<!-- margin-top: 10px;">добавить еще 1 телефон</p>-->  
546 -<!-- <p>Фактический адрес</p>-->  
547 -<!-- <div class="selectize_item2">-->  
548 -<!---->  
549 -<!---->  
550 -<!-- <select class="area">-->  
551 -<!-- <option value="" disabled="" selected="">Выберите область</option>-->  
552 -<!-- <option value="2">Выбери меня!</option>-->  
553 -<!-- <option value="3">Выбери меня!</option>-->  
554 -<!-- <option value="5">Меня!</option>-->  
555 -<!-- <option value="4">Меня</option>-->  
556 -<!-- </select>-->  
557 -<!---->  
558 -<!-- </div>-->  
559 -<!-- <div class="selectize_item2">-->  
560 -<!---->  
561 -<!---->  
562 -<!-- <select class="city">-->  
563 -<!-- <option value="" disabled="" selected="">Выберите город</option>-->  
564 -<!-- <option value="2">Выбери меня!</option>-->  
565 -<!-- <option value="3">Выбери меня!</option>-->  
566 -<!-- <option value="5">Меня!</option>-->  
567 -<!-- <option value="4">Меня</option>-->  
568 -<!-- </select>-->  
569 -<!---->  
570 -<!-- </div>-->  
571 -<!-- <div class="selectize_item2">-->  
572 -<!---->  
573 -<!---->  
574 -<!-- <select class="steel1">-->  
575 -<!-- <option value="" disabled="" selected="">Перевозчик</option>-->  
576 -<!-- <option value="2">Выбери меня!</option>-->  
577 -<!-- <option value="3">Выбери меня!</option>-->  
578 -<!-- <option value="5">Меня!</option>-->  
579 -<!-- <option value="4">Меня</option>-->  
580 -<!-- </select>-->  
581 -<!---->  
582 -<!-- </div>-->  
583 -<!---->  
584 -<!-- <input type="text" placeholder="Введите код" id="code_input" required='4'>-->  
585 -<!-- <div class="code_generate">-->  
586 -<!-- <img src="/images/code_generator.png">-->  
587 -<!-- </div><span class='star5'>*</span>-->  
588 -<!-- <button class="purple" type="submit" value="Submit">Зарегистрироваться</button>-->  
589 -<!---->  
590 -<!---->  
591 -<!-- </div>-->  
592 -<!-- </div></form>-->  
593 -  
594 -  
595 -  
596 </div> 460 </div>
597 </div> 461 </div>
598 462
frontend/web/.gitignore
  1 +/assets
1 /index.php 2 /index.php
2 /index-test.php 3 /index-test.php
frontend/web/css/main.css
@@ -395,11 +395,16 @@ div.required:after { content: &quot; *&quot;; @@ -395,11 +395,16 @@ div.required:after { content: &quot; *&quot;;
395 width: 434px!important; 395 width: 434px!important;
396 } 396 }
397 397
  398 +.field-accountsform-company{
  399 + display: none;
  400 +}
  401 +
398 .field-accounts-company{ 402 .field-accounts-company{
399 display: none; 403 display: none;
400 } 404 }
401 405
402 406
  407 +
403 #form_login{ 408 #form_login{
404 margin: 0 auto; 409 margin: 0 auto;
405 width: 561px; 410 width: 561px;
@@ -464,4 +469,48 @@ div.required:after { content: &quot; *&quot;; @@ -464,4 +469,48 @@ div.required:after { content: &quot; *&quot;;
464 469
465 .my_profile .selectize_item2 label{ 470 .my_profile .selectize_item2 label{
466 left: -65px; 471 left: -65px;
  472 +}
  473 +
  474 +.myprofile .purple_white {
  475 + margin-top: 28px;
  476 + margin-left: 174px;
  477 + font-family: Arial;
  478 + font-size: 11px;
  479 + font-weight: 600;
  480 + color: #6b84b5;
  481 + height: 43px;
  482 + width: 130px;
  483 + border-radius: 8px;
  484 + border: 1px solid #6b84b5;
  485 + background-color: #ffffff;
  486 + cursor: pointer;
  487 + outline: none;
  488 + text-transform: uppercase;
  489 + display: inline-block;
  490 + text-align: center;
  491 + box-sizing: border-box;
  492 + padding-top: 14px;
  493 + position: relative;
  494 + top: 1px;
  495 +}
  496 +
  497 +.myprofile input{
  498 + margin-left: 135px;
  499 +}
  500 +
  501 +.myprofile div.required:after{
  502 + left: 121px;
  503 +}
  504 +.myprofile a.top{
  505 + padding-top: 13px;
  506 + text-align: center;
  507 +}
  508 +
  509 +.field-passwordresetrequestform-email:after{
  510 + top: -34px!important;
  511 + left: 388px!important;
  512 +}
  513 +
  514 +.myprofile .field-changepasswordform-old_pass label, .myprofile .field-changepasswordform-pass label, .myprofile .field-changepasswordform-re_pass label{
  515 + left: 0px!important;
467 } 516 }
468 \ No newline at end of file 517 \ No newline at end of file
frontend/web/js/main.js
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * Created by vitaliy on 23.11.15. 2 * Created by vitaliy on 23.11.15.
3 */ 3 */
4 $(document).ready(function(){ 4 $(document).ready(function(){
5 - $('#accounts-country').change(function(){ 5 + $('#accountsform-country').change(function(){
6 var region_id = $(this).val(); 6 var region_id = $(this).val();
7 if(region_id){ 7 if(region_id){
8 $.get( "/ajax/get-city", {region_id:region_id}, function( data ) { 8 $.get( "/ajax/get-city", {region_id:region_id}, function( data ) {
@@ -18,9 +18,9 @@ $(document).ready(function(){ @@ -18,9 +18,9 @@ $(document).ready(function(){
18 $(this).addClass('active_button'); 18 $(this).addClass('active_button');
19 $('#person').removeClass('active_button'); 19 $('#person').removeClass('active_button');
20 20
21 - $('#accounts-company').attr('type', 'text').attr('placeholder', 'Компания').val('');  
22 - $('.field-accounts-company').css('display','block');  
23 - $('#accounts-is_firm').val('1'); 21 + $('#accountsform-company').attr('type', 'text').attr('placeholder', 'Компания').val('');
  22 + $('.field-accountsform-company').css('display','block');
  23 + $('#accountsform-is_firm').val('1');
24 24
25 }); 25 });
26 26
@@ -28,11 +28,11 @@ $(document).ready(function(){ @@ -28,11 +28,11 @@ $(document).ready(function(){
28 $('#company').removeClass('active_button'); 28 $('#company').removeClass('active_button');
29 $(this).addClass('active_button'); 29 $(this).addClass('active_button');
30 30
31 - $('.field-accounts-company').css('display','none');  
32 - $('#accounts-company').attr('type', 'hidden').val('Частное лицо');  
33 - $('#accounts-is_firm').val('0'); 31 + $('.field-accountsform-company').css('display','none');
  32 + $('#accountsform-company').attr('type', 'hidden').val('Частное лицо');
  33 + $('#accountsform-is_firm').val('0');
34 34
35 35
36 }); 36 });
37 37
38 -});  
39 \ No newline at end of file 38 \ No newline at end of file
  39 +});
frontend/web/js/script.js
@@ -469,6 +469,7 @@ $(&#39;.phone_control, .phone_placeholder&#39;).click( @@ -469,6 +469,7 @@ $(&#39;.phone_control, .phone_placeholder&#39;).click(
469 function(){ 469 function(){
470 $('.menu_block_center').css({display:'none'}); 470 $('.menu_block_center').css({display:'none'});
471 $('.menu_block_center1').css({display:'block'}); 471 $('.menu_block_center1').css({display:'block'});
  472 + $('.menus_search_down').css({display: 'block'});
472 $('.menu_search_down .input_search').find('input').focus(); 473 $('.menu_search_down .input_search').find('input').focus();
473 474
474 }); 475 });
@@ -539,7 +540,9 @@ $(&#39;.active_menu&#39;).hover(function(){ @@ -539,7 +540,9 @@ $(&#39;.active_menu&#39;).hover(function(){
539 $('#auto_staff').css({'background-color':'#6b84b5'}); 540 $('#auto_staff').css({'background-color':'#6b84b5'});
540 $('#auto_staff').find('a').css({'color':'#fff'}); 541 $('#auto_staff').find('a').css({'color':'#fff'});
541 }); 542 });
542 - 543 + $('.menu_block_center2 #main_seacrh').click(function(){
  544 + $('.menu_block_center2 .menu_search_down').css({display: 'block'});
  545 + });
543 $('.menu_block_center2 .by_articul .menu_search_down').hover(function(){ 546 $('.menu_block_center2 .by_articul .menu_search_down').hover(function(){
544 $(this).find('a:first-child').css({'color':'#333'}); 547 $(this).find('a:first-child').css({'color':'#333'});
545 548