@things-factory/operato-wms 3.6.37 → 3.6.41

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 (52) hide show
  1. package/client/pages/constants/order.js +1 -0
  2. package/client/pages/inbound/unload-product.js +0 -1
  3. package/client/pages/order/release-order/b2c/b2c-order-requests.js +35 -0
  4. package/client/pages/order/release-order/bulk-print-packing-list.js +278 -0
  5. package/client/pages/order/return-order/create-return-order.js +2 -4
  6. package/client/pages/outbound/inventory-assign-popup.js +9 -0
  7. package/client/pages/outbound/inventory-auto-assign-popup.js +9 -5
  8. package/client/pages/outbound/packing-product.js +16 -26
  9. package/client/pages/outbound/worksheet-batch-picking.js +26 -11
  10. package/client/pages/outbound/worksheet-picking.js +35 -10
  11. package/client/pages/vas/print-product-label.js +159 -17
  12. package/client/route.js +4 -0
  13. package/config.development.js +95 -0
  14. package/config.production.js +90 -0
  15. package/dist-server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.js +1 -1
  16. package/dist-server/graphql/resolvers/dashboard/arrival-notices-by-status.js +24 -0
  17. package/dist-server/graphql/resolvers/dashboard/arrival-notices-by-status.js.map +1 -0
  18. package/dist-server/graphql/resolvers/dashboard/collection-orders-by-status.js +24 -0
  19. package/dist-server/graphql/resolvers/dashboard/collection-orders-by-status.js.map +1 -0
  20. package/dist-server/graphql/resolvers/dashboard/delivery-orders-by-status.js +24 -0
  21. package/dist-server/graphql/resolvers/dashboard/delivery-orders-by-status.js.map +1 -0
  22. package/dist-server/graphql/resolvers/dashboard/index.js +9 -0
  23. package/dist-server/graphql/resolvers/dashboard/index.js.map +1 -0
  24. package/dist-server/graphql/resolvers/dashboard/release-goods-by-status.js +24 -0
  25. package/dist-server/graphql/resolvers/dashboard/release-goods-by-status.js.map +1 -0
  26. package/dist-server/graphql/resolvers/index.js +10 -2
  27. package/dist-server/graphql/resolvers/index.js.map +1 -1
  28. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js +2 -1
  29. package/dist-server/graphql/resolvers/reports/outbound-order-details-report.js.map +1 -1
  30. package/dist-server/graphql/types/dashboard/index.js +12 -0
  31. package/dist-server/graphql/types/dashboard/index.js.map +1 -0
  32. package/dist-server/graphql/types/dashboard/order-status-counter.js +14 -0
  33. package/dist-server/graphql/types/dashboard/order-status-counter.js.map +1 -0
  34. package/dist-server/graphql/types/index.js +17 -3
  35. package/dist-server/graphql/types/index.js.map +1 -1
  36. package/package.json +39 -38
  37. package/server/graphql/resolvers/custom/elccl/elccl-inventory-history-summary-report.ts +1 -1
  38. package/server/graphql/resolvers/dashboard/arrival-notices-by-status.ts +25 -0
  39. package/server/graphql/resolvers/dashboard/collection-orders-by-status.ts +25 -0
  40. package/server/graphql/resolvers/dashboard/delivery-orders-by-status.ts +25 -0
  41. package/server/graphql/resolvers/dashboard/index.ts +11 -0
  42. package/server/graphql/resolvers/dashboard/release-goods-by-status.ts +25 -0
  43. package/server/graphql/resolvers/index.ts +10 -2
  44. package/server/graphql/resolvers/reports/outbound-order-details-report.ts +2 -1
  45. package/server/graphql/types/dashboard/index.ts +9 -0
  46. package/server/graphql/types/dashboard/order-status-counter.ts +8 -0
  47. package/server/graphql/types/index.ts +17 -3
  48. package/things-factory.config.js +4 -0
  49. package/translations/en.json +5 -0
  50. package/translations/ko.json +5 -0
  51. package/translations/ms.json +5 -0
  52. package/translations/zh.json +7 -2
