@things-factory/operato-mms 4.0.0-alpha.7 → 4.0.0-beta.1

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 (71) hide show
  1. package/Dockerfile +2 -1
  2. package/client/bootstrap.js +32 -16
  3. package/client/components/marketplace-order-max-weight.js +158 -0
  4. package/client/components/mms-home-cards.js +1 -1
  5. package/client/components/stock-allocation-ratio.js +17 -23
  6. package/client/pages/catalogue/products.js +2 -1
  7. package/client/pages/catalogue/warehouse-products.js +2 -1
  8. package/client/pages/catalogue-variation/product-variations.js +72 -15
  9. package/client/pages/inventory/inventory-by-product.js +3 -2
  10. package/client/pages/order/logistics/batch-init-popup.js +566 -0
  11. package/client/pages/order/logistics/lazada-order-init-batch-popup.js +233 -21
  12. package/client/pages/order/logistics/order-shipping-items.js +47 -16
  13. package/client/pages/order/logistics/order-shipping.js +7 -4
  14. package/client/pages/order/logistics/request-ro-popup.js +104 -17
  15. package/client/pages/order/logistics/shopee-order-init-batch-popup.js +431 -129
  16. package/client/pages/order/order-by-store.js +176 -149
  17. package/client/pages/setting/marketplace-setting.js +12 -0
  18. package/dist-server/graphql/index.js +1 -1
  19. package/dist-server/graphql/resolvers/index.js +1 -1
  20. package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js +74 -13
  21. package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js.map +1 -1
  22. package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js +74 -13
  23. package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js.map +1 -1
  24. package/dist-server/graphql/resolvers/interface-with-hub/generate-replenishment-order.js +1 -1
  25. package/dist-server/graphql/resolvers/interface-with-hub/generate-replenishment-order.js.map +1 -1
  26. package/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js +53 -36
  27. package/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js.map +1 -1
  28. package/dist-server/graphql/resolvers/warehouse-product/auto-link-warehouse-marketplace-product-variations.js +5 -5
  29. package/dist-server/graphql/resolvers/warehouse-product/auto-link-warehouse-marketplace-product-variations.js.map +1 -1
  30. package/dist-server/graphql/types/index.js +1 -1
  31. package/dist-server/graphql/types/interface-with-hub/new-stock-replenishment.js +1 -1
  32. package/dist-server/graphql/types/interface-with-hub/new-stock-replenishment.js.map +1 -1
  33. package/dist-server/graphql/types/interface-with-hub/replenishment-order-product.js +1 -1
  34. package/dist-server/graphql/types/interface-with-hub/replenishment-order-product.js.map +1 -1
  35. package/dist-server/graphql/types/interface-with-hub/stock-replenishment-list.js +1 -1
  36. package/dist-server/graphql/types/interface-with-hub/stock-replenishment-list.js.map +1 -1
  37. package/dist-server/graphql/types/interface-with-hub/stock-replenishment.js +1 -1
  38. package/dist-server/graphql/types/interface-with-hub/stock-replenishment.js.map +1 -1
  39. package/dist-server/graphql/types/interface-with-hub/warehouse-inventory.js +1 -1
  40. package/dist-server/graphql/types/interface-with-hub/warehouse-inventory.js.map +1 -1
  41. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product-list.js +1 -1
  42. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product-list.js.map +1 -1
  43. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product.js +1 -1
  44. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product.js.map +1 -1
  45. package/dist-server/graphql/types/warehouse-product/warehouse-product.js +1 -1
  46. package/dist-server/graphql/types/warehouse-product/warehouse-product.js.map +1 -1
  47. package/dist-server/index.js +1 -1
  48. package/dist-server/migrations/1599732967233-SeedCommonCode.js +5 -5
  49. package/dist-server/migrations/1599732967233-SeedCommonCode.js.map +1 -1
  50. package/dist-server/migrations/1608009991075-SeedUser.js +4 -4
  51. package/dist-server/migrations/1608009991075-SeedUser.js.map +1 -1
  52. package/dist-server/routers/etrax-router.js +7 -6
  53. package/dist-server/routers/etrax-router.js.map +1 -1
  54. package/dist-server/routers/shopify-pos-public-router.js +10 -10
  55. package/dist-server/routers/shopify-pos-public-router.js.map +1 -1
  56. package/dist-server/util/interface-helper.js +2 -2
  57. package/dist-server/util/interface-helper.js.map +1 -1
  58. package/dist-server/util/no-generator.js +2 -2
  59. package/dist-server/util/no-generator.js.map +1 -1
  60. package/package.json +65 -63
  61. package/server/graphql/resolvers/interface-with-hub/add-release-order.ts +83 -14
  62. package/server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts +79 -11
  63. package/server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.ts +50 -33
  64. package/server/routers/etrax-router.ts +6 -4
  65. package/translations/en.json +16 -0
  66. package/translations/ko.json +14 -0
  67. package/translations/ms.json +14 -0
  68. package/translations/zh.json +14 -0
  69. package/views/auth-page.html +1 -1
  70. package/views/public/home.html +1 -1
  71. package/config.development.js +0 -54
@@ -1,10 +1,13 @@
1
1
  import '@material/mwc-button'
2
- import { i18next } from '@things-factory/i18n-base'
2
+
3
+ import gql from 'graphql-tag'
4
+ import { css, html, LitElement } from 'lit-element'
5
+
3
6
  import { MultiColumnFormStyles } from '@things-factory/form-ui'
7
+ import { i18next } from '@things-factory/i18n-base'
4
8
  import { client, CustomAlert } from '@things-factory/shell'
5
9
  import { isMobileDevice } from '@things-factory/utils'
6
- import gql from 'graphql-tag'
7
- import { css, html, LitElement } from 'lit-element'
10
+
8
11
  import { PLATFORM } from '../../constants'
9
12
 
10
13
  class RequestROPopup extends LitElement {
@@ -152,7 +155,7 @@ class RequestROPopup extends LitElement {
152
155
  },
153
156
  {
154
157
  type: 'string',
155
- name: 'trackingNo',
158
+ name: 'newTrackingNo',
156
159
  header: i18next.t('field.tracking_no'),
157
160
  sortable: true,
158
161
  width: 130
@@ -164,6 +167,13 @@ class RequestROPopup extends LitElement {
164
167
  sortable: true,
165
168
  width: 130
166
169
  },
170
+ {
171
+ type: 'string',
172
+ name: 'postCode',
173
+ header: i18next.t('field.post_code'),
174
+ sortable: true,
175
+ width: 130
176
+ },
167
177
  {
168
178
  type: 'string',
169
179
  name: 'itemCount',
@@ -275,17 +285,18 @@ class RequestROPopup extends LitElement {
275
285
  let filters = []
276
286
 
277
287
  if (this.store) {
278
- filters.push({
279
- name: 'marketplaceStore',
280
- operator: 'eq',
281
- value: this.store.id
282
- })
283
-
284
- filters.push({
285
- name: 'status',
286
- operator: 'in',
287
- value: this.getROCreatableStatus()
288
- })
288
+ filters.push(
289
+ {
290
+ name: 'marketplaceStoreId',
291
+ operator: 'eq',
292
+ value: this.store.id
293
+ },
294
+ {
295
+ name: 'status',
296
+ operator: 'in',
297
+ value: this.getROCreatableStatus()
298
+ }
299
+ )
289
300
  }
290
301
 
291
302
  const pagination = { page, limit }
@@ -305,6 +316,23 @@ class RequestROPopup extends LitElement {
305
316
  description
306
317
  }
307
318
  marketplaceOrderItems {
319
+ marketplaceOrderShipping {
320
+ id
321
+ name
322
+ address1
323
+ address2
324
+ address3
325
+ address4
326
+ address5
327
+ city
328
+ postCode
329
+ country
330
+ state
331
+ phone1
332
+ phone2
333
+ attentionTo
334
+ trackingNo
335
+ }
308
336
  marketplaceProductVariation {
309
337
  marketplaceProduct {
310
338
  isku
@@ -335,13 +363,68 @@ class RequestROPopup extends LitElement {
335
363
  })
336
364
 
337
365
  if (!response.errors) {
366
+ let marketplaceOrders = response.data.marketplaceOrders.items
367
+ marketplaceOrders = marketplaceOrders.map(item => {
368
+ return {
369
+ ...item,
370
+ newTrackingNo: this.getOrderShippingInformation(item.marketplaceOrderItems, 'trackingNo'),
371
+ postCode: this.getOrderShippingInformation(item.marketplaceOrderItems, 'postCode')
372
+ }
373
+ })
374
+
338
375
  return {
339
376
  total: response.data.marketplaceOrders.total || 0,
340
- records: response.data.marketplaceOrders.items || []
377
+ records: marketplaceOrders || []
341
378
  }
342
379
  }
343
380
  }
344
381
 
382
+ getOrderShippingInformation(marketplaceOrderItems, type) {
383
+ let item
384
+ let marketplaceOrderShippings = []
385
+
386
+ marketplaceOrderItems.map(item => {
387
+ const marketplaceOrderShipping = item.marketplaceOrderShipping
388
+
389
+ if (marketplaceOrderShipping) {
390
+ marketplaceOrderShippings.push(marketplaceOrderShipping)
391
+ }
392
+ })
393
+
394
+ const uniqueMarketplaceOrderShippings = Array.from(new Set(marketplaceOrderShippings.map(a => a.id))).map(id => {
395
+ return marketplaceOrderShippings.find(a => a.id === id)
396
+ })
397
+
398
+ switch (type) {
399
+ case 'trackingNo':
400
+ if (uniqueMarketplaceOrderShippings) {
401
+ uniqueMarketplaceOrderShippings.map(marketplaceOrderShipping => {
402
+ if (this.store?.platform === PLATFORM.LAZADA.value) {
403
+ var newTrackingNo = []
404
+ if (marketplaceOrderShipping?.trackingNo) {
405
+ const trackingNos = JSON.parse(marketplaceOrderShipping.trackingNo)
406
+ newTrackingNo = trackingNos.map(item => item.tracking_code)
407
+ }
408
+ let uniqueTrackingNos = [...new Set(newTrackingNo)]
409
+ item = uniqueTrackingNos.join(', ')
410
+ } else {
411
+ item = marketplaceOrderShipping.trackingNo
412
+ }
413
+ })
414
+ }
415
+ break
416
+ case 'postCode':
417
+ if (uniqueMarketplaceOrderShippings) {
418
+ uniqueMarketplaceOrderShippings.map(marketplaceOrderShipping => {
419
+ item = marketplaceOrderShipping.postCode
420
+ })
421
+ }
422
+ break
423
+ }
424
+
425
+ return item
426
+ }
427
+
345
428
  getROCreatableStatus() {
346
429
  const platform = this.store.platform
347
430
  let roCreatableStatus = []
@@ -360,7 +443,11 @@ class RequestROPopup extends LitElement {
360
443
  break
361
444
 
362
445
  case PLATFORM.WOOCOMMERCE.value:
363
- roCreatableStatus = ['pending']
446
+ roCreatableStatus = ['pending', 'processing']
447
+ break
448
+
449
+ case PLATFORM.MAGENTO.value:
450
+ roCreatableStatus = ['processing']
364
451
  break
365
452
 
366
453
  default: