@kigi/components 1.37.0-beta.4 → 1.37.0-beta.6
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './panel.scss'
|
|
2
2
|
import template from './panel.html'
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { DashboardService } from 'services/dashboard-service'
|
|
4
|
+
import moment from 'moment'
|
|
5
5
|
|
|
6
6
|
class MbgCardPanelController {
|
|
7
7
|
public loading
|
|
@@ -22,7 +22,7 @@ class MbgCardPanelController {
|
|
|
22
22
|
public $element,
|
|
23
23
|
public $attrs,
|
|
24
24
|
public $timeout,
|
|
25
|
-
|
|
25
|
+
public dashboardService: DashboardService,
|
|
26
26
|
public $filter,
|
|
27
27
|
) {}
|
|
28
28
|
$onInit() {
|
|
@@ -206,7 +206,7 @@ MbgCardPanelController['$inject'] = [
|
|
|
206
206
|
'$element',
|
|
207
207
|
'$attrs',
|
|
208
208
|
'$timeout',
|
|
209
|
-
|
|
209
|
+
'dashboardService',
|
|
210
210
|
'$filter',
|
|
211
211
|
]
|
|
212
212
|
|
|
@@ -1,2 +1,62 @@
|
|
|
1
|
-
<div
|
|
2
|
-
|
|
1
|
+
<div ng-class="{'opacity-dash-goal': !$ctrl.isPermissionStoreGoal}"
|
|
2
|
+
ng-show="$ctrl.showDashboard">
|
|
3
|
+
<div class="description-container-dash">
|
|
4
|
+
<p class="description-dash">Meta do mês / {{$ctrl.currentMonthName}}</p>
|
|
5
|
+
<div class="mbg-h-c-tone-s-icon-dash"
|
|
6
|
+
ng-click="$ctrl.toggleShowValueStoreGoal(false)">
|
|
7
|
+
<span class="link-store"
|
|
8
|
+
ng-if="$ctrl.estimatedPercentageGreaterThanTarget"
|
|
9
|
+
uib-tooltip="{{$ctrl.percentageEstimated}}"
|
|
10
|
+
tooltip-placement="left">
|
|
11
|
+
<i class="fa fa-exclamation-circle"
|
|
12
|
+
aria-hidden="true"></i></span>
|
|
13
|
+
<i class="fa fa-lock lock-dash-store"
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
uib-tooltip="Sem permissão para visualizar"
|
|
16
|
+
tooltip-placement="left"
|
|
17
|
+
ng-if="!$ctrl.isPermissionStoreGoal"></i>
|
|
18
|
+
<i ng-if="$ctrl.hideValue && $ctrl.isPermissionStoreGoal"
|
|
19
|
+
disable-animate
|
|
20
|
+
class="far fa-eye eye-board-target"></i>
|
|
21
|
+
<i ng-if="!$ctrl.hideValue && $ctrl.isPermissionStoreGoal"
|
|
22
|
+
disable-animate
|
|
23
|
+
class="far fa-eye-slash eye-board-target"></i>
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="line-pay"></div>
|
|
28
|
+
<div class="goal-target">
|
|
29
|
+
<p ng-if="$ctrl.hideValue">Meta: <strong>{{$ctrl.goalStoreTarget }}</strong></p>
|
|
30
|
+
<p ng-if="!$ctrl.hideValue">Meta: <i class="fa fa-lock"
|
|
31
|
+
aria-hidden="true"
|
|
32
|
+
uib-tooltip="Sem permissão para visualizar"></i></p>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="goal-day">
|
|
35
|
+
<p class="estimate-goal"
|
|
36
|
+
ng-if="!$ctrl.hideValue">Estimativa da meta: <i class="fa fa-lock"
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
uib-tooltip="Sem permissão para visualizar"></i>
|
|
39
|
+
</p>
|
|
40
|
+
<p class="estimate-goal"
|
|
41
|
+
ng-if="$ctrl.hideValue">Estimativa da meta: <strong>{{$ctrl.estimatedGoal }}</strong>
|
|
42
|
+
<p class="estimated "
|
|
43
|
+
ng-if="$ctrl.hideValue"
|
|
44
|
+
tooltip-placement="right"
|
|
45
|
+
uib-tooltip="{{$ctrl.messageTooltip}}">
|
|
46
|
+
<i class="fa fa-exclamation-circle"
|
|
47
|
+
aria-hidden="true"></i>
|
|
48
|
+
</p>
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div class="dashboard-wrapper">
|
|
53
|
+
<div class="chart-container"
|
|
54
|
+
id="container-speed"></div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<div ng-show="!$ctrl.showDashboard"
|
|
59
|
+
class="hide-goal">
|
|
60
|
+
<label for="">Sem meta cadastrada. Defina sua meta hoje. <a class="state-goal"
|
|
61
|
+
ng-click="$ctrl.stateGoNewGoal()">Clique aqui</a> </label>
|
|
62
|
+
</div>
|
|
@@ -1,5 +1,143 @@
|
|
|
1
|
+
.dashboard-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
height: 100%;
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
.chart-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
2
13
|
width: 300px;
|
|
3
|
-
height:
|
|
4
|
-
|
|
14
|
+
height: auto;
|
|
15
|
+
position: relative;
|
|
16
|
+
left: 2%;
|
|
17
|
+
bottom: 252px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.opacity-dash-goal{
|
|
21
|
+
opacity: 0.5;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.goal-target{
|
|
25
|
+
position: relative;
|
|
26
|
+
top: 192px;
|
|
27
|
+
font-size: 14px;
|
|
28
|
+
color: #5f5b5b;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
.tooltip-inner {
|
|
33
|
+
background:#ff8c00 !important;
|
|
34
|
+
color: #000000 !important;
|
|
35
|
+
width: 300px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@keyframes blink {
|
|
39
|
+
0% {
|
|
40
|
+
opacity: 1;
|
|
41
|
+
}
|
|
42
|
+
50% {
|
|
43
|
+
opacity: 0;
|
|
44
|
+
}
|
|
45
|
+
100% {
|
|
46
|
+
opacity: 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.estimate-goal{
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
color: #5f5b5b;
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.estimated{
|
|
57
|
+
position: relative;
|
|
58
|
+
left: -124px;
|
|
59
|
+
color: cornflowerblue;
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
.tooltip-inner{
|
|
63
|
+
background:#95c5ec !important;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
.link-store{
|
|
69
|
+
animation: blink 1s infinite;
|
|
70
|
+
color: #ff8c00;
|
|
71
|
+
position: relative;
|
|
72
|
+
font-size: 22px;
|
|
73
|
+
top: 16px;
|
|
74
|
+
right: -38px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.goal-day {
|
|
78
|
+
display: flex;
|
|
79
|
+
justify-content: space-between;
|
|
80
|
+
align-items: end;
|
|
81
|
+
position: relative;
|
|
82
|
+
top: 184px;
|
|
83
|
+
font-size: 16px;
|
|
84
|
+
color: #5f5b5b;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
.description-container-dash {
|
|
90
|
+
flex-grow: 1;
|
|
91
|
+
color: var(--titleColor);
|
|
92
|
+
display: flex;
|
|
93
|
+
justify-content: space-between;
|
|
94
|
+
width: 100%;
|
|
95
|
+
margin-top: 16px;
|
|
96
|
+
font-weight: 600;
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
|
|
99
|
+
.mbg-h-c-tone-s-icon-dash {
|
|
100
|
+
margin-top: -10px;
|
|
101
|
+
transition: opacity 500ms ease;
|
|
102
|
+
opacity: 0.9;
|
|
103
|
+
|
|
104
|
+
.eye-board-target {
|
|
105
|
+
position: relative;
|
|
106
|
+
top: -10px;
|
|
107
|
+
right: -16px;
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
.eye-board-target-hide {
|
|
111
|
+
position: relative;
|
|
112
|
+
top: -5px;
|
|
113
|
+
right: -16px;
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.lock-dash-store{
|
|
119
|
+
position: relative;
|
|
120
|
+
right: -16px;
|
|
121
|
+
// color: red;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.description-dash {
|
|
126
|
+
font-size: 20px;
|
|
127
|
+
color: #5f5b5b;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
.hide-goal{
|
|
132
|
+
display: flex;
|
|
133
|
+
justify-content: center;
|
|
134
|
+
align-items: center;
|
|
135
|
+
width: 100%;
|
|
136
|
+
height: 100%;
|
|
137
|
+
font-size: 14px;
|
|
138
|
+
color: #5f5b5b;
|
|
5
139
|
}
|
|
140
|
+
|
|
141
|
+
.state-goal{
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
}
|
|
@@ -18,28 +18,132 @@ class MbgStoreGoalController {
|
|
|
18
18
|
private status: string
|
|
19
19
|
private cappedPercentage
|
|
20
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
|
|
21
36
|
|
|
22
|
-
constructor(
|
|
37
|
+
constructor(
|
|
38
|
+
public $scope,
|
|
39
|
+
public $element,
|
|
40
|
+
public $attrs,
|
|
41
|
+
public $timeout,
|
|
42
|
+
public $filter,
|
|
43
|
+
public $state,
|
|
44
|
+
) {}
|
|
23
45
|
|
|
24
|
-
$onInit() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 = `Média Diária: (Valor V. / Dia A.)\n\n
|
|
67
|
+
projeção final: (Média Diária * Dias passados do mês)\n\n
|
|
68
|
+
estimativa: (Projeção final / Meta do mês) * 100
|
|
69
|
+
`
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async configSolidGauge() {
|
|
73
|
+
const storeGoalPercentage = this.hideValue ? this.storeGoalDashboard : 0
|
|
74
|
+
const porcentageEstimated = Number(this.percentageEstimatedStoreGoal.projectionFinal)
|
|
75
|
+
this.showDashboard = this.storeGoalDashboard
|
|
76
|
+
const percentageTarget = this.percentageEstimatedStoreGoal.percentageTarget.toFixed(2)
|
|
77
|
+
const showPercentage = this.hideValue ? `${percentageTarget}%` : '****'
|
|
78
|
+
this.percentageEstimated = `Alerta: Você atingirá aproximadamente ${showPercentage} da sua meta se continuar no ritmo atual.`
|
|
79
|
+
const goal = this.percentageEstimatedStoreGoal.target
|
|
80
|
+
|
|
81
|
+
this.goalStoreTarget = this.$filter('currency')(isNaN(goal) ? 0 : goal, 'R$ ')
|
|
82
|
+
this.estimatedGoal = this.$filter('currency')(isNaN(goal) ? 0 : porcentageEstimated, 'R$ ')
|
|
83
|
+
|
|
84
|
+
if (porcentageEstimated < goal) {
|
|
85
|
+
this.estimatedPercentageGreaterThanTarget = true
|
|
86
|
+
} else {
|
|
87
|
+
this.estimatedPercentageGreaterThanTarget = false
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const gaugeOptions = this.gaugeOptions()
|
|
91
|
+
|
|
92
|
+
const chartSpeed = Highcharts.chart(
|
|
93
|
+
'container-speed',
|
|
94
|
+
Highcharts.merge(gaugeOptions, {
|
|
95
|
+
yAxis: {
|
|
96
|
+
min: 0,
|
|
97
|
+
max: 100,
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
credits: {
|
|
101
|
+
enabled: false,
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
series: [
|
|
105
|
+
{
|
|
106
|
+
name: 'Speed',
|
|
107
|
+
data: [storeGoalPercentage],
|
|
108
|
+
dataLabels: {
|
|
109
|
+
format: this.hideValue
|
|
110
|
+
? '<div style="display: flex;justify-content: center;align-items: center;margin-top: -20px;">' +
|
|
111
|
+
'<span style="font-size:25px">{y}</span><br/>' +
|
|
112
|
+
'<span style="font-size:12px;opacity:0.4">%</span>' +
|
|
113
|
+
'</div>'
|
|
114
|
+
: '<div style="margin-top: -20px;">' +
|
|
115
|
+
'<span style="font-size:25px"><i class="fa fa-lock"</i></span>' +
|
|
116
|
+
'</div>',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
}),
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
this.updateChart(storeGoalPercentage, chartSpeed)
|
|
124
|
+
}
|
|
125
|
+
updateChart(totalPercentage, chartSpeed) {
|
|
126
|
+
const point = chartSpeed.series[0].points[0]
|
|
127
|
+
point.update(totalPercentage)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
gaugeOptions() {
|
|
131
|
+
return {
|
|
30
132
|
chart: {
|
|
31
133
|
type: 'solidgauge',
|
|
134
|
+
backgroundColor: 'none',
|
|
135
|
+
// plotBorderWidth: 0,
|
|
136
|
+
// margin: [0, 0, 0, 0],
|
|
32
137
|
},
|
|
33
138
|
|
|
34
139
|
title: null,
|
|
35
|
-
|
|
36
140
|
pane: {
|
|
37
|
-
center: ['50%', '
|
|
38
|
-
size: '
|
|
141
|
+
center: ['50%', '90%'],
|
|
142
|
+
size: '100%',
|
|
39
143
|
startAngle: -90,
|
|
40
144
|
endAngle: 90,
|
|
41
145
|
background: {
|
|
42
|
-
backgroundColor:
|
|
146
|
+
backgroundColor: 'none',
|
|
43
147
|
borderRadius: 5,
|
|
44
148
|
innerRadius: '60%',
|
|
45
149
|
outerRadius: '100%',
|
|
@@ -67,7 +171,7 @@ class MbgStoreGoalController {
|
|
|
67
171
|
minorTickInterval: null,
|
|
68
172
|
tickAmount: 2,
|
|
69
173
|
title: {
|
|
70
|
-
y: -
|
|
174
|
+
y: -80,
|
|
71
175
|
},
|
|
72
176
|
labels: {
|
|
73
177
|
y: 16,
|
|
@@ -81,59 +185,71 @@ class MbgStoreGoalController {
|
|
|
81
185
|
y: 5,
|
|
82
186
|
borderWidth: 0,
|
|
83
187
|
useHTML: true,
|
|
188
|
+
style: {
|
|
189
|
+
textAlign: 'center',
|
|
190
|
+
width: '120px',
|
|
191
|
+
whiteSpace: 'nowrap',
|
|
192
|
+
},
|
|
84
193
|
},
|
|
85
194
|
},
|
|
86
195
|
},
|
|
87
196
|
}
|
|
197
|
+
}
|
|
88
198
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
min: 0,
|
|
95
|
-
max: percentage,
|
|
96
|
-
title: {
|
|
97
|
-
text: 'Speed',
|
|
98
|
-
},
|
|
99
|
-
},
|
|
199
|
+
initialize() {
|
|
200
|
+
if (this.allowDashBoardAutoValues) {
|
|
201
|
+
this.hideValue = this.isPermissionStoreGoal ? true : false
|
|
202
|
+
return
|
|
203
|
+
}
|
|
100
204
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
205
|
+
if (this.allowedToSee && !this.allowDashBoardAutoValues) {
|
|
206
|
+
this.hideValue = this.allowDashBoardAutoValues && this.isPermissionStoreGoal ? true : false
|
|
207
|
+
return
|
|
208
|
+
}
|
|
104
209
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
name: 'Speed',
|
|
108
|
-
data: [percentage],
|
|
109
|
-
dataLabels: {
|
|
110
|
-
format:
|
|
111
|
-
'<div style="display: flex;justify-content: center;align-items: center;">' +
|
|
112
|
-
'<span style="font-size:25px">{y}</span><br/>' +
|
|
113
|
-
'<span style="font-size:12px;opacity:0.4">%</span>' +
|
|
114
|
-
'</div>',
|
|
115
|
-
},
|
|
116
|
-
tooltip: {
|
|
117
|
-
valueSuffix: ' km/h',
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
}),
|
|
122
|
-
)
|
|
210
|
+
this.hideValue = this.allowedToSee && this.isPermissionStoreGoal ? true : false
|
|
211
|
+
}
|
|
123
212
|
|
|
124
|
-
|
|
213
|
+
stateGoNewGoal() {
|
|
214
|
+
this.$state.go('app.goal.list')
|
|
125
215
|
}
|
|
126
216
|
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
217
|
+
generateRandomEmoji = () => {
|
|
218
|
+
const emojis = ['🔐🔐🔐']
|
|
219
|
+
return emojis[0]
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
toggleShowValueStoreGoal() {
|
|
223
|
+
if ((this.allowedToSee !== undefined && !this.allowedToSee) || !this.isPermissionStoreGoal) {
|
|
224
|
+
if (this.allowedCallBack) {
|
|
225
|
+
this.allowedCallBack()
|
|
226
|
+
}
|
|
227
|
+
return
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
this.hideValue = !this.hideValue
|
|
231
|
+
this.randomEmoji = this.generateRandomEmoji()
|
|
232
|
+
this.configSolidGauge()
|
|
131
233
|
}
|
|
132
234
|
}
|
|
133
|
-
MbgStoreGoalController['$inject'] = [
|
|
235
|
+
MbgStoreGoalController['$inject'] = [
|
|
236
|
+
'$scope',
|
|
237
|
+
'$element',
|
|
238
|
+
'$attrs',
|
|
239
|
+
'$timeout',
|
|
240
|
+
'$filter',
|
|
241
|
+
'$state',
|
|
242
|
+
]
|
|
134
243
|
|
|
135
244
|
const mbgStoreGoal = {
|
|
136
|
-
bindings: {
|
|
245
|
+
bindings: {
|
|
246
|
+
allowedToSee: '=?',
|
|
247
|
+
allowedCallBack: '&?',
|
|
248
|
+
storeGoalDashboard: '=?',
|
|
249
|
+
percentageEstimatedStoreGoal: '=?',
|
|
250
|
+
isPermissionStoreGoal: '=?',
|
|
251
|
+
allowDashBoardAutoValues: '=?',
|
|
252
|
+
},
|
|
137
253
|
template,
|
|
138
254
|
controller: MbgStoreGoalController,
|
|
139
255
|
}
|