@@ -53,6 +53,7 @@ export const ORDER_STATUS = {
53
53
  INPROCESS: { name: 'order_status_in_process', value: 'INPROCESS' },
54
54
  READY_TO_PICK: { name: 'order_status_ready_to_pick', value: 'READY_TO_PICK' },
55
55
  PICKING: { name: 'order_status_picking', value: 'PICKING' },
56
+ PACKING: { name: 'order_status_packing', value: 'PACKING' },
56
57
  LOADING: { name: 'order_status_loading', value: 'LOADING' },
57
58
  READY_TO_DISPATCH: { name: 'order_status_ready_to_dispatch', value: 'READY_TO_DISPATCH' },
58
59
  READY_TO_EXECUTE: { name: 'order_status_ready_to_execute', value: 'READY_TO_EXECUTE' },
@@ -19,7 +19,6 @@ import './select-product-batch'
19
19
  import orderBy from 'lodash/orderBy'
20
20
 
21
21
  const AVAIL_ORDER_TYPES = { ARRIVAL_NOTICE, RETURN_ORDER }
22
-
23
22
  class UnloadProduct extends connect(store)(localize(i18next)(PageView)) {
24
23
  static get properties() {
25
24
  return {
@@ -61,6 +61,11 @@ class B2cOrderRequests extends localize(i18next)(PageView) {
61
61
  return {
62
62
  title: i18next.t('title.release_order_requests'),
63
63
  actions: [
64
+ {
65
+ title: i18next.t('button.generate_packing_list'),
66
+ action: this._generatePackingList.bind(this),
67
+ ...CommonButtonStyles.label
68
+ },
64
69
  {
65
70
  title: i18next.t('button.batch_picking'),
66
71
  action: this._openBatchPickingPopup.bind(this),
@@ -139,6 +144,7 @@ class B2cOrderRequests extends localize(i18next)(PageView) {
139
144
  list: { fields: ['name', 'bizplace', 'releaseDate', 'status', 'updatedAt'] },
140
145
  columns: [
141
146
  { type: 'gutter', gutterName: 'sequence' },
147
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
142
148
  {
143
149
  type: 'gutter',
144
150
  gutterName: 'button',
@@ -298,6 +304,35 @@ class B2cOrderRequests extends localize(i18next)(PageView) {
298
304
  }
299
305
  }
300
306
 
307
+ _generatePackingList() {
308
+ try {
309
+ if (this.dataGrist.selected?.length == 0) {
310
+ throw new Error(i18next.t('text.select_orders_to_generate_merged_packing_list_for_printing'))
311
+ }
312
+
313
+ let roNos =
314
+ this.dataGrist.selected
315
+ .filter(
316
+ record =>
317
+ record.status === ORDER_STATUS.READY_TO_PICK.value ||
318
+ record.status === ORDER_STATUS.PICKING.value ||
319
+ record.status === ORDER_STATUS.PACKING.value ||
320
+ record.status === ORDER_STATUS.LOADING.value
321
+ )
322
+ .map(record => record.name) || []
323
+
324
+ if (roNos?.length) {
325
+ const searchParams = new URLSearchParams()
326
+ searchParams.append('orderNo', roNos)
327
+ navigate(`bulk_print_packing_list?${searchParams.toString()}`)
328
+ } else {
329
+ throw new Error(i18next.t('text.order_status_not_qualified_for_bulk_printing_packing_list'))
330
+ }
331
+ } catch (e) {
332
+ this._showToast(e)
333
+ }
334
+ }
335
+
301
336
  _openBatchPickingPopup() {
302
337
  openPopup(
303
338
  html`
@@ -0,0 +1,278 @@
1
+ import '@things-factory/grist-ui'
2
+ import '@things-factory/barcode-ui'
3
+
4
+ import gql from 'graphql-tag'
5
+ import { css, html } from 'lit-element'
6
+
7
+ import { MultiColumnFormStyles } from '@things-factory/form-ui'
8
+ import { i18next, localize } from '@things-factory/i18n-base'
9
+ import { client, PageView } from '@things-factory/shell'
10
+ import { CommonButtonStyles } from '@things-factory/styles'
11
+ import { isMobileDevice } from '@things-factory/utils'
12
+
13
+ class BulkPrintPackingList extends localize(i18next)(PageView) {
14
+ static get properties() {
15
+ return {
16
+ pickingListConfig: Object,
17
+ orderNos: Array,
18
+ releaseOrders: Array
19
+ }
20
+ }
21
+
22
+ static get styles() {
23
+ return [
24
+ MultiColumnFormStyles,
25
+ css`
26
+ :host {
27
+ overflow-x: auto;
28
+ }
29
+ section {
30
+ display: flex;
31
+ flex-direction: column;
32
+ }
33
+ .form-container {
34
+ display: flex;
35
+ }
36
+ .form-container > form {
37
+ flex: 1;
38
+ }
39
+ barcode-tag {
40
+ width: 100px;
41
+ height: 100px;
42
+ margin: 10px;
43
+ }
44
+ .grist {
45
+ background-color: var(--main-section-background-color);
46
+ display: flex;
47
+ flex-direction: row;
48
+ flex: 1;
49
+ overflow-y: auto;
50
+ }
51
+ .grist-column {
52
+ flex: 1;
53
+ display: flex;
54
+ flex-direction: column;
55
+ overflow: auto;
56
+ }
57
+ data-grist {
58
+ overflow-y: hidden;
59
+ flex: 1;
60
+ }
61
+ h2 {
62
+ padding: var(--subtitle-padding);
63
+ font: var(--subtitle-font);
64
+ color: var(--subtitle-text-color);
65
+ border-bottom: var(--subtitle-border-bottom);
66
+ }
67
+ .grist h2 {
68
+ margin: var(--grist-title-margin);
69
+ border: var(--grist-title-border);
70
+ font: var(--grist-title-font);
71
+ color: var(--secondary-color);
72
+ }
73
+
74
+ .grist h2 mwc-icon {
75
+ vertical-align: middle;
76
+ margin: var(--grist-title-icon-margin);
77
+ font-size: var(--grist-title-icon-size);
78
+ color: var(--grist-title-icon-color);
79
+ }
80
+
81
+ h2 + data-grist {
82
+ padding-top: var(--grist-title-with-grid-padding);
83
+ }
84
+
85
+ @media print {
86
+ section {
87
+ break-before: page;
88
+ break-after: page;
89
+
90
+ margin: 0;
91
+ padding: 0;
92
+ }
93
+ }
94
+ `
95
+ ]
96
+ }
97
+
98
+ get context() {
99
+ var actions = [
100
+ {
101
+ title: i18next.t('button.back_to_list'),
102
+ action: () => history.back(),
103
+ ...CommonButtonStyles.back
104
+ }
105
+ ]
106
+
107
+ return {
108
+ title: i18next.t('title.bulk_print_packing_list'),
109
+ actions,
110
+ printable: {
111
+ accept: ['preview'],
112
+ content: this
113
+ }
114
+ }
115
+ }
116
+
117
+ render() {
118
+ const releaseOrders = this.releaseOrders
119
+
120
+ return html` ${releaseOrders.map(releaseOrder => {
121
+ const orderInventories = {
122
+ records: (releaseOrder.orderInventories || []).map(orderInventory => {
123
+ return {
124
+ ...orderInventory,
125
+ productName: orderInventory.product.name,
126
+ sku: orderInventory.product.sku,
127
+ uom: orderInventory.inventory.uom
128
+ }
129
+ })
130
+ }
131
+ return html`
132
+ <section>
133
+ <div class="form-container">
134
+ <form name="releaseOrder" class="multi-column-form">
135
+ <fieldset>
136
+ <legend>${releaseOrder.name}</legend>
137
+ <label>${i18next.t('label.company')}</label>
138
+ <input name="bizplaceName" value="${releaseOrder?.bizplace.name}" readonly />
139
+
140
+ <label>${i18next.t('label.ref_no')}</label>
141
+ <input name="refNo" value="${releaseOrder?.refNo || ''}" readonly />
142
+
143
+ <label>${i18next.t('label.ref_no_2')}</label>
144
+ <input name="refNo2" value="${releaseOrder?.refNo2 || ''}" readonly />
145
+
146
+ <label>${i18next.t('label.ref_no_3')}</label>
147
+ <input name="refNo3" value="${releaseOrder?.refNo3 || ''}" readonly />
148
+
149
+ <label>${i18next.t('label.release_date')}</label>
150
+ <input name="releaseDate" type="date" value="${releaseOrder.releaseDate}" readonly />
151
+ </fieldset>
152
+ </form>
153
+
154
+ <barcode-tag bcid="qrcode" .value=${releaseOrder.name}></barcode-tag>
155
+ </div>
156
+
157
+ <div class="grist">
158
+ <data-grist
159
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
160
+ .config=${this.pickingListConfig}
161
+ .data=${orderInventories}
162
+ ></data-grist>
163
+ </div>
164
+ </section>
165
+ `
166
+ })}`
167
+ }
168
+
169
+ async pageUpdated(changes, lifecycle) {
170
+ if (this.active) {
171
+ this.orderNos = lifecycle.params.orderNo.split(',') || []
172
+ await this.fetchReleaseOrders()
173
+ }
174
+ }
175
+
176
+ get pickingListGrist() {
177
+ return this.shadowRoot.querySelector('data-grist')
178
+ }
179
+
180
+ pageInitialized() {
181
+ this.pickingListConfig = {
182
+ pagination: { infinite: true },
183
+ rows: { appendable: false },
184
+ columns: [
185
+ { type: 'gutter', gutterName: 'sequence' },
186
+ {
187
+ type: 'string',
188
+ name: 'sku',
189
+ header: i18next.t('field.sku'),
190
+ width: 120
191
+ },
192
+ {
193
+ type: 'string',
194
+ name: 'productName',
195
+ header: i18next.t('field.name'),
196
+ width: 180
197
+ },
198
+ {
199
+ type: 'string',
200
+ name: 'packingType',
201
+ header: i18next.t('field.packing_type'),
202
+ width: 180
203
+ },
204
+ {
205
+ type: 'float',
206
+ name: 'packingSize',
207
+ header: i18next.t('field.packing_size'),
208
+ width: 100
209
+ },
210
+ {
211
+ type: 'number',
212
+ name: 'releaseQty',
213
+ header: i18next.t('field.qty'),
214
+ width: 100
215
+ },
216
+ {
217
+ type: 'number',
218
+ name: 'releaseUomValue',
219
+ header: i18next.t('field.uom_value'),
220
+ width: 120
221
+ },
222
+ {
223
+ type: 'string',
224
+ name: 'uom',
225
+ header: i18next.t('field.uom'),
226
+ width: 120
227
+ }
228
+ ]
229
+ }
230
+ }
231
+
232
+ async fetchReleaseOrders() {
233
+ if (!this.orderNos?.length) return
234
+ const response = await client.query({
235
+ query: gql`
236
+ query releaseGoods($filters: [Filter], $sortings: [Sorting]) {
237
+ releaseGoods(filters: $filters, sortings: $sortings) {
238
+ items {
239
+ id
240
+ name
241
+ refNo
242
+ refNo2
243
+ refNo3
244
+ releaseDate
245
+ bizplace {
246
+ id
247
+ name
248
+ }
249
+ orderInventories {
250
+ id
251
+ releaseQty
252
+ packingType
253
+ packingSize
254
+ releaseUomValue
255
+ inventory {
256
+ uom
257
+ }
258
+ product {
259
+ sku
260
+ name
261
+ }
262
+ }
263
+ }
264
+ }
265
+ }
266
+ `,
267
+ variables: {
268
+ filters: [{ name: 'name', operator: 'in', value: this.orderNos }],
269
+ sortings: [{ name: 'updatedAt', desc: true }]
270
+ }
271
+ })
272
+
273
+ if (!response.errors) {
274
+ this.releaseOrders = response.data.releaseGoods.items || []
275
+ }
276
+ }
277
+ }
278
+ window.customElements.define('bulk-print-packing-list', BulkPrintPackingList)
@@ -754,8 +754,7 @@ class CreateReturnOrder extends localize(i18next)(PageView) {
754
754
  let returnOrder = this._serializeForm(this.returnOrderForm)
755
755
  delete returnOrder.warehouseTransport
756
756
  returnOrder.orderInventories = this._getOrderInventories()
757
- returnOrder.ownTransport = this._ownTransport
758
-
757
+ returnOrder.ownTransport = this._ownTransport
759
758
  const attachments = this._document?.files ? this._document.files : undefined
760
759
  const response = await client.mutate({
761
760
  mutation: gql`
@@ -787,11 +786,10 @@ class CreateReturnOrder extends localize(i18next)(PageView) {
787
786
  remark: record?.remark ? '[RETURN]' + record.remark : '[RETURN]',
788
787
  batchId: record?.batchId,
789
788
  packingType: record?.packingType,
790
- packingSize: record.inventory.packingSize,
789
+ packingSize: record?.packingSize,
791
790
  type: ORDER_TYPES.RETURN_ORDER.value,
792
791
  status: ORDER_INVENTORY_STATUS.PENDING.value
793
792
  }
794
-
795
793
  newRecord.product = { id: record?.productId, name: record?.productName }
796
794
  newRecord.inventory = { id: record.id }
797
795
  return newRecord
@@ -20,6 +20,7 @@ class InventoryAssignPopup extends localize(i18next)(LitElement) {
20
20
  productSku: String,
21
21
  bizplaceId: String,
22
22
  packingType: String,
23
+ packingSize: Number,
23
24
  worksheetType: String,
24
25
  releaseQty: Number,
25
26
  releaseUomValue: Number,
@@ -248,6 +249,7 @@ class InventoryAssignPopup extends localize(i18next)(LitElement) {
248
249
  $productName: String!
249
250
  $productSku: String!
250
251
  $packingType: String!
252
+
251
253
  $pickingStrategy: String!
252
254
  $locationSortingRules: [Sorting]
253
255
  ) {
@@ -258,6 +260,7 @@ class InventoryAssignPopup extends localize(i18next)(LitElement) {
258
260
  productName: $productName
259
261
  productSku: $productSku
260
262
  packingType: $packingType
263
+
261
264
  pickingStrategy: $pickingStrategy
262
265
  locationSortingRules: $locationSortingRules
263
266
  ) {
@@ -292,6 +295,7 @@ class InventoryAssignPopup extends localize(i18next)(LitElement) {
292
295
  productName: this.productName,
293
296
  productSku: this.productSku,
294
297
  packingType: this.packingType,
298
+ packingSize: this.packingSize,
295
299
  pickingStrategy: this.selectedStrategy,
296
300
  locationSortingRules: this.locationSortingRules
297
301
  }
@@ -429,6 +433,7 @@ class InventoryAssignPopup extends localize(i18next)(LitElement) {
429
433
  $batchId: String!
430
434
  $productId: String!
431
435
  $packingType: String!
436
+
432
437
  $worksheetDetails: [NewWorksheetDetail]
433
438
  ) {
434
439
  generateBatchPickingWorksheetDetails(
@@ -436,6 +441,7 @@ class InventoryAssignPopup extends localize(i18next)(LitElement) {
436
441
  batchId: $batchId
437
442
  productId: $productId
438
443
  packingType: $packingType
444
+
439
445
  worksheetDetails: $worksheetDetails
440
446
  )
441
447
  }
@@ -458,6 +464,7 @@ class InventoryAssignPopup extends localize(i18next)(LitElement) {
458
464
  $batchId: String!
459
465
  $productId: String!
460
466
  $packingType: String!
467
+ $packingSize: Float!
461
468
  $worksheetDetails: [NewWorksheetDetail]
462
469
  ) {
463
470
  generateReleaseGoodWorksheetDetails(
@@ -465,6 +472,7 @@ class InventoryAssignPopup extends localize(i18next)(LitElement) {
465
472
  batchId: $batchId
466
473
  productId: $productId
467
474
  packingType: $packingType
475
+ packingSize: $packingSize
468
476
  worksheetDetails: $worksheetDetails
469
477
  )
470
478
  }
@@ -474,6 +482,7 @@ class InventoryAssignPopup extends localize(i18next)(LitElement) {
474
482
  batchId: this.batchId,
475
483
  productId: this.productId,
476
484
  packingType: this.packingType,
485
+ packingSize: this.packingSize,
477
486
  worksheetDetails: this._composeWorksheetDetails()
478
487
  }
479
488
  })
@@ -125,7 +125,7 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
125
125
  },
126
126
  {
127
127
  type: 'string',
128
- name: 'sku',
128
+ name: 'productSku',
129
129
  header: i18next.t('field.sku'),
130
130
  width: 100
131
131
  },
@@ -195,7 +195,6 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
195
195
  allowOutsideClick: true,
196
196
  allowEscapeKey: true
197
197
  })
198
-
199
198
  //// Note: Batch picking has been moved to server side processing.
200
199
  switch (this.worksheetType) {
201
200
  case WORKSHEET_TYPE.PICKING.value:
@@ -229,7 +228,7 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
229
228
  }
230
229
  }
231
230
 
232
- async fetchInventoriesByStrategy({ batchId, product, packingType }, pickingStrategy, bizplaceId) {
231
+ async fetchInventoriesByStrategy({ batchId, product, packingType, packingSize }, pickingStrategy, bizplaceId) {
233
232
  const productName = product.name
234
233
  const productSku = product.sku
235
234
  const response = await client.query({
@@ -241,6 +240,7 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
241
240
  $productName: String!
242
241
  $productSku: String!
243
242
  $packingType: String!
243
+
244
244
  $pickingStrategy: String!
245
245
  ) {
246
246
  inventoriesByStrategy(
@@ -250,6 +250,7 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
250
250
  productName: $productName
251
251
  productSku: $productSku
252
252
  packingType: $packingType
253
+
253
254
  pickingStrategy: $pickingStrategy
254
255
  ) {
255
256
  items {
@@ -274,6 +275,7 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
274
275
  productName,
275
276
  productSku,
276
277
  packingType,
278
+ packingSize,
277
279
  pickingStrategy
278
280
  }
279
281
  })
@@ -337,7 +339,7 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
337
339
  return worksheetDetails
338
340
  }
339
341
 
340
- async submitPickedItems(worksheetNo, { batchId, product, packingType }, worksheetDetails) {
342
+ async submitPickedItems(worksheetNo, { batchId, product, packingType, packingSize }, worksheetDetails) {
341
343
  try {
342
344
  await client.mutate({
343
345
  mutation: gql`
@@ -346,6 +348,7 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
346
348
  $batchId: String!
347
349
  $productId: String!
348
350
  $packingType: String!
351
+ $packingSize: Float!
349
352
  $worksheetDetails: [NewWorksheetDetail]
350
353
  ) {
351
354
  generateReleaseGoodWorksheetDetails(
@@ -353,11 +356,12 @@ class InventoryAutoAssignPopup extends localize(i18next)(LitElement) {
353
356
  batchId: $batchId
354
357
  productId: $productId
355
358
  packingType: $packingType
359
+ packingSize: $packingSize
356
360
  worksheetDetails: $worksheetDetails
357
361
  )
358
362
  }
359
363
  `,
360
- variables: { worksheetNo, batchId, productId: product.id, packingType, worksheetDetails }
364
+ variables: { worksheetNo, batchId, productId: product.id, packingType, packingSize, worksheetDetails }
361
365
  })
362
366
  } catch (e) {
363
367
  this._showToast(e)
@@ -6,6 +6,7 @@ import gql from 'graphql-tag'
6
6
  import { css, html } from 'lit-element'
7
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
8
8
 
9
+ import { GhostPrint } from '@operato/ghost-print'
9
10
  import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
10
11
  import { i18next, localize } from '@things-factory/i18n-base'
11
12
  import { openPopup } from '@things-factory/layout-base'
@@ -701,37 +702,26 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
701
702
  }
702
703
  }
703
704
 
704
- _callPrintDialog(contentSource) {
705
- const iframe = document.createElement('iframe')
706
- iframe.style.display = 'none'
707
- document.body.appendChild(iframe)
708
-
705
+ async _callPrintDialog(contentSource) {
709
706
  switch (this.platform) {
710
- case 'shopee':
711
- iframe.src = contentSource
712
- iframe.onload = () => {
713
- iframe.focus()
714
- iframe.contentWindow.print()
715
- this._showToast({ message: i18next.t('text.document_has_been_generated') })
716
- }
717
- break
718
-
719
707
  case 'lazada':
720
- iframe.contentDocument.body.innerHTML = contentSource
721
- setTimeout(() => {
722
- iframe.focus()
723
- iframe.contentWindow.print()
724
- this._showToast({ message: i18next.t('text.document_has_been_generated') })
725
- }, 1000)
708
+ GhostPrint.print({
709
+ srcdoc: contentSource,
710
+ pending: 1000,
711
+ onfinish: () => {
712
+ this._showToast({ message: i18next.t('text.document_has_been_generated') })
713
+ }
714
+ })
726
715
  break
727
716
 
717
+ case 'shopee':
728
718
  default:
729
- iframe.src = contentSource
730
- iframe.onload = () => {
731
- iframe.focus()
732
- iframe.contentWindow.print()
733
- this._showToast({ message: i18next.t('text.document_has_been_generated') })
734
- }
719
+ GhostPrint.print({
720
+ src: contentSource,
721
+ onfinish: () => {
722
+ this._showToast({ message: i18next.t('text.document_has_been_generated') })
723
+ }
724
+ })
735
725
  break
736
726
  }
737
727
  }