Commit 3ed4a4cd592be4b58e349307f27e0b6b136f149c

Authored by Karnovsky A
2 parents 020c69f5 55ae078b

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

backend/controllers/BlogController.php
... ... @@ -9,24 +9,37 @@ use common\models\BlogSearch;
9 9 use yii\web\Controller;
10 10 use yii\web\NotFoundHttpException;
11 11 use yii\filters\VerbFilter;
12   -
  12 +use yii\filters\AccessControl;
13 13 /**
14 14 * BlogController implements the CRUD actions for Blog model.
15 15 */
16 16 class BlogController extends Controller
17 17 {
18 18  
19   - public $layout = '/admin';
20 19 /**
21 20 * @inheritdoc
22 21 */
23 22 public function behaviors()
24 23 {
25 24 return [
  25 + 'access' => [
  26 + 'class' => AccessControl::className(),
  27 + 'rules' => [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ],
  32 + [
  33 + 'actions' => ['logout', 'index'],
  34 + 'allow' => true,
  35 + 'roles' => ['@'],
  36 + ],
  37 + ],
  38 + ],
26 39 'verbs' => [
27 40 'class' => VerbFilter::className(),
28 41 'actions' => [
29   - 'delete' => ['POST'],
  42 + 'logout' => ['post'],
30 43 ],
31 44 ],
32 45 ];
... ...
backend/controllers/BrandController.php
... ... @@ -8,7 +8,7 @@ use common\modules\product\models\BrandSearch;
8 8 use yii\web\Controller;
9 9 use yii\web\NotFoundHttpException;
10 10 use yii\filters\VerbFilter;
11   -
  11 +use yii\filters\AccessControl;
12 12 /**
13 13 * BrandController implements the CRUD actions for Brand model.
14 14 */
... ... @@ -20,10 +20,24 @@ class BrandController extends Controller
20 20 public function behaviors()
21 21 {
22 22 return [
  23 + 'access' => [
  24 + 'class' => AccessControl::className(),
  25 + 'rules' => [
  26 + [
  27 + 'actions' => ['login', 'error'],
  28 + 'allow' => true,
  29 + ],
  30 + [
  31 + 'actions' => ['logout', 'index'],
  32 + 'allow' => true,
  33 + 'roles' => ['@'],
  34 + ],
  35 + ],
  36 + ],
23 37 'verbs' => [
24 38 'class' => VerbFilter::className(),
25 39 'actions' => [
26   - 'delete' => ['POST'],
  40 + 'logout' => ['post'],
27 41 ],
28 42 ],
29 43 ];
... ...
backend/controllers/CategoryController.php
... ... @@ -10,7 +10,7 @@ use yii\helpers\ArrayHelper;
10 10 use yii\web\Controller;
11 11 use yii\web\NotFoundHttpException;
12 12 use yii\filters\VerbFilter;
13   -
  13 +use yii\filters\AccessControl;
14 14 /**
15 15 * CategoryController implements the CRUD actions for Category model.
16 16 */
... ... @@ -22,10 +22,24 @@ class CategoryController extends Controller
22 22 public function behaviors()
23 23 {
24 24 return [
  25 + 'access' => [
  26 + 'class' => AccessControl::className(),
  27 + 'rules' => [
  28 + [
  29 + 'actions' => ['login', 'error'],
  30 + 'allow' => true,
  31 + ],
  32 + [
  33 + 'actions' => ['logout', 'index'],
  34 + 'allow' => true,
  35 + 'roles' => ['@'],
  36 + ],
  37 + ],
  38 + ],
25 39 'verbs' => [
26 40 'class' => VerbFilter::className(),
27 41 'actions' => [
28   - 'delete' => ['POST'],
  42 + 'logout' => ['post'],
29 43 ],
30 44 ],
31 45 ];
... ...
backend/controllers/OrdersController.php
... ... @@ -8,7 +8,7 @@ use common\models\OrdersSearch;
8 8 use yii\web\Controller;
9 9 use yii\web\NotFoundHttpException;
10 10 use yii\filters\VerbFilter;
11   -
  11 +use yii\filters\AccessControl;
12 12 /**
13 13 * OrdersController implements the CRUD actions for Orders model.
14 14 */
... ... @@ -20,15 +20,28 @@ class OrdersController extends Controller
20 20 public function behaviors()
21 21 {
22 22 return [
  23 + 'access' => [
  24 + 'class' => AccessControl::className(),
  25 + 'rules' => [
  26 + [
  27 + 'actions' => ['login', 'error'],
  28 + 'allow' => true,
  29 + ],
  30 + [
  31 + 'actions' => ['logout', 'index'],
  32 + 'allow' => true,
  33 + 'roles' => ['@'],
  34 + ],
  35 + ],
  36 + ],
23 37 'verbs' => [
24 38 'class' => VerbFilter::className(),
25 39 'actions' => [
26   - 'delete' => ['POST'],
  40 + 'logout' => ['post'],
27 41 ],
28 42 ],
29 43 ];
30 44 }
31   -
32 45 /**
33 46 * Lists all Orders models.
34 47 * @return mixed
... ...
backend/controllers/SiteController.php
... ... @@ -4,7 +4,7 @@ namespace backend\controllers;
4 4 use Yii;
5 5 use yii\filters\AccessControl;
6 6 use yii\web\Controller;
7   -use common\models\LoginForm;
  7 +use backend\models\LoginForm;
8 8 use yii\filters\VerbFilter;
9 9 use common\models\Blog;
10 10 /**
... ... @@ -13,7 +13,6 @@ use common\models\Blog;
13 13 class SiteController extends Controller
14 14 {
15 15  
16   - public $layout = '/admin';
17 16  
18 17 /**
19 18 * @inheritdoc
... ...
backend/models/LoginForm.php 0 → 100755
  1 +<?php
  2 +namespace backend\models;
  3 +
  4 +use common\models\User;
  5 +use Yii;
  6 +use yii\base\Model;
  7 +
  8 +/**
  9 + * Login form
  10 + */
  11 +class LoginForm extends Model
  12 +{
  13 + public $username;
  14 + public $password;
  15 + public $rememberMe = true;
  16 +
  17 + private $_user;
  18 +
  19 +
  20 + /**
  21 + * @inheritdoc
  22 + */
  23 + public function rules()
  24 + {
  25 + return [
  26 + // username and password are both required
  27 + [['username', 'password'], 'required'],
  28 + // rememberMe must be a boolean value
  29 + ['rememberMe', 'boolean'],
  30 + // password is validated by validatePassword()
  31 + ['password', 'validatePassword'],
  32 + ];
  33 + }
  34 +
  35 + /**
  36 + * Validates the password.
  37 + * This method serves as the inline validation for password.
  38 + *
  39 + * @param string $attribute the attribute currently being validated
  40 + * @param array $params the additional name-value pairs given in the rule
  41 + */
  42 + public function validatePassword($attribute, $params)
  43 + {
  44 + if (!$this->hasErrors()) {
  45 + $user = $this->getUser();
  46 + if (!$user || !$user->validatePassword($this->password)) {
  47 + $this->addError($attribute, 'Incorrect username or password.');
  48 + }
  49 + }
  50 + }
  51 +
  52 + /**
  53 + * Logs in a user using the provided username and password.
  54 + *
  55 + * @return boolean whether the user is logged in successfully
  56 + */
  57 + public function login()
  58 + {
  59 + if ($this->validate()) {
  60 + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
  61 + } else {
  62 + return false;
  63 + }
  64 + }
  65 +
  66 + /**
  67 + * Finds user by [[username]]
  68 + *
  69 + * @return User|null
  70 + */
  71 + protected function getUser()
  72 + {
  73 + if ($this->_user === null) {
  74 + $this->_user = User::findByUsername($this->username);
  75 + }
  76 +
  77 + return $this->_user;
  78 + }
  79 +}
... ...
backend/views/layouts/main-sidebar.php
... ... @@ -5,15 +5,6 @@ use yii\widgets\Menu;
5 5 <!-- sidebar: style can be found in sidebar.less -->
6 6 <section class="sidebar">
7 7 <!-- Sidebar user panel -->
8   - <div class="user-panel" style="min-height: 60px;">
9   - <div class="pull-left image">
10   - <!--img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"-->
11   - </div>
12   - <div class="pull-left info">
13   - <p>Alexander Pierce</p>
14   - <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
15   - </div>
16   - </div>
17 8 <!-- search form -->
18 9 <form action="#" method="get" class="sidebar-form">
19 10 <div class="input-group">
... ... @@ -24,7 +15,7 @@ use yii\widgets\Menu;
24 15 </span>
25 16 </div>
26 17 </form>
27   - <!-- /.search form -->
  18 + <!-- /.search form -->
28 19 <?=
29 20 Menu::widget([
30 21 'options' => ['class' => 'sidebar-menu'],
... ... @@ -32,16 +23,10 @@ use yii\widgets\Menu;
32 23  
33 24 'items' => [
34 25 ['label' => 'MAIN NAVIGATION', 'options'=>['class'=>'header']],
35   - ['label' => "Блог", 'options'=>['class'=>'treeview'], 'url' => ['#'],
36   - 'template'=>'<a href="{url}"> <i class="fa fa-dashboard"></i> <span>{label}</span> <i class="fa fa-angle-left pull-right"></i></a>',
37   - 'items' => [
38   - ['label' => 'Просмотр', 'url' => ['blog/index']],
39   - ['label' => 'Создать', 'url' => ['blog/create']],
40   - ],
41   - ],
42   - ['label' => 'Заказы', 'url' => ['orders/index'], 'template'=>'<a href="{url}"> <i class="fa fa-dashboard"></i> <span>{label}</span></a>'],
  26 + ['label' => 'Заказы', 'url' => ['orders/index'], 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-shopping-cart"></i> <span>{label}</span></a>'],
43 27 [
44 28 'label' => 'Products',
  29 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-barcode"></i> <span>{label}</span></a>',
45 30 'url' => ['/product/manage'],
46 31 'items' => [
47 32 ['label' => 'Товары', 'url' => ['/product/manage']],
... ... @@ -51,6 +36,7 @@ use yii\widgets\Menu;
51 36 ],
52 37 [
53 38 'label' => 'Характеристики',
  39 + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-search"></i> <span>{label}</span></a>',
54 40 'url' => ['/rubrication/tax-group'],
55 41 'items' => [
56 42 ['label' => 'Характеристики', 'url' => ['/rubrication/tax-group']],
... ...
backend/views/layouts/main-sidebar1.php deleted
1   -<?php
2   -use yii\widgets\Menu;
3   -?>
4   -<aside class="main-sidebar">
5   - <!-- sidebar: style can be found in sidebar.less -->
6   - <section class="sidebar">
7   - <!-- Sidebar user panel -->
8   - <div class="user-panel">
9   - <div class="pull-left image">
10   - <img src="/admin/images/img/user2-160x160.jpg" class="img-circle" alt="User Image" />
11   - </div>
12   - <div class="pull-left info">
13   - <p>Alexander Pierce</p>
14   - <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
15   - </div>
16   - </div>
17   - <!-- search form -->
18   - <form action="#" method="get" class="sidebar-form">
19   - <div class="input-group">
20   - <input type="text" name="q" class="form-control" placeholder="Search..." />
21   - <span class="input-group-btn">
22   - <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i></button>
23   - </span>
24   - </div>
25   - </form>
26   - <!-- /.search form -->
27   - <!-- sidebar menu: : style can be found in sidebar.less -->
28   - <?=
29   - Menu::widget([
30   - 'options' => ['class' => 'sidebar-menu'],
31   - 'linkTemplate'=>'<a href="{url}"><i class="fa fa-th"></i>{label}</a>',
32   - 'submenuTemplate' => "\n<ul class='treeview-menu'>\n{items}\n</ul>\n",
33   - 'items' => [
34   - ['label' => 'Главное меню', 'options'=>['class'=>'header']],
35   - ['label' => 'Заказы', 'url' => ['cart/index']],
36   - ['label' => "Загрузка файлов", 'options'=>['class'=>'treeview'], 'url' => ['#'],
37   - 'items' => [
38   - ['label' => 'Кросс файлы', 'url' => ['crossing-upload/index']],
39   - ['label' => 'Группы RG', 'url' => ['rg-grup/index']],
40   - ['label' => "Прайс файлы", 'url' => ['#'], 'items' => [
41   - ['label' => 'Файлы на сервере', 'url' => ['parser/server-files']],
42   - ['label' => 'Загрузить файл на сервер', 'url' => ['parser/index', 'mode' => 1]],
43   - ['label' => 'Журнал загрузок', 'url' => ['log/index']],
44   - ['label' => 'Ручная загрузка', 'url' => ['parser/index']],
45   - ['label' => 'Проверка прайс файлов', 'url' => ['check-price/index']],
46   - ['label' => 'Управление префиксами', 'url' => ['importers-prefix/index']],
47   - ],
48   - ],
49   - ],
50   - ],
51   - ['label' => 'Управление ролями', 'options'=>['class'=>'label_3'],'url' => ['#'], 'items' => [
52   - ['label' => 'Покупатели', 'url' => ['accounts/index']],
53   - ['label' => 'Поставщики', 'url' => ['importers/index']],
54   - ['label' => 'Администраторы', 'url' => ['user/index']],
55   - ['label' => 'Команда', 'url' => ['team/index']],
56   - ['label' => 'Группы команды', 'url' => ['team-group/index']],
57   - ],
58   - ],
59   - ['label' => 'Ценообразование', 'options'=>['class'=>'label_4'], 'url' => ['#'], 'items' => [
60   - ['label' => 'Курс', 'url' => ['currency/index']],
61   - ['label' => 'Типы цен', 'url' => ['margins/index']],
62   - ['label' => 'Коэфициенты на поставщиков', 'url' => ['margins-importers/index']],
63   - ['label' => 'Коэфициенты на импорт поставщиков', 'url' => ['margins-importers-import/index']],
64   - ['label' => 'Коэфициенты на группы RG', 'url' => ['margins-groups/index']],
65   - ],
66   - ],
67   - ['label' => 'Справочник', 'options'=>['class'=>'label_5'], 'url' => ['#'], 'items' => [
68   - ['label' => 'Замены брендов', 'url' => ['brands-replace/index']],
69   - ['label' => 'Карточки товаров', 'url' => ['details-description/index']],
70   - ['label' => 'Товары поставщиков', 'url' => ['details/index']],
71   - ['label' => 'Кроссы', 'url' => ['details-crosses/index']],
72   - ['label' => 'Бренды', 'url' => ['brands/index']],
73   - ['label' => 'Марки авто', 'url' => ['manufacturers/index']],
74   - ['label' => 'Статусы заказов', 'url' => ['currency/index']],
75   - ['label' => 'Типы доставок', 'url' => ['deliveries/index']],
76   - ['label' => 'Категории товаров', 'url' => ['currency/index']],
77   - ['label' => 'Vin коды', 'url' => ['currency/index']],
78   - ['label' => 'Запросы по номеру', 'url' => ['currency/index']],
79   - ['label' => 'Офисы', 'url' => ['offices/index']],
80   - ],
81   - ],
82   - ['label' => 'Анализ', 'options'=>['class'=>'label_6'], 'url' => ['#'], 'items' => [
83   - ['label' => 'Бренды', 'url' => ['#']],
84   - ],
85   - ],
86   - ['label' => 'Письма', 'options'=>['class'=>'label_7'], 'url' => ['#'], 'items' => [
87   - ['label' => 'Рассылка', 'url' => ['#']],
88   - ['label' => 'Рассылка Прайсов', 'url' => ['price-mailing/index']],
89   - ['label' => 'Сообщения об оплате', 'url' => ['pay-messages/index']],
90   - ['label' => 'Шаблоны писем', 'url' => ['emails/index']],
91   - ],
92   - ],
93   - ['label' => 'Элементы сайта', 'options'=>['class'=>'label_8'], 'url' => ['#'], 'items' => [
94   - ['label' => 'Текстовые страницы', 'url' => ['page/index']],
95   - ['label' => 'Новости', 'url' => ['news/index']],
96   - ['label' => 'Слайдер', 'url' => ['slider/index']],
97   - ],
98   - ],
99   - ['label' => 'Платежные системы', 'options'=>['class'=>'label_9'], 'url' => ['#'], 'items' => [
100   - ['label' => 'Описание систем', 'url' => ['settings-merchants-list/index']],
101   - ['label' => 'Хутки грош', 'url' => ['news/index']],
102   - ['label' => 'QIWI', 'url' => ['slider/index']],
103   - ['label' => 'ASSIST', 'url' => ['partners/index']],
104   - ['label' => 'iPay', 'url' => ['team/index']],
105   - ['label' => 'WEBPAY', 'url' => ['team-group/index']],
106   - ['label' => 'Деньги.Online', 'url' => ['team-group/index']],
107   - ['label' => 'ROBOKASSA', 'url' => ['team-group/index']],
108   - ['label' => 'MONEXY', 'url' => ['team-group/index']],
109   - ],
110   - ],
111   -
112   - ],
113   -
114   - ]);
115   - ?>
116   - </section>
117   - <!-- /.sidebar -->
118   -</aside>
119 0 \ No newline at end of file
backend/views/site/login.php
... ... @@ -19,7 +19,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
19 19 <div class="col-lg-5">
20 20 <?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
21 21  
22   - <?= $form->field($model, 'email')->textInput(['autofocus' => true]) ?>
  22 + <?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
23 23  
24 24 <?= $form->field($model, 'password')->passwordInput() ?>
25 25  
... ...
common/widgets/views/busket_modal.php
... ... @@ -23,7 +23,7 @@ use yii\helpers\Html;
23 23 <?php endif?>
24 24 </div>
25 25 <div class="name_and_code">
26   - <span class="name"><?= $item['item']->name?></span>
  26 + <span class="name"><?=$item['item']->product->name.' '.$item['item']->name?></span>
27 27 <span class="code"> Код: 45885-01016049</span>
28 28 </div>
29 29 <div class="count_block_wrap">
... ...
frontend/web/js/basket.js
... ... @@ -46,13 +46,15 @@ $(document).ready(function(){
46 46  
47 47 $.post( "/orders/delete", {id: id}, function( data ) {
48 48 });
49   -
  49 + var forCount = block.parents('ul');
50 50 $('.order_list_li[data-id='+id+']').each(function(){
51 51 var block = $(this);
52 52 block.remove();
53 53 });
  54 + countPrise(forCount);
  55 +
  56 +
54 57  
55   - countPrise(block);
56 58  
57 59 });
58 60  
... ...