@things-factory/operato-wms 4.0.11 → 4.0.16

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.
Files changed (161) hide show
  1. package/client/pages/adjustment/transfer-inventory.js +368 -165
  2. package/client/pages/bulk-operation/bulk-operation.js +316 -0
  3. package/client/pages/bulk-operation/validate-ro-popup.js +445 -0
  4. package/client/pages/components/select-product-popup.js +15 -2
  5. package/client/pages/constants/inventory.js +1 -0
  6. package/client/pages/constants/location.js +33 -6
  7. package/client/pages/constants/order.js +10 -0
  8. package/client/pages/constants/worksheet.js +2 -2
  9. package/client/pages/inbound/inbound-worksheet.js +78 -9
  10. package/client/pages/inbound/putaway-product.js +214 -139
  11. package/client/pages/inbound/putaway-worksheet-generate-popup.js +24 -2
  12. package/client/pages/inbound/unload-product.js +149 -76
  13. package/client/pages/inbound/worksheet-putaway-return.js +22 -5
  14. package/client/pages/inbound/worksheet-putaway.js +21 -8
  15. package/client/pages/inbound/worksheet-unloading-return.js +22 -5
  16. package/client/pages/inbound/worksheet-unloading.js +8 -0
  17. package/client/pages/inventory/inventory-adjustment-approval.js +11 -19
  18. package/client/pages/inventory/inventory-adjustment.js +136 -101
  19. package/client/pages/inventory/inventory-by-product-detail.js +3 -5
  20. package/client/pages/inventory/inventory-by-product.js +8 -0
  21. package/client/pages/inventory/inventory-history-by-pallet.js +12 -5
  22. package/client/pages/inventory/inventory-history.js +10 -0
  23. package/client/pages/inventory/onhand-inventory.js +11 -2
  24. package/client/pages/inventory-check/create-cycle-count.js +12 -6
  25. package/client/pages/inventory-check/cycle-count-report.js +8 -0
  26. package/client/pages/inventory-check/inspecting-product.js +146 -80
  27. package/client/pages/inventory-check/worksheet-cycle-count.js +14 -0
  28. package/client/pages/manifest/create-loading-manifest.js +314 -0
  29. package/client/pages/manifest/dispatcher-verification-popup.js +86 -0
  30. package/client/pages/manifest/loading-manifest-detail.js +345 -0
  31. package/client/pages/manifest/loading-manifest-list.js +305 -0
  32. package/client/pages/master/location-list.js +58 -17
  33. package/client/pages/master/product/product-detail-bizplace-setting-popup.js +2 -2
  34. package/client/pages/master/product/product-details-popup.js +2 -2
  35. package/client/pages/master/product/product-list.js +5 -5
  36. package/client/pages/order/arrival-notice/arrival-notice-detail.js +134 -115
  37. package/client/pages/order/arrival-notice/arrival-notice-list.js +87 -6
  38. package/client/pages/order/arrival-notice/arrival-notice-requests.js +83 -6
  39. package/client/pages/order/arrival-notice/assign-buffer-location.js +8 -1
  40. package/client/pages/order/arrival-notice/check-arrived-notice.js +9 -1
  41. package/client/pages/order/arrival-notice/create-arrival-notice.js +38 -3
  42. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +290 -25
  43. package/client/pages/order/arrival-notice/edit-product-popup.js +36 -5
  44. package/client/pages/order/arrival-notice/receive-arrival-notice.js +8 -1
  45. package/client/pages/order/goods-received-note/received-note-list.js +138 -6
  46. package/client/pages/order/release-order/b2b/b2b-order-list.js +45 -5
  47. package/client/pages/order/release-order/b2b/b2b-order-requests.js +52 -12
  48. package/client/pages/order/release-order/b2c/b2c-order-requests.js +244 -24
  49. package/client/pages/order/release-order/bulk-print-packing-list.js +23 -0
  50. package/client/pages/order/release-order/create-release-order.js +55 -8
  51. package/client/pages/order/release-order/receive-release-order-request.js +35 -24
  52. package/client/pages/order/release-order/release-extra-product-popup.js +204 -63
  53. package/client/pages/order/release-order/release-order-detail.js +301 -74
  54. package/client/pages/order/return-order/check-return-order.js +9 -1
  55. package/client/pages/order/return-order/create-return-order.js +14 -2
  56. package/client/pages/order/return-order/receive-return-order-requests.js +9 -1
  57. package/client/pages/order/return-order/return-order-detail.js +15 -6
  58. package/client/pages/order/return-order/return-order-inventory-popup.js +7 -0
  59. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-detail.js +124 -59
  60. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-list.js +1 -6
  61. package/client/pages/order/reverse-kitting-order/reverse-kitting-pallet-label-popup.js +239 -0
  62. package/client/pages/order/transport-order/delivery-order-list.js +102 -59
  63. package/client/pages/outbound/inventory-assign-popup.js +23 -6
  64. package/client/pages/outbound/inventory-auto-assign-popup.js +22 -6
  65. package/client/pages/outbound/loading-product.js +4 -1
  66. package/client/pages/outbound/merged-outbound-worksheet.js +43 -1
  67. package/client/pages/outbound/packing-product.js +4 -1
  68. package/client/pages/outbound/packing-worksheet-list.js +39 -1
  69. package/client/pages/outbound/picking-product.js +803 -431
  70. package/client/pages/outbound/picking-replacement-popup.js +1 -1
  71. package/client/pages/outbound/serial-number-popup.js +280 -0
  72. package/client/pages/outbound/single-outbound-worksheet.js +47 -1
  73. package/client/pages/outbound/worksheet-batch-picking.js +22 -8
  74. package/client/pages/outbound/worksheet-loading.js +22 -5
  75. package/client/pages/outbound/worksheet-packing.js +8 -0
  76. package/client/pages/outbound/worksheet-picking.js +62 -8
  77. package/client/pages/outbound/worksheet-return.js +9 -1
  78. package/client/pages/outbound/worksheet-sorting.js +9 -1
  79. package/client/pages/report/custom-elccl/elccl-inventory-report.js +31 -30
  80. package/client/pages/report/custom-elccl/elccl-inventory-summary-report.js +23 -26
  81. package/client/pages/report/inventory-pallet-storage-report.js +11 -10
  82. package/client/pages/report/inventory-report.js +41 -43
  83. package/client/pages/report/inventory-summary-report.js +25 -28
  84. package/client/pages/report/product-label-report.js +401 -0
  85. package/client/pages/support/inventory-comparison.js +296 -0
  86. package/client/pages/vas/print-product-label.js +298 -132
  87. package/client/pages/vas/reverse-kitting/execute-reverse-kitting.js +38 -23
  88. package/client/pages/vas/reverse-kitting/popup-combination-sets.js +98 -15
  89. package/client/pages/vas/reverse-kitting/popup-reverse-kitting-template.js +129 -21
  90. package/client/pages/vas/vas-pallet-label-popup.js +5 -8
  91. package/client/route.js +28 -0
  92. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js +1 -1
  93. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.js.map +1 -1
  94. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +64 -54
  95. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js.map +1 -1
  96. package/dist-server/graphql/resolvers/extra/add-release-good-products.js +34 -9
  97. package/dist-server/graphql/resolvers/extra/add-release-good-products.js.map +1 -1
  98. package/dist-server/graphql/resolvers/index.js +5 -1
  99. package/dist-server/graphql/resolvers/index.js.map +1 -1
  100. package/dist-server/graphql/resolvers/inventory-comparison/index.js +6 -0
  101. package/dist-server/graphql/resolvers/inventory-comparison/index.js.map +1 -0
  102. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js +78 -0
  103. package/dist-server/graphql/resolvers/inventory-comparison/inventory-comparison-list.js.map +1 -0
  104. package/dist-server/graphql/resolvers/reports/index.js +2 -1
  105. package/dist-server/graphql/resolvers/reports/index.js.map +1 -1
  106. package/dist-server/graphql/resolvers/reports/product-label-report.js +56 -0
  107. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -0
  108. package/dist-server/graphql/resolvers/shipping-provider/index.js +6 -0
  109. package/dist-server/graphql/resolvers/shipping-provider/index.js.map +1 -0
  110. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +20 -0
  111. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +1 -0
  112. package/dist-server/graphql/types/custom/elccl/elccl-inventory-report.js +1 -1
  113. package/dist-server/graphql/types/index.js +8 -2
  114. package/dist-server/graphql/types/index.js.map +1 -1
  115. package/dist-server/graphql/types/inventory-comparison/index.js +13 -0
  116. package/dist-server/graphql/types/inventory-comparison/index.js.map +1 -0
  117. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js +14 -0
  118. package/dist-server/graphql/types/inventory-comparison/inventory-comparison-list.js.map +1 -0
  119. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js +18 -0
  120. package/dist-server/graphql/types/inventory-comparison/inventory-comparison.js.map +1 -0
  121. package/dist-server/graphql/types/reports/index.js +6 -1
  122. package/dist-server/graphql/types/reports/index.js.map +1 -1
  123. package/dist-server/graphql/types/reports/product-label-report-list.js +14 -0
  124. package/dist-server/graphql/types/reports/product-label-report-list.js.map +1 -0
  125. package/dist-server/graphql/types/reports/product-label-report.js +16 -0
  126. package/dist-server/graphql/types/reports/product-label-report.js.map +1 -0
  127. package/dist-server/graphql/types/shipping-provider/index.js +10 -0
  128. package/dist-server/graphql/types/shipping-provider/index.js.map +1 -0
  129. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js +13 -0
  130. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js.map +1 -0
  131. package/dist-server/graphql/types/shipping-provider/shipping-provider.js +13 -0
  132. package/dist-server/graphql/types/shipping-provider/shipping-provider.js.map +1 -0
  133. package/package.json +65 -65
  134. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-report.ts +4 -2
  135. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +75 -65
  136. package/server/graphql/resolvers/extra/add-release-good-products.ts +57 -15
  137. package/server/graphql/resolvers/index.ts +5 -1
  138. package/server/graphql/resolvers/inventory-comparison/index.ts +5 -0
  139. package/server/graphql/resolvers/inventory-comparison/inventory-comparison-list.ts +99 -0
  140. package/server/graphql/resolvers/reports/index.ts +3 -1
  141. package/server/graphql/resolvers/reports/product-label-report.ts +56 -0
  142. package/server/graphql/resolvers/shipping-provider/index.ts +5 -0
  143. package/server/graphql/resolvers/shipping-provider/shipping-providers.ts +20 -0
  144. package/server/graphql/types/custom/elccl/elccl-inventory-report.ts +1 -1
  145. package/server/graphql/types/index.ts +8 -2
  146. package/server/graphql/types/inventory-comparison/index.ts +11 -0
  147. package/server/graphql/types/inventory-comparison/inventory-comparison-list.ts +8 -0
  148. package/server/graphql/types/inventory-comparison/inventory-comparison.ts +12 -0
  149. package/server/graphql/types/reports/index.ts +6 -1
  150. package/server/graphql/types/reports/product-label-report-list.ts +8 -0
  151. package/server/graphql/types/reports/product-label-report.ts +10 -0
  152. package/server/graphql/types/shipping-provider/index.ts +8 -0
  153. package/server/graphql/types/shipping-provider/shipping-provider-list.ts +7 -0
  154. package/server/graphql/types/shipping-provider/shipping-provider.ts +7 -0
  155. package/things-factory.config.js +30 -0
  156. package/translations/en.json +91 -11
  157. package/translations/ko.json +109 -11
  158. package/translations/ms.json +111 -12
  159. package/translations/zh.json +123 -26
  160. package/config.development.js +0 -73
  161. package/config.production.js +0 -113
@@ -10,7 +10,7 @@ import { getPartnerCodeByName } from '@things-factory/code-base'
10
10
  import { i18next, localize } from '@things-factory/i18n-base'
11
11
  import { openPopup } from '@things-factory/layout-base'
12
12
  import { client, PageView, store } from '@things-factory/shell'
13
- import { flattenObject, gqlBuilder, isMobileDevice } from '@things-factory/utils'
13
+ import { flattenObject, isMobileDevice } from '@things-factory/utils'
14
14
 
15
15
  class InventorySummaryReport extends connect(store)(localize(i18next)(PageView)) {
16
16
  static get styles() {
@@ -320,7 +320,7 @@ class InventorySummaryReport extends connect(store)(localize(i18next)(PageView))
320
320
  this._config = this.reportConfig
321
321
  }
322
322
 
323
- async pageUpdated(changes, lifecycle) {
323
+ pageUpdated(changes, lifecycle) {
324
324
  if (this.active) {
325
325
  this.dataGrist.fetch()
326
326
  }
@@ -349,35 +349,32 @@ class InventorySummaryReport extends connect(store)(localize(i18next)(PageView))
349
349
  })
350
350
  const response = await client.query({
351
351
  query: gql`
352
- query {
353
- inventoryHistorySummaryReport(${gqlBuilder.buildArgs({
354
- filters: filter,
355
- pagination: { page, limit },
356
- sortings: sorters
357
- })}) {
358
- items{
359
- batchId
360
- packingType
361
- packingSize
362
- product{
363
- id
364
- sku
365
- name
366
- description
367
- type
368
- }
369
- openingQty
370
- totalInQty
371
- totalOutQty
372
- adjustmentQty
373
- closingQty
352
+ query inventoryHistorySummaryReport($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
353
+ inventoryHistorySummaryReport(filters: $filters, pagination: $pagination, sortings: $sortings) {
354
+ items {
355
+ batchId
356
+ packingType
357
+ packingSize
358
+ product {
359
+ id
360
+ sku
361
+ name
362
+ description
363
+ type
374
364
  }
375
- total
376
- totalInboundQty
377
- totalOpeningBal
365
+ openingQty
366
+ totalInQty
367
+ totalOutQty
368
+ adjustmentQty
369
+ closingQty
378
370
  }
371
+ total
372
+ totalInboundQty
373
+ totalOpeningBal
379
374
  }
380
- `
375
+ }
376
+ `,
377
+ variables: { filters: filter, pagination: { page, limit }, sortings: sorters }
381
378
  })
382
379
 
383
380
  const data = {
@@ -0,0 +1,401 @@
1
+ import '@things-factory/form-ui'
2
+ import '@things-factory/grist-ui'
3
+
4
+ import gql from 'graphql-tag'
5
+ import { css, html } from 'lit-element'
6
+ import { connect } from 'pwa-helpers/connect-mixin'
7
+
8
+ import { i18next, localize } from '@things-factory/i18n-base'
9
+ import { client, PageView, store } from '@things-factory/shell'
10
+
11
+ class ProductLabelReport extends connect(store)(localize(i18next)(PageView)) {
12
+ static get styles() {
13
+ return css`
14
+ :host {
15
+ display: flex;
16
+ flex-direction: column;
17
+ width: 100%;
18
+ }
19
+
20
+ data-report {
21
+ flex: 1;
22
+ }
23
+ `
24
+ }
25
+
26
+ static get properties() {
27
+ return {
28
+ _searchFields: Object,
29
+ _config: Object,
30
+ _partners: Object,
31
+ data: Object
32
+ }
33
+ }
34
+
35
+ get context() {
36
+ return {
37
+ title: i18next.t('title.product_label_report'),
38
+ printable: {
39
+ accept: ['preview'],
40
+ content: this
41
+ },
42
+ exportable: {
43
+ name: i18next.t('title.date_product_label', {
44
+ state: {
45
+ text: (() => {
46
+ let date = new Date()
47
+ return date.getFullYear().toString() + (date.getMonth() + 1).toString() + date.getDate().toString()
48
+ })()
49
+ }
50
+ }),
51
+ data: this._exportableData.bind(this)
52
+ },
53
+ help: 'operato-wms/report/inventory-report'
54
+ }
55
+ }
56
+
57
+ get report() {
58
+ return this.shadowRoot.querySelector('data-report')
59
+ }
60
+
61
+ get searchForm() {
62
+ return this.shadowRoot.querySelector('search-form')
63
+ }
64
+
65
+ get _bizplaceSelector() {
66
+ return this.searchForm.shadowRoot.querySelector('select[name=bizplace]')
67
+ }
68
+
69
+ get _fromDateInput() {
70
+ return this.searchForm.shadowRoot.querySelector('input[name=fromDate]')
71
+ }
72
+
73
+ get _toDateInput() {
74
+ return this.searchForm.shadowRoot.querySelector('input[name=toDate]')
75
+ }
76
+
77
+ render() {
78
+ return html`
79
+ <search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.report.fetch()}></search-form>
80
+
81
+ <data-report .config=${this._config} .fetchHandler=${this.fetchHandler.bind(this)}></data-report>
82
+ `
83
+ }
84
+
85
+ get searchFields() {
86
+ return [
87
+ {
88
+ label: i18next.t('field.company'),
89
+ name: 'bizplace',
90
+ type: 'select',
91
+ options: [
92
+ { value: '' },
93
+ ...this._partners
94
+ .map(partner => {
95
+ return {
96
+ name: `${partner.name} ${partner.description ? `(${partner.description})` : ''}`,
97
+ value: partner.id
98
+ }
99
+ })
100
+ .sort(this._compareValues('name', 'asc'))
101
+ ],
102
+ props: { searchOper: 'eq' }
103
+ },
104
+ {
105
+ label: i18next.t('field.from_date'),
106
+ name: 'fromDate',
107
+ type: 'date',
108
+ props: {
109
+ searchOper: 'eq',
110
+ max: new Date().toISOString().split('T')[0]
111
+ },
112
+ value: (() => {
113
+ let date = new Date()
114
+ date.setMonth(date.getMonth() - 1)
115
+ return date.toISOString().split('T')[0]
116
+ })(),
117
+ handlers: { change: this._modifyDateRange.bind(this) }
118
+ },
119
+ {
120
+ label: i18next.t('field.to_date'),
121
+ name: 'toDate',
122
+ type: 'date',
123
+ props: {
124
+ searchOper: 'eq',
125
+ min: (() => {
126
+ let date = new Date()
127
+ date.setMonth(date.getMonth() - 1)
128
+ return date.toISOString().split('T')[0]
129
+ })(),
130
+ max: new Date().toISOString().split('T')[0]
131
+ },
132
+ value: new Date().toISOString().split('T')[0]
133
+ },
134
+ {
135
+ label: i18next.t('field.product_type'),
136
+ name: 'type',
137
+ type: 'string',
138
+ props: { searchOper: 'in' }
139
+ }
140
+ ]
141
+ }
142
+
143
+ get reportConfig() {
144
+ return {
145
+ rows: {
146
+ selectable: false,
147
+ groups: [{ column: 'type', title: 'Sub Total' }],
148
+ totals: ['count']
149
+ },
150
+ columns: [
151
+ {
152
+ type: 'string',
153
+ name: 'type',
154
+ header: i18next.t('field.type'),
155
+ imex: { header: i18next.t('field.type'), key: 'type', width: 25, type: 'string' },
156
+ width: 400
157
+ },
158
+ {
159
+ type: 'string',
160
+ name: 'date',
161
+ header: i18next.t('field.date'),
162
+ sortable: true,
163
+ imex: { header: i18next.t('field.date'), key: 'createdAt', width: 25, type: 'string' },
164
+ width: 200
165
+ },
166
+ {
167
+ type: 'number',
168
+ name: 'count',
169
+ header: i18next.t('field.count'),
170
+ record: { align: 'center' },
171
+ sortable: true,
172
+ imex: { header: i18next.t('field.count'), key: 'count', width: 25, type: 'string' },
173
+ width: 120
174
+ }
175
+ ]
176
+ }
177
+ }
178
+
179
+ async pageInitialized() {
180
+ this._products = []
181
+ this._partners = [...(await this._fetchPartners())]
182
+
183
+ this._searchFields = this.searchFields
184
+ this._config = this.reportConfig
185
+ }
186
+
187
+ async pageUpdated(changes, lifecycle) {
188
+ if (this.active) {
189
+ this.report.fetch()
190
+ }
191
+ }
192
+
193
+ async fetchHandler({ page, limit, sorters = [] }) {
194
+ // return {
195
+ // total: 0,
196
+ // records: [
197
+ // { productType: 'DRUM', count: 16, createdAt: '2021/10/13' },
198
+ // { productType: 'WOOD', count: 50, createdAt: '2021/10/18' },
199
+ // { productType: 'WOOD', count: 6, createdAt: '2021/10/11' },
200
+ // { productType: 'WOOD', count: 21, createdAt: '2021/10/15' },
201
+ // { productType: 'GSC', count: 30, createdAt: '2021/10/20' },
202
+ // { productType: 'GSC', count: 3, createdAt: '2021/10/11' },
203
+ // { productType: 'WOOD', count: 8, createdAt: '2021/10/12' },
204
+ // { productType: 'FG', count: 4, createdAt: '2021/10/18' },
205
+ // { productType: 'GSC', count: 2, createdAt: '2021/10/14' },
206
+ // { productType: 'GSC', count: 213, createdAt: '2021/10/12' },
207
+ // { productType: 'WOOD', count: 3, createdAt: '2021/10/20' },
208
+ // { productType: 'GSC', count: 51, createdAt: '2021/10/16' },
209
+ // { productType: 'PKG', count: 1, createdAt: '2021/10/18' },
210
+ // { productType: 'GSC', count: 27, createdAt: '2021/10/15' },
211
+ // { productType: 'GSC', count: 174, createdAt: '2021/10/18' }
212
+ // ]
213
+ // }
214
+ try {
215
+ this._validate()
216
+
217
+ var tzoffset = new Date().getTimezoneOffset() * 60
218
+ const response = await client.query({
219
+ query: gql`
220
+ query productLabelReport($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
221
+ productLabelReport(filters: $filters, pagination: $pagination, sortings: $sortings) {
222
+ items {
223
+ type
224
+ date
225
+ count
226
+ bizplace {
227
+ id
228
+ name
229
+ }
230
+ }
231
+ total
232
+ }
233
+ }
234
+ `,
235
+ variables: {
236
+ filters: [...this.searchForm.queryFilters, { name: 'tzoffset', operator: 'custom', value: tzoffset }],
237
+ pagination: { page, limit },
238
+ sortings: sorters
239
+ }
240
+ })
241
+
242
+ return {
243
+ total: response.data.productLabelReport.total,
244
+ records: response.data.productLabelReport.items
245
+ }
246
+
247
+ // @farishelmi any usage for this? If no please remove.
248
+ // return {
249
+ // total: 0,
250
+ // records:
251
+ // response.data.inventoryHistoryReport.map(item => {
252
+ // let date = new Date(parseInt(item.createdAt))
253
+ // return flattenObject({
254
+ // ...item,
255
+ // createdAt:
256
+ // date.getDate().toString() + '/' + (date.getMonth() + 1).toString() + '/' + date.getFullYear().toString()
257
+ // })
258
+ // }) || []
259
+ // }
260
+ } catch (e) {
261
+ this._showToast(e)
262
+ }
263
+ }
264
+
265
+ async _fetchPartners() {
266
+ const filters = []
267
+ const response = await client.query({
268
+ query: gql`
269
+ query partnersBizplaces($filters: [Filter!]) {
270
+ partnersBizplaces(filters: $filters) {
271
+ items {
272
+ id
273
+ name
274
+ description
275
+ }
276
+ }
277
+ }
278
+ `,
279
+ variables: { filters }
280
+ })
281
+
282
+ if (!response.errors) {
283
+ return response.data.partnersBizplaces.items
284
+ }
285
+ }
286
+
287
+ _validate() {
288
+ if (!this.searchForm.shadowRoot.querySelector('form').checkValidity())
289
+ throw new Error(i18next.t('text.invalid_form_value'))
290
+ if (!this._bizplaceSelector.value) throw new Error(i18next.t('text.no_company_selected'))
291
+ if (!this._fromDateInput.value) throw new Error(i18next.t('text.from_date_is_empty'))
292
+ if (!this._toDateInput.value) throw new Error(i18next.t('text.to_date_is_empty'))
293
+ }
294
+
295
+ _modifyDateRange(e) {
296
+ const fromDate = e.currentTarget.value
297
+
298
+ if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
299
+
300
+ let min = new Date(fromDate)
301
+ let today = new Date()
302
+ today.setHours(0, 0, 0, 0)
303
+
304
+ min = min.toISOString().split('T')[0]
305
+
306
+ this._toDateInput.min = min
307
+ }
308
+
309
+ _compareValues(key, order = 'asc') {
310
+ return function innerSort(a, b) {
311
+ if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
312
+ return 0
313
+ }
314
+
315
+ const varA = typeof a[key] === 'string' ? a[key].toUpperCase() : a[key]
316
+ const varB = typeof b[key] === 'string' ? b[key].toUpperCase() : b[key]
317
+
318
+ let comparison = 0
319
+ if (varA > varB) {
320
+ comparison = 1
321
+ } else if (varA < varB) {
322
+ comparison = -1
323
+ }
324
+ return order === 'desc' ? comparison * -1 : comparison
325
+ }
326
+ }
327
+
328
+ // @farishelmi any usage for this function? If no please remove.
329
+ async _bizplaceChange(e) {
330
+ /* let bizplace = [{ name: 'bizplace', operator: 'eq', value: e.currentTarget.value }]
331
+ if (e.currentTarget.value == '') {
332
+ this.searchFields
333
+ this._searchFields.filter(x => x.name == 'product')[0].options = [{ name: 'All', value: '' }]
334
+ this._searchFields = [...this._searchFields]
335
+ } else {
336
+ const response = await client.query({
337
+ query: gql`
338
+ query {
339
+ productsByBizplace(${gqlBuilder.buildArgs({
340
+ filters: [...bizplace]
341
+ })}) {
342
+ items {
343
+ id
344
+ name
345
+ }
346
+ }
347
+ }
348
+ `
349
+ })
350
+
351
+ if (!response.errors) {
352
+ this.searchFields
353
+ this._searchFields.filter(x => x.name == 'product')[0].options = [
354
+ { name: 'All', value: '' },
355
+ ...response.data.productsByBizplace.items.map(item => {
356
+ return {
357
+ name: item.name,
358
+ value: item.id
359
+ }
360
+ })
361
+ ]
362
+ this._searchFields = [...this._searchFields]
363
+ }
364
+ } */
365
+ }
366
+
367
+ _exportableData() {
368
+ try {
369
+ const report = this.report
370
+ var headerSetting = [
371
+ ...report._config.columns
372
+ .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
373
+ .map(column => {
374
+ return column.imex
375
+ })
376
+ ]
377
+
378
+ return {
379
+ header: headerSetting,
380
+ data: report.data.records,
381
+ groups: report._config.rows.groups,
382
+ totals: report._config.rows.totals
383
+ }
384
+ } catch (e) {
385
+ this._showToast(e)
386
+ }
387
+ }
388
+
389
+ _showToast({ type, message }) {
390
+ document.dispatchEvent(
391
+ new CustomEvent('notify', {
392
+ detail: {
393
+ type,
394
+ message
395
+ }
396
+ })
397
+ )
398
+ }
399
+ }
400
+
401
+ window.customElements.define('product-label-report', ProductLabelReport)