@things-factory/operato-wms 3.6.3 → 3.6.8

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.
@@ -1,12 +1,14 @@
1
- import { getCodeByName } from '@things-factory/code-base'
2
1
  import '@things-factory/form-ui'
3
2
  import '@things-factory/grist-ui'
4
- import { i18next, localize } from '@things-factory/i18n-base'
5
- import { client, CustomAlert, gqlContext, PageView } from '@things-factory/shell'
6
- import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
7
- import { isMobileDevice, flattenObject } from '@things-factory/utils'
3
+
8
4
  import gql from 'graphql-tag'
9
5
  import { css, html, LitElement } from 'lit-element'
6
+
7
+ import { i18next, localize } from '@things-factory/i18n-base'
8
+ import { client, CustomAlert, gqlContext } from '@things-factory/shell'
9
+ import { ScrollbarStyles } from '@things-factory/styles'
10
+ import { flattenObject, isMobileDevice } from '@things-factory/utils'
11
+
10
12
  const _ = require('lodash')
11
13
 
12
14
  export class ProductDetailBizplaceSettingPopup extends localize(i18next)(LitElement) {
@@ -131,7 +133,7 @@ export class ProductDetailBizplaceSettingPopup extends localize(i18next)(LitElem
131
133
  {
132
134
  type: 'string',
133
135
  name: 'productDetail|refCode',
134
- header: i18next.t('field.refCode'),
136
+ header: i18next.t('field.ref_code'),
135
137
  sortable: true,
136
138
  width: 150
137
139
  },
@@ -1,12 +1,15 @@
1
- import { getCodeByName } from '@things-factory/code-base'
2
1
  import '@things-factory/form-ui'
3
2
  import '@things-factory/grist-ui'
4
- import { i18next, localize } from '@things-factory/i18n-base'
5
- import { client, CustomAlert, gqlContext, PageView } from '@things-factory/shell'
6
- import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
7
- import { isMobileDevice } from '@things-factory/utils'
3
+
8
4
  import gql from 'graphql-tag'
9
5
  import { css, html, LitElement } from 'lit-element'
6
+
7
+ import { getCodeByName } from '@things-factory/code-base'
8
+ import { i18next, localize } from '@things-factory/i18n-base'
9
+ import { client, CustomAlert, gqlContext } from '@things-factory/shell'
10
+ import { ScrollbarStyles } from '@things-factory/styles'
11
+ import { isMobileDevice } from '@things-factory/utils'
12
+
10
13
  const _ = require('lodash')
11
14
 
12
15
  export class ProductDetailsPopup extends localize(i18next)(LitElement) {
@@ -159,7 +162,7 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
159
162
  {
160
163
  type: 'string',
161
164
  name: 'refCode',
162
- header: i18next.t('field.refCode'),
165
+ header: i18next.t('field.ref_code'),
163
166
  record: { editable: true },
164
167
  sortable: true,
165
168
  width: 150
@@ -429,8 +429,8 @@ class ProductList extends localize(i18next)(PageView) {
429
429
  type: 'string',
430
430
  name: 'refCode',
431
431
  record: { editable: true },
432
- imex: { header: i18next.t('field.refCode'), key: 'refCode', width: 20, type: 'string' },
433
- header: i18next.t('field.refCode'),
432
+ imex: { header: i18next.t('field.ref_code'), key: 'refCode', width: 20, type: 'string' },
433
+ header: i18next.t('field.ref_code'),
434
434
  width: 80
435
435
  },
436
436
  {
@@ -78,14 +78,24 @@ class CustomerReceivedNote extends localize(i18next)(PageView) {
78
78
  _fetchGRNTemplate() {
79
79
  var { domain } = getPathInfo(location.pathname) // find out better way later.
80
80
  var timezoneOffSet = new Date().getTimezoneOffset().toString()
81
- if (domain === 'el-cold-chain-warehouse') {
82
- this.shadowRoot.querySelector('#container').src = `/view_elccl_grn/${this._grnNo}`
83
- } else if (domain === 'orientage-warehouse' || domain === 'shah-alam-warehouse') {
84
- this.shadowRoot.querySelector('#container').src = `/view_orientage_grn/${this._grnNo}`
85
- } else if (domain === 'seebuu-warehouse') {
86
- this.shadowRoot.querySelector('#container').src = `/view_seebuu_grn/${this._grnNo}`
87
- } else {
88
- this.shadowRoot.querySelector('#container').src = `/view_kimeda_grn/${this._grnNo}/${timezoneOffSet}`
81
+
82
+ switch (domain) {
83
+ case 'el-cold-chain-warehouse':
84
+ this.shadowRoot.querySelector('#container').src = `/view_elccl_grn/${this._grnNo}`
85
+ break
86
+ case 'orientage-warehouse':
87
+ case 'shah-alam-warehouse':
88
+ this.shadowRoot.querySelector('#container').src = `/view_orientage_grn/${this._grnNo}`
89
+ break
90
+ case 'seebuu-warehouse':
91
+ this.shadowRoot.querySelector('#container').src = `/view_seebuu_grn/${this._grnNo}`
92
+ break
93
+ case 'kimeda-warehouse':
94
+ this.shadowRoot.querySelector('#container').src = `/view_kimeda_grn/${this._grnNo}/${timezoneOffSet}`
95
+ break
96
+ default:
97
+ this.shadowRoot.querySelector('#container').src = `/view_grn/${this._grnNo}/${timezoneOffSet}`
98
+ break
89
99
  }
90
100
  }
91
101
 
@@ -81,14 +81,23 @@ class ReceivedNoteDetail extends localize(i18next)(PageView) {
81
81
  var { domain } = getPathInfo(location.pathname) // find out better way later.
82
82
  var timezoneOffSet = new Date().getTimezoneOffset().toString()
83
83
 
84
- if (domain === 'el-cold-chain-warehouse') {
85
- this.shadowRoot.querySelector('#container').src = `/view_elccl_grn/${this._grnNo}`
86
- } else if (domain === 'orientage-warehouse' || domain === 'shah-alam-warehouse') {
87
- this.shadowRoot.querySelector('#container').src = `/view_orientage_grn/${this._grnNo}`
88
- } else if (domain === 'seebuu-warehouse') {
89
- this.shadowRoot.querySelector('#container').src = `/view_seebuu_grn/${this._grnNo}`
90
- } else {
91
- this.shadowRoot.querySelector('#container').src = `/view_kimeda_grn/${this._grnNo}/${timezoneOffSet}`
84
+ switch (domain) {
85
+ case 'el-cold-chain-warehouse':
86
+ this.shadowRoot.querySelector('#container').src = `/view_elccl_grn/${this._grnNo}`
87
+ break
88
+ case 'orientage-warehouse':
89
+ case 'shah-alam-warehouse':
90
+ this.shadowRoot.querySelector('#container').src = `/view_orientage_grn/${this._grnNo}`
91
+ break
92
+ case 'seebuu-warehouse':
93
+ this.shadowRoot.querySelector('#container').src = `/view_seebuu_grn/${this._grnNo}`
94
+ break
95
+ case 'kimeda-warehouse':
96
+ this.shadowRoot.querySelector('#container').src = `/view_kimeda_grn/${this._grnNo}/${timezoneOffSet}`
97
+ break
98
+ default:
99
+ this.shadowRoot.querySelector('#container').src = `/view_grn/${this._grnNo}/${timezoneOffSet}`
100
+ break
92
101
  }
93
102
  }
94
103
 
@@ -1,14 +1,16 @@
1
1
  import '@things-factory/form-ui'
2
- import { getCodeByName } from '@things-factory/code-base'
3
2
  import '@things-factory/grist-ui'
3
+ import './upload-delivery-note'
4
+
5
+ import gql from 'graphql-tag'
6
+ import { css, html } from 'lit-element'
7
+
8
+ import { getCodeByName } from '@things-factory/code-base'
4
9
  import { i18next, localize } from '@things-factory/i18n-base'
5
10
  import { openPopup } from '@things-factory/layout-base'
6
11
  import { client, navigate, PageView } from '@things-factory/shell'
7
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
8
12
  import { ScrollbarStyles } from '@things-factory/styles'
9
- import gql from 'graphql-tag'
10
- import { css, html } from 'lit-element'
11
- import './upload-delivery-note'
13
+ import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
12
14
 
13
15
  class DeliveryOrderList extends localize(i18next)(PageView) {
14
16
  static get styles() {
@@ -64,6 +66,26 @@ class DeliveryOrderList extends localize(i18next)(PageView) {
64
66
  }
65
67
  }
66
68
 
69
+ get searchForm() {
70
+ return this.shadowRoot.querySelector('search-form')
71
+ }
72
+
73
+ get dataGrist() {
74
+ return this.shadowRoot.querySelector('data-grist')
75
+ }
76
+
77
+ get _fromDateInput() {
78
+ return this.searchForm.shadowRoot.querySelector('input[name=fromDate]')
79
+ }
80
+
81
+ get _toDateInput() {
82
+ return this.searchForm.shadowRoot.querySelector('input[name=toDate]')
83
+ }
84
+
85
+ get _columns() {
86
+ return this.config.columns
87
+ }
88
+
67
89
  pageUpdated(changes, lifecycle) {
68
90
  if (this.active) {
69
91
  this.dataGrist.fetch()
@@ -83,7 +105,7 @@ class DeliveryOrderList extends localize(i18next)(PageView) {
83
105
  },
84
106
  {
85
107
  name: 'releaseGoodNo',
86
- label: i18next.t('field.release_good_no'),
108
+ label: i18next.t('field.ro_no'),
87
109
  type: 'text',
88
110
  props: { searchOper: 'i_like' }
89
111
  },
@@ -122,6 +144,7 @@ class DeliveryOrderList extends localize(i18next)(PageView) {
122
144
  this.config = {
123
145
  list: { fields: ['name', 'refNo', 'bizplace', 'deliveryDate', 'ownCollection', 'status', 'updatedAt'] },
124
146
  rows: { selectable: { multiple: true }, appendable: false },
147
+ pagination: { pages: [20, 50, 100, 200, 500] },
125
148
  columns: [
126
149
  { type: 'gutter', gutterName: 'dirty' },
127
150
  { type: 'gutter', gutterName: 'sequence' },
@@ -146,6 +169,13 @@ class DeliveryOrderList extends localize(i18next)(PageView) {
146
169
  sortable: true,
147
170
  width: 150
148
171
  },
172
+ {
173
+ type: 'object',
174
+ name: 'releaseGood',
175
+ header: i18next.t('field.ro_no'),
176
+ sortable: true,
177
+ width: 150
178
+ },
149
179
  {
150
180
  type: 'string',
151
181
  name: 'refNo',
@@ -199,14 +229,6 @@ class DeliveryOrderList extends localize(i18next)(PageView) {
199
229
  }
200
230
  }
201
231
 
202
- get searchForm() {
203
- return this.shadowRoot.querySelector('search-form')
204
- }
205
-
206
- get dataGrist() {
207
- return this.shadowRoot.querySelector('data-grist')
208
- }
209
-
210
232
  async fetchHandler({ page, limit, sorters = [{ name: 'createdAt', desc: true }] }) {
211
233
  const filters = this.searchForm.queryFilters
212
234
  const response = await client.query({
@@ -224,12 +246,6 @@ class DeliveryOrderList extends localize(i18next)(PageView) {
224
246
  id
225
247
  name
226
248
  }
227
- attachments {
228
- id
229
- name
230
- refBy
231
- path
232
- }
233
249
  to
234
250
  deliveryDate
235
251
  status
@@ -317,13 +333,23 @@ class DeliveryOrderList extends localize(i18next)(PageView) {
317
333
  )
318
334
  }
319
335
 
320
- get _columns() {
321
- return this.config.columns
322
- }
323
-
324
336
  _exportableData() {
325
337
  return this.dataGrist.exportRecords()
326
338
  }
339
+
340
+ _modifyDateRange(e) {
341
+ const fromDate = e.currentTarget.value
342
+
343
+ if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
344
+
345
+ let min = new Date(fromDate)
346
+ let today = new Date()
347
+ today.setHours(0, 0, 0, 0)
348
+
349
+ min = min.toISOString().split('T')[0]
350
+
351
+ this._toDateInput.min = min
352
+ }
327
353
  }
328
354
 
329
355
  window.customElements.define('delivery-order-list', DeliveryOrderList)
@@ -1,18 +1,20 @@
1
1
  import '@things-factory/barcode-ui'
2
- import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
3
2
  import '@things-factory/grist-ui'
4
- import { openPopup } from '@things-factory/layout-base'
3
+ import './logistics-init/logistics-init-popup'
4
+
5
+ import gql from 'graphql-tag'
6
+ import { css, html } from 'lit-element'
7
+ import { connect } from 'pwa-helpers/connect-mixin.js'
8
+
9
+ import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
5
10
  import { i18next, localize } from '@things-factory/i18n-base'
11
+ import { openPopup } from '@things-factory/layout-base'
6
12
  import { client, CustomAlert, PageView, store } from '@things-factory/shell'
7
13
  import { CommonButtonStyles } from '@things-factory/styles'
8
14
  import { isMobileDevice } from '@things-factory/utils'
9
- import gql from 'graphql-tag'
10
- import { css, html } from 'lit-element'
11
- import { connect } from 'pwa-helpers/connect-mixin.js'
12
- import { fetchSettingRule } from '../../fetch-setting-value'
13
- import { WORKSHEET_STATUS, PLATFORM } from '../constants'
14
15
 
15
- import './logistics-init/logistics-init-popup'
16
+ import { fetchSettingRule } from '../../fetch-setting-value'
17
+ import { PLATFORM, WORKSHEET_STATUS } from '../constants'
16
18
 
17
19
  class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
18
20
  static get properties() {
@@ -22,6 +24,8 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
22
24
  trackingNo: String,
23
25
  shippingProvider: String,
24
26
  platform: String,
27
+ airwayBill: String,
28
+ invoice: String,
25
29
  config: Object,
26
30
  data: Object,
27
31
  _productName: String,
@@ -119,7 +123,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
119
123
  })
120
124
  }
121
125
 
122
- if (this.releaseGoodNo && this.completed && this.trackingNo) {
126
+ if (this.releaseGoodNo && this.platform != 'operato' && this.completed && this.trackingNo) {
123
127
  if (this.platform === PLATFORM.LAZADA.value) {
124
128
  actions.push({
125
129
  title: i18next.t('button.print_invoice'),
@@ -135,6 +139,26 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
135
139
  })
136
140
  }
137
141
 
142
+ if (this.releaseGoodNo && this.platform == 'operato' && !this.airwayBill && this.completed) {
143
+ actions.push({
144
+ title: i18next.t('button.fetch_airway_bill'),
145
+ action: this.fetchSellercraftAirwayBill.bind(this),
146
+ ...CommonButtonStyles.label
147
+ })
148
+ } else if (this.releaseGoodNo && this.platform == 'operato' && this.airwayBill && this.completed) {
149
+ actions.push({
150
+ title: i18next.t('button.print_airway_bill'),
151
+ action: this.printSellercraftAirwayBill.bind(this),
152
+ ...CommonButtonStyles.label
153
+ })
154
+
155
+ actions.push({
156
+ title: i18next.t('button.print_invoice'),
157
+ action: this.printSellercraftInvoice.bind(this),
158
+ ...CommonButtonStyles.label
159
+ })
160
+ }
161
+
138
162
  if (
139
163
  this.releaseGoodNo &&
140
164
  this.orderInformation.status === 'packed' &&
@@ -247,9 +271,6 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
247
271
  <label>${i18next.t('label.tracking_no')}</label>
248
272
  <input name="trackingNo" readonly />
249
273
 
250
- <label>${i18next.t('label.platform')}</label>
251
- <input name="platform" readonly />
252
-
253
274
  <label>${i18next.t('label.status')}</label>
254
275
  <input name="marketplaceStatus" readonly />
255
276
 
@@ -417,11 +438,12 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
417
438
  bizplaceName
418
439
  partnerDomainId
419
440
  refNo
441
+ airwayBill
442
+ invoice
420
443
  startedAt
421
444
  shippingProvider
422
445
  marketplaceStatus
423
446
  trackingNo
424
- platform
425
447
  marketplaceOrder {
426
448
  id
427
449
  name
@@ -432,6 +454,7 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
432
454
  platform
433
455
  }
434
456
  }
457
+ platform
435
458
  }
436
459
  worksheetDetailInfos {
437
460
  name
@@ -476,6 +499,8 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
476
499
  const { worksheetInfo, worksheetDetailInfos } = response.data.packingWorksheet
477
500
 
478
501
  this.trackingNo = worksheetInfo.trackingNo
502
+ this.airwayBill = worksheetInfo.airwayBill
503
+ this.invoice = worksheetInfo.invoice
479
504
  this.refNo = worksheetInfo.refNo
480
505
  this.platform = worksheetInfo.platform
481
506
  this.shippingProvider = worksheetInfo.shippingProvider
@@ -569,6 +594,20 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
569
594
  return otherInfo.deliveryType
570
595
  }
571
596
 
597
+ printSellercraftInvoice() {
598
+ let url = new URL(window.location)
599
+
600
+ var convertedPdfUrl = `${url.origin}/proxy?url=${this.invoice}`
601
+ this._callPrintDialog(convertedPdfUrl)
602
+ }
603
+
604
+ printSellercraftAirwayBill() {
605
+ let url = new URL(window.location)
606
+
607
+ var convertedPdfUrl = `${url.origin}/proxy?url=${this.airwayBill}`
608
+ this._callPrintDialog(convertedPdfUrl)
609
+ }
610
+
572
611
  async printInvoice() {
573
612
  var orderDocInfo = await this.getOrderDocument(this.refNo, 'invoice')
574
613
 
@@ -609,6 +648,30 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
609
648
  }
610
649
  }
611
650
 
651
+ async fetchSellercraftAirwayBill() {
652
+ const response = await client.query({
653
+ query: gql`
654
+ query fetchSellercraftAirwayBill($releaseOrderNo: String!) {
655
+ fetchSellercraftAirwayBill(releaseOrderNo: $releaseOrderNo) {
656
+ airwayBill
657
+ }
658
+ }
659
+ `,
660
+ variables: { releaseOrderNo }
661
+ })
662
+
663
+ if (!response.errors) {
664
+ this.airwayBill = response.data.fetchAirwayBill.airwayBill
665
+
666
+ if (airwayBill) {
667
+ this.updateContext()
668
+ this._callPrintDialog(this.airwayBill)
669
+ } else {
670
+ this._showToast({ message: i18next.t('text.pending_airwaybill_from_ecommerce_platform') })
671
+ }
672
+ }
673
+ }
674
+
612
675
  async getOrderDocument(orderNo, docType) {
613
676
  try {
614
677
  const response = await client.query({
@@ -657,6 +720,15 @@ class PackingProduct extends connect(store)(localize(i18next)(PageView)) {
657
720
  this._showToast({ message: i18next.t('text.document_has_been_generated') })
658
721
  }, 1000)
659
722
  break
723
+
724
+ default:
725
+ iframe.src = contentSource
726
+ iframe.onload = () => {
727
+ iframe.focus()
728
+ iframe.contentWindow.print()
729
+ this._showToast({ message: i18next.t('text.document_has_been_generated') })
730
+ }
731
+ break
660
732
  }
661
733
  }
662
734