@kigi/components 1.37.0-beta.7 β†’ 1.37.0-beta.8

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@kigi/components",
3
- "version": "1.37.0-beta.7",
3
+ "version": "1.37.0-beta.8",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -57,8 +57,7 @@
57
57
  "firebase": "7.16.0",
58
58
  "fuse.js": "^3.4.6",
59
59
  "grpc": "1.20.2",
60
- "highcharts": "^6.2.0",
61
- "highcharts-more": "^0.1.7",
60
+ "highcharts": "^6.1.0",
62
61
  "imports-loader": "^0.8.0",
63
62
  "jodit": "^3.6.11",
64
63
  "jquery": "3.4.1",
@@ -66,7 +65,6 @@
66
65
  "jquery-ui": "^1.12.1",
67
66
  "jquery-ui-bundle": "^1.12.1-migrate",
68
67
  "lodash.get": "^4.4.2",
69
- "moment": "^2.30.1",
70
68
  "ng-easy-infinite-scroll": "^1.0.0",
71
69
  "postcss-flexbugs-fixes": "^4.1.0",
72
70
  "postcss-import": "^12.0.1",
@@ -86,7 +86,6 @@ 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'
90
89
 
91
90
  if (!window['$']) {
92
91
  window['$'] = $
@@ -154,7 +153,6 @@ const mbgComponentsModule = angular
154
153
  mbgRepasseModule,
155
154
  mbgTextEditorModule,
156
155
  mbgAceEditorModule,
157
- mbgStoreGoalModule,
158
156
  ])
159
157
  .config(appConfig)
160
158
  .service('mbgAlert', MbgAlert)
@@ -2,12 +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 track by $index"
5
+ <mbg-card-panel ng-repeat="panel in $ctrl.panels"
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
+ panel-values-filter="$ctrl.panelValuesFilter"
11
11
  allowed-call-back="$ctrl.allowedCallBack()"
12
12
  panel="panel">
13
13
  <i class="{{ panel.icon }}"
@@ -15,7 +15,7 @@ const mbgChartWrapper = {
15
15
  allowedToSee: '=?',
16
16
  allowedCallBack: '&?',
17
17
  allowDashboardMainSales: '=?',
18
- activeFilter: '=?',
18
+ panelValuesFilter: '=?',
19
19
  },
20
20
  template,
21
21
  controller: MbgChartWrapperController,
@@ -11,17 +11,12 @@ mbg-card-panel {
11
11
  margin-right: 200px;
12
12
  }
13
13
 
