Commit 949843769e86562e344ce004016044cdf21ea45b

Authored by Administrator
1 parent fe81463c

add active menu

backend/assets/AdminLteAsset.php
... ... @@ -27,9 +27,9 @@ class AdminLteAsset extends AssetBundle
27 27 ];
28 28 public $depends = [
29 29 'yii\web\YiiAsset',
30   - 'yii\bootstrap\BootstrapAsset',
  30 + 'common\modules\file\FileUploadAsset',
31 31 'yii\bootstrap\BootstrapPluginAsset',
32 32 'backend\assets\FontAwesomeAsset',
33   - 'common\modules\file\FileUploadAsset'
  33 +
34 34 ];
35 35 }
36 36 \ No newline at end of file
... ...
backend/controllers/OrdersController.php
... ... @@ -2,16 +2,16 @@
2 2  
3 3 namespace backend\controllers;
4 4  
  5 +use backend\models\OrdersSearch;
5 6 use Yii;
6 7 use yii\web\Controller;
7   -use yii\filters\AccessControl;
8 8 use yii\filters\VerbFilter;
9 9 use yii\data\ActiveDataProvider;
10 10 use yii\web\HttpException;
11 11 use backend\models\Orders;
12 12 use backend\models\OrdersProducts;
13 13 use common\modules\product\models\ProductVariant;
14   -
  14 +use yii\web\NotFoundHttpException;
15 15  
16 16  
17 17 class OrdersController extends Controller
... ... @@ -33,29 +33,9 @@ class OrdersController extends Controller
33 33  
34 34 public function actionIndex()
35 35 {
36   - $searchModel = new Orders;
37   - $searchModel->load(Yii::$app->request->queryParams);
38   - $query = Orders::find();
39   - if(!empty($searchModel->labels))$query->andWhere(['label'=>$searchModel->labels]);
40   - //if(!empty($searchModel->date_time))$query->andFilterWhere(['like', 'date_time', $searchModel->date_time]);
41   - if(!empty($searchModel->username))$query->andFilterWhere(['like', 'username', $searchModel->username]);
42   - if(!empty($searchModel->id))$query->andFilterWhere(['like', 'id', $searchModel->id]);
43   - if(!empty($searchModel->phone))$query->andFilterWhere(['like', 'phone', $searchModel->phone]);
44   - if(!empty($searchModel->name))$query->andFilterWhere(['like', 'name', $searchModel->name]);
45   - if(!empty($searchModel->total))$query->andFilterWhere(['like', 'total', $searchModel->total]);
46   - if(!empty($searchModel->reserve))$query->andFilterWhere(['like', 'reserve', $searchModel->reserve]);
47   - if(!empty($searchModel->status))$query->andFilterWhere(['like', 'status', $searchModel->status]);
48   -
49   -// var_dump($searchModel->name);
50   -// die;
51   - $dataProvider = new ActiveDataProvider([
52   - 'query' =>$query,
53   - 'sort'=> ['defaultOrder' => ['id'=>SORT_DESC]],
54   - 'pagination' => [
55   - 'pageSize' => 20,
56   - ],
57   - ]);
58   -
  36 + $searchModel = new OrdersSearch();
  37 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  38 +
59 39 return $this->render('index', [
60 40 'dataProvider'=>$dataProvider,
61 41 'searchModel'=>$searchModel,
... ... @@ -78,7 +58,7 @@ class OrdersController extends Controller
78 58 $model_orderproducts = new OrdersProducts;
79 59  
80 60  
81   - return $this->renderPartial('show', [
  61 + return $this->renderAjax('show', [
82 62 'model' => $model,
83 63 'model_orderproducts'=>$model_orderproducts,
84 64 'dataProvider' => $dataProvider,
... ... @@ -90,14 +70,12 @@ class OrdersController extends Controller
90 70 $model = Orders::findOne($_POST['order_id']);
91 71 $model->label = $_POST['label_id'];
92 72 $model->save();
93   - Yii::$app->and();
94 73 }
95 74  
96 75 public function actionPayupdate(){
97 76 $model = Orders::findOne($_POST['order_id']);
98 77 $model->pay = $_POST['pay_id'];
99 78 $model->save();
100   - Yii::$app->and();
101 79 }
102 80  
103 81 public function actionDelete(){
... ... @@ -111,15 +89,15 @@ class OrdersController extends Controller
111 89 $model = new OrdersProducts;
112 90 if ($model->load(Yii::$app->request->post())) {
113 91  
114   - if(!$modelMod = ProductVariant::find()->with(['product'])->where(['sku'=>$model->sku])->one())
115   - throw new HttpException(404, 'Данного артикля не существует!');
116   - $model->product_name = $modelMod->product->name;
117   - $model->name = $modelMod->name;
118   - $model->sku = $modelMod->sku;
119   - $model->price = $modelMod->price;
120   - $model->sum_cost = $model->count*$modelMod->price;
121   - $model->mod_id = $modelMod->id;
122   - $model->save();
  92 + if(!$modelMod = ProductVariant::find()->with(['product'])->where(['sku'=>$model->sku])->one())
  93 + throw new HttpException(404, 'Данного артикля не существует!');
  94 + $model->product_name = $modelMod->product->name;
  95 + $model->name = $modelMod->name;
  96 + $model->sku = $modelMod->sku;
  97 + $model->price = $modelMod->price;
  98 + $model->sum_cost = $model->count*$modelMod->price;
  99 + $model->mod_id = $modelMod->id;
  100 + $model->save();
123 101 //return Yii::$app->response->redirect(['/admin/orders/show','id'=>$_GET['order_id']]);
124 102 }
125 103  
... ...
backend/models/Orders.php
... ... @@ -16,7 +16,7 @@ class Orders extends \yii\db\ActiveRecord
16 16 {
17 17 return [
18 18 [['name'], 'required'],
19   - [['user_id','adress','body','total','status','email','patronymic','surname',
  19 + [['user_id','adress','body','total','status','email',
20 20 'comment','labels','pay','date_dedline','phone','phone2','numbercard','delivery',
21 21 'declaration','stock','consignment','payment', 'insurance',
22 22 'amount_imposed','shipping_by','city','date_time', 'id' ], 'safe'],
... ... @@ -28,31 +28,29 @@ class Orders extends \yii\db\ActiveRecord
28 28 {
29 29 return [
30 30 'id'=>'№ заказа',
31   - 'name'=>'Имя',
  31 + 'name'=>'ФИО',
32 32 'phone'=>'Телефон',
33   - 'phone2'=>'Телефон 2',
  33 + 'phone2'=>'Телефон 2',
34 34 'adress'=>'Адрес',
35   - 'body'=>'Сообщение',
36   - 'reserve'=>'Резерв',
37   - 'status'=>'Статус',
38   - 'email'=>'E-mail',
39   - 'patronymic'=>'Очество',
40   - 'surname'=>'Фамилия',
41   - 'total'=>'Сумма',
42   - 'labels'=>'Метки',
43   - 'label'=>'Метка',
44   - 'comment'=>'Комментарий менеджера',
45   - 'date_dedline'=>'Дедлайн',
46   - 'numbercard'=>'№ карточки',
47   - 'delivery'=>'Доставка',
48   - 'declaration'=>'Декларация №',
49   - 'stock'=>'№ склада',
50   - 'consignment'=>'№ накладной',
51   - 'payment'=>'Способ оплаты',
52   - 'insurance'=>'Страховка',
53   - 'amount_imposed'=>'Сумма наложенного',
54   - 'shipping_by'=>'Отправка за счет',
55   - 'city'=>'Город'
  35 + 'body'=>'Сообщение',
  36 + 'reserve'=>'Резерв',
  37 + 'status'=>'Статус',
  38 + 'email'=>'E-mail',
  39 + 'total'=>'Сумма',
  40 + 'labels'=>'Метки',
  41 + 'label'=>'Метка',
  42 + 'comment'=>'Комментарий менеджера',
  43 + 'date_dedline'=>'Дедлайн',
  44 + 'numbercard'=>'№ карточки',
  45 + 'delivery'=>'Доставка',
  46 + 'declaration'=>'Декларация №',
  47 + 'stock'=>'№ склада',
  48 + 'consignment'=>'№ накладной',
  49 + 'payment'=>'Способ оплаты',
  50 + 'insurance'=>'Страховка',
  51 + 'amount_imposed'=>'Сумма наложенного',
  52 + 'shipping_by'=>'Отправка за счет',
  53 + 'city'=>'Город'
56 54 ];
57 55 }
58 56  
... ...
backend/models/OrdersSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use backend\models\Orders;
  9 +
  10 +/**
  11 + * OrdersSearch represents the model behind the search form about `backend\models\Orders`.
  12 + */
  13 +class OrdersSearch extends Orders
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id', 'user_id', 'label', 'pay', 'numbercard'], 'integer'],
  22 + [['name', 'phone', 'phone2', 'email', 'adress', 'body', 'date_time', 'date_dedline', 'reserve', 'status', 'comment', 'delivery', 'declaration', 'stock', 'consignment', 'payment', 'insurance', 'shipping_by', 'city'], 'safe'],
  23 + [['total', 'amount_imposed'], 'number'],
  24 + ];
  25 + }
  26 +
  27 + /**
  28 + * @inheritdoc
  29 + */
  30 + public function scenarios()
  31 + {
  32 + // bypass scenarios() implementation in the parent class
  33 + return Model::scenarios();
  34 + }
  35 +
  36 + /**
  37 + * Creates data provider instance with search query applied
  38 + *
  39 + * @param array $params
  40 + *
  41 + * @return ActiveDataProvider
  42 + */
  43 + public function search($params)
  44 + {
  45 + $query = Orders::find();
  46 +
  47 + // add conditions that should always apply here
  48 +
  49 + $dataProvider = new ActiveDataProvider([
  50 + 'query' => $query,
  51 + 'sort'=> ['defaultOrder' => ['id'=>SORT_DESC]],
  52 + 'pagination' => [
  53 + 'pageSize' => 20,
  54 + ]
  55 + ]);
  56 +
  57 + $this->load($params);
  58 +
  59 + if (!$this->validate()) {
  60 + // uncomment the following line if you do not want to return any records when validation fails
  61 + // $query->where('0=1');
  62 + return $dataProvider;
  63 + }
  64 +
  65 + // grid filtering conditions
  66 + $query->andFilterWhere([
  67 + 'id' => $this->id,
  68 + 'user_id' => $this->user_id,
  69 + 'total' => $this->total,
  70 + 'date_time' => $this->date_time,
  71 + 'date_dedline' => $this->date_dedline,
  72 + 'label' => $this->label,
  73 + 'pay' => $this->pay,
  74 + 'numbercard' => $this->numbercard,
  75 + 'amount_imposed' => $this->amount_imposed,
  76 + ]);
  77 +
  78 + $query->andFilterWhere(['like', 'name', $this->name])
  79 + ->andFilterWhere(['like', 'phone', $this->phone])
  80 + ->andFilterWhere(['like', 'phone2', $this->phone2])
  81 + ->andFilterWhere(['like', 'email', $this->email])
  82 + ->andFilterWhere(['like', 'adress', $this->adress])
  83 + ->andFilterWhere(['like', 'body', $this->body])
  84 + ->andFilterWhere(['like', 'reserve', $this->reserve])
  85 + ->andFilterWhere(['like', 'status', $this->status])
  86 + ->andFilterWhere(['like', 'comment', $this->comment])
  87 + ->andFilterWhere(['like', 'delivery', $this->delivery])
  88 + ->andFilterWhere(['like', 'declaration', $this->declaration])
  89 + ->andFilterWhere(['like', 'stock', $this->stock])
  90 + ->andFilterWhere(['like', 'consignment', $this->consignment])
  91 + ->andFilterWhere(['like', 'payment', $this->payment])
  92 + ->andFilterWhere(['like', 'insurance', $this->insurance])
  93 + ->andFilterWhere(['like', 'shipping_by', $this->shipping_by])
  94 + ->andFilterWhere(['like', 'city', $this->city]);
  95 +
  96 + return $dataProvider;
  97 + }
  98 +}
... ...
backend/views/event/_form.php
1 1 <?php
2 2  
3   -use yii\jui\DatePicker;
  3 +use kartik\date\DatePicker;
4 4 use yii\helpers\Html;
5 5 use yii\widgets\ActiveForm;
6 6 use mihaildev\ckeditor\CKEditor;
... ... @@ -31,9 +31,10 @@ use mihaildev\elfinder\ElFinder;
31 31  
32 32 <?= $form->field($model, 'end_at')
33 33 ->widget(DatePicker::className(), [
34   - 'dateFormat' => 'yyyy-MM-dd',
35   - 'clientOptions' => [ 'minDate' => 1 ],
36   - ]) ?>
  34 + 'pluginOptions' => [
  35 + 'format' => 'dd-M-yyyy',
  36 + 'todayHighlight' => true
  37 + ]]) ?>
37 38  
38 39  
39 40 <?= \common\modules\file\widgets\ImageUploader::widget([
... ...
backend/views/layouts/header.php
... ... @@ -2,9 +2,9 @@
2 2 <!-- Logo -->
3 3 <a href="index2.html" class="logo">
4 4 <!-- mini logo for sidebar mini 50x50 pixels -->
5   - <span class="logo-mini"><b>A</b>LT</span>
  5 + <span class="logo-mini"><b>A</b>BOX</span>
6 6 <!-- logo for regular state and mobile devices -->
7   - <span class="logo-lg"><b>Admin</b>LTE</span>
  7 + <span class="logo-lg"><b>Art</b>BOX</span>
8 8 </a>
9 9 <!-- Header Navbar: style can be found in header.less -->
10 10 <nav class="navbar navbar-static-top" role="navigation">
... ... @@ -14,247 +14,6 @@
14 14 </a>
15 15  
16 16 <div class="navbar-custom-menu">
17   - <ul class="nav navbar-nav">
18   - <!-- Messages: style can be found in dropdown.less-->
19   - <li class="dropdown messages-menu">
20   - <a href="#" class="dropdown-toggle" data-toggle="dropdown">
21   - <i class="fa fa-envelope-o"></i>
22   - <span class="label label-success">4</span>
23   - </a>
24   - <ul class="dropdown-menu">
25   - <li class="header">You have 4 messages</li>
26   - <li>
27   - <!-- inner menu: contains the actual data -->
28   - <ul class="menu">
29   - <li><!-- start message -->
30   - <a href="#">
31   - <div class="pull-left">
32   - <img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
33   - </div>
34   - <h4>
35   - Support Team
36   - <small><i class="fa fa-clock-o"></i> 5 mins</small>
37   - </h4>
38   - <p>Why not buy a new awesome theme?</p>
39   - </a>
40   - </li>
41   - <!-- end message -->
42   - <li>
43   - <a href="#">
44   - <div class="pull-left">
45   - <img src="dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
46   - </div>
47   - <h4>
48   - AdminLTE Design Team
49   - <small><i class="fa fa-clock-o"></i> 2 hours</small>
50   - </h4>
51   - <p>Why not buy a new awesome theme?</p>
52   - </a>
53   - </li>
54   - <li>
55   - <a href="#">
56   - <div class="pull-left">
57   - <img src="dist/img/user4-128x128.jpg" class="img-circle" alt="User Image">
58   - </div>
59   - <h4>
60   - Developers
61   - <small><i class="fa fa-clock-o"></i> Today</small>
62   - </h4>
63   - <p>Why not buy a new awesome theme?</p>
64   - </a>
65   - </li>
66   - <li>
67   - <a href="#">
68   - <div class="pull-left">
69   - <img src="dist/img/user3-128x128.jpg" class="img-circle" alt="User Image">
70   - </div>
71   - <h4>
72   - Sales Department
73   - <small><i class="fa fa-clock-o"></i> Yesterday</small>
74   - </h4>
75   - <p>Why not buy a new awesome theme?</p>
76   - </a>
77   - </li>
78   - <li>
79   - <a href="#">
80   - <div class="pull-left">
81   - <img src="dist/img/user4-128x128.jpg" class="img-circle" alt="User Image">
82   - </div>
83   - <h4>
84   - Reviewers
85   - <small><i class="fa fa-clock-o"></i> 2 days</small>
86   - </h4>
87   - <p>Why not buy a new awesome theme?</p>
88   - </a>
89   - </li>
90   - </ul>
91   - </li>
92   - <li class="footer"><a href="#">See All Messages</a></li>
93   - </ul>
94   - </li>
95   - <!-- Notifications: style can be found in dropdown.less -->
96   - <li class="dropdown notifications-menu">
97   - <a href="#" class="dropdown-toggle" data-toggle="dropdown">
98   - <i class="fa fa-bell-o"></i>
99   - <span class="label label-warning">10</span>
100   - </a>
101   - <ul class="dropdown-menu">
102   - <li class="header">You have 10 notifications</li>
103   - <li>
104   - <!-- inner menu: contains the actual data -->
105   - <ul class="menu">
106   - <li>
107   - <a href="#">
108   - <i class="fa fa-users text-aqua"></i> 5 new members joined today
109   - </a>
110   - </li>
111   - <li>
112   - <a href="#">
113   - <i class="fa fa-warning text-yellow"></i> Very long description here that may not fit into the
114   - page and may cause design problems
115   - </a>
116   - </li>
117   - <li>
118   - <a href="#">
119   - <i class="fa fa-users text-red"></i> 5 new members joined
120   - </a>
121   - </li>
122   - <li>
123   - <a href="#">
124   - <i class="fa fa-shopping-cart text-green"></i> 25 sales made
125   - </a>
126   - </li>
127   - <li>
128   - <a href="#">
129   - <i class="fa fa-user text-red"></i> You changed your username
130   - </a>
131   - </li>
132   - </ul>
133   - </li>
134   - <li class="footer"><a href="#">View all</a></li>
135   - </ul>
136   - </li>
137   - <!-- Tasks: style can be found in dropdown.less -->
138   - <li class="dropdown tasks-menu">
139   - <a href="#" class="dropdown-toggle" data-toggle="dropdown">
140   - <i class="fa fa-flag-o"></i>
141   - <span class="label label-danger">9</span>
142   - </a>
143   - <ul class="dropdown-menu">
144   - <li class="header">You have 9 tasks</li>
145   - <li>
146   - <!-- inner menu: contains the actual data -->
147   - <ul class="menu">
148   - <li><!-- Task item -->
149   - <a href="#">
150   - <h3>
151   - Design some buttons
152   - <small class="pull-right">20%</small>
153   - </h3>
154   - <div class="progress xs">
155   - <div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
156   - <span class="sr-only">20% Complete</span>
157   - </div>
158   - </div>
159   - </a>
160   - </li>
161   - <!-- end task item -->
162   - <li><!-- Task item -->
163   - <a href="#">
164   - <h3>
165   - Create a nice theme
166   - <small class="pull-right">40%</small>
167   - </h3>
168   - <div class="progress xs">
169   - <div class="progress-bar progress-bar-green" style="width: 40%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
170   - <span class="sr-only">40% Complete</span>
171   - </div>
172   - </div>
173   - </a>
174   - </li>
175   - <!-- end task item -->
176   - <li><!-- Task item -->
177   - <a href="#">
178   - <h3>
179   - Some task I need to do
180   - <small class="pull-right">60%</small>
181   - </h3>
182   - <div class="progress xs">
183   - <div class="progress-bar progress-bar-red" style="width: 60%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
184   - <span class="sr-only">60% Complete</span>
185   - </div>
186   - </div>
187   - </a>
188   - </li>
189   - <!-- end task item -->
190   - <li><!-- Task item -->
191   - <a href="#">
192   - <h3>
193   - Make beautiful transitions
194   - <small class="pull-right">80%</small>
195   - </h3>
196   - <div class="progress xs">
197   - <div class="progress-bar progress-bar-yellow" style="width: 80%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
198   - <span class="sr-only">80% Complete</span>
199   - </div>
200   - </div>
201   - </a>
202   - </li>
203   - <!-- end task item -->
204   - </ul>
205   - </li>
206   - <li class="footer">
207   - <a href="#">View all tasks</a>
208   - </li>
209   - </ul>
210   - </li>
211   - <!-- User Account: style can be found in dropdown.less -->
212   - <li class="dropdown user user-menu">
213   - <a href="#" class="dropdown-toggle" data-toggle="dropdown">
214   - <!--img src="dist/img/user2-160x160.jpg" class="user-image" alt="User Image"-->
215   - <span class="hidden-xs">Alexander Pierce</span>
216   - </a>
217   - <ul class="dropdown-menu">
218   - <!-- User image -->
219   - <li class="user-header">
220   - <img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
221   -
222   - <p>
223   - Alexander Pierce - Web Developer
224   - <small>Member since Nov. 2012</small>
225   - </p>
226   - </li>
227   - <!-- Menu Body -->
228   - <li class="user-body">
229   - <div class="row">
230   - <div class="col-xs-4 text-center">
231   - <a href="#">Followers</a>
232   - </div>
233   - <div class="col-xs-4 text-center">
234   - <a href="#">Sales</a>
235   - </div>
236   - <div class="col-xs-4 text-center">
237   - <a href="#">Friends</a>
238   - </div>
239   - </div>
240   - <!-- /.row -->
241   - </li>
242   - <!-- Menu Footer-->
243   - <li class="user-footer">
244   - <div class="pull-left">
245   - <a href="#" class="btn btn-default btn-flat">Profile</a>
246   - </div>
247   - <div class="pull-right">
248   - <a href="#" class="btn btn-default btn-flat">Sign out</a>
249   - </div>
250   - </li>
251   - </ul>
252   - </li>
253   - <!-- Control Sidebar Toggle Button -->
254   - <li>
255   - <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
256   - </li>
257   - </ul>
258 17 </div>
259 18 </nav>
260 19 </header>
261 20 \ No newline at end of file
... ...
backend/views/layouts/main-sidebar.php
... ... @@ -4,25 +4,12 @@ use yii\widgets\Menu;
4 4 <aside class="main-sidebar">
5 5 <!-- sidebar: style can be found in sidebar.less -->
6 6 <section class="sidebar">
7   - <!-- Sidebar user panel -->
8   - <!-- search form -->
9   - <form action="#" method="get" class="sidebar-form">
10   - <div class="input-group">
11   - <input type="text" name="q" class="form-control" placeholder="Search...">
12   - <span class="input-group-btn">
13   - <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
14   - </button>
15   - </span>
16   - </div>
17   - </form>
18   - <!-- /.search form -->
19 7 <?=
20 8 Menu::widget([
21 9 'options' => ['class' => 'sidebar-menu'],
22 10 'submenuTemplate' => "\n<ul class='treeview-menu'>\n{items}\n</ul>\n",
23 11  
24 12 'items' => [
25   - ['label' => 'MAIN NAVIGATION', 'options'=>['class'=>'header']],
26 13 ['label' => 'Заказы', 'url' => ['/orders/index'], 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-shopping-cart"></i> <span>{label}</span></a>'],
27 14 [
28 15 'label' => 'eCommerce',
... ...
backend/views/orders/index.php
... ... @@ -5,8 +5,6 @@ use yii\bootstrap\ActiveForm;
5 5 use yii\helpers\ArrayHelper;
6 6 use backend\models\Label;
7 7 use yii\bootstrap\Modal;
8   -$this->registerJsFile('/app/modules/admin/assets/js/jquery-1.11.3.min.js');
9   -$this->registerJsFile('/app/modules/admin/assets/js/site.js');
10 8  
11 9  
12 10 $this->title = 'Заказы';
... ... @@ -15,15 +13,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
15 13 <h1>Заказы</h1>
16 14  
17 15 <?php $form = ActiveForm::begin(['id' => 'label-form','method'=>'get','action'=>['/admin/orders/index']]); ?>
18   -
19   - <?php
20   - $arr = [];
21   - foreach(Label::find()->orderBy('id')->all() as $item)
22   - {
23   - $arr[] = ['id'=>$item->id,'label'=>$item->label.'-'.$item->name];
24   - }
25   - echo $form->field($searchModel, 'labels')->inline(true)->checkboxList(ArrayHelper::map($arr, 'id', 'label'),['onClick'=>'$("#label-form").submit()']);
26   - ?>
  16 +
27 17  
28 18 <?php ActiveForm::end(); ?>
29 19  
... ... @@ -73,23 +63,24 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
73 63 //'contentOptions'=>['style'=>'max-width: 300px;']
74 64 ],
75 65 [
76   - 'attribute' => 'label',
77   - 'value' => function ($model, $key, $index, $column) {
78   - // var_dump($model); var_dump($key); exit;
79   - return Html::activeDropDownList($model, 'label',
80   - yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'),
81   - [
82   - 'prompt' => 'Нет',
83   - 'onchange' => "$.ajax({
84   - url: \"/admin/orders/labelupdate\",
85   - type: \"post\",
86   - data: { order_id: $model->id, label_id : this.value},
87   - });"
88   - ]
  66 + 'filter' => yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'),
  67 + 'attribute' => 'label',
  68 + 'value' => function ($model, $key, $index, $column) {
  69 + // var_dump($model); var_dump($key); exit;
  70 + return Html::activeDropDownList($model, 'label',
  71 + yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'),
  72 + [
  73 + 'prompt' => 'Нет',
  74 + 'onchange' => "$.ajax({
  75 + url: \"/admin/orders/labelupdate\",
  76 + type: \"post\",
  77 + data: { order_id: $model->id, label_id : this.value},
  78 + });"
  79 + ]
89 80  
90   - );
91   - },
92   - 'format' => 'raw',
  81 + );
  82 + },
  83 + 'format' => 'raw',
93 84 ],
94 85 [
95 86 'attribute' => 'pay',
... ...
backend/views/orders/show.php
... ... @@ -5,8 +5,7 @@ use yii\bootstrap\ActiveForm;
5 5 use yii\helpers\ArrayHelper;
6 6 use common\models\Delivery;
7 7 use yii\bootstrap\Modal;
8   -
9   -$this->registerCssFile('/app/modules/admin/assets/css/admin_order.css');
  8 +use kartik\date\DatePicker;
10 9  
11 10  
12 11 // $this->title = 'Заказ №'.$model->id;
... ... @@ -44,8 +43,13 @@ $this-&gt;registerCssFile(&#39;/app/modules/admin/assets/css/admin_order.css&#39;);
44 43 <label class="control-label col-sm-3">Дата</label>
45 44 <?=$model->date_time?>
46 45 </div>
47   -<?= $form->field($model,'date_dedline')->widget(\yii\jui\DatePicker::className(),['clientOptions' => [],'options' => ['class'=>'form-control','style'=>'width:150px;'],'dateFormat' => 'yyyy-MM-dd',]) ?>
48 46  
  47 + <?= $form->field($model, 'date_dedline')
  48 + ->widget(DatePicker::className(), [
  49 + 'pluginOptions' => [
  50 + 'format' => 'dd-M-yyyy',
  51 + 'todayHighlight' => true
  52 + ]]) ?>
49 53  
50 54 <?= $form->field($model, 'name') ?>
51 55  
... ...
backend/web/css/site.css
1   -@import url("//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css");
2   -
3 1 html,
4 2 body {
5 3 height: 100%;
... ...
common/models/Orders.php
... ... @@ -51,33 +51,7 @@ class Orders extends \yii\db\ActiveRecord
51 51 return parent::beforeDelete();
52 52 }
53 53  
54   - public function contact($email,$body)
55   - {
56   - if ($this->validate()) {
57   - $body .= 'Вся сумма: '.$this->total;
58   - $body .= "\n\r";
59   - $body .= 'Имя: '.$this->name;
60   - $body .= "\n\r";
61   - $body .= 'E-mail: '.$this->email;
62   - $body .= "\n\r";
63   - $body .= 'Телефон: '.$this->phone;
64   - $body .= "\n\r";
65   - $body .= 'Адрес: '.$this->adress;
66   - $body .= "\n\r";
67   - $body .= 'Сообщение: '.$this->body;
68   - $body .= "\n\r";
69   -
70   - Yii::$app->mailer->compose()
71   - ->setTo($email)
72   - ->setFrom(['send@artweb.ua' => 'send'])
73   - ->setSubject('Заказ на сайте Рюкзаки')
74   - ->setTextBody($body)
75   - ->send();
76   - return true;
77   - } else {
78   - return false;
79   - }
80   - }
  54 +
81 55 public function addBasket ($mod_id, $count)
82 56 {
83 57 $session = new Session;
... ...