@kigi/components 1.37.0 β 1.38.0-beta.2
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 +4 -2
- 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.scss +5 -1
- package/src/components/mbg-homescreen/cards/panel/panel.ts +8 -0
- 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 +65 -0
- package/src/components/mbg-store-goal/mbg-store-goal.scss +156 -0
- package/src/components/mbg-store-goal/mbg-store-goal.ts +259 -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.38.0-beta.2",
|
|
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
|
@@ -76,7 +76,6 @@ import { mbgSelectMultiListModule } from './mbg-select-multi-list'
|
|
|
76
76
|
import { mbgProductInlineModule } from './mbg-product-inline'
|
|
77
77
|
import { NgCountCharacter } from '../helpers/count-character/count-character'
|
|
78
78
|
import { mbgPopupSelectModule } from './mbg-popup-select'
|
|
79
|
-
import { mbgStatusLabelModule } from './mbg-status-label'
|
|
80
79
|
import { mbgDynamicCubeModule } from './mbg-dynamic-cube'
|
|
81
80
|
import { mbgTimelineModule } from './mbg-timeline'
|
|
82
81
|
import { MbgActiveScroll } from '../helpers/mbg-active-scroll/mbg-active-scroll'
|
|
@@ -86,6 +85,8 @@ import 'jodit/src/langs/pt_br.js'
|
|
|
86
85
|
import { NgMaskIe } from '../helpers/ie-directive/ie-directive'
|
|
87
86
|
import { mbgAceEditorModule } from './mbg-ace-editor'
|
|
88
87
|
import { mbgImageUploadCropModule } from './mbg-image-upload-crop'
|
|
88
|
+
import { mbgStoreGoalModule } from './mbg-store-goal'
|
|
89
|
+
import { mbgStatusLabelModule } from './mbg-status-label'
|
|
89
90
|
|
|
90
91
|
if (!window['$']) {
|
|
91
92
|
window['$'] = $
|
|
@@ -147,12 +148,13 @@ const mbgComponentsModule = angular
|
|
|
147
148
|
mbgProductInlineModule,
|
|
148
149
|
// mbgEditorModule,
|
|
149
150
|
mbgPopupSelectModule,
|
|
150
|
-
mbgStatusLabelModule,
|
|
151
151
|
mbgDynamicCubeModule,
|
|
152
152
|
mbgTimelineModule,
|
|
153
153
|
mbgRepasseModule,
|
|
154
154
|
mbgTextEditorModule,
|
|
155
155
|
mbgAceEditorModule,
|
|
156
|
+
mbgStoreGoalModule,
|
|
157
|
+
mbgStatusLabelModule,
|
|
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
|
panel-values-filter="$ctrl.panelValuesFilter"
|
|
11
12
|
allowed-call-back="$ctrl.allowedCallBack()"
|
|
12
13
|
panel="panel">
|
|
@@ -9,6 +9,8 @@ mbg-card-panel {
|
|
|
9
9
|
width: 100%;
|
|
10
10
|
height: 100%;
|
|
11
11
|
margin-right: 200px;
|
|
12
|
+
border-radius: 10px;
|
|
13
|
+
opacity: 1.0;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
.tooltip-inner {
|
|
@@ -16,7 +18,9 @@ mbg-card-panel {
|
|
|
16
18
|
margin-right: 180px;
|
|
17
19
|
}
|
|
18
20
|
.mbg-h-c-panel {
|
|
19
|
-
border: 1px solid #
|
|
21
|
+
border: 1px solid #f8f8f1;
|
|
22
|
+
border-radius: 12px;
|
|
23
|
+
padding: 8px;
|
|
20
24
|
border-radius: 12px;
|
|
21
25
|
padding: 8px;
|
|
22
26
|
|
|
@@ -102,6 +102,13 @@ class MbgCardPanelController {
|
|
|
102
102
|
}, 1000)
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
formatToBRL(value) {
|
|
106
|
+
return value.toLocaleString('pt-BR', {
|
|
107
|
+
style: 'currency',
|
|
108
|
+
currency: 'BRL',
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
105
112
|
syncValue() {
|
|
106
113
|
if (this.panel.sync) {
|
|
107
114
|
this.panel.loading = true
|
|
@@ -138,6 +145,7 @@ const mbgCardPanel = {
|
|
|
138
145
|
allowedToSee: '=?',
|
|
139
146
|
allowedCallBack: '&?',
|
|
140
147
|
allowDashboardMainSales: '=?',
|
|
148
|
+
activeFilter: '=?',
|
|
141
149
|
panelValuesFilter: '=?',
|
|
142
150
|
},
|
|
143
151
|
template,
|
|
@@ -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
|
panel-values-filter="$ctrl.panelValuesFilter"
|
|
9
10
|
allowed-call-back="$ctrl.allowedCallBack()"></mbg-chart-wrapper>
|
|
10
11
|
|
|
@@ -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
|
panel-values-filter="$ctrl.panelValuesFilter"
|
|
9
10
|
allowed-call-back="$ctrl.allowedCallBack()"></mbg-chart-wrapper>
|
|
10
11
|
|
|
@@ -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
|
panel-values-filter="$ctrl.panelValuesFilter"
|
|
9
10
|
allowed-call-back="$ctrl.allowedCallBack()"></mbg-chart-wrapper>
|
|
10
11
|
|
|
@@ -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
|
panel-values-filter="$ctrl.panelValuesFilter"
|
|
56
57
|
ng-if="$ctrl.chart && $ctrl.chart.type == 'line'"></mbg-chart-line>
|
|
57
58
|
<mbg-chart-bar-line chart="$ctrl.chart"
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
loading="$ctrl.loading"
|
|
62
63
|
allowed-to-see="$ctrl.allowedToSee"
|
|
63
64
|
allowed-call-back="$ctrl.allowedCallBack()"
|
|
65
|
+
active-filter="$ctrl.activeFilter"
|
|
64
66
|
panel-values-filter="$ctrl.panelValuesFilter"
|
|
65
67
|
ng-if="$ctrl.chart && $ctrl.chart.type == 'barline'"></mbg-chart-bar-line>
|
|
66
68
|
<mbg-chart-bar-line-pie chart="$ctrl.chart"
|
|
@@ -70,6 +72,7 @@
|
|
|
70
72
|
loading="$ctrl.loading"
|
|
71
73
|
allowed-to-see="$ctrl.allowedToSee"
|
|
72
74
|
allowed-call-back="$ctrl.allowedCallBack()"
|
|
75
|
+
active-filter="$ctrl.activeFilter"
|
|
73
76
|
panel-values-filter="$ctrl.panelValuesFilter"
|
|
74
77
|
ng-if="$ctrl.chart && $ctrl.chart.type == 'barlinepie'"></mbg-chart-bar-line-pie>
|
|
75
78
|
<div class="display-values">
|
|
@@ -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,65 @@
|
|
|
1
|
+
<div ng-class="{'opacity-dash-goal': !$ctrl.isPermissionStoreGoal}"
|
|
2
|
+
class="store-goal-wrapper"
|
|
3
|
+
ng-show="$ctrl.showDashboard">
|
|
4
|
+
<div class="description-container-dash">
|
|
5
|
+
<p class="description-dash">
|
|
6
|
+
<i class="fa fa-exclamation-circle"
|
|
7
|
+
uib-tooltip="{{$ctrl.percentageEstimated}}"
|
|
8
|
+
tooltip-placement="top"
|
|
9
|
+
class="link-store"
|
|
10
|
+
ng-if="$ctrl.estimatedPercentageGreaterThanTarget"
|
|
11
|
+
aria-hidden="true"></i>
|
|
12
|
+
Meta do mΓͺs / {{$ctrl.currentMonthName}}
|
|
13
|
+
</p>
|
|
14
|
+
<div class="mbg-h-c-tone-s-icon-dash"
|
|
15
|
+
ng-click="$ctrl.toggleShowValueStoreGoal(false)">
|
|
16
|
+
<i class="fa fa-lock lock-dash-store"
|
|
17
|
+
aria-hidden="true"
|
|
18
|
+
uib-tooltip="Sem permissΓ£o para visualizar"
|
|
19
|
+
tooltip-placement="left"
|
|
20
|
+
ng-if="!$ctrl.isPermissionStoreGoal"></i>
|
|
21
|
+
<i ng-if="$ctrl.hideValue && $ctrl.isPermissionStoreGoal"
|
|
22
|
+
disable-animate
|
|
23
|
+
class="far fa-eye eye-board-target"></i>
|
|
24
|
+
<i ng-if="!$ctrl.hideValue && $ctrl.isPermissionStoreGoal"
|
|
25
|
+
disable-animate
|
|
26
|
+
class="far fa-eye-slash eye-board-target"></i>
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="line-pay"></div>
|
|
31
|
+
<div class="goal-target">
|
|
32
|
+
<p ng-if="$ctrl.hideValue">Meta: <strong>{{$ctrl.goalStoreTarget }}</strong></p>
|
|
33
|
+
<p ng-if="!$ctrl.hideValue">Meta: <i class="fa fa-lock"
|
|
34
|
+
aria-hidden="true"
|
|
35
|
+
uib-tooltip="Sem permissΓ£o para visualizar"></i></p>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="goal-day">
|
|
38
|
+
<p class="estimate-goal"
|
|
39
|
+
ng-if="!$ctrl.hideValue">Estimativa da meta: <i class="fa fa-lock"
|
|
40
|
+
aria-hidden="true"
|
|
41
|
+
uib-tooltip="Sem permissΓ£o para visualizar"></i>
|
|
42
|
+
</p>
|
|
43
|
+
<p class="estimate-goal-store"
|
|
44
|
+
ng-if="$ctrl.hideValue">Estimativa da meta: <strong>{{$ctrl.estimatedGoal }}</strong>
|
|
45
|
+
|
|
46
|
+
<i class="fa fa-exclamation-circle"
|
|
47
|
+
ng-if="$ctrl.hideValue"
|
|
48
|
+
tooltip-placement="right"
|
|
49
|
+
class="estimated"
|
|
50
|
+
uib-tooltip-html="$ctrl.messageTooltip"
|
|
51
|
+
aria-hidden="true"></i>
|
|
52
|
+
</p>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div class="dashboard-wrapper">
|
|
56
|
+
<div class="chart-container"
|
|
57
|
+
id="container-speed"></div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div ng-show="!$ctrl.showDashboard"
|
|
62
|
+
class="hide-goal">
|
|
63
|
+
<label for="">Sem meta cadastrada. Defina sua meta hoje. <a class="state-goal"
|
|
64
|
+
ng-click="$ctrl.stateGoNewGoal()">Clique aqui</a> </label>
|
|
65
|
+
</div>
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
.store-goal-wrapper{
|
|
2
|
+
.dashboard-wrapper {
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
align-items: center;
|
|
6
|
+
height: 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.chart-container {
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
width: 300px;
|
|
15
|
+
height: auto;
|
|
16
|
+
position: relative;
|
|
17
|
+
left: 2%;
|
|
18
|
+
bottom: 252px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.opacity-dash-goal{
|
|
22
|
+
opacity: 0.5;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.goal-target{
|
|
26
|
+
position: relative;
|
|
27
|
+
top: 192px;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
color: #5f5b5b;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
.estimate-goal{
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
color: #5f5b5b;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.estimate-goal-store{
|
|
43
|
+
font-size: 14px;
|
|
44
|
+
color: #5f5b5b;
|
|
45
|
+
i{
|
|
46
|
+
color: #0EBCBD;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.tooltip-inner {
|
|
50
|
+
background: transparent ;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
.tooltip-chart-panel {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
position: relative;
|
|
58
|
+
background:#0EBCBD !important;
|
|
59
|
+
font-weight: bold;
|
|
60
|
+
color: #FFFFFF;
|
|
61
|
+
width: 100%;
|
|
62
|
+
height: 100%;
|
|
63
|
+
margin-right: 200px;
|
|
64
|
+
border-radius: 10px;
|
|
65
|
+
opacity: 1.0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
.goal-day {
|
|
76
|
+
display: flex;
|
|
77
|
+
justify-content: space-between;
|
|
78
|
+
align-items: end;
|
|
79
|
+
position: relative;
|
|
80
|
+
top: 184px;
|
|
81
|
+
font-size: 16px;
|
|
82
|
+
color: #5f5b5b;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
.description-container-dash {
|
|
88
|
+
flex-grow: 1;
|
|
89
|
+
color: var(--titleColor);
|
|
90
|
+
display: flex;
|
|
91
|
+
justify-content: space-between;
|
|
92
|
+
width: 100%;
|
|
93
|
+
margin-top: 16px;
|
|
94
|
+
font-weight: 600;
|
|
95
|
+
font-size: 14px;
|
|
96
|
+
|
|
97
|
+
.mbg-h-c-tone-s-icon-dash {
|
|
98
|
+
margin-top: -10px;
|
|
99
|
+
transition: opacity 500ms ease;
|
|
100
|
+
opacity: 0.9;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.lock-dash-store{
|
|
104
|
+
position: relative;
|
|
105
|
+
right: -20px;
|
|
106
|
+
top: -10px;
|
|
107
|
+
// color: red;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@keyframes blink {
|
|
112
|
+
0% {
|
|
113
|
+
opacity: 1;
|
|
114
|
+
}
|
|
115
|
+
50% {
|
|
116
|
+
opacity: 0;
|
|
117
|
+
}
|
|
118
|
+
100% {
|
|
119
|
+
opacity: 1;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.description-dash {
|
|
124
|
+
font-size: 20px;
|
|
125
|
+
color: #5f5b5b;
|
|
126
|
+
position: relative;
|
|
127
|
+
left: -24px;
|
|
128
|
+
|
|
129
|
+
i{
|
|
130
|
+
animation: blink 1s infinite;
|
|
131
|
+
color: #ff8c00;
|
|
132
|
+
position: relative;
|
|
133
|
+
top: -12px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.tooltip-inner {
|
|
137
|
+
background:#ff8c00 !important;
|
|
138
|
+
color: #000000 !important;
|
|
139
|
+
width: 300px;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
.hide-goal{
|
|
145
|
+
display: flex;
|
|
146
|
+
justify-content: center;
|
|
147
|
+
align-items: center;
|
|
148
|
+
width: 100%;
|
|
149
|
+
height: 100%;
|
|
150
|
+
font-size: 14px;
|
|
151
|
+
color: #5f5b5b;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.state-goal{
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
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
|
+
private goalStoreTarget
|
|
33
|
+
private messageTooltip: string = ''
|
|
34
|
+
private percentageEstimated
|
|
35
|
+
private showDashboard: boolean = false
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
public $scope,
|
|
39
|
+
public $element,
|
|
40
|
+
public $attrs,
|
|
41
|
+
public $timeout,
|
|
42
|
+
public $filter,
|
|
43
|
+
public $state,
|
|
44
|
+
) {}
|
|
45
|
+
|
|
46
|
+
async $onInit() {
|
|
47
|
+
this.initialize()
|
|
48
|
+
this.randomEmoji = this.generateRandomEmoji()
|
|
49
|
+
this.$scope.$watch(
|
|
50
|
+
'$ctrl.storeGoalDashboard',
|
|
51
|
+
(data) => {
|
|
52
|
+
if (data) {
|
|
53
|
+
this.configSolidGauge()
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
true,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
const currentDate = new Date()
|
|
60
|
+
const currentMonth = currentDate.toLocaleString('default', { month: 'short' })
|
|
61
|
+
this.currentMonthName = currentMonth.charAt(0).toUpperCase() + currentMonth.slice(1)
|
|
62
|
+
this.message()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
message() {
|
|
66
|
+
this.messageTooltip = `
|
|
67
|
+
<div class="tooltip-chart-panel">
|
|
68
|
+
<label>MΓ©dia DiΓ‘ria: (Valor V. / Dia A.) </label><br>
|
|
69
|
+
<label>ProjeΓ§Γ£o final: (MΓ©dia DiΓ‘ria * Dias passados do mΓͺs) </label><br>
|
|
70
|
+
<label>Estimativa: (ProjeΓ§Γ£o final / Meta do mΓͺs) * 100</label>
|
|
71
|
+
</div>`
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async configSolidGauge() {
|
|
75
|
+
const storeGoalPercentage = this.hideValue ? this.storeGoalDashboard : 0
|
|
76
|
+
const porcentageEstimated = Number(this.percentageEstimatedStoreGoal.projectionFinal)
|
|
77
|
+
this.showDashboard = this.storeGoalDashboard
|
|
78
|
+
const percentageTarget = this.percentageEstimatedStoreGoal.percentageTarget.toFixed(2)
|
|
79
|
+
const showPercentage = this.hideValue ? `${percentageTarget}%` : '****'
|
|
80
|
+
this.percentageEstimated = `Alerta: VocΓͺ atingirΓ‘ aproximadamente ${showPercentage} da sua meta se continuar no ritmo atual.`
|
|
81
|
+
const goal = this.percentageEstimatedStoreGoal.target
|
|
82
|
+
|
|
83
|
+
this.goalStoreTarget = this.$filter('currency')(isNaN(goal) ? 0 : goal, 'R$ ')
|
|
84
|
+
this.estimatedGoal = this.$filter('currency')(isNaN(goal) ? 0 : porcentageEstimated, 'R$ ')
|
|
85
|
+
|
|
86
|
+
if (porcentageEstimated < goal) {
|
|
87
|
+
this.estimatedPercentageGreaterThanTarget = true
|
|
88
|
+
} else {
|
|
89
|
+
this.estimatedPercentageGreaterThanTarget = false
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const gaugeOptions = this.gaugeOptions()
|
|
93
|
+
|
|
94
|
+
const chartSpeed = Highcharts.chart(
|
|
95
|
+
'container-speed',
|
|
96
|
+
Highcharts.merge(gaugeOptions, {
|
|
97
|
+
yAxis: {
|
|
98
|
+
min: 0,
|
|
99
|
+
max: 100,
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
credits: {
|
|
103
|
+
enabled: false,
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
series: [
|
|
107
|
+
{
|
|
108
|
+
name: 'Speed',
|
|
109
|
+
data: [storeGoalPercentage],
|
|
110
|
+
dataLabels: {
|
|
111
|
+
format: this.hideValue
|
|
112
|
+
? '<div style="display: flex;justify-content: center;align-items: center;margin-top: -20px;">' +
|
|
113
|
+
'<span style="font-size:25px">{y}</span><br/>' +
|
|
114
|
+
'<span style="font-size:12px;opacity:0.4">%</span>' +
|
|
115
|
+
'</div>'
|
|
116
|
+
: '<div style="margin-top: -20px;">' +
|
|
117
|
+
'<span style="font-size:25px"><i class="fa fa-lock"</i></span>' +
|
|
118
|
+
'</div>',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
}),
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
this.updateChart(storeGoalPercentage, chartSpeed)
|
|
126
|
+
}
|
|
127
|
+
updateChart(totalPercentage, chartSpeed) {
|
|
128
|
+
const point = chartSpeed.series[0].points[0]
|
|
129
|
+
point.update(totalPercentage)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
gaugeOptions() {
|
|
133
|
+
return {
|
|
134
|
+
chart: {
|
|
135
|
+
type: 'solidgauge',
|
|
136
|
+
backgroundColor: 'none',
|
|
137
|
+
// plotBorderWidth: 0,
|
|
138
|
+
// margin: [0, 0, 0, 0],
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
title: null,
|
|
142
|
+
pane: {
|
|
143
|
+
center: ['50%', '90%'],
|
|
144
|
+
size: '100%',
|
|
145
|
+
startAngle: -90,
|
|
146
|
+
endAngle: 90,
|
|
147
|
+
background: {
|
|
148
|
+
backgroundColor: 'none',
|
|
149
|
+
borderRadius: 5,
|
|
150
|
+
innerRadius: '60%',
|
|
151
|
+
outerRadius: '100%',
|
|
152
|
+
shape: 'arc',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
exporting: {
|
|
157
|
+
enabled: false,
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
tooltip: {
|
|
161
|
+
enabled: false,
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
// the value axis
|
|
165
|
+
yAxis: {
|
|
166
|
+
stops: [
|
|
167
|
+
[0.1, '#DF5353'], // Vermelho para atΓ© 10% da meta
|
|
168
|
+
[0.5, '#DDDF0D'], // Amarelo entre 10% e 50%
|
|
169
|
+
[0.9, '#55BF3B'], // Verde para mais de 50%
|
|
170
|
+
],
|
|
171
|
+
lineWidth: 0,
|
|
172
|
+
tickWidth: 0,
|
|
173
|
+
minorTickInterval: null,
|
|
174
|
+
tickAmount: 2,
|
|
175
|
+
title: {
|
|
176
|
+
y: -80,
|
|
177
|
+
},
|
|
178
|
+
labels: {
|
|
179
|
+
y: 16,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
plotOptions: {
|
|
184
|
+
solidgauge: {
|
|
185
|
+
borderRadius: 3,
|
|
186
|
+
dataLabels: {
|
|
187
|
+
y: 5,
|
|
188
|
+
borderWidth: 0,
|
|
189
|
+
useHTML: true,
|
|
190
|
+
style: {
|
|
191
|
+
textAlign: 'center',
|
|
192
|
+
width: '120px',
|
|
193
|
+
whiteSpace: 'nowrap',
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
initialize() {
|
|
202
|
+
if (this.allowDashBoardAutoValues) {
|
|
203
|
+
this.hideValue = this.isPermissionStoreGoal ? true : false
|
|
204
|
+
return
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (this.allowedToSee && !this.allowDashBoardAutoValues) {
|
|
208
|
+
this.hideValue = this.allowDashBoardAutoValues && this.isPermissionStoreGoal ? true : false
|
|
209
|
+
return
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
this.hideValue = this.allowedToSee && this.isPermissionStoreGoal ? true : false
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
stateGoNewGoal() {
|
|
216
|
+
this.$state.go('app.goal.list')
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
generateRandomEmoji = () => {
|
|
220
|
+
const emojis = ['πππ']
|
|
221
|
+
return emojis[0]
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
toggleShowValueStoreGoal() {
|
|
225
|
+
if ((this.allowedToSee !== undefined && !this.allowedToSee) || !this.isPermissionStoreGoal) {
|
|
226
|
+
if (this.allowedCallBack) {
|
|
227
|
+
this.allowedCallBack()
|
|
228
|
+
}
|
|
229
|
+
return
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
this.hideValue = !this.hideValue
|
|
233
|
+
this.randomEmoji = this.generateRandomEmoji()
|
|
234
|
+
this.configSolidGauge()
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
MbgStoreGoalController['$inject'] = [
|
|
238
|
+
'$scope',
|
|
239
|
+
'$element',
|
|
240
|
+
'$attrs',
|
|
241
|
+
'$timeout',
|
|
242
|
+
'$filter',
|
|
243
|
+
'$state',
|
|
244
|
+
]
|
|
245
|
+
|
|
246
|
+
const mbgStoreGoal = {
|
|
247
|
+
bindings: {
|
|
248
|
+
allowedToSee: '=?',
|
|
249
|
+
allowedCallBack: '&?',
|
|
250
|
+
storeGoalDashboard: '=?',
|
|
251
|
+
percentageEstimatedStoreGoal: '=?',
|
|
252
|
+
isPermissionStoreGoal: '=?',
|
|
253
|
+
allowDashBoardAutoValues: '=?',
|
|
254
|
+
},
|
|
255
|
+
template,
|
|
256
|
+
controller: MbgStoreGoalController,
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
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>
|