Commit 271ac00044f8bcc348719bc1390a49a521cc81de

Authored by Administrator
1 parent e85ce308

after marge

backend/assets/MyAsset.php
@@ -17,7 +17,7 @@ class MyAsset extends AssetBundle @@ -17,7 +17,7 @@ class MyAsset extends AssetBundle
17 { 17 {
18 public $basePath = '@webroot'; 18 public $basePath = '@webroot';
19 public $baseUrl = '@web'; 19 public $baseUrl = '@web';
20 - 20 + public $jsOptions = ['position' => \yii\web\View::POS_HEAD];
21 public $css = [ 21 public $css = [
22 'css/site.css', 22 'css/site.css',
23 'css/bootstrap.min.css', 23 'css/bootstrap.min.css',
backend/views/accounts/_form.php
@@ -8,23 +8,33 @@ use yii\helpers\ArrayHelper; @@ -8,23 +8,33 @@ use yii\helpers\ArrayHelper;
8 /* @var $model common\models\Accounts */ 8 /* @var $model common\models\Accounts */
9 /* @var $form yii\widgets\ActiveForm */ 9 /* @var $form yii\widgets\ActiveForm */
10 ?> 10 ?>
  11 +<script>
  12 + var app = angular.module("BackendApp", []);
  13 +
  14 + app.controller("SampleAppCtrl", function ($scope) {
  15 + $scope.hideElem1 = true;
  16 + $scope.hideElem2 = false;
  17 + $scope.buttons = [
  18 + {status: true, data:'Основные данные'},
  19 + {status: false, data:'Юридическое лицо'}
  20 +
  21 + ];
  22 + $scope.ShowMe =function(item){
  23 + $scope.buttons.forEach(function(element){
  24 + element.status = false;
  25 + });
  26 + item.status = true;
  27 + }
  28 + });
  29 +
  30 +</script>
  31 +<div ng-controller="SampleAppCtrl" class="Accounts-form">
11 32
12 -<div ng-app="HideApp" ng-controller="SampleAppCtrl" class="Accounts-form">  
13 - <script>  
14 - var app = angular.module("HideApp", []);  
15 -  
16 - app.controller("SampleAppCtrl", function ($scope) {  
17 - $scope.hideElem1 = false;  
18 - $scope.hideElem2 = true;  
19 - });  
20 -  
21 - </script>  
22 <?php $form = ActiveForm::begin(); ?> 33 <?php $form = ActiveForm::begin(); ?>
23 - <div>  
24 - <input type="checkbox" ng-model="hideElem1" /> Hide Element 1<br />  
25 - <input type="checkbox" ng-model="hideElem2" /> Hide Element 2 34 + <div >
  35 + <button ng-repeat="item in buttons" ng-click="ShowMe(item)" type="button" ng-class="item.status ? 'btn btn-primary btn-lg active' : 'btn btn-default btn-lg'" class=>{{item.data}}</button>
26 </div> 36 </div>
27 - <div ng-hide="hideElem1" > 37 + <div ng-show="buttons[0].status" >
28 <?= $form->field($model, 'if_manager')->checkbox() ?> 38 <?= $form->field($model, 'if_manager')->checkbox() ?>
29 39
30 <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?> 40 <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
@@ -58,7 +68,7 @@ use yii\helpers\ArrayHelper; @@ -58,7 +68,7 @@ use yii\helpers\ArrayHelper;
58 68
59 <?= $form->field($model, 'scode')->textInput() ?> 69 <?= $form->field($model, 'scode')->textInput() ?>
60 </div> 70 </div>
61 - <div ng-hide="hideElem2"> 71 + <div ng-show="buttons[1].status">
62 <?= $form->field($model, 'is_firm')->textInput() ?> 72 <?= $form->field($model, 'is_firm')->textInput() ?>
63 73
64 <?= $form->field($model, 'company')->textInput(['maxlength' => true]) ?> 74 <?= $form->field($model, 'company')->textInput(['maxlength' => true]) ?>
backend/views/layouts/main.php
@@ -9,7 +9,7 @@ use yii\helpers\Html; @@ -9,7 +9,7 @@ use yii\helpers\Html;
9 MyAsset::register($this); 9 MyAsset::register($this);
10 ?> 10 ?>
11 <?php $this->beginPage() ?> 11 <?php $this->beginPage() ?>
12 -<!DOCTYPE html><html lang="<?= Yii::$app->language ?>"> 12 +<!DOCTYPE html><html lang="<?= Yii::$app->language ?>" ng-app="BackendApp" >
13 <head> 13 <head>
14 <meta charset="<?= Yii::$app->charset ?>"> 14 <meta charset="<?= Yii::$app->charset ?>">
15 <meta name="viewport" content="width=device-width, initial-scale=1"> 15 <meta name="viewport" content="width=device-width, initial-scale=1">
backend/web/js/pages/dashboard.js
@@ -26,28 +26,8 @@ $(function () { @@ -26,28 +26,8 @@ $(function () {
26 zIndex: 999999 26 zIndex: 999999
27 }); 27 });
28 28
29 - //bootstrap WYSIHTML5 - text editor  
30 - $(".textarea").wysihtml5();  
31 -  
32 - $('.daterange').daterangepicker(  
33 - {  
34 - ranges: {  
35 - 'Today': [moment(), moment()],  
36 - 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],  
37 - 'Last 7 Days': [moment().subtract(6, 'days'), moment()],  
38 - 'Last 30 Days': [moment().subtract(29, 'days'), moment()],  
39 - 'This Month': [moment().startOf('month'), moment().endOf('month')],  
40 - 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]  
41 - },  
42 - startDate: moment().subtract(29, 'days'),  
43 - endDate: moment()  
44 - },  
45 - function (start, end) {  
46 - alert("You chose: " + start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));  
47 - });  
48 29
49 - /* jQueryKnob */  
50 - $(".knob").knob(); 30 +
51 31
52 //jvectormap data 32 //jvectormap data
53 var visitorsData = { 33 var visitorsData = {
@@ -63,31 +43,7 @@ $(function () { @@ -63,31 +43,7 @@ $(function () {
63 "GB": 320, //Great Britain 43 "GB": 320, //Great Britain
64 "RU": 3000 //Russia 44 "RU": 3000 //Russia
65 }; 45 };
66 - //World map by jvectormap  
67 - $('#world-map').vectorMap({  
68 - map: 'world_mill_en',  
69 - backgroundColor: "transparent",  
70 - regionStyle: {  
71 - initial: {  
72 - fill: '#e4e4e4',  
73 - "fill-opacity": 1,  
74 - stroke: 'none',  
75 - "stroke-width": 0,  
76 - "stroke-opacity": 1  
77 - }  
78 - },  
79 - series: {  
80 - regions: [{  
81 - values: visitorsData,  
82 - scale: ["#92c1dc", "#ebf4f9"],  
83 - normalizeFunction: 'polynomial'  
84 - }]  
85 - },  
86 - onRegionLabelShow: function (e, el, code) {  
87 - if (typeof visitorsData[code] != "undefined")  
88 - el.html(el.html() + ': ' + visitorsData[code] + ' new visitors');  
89 - }  
90 - }); 46 +
91 47
92 //Sparkline charts 48 //Sparkline charts
93 var myvalues = [1000, 1200, 920, 927, 931, 1027, 819, 930, 1021]; 49 var myvalues = [1000, 1200, 920, 927, 931, 1027, 819, 930, 1021];
@@ -123,77 +79,9 @@ $(function () { @@ -123,77 +79,9 @@ $(function () {
123 height: '250px' 79 height: '250px'
124 }); 80 });
125 81
126 - /* Morris.js Charts */  
127 - // Sales chart  
128 - var area = new Morris.Area({  
129 - element: 'revenue-chart',  
130 - resize: true,  
131 - data: [  
132 - {y: '2011 Q1', item1: 2666, item2: 2666},  
133 - {y: '2011 Q2', item1: 2778, item2: 2294},  
134 - {y: '2011 Q3', item1: 4912, item2: 1969},  
135 - {y: '2011 Q4', item1: 3767, item2: 3597},  
136 - {y: '2012 Q1', item1: 6810, item2: 1914},  
137 - {y: '2012 Q2', item1: 5670, item2: 4293},  
138 - {y: '2012 Q3', item1: 4820, item2: 3795},  
139 - {y: '2012 Q4', item1: 15073, item2: 5967},  
140 - {y: '2013 Q1', item1: 10687, item2: 4460},  
141 - {y: '2013 Q2', item1: 8432, item2: 5713}  
142 - ],  
143 - xkey: 'y',  
144 - ykeys: ['item1', 'item2'],  
145 - labels: ['Item 1', 'Item 2'],  
146 - lineColors: ['#a0d0e0', '#3c8dbc'],  
147 - hideHover: 'auto'  
148 - });  
149 - var line = new Morris.Line({  
150 - element: 'line-chart',  
151 - resize: true,  
152 - data: [  
153 - {y: '2011 Q1', item1: 2666},  
154 - {y: '2011 Q2', item1: 2778},  
155 - {y: '2011 Q3', item1: 4912},  
156 - {y: '2011 Q4', item1: 3767},  
157 - {y: '2012 Q1', item1: 6810},  
158 - {y: '2012 Q2', item1: 5670},  
159 - {y: '2012 Q3', item1: 4820},  
160 - {y: '2012 Q4', item1: 15073},  
161 - {y: '2013 Q1', item1: 10687},  
162 - {y: '2013 Q2', item1: 8432}  
163 - ],  
164 - xkey: 'y',  
165 - ykeys: ['item1'],  
166 - labels: ['Item 1'],  
167 - lineColors: ['#efefef'],  
168 - lineWidth: 2,  
169 - hideHover: 'auto',  
170 - gridTextColor: "#fff",  
171 - gridStrokeWidth: 0.4,  
172 - pointSize: 4,  
173 - pointStrokeColors: ["#efefef"],  
174 - gridLineColor: "#efefef",  
175 - gridTextFamily: "Open Sans",  
176 - gridTextSize: 10  
177 - });  
178 82
179 - //Donut Chart  
180 - var donut = new Morris.Donut({  
181 - element: 'sales-chart',  
182 - resize: true,  
183 - colors: ["#3c8dbc", "#f56954", "#00a65a"],  
184 - data: [  
185 - {label: "Download Sales", value: 12},  
186 - {label: "In-Store Sales", value: 30},  
187 - {label: "Mail-Order Sales", value: 20}  
188 - ],  
189 - hideHover: 'auto'  
190 - });  
191 83
192 - //Fix for charts under tabs  
193 - $('.box ul.nav a').on('shown.bs.tab', function (e) {  
194 - area.redraw();  
195 - donut.redraw();  
196 - }); 84 +
197 85
198 86
199 /* BOX REFRESH PLUGIN EXAMPLE (usage with morris charts) */ 87 /* BOX REFRESH PLUGIN EXAMPLE (usage with morris charts) */