14
- .tooltip-inner {
15
- background: transparent;
16
- margin-right: 180px;
17
- }
18
-
19
-
20
-
14
+ .tooltip-inner {
15
+ background: transparent;
16
+ margin-right: 180px;
17
+ }
21
18
  .mbg-h-c-panel {
22
- border: 1px solid #F1F1F1;
23
- border-radius: 12px;
24
- padding: 8px;
19
+ border: 1px solid #5f5b5b;
25
20
  border-radius: 12px;
26
21
  padding: 8px;
27
22
 
@@ -1,6 +1,5 @@
1
1
  import './panel.scss'
2
2
  import template from './panel.html'
3
- import { DashboardService } from 'services/dashboard-service'
4
3
  import moment from 'moment'
5
4
 
6
5
  class MbgCardPanelController {
@@ -11,20 +10,10 @@ class MbgCardPanelController {
11
10
  public allowedToSee: boolean
12
11
  private allowedCallBack: Function
13
12
  private allowDashboardMainSales
14
- private activeFilter: any
15
- private totalSalesFilter = false
16
- private index
17
- private messagetooltip = ''
13
+ private panelValuesFilter
18
14
  private valuesEqual: boolean = false
19
15
 
20
- constructor(
21
- public $scope,
22
- public $element,
23
- public $attrs,
24
- public $timeout,
25
- public dashboardService: DashboardService,
26
- public $filter,
27
- ) {}
16
+ constructor(public $scope, public $element, public $attrs, public $timeout, public $filter) {}
28
17
  $onInit() {
29
18
  this.syncValue()
30
19
  this.$scope.$watch('$ctrl.displayValues', (data) => {
@@ -32,12 +21,78 @@ class MbgCardPanelController {
32
21
  this.hideValue = !data
33
22
  })
34
23
 
24
+ this.$scope.$watch('$ctrl.panelValuesFilter', (data) => {
25
+ this.panelValuesFilter = data
26
+ if (this.panelValuesFilter) {
27
+ this.panelValuesFiltered()
28
+ }
29
+ })
35
30
  this.randomEmoji = this.generateRandomEmoji()
36
31
 
37
32
  this.panel.setNewValue = (value) => {
38
33
  this.setValue(value)
39
34
  }
40
- // this.getCardsGeral()
35
+ }
36
+
37
+ messagesTooltipHtml(label, dateIni, dateFim, panel) {
38
+ this.panel.message = `
39
+ <div class="tooltip-chart-panel">
40
+ <label>Comparado as data de:</label>
41
+ <label>${
42
+ moment(dateIni).format('DD-MM') + ' atΓ© ' + moment(dateFim).format('DD-MM')
43
+ }</label>
44
+ <label>${label}: ${
45
+ this.panel.isCurrency ? this.$filter('currency')(isNaN(panel) ? 0 : panel, 'R$ ') : panel
46
+ }</label>
47
+ </div>`
48
+ }
49
+
50
+ panelValuesFiltered() {
51
+ this.$timeout(() => {
52
+ if (this.panel.countSales) {
53
+ this.panel.increasedValue = this.panel.value > this.panelValuesFilter.countSales
54
+ this.valuesEqual = this.panel.value === this.panelValuesFilter.countSales
55
+ this.messagesTooltipHtml(
56
+ 'Vendas',
57
+ this.panelValuesFilter.dateIni,
58
+ this.panelValuesFilter.dateFim,
59
+ this.panelValuesFilter.countSales,
60
+ )
61
+ }
62
+
63
+ if (this.panel.countItems) {
64
+ this.panel.increasedValue = this.panel.value > this.panelValuesFilter.countItems
65
+ this.valuesEqual = this.panel.value === this.panelValuesFilter.countItems
66
+ this.messagesTooltipHtml(
67
+ 'Items',
68
+ this.panelValuesFilter.dateIni,
69
+ this.panelValuesFilter.dateFim,
70
+ this.panelValuesFilter.countItems,
71
+ )
72
+ }
73
+
74
+ if (this.panel.avgSales) {
75
+ this.panel.increasedValue = this.panel.value > this.panelValuesFilter.avgSales
76
+ this.valuesEqual = this.panel.value === this.panelValuesFilter.avgSales
77
+ this.messagesTooltipHtml(
78
+ 'Valor',
79
+ this.panelValuesFilter.dateIni,
80
+ this.panelValuesFilter.dateFim,
81
+ this.panelValuesFilter.avgSales,
82
+ )
83
+ }
84
+
85
+ if (this.panel.totalSales) {
86
+ this.panel.increasedValue = this.panel.value > this.panelValuesFilter.totalSales
87
+ this.valuesEqual = this.panel.value === this.panelValuesFilter.totalSales
88
+ this.messagesTooltipHtml(
89
+ 'Valor',
90
+ this.panelValuesFilter.dateIni,
91
+ this.panelValuesFilter.dateFim,
92
+ this.panelValuesFilter.totalSales,
93
+ )
94
+ }
95
+ }, 1000)
41
96
  }
42
97
 
43
98
  setValue = (value) => {
@@ -47,135 +102,6 @@ class MbgCardPanelController {
47
102
  }, 1000)
48
103
  }
49
104
 
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
-
179
105
  syncValue() {
180
106
  if (this.panel.sync) {
181
107
  this.panel.loading = true
@@ -201,14 +127,7 @@ class MbgCardPanelController {
201
127
  }
202
128
  }
203
129
 
204
- MbgCardPanelController['$inject'] = [
205
- '$scope',
206
- '$element',
207
- '$attrs',
208
- '$timeout',
209
- 'dashboardService',
210
- '$filter',
211
- ]
130
+ MbgCardPanelController['$inject'] = ['$scope', '$element', '$attrs', '$timeout', '$filter']
212
131
 
213
132
  const mbgCardPanel = {
214
133
  transclude: true,
@@ -219,7 +138,7 @@ const mbgCardPanel = {
219
138
  allowedToSee: '=?',
220
139
  allowedCallBack: '&?',
221
140
  allowDashboardMainSales: '=?',
222
- activeFilter: '=?',
141
+ panelValuesFilter: '=?',
223
142
  },
224
143
  template,
225
144
  controller: MbgCardPanelController,
@@ -5,7 +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
+ panel-values-filter="$ctrl.panelValuesFilter"
9
9
  allowed-call-back="$ctrl.allowedCallBack()"></mbg-chart-wrapper>
10
10
 
11
11
  <div ng-show="!$ctrl.hasData()"
@@ -257,7 +257,7 @@ const mbgChartBarLine = {
257
257
  allowedToSee: '=?',
258
258
  allowedCallBack: '&?',
259
259
  allowDashboardMainSales: '=?',
260
- activeFilter: '=?',
260
+ panelValuesFilter: '=?',
261
261
  },
262
262
  template,
263
263
  controller: MbgChartBarLineController,
@@ -5,7 +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
+ panel-values-filter="$ctrl.panelValuesFilter"
9
9
  allowed-call-back="$ctrl.allowedCallBack()"></mbg-chart-wrapper>
10
10
 
11
11
  <div ng-show="!$ctrl.hasData()"
@@ -282,7 +282,7 @@ const mbgChartBarLinePie = {
282
282
  allowedToSee: '=?',
283
283
  allowedCallBack: '&?',
284
284
  allowDashboardMainSales: '=?',
285
- activeFilter: '=?',
285
+ panelValuesFilter: '=?',
286
286
  },
287
287
  template,
288
288
  controller: MbgChartBarLinePieController,
@@ -5,7 +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
+ panel-values-filter="$ctrl.panelValuesFilter"
9
9
  allowed-call-back="$ctrl.allowedCallBack()"></mbg-chart-wrapper>
10
10
 
11
11
  <div ng-show="!$ctrl.hasData()"
@@ -278,7 +278,7 @@ const mbgChartLine = {
278
278
  allowedToSee: '=?',
279
279
  allowedCallBack: '&?',
280
280
  allowDashboardMainSales: '=?',
281
- activeFilter: '=?',
281
+ panelValuesFilter: '=?',
282
282
  },
283
283
  template,
284
284
  controller: MbgChartLineController,
@@ -14,4 +14,3 @@ const mbgHomeScreenModule = angular
14
14
  .component('mbgChartWrapper', mbgChartWrapper).name
15
15
 
16
16
  export { mbgHomeScreenModule }
17
-
@@ -52,7 +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
+ panel-values-filter="$ctrl.panelValuesFilter"
56
56
  ng-if="$ctrl.chart && $ctrl.chart.type == 'line'"></mbg-chart-line>
57
57
  <mbg-chart-bar-line chart="$ctrl.chart"
58
58
  panels="$ctrl.cards"
@@ -61,7 +61,7 @@
61
61
  loading="$ctrl.loading"
62
62
  allowed-to-see="$ctrl.allowedToSee"
63
63
  allowed-call-back="$ctrl.allowedCallBack()"
64
- active-filter="$ctrl.activeFilter"
64
+ panel-values-filter="$ctrl.panelValuesFilter"
65
65
  ng-if="$ctrl.chart && $ctrl.chart.type == 'barline'"></mbg-chart-bar-line>
66
66
  <mbg-chart-bar-line-pie chart="$ctrl.chart"
67
67
  panels="$ctrl.cards"
@@ -70,7 +70,7 @@
70
70
  loading="$ctrl.loading"
71
71
  allowed-to-see="$ctrl.allowedToSee"
72
72
  allowed-call-back="$ctrl.allowedCallBack()"
73
- active-filter="$ctrl.activeFilter"
73
+ panel-values-filter="$ctrl.panelValuesFilter"
74
74
  ng-if="$ctrl.chart && $ctrl.chart.type == 'barlinepie'"></mbg-chart-bar-line-pie>
75
75
  <div class="display-values">
76
76
  <a ng-show="!$ctrl.displayValues"
@@ -22,7 +22,6 @@ class MbgHomescreenController {
22
22
  isCurrency: boolean
23
23
  }[]
24
24
  private allowDashboardMainSales
25
- private filterActive
26
25
 
27
26
  constructor(public $scope, public $element, public $attrs, public $timeout) {}
28
27
 
@@ -64,7 +63,6 @@ class MbgHomescreenController {
64
63
  return tab
65
64
  })
66
65
  this.activeFilter = item
67
- this.filterActive = this.activeFilter
68
66
  item.active = true
69
67
  if (this.tabs[this.activeIndex].executeFilter) {
70
68
  this.tabs[this.activeIndex].executeFilter(this.config)
@@ -80,7 +78,6 @@ class MbgHomescreenController {
80
78
  this.tabs.forEach((tab, index) => (this.tabs[index].active = false))
81
79
  this.tabs[tabIndex].active = true
82
80
  this.activeFilter = (this.tabs[tabIndex].filters || []).find((filter) => filter.active)
83
- this.filterActive = this.activeFilter
84
81
  this.cards = this.tabs[tabIndex].cards
85
82
  this.chart = this.tabs[tabIndex].chart
86
83
  }
@@ -109,6 +106,7 @@ const mbgHomescreen = {
109
106
  allowedCallBack: '&?',
110
107
  activeFilter: '=?',
111
108
  allowDashboardMainSales: '=?',
109
+ panelValuesFilter: '=?',
112
110
  },
113
111
  template,
114
112
  controller: MbgHomescreenController,
@@ -30,7 +30,6 @@
30
30
  ng-keydown="$ctrl.ngKeydown({ $event })"
31
31
  ui-date-mask="{{ $ctrl.format }}"
32
32
  only-month-year="$ctrl.onlyMonthYear"
33
- ng-class="{'input-date':$ctrl.titleMode}"
34
33
  mbg-datepicker />
35
34
  <!-- between dates -->
36
35
  <div class="mbg-date-between"
@@ -1,9 +1,4 @@
1
1
  .mb-input-date-wrapper {
2
- .input-date {
3
- width: 150px !important;
4
- height: 28px !important;
5
- }
6
-
7
2
  input {
8
3
  width: 100%;
9
4
  }
@@ -19,6 +14,7 @@
19
14
  }
20
15
  }
21
16
 
17
+
22
18
  body {
23
19
  .datepicker-top-left, .datepicker-top-right {
24
20
  border-top-color: var(--primary);
@@ -18,7 +18,6 @@ class MbgInputDateController {
18
18
  public filterDate: Function
19
19
  public onlyMonthYear: boolean
20
20
 
21
-
22
21
  constructor(public $scope, public $element, public $attrs, public $timeout) {
23
22
  if ($attrs.ngRequired === '') {
24
23
  this.ngRequired = true
@@ -132,7 +131,6 @@ const mbgInputDate = {
132
131
  between: '=?',
133
132
  filterDate: '&?',
134
133
  onlyMonthYear: '=?',
135
- titleMode: '=?',
136
134
  },
137
135
  template,
138
136
  controller: MbgInputDateController,
package/src/index.html CHANGED
@@ -159,14 +159,12 @@
159
159
  <!-- <div style="padding: 100px;">
160
160
  <div class="row">
161
161
  <div class="col-md-12"> -->
162
- <div class=""
162
+ <!-- <div class=""
163
163
  style="height: 260px">
164
- <mbg-store-goal></mbg-store-goal>
165
-
166
- <!-- <mbg-text-editor ng-model="editorJodit"
164
+ <mbg-text-editor ng-model="editorJodit"
167
165
  ng-if="testeeditorif"
168
- ng-change="changeEditorTeste(value)"></mbg-text-editor> -->
169
- </div>
166
+ ng-change="changeEditorTeste(value)"></mbg-text-editor>
167
+ </div> -->
170
168
  <!-- <mbg-address ng-model="address"></mbg-address>
171
169
  <pre>{{ address | json }}</pre>
172
170
  </div>
@@ -1,8 +0,0 @@
1
- import * as angular from 'angular'
2
- import { mbgStoreGoal } from './mbg-store-goal'
3
-
4
- const mbgStoreGoalModule = angular
5
- .module('mbg.components.mbgStatusLabel', [])
6
- .component('mbgStoreGoal', mbgStoreGoal).name
7
-
8
- export { mbgStoreGoalModule }
@@ -1,62 +0,0 @@
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,143 +0,0 @@
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: 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;
139
- }
140
-
141
- .state-goal{
142
- cursor: pointer;
143
- }
@@ -1,257 +0,0 @@
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 = `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 {
132
- chart: {
133
- type: 'solidgauge',
134
- backgroundColor: 'none',
135
- // plotBorderWidth: 0,
136
- // margin: [0, 0, 0, 0],
137
- },
138
-
139
- title: null,
140
- pane: {
141
- center: ['50%', '90%'],
142
- size: '100%',
143
- startAngle: -90,
144
- endAngle: 90,
145
- background: {
146
- backgroundColor: 'none',
147
- borderRadius: 5,
148
- innerRadius: '60%',
149
- outerRadius: '100%',
150
- shape: 'arc',
151
- },
152
- },
153
-
154
- exporting: {
155
- enabled: false,
156
- },
157
-
158
- tooltip: {
159
- enabled: false,
160
- },
161
-
162
- // the value axis
163
- yAxis: {
164
- stops: [
165
- [0.1, '#DF5353'], // Vermelho para atΓ© 10% da meta
166
- [0.5, '#DDDF0D'], // Amarelo entre 10% e 50%
167
- [0.9, '#55BF3B'], // Verde para mais de 50%
168
- ],
169
- lineWidth: 0,
170
- tickWidth: 0,
171
- minorTickInterval: null,
172
- tickAmount: 2,
173
- title: {
174
- y: -80,
175
- },
176
- labels: {
177
- y: 16,
178
- },
179
- },
180
-
181
- plotOptions: {
182
- solidgauge: {
183
- borderRadius: 3,
184
- dataLabels: {
185
- y: 5,
186
- borderWidth: 0,
187
- useHTML: true,
188
- style: {
189
- textAlign: 'center',
190
- width: '120px',
191
- whiteSpace: 'nowrap',
192
- },
193
- },
194
- },
195
- },
196
- }
197
- }
198
-
199
- initialize() {
200
- if (this.allowDashBoardAutoValues) {
201
- this.hideValue = this.isPermissionStoreGoal ? true : false
202
- return
203
- }
204
-
205
- if (this.allowedToSee && !this.allowDashBoardAutoValues) {
206
- this.hideValue = this.allowDashBoardAutoValues && this.isPermissionStoreGoal ? true : false
207
- return
208
- }
209
-
210
- this.hideValue = this.allowedToSee && this.isPermissionStoreGoal ? true : false
211
- }
212
-
213
- stateGoNewGoal() {
214
- this.$state.go('app.goal.list')
215
- }
216
-
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()
233
- }
234
- }
235
- MbgStoreGoalController['$inject'] = [
236
- '$scope',
237
- '$element',
238
- '$attrs',
239
- '$timeout',
240
- '$filter',
241
- '$state',
242
- ]
243
-
244
- const mbgStoreGoal = {
245
- bindings: {
246
- allowedToSee: '=?',
247
- allowedCallBack: '&?',
248
- storeGoalDashboard: '=?',
249
- percentageEstimatedStoreGoal: '=?',
250
- isPermissionStoreGoal: '=?',
251
- allowDashBoardAutoValues: '=?',
252
- },
253
- template,
254
- controller: MbgStoreGoalController,
255
- }
256
-
257
- export { mbgStoreGoal }