@things-factory/operato-wms 4.3.708 → 4.3.725

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.
@@ -3,27 +3,20 @@ import '@things-factory/grist-ui'
3
3
  import '../inventory/inventory-by-product-detail'
4
4
 
5
5
  import gql from 'graphql-tag'
6
- import {
7
- css,
8
- html
9
- } from 'lit-element'
6
+ import { css, html } from 'lit-element'
10
7
  import { connect } from 'pwa-helpers/connect-mixin'
11
8
 
12
9
  import { getCodeByName } from '@things-factory/code-base'
13
- import {
14
- i18next,
15
- localize
16
- } from '@things-factory/i18n-base'
17
- import {
18
- client,
19
- gqlContext,
20
- PageView,
21
- store
22
- } from '@things-factory/shell'
23
- import {
24
- flattenObject,
25
- isMobileDevice
26
- } from '@things-factory/utils'
10
+ import { i18next, localize } from '@things-factory/i18n-base'
11
+ import { client, gqlContext, PageView, store } from '@things-factory/shell'
12
+ import { flattenObject, isMobileDevice } from '@things-factory/utils'
13
+
14
+ function formatLocalDate(date = new Date()) {
15
+ const year = date.getFullYear()
16
+ const month = String(date.getMonth() + 1).padStart(2, '0')
17
+ const day = String(date.getDate()).padStart(2, '0')
18
+ return `${year}-${month}-${day}`
19
+ }
27
20
 
28
21
  class OutboundOrderDetailsReport extends connect(store)(localize(i18next)(PageView)) {
29
22
  static get styles() {
@@ -134,12 +127,12 @@ class OutboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVi
134
127
  type: 'date',
135
128
  props: {
136
129
  searchOper: 'eq',
137
- max: new Date().toISOString().split('T')[0]
130
+ max: formatLocalDate(new Date())
138
131
  },
139
132
  value: (() => {
140
- let date = new Date()
133
+ const date = new Date()
141
134
  date.setMonth(date.getMonth() - 1)
142
- return date.toISOString().split('T')[0]
135
+ return formatLocalDate(date)
143
136
  })(),
144
137
  handlers: { change: this._modifyDateRange.bind(this) }
145
138
  },
@@ -150,17 +143,16 @@ class OutboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVi
150
143
  props: {
151
144
  searchOper: 'eq',
152
145
  min: (() => {
153
- let date = new Date()
146
+ const date = new Date()
154
147
  date.setMonth(date.getMonth() - 1)
155
- return date.toISOString().split('T')[0]
148
+ return formatLocalDate(date)
156
149
  })(),
157
150
  max: (() => {
158
- var max = new Date()
159
- max.setUTCDate(max.getDate())
160
- return max.toISOString().split('T')[0]
151
+ const max = new Date()
152
+ return formatLocalDate(max)
161
153
  })()
162
154
  },
163
- value: new Date().toISOString().split('T')[0]
155
+ value: formatLocalDate(new Date())
164
156
  // handlers: { change: this._submit.bind(this) }
165
157
  },
166
158
  {
@@ -844,7 +836,7 @@ class OutboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVi
844
836
  }
845
837
  }
846
838
  `,
847
- variables: { filters, pagination, sortings},
839
+ variables: { filters, pagination, sortings },
848
840
  context: gqlContext()
849
841
  })
850
842
 
@@ -921,15 +913,16 @@ class OutboundOrderDetailsReport extends connect(store)(localize(i18next)(PageVi
921
913
  _modifyDateRange(e) {
922
914
  const fromDate = e.currentTarget.value
923
915
 
924
- let min = new Date(fromDate)
925
- let max = new Date(fromDate)
926
- max.setMonth(max.getMonth() + 2)
916
+ const minDate = new Date(fromDate)
917
+ if (Number.isNaN(minDate.getTime())) return
927
918
 
928
- min = min.toISOString().split('T')[0]
929
- max = max.toISOString().split('T')[0]
919
+ const maxDate = new Date(minDate)
920
+ maxDate.setMonth(maxDate.getMonth() + 2)
930
921
 
931
- if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
922
+ const min = formatLocalDate(minDate)
923
+ const max = formatLocalDate(maxDate)
932
924
 
925
+ if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
933
926
  if (this._toDateInput.value > max) this._toDateInput.value = max
934
927
 
935
928
  this._toDateInput.max = max
@@ -10,6 +10,13 @@ import { i18next, localize } from '@things-factory/i18n-base'
10
10
  import { client, gqlContext, PageView, store } from '@things-factory/shell'
11
11
  import { flattenObject, isMobileDevice } from '@things-factory/utils'
12
12
 
13
+ function formatLocalDate(date = new Date()) {
14
+ const year = date.getFullYear()
15
+ const month = String(date.getMonth() + 1).padStart(2, '0')
16
+ const day = String(date.getDate()).padStart(2, '0')
17
+ return `${year}-${month}-${day}`
18
+ }
19
+
13
20
  class OutboundSerialNumberReport extends connect(store)(localize(i18next)(PageView)) {
14
21
  static get styles() {
15
22
  return css`
@@ -122,12 +129,12 @@ class OutboundSerialNumberReport extends connect(store)(localize(i18next)(PageVi
122
129
  type: 'date',
123
130
  props: {
124
131
  searchOper: 'eq',
125
- max: new Date().toISOString().split('T')[0]
132
+ max: formatLocalDate(new Date())
126
133
  },
127
134
  value: (() => {
128
- let date = new Date()
135
+ const date = new Date()
129
136
  date.setMonth(date.getMonth() - 1)
130
- return date.toISOString().split('T')[0]
137
+ return formatLocalDate(date)
131
138
  })(),
132
139
  handlers: { change: this._modifyDateRange.bind(this) }
133
140
  },
@@ -138,13 +145,13 @@ class OutboundSerialNumberReport extends connect(store)(localize(i18next)(PageVi
138
145
  props: {
139
146
  searchOper: 'eq',
140
147
  min: (() => {
141
- let date = new Date()
148
+ const date = new Date()
142
149
  date.setMonth(date.getMonth() - 1)
143
- return date.toISOString().split('T')[0]
150
+ return formatLocalDate(date)
144
151
  })(),
145
- max: new Date().toISOString().split('T')[0]
152
+ max: formatLocalDate(new Date())
146
153
  },
147
- value: new Date().toISOString().split('T')[0],
154
+ value: formatLocalDate(new Date()),
148
155
  handlers: { change: this._submit.bind(this) }
149
156
  },
150
157
  {
@@ -418,7 +425,7 @@ class OutboundSerialNumberReport extends connect(store)(localize(i18next)(PageVi
418
425
  }
419
426
  }
420
427
 
421
- async _exportableData() {
428
+ async _exportableData() {
422
429
  try {
423
430
  var headerSetting = [
424
431
  { header: i18next.t('field.company'), key: 'bizplace|name', width: 25, type: 'string' },
@@ -509,17 +516,18 @@ async _exportableData() {
509
516
 
510
517
  if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
511
518
 
512
- let min = new Date(fromDate)
513
- let max = new Date(fromDate)
514
- let today = new Date()
515
- today.setHours(0, 0, 0, 0)
516
- max.setMonth(max.getMonth() + 1)
517
- max.setDate(max.getDate() - 1)
519
+ const minDate = new Date(fromDate)
520
+ if (Number.isNaN(minDate.getTime())) return
521
+
522
+ const maxDate = new Date(minDate)
523
+ maxDate.setMonth(maxDate.getMonth() + 1)
524
+ maxDate.setDate(maxDate.getDate() - 1)
525
+
526
+ const min = formatLocalDate(minDate)
527
+ const max = formatLocalDate(maxDate)
518
528
 
519
- min = min.toISOString().split('T')[0]
520
- max = max.toISOString().split('T')[0]
529
+ if (this._toDateInput.value > max) this._toDateInput.value = max
521
530
 
522
- this._toDateInput.value = max
523
531
  this._toDateInput.max = max
524
532
  this._toDateInput.min = min
525
533
  this._submit()
@@ -8,6 +8,13 @@ import { connect } from 'pwa-helpers/connect-mixin'
8
8
  import { i18next, localize } from '@things-factory/i18n-base'
9
9
  import { client, PageView, store } from '@things-factory/shell'
10
10
 
11
+ function formatLocalDate(date = new Date()) {
12
+ const year = date.getFullYear()
13
+ const month = String(date.getMonth() + 1).padStart(2, '0')
14
+ const day = String(date.getDate()).padStart(2, '0')
15
+ return `${year}-${month}-${day}`
16
+ }
17
+
11
18
  class ProductLabelReport extends connect(store)(localize(i18next)(PageView)) {
12
19
  static get styles() {
13
20
  return css`
@@ -107,12 +114,12 @@ class ProductLabelReport extends connect(store)(localize(i18next)(PageView)) {
107
114
  type: 'date',
108
115
  props: {
109
116
  searchOper: 'eq',
110
- max: new Date().toISOString().split('T')[0]
117
+ max: formatLocalDate(new Date())
111
118
  },
112
119
  value: (() => {
113
- let date = new Date()
120
+ const date = new Date()
114
121
  date.setMonth(date.getMonth() - 1)
115
- return date.toISOString().split('T')[0]
122
+ return formatLocalDate(date)
116
123
  })(),
117
124
  handlers: { change: this._modifyDateRange.bind(this) }
118
125
  },
@@ -123,13 +130,13 @@ class ProductLabelReport extends connect(store)(localize(i18next)(PageView)) {
123
130
  props: {
124
131
  searchOper: 'eq',
125
132
  min: (() => {
126
- let date = new Date()
133
+ const date = new Date()
127
134
  date.setMonth(date.getMonth() - 1)
128
- return date.toISOString().split('T')[0]
135
+ return formatLocalDate(date)
129
136
  })(),
130
- max: new Date().toISOString().split('T')[0]
137
+ max: formatLocalDate(new Date())
131
138
  },
132
- value: new Date().toISOString().split('T')[0]
139
+ value: formatLocalDate(new Date())
133
140
  },
134
141
  {
135
142
  label: i18next.t('field.product_type'),
@@ -297,12 +304,10 @@ class ProductLabelReport extends connect(store)(localize(i18next)(PageView)) {
297
304
 
298
305
  if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
299
306
 
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]
307
+ const minDate = new Date(fromDate)
308
+ if (Number.isNaN(minDate.getTime())) return
305
309
 
310
+ const min = formatLocalDate(minDate)
306
311
  this._toDateInput.min = min
307
312
  }
308
313
 
@@ -13,6 +13,13 @@ import { isMobileDevice } from '@things-factory/utils'
13
13
 
14
14
  import { showToast } from '../../util'
15
15
 
16
+ function formatLocalDate(date = new Date()) {
17
+ const year = date.getFullYear()
18
+ const month = String(date.getMonth() + 1).padStart(2, '0')
19
+ const day = String(date.getDate()).padStart(2, '0')
20
+ return `${year}-${month}-${day}`
21
+ }
22
+
16
23
  class shortageReport extends connect(store)(localize(i18next)(PageView)) {
17
24
  static get styles() {
18
25
  return [
@@ -130,12 +137,12 @@ class shortageReport extends connect(store)(localize(i18next)(PageView)) {
130
137
  type: 'date',
131
138
  props: {
132
139
  searchOper: 'eq',
133
- max: new Date().toISOString().split('T')[0]
140
+ max: formatLocalDate(new Date())
134
141
  },
135
142
  value: (() => {
136
143
  let date = new Date()
137
144
  date.setMonth(date.getMonth() - 1)
138
- return date.toISOString().split('T')[0]
145
+ return formatLocalDate(date)
139
146
  })(),
140
147
  handlers: { change: this._modifyDateRange.bind(this) }
141
148
  },
@@ -148,11 +155,11 @@ class shortageReport extends connect(store)(localize(i18next)(PageView)) {
148
155
  min: (() => {
149
156
  let date = new Date()
150
157
  date.setMonth(date.getMonth() - 1)
151
- return date.toISOString().split('T')[0]
158
+ return formatLocalDate(date)
152
159
  })(),
153
- max: new Date().toISOString().split('T')[0]
160
+ max: formatLocalDate(new Date())
154
161
  },
155
- value: new Date().toISOString().split('T')[0],
162
+ value: formatLocalDate(new Date()),
156
163
  handlers: { change: this._submit.bind(this) }
157
164
  },
158
165
  {
@@ -422,7 +429,7 @@ class shortageReport extends connect(store)(localize(i18next)(PageView)) {
422
429
  { header: i18next.t('field.ref_no'), key: 'refNo', width: 60, type: 'string' },
423
430
  { header: i18next.t('field.sku'), key: 'productSku', width: 25, type: 'string' },
424
431
  { header: i18next.t('field.product'), key: 'productName', width: 25, type: 'string' },
425
- { header: i18next.t('field.product_description'), key: 'productDescription', width: 25, type: 'string'},
432
+ { header: i18next.t('field.product_description'), key: 'productDescription', width: 25, type: 'string' },
426
433
  { header: i18next.t('field.order_quantity'), key: 'orderQty', width: 15, type: 'string' },
427
434
  { header: i18next.t('field.available_qty'), key: 'avQty', width: 15, type: 'string' },
428
435
  { header: i18next.t('field.nett_stock'), key: 'nettStock', width: 15, type: 'string' },
@@ -9,6 +9,13 @@ import { i18next, localize } from '@things-factory/i18n-base'
9
9
  import { client, PageView, store } from '@things-factory/shell'
10
10
  import { flattenObject } from '@things-factory/utils'
11
11
 
12
+ function formatLocalDate(date = new Date()) {
13
+ const year = date.getFullYear()
14
+ const month = String(date.getMonth() + 1).padStart(2, '0')
15
+ const day = String(date.getDate()).padStart(2, '0')
16
+ return `${year}-${month}-${day}`
17
+ }
18
+
12
19
  class ToteLoadingQcReport extends connect(store)(localize(i18next)(PageView)) {
13
20
  static get styles() {
14
21
  return css`
@@ -113,12 +120,12 @@ class ToteLoadingQcReport extends connect(store)(localize(i18next)(PageView)) {
113
120
  type: 'date',
114
121
  props: {
115
122
  searchOper: 'eq',
116
- max: new Date().toISOString().split('T')[0]
123
+ max: formatLocalDate(new Date())
117
124
  },
118
125
  value: (() => {
119
- let date = new Date()
126
+ const date = new Date()
120
127
  date.setDate(date.getDate() - 1)
121
- return date.toISOString().split('T')[0]
128
+ return formatLocalDate(date)
122
129
  })(),
123
130
  handlers: { change: this._modifyDateRange.bind(this) }
124
131
  },
@@ -129,17 +136,16 @@ class ToteLoadingQcReport extends connect(store)(localize(i18next)(PageView)) {
129
136
  props: {
130
137
  searchOper: 'eq',
131
138
  min: (() => {
132
- let date = new Date()
139
+ const date = new Date()
133
140
  date.setDate(date.getDate() - 1)
134
- return date.toISOString().split('T')[0]
141
+ return formatLocalDate(date)
135
142
  })(),
136
143
  max: (() => {
137
- var max = new Date()
138
- max.setMonth(max.getMonth())
139
- return max.toISOString().split('T')[0]
144
+ const max = new Date()
145
+ return formatLocalDate(max)
140
146
  })()
141
147
  },
142
- value: new Date().toISOString().split('T')[0]
148
+ value: formatLocalDate(new Date())
143
149
  },
144
150
  {
145
151
  label: i18next.t('field.route_id'),
@@ -422,18 +428,14 @@ class ToteLoadingQcReport extends connect(store)(localize(i18next)(PageView)) {
422
428
 
423
429
  if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
424
430
 
425
- let min = new Date(fromDate)
426
- let max = new Date(fromDate)
427
- max.setMonth(max.getMonth() + 1)
428
-
429
- let today = new Date()
430
- today.setHours(0, 0, 0, 0)
431
- if (!Number.isNaN(new Date(min).getTime())) {
432
- min = min.toISOString().split('T')[0]
433
- max = max.toISOString().split('T')[0]
434
- } else {
435
- return
436
- }
431
+ const minDate = new Date(fromDate)
432
+ if (Number.isNaN(minDate.getTime())) return
433
+
434
+ const maxDate = new Date(minDate)
435
+ maxDate.setMonth(maxDate.getMonth() + 1)
436
+
437
+ const min = formatLocalDate(minDate)
438
+ const max = formatLocalDate(maxDate)
437
439
 
438
440
  if (this._toDateInput.value > max) this._toDateInput.value = max
439
441
 
@@ -10,6 +10,13 @@ import { client, PageView, store } from '@things-factory/shell'
10
10
  import { flattenObject } from '@things-factory/utils'
11
11
  import { VAS_TYPES } from '@things-factory/sales-ui/client/constants/vas'
12
12
 
13
+ function formatLocalDate(date = new Date()) {
14
+ const year = date.getFullYear()
15
+ const month = String(date.getMonth() + 1).padStart(2, '0')
16
+ const day = String(date.getDate()).padStart(2, '0')
17
+ return `${year}-${month}-${day}`
18
+ }
19
+
13
20
  class VasReport extends connect(store)(localize(i18next)(PageView)) {
14
21
  static get styles() {
15
22
  return css`
@@ -112,12 +119,12 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
112
119
  type: 'date',
113
120
  props: {
114
121
  searchOper: 'eq',
115
- max: new Date().toISOString().split('T')[0]
122
+ max: formatLocalDate(new Date())
116
123
  },
117
124
  value: (() => {
118
- let date = new Date()
125
+ const date = new Date()
119
126
  date.setMonth(date.getMonth() - 1)
120
- return date.toISOString().split('T')[0]
127
+ return formatLocalDate(date)
121
128
  })(),
122
129
  handlers: { change: this._modifyDateRange.bind(this) }
123
130
  },
@@ -127,9 +134,9 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
127
134
  type: 'date',
128
135
  props: {
129
136
  searchOper: 'lte',
130
- max: new Date().toISOString().split('T')[0]
137
+ max: formatLocalDate(new Date())
131
138
  },
132
- value: new Date().toISOString().split('T')[0],
139
+ value: formatLocalDate(new Date()),
133
140
  handlers: { change: this._modifyDateRange.bind(this) }
134
141
  },
135
142
  {
@@ -378,12 +385,10 @@ class VasReport extends connect(store)(localize(i18next)(PageView)) {
378
385
 
379
386
  if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
380
387
 
381
- let min = new Date(fromDate)
382
- let today = new Date()
383
- today.setHours(0, 0, 0, 0)
384
-
385
- min = min.toISOString().split('T')[0]
388
+ const minDate = new Date(fromDate)
389
+ if (Number.isNaN(minDate.getTime())) return
386
390
 
391
+ const min = formatLocalDate(minDate)
387
392
  this._toDateInput.min = min
388
393
  }
389
394
 
@@ -10,6 +10,13 @@ import { i18next, localize } from '@things-factory/i18n-base'
10
10
  import { client, PageView, store } from '@things-factory/shell'
11
11
  import { flattenObject, isMobileDevice } from '@things-factory/utils'
12
12
 
13
+ function formatLocalDate(date = new Date()) {
14
+ const year = date.getFullYear()
15
+ const month = String(date.getMonth() + 1).padStart(2, '0')
16
+ const day = String(date.getDate()).padStart(2, '0')
17
+ return `${year}-${month}-${day}`
18
+ }
19
+
13
20
  class VolumeSummaryReport extends connect(store)(localize(i18next)(PageView)) {
14
21
  static get styles() {
15
22
  return css`
@@ -146,12 +153,12 @@ class VolumeSummaryReport extends connect(store)(localize(i18next)(PageView)) {
146
153
  type: 'date',
147
154
  props: {
148
155
  searchOper: 'eq',
149
- max: new Date().toISOString().split('T')[0]
156
+ max: formatLocalDate(new Date())
150
157
  },
151
158
  value: (() => {
152
- let date = new Date()
159
+ const date = new Date()
153
160
  date.setMonth(date.getMonth() - 1)
154
- return date.toISOString().split('T')[0]
161
+ return formatLocalDate(date)
155
162
  })(),
156
163
  handlers: { change: this._modifyDateRange.bind(this) }
157
164
  },
@@ -162,17 +169,16 @@ class VolumeSummaryReport extends connect(store)(localize(i18next)(PageView)) {
162
169
  props: {
163
170
  searchOper: 'eq',
164
171
  min: (() => {
165
- let date = new Date()
172
+ const date = new Date()
166
173
  date.setMonth(date.getMonth() - 1)
167
- return date.toISOString().split('T')[0]
174
+ return formatLocalDate(date)
168
175
  })(),
169
176
  max: (() => {
170
- var max = new Date()
171
- max.setMonth(max.getMonth())
172
- return max.toISOString().split('T')[0]
177
+ const max = new Date()
178
+ return formatLocalDate(max)
173
179
  })()
174
180
  },
175
- value: new Date().toISOString().split('T')[0],
181
+ value: formatLocalDate(new Date()),
176
182
  handlers: { change: this._submit.bind(this) }
177
183
  }
178
184
  ]
@@ -541,18 +547,14 @@ class VolumeSummaryReport extends connect(store)(localize(i18next)(PageView)) {
541
547
 
542
548
  if (this._toDateInput.value < fromDate) this._toDateInput.value = fromDate
543
549
 
544
- let min = new Date(fromDate)
545
- let max = new Date(fromDate)
546
- max.setMonth(max.getMonth() + 1)
547
-
548
- let today = new Date()
549
- today.setHours(0, 0, 0, 0)
550
- if (!Number.isNaN(new Date(min).getTime())) {
551
- min = min.toISOString().split('T')[0]
552
- max = max.toISOString().split('T')[0]
553
- } else {
554
- return
555
- }
550
+ const minDate = new Date(fromDate)
551
+ if (Number.isNaN(minDate.getTime())) return
552
+
553
+ const maxDate = new Date(minDate)
554
+ maxDate.setMonth(maxDate.getMonth() + 1)
555
+
556
+ const min = formatLocalDate(minDate)
557
+ const max = formatLocalDate(maxDate)
556
558
 
557
559
  if (this._toDateInput.value > max) this._toDateInput.value = max
558
560