@kigi/components 1.37.0-beta.3 → 1.37.0-beta.4

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.3",
3
+ "version": "1.37.0-beta.4",
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.1.0",
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",
@@ -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)
@@ -1,8 +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'
5
-
3
+ // import { DashboardService } from 'services/dashboard-service'
4
+ // import moment from 'moment'
6
5
 
7
6
  class MbgCardPanelController {
8
7
  public loading
@@ -23,7 +22,7 @@ class MbgCardPanelController {
23
22
  public $element,
24
23
  public $attrs,
25
24
  public $timeout,
26
- public dashboardService: DashboardService,
25
+ // public dashboardService: DashboardService,
27
26
  public $filter,
28
27
  ) {}
29
28
  $onInit() {
@@ -38,7 +37,7 @@ class MbgCardPanelController {
38
37
  this.panel.setNewValue = (value) => {
39
38
  this.setValue(value)
40
39
  }
41
- this.getCardsGeral()
40
+ // this.getCardsGeral()
42
41
  }
43
42
 
44
43
  setValue = (value) => {
@@ -48,74 +47,74 @@ class MbgCardPanelController {
48
47
  }, 1000)
49
48
  }
50
49
 
51
- async getCardsGeral() {
52
- this.$timeout(async () => {
53
- const { dateIni, dateFim } = this.getFilterDate()
54
- let response = await this.dashboardService
55
- .getCardsTotalSalesDashboardByFilter({ dateIni, dateFim })
56
- .then((response) => response.data)
57
-
58
- const values = {
59
- totalSales: response.totalSales ? response.totalSales : 0,
60
- avgSales: response.avgSales ? response.avgSales : 0,
61
- countSales: response.countSales || 0,
62
- countItems: response.countItems || 0,
63
- }
64
-
65
- if (this.panel.countSales) {
66
- this.panel.increasedValue = this.panel.value > values.countSales
67
- this.valuesEqual = this.panel.value === values.countSales
68
- this.panel.message = `
69
- <div class="tooltip-chart-panel">
70
- <label>Comparado as data de:</label>
71
- <label>${
72
- moment(dateIni).format('DD-MM') + ' até ' + moment(dateFim).format('DD-MM')
73
- }</label>
74
- <label>Vendas: ${values.countSales}</label>
75
- </div>`
76
- }
77
-
78
- if (this.panel.countItems) {
79
- this.panel.increasedValue = this.panel.value > values.countItems
80
- this.valuesEqual = this.panel.value === values.countItems
81
- this.panel.message = `
82
- <div class="tooltip-chart-panel">
83
- <label>Comparado as data de:</label>
84
- <label>${
85
- moment(dateIni).format('DD-MM') + ' até ' + moment(dateFim).format('DD-MM')
86
- }</label>
87
- <label>Items: ${values.countItems}</label>
88
- </div>`
89
- }
90
-
91
- if (this.panel.avgSales) {
92
- this.panel.increasedValue = this.panel.value > values.avgSales
93
- this.valuesEqual = this.panel.value === values.avgSales
94
- this.panel.message = `
95
- <div class="tooltip-chart-panel">
96
- <label>Comparado as data de:</label>
97
- <label>${
98
- moment(dateIni).format('DD-MM') + ' até ' + moment(dateFim).format('DD-MM')
99
- }</label>
100
- <label>Valor: ${this.$filter('currency')(values.avgSales, 'R$ ')}</label>
101
- </div>`
102
- }
103
-
104
- if (this.panel.totalSales) {
105
- this.panel.increasedValue = this.panel.value > values.totalSales
106
- this.valuesEqual = this.panel.value === values.totalSales
107
-
108
- this.panel.message = `
109
- <div class="tooltip-chart-panel">
110
- <label>Comparado as data de:</label>
111
- <label>${
112
- moment(dateIni).format('DD-MM') + ' até ' + moment(dateFim).format('DD-MM')
113
- }</label>
114
- <label>Valor: ${this.$filter('currency')(values.totalSales, 'R$ ')}</label>
115
- </div>`
116
- }
117
- }, 1000)
118
- }
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
+ // }
119
118
 
120
119
  formatToBRL(value) {
121
120
  return value.toLocaleString('pt-BR', {
@@ -124,58 +123,58 @@ class MbgCardPanelController {
124
123
  })
125
124
  }
126
125
 
127
- getFilterDate() {
128
- this.activeFilter = this.activeFilter || { name: 'Hoje', key: 'TODAY' }
129
- switch (this.activeFilter.key) {
130
- case 'TODAY':
131
- return {
132
- dateIni: moment()
133
- .subtract(1, 'd')
134
- .set({ hours: 0, minutes: 0, seconds: 0 })
135
- .format('YYYY-MM-DD HH:mm:ss'),
136
- dateFim: moment()
137
- .subtract(1, 'd')
138
- .set({ hours: 23, minutes: 59, seconds: 59 })
139
- .format('YYYY-MM-DD HH:mm:ss'),
140
- }
141
- case 'YESTERDAY':
142
- return {
143
- dateIni: moment()
144
- .subtract(2, 'd')
145
- .set({ hours: 0, minutes: 0, seconds: 0 })
146
- .format('YYYY-MM-DD HH:mm:ss'),
147
- dateFim: moment()
148
- .subtract(2, 'd')
149
- .set({ hours: 23, minutes: 59, seconds: 59 })
150
- .format('YYYY-MM-DD HH:mm:ss'),
151
- }
152
- case 'THIS_WEEK':
153
- const startOfLastWeek = moment()
154
- .subtract(7, 'days')
155
- .startOf('week')
156
- .set({ hours: 0, minutes: 0, seconds: 0 })
157
- const lastWeekToday = moment()
158
- .subtract(7, 'days')
159
- .set({ hours: 23, minutes: 59, seconds: 59 })
160
-
161
- return {
162
- dateIni: startOfLastWeek.format('YYYY-MM-DD HH:mm:ss'),
163
- dateFim: lastWeekToday.format('YYYY-MM-DD HH:mm:ss'),
164
- }
165
-
166
- default:
167
- return {
168
- dateIni: moment()
169
- .subtract(1, 'month')
170
- .set({ date: 1, hours: 23, minutes: 59, seconds: 59 })
171
- .format('YYYY-MM-DD HH:mm:ss'),
172
- dateFim: moment()
173
- .subtract(1, 'month')
174
- .set({ date: moment().date(), hours: 0, minutes: 0, seconds: 0 })
175
- .format('YYYY-MM-DD HH:mm:ss'),
176
- }
177
- }
178
- }
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
+ // }
179
178
 
180
179
  syncValue() {
181
180
  if (this.panel.sync) {
@@ -207,7 +206,7 @@ MbgCardPanelController['$inject'] = [
207
206
  '$element',
208
207
  '$attrs',
209
208
  '$timeout',
210
- 'dashboardService',
209
+ // 'dashboardService',
211
210
  '$filter',
212
211
  ]
213
212
 
@@ -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,
@@ -71,7 +71,6 @@ class MbgStatusLabelController {
71
71
  this.label = 'Inutilizada'
72
72
  break
73
73
  case 'TODO':
74
- case 'OPEN':
75
74
  this.label = 'Aberta'
76
75
  break
77
76
  case 'PROCESSED':
@@ -82,9 +81,6 @@ class MbgStatusLabelController {
82
81
  break
83
82
  case 'NOT_PROCESSED':
84
83
  this.label = 'Não processado'
85
- break
86
- default:
87
- this.label = undefined
88
84
  }
89
85
  }
90
86
 
@@ -120,7 +116,6 @@ class MbgStatusLabelController {
120
116
  case 'ENVIADA':
121
117
  case 'NAO_ENVIADA':
122
118
  case 'TODO':
123
- case 'OPEN':
124
119
  this.labelClass = 'light'
125
120
  break
126
121
  case 'REVERSED':
@@ -131,8 +126,6 @@ class MbgStatusLabelController {
131
126
  case 'IN_PROGRESS':
132
127
  this.labelClass = 'primary'
133
128
  break
134
- default:
135
- this.labelClass = undefined
136
129
  }
137
130
  }
138
131
  }
@@ -0,0 +1,8 @@
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 }
@@ -0,0 +1,2 @@
1
+ <div id="container-speed"
2
+ class="chart-container"></div>
@@ -0,0 +1,5 @@
1
+ .chart-container {
2
+ width: 300px;
3
+ height: 200px;
4
+ float: left;
5
+ }
@@ -0,0 +1,141 @@
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
+
22
+ constructor(public $scope, public $element, public $attrs, public $timeout) {}
23
+
24
+ $onInit() {
25
+ const sales = 16000
26
+ const target = 8000
27
+ const percentage = Math.round(((sales / target) * 100) / 10) * 10
28
+ console.log('percentage', percentage)
29
+ const gaugeOptions = {
30
+ chart: {
31
+ type: 'solidgauge',
32
+ },
33
+
34
+ title: null,
35
+
36
+ pane: {
37
+ center: ['50%', '85%'],
38
+ size: '140%',
39
+ startAngle: -90,
40
+ endAngle: 90,
41
+ background: {
42
+ backgroundColor: Highcharts.defaultOptions.legend.backgroundColor || '#fafafa',
43
+ borderRadius: 5,
44
+ innerRadius: '60%',
45
+ outerRadius: '100%',
46
+ shape: 'arc',
47
+ },
48
+ },
49
+
50
+ exporting: {
51
+ enabled: false,
52
+ },
53
+
54
+ tooltip: {
55
+ enabled: false,
56
+ },
57
+
58
+ // the value axis
59
+ yAxis: {
60
+ stops: [
61
+ [0.1, '#DF5353'], // Vermelho para até 10% da meta
62
+ [0.5, '#DDDF0D'], // Amarelo entre 10% e 50%
63
+ [0.9, '#55BF3B'], // Verde para mais de 50%
64
+ ],
65
+ lineWidth: 0,
66
+ tickWidth: 0,
67
+ minorTickInterval: null,
68
+ tickAmount: 2,
69
+ title: {
70
+ y: -70,
71
+ },
72
+ labels: {
73
+ y: 16,
74
+ },
75
+ },
76
+
77
+ plotOptions: {
78
+ solidgauge: {
79
+ borderRadius: 3,
80
+ dataLabels: {
81
+ y: 5,
82
+ borderWidth: 0,
83
+ useHTML: true,
84
+ },
85
+ },
86
+ },
87
+ }
88
+
89
+ // The speed gauge
90
+ const chartSpeed = Highcharts.chart(
91
+ 'container-speed',
92
+ Highcharts.merge(gaugeOptions, {
93
+ yAxis: {
94
+ min: 0,
95
+ max: percentage,
96
+ title: {
97
+ text: 'Speed',
98
+ },
99
+ },
100
+
101
+ credits: {
102
+ enabled: false,
103
+ },
104
+
105
+ series: [
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
+ )
123
+
124
+ this.updateChart(sales, target, chartSpeed)
125
+ }
126
+
127
+ updateChart(newSales, newTarget, chartSpeed) {
128
+ const newPercentage = Math.round(((newSales / newTarget) * 100) / 10) * 10
129
+ const point = chartSpeed.series[0].points[0]
130
+ point.update(newPercentage)
131
+ }
132
+ }
133
+ MbgStoreGoalController['$inject'] = ['$scope', '$element', '$attrs', '$timeout']
134
+
135
+ const mbgStoreGoal = {
136
+ bindings: {},
137
+ template,
138
+ controller: MbgStoreGoalController,
139
+ }
140
+
141
+ 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
- <!-- <div class=""
162
+ <div class=""
163
163
  style="height: 260px">
164
- <mbg-text-editor ng-model="editorJodit"
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>