@kigi/components 1.43.0 → 1.44.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kigi/components",
3
- "version": "1.43.0",
3
+ "version": "1.44.0-beta.2",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -3,6 +3,9 @@ import template from './mbg-average-customer-time.html'
3
3
  import Highcharts from 'highcharts'
4
4
  import Exporting from 'highcharts/modules/exporting.js'
5
5
  import Accessibility from 'highcharts/modules/accessibility.js'
6
+ import { MbgAlert } from '@kigi/components/src/helpers/services/mbg-alert'
7
+ import { MbgTypeAlert } from '@kigi/components/src/helpers/enums/mbg-type-alert'
8
+ import { ButtonConfirmModal } from '@kigi/components/src/helpers/interfaces/button-confirm-modal'
6
9
 
7
10
  Exporting(Highcharts)
8
11
  Accessibility(Highcharts)
@@ -16,6 +19,7 @@ class MbgAverageCustomerTimeController {
16
19
  private hideValue: boolean = false
17
20
  private boundAdjustContainerWidth
18
21
  private allowDashBoardAutoValues
22
+ private callBackInstanceZapi: Function
19
23
 
20
24
  constructor(
21
25
  public $scope,
@@ -24,6 +28,7 @@ class MbgAverageCustomerTimeController {
24
28
  public $timeout,
25
29
  public $filter,
26
30
  public $state,
31
+ public mbgAlert: MbgAlert,
27
32
  ) {}
28
33
 
29
34
  async $onInit() {
@@ -82,6 +87,61 @@ class MbgAverageCustomerTimeController {
82
87
  }
83
88
  }
84
89
 
90
+ async clickedPoint(clickedPoint) {
91
+ const response = await this.mbgAlert.confirm({
92
+ type: MbgTypeAlert.INFORMATION,
93
+ title: 'Escolha uma Ação',
94
+ message: 'Deseja enviar uma mensagem ou imprimir o relatório?',
95
+ textConfirm: 'Enviar mensagem',
96
+ textCancel: 'Imprimir relatório',
97
+ })
98
+
99
+ if (response) {
100
+ this.sendMensage(clickedPoint)
101
+ }
102
+ }
103
+
104
+ async toKnowZapi(value) {
105
+ const buttons: ButtonConfirmModal[] = [
106
+ {
107
+ label: 'Conhecer Z-API',
108
+ onClick: () => {
109
+ return true
110
+ },
111
+ },
112
+ {
113
+ label: 'Cancelar',
114
+ style: 'LEAKED',
115
+ onClick: () => {
116
+ return false
117
+ },
118
+ },
119
+ ]
120
+
121
+ const response = await this.mbgAlert.confirm({
122
+ title: 'Atenção',
123
+ type: MbgTypeAlert.WARNING,
124
+ visibleCancel: false,
125
+ message:
126
+ 'Para envio de mensagens deve-se contratar Z-API. Caso ainda não tenha feito o contrato de teste, faça um teste de 2 dias.',
127
+ buttons,
128
+ })
129
+ console.log('response', response)
130
+ if (!response) return
131
+ return this.$state.go('app.mobi-store.form', { doc: 'Z-API' })
132
+ }
133
+
134
+ async sendMensage(clickedPoint) {
135
+ if (this.callBackInstanceZapi) {
136
+ await this.callBackInstanceZapi()
137
+ return
138
+ }
139
+ const interval = this.percentagesReturnCustomerTime.find(
140
+ (person) => person.days === Number(clickedPoint.name),
141
+ )
142
+ this.$state.go('app.individual-messages.individual-messages', { ids: interval.ids })
143
+ }
144
+
85
145
  configPanelPercentagesReturnCustomerTime() {
86
146
  const colors = ['#696EF0', '#45C413', '#F8D658', '#F5AE3C', '#FF8A22', '#FF4641']
87
147
  const hasPermissionPorcentages = this.hideValue
@@ -195,6 +255,14 @@ class MbgAverageCustomerTimeController {
195
255
  },
196
256
  },
197
257
  showInLegend: true,
258
+ point: {
259
+ events: {
260
+ click: async function (event) {
261
+ const clickedPoint = event.point
262
+ await this.clickedPoint(clickedPoint)
263
+ }.bind(this),
264
+ },
265
+ },
198
266
  },
199
267
  },
200
268
  tooltip: {
@@ -249,6 +317,7 @@ MbgAverageCustomerTimeController['$inject'] = [
249
317
  '$timeout',
250
318
  '$filter',
251
319
  '$state',
320
+ 'mbgAlert',
252
321
  ]
253
322
 
254
323
  const mbgAverageCustomerTime = {
@@ -259,6 +328,7 @@ const mbgAverageCustomerTime = {
259
328
  allowedCallBack: '&?',
260
329
  isBlockValuesDashboarReturnCustomer: '=?',
261
330
  allowDashBoardAutoValues: '=?',
331
+ callBackInstanceZapi: '&?',
262
332
  },
263
333
  template,
264
334
  controller: MbgAverageCustomerTimeController,
@@ -6,6 +6,7 @@ import { UploadImageCropModal } from './modals/upload-image-crop-modal'
6
6
  class ImageUploadCropController {
7
7
  public config: IConfigImageUploadCrop
8
8
  public ngModel: string
9
+ private callBackImage: Function
9
10
 
10
11
  constructor(
11
12
  public $scope,
@@ -27,12 +28,18 @@ class ImageUploadCropController {
27
28
  removeImage(e) {
28
29
  e.stopPropagation()
29
30
  this.ngModel = ''
31
+ if (this.callBackImage) {
32
+ this.callBackImage({ value: 'REMOVE' })
33
+ }
30
34
  }
31
35
 
32
36
  openModal(e) {
33
37
  this.uploadImageCropModal.open(this.config, this.ngModel).then((url) => {
34
38
  if (url) {
35
39
  this.ngModel = url
40
+ if (this.callBackImage) {
41
+ this.callBackImage({ value: 'UPLOAD' })
42
+ }
36
43
  }
37
44
  })
38
45
  }
@@ -42,6 +49,7 @@ const imageUploadCrop = {
42
49
  bindings: {
43
50
  ngModel: '=?',
44
51
  config: '=?',
52
+ callBackImage: '&?',
45
53
  },
46
54
  controller: ImageUploadCropController,
47
55
  template,