@kigi/components 1.36.0 β 1.37.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -2
- package/src/components/index.ts +2 -0
- package/src/components/mbg-homescreen/cards/chart-wrapper/chart-wrapper.html +2 -1
- package/src/components/mbg-homescreen/cards/chart-wrapper/chart-wrapper.ts +1 -0
- package/src/components/mbg-homescreen/cards/panel/panel.html +36 -11
- package/src/components/mbg-homescreen/cards/panel/panel.scss +22 -1
- package/src/components/mbg-homescreen/cards/panel/panel.ts +154 -2
- package/src/components/mbg-homescreen/charts/bar-line/bar-line.html +1 -0
- package/src/components/mbg-homescreen/charts/bar-line/bar-line.ts +1 -0
- package/src/components/mbg-homescreen/charts/bar-line-pie/bar-line-pie.html +1 -0
- package/src/components/mbg-homescreen/charts/bar-line-pie/bar-line-pie.ts +1 -0
- package/src/components/mbg-homescreen/charts/line/line.html +1 -0
- package/src/components/mbg-homescreen/charts/line/line.ts +1 -0
- package/src/components/mbg-homescreen/index.ts +1 -0
- package/src/components/mbg-homescreen/mbg-homescreen.html +3 -0
- package/src/components/mbg-homescreen/mbg-homescreen.ts +3 -0
- package/src/components/mbg-store-goal/index.ts +8 -0
- package/src/components/mbg-store-goal/mbg-store-goal.html +40 -0
- package/src/components/mbg-store-goal/mbg-store-goal.scss +100 -0
- package/src/components/mbg-store-goal/mbg-store-goal.ts +228 -0
- package/src/index.html +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kigi/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.37.0-alpha.1",
|
|
4
4
|
"description": "@kigi/components",
|
|
5
5
|
"main": "src/components/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"firebase": "7.16.0",
|
|
58
58
|
"fuse.js": "^3.4.6",
|
|
59
59
|
"grpc": "1.20.2",
|
|
60
|
-
"highcharts": "^6.
|
|
60
|
+
"highcharts": "^6.2.0",
|
|
61
|
+
"highcharts-more": "^0.1.7",
|
|
61
62
|
"imports-loader": "^0.8.0",
|
|
62
63
|
"jodit": "^3.6.11",
|
|
63
64
|
"jquery": "3.4.1",
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
"jquery-ui": "^1.12.1",
|
|
66
67
|
"jquery-ui-bundle": "^1.12.1-migrate",
|
|
67
68
|
"lodash.get": "^4.4.2",
|
|
69
|
+
"moment": "^2.30.1",
|
|
68
70
|
"ng-easy-infinite-scroll": "^1.0.0",
|
|
69
71
|
"postcss-flexbugs-fixes": "^4.1.0",
|
|
70
72
|
"postcss-import": "^12.0.1",
|
package/src/components/index.ts
CHANGED
|
@@ -86,6 +86,7 @@ import 'jodit/src/langs/pt_br.js'
|
|
|
86
86
|
import { NgMaskIe } from '../helpers/ie-directive/ie-directive'
|
|
87
87
|
import { mbgAceEditorModule } from './mbg-ace-editor'
|
|
88
88
|
import { mbgImageUploadCropModule } from './mbg-image-upload-crop'
|
|
89
|
+
import { mbgStoreGoalModule } from './mbg-store-goal'
|
|
89
90
|
|
|
90
91
|
if (!window['$']) {
|
|
91
92
|
window['$'] = $
|
|
@@ -153,6 +154,7 @@ const mbgComponentsModule = angular
|
|
|
153
154
|
mbgRepasseModule,
|
|
154
155
|
mbgTextEditorModule,
|
|
155
156
|
mbgAceEditorModule,
|
|
157
|
+
mbgStoreGoalModule,
|
|
156
158
|
])
|
|
157
159
|
.config(appConfig)
|
|
158
160
|
.service('mbgAlert', MbgAlert)
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
<div class="home-chart"> </div>
|
|
3
3
|
<div class="divider"></div>
|
|
4
4
|
<div class="home-cards">
|
|
5
|
-
<mbg-card-panel ng-repeat="panel in $ctrl.panels"
|
|
5
|
+
<mbg-card-panel ng-repeat="panel in $ctrl.panels track by $index"
|
|
6
6
|
loading="$ctrl.loading"
|
|
7
7
|
allow-dashboard-main-sales="$ctrl.allowDashboardMainSales"
|
|
8
8
|
display-values="$ctrl.displayValues"
|
|
9
9
|
allowed-to-see="$ctrl.allowedToSee"
|
|
10
|
+
active-filter="$ctrl.activeFilter"
|
|
10
11
|
allowed-call-back="$ctrl.allowedCallBack()"
|
|
11
12
|
panel="panel">
|
|
12
13
|
<i class="{{ panel.icon }}"
|
|
@@ -20,19 +20,37 @@
|
|
|
20
20
|
ng-show="!$ctrl.hideValue"
|
|
21
21
|
disable-animate>
|
|
22
22
|
<p class="value"
|
|
23
|
-
ng-class="{'positive':
|
|
24
|
-
|
|
23
|
+
ng-class="{'positive': $ctrl.panel.increasedValue,
|
|
24
|
+
'negative': !$ctrl.panel.increasedValue}"
|
|
25
25
|
ng-if="$ctrl.panel.isCurrency">{{ $ctrl.panel.value || 0 | currency: 'R$ ' }}
|
|
26
26
|
</p>
|
|
27
27
|
<p class="value"
|
|
28
|
+
ng-class="{'positive': $ctrl.panel.increasedValue,
|
|
29
|
+
'negative': !$ctrl.panel.increasedValue}"
|
|
28
30
|
ng-if="!$ctrl.panel.isCurrency">{{ $ctrl.panel.value || 0}}
|
|
29
31
|
</p>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<div uib-tooltip-html="$ctrl.panel.message"
|
|
35
|
+
tooltip-placement="{{$ctrl.panel.avgSales ? 'top' :'bottom' }}">
|
|
36
|
+
<span ng-if="$ctrl.panel.increasedValue && !$ctrl.valuesEqual && !$ctrl.hideValue"
|
|
37
|
+
class="positive">
|
|
38
|
+
<i class="fa fa-arrow-up"
|
|
39
|
+
aria-hidden="true"></i></span>
|
|
40
|
+
|
|
41
|
+
<span ng-if="$ctrl.valuesEqual && !$ctrl.hideValue"
|
|
42
|
+
class="equal">
|
|
43
|
+
<i class="fa fa-minus"
|
|
44
|
+
aria-hidden="true"></i></span>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
<div uib-tooltip-html="$ctrl.panel.message"
|
|
49
|
+
tooltip-placement="{{$ctrl.panel.avgSales ? 'top' :'bottom' }}">
|
|
50
|
+
<span ng-if="!$ctrl.panel.increasedValue && !$ctrl.valuesEqual && !$ctrl.hideValue"
|
|
51
|
+
class="negative"><i class="fa fa-arrow-down"
|
|
52
|
+
aria-hidden="true"></i></span>
|
|
53
|
+
</div>
|
|
36
54
|
</div>
|
|
37
55
|
|
|
38
56
|
<!-- quando valores estΓ£o ocultos -->
|
|
@@ -41,12 +59,19 @@
|
|
|
41
59
|
disable-animate>
|
|
42
60
|
<p class="value">{{ $ctrl.randomEmoji }}</p>
|
|
43
61
|
|
|
44
|
-
<span ng-if="$ctrl.panel.
|
|
62
|
+
<span ng-if="$ctrl.panel.increasedValue && !$ctrl.valuesEqual"
|
|
45
63
|
class="positive"><i class="fa fa-arrow-up"
|
|
46
|
-
aria-hidden="true"></i></
|
|
47
|
-
|
|
64
|
+
aria-hidden="true"></i></span>
|
|
65
|
+
|
|
66
|
+
<span ng-if="!$ctrl.panel.increasedValue && !$ctrl.valuesEqual"
|
|
48
67
|
class="negative"><i class="fa fa-arrow-down"
|
|
49
68
|
aria-hidden="true"></i></span>
|
|
69
|
+
|
|
70
|
+
<span ng-if="$ctrl.valuesEqual"
|
|
71
|
+
class="equal">
|
|
72
|
+
<i class="fa fa-minus"
|
|
73
|
+
aria-hidden="true"></i></span>
|
|
74
|
+
|
|
50
75
|
</div>
|
|
51
76
|
</div>
|
|
52
77
|
</div>
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
mbg-card-panel {
|
|
2
|
+
.tooltip-chart-panel {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
position: relative;
|
|
6
|
+
background:#0EBCBD;
|
|
7
|
+
font-weight: bold;
|
|
8
|
+
color: #FFFFFF;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
margin-right: 200px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tooltip-inner {
|
|
15
|
+
background: transparent;
|
|
16
|
+
margin-right: 180px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
2
21
|
.mbg-h-c-panel {
|
|
3
|
-
border: 1px solid #
|
|
22
|
+
border: 1px solid #F1F1F1;
|
|
23
|
+
border-radius: 12px;
|
|
24
|
+
padding: 8px;
|
|
4
25
|
border-radius: 12px;
|
|
5
26
|
padding: 8px;
|
|
6
27
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import './panel.scss'
|
|
2
2
|
import template from './panel.html'
|
|
3
|
+
// import { DashboardService } from 'services/dashboard-service'
|
|
4
|
+
// import moment from 'moment'
|
|
3
5
|
|
|
4
6
|
class MbgCardPanelController {
|
|
5
7
|
public loading
|
|
@@ -9,8 +11,20 @@ class MbgCardPanelController {
|
|
|
9
11
|
public allowedToSee: boolean
|
|
10
12
|
private allowedCallBack: Function
|
|
11
13
|
private allowDashboardMainSales
|
|
14
|
+
private activeFilter: any
|
|
15
|
+
private totalSalesFilter = false
|
|
16
|
+
private index
|
|
17
|
+
private messagetooltip = ''
|
|
18
|
+
private valuesEqual: boolean = false
|
|
12
19
|
|
|
13
|
-
constructor(
|
|
20
|
+
constructor(
|
|
21
|
+
public $scope,
|
|
22
|
+
public $element,
|
|
23
|
+
public $attrs,
|
|
24
|
+
public $timeout,
|
|
25
|
+
// public dashboardService: DashboardService,
|
|
26
|
+
public $filter,
|
|
27
|
+
) {}
|
|
14
28
|
$onInit() {
|
|
15
29
|
this.syncValue()
|
|
16
30
|
this.$scope.$watch('$ctrl.displayValues', (data) => {
|
|
@@ -23,6 +37,7 @@ class MbgCardPanelController {
|
|
|
23
37
|
this.panel.setNewValue = (value) => {
|
|
24
38
|
this.setValue(value)
|
|
25
39
|
}
|
|
40
|
+
// this.getCardsGeral()
|
|
26
41
|
}
|
|
27
42
|
|
|
28
43
|
setValue = (value) => {
|
|
@@ -32,6 +47,135 @@ class MbgCardPanelController {
|
|
|
32
47
|
}, 1000)
|
|
33
48
|
}
|
|
34
49
|
|
|
50
|
+
// async getCardsGeral() {
|
|
51
|
+
// this.$timeout(async () => {
|
|
52
|
+
// const { dateIni, dateFim } = this.getFilterDate()
|
|
53
|
+
// let response = await this.dashboardService
|
|
54
|
+
// .getCardsTotalSalesDashboardByFilter({ dateIni, dateFim })
|
|
55
|
+
// .then((response) => response.data)
|
|
56
|
+
|
|
57
|
+
// const values = {
|
|
58
|
+
// totalSales: response.totalSales ? response.totalSales : 0,
|
|
59
|
+
// avgSales: response.avgSales ? response.avgSales : 0,
|
|
60
|
+
// countSales: response.countSales || 0,
|
|
61
|
+
// countItems: response.countItems || 0,
|
|
62
|
+
// }
|
|
63
|
+
|
|
64
|
+
// if (this.panel.countSales) {
|
|
65
|
+
// this.panel.increasedValue = this.panel.value > values.countSales
|
|
66
|
+
// this.valuesEqual = this.panel.value === values.countSales
|
|
67
|
+
// this.panel.message = `
|
|
68
|
+
// <div class="tooltip-chart-panel">
|
|
69
|
+
// <label>Comparado as data de:</label>
|
|
70
|
+
// <label>${
|
|
71
|
+
// moment(dateIni).format('DD-MM') + ' atΓ© ' + moment(dateFim).format('DD-MM')
|
|
72
|
+
// }</label>
|
|
73
|
+
// <label>Vendas: ${values.countSales}</label>
|
|
74
|
+
// </div>`
|
|
75
|
+
// }
|
|
76
|
+
|
|
77
|
+
// if (this.panel.countItems) {
|
|
78
|
+
// this.panel.increasedValue = this.panel.value > values.countItems
|
|
79
|
+
// this.valuesEqual = this.panel.value === values.countItems
|
|
80
|
+
// this.panel.message = `
|
|
81
|
+
// <div class="tooltip-chart-panel">
|
|
82
|
+
// <label>Comparado as data de:</label>
|
|
83
|
+
// <label>${
|
|
84
|
+
// moment(dateIni).format('DD-MM') + ' atΓ© ' + moment(dateFim).format('DD-MM')
|
|
85
|
+
// }</label>
|
|
86
|
+
// <label>Items: ${values.countItems}</label>
|
|
87
|
+
// </div>`
|
|
88
|
+
// }
|
|
89
|
+
|
|
90
|
+
// if (this.panel.avgSales) {
|
|
91
|
+
// this.panel.increasedValue = this.panel.value > values.avgSales
|
|
92
|
+
// this.valuesEqual = this.panel.value === values.avgSales
|
|
93
|
+
// this.panel.message = `
|
|
94
|
+
// <div class="tooltip-chart-panel">
|
|
95
|
+
// <label>Comparado as data de:</label>
|
|
96
|
+
// <label>${
|
|
97
|
+
// moment(dateIni).format('DD-MM') + ' atΓ© ' + moment(dateFim).format('DD-MM')
|
|
98
|
+
// }</label>
|
|
99
|
+
// <label>Valor: ${this.$filter('currency')(values.avgSales, 'R$ ')}</label>
|
|
100
|
+
// </div>`
|
|
101
|
+
// }
|
|
102
|
+
|
|
103
|
+
// if (this.panel.totalSales) {
|
|
104
|
+
// this.panel.increasedValue = this.panel.value > values.totalSales
|
|
105
|
+
// this.valuesEqual = this.panel.value === values.totalSales
|
|
106
|
+
|
|
107
|
+
// this.panel.message = `
|
|
108
|
+
// <div class="tooltip-chart-panel">
|
|
109
|
+
// <label>Comparado as data de:</label>
|
|
110
|
+
// <label>${
|
|
111
|
+
// moment(dateIni).format('DD-MM') + ' atΓ© ' + moment(dateFim).format('DD-MM')
|
|
112
|
+
// }</label>
|
|
113
|
+
// <label>Valor: ${this.$filter('currency')(values.totalSales, 'R$ ')}</label>
|
|
114
|
+
// </div>`
|
|
115
|
+
// }
|
|
116
|
+
// }, 1000)
|
|
117
|
+
// }
|
|
118
|
+
|
|
119
|
+
formatToBRL(value) {
|
|
120
|
+
return value.toLocaleString('pt-BR', {
|
|
121
|
+
style: 'currency',
|
|
122
|
+
currency: 'BRL',
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// getFilterDate() {
|
|
127
|
+
// this.activeFilter = this.activeFilter || { name: 'Hoje', key: 'TODAY' }
|
|
128
|
+
// switch (this.activeFilter.key) {
|
|
129
|
+
// case 'TODAY':
|
|
130
|
+
// return {
|
|
131
|
+
// dateIni: moment()
|
|
132
|
+
// .subtract(1, 'd')
|
|
133
|
+
// .set({ hours: 0, minutes: 0, seconds: 0 })
|
|
134
|
+
// .format('YYYY-MM-DD HH:mm:ss'),
|
|
135
|
+
// dateFim: moment()
|
|
136
|
+
// .subtract(1, 'd')
|
|
137
|
+
// .set({ hours: 23, minutes: 59, seconds: 59 })
|
|
138
|
+
// .format('YYYY-MM-DD HH:mm:ss'),
|
|
139
|
+
// }
|
|
140
|
+
// case 'YESTERDAY':
|
|
141
|
+
// return {
|
|
142
|
+
// dateIni: moment()
|
|
143
|
+
// .subtract(2, 'd')
|
|
144
|
+
// .set({ hours: 0, minutes: 0, seconds: 0 })
|
|
145
|
+
// .format('YYYY-MM-DD HH:mm:ss'),
|
|
146
|
+
// dateFim: moment()
|
|
147
|
+
// .subtract(2, 'd')
|
|
148
|
+
// .set({ hours: 23, minutes: 59, seconds: 59 })
|
|
149
|
+
// .format('YYYY-MM-DD HH:mm:ss'),
|
|
150
|
+
// }
|
|
151
|
+
// case 'THIS_WEEK':
|
|
152
|
+
// const startOfLastWeek = moment()
|
|
153
|
+
// .subtract(7, 'days')
|
|
154
|
+
// .startOf('week')
|
|
155
|
+
// .set({ hours: 0, minutes: 0, seconds: 0 })
|
|
156
|
+
// const lastWeekToday = moment()
|
|
157
|
+
// .subtract(7, 'days')
|
|
158
|
+
// .set({ hours: 23, minutes: 59, seconds: 59 })
|
|
159
|
+
|
|
160
|
+
// return {
|
|
161
|
+
// dateIni: startOfLastWeek.format('YYYY-MM-DD HH:mm:ss'),
|
|
162
|
+
// dateFim: lastWeekToday.format('YYYY-MM-DD HH:mm:ss'),
|
|
163
|
+
// }
|
|
164
|
+
|
|
165
|
+
// default:
|
|
166
|
+
// return {
|
|
167
|
+
// dateIni: moment()
|
|
168
|
+
// .subtract(1, 'month')
|
|
169
|
+
// .set({ date: 1, hours: 23, minutes: 59, seconds: 59 })
|
|
170
|
+
// .format('YYYY-MM-DD HH:mm:ss'),
|
|
171
|
+
// dateFim: moment()
|
|
172
|
+
// .subtract(1, 'month')
|
|
173
|
+
// .set({ date: moment().date(), hours: 0, minutes: 0, seconds: 0 })
|
|
174
|
+
// .format('YYYY-MM-DD HH:mm:ss'),
|
|
175
|
+
// }
|
|
176
|
+
// }
|
|
177
|
+
// }
|
|
178
|
+
|
|
35
179
|
syncValue() {
|
|
36
180
|
if (this.panel.sync) {
|
|
37
181
|
this.panel.loading = true
|
|
@@ -57,7 +201,14 @@ class MbgCardPanelController {
|
|
|
57
201
|
}
|
|
58
202
|
}
|
|
59
203
|
|
|
60
|
-
MbgCardPanelController['$inject'] = [
|
|
204
|
+
MbgCardPanelController['$inject'] = [
|
|
205
|
+
'$scope',
|
|
206
|
+
'$element',
|
|
207
|
+
'$attrs',
|
|
208
|
+
'$timeout',
|
|
209
|
+
// 'dashboardService',
|
|
210
|
+
'$filter',
|
|
211
|
+
]
|
|
61
212
|
|
|
62
213
|
const mbgCardPanel = {
|
|
63
214
|
transclude: true,
|
|
@@ -68,6 +219,7 @@ const mbgCardPanel = {
|
|
|
68
219
|
allowedToSee: '=?',
|
|
69
220
|
allowedCallBack: '&?',
|
|
70
221
|
allowDashboardMainSales: '=?',
|
|
222
|
+
activeFilter: '=?',
|
|
71
223
|
},
|
|
72
224
|
template,
|
|
73
225
|
controller: MbgCardPanelController,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
allow-dashboard-main-sales="$ctrl.allowDashboardMainSales"
|
|
6
6
|
display-values="$ctrl.displayValues"
|
|
7
7
|
allowed-to-see="$ctrl.allowedToSee"
|
|
8
|
+
active-filter="$ctrl.activeFilter"
|
|
8
9
|
allowed-call-back="$ctrl.allowedCallBack()"></mbg-chart-wrapper>
|
|
9
10
|
|
|
10
11
|
<div ng-show="!$ctrl.hasData()"
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
display-values="$ctrl.displayValues"
|
|
6
6
|
allow-dashboard-main-sales="$ctrl.allowDashboardMainSales"
|
|
7
7
|
allowed-to-see="$ctrl.allowedToSee"
|
|
8
|
+
active-filter="$ctrl.activeFilter"
|
|
8
9
|
allowed-call-back="$ctrl.allowedCallBack()"></mbg-chart-wrapper>
|
|
9
10
|
|
|
10
11
|
<div ng-show="!$ctrl.hasData()"
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
display-values="$ctrl.displayValues"
|
|
6
6
|
allow-dashboard-main-sales="$ctrl.allowDashboardMainSales"
|
|
7
7
|
allowed-to-see="$ctrl.allowedToSee"
|
|
8
|
+
active-filter="$ctrl.activeFilter"
|
|
8
9
|
allowed-call-back="$ctrl.allowedCallBack()"></mbg-chart-wrapper>
|
|
9
10
|
|
|
10
11
|
<div ng-show="!$ctrl.hasData()"
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
loading="$ctrl.loading"
|
|
53
53
|
allowed-to-see="$ctrl.allowedToSee"
|
|
54
54
|
allowed-call-back="$ctrl.allowedCallBack()"
|
|
55
|
+
active-filter="$ctrl.activeFilter"
|
|
55
56
|
ng-if="$ctrl.chart && $ctrl.chart.type == 'line'"></mbg-chart-line>
|
|
56
57
|
<mbg-chart-bar-line chart="$ctrl.chart"
|
|
57
58
|
panels="$ctrl.cards"
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
loading="$ctrl.loading"
|
|
61
62
|
allowed-to-see="$ctrl.allowedToSee"
|
|
62
63
|
allowed-call-back="$ctrl.allowedCallBack()"
|
|
64
|
+
active-filter="$ctrl.activeFilter"
|
|
63
65
|
ng-if="$ctrl.chart && $ctrl.chart.type == 'barline'"></mbg-chart-bar-line>
|
|
64
66
|
<mbg-chart-bar-line-pie chart="$ctrl.chart"
|
|
65
67
|
panels="$ctrl.cards"
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
loading="$ctrl.loading"
|
|
69
71
|
allowed-to-see="$ctrl.allowedToSee"
|
|
70
72
|
allowed-call-back="$ctrl.allowedCallBack()"
|
|
73
|
+
active-filter="$ctrl.activeFilter"
|
|
71
74
|
ng-if="$ctrl.chart && $ctrl.chart.type == 'barlinepie'"></mbg-chart-bar-line-pie>
|
|
72
75
|
<div class="display-values">
|
|
73
76
|
<a ng-show="!$ctrl.displayValues"
|
|
@@ -22,6 +22,7 @@ class MbgHomescreenController {
|
|
|
22
22
|
isCurrency: boolean
|
|
23
23
|
}[]
|
|
24
24
|
private allowDashboardMainSales
|
|
25
|
+
private filterActive
|
|
25
26
|
|
|
26
27
|
constructor(public $scope, public $element, public $attrs, public $timeout) {}
|
|
27
28
|
|
|
@@ -63,6 +64,7 @@ class MbgHomescreenController {
|
|
|
63
64
|
return tab
|
|
64
65
|
})
|
|
65
66
|
this.activeFilter = item
|
|
67
|
+
this.filterActive = this.activeFilter
|
|
66
68
|
item.active = true
|
|
67
69
|
if (this.tabs[this.activeIndex].executeFilter) {
|
|
68
70
|
this.tabs[this.activeIndex].executeFilter(this.config)
|
|
@@ -78,6 +80,7 @@ class MbgHomescreenController {
|
|
|
78
80
|
this.tabs.forEach((tab, index) => (this.tabs[index].active = false))
|
|
79
81
|
this.tabs[tabIndex].active = true
|
|
80
82
|
this.activeFilter = (this.tabs[tabIndex].filters || []).find((filter) => filter.active)
|
|
83
|
+
this.filterActive = this.activeFilter
|
|
81
84
|
this.cards = this.tabs[tabIndex].cards
|
|
82
85
|
this.chart = this.tabs[tabIndex].chart
|
|
83
86
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<div ng-class="{'opacity-dash-goal': !$ctrl.isPermissionStoreGoal}">
|
|
2
|
+
<div class="description-container-dash">
|
|
3
|
+
<p class="description-dash">Meta do mΓͺs / {{$ctrl.currentMonthName}}</p>
|
|
4
|
+
<div class="mbg-h-c-tone-s-icon-dash"
|
|
5
|
+
ng-click="$ctrl.toggleShowValueStoreGoal(false)">
|
|
6
|
+
<i class="fa fa-lock lock-dash-store"
|
|
7
|
+
aria-hidden="true"
|
|
8
|
+
uib-tooltip="Sem permissΓ£o para visualizar"
|
|
9
|
+
tooltip-placement="left"
|
|
10
|
+
ng-if="!$ctrl.isPermissionStoreGoal"></i>
|
|
11
|
+
<i ng-if="$ctrl.hideValue && $ctrl.isPermissionStoreGoal"
|
|
12
|
+
disable-animate
|
|
13
|
+
class="far fa-eye eye-board"></i>
|
|
14
|
+
<i ng-if="!$ctrl.hideValue && $ctrl.isPermissionStoreGoal"
|
|
15
|
+
disable-animate
|
|
16
|
+
class="far fa-eye-slash eye-board"></i>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="goal-day">
|
|
20
|
+
<p class="estimate-goal"
|
|
21
|
+
ng-if="!$ctrl.hideValue">Estimativa da meta: <i class="fa fa-lock"
|
|
22
|
+
aria-hidden="true"
|
|
23
|
+
uib-tooltip="Sem permissΓ£o para visualizar"></i>
|
|
24
|
+
</p>
|
|
25
|
+
<p class="estimate-goal"
|
|
26
|
+
ng-if="$ctrl.hideValue">Estimativa da meta: <strong>{{$ctrl.estimatedGoal }}</strong></p>
|
|
27
|
+
|
|
28
|
+
<span class="link-store"
|
|
29
|
+
ng-if="$ctrl.estimatedPercentageGreaterThanTarget && $ctrl.hideValue"
|
|
30
|
+
uib-tooltip="Alerta: Com o desempenho atual, vocΓͺ nΓ£o alcanΓ§arΓ‘ a meta."
|
|
31
|
+
tooltip-placement="left">
|
|
32
|
+
<i class="fa fa-exclamation-circle"
|
|
33
|
+
aria-hidden="true"></i></span>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="dashboard-wrapper">
|
|
37
|
+
<div class="chart-container"
|
|
38
|
+
id="container-speed"></div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
.dashboard-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
height: 100%;
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.chart-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
width: 300px;
|
|
14
|
+
height: auto;
|
|
15
|
+
position: relative;
|
|
16
|
+
left: 2%;
|
|
17
|
+
bottom: 220px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.opacity-dash-goal{
|
|
21
|
+
opacity: 0.5;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
.tooltip-inner {
|
|
26
|
+
background:#ff8c00 !important;
|
|
27
|
+
color: #000000 !important;
|
|
28
|
+
width: 300px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes blink {
|
|
32
|
+
0% {
|
|
33
|
+
opacity: 1;
|
|
34
|
+
}
|
|
35
|
+
50% {
|
|
36
|
+
opacity: 0;
|
|
37
|
+
}
|
|
38
|
+
100% {
|
|
39
|
+
opacity: 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.estimate-goal{
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
color: #5f5b5b;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.link-store{
|
|
49
|
+
animation: blink 1s infinite;
|
|
50
|
+
color: #ff8c00;
|
|
51
|
+
position: relative;
|
|
52
|
+
font-size: 18px;
|
|
53
|
+
bottom: 14px;
|
|
54
|
+
right: -18px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.goal-day {
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: space-between;
|
|
60
|
+
align-items: end;
|
|
61
|
+
position: relative;
|
|
62
|
+
top: 200px;
|
|
63
|
+
font-size: 16px;
|
|
64
|
+
color: #5f5b5b;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
.description-container-dash {
|
|
70
|
+
flex-grow: 1;
|
|
71
|
+
color: var(--titleColor);
|
|
72
|
+
display: flex;
|
|
73
|
+
justify-content: space-between;
|
|
74
|
+
width: 100%;
|
|
75
|
+
margin-top: 16px;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
|
|
79
|
+
.mbg-h-c-tone-s-icon-dash {
|
|
80
|
+
margin-top: -10px;
|
|
81
|
+
transition: opacity 500ms ease;
|
|
82
|
+
opacity: 0.9;
|
|
83
|
+
|
|
84
|
+
.eye-board {
|
|
85
|
+
position: relative;
|
|
86
|
+
right: -16px;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.lock-dash-store{
|
|
91
|
+
position: relative;
|
|
92
|
+
right: -16px;
|
|
93
|
+
// color: red;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.description-dash {
|
|
98
|
+
font-size: 20px;
|
|
99
|
+
color: #5f5b5b;
|
|
100
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import './mbg-store-goal.scss'
|
|
2
|
+
import template from './mbg-store-goal.html'
|
|
3
|
+
import * as Highcharts from 'highcharts'
|
|
4
|
+
import * as HighchartsMore from 'highcharts/highcharts-more.js'
|
|
5
|
+
import * as SolidGauge from 'highcharts/modules/solid-gauge.js'
|
|
6
|
+
import * as Exporting from 'highcharts/modules/exporting.js'
|
|
7
|
+
import * as ExportData from 'highcharts/modules/export-data.js'
|
|
8
|
+
import * as Accessibility from 'highcharts/modules/accessibility.js'
|
|
9
|
+
|
|
10
|
+
// Inicialize os mΓ³dulos
|
|
11
|
+
HighchartsMore(Highcharts)
|
|
12
|
+
SolidGauge(Highcharts)
|
|
13
|
+
Exporting(Highcharts)
|
|
14
|
+
ExportData(Highcharts)
|
|
15
|
+
Accessibility(Highcharts)
|
|
16
|
+
|
|
17
|
+
class MbgStoreGoalController {
|
|
18
|
+
private status: string
|
|
19
|
+
private cappedPercentage
|
|
20
|
+
private percentageAchieved
|
|
21
|
+
private allowedToSee: boolean
|
|
22
|
+
private allowedCallBack: Function
|
|
23
|
+
private randomEmoji: string
|
|
24
|
+
private hideValue: boolean = false
|
|
25
|
+
private allowDashBoardAutoValues
|
|
26
|
+
private isPermissionStoreGoal
|
|
27
|
+
private estimatedGoal
|
|
28
|
+
private storeGoalDashboard
|
|
29
|
+
private currentMonthName
|
|
30
|
+
private percentageEstimatedStoreGoal
|
|
31
|
+
private estimatedPercentageGreaterThanTarget: boolean = false
|
|
32
|
+
|
|
33
|
+
constructor(public $scope, public $element, public $attrs, public $timeout, public $filter) {}
|
|
34
|
+
|
|
35
|
+
async $onInit() {
|
|
36
|
+
this.initialize()
|
|
37
|
+
this.randomEmoji = this.generateRandomEmoji()
|
|
38
|
+
this.$scope.$watch(
|
|
39
|
+
'$ctrl.storeGoalDashboard',
|
|
40
|
+
(data) => {
|
|
41
|
+
if (data) {
|
|
42
|
+
this.configSolidGauge()
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
true,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
const currentDate = new Date()
|
|
49
|
+
const currentMonth = currentDate.toLocaleString('default', { month: 'short' })
|
|
50
|
+
this.currentMonthName = currentMonth.charAt(0).toUpperCase() + currentMonth.slice(1)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async configSolidGauge() {
|
|
54
|
+
const storeGoalPercentage = this.hideValue ? this.storeGoalDashboard : 0
|
|
55
|
+
const porcentageEstimated = Number(this.percentageEstimatedStoreGoal.projectionFinal)
|
|
56
|
+
const goal = this.percentageEstimatedStoreGoal.target
|
|
57
|
+
|
|
58
|
+
this.estimatedGoal = this.$filter('currency')(isNaN(goal) ? 0 : porcentageEstimated, 'R$ ')
|
|
59
|
+
|
|
60
|
+
if (porcentageEstimated < goal) {
|
|
61
|
+
this.estimatedPercentageGreaterThanTarget = true
|
|
62
|
+
} else {
|
|
63
|
+
this.estimatedPercentageGreaterThanTarget = true
|
|
64
|
+
}
|
|
65
|
+
const titleGoal = this.hideValue
|
|
66
|
+
? `Meta: ${this.$filter('currency')(isNaN(goal) ? 0 : goal, 'R$ ')}`
|
|
67
|
+
: ''
|
|
68
|
+
|
|
69
|
+
const gaugeOptions = this.gaugeOptions()
|
|
70
|
+
|
|
71
|
+
const chartSpeed = Highcharts.chart(
|
|
72
|
+
'container-speed',
|
|
73
|
+
Highcharts.merge(gaugeOptions, {
|
|
74
|
+
yAxis: {
|
|
75
|
+
min: 0,
|
|
76
|
+
max: 100,
|
|
77
|
+
title: {
|
|
78
|
+
text: titleGoal,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
credits: {
|
|
83
|
+
enabled: false,
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
series: [
|
|
87
|
+
{
|
|
88
|
+
name: 'Speed',
|
|
89
|
+
data: [storeGoalPercentage],
|
|
90
|
+
dataLabels: {
|
|
91
|
+
format: this.hideValue
|
|
92
|
+
? '<div style="display: flex;justify-content: center;align-items: center;margin-top: -20px;">' +
|
|
93
|
+
'<span style="font-size:25px">{y}</span><br/>' +
|
|
94
|
+
'<span style="font-size:12px;opacity:0.4">%</span>' +
|
|
95
|
+
'</div>'
|
|
96
|
+
: '<div style="margin-top: -20px;">' +
|
|
97
|
+
'<span style="font-size:25px"><i class="fa fa-lock"</i></span>' +
|
|
98
|
+
'</div>',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
}),
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
this.updateChart(storeGoalPercentage, chartSpeed)
|
|
106
|
+
}
|
|
107
|
+
updateChart(totalPercentage, chartSpeed) {
|
|
108
|
+
const point = chartSpeed.series[0].points[0]
|
|
109
|
+
point.update(totalPercentage)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
gaugeOptions() {
|
|
113
|
+
return {
|
|
114
|
+
chart: {
|
|
115
|
+
type: 'solidgauge',
|
|
116
|
+
backgroundColor: 'none',
|
|
117
|
+
plotBorderWidth: 0,
|
|
118
|
+
margin: [0, 0, 0, 0],
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
title: null,
|
|
122
|
+
pane: {
|
|
123
|
+
center: ['50%', '90%'],
|
|
124
|
+
size: '100%',
|
|
125
|
+
startAngle: -90,
|
|
126
|
+
endAngle: 90,
|
|
127
|
+
background: {
|
|
128
|
+
backgroundColor: 'none',
|
|
129
|
+
borderRadius: 5,
|
|
130
|
+
innerRadius: '60%',
|
|
131
|
+
outerRadius: '100%',
|
|
132
|
+
shape: 'arc',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
exporting: {
|
|
137
|
+
enabled: false,
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
tooltip: {
|
|
141
|
+
enabled: false,
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
// the value axis
|
|
145
|
+
yAxis: {
|
|
146
|
+
stops: [
|
|
147
|
+
[0.1, '#DF5353'], // Vermelho para atΓ© 10% da meta
|
|
148
|
+
[0.5, '#DDDF0D'], // Amarelo entre 10% e 50%
|
|
149
|
+
[0.9, '#55BF3B'], // Verde para mais de 50%
|
|
150
|
+
],
|
|
151
|
+
lineWidth: 0,
|
|
152
|
+
tickWidth: 0,
|
|
153
|
+
minorTickInterval: null,
|
|
154
|
+
tickAmount: 2,
|
|
155
|
+
title: {
|
|
156
|
+
y: -80,
|
|
157
|
+
},
|
|
158
|
+
labels: {
|
|
159
|
+
y: 16,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
plotOptions: {
|
|
164
|
+
solidgauge: {
|
|
165
|
+
borderRadius: 3,
|
|
166
|
+
dataLabels: {
|
|
167
|
+
y: 5,
|
|
168
|
+
borderWidth: 0,
|
|
169
|
+
useHTML: true,
|
|
170
|
+
style: {
|
|
171
|
+
textAlign: 'center',
|
|
172
|
+
width: '120px',
|
|
173
|
+
whiteSpace: 'nowrap',
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
initialize() {
|
|
182
|
+
if (this.allowDashBoardAutoValues) {
|
|
183
|
+
this.hideValue = this.isPermissionStoreGoal ? true : false
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (this.allowedToSee && !this.allowDashBoardAutoValues) {
|
|
188
|
+
this.hideValue = this.allowDashBoardAutoValues && this.isPermissionStoreGoal ? true : false
|
|
189
|
+
return
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
this.hideValue = this.allowedToSee && this.isPermissionStoreGoal ? true : false
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
generateRandomEmoji = () => {
|
|
196
|
+
const emojis = ['πππ']
|
|
197
|
+
return emojis[0]
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
toggleShowValueStoreGoal() {
|
|
201
|
+
if ((this.allowedToSee !== undefined && !this.allowedToSee) || !this.isPermissionStoreGoal) {
|
|
202
|
+
if (this.allowedCallBack) {
|
|
203
|
+
this.allowedCallBack()
|
|
204
|
+
}
|
|
205
|
+
return
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
this.hideValue = !this.hideValue
|
|
209
|
+
this.randomEmoji = this.generateRandomEmoji()
|
|
210
|
+
this.configSolidGauge()
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
MbgStoreGoalController['$inject'] = ['$scope', '$element', '$attrs', '$timeout', '$filter']
|
|
214
|
+
|
|
215
|
+
const mbgStoreGoal = {
|
|
216
|
+
bindings: {
|
|
217
|
+
allowedToSee: '=?',
|
|
218
|
+
allowedCallBack: '&?',
|
|
219
|
+
storeGoalDashboard: '=?',
|
|
220
|
+
percentageEstimatedStoreGoal: '=?',
|
|
221
|
+
isPermissionStoreGoal: '=?',
|
|
222
|
+
allowDashBoardAutoValues: '=?',
|
|
223
|
+
},
|
|
224
|
+
template,
|
|
225
|
+
controller: MbgStoreGoalController,
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export { mbgStoreGoal }
|
package/src/index.html
CHANGED
|
@@ -159,12 +159,14 @@
|
|
|
159
159
|
<!-- <div style="padding: 100px;">
|
|
160
160
|
<div class="row">
|
|
161
161
|
<div class="col-md-12"> -->
|
|
162
|
-
|
|
162
|
+
<div class=""
|
|
163
163
|
style="height: 260px">
|
|
164
|
-
<mbg-
|
|
164
|
+
<mbg-store-goal></mbg-store-goal>
|
|
165
|
+
|
|
166
|
+
<!-- <mbg-text-editor ng-model="editorJodit"
|
|
165
167
|
ng-if="testeeditorif"
|
|
166
|
-
ng-change="changeEditorTeste(value)"></mbg-text-editor>
|
|
167
|
-
</div>
|
|
168
|
+
ng-change="changeEditorTeste(value)"></mbg-text-editor> -->
|
|
169
|
+
</div>
|
|
168
170
|
<!-- <mbg-address ng-model="address"></mbg-address>
|
|
169
171
|
<pre>{{ address | json }}</pre>
|
|
170
172
|
</div>
|