@things-factory/operato-mms 4.3.175 → 4.3.177
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.
|
@@ -348,11 +348,6 @@ class ShopeeOrderInitBatchPopup extends localize(i18next)(LitElement) {
|
|
|
348
348
|
operator: 'eq',
|
|
349
349
|
value: this.store.id
|
|
350
350
|
},
|
|
351
|
-
{
|
|
352
|
-
name: 'trackingNo',
|
|
353
|
-
operator: 'is_null',
|
|
354
|
-
value: ''
|
|
355
|
-
},
|
|
356
351
|
{
|
|
357
352
|
name: 'status',
|
|
358
353
|
operator: 'eq',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '@things-factory/form-ui'
|
|
2
2
|
import '@things-factory/grist-ui'
|
|
3
|
+
import '@things-factory/import-ui'
|
|
3
4
|
import './select-datetime-popup'
|
|
4
5
|
import './logistics/order-init-popup'
|
|
5
6
|
import './logistics/shopee-order-init-batch-popup'
|
|
@@ -9,6 +10,7 @@ import './logistics/request-ro-popup'
|
|
|
9
10
|
|
|
10
11
|
import gql from 'graphql-tag'
|
|
11
12
|
import { css, html } from 'lit-element'
|
|
13
|
+
import _ from 'lodash'
|
|
12
14
|
|
|
13
15
|
import { GhostPrint } from '@operato/ghost-print'
|
|
14
16
|
import { getCodeByName } from '@things-factory/code-base'
|
|
@@ -128,10 +130,35 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
128
130
|
exportable: {
|
|
129
131
|
name: i18next.t('title.order_by_store'),
|
|
130
132
|
data: this._exportableData.bind(this)
|
|
133
|
+
},
|
|
134
|
+
importable: {
|
|
135
|
+
handler: this._importableData.bind(this)
|
|
131
136
|
}
|
|
132
137
|
}
|
|
133
138
|
}
|
|
134
139
|
|
|
140
|
+
_importableData(records) {
|
|
141
|
+
setTimeout(() => {
|
|
142
|
+
openPopup(
|
|
143
|
+
html`
|
|
144
|
+
<import-pop-up
|
|
145
|
+
.records=${records}
|
|
146
|
+
.config=${{
|
|
147
|
+
rows: this.config.rows,
|
|
148
|
+
columns: [...this.config.columns.filter(column => column.imex !== undefined)]
|
|
149
|
+
}}
|
|
150
|
+
.importHandler="${this._importData.bind(this)}"
|
|
151
|
+
></import-pop-up>
|
|
152
|
+
`,
|
|
153
|
+
{
|
|
154
|
+
backdrop: true,
|
|
155
|
+
size: 'large',
|
|
156
|
+
title: i18next.t('title.import')
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}, 500)
|
|
160
|
+
}
|
|
161
|
+
|
|
135
162
|
render() {
|
|
136
163
|
return html`
|
|
137
164
|
<search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
|
|
@@ -157,6 +184,31 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
157
184
|
type: 'text',
|
|
158
185
|
props: { searchOper: 'i_like' }
|
|
159
186
|
},
|
|
187
|
+
{
|
|
188
|
+
label: i18next.t('field.from_date'),
|
|
189
|
+
name: 'fromDate',
|
|
190
|
+
type: 'date',
|
|
191
|
+
props: {
|
|
192
|
+
searchOper: 'eq',
|
|
193
|
+
max: new Date().toISOString().split('T')[0]
|
|
194
|
+
},
|
|
195
|
+
value: (() => {
|
|
196
|
+
let date = new Date()
|
|
197
|
+
date.setMonth(date.getMonth() - 1)
|
|
198
|
+
return date.toISOString().split('T')[0]
|
|
199
|
+
})(),
|
|
200
|
+
handlers: { change: this._modifyDateRange.bind(this) }
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
label: i18next.t('field.to_date'),
|
|
204
|
+
name: 'toDate',
|
|
205
|
+
type: 'date',
|
|
206
|
+
props: {
|
|
207
|
+
searchOper: 'eq',
|
|
208
|
+
max: new Date().toISOString().split('T')[0]
|
|
209
|
+
},
|
|
210
|
+
value: new Date().toISOString().split('T')[0]
|
|
211
|
+
},
|
|
160
212
|
{
|
|
161
213
|
label: i18next.t('field.status'),
|
|
162
214
|
name: 'status',
|
|
@@ -240,21 +292,39 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
240
292
|
name: 'orderNo',
|
|
241
293
|
header: i18next.t('field.order_no'),
|
|
242
294
|
sortable: true,
|
|
243
|
-
width: 130
|
|
295
|
+
width: 130,
|
|
296
|
+
imex: {
|
|
297
|
+
key: 'orderNo',
|
|
298
|
+
type: 'string',
|
|
299
|
+
header: i18next.t('field.order_no'),
|
|
300
|
+
width: 40
|
|
301
|
+
}
|
|
244
302
|
},
|
|
245
303
|
{
|
|
246
304
|
type: 'boolean',
|
|
247
305
|
name: 'releaseOrderId',
|
|
248
306
|
header: i18next.t('field.ro_created'),
|
|
249
307
|
record: { align: 'center' },
|
|
250
|
-
width: 40
|
|
308
|
+
width: 40,
|
|
309
|
+
imex: {
|
|
310
|
+
type: 'boolean',
|
|
311
|
+
key: 'releaseOrderId',
|
|
312
|
+
header: i18next.t('field.ro_created'),
|
|
313
|
+
width: 40
|
|
314
|
+
}
|
|
251
315
|
},
|
|
252
316
|
{
|
|
253
317
|
type: 'boolean',
|
|
254
318
|
name: 'isSplitted',
|
|
255
319
|
header: i18next.t('field.is_splitted'),
|
|
256
320
|
record: { align: 'center' },
|
|
257
|
-
width: 40
|
|
321
|
+
width: 40,
|
|
322
|
+
imex: {
|
|
323
|
+
type: 'boolean',
|
|
324
|
+
key: 'isSplitted',
|
|
325
|
+
header: i18next.t('field.is_splitted'),
|
|
326
|
+
width: 40
|
|
327
|
+
}
|
|
258
328
|
},
|
|
259
329
|
{
|
|
260
330
|
type: 'object',
|
|
@@ -268,28 +338,52 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
268
338
|
name: 'newTrackingNo',
|
|
269
339
|
header: i18next.t('field.tracking_no'),
|
|
270
340
|
sortable: false,
|
|
271
|
-
width: 130
|
|
341
|
+
width: 130,
|
|
342
|
+
imex: {
|
|
343
|
+
type: 'string',
|
|
344
|
+
key: 'newTrackingNo',
|
|
345
|
+
header: i18next.t('field.tracking_no'),
|
|
346
|
+
width: 40
|
|
347
|
+
}
|
|
272
348
|
},
|
|
273
349
|
{
|
|
274
350
|
type: 'string',
|
|
275
351
|
name: 'newOwnTrackingNo',
|
|
276
352
|
header: i18next.t('field.own_tracking_no'),
|
|
277
353
|
sortable: false,
|
|
278
|
-
width: 130
|
|
354
|
+
width: 130,
|
|
355
|
+
imex: {
|
|
356
|
+
type: 'string',
|
|
357
|
+
key: 'newOwnTrackingNo',
|
|
358
|
+
header: i18next.t('field.own_tracking_no'),
|
|
359
|
+
width: 40
|
|
360
|
+
}
|
|
279
361
|
},
|
|
280
362
|
{
|
|
281
363
|
type: 'string',
|
|
282
364
|
name: 'shippingProvider',
|
|
283
365
|
header: i18next.t('field.shipping_carrier'),
|
|
284
366
|
sortable: true,
|
|
285
|
-
width: 130
|
|
367
|
+
width: 130,
|
|
368
|
+
imex: {
|
|
369
|
+
type: 'string',
|
|
370
|
+
key: 'shippingProvider',
|
|
371
|
+
header: i18next.t('field.shipping_carrier'),
|
|
372
|
+
width: 40
|
|
373
|
+
}
|
|
286
374
|
},
|
|
287
375
|
{
|
|
288
376
|
type: 'string',
|
|
289
377
|
name: 'newOwnTransporter',
|
|
290
378
|
header: i18next.t('field.own_shipping_carrier'),
|
|
291
379
|
sortable: false,
|
|
292
|
-
width: 130
|
|
380
|
+
width: 130,
|
|
381
|
+
imex: {
|
|
382
|
+
type: 'string',
|
|
383
|
+
key: 'newOwnTransporter',
|
|
384
|
+
header: i18next.t('field.own_shipping_carrier'),
|
|
385
|
+
width: 40
|
|
386
|
+
}
|
|
293
387
|
},
|
|
294
388
|
{
|
|
295
389
|
type: 'string',
|
|
@@ -298,6 +392,18 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
298
392
|
sortable: true,
|
|
299
393
|
width: 130
|
|
300
394
|
},
|
|
395
|
+
{
|
|
396
|
+
type: 'string',
|
|
397
|
+
name: 'state',
|
|
398
|
+
header: i18next.t('field.state'),
|
|
399
|
+
width: 130
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
type: 'string',
|
|
403
|
+
name: 'city',
|
|
404
|
+
header: i18next.t('field.city'),
|
|
405
|
+
width: 130
|
|
406
|
+
},
|
|
301
407
|
{
|
|
302
408
|
type: 'string',
|
|
303
409
|
name: 'itemCount',
|
|
@@ -317,28 +423,52 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
317
423
|
name: 'status',
|
|
318
424
|
header: i18next.t('field.status'),
|
|
319
425
|
sortable: true,
|
|
320
|
-
width: 120
|
|
426
|
+
width: 120,
|
|
427
|
+
imex: {
|
|
428
|
+
type: 'string',
|
|
429
|
+
key: 'status',
|
|
430
|
+
header: i18next.t('field.status'),
|
|
431
|
+
width: 40
|
|
432
|
+
}
|
|
321
433
|
},
|
|
322
434
|
{
|
|
323
435
|
type: 'string',
|
|
324
436
|
name: 'remark',
|
|
325
437
|
header: i18next.t('field.remark'),
|
|
326
438
|
sortable: true,
|
|
327
|
-
width: 200
|
|
439
|
+
width: 200,
|
|
440
|
+
imex: {
|
|
441
|
+
type: 'string',
|
|
442
|
+
key: 'remark',
|
|
443
|
+
header: i18next.t('field.remark'),
|
|
444
|
+
width: 40
|
|
445
|
+
}
|
|
328
446
|
},
|
|
329
447
|
{
|
|
330
448
|
type: 'datetime',
|
|
331
449
|
name: 'orderUpdatedAt',
|
|
332
450
|
header: i18next.t('field.last_updated'),
|
|
333
451
|
sortable: true,
|
|
334
|
-
width: 180
|
|
452
|
+
width: 180,
|
|
453
|
+
imex: {
|
|
454
|
+
type: 'datetime',
|
|
455
|
+
key: 'orderUpdatedAt',
|
|
456
|
+
header: i18next.t('field.last_updated'),
|
|
457
|
+
width: 40
|
|
458
|
+
}
|
|
335
459
|
},
|
|
336
460
|
{
|
|
337
461
|
type: 'datetime',
|
|
338
462
|
name: 'orderCreatedAt',
|
|
339
463
|
header: i18next.t('field.created_at'),
|
|
340
464
|
sortable: true,
|
|
341
|
-
width: 180
|
|
465
|
+
width: 180,
|
|
466
|
+
imex: {
|
|
467
|
+
type: 'datetime',
|
|
468
|
+
key: 'orderCreatedAt',
|
|
469
|
+
header: i18next.t('field.created_at'),
|
|
470
|
+
width: 40
|
|
471
|
+
}
|
|
342
472
|
}
|
|
343
473
|
]
|
|
344
474
|
}
|
|
@@ -389,6 +519,10 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
389
519
|
return this.excelConfig
|
|
390
520
|
}
|
|
391
521
|
|
|
522
|
+
get _toDateInput() {
|
|
523
|
+
return this._searchForm.shadowRoot.querySelector('input[name=toDate]')
|
|
524
|
+
}
|
|
525
|
+
|
|
392
526
|
async fetchStore(id) {
|
|
393
527
|
const response = await client.query({
|
|
394
528
|
query: gql`
|
|
@@ -412,111 +546,148 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
412
546
|
}
|
|
413
547
|
}
|
|
414
548
|
|
|
415
|
-
async fetchHandler({ page, limit, sorters = [{ name: 'orderUpdatedAt', desc: true }] }) {
|
|
416
|
-
|
|
549
|
+
async fetchHandler({ page, limit, sorters = [{ name: 'orderUpdatedAt', desc: true }], filters }) {
|
|
550
|
+
try {
|
|
551
|
+
let mergedFilters = [...this.searchForm.queryFilters]
|
|
417
552
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
553
|
+
if (filters) {
|
|
554
|
+
mergedFilters = [...mergedFilters, ...filters]
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
let fromDate = mergedFilters.find(f => f.name == 'fromDate')
|
|
558
|
+
let toDate = mergedFilters.find(f => f.name == 'toDate')
|
|
559
|
+
if (!fromDate && toDate) {
|
|
560
|
+
throw new Error('from date parameter missing')
|
|
561
|
+
}
|
|
562
|
+
if (fromDate && !toDate) {
|
|
563
|
+
throw new Error('to date parameter missing')
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
mergedFilters = mergedFilters.map(filter => {
|
|
567
|
+
switch (filter.name) {
|
|
568
|
+
case 'fromDate':
|
|
569
|
+
let fromDt = new Date(filter.value)
|
|
570
|
+
fromDt.setHours(0)
|
|
571
|
+
filter.value = fromDt.toISOString()
|
|
572
|
+
break
|
|
573
|
+
case 'toDate':
|
|
574
|
+
let toDt = new Date(filter.value)
|
|
575
|
+
toDt.setHours(23, 59, 59)
|
|
576
|
+
filter.value = toDt.toISOString()
|
|
577
|
+
break
|
|
578
|
+
default:
|
|
579
|
+
break
|
|
580
|
+
}
|
|
581
|
+
return filter
|
|
423
582
|
})
|
|
424
|
-
}
|
|
425
583
|
|
|
426
|
-
|
|
427
|
-
|
|
584
|
+
if (this.store) {
|
|
585
|
+
mergedFilters.push({
|
|
586
|
+
name: 'marketplaceStoreId',
|
|
587
|
+
operator: 'eq',
|
|
588
|
+
value: this.store.id
|
|
589
|
+
})
|
|
590
|
+
}
|
|
428
591
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
592
|
+
const pagination = { page, limit }
|
|
593
|
+
const sortings = sorters
|
|
594
|
+
|
|
595
|
+
const response = await client.query({
|
|
596
|
+
query: gql`
|
|
597
|
+
query marketplaceOrders($filters: [Filter], $pagination: Pagination, $sortings: [Sorting]) {
|
|
598
|
+
marketplaceOrders(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
599
|
+
items {
|
|
437
600
|
id
|
|
438
601
|
name
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
marketplaceOrderShipping {
|
|
446
|
-
id
|
|
447
|
-
name
|
|
448
|
-
address1
|
|
449
|
-
address2
|
|
450
|
-
address3
|
|
451
|
-
address4
|
|
452
|
-
address5
|
|
453
|
-
city
|
|
454
|
-
postCode
|
|
455
|
-
country
|
|
456
|
-
state
|
|
457
|
-
phone1
|
|
458
|
-
phone2
|
|
459
|
-
attentionTo
|
|
460
|
-
trackingNo
|
|
461
|
-
ownTrackingNo
|
|
462
|
-
totalWeight
|
|
463
|
-
weightUnit
|
|
464
|
-
totalVolume
|
|
465
|
-
volumeUnit
|
|
466
|
-
transporter
|
|
467
|
-
ownTransporter
|
|
468
|
-
orderNoRef
|
|
469
|
-
subOrderNoRef
|
|
470
|
-
}
|
|
602
|
+
marketplaceStore {
|
|
603
|
+
id
|
|
604
|
+
name
|
|
605
|
+
platform
|
|
606
|
+
isOwnTransport
|
|
607
|
+
description
|
|
471
608
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
609
|
+
marketplaceOrderItems {
|
|
610
|
+
marketplaceOrderShippingItems {
|
|
611
|
+
marketplaceOrderShipping {
|
|
612
|
+
id
|
|
613
|
+
name
|
|
614
|
+
address1
|
|
615
|
+
address2
|
|
616
|
+
address3
|
|
617
|
+
address4
|
|
618
|
+
address5
|
|
619
|
+
city
|
|
620
|
+
postCode
|
|
621
|
+
country
|
|
622
|
+
state
|
|
623
|
+
phone1
|
|
624
|
+
phone2
|
|
625
|
+
attentionTo
|
|
626
|
+
trackingNo
|
|
627
|
+
ownTrackingNo
|
|
628
|
+
totalWeight
|
|
629
|
+
weightUnit
|
|
630
|
+
totalVolume
|
|
631
|
+
volumeUnit
|
|
632
|
+
transporter
|
|
633
|
+
ownTransporter
|
|
634
|
+
orderNoRef
|
|
635
|
+
subOrderNoRef
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
marketplaceProductVariation {
|
|
639
|
+
marketplaceProduct {
|
|
640
|
+
isku
|
|
641
|
+
name
|
|
642
|
+
}
|
|
475
643
|
name
|
|
644
|
+
variationSku
|
|
476
645
|
}
|
|
477
|
-
|
|
478
|
-
|
|
646
|
+
qty
|
|
647
|
+
paidPrice
|
|
479
648
|
}
|
|
480
|
-
|
|
481
|
-
|
|
649
|
+
orderNo
|
|
650
|
+
remark
|
|
651
|
+
type
|
|
652
|
+
paymentMethod
|
|
653
|
+
status
|
|
654
|
+
isSplitted
|
|
655
|
+
itemCount
|
|
656
|
+
releaseOrderId
|
|
657
|
+
totalAmount
|
|
658
|
+
shippingProvider
|
|
659
|
+
orderCreatedAt
|
|
660
|
+
orderUpdatedAt
|
|
661
|
+
updatedAt
|
|
482
662
|
}
|
|
483
|
-
|
|
484
|
-
remark
|
|
485
|
-
type
|
|
486
|
-
paymentMethod
|
|
487
|
-
status
|
|
488
|
-
isSplitted
|
|
489
|
-
itemCount
|
|
490
|
-
releaseOrderId
|
|
491
|
-
totalAmount
|
|
492
|
-
shippingProvider
|
|
493
|
-
orderCreatedAt
|
|
494
|
-
orderUpdatedAt
|
|
495
|
-
updatedAt
|
|
663
|
+
total
|
|
496
664
|
}
|
|
497
|
-
total
|
|
498
665
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
666
|
+
`,
|
|
667
|
+
variables: { filters: mergedFilters, pagination, sortings }
|
|
668
|
+
})
|
|
669
|
+
|
|
670
|
+
if (!response.errors) {
|
|
671
|
+
let marketplaceOrders = response.data.marketplaceOrders.items
|
|
672
|
+
marketplaceOrders = marketplaceOrders.map(item => {
|
|
673
|
+
return {
|
|
674
|
+
...item,
|
|
675
|
+
newTrackingNo: this.getOrderShippingInformation(item.marketplaceOrderItems, 'trackingNo'),
|
|
676
|
+
newOwnTrackingNo: this.getOrderShippingInformation(item.marketplaceOrderItems, 'ownTrackingNo'),
|
|
677
|
+
newOwnTransporter: this.getOrderShippingInformation(item.marketplaceOrderItems, 'ownTransporter'),
|
|
678
|
+
postCode: this.getOrderShippingInformation(item.marketplaceOrderItems, 'postCode'),
|
|
679
|
+
state: this.getOrderShippingInformation(item.marketplaceOrderItems, 'state'),
|
|
680
|
+
city: this.getOrderShippingInformation(item.marketplaceOrderItems, 'city')
|
|
681
|
+
}
|
|
682
|
+
})
|
|
503
683
|
|
|
504
|
-
if (!response.errors) {
|
|
505
|
-
let marketplaceOrders = response.data.marketplaceOrders.items
|
|
506
|
-
marketplaceOrders = marketplaceOrders.map(item => {
|
|
507
684
|
return {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
newOwnTrackingNo: this.getOrderShippingInformation(item.marketplaceOrderItems, 'ownTrackingNo'),
|
|
511
|
-
newOwnTransporter: this.getOrderShippingInformation(item.marketplaceOrderItems, 'ownTransporter'),
|
|
512
|
-
postCode: this.getOrderShippingInformation(item.marketplaceOrderItems, 'postCode')
|
|
685
|
+
total: response.data.marketplaceOrders.total || 0,
|
|
686
|
+
records: marketplaceOrders || []
|
|
513
687
|
}
|
|
514
|
-
})
|
|
515
|
-
|
|
516
|
-
return {
|
|
517
|
-
total: response.data.marketplaceOrders.total || 0,
|
|
518
|
-
records: marketplaceOrders || []
|
|
519
688
|
}
|
|
689
|
+
} catch (e) {
|
|
690
|
+
this._showToast(e)
|
|
520
691
|
}
|
|
521
692
|
}
|
|
522
693
|
|
|
@@ -578,6 +749,20 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
578
749
|
})
|
|
579
750
|
}
|
|
580
751
|
break
|
|
752
|
+
case 'state':
|
|
753
|
+
if (uniqueMarketplaceOrderShippings) {
|
|
754
|
+
uniqueMarketplaceOrderShippings.map(marketplaceOrderShipping => {
|
|
755
|
+
item = marketplaceOrderShipping.state
|
|
756
|
+
})
|
|
757
|
+
}
|
|
758
|
+
break
|
|
759
|
+
case 'city':
|
|
760
|
+
if (uniqueMarketplaceOrderShippings) {
|
|
761
|
+
uniqueMarketplaceOrderShippings.map(marketplaceOrderShipping => {
|
|
762
|
+
item = marketplaceOrderShipping.city
|
|
763
|
+
})
|
|
764
|
+
}
|
|
765
|
+
break
|
|
581
766
|
}
|
|
582
767
|
|
|
583
768
|
return item
|
|
@@ -858,29 +1043,54 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
858
1043
|
|
|
859
1044
|
async _exportableData() {
|
|
860
1045
|
try {
|
|
861
|
-
let
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
{ header: i18next.t('field.created_at'), key: 'createdAt', width: 75, type: 'date' },
|
|
874
|
-
{ header: i18next.t('field.updated_at'), key: 'updatedAt', width: 75, type: 'date' }
|
|
875
|
-
]
|
|
1046
|
+
let filters = [
|
|
1047
|
+
{
|
|
1048
|
+
name: 'status',
|
|
1049
|
+
operator: 'eq',
|
|
1050
|
+
value: 'ready_to_ship'
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
name: 'ownTrackingNo',
|
|
1054
|
+
operator: 'is_null',
|
|
1055
|
+
value: ''
|
|
1056
|
+
}
|
|
1057
|
+
]
|
|
876
1058
|
|
|
877
|
-
|
|
878
|
-
const selectedOrderNo = records.map(record => record.name)
|
|
1059
|
+
let queryData = await this.fetchHandler({ page: 1, limit: 99999, filters })
|
|
879
1060
|
|
|
880
|
-
|
|
1061
|
+
var headerSetting = this.dataGrist._config.columns
|
|
1062
|
+
.filter(column => column.type !== 'gutter' && column.imex !== undefined)
|
|
1063
|
+
.map(column => {
|
|
1064
|
+
return column.imex
|
|
1065
|
+
})
|
|
881
1066
|
|
|
882
|
-
|
|
883
|
-
|
|
1067
|
+
var data = queryData.records.map(item => {
|
|
1068
|
+
return {
|
|
1069
|
+
id: item.id,
|
|
1070
|
+
...this.config.columns
|
|
1071
|
+
.filter(column => column.type !== 'gutter' && column.imex !== undefined)
|
|
1072
|
+
.reduce((record, column) => {
|
|
1073
|
+
if (column.imex.key == 'releaseOrderId' || column.imex.key == 'isSplitted') {
|
|
1074
|
+
record[column.imex.key] = column.imex.key
|
|
1075
|
+
.split('.')
|
|
1076
|
+
.reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)
|
|
1077
|
+
? 'TRUE'
|
|
1078
|
+
: 'FALSE'
|
|
1079
|
+
} else {
|
|
1080
|
+
let value = column.imex.key
|
|
1081
|
+
.split('.')
|
|
1082
|
+
.reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)
|
|
1083
|
+
if (column.imex.type == 'datetime') {
|
|
1084
|
+
value = new Date(parseInt(value)).toLocaleString()
|
|
1085
|
+
}
|
|
1086
|
+
record[column.imex.key] = value
|
|
1087
|
+
}
|
|
1088
|
+
return record
|
|
1089
|
+
}, {})
|
|
1090
|
+
}
|
|
1091
|
+
})
|
|
1092
|
+
|
|
1093
|
+
return { header: headerSetting, data }
|
|
884
1094
|
} catch (e) {
|
|
885
1095
|
this._showToast(e)
|
|
886
1096
|
}
|
|
@@ -926,6 +1136,22 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
926
1136
|
}
|
|
927
1137
|
}
|
|
928
1138
|
|
|
1139
|
+
_modifyDateRange(e) {
|
|
1140
|
+
try {
|
|
1141
|
+
const fromDate = e.currentTarget.value
|
|
1142
|
+
|
|
1143
|
+
if (this?._toDateInput?.value < fromDate) this._toDateInput.value = fromDate
|
|
1144
|
+
|
|
1145
|
+
let min = new Date(fromDate)
|
|
1146
|
+
let today = new Date()
|
|
1147
|
+
today.setHours(0, 0, 0, 0)
|
|
1148
|
+
|
|
1149
|
+
min = min.toISOString().split('T')[0]
|
|
1150
|
+
|
|
1151
|
+
this._toDateInput.min = min
|
|
1152
|
+
} catch (e) {}
|
|
1153
|
+
}
|
|
1154
|
+
|
|
929
1155
|
_showToast({ type, message }) {
|
|
930
1156
|
document.dispatchEvent(
|
|
931
1157
|
new CustomEvent('notify', {
|
|
@@ -936,6 +1162,69 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
936
1162
|
})
|
|
937
1163
|
)
|
|
938
1164
|
}
|
|
1165
|
+
|
|
1166
|
+
async _importData(patches) {
|
|
1167
|
+
try {
|
|
1168
|
+
if (patches.length == 0) {
|
|
1169
|
+
throw new Error(i18next.t('text.empty_value_in_list'))
|
|
1170
|
+
}
|
|
1171
|
+
this._validateImport(patches)
|
|
1172
|
+
patches = patches
|
|
1173
|
+
.map(patch => {
|
|
1174
|
+
return { orderNoRef: patch.orderNo, ownTrackingNo: patch.newOwnTrackingNo }
|
|
1175
|
+
})
|
|
1176
|
+
.filter(item => item.ownTrackingNo != null)
|
|
1177
|
+
|
|
1178
|
+
if (patches.length == 0) {
|
|
1179
|
+
throw new Error('no changes to tracking number')
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
const response = await client.query({
|
|
1183
|
+
query: gql`
|
|
1184
|
+
mutation updateMarketplaceOrderShippingByRefNo($patches: [MarketplaceOrderShippingPatch!]!) {
|
|
1185
|
+
updateMarketplaceOrderShippingByRefNo(patches: $patches)
|
|
1186
|
+
}
|
|
1187
|
+
`,
|
|
1188
|
+
variables: {
|
|
1189
|
+
patches
|
|
1190
|
+
}
|
|
1191
|
+
})
|
|
1192
|
+
|
|
1193
|
+
if (!response.errors) {
|
|
1194
|
+
history.back()
|
|
1195
|
+
this.dataGrist.fetch()
|
|
1196
|
+
document.dispatchEvent(
|
|
1197
|
+
new CustomEvent('notify', {
|
|
1198
|
+
detail: {
|
|
1199
|
+
message: i18next.t('text.data_imported_successfully')
|
|
1200
|
+
}
|
|
1201
|
+
})
|
|
1202
|
+
)
|
|
1203
|
+
}
|
|
1204
|
+
} catch (e) {
|
|
1205
|
+
this._showToast(e)
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
async _validateImport(data) {
|
|
1210
|
+
let errors = []
|
|
1211
|
+
data = data.map(item => {
|
|
1212
|
+
if (_.isEmpty(item.name) || '') {
|
|
1213
|
+
if (!errors.find(error => error.type == 'name')) {
|
|
1214
|
+
errors.push({ type: 'name', value: 'Name is required' })
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
if (_.isEmpty(item.name) || '') {
|
|
1218
|
+
if (!errors.find(error => error.type == 'id')) {
|
|
1219
|
+
errors.push({ type: 'id', value: 'ID is required' })
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
return item
|
|
1223
|
+
})
|
|
1224
|
+
if (errors.length > 0) {
|
|
1225
|
+
throw new Error(`${errors.map(item => item.value).join(', ')}`)
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
939
1228
|
}
|
|
940
1229
|
|
|
941
1230
|
customElements.define('mms-order-by-store', OrderByStore)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-mms",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.177",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -59,50 +59,52 @@
|
|
|
59
59
|
"@operato/scene-table": "^0.1.8",
|
|
60
60
|
"@operato/scene-timer": "^0.1.8",
|
|
61
61
|
"@operato/scene-wheel-sorter": "^0.1.8",
|
|
62
|
-
"@things-factory/apptool-ui": "^4.3.
|
|
63
|
-
"@things-factory/attachment-base": "^4.3.
|
|
64
|
-
"@things-factory/auth-ui": "^4.3.
|
|
65
|
-
"@things-factory/biz-base": "^4.3.
|
|
66
|
-
"@things-factory/board-service": "^4.3.
|
|
67
|
-
"@things-factory/board-ui": "^4.3.
|
|
68
|
-
"@things-factory/code-ui": "^4.3.
|
|
69
|
-
"@things-factory/context-ui": "^4.3.
|
|
70
|
-
"@things-factory/dashboard": "^4.3.
|
|
71
|
-
"@things-factory/export-ui": "^4.3.
|
|
72
|
-
"@things-factory/export-ui-csv": "^4.3.
|
|
73
|
-
"@things-factory/export-ui-excel": "^4.3.
|
|
74
|
-
"@things-factory/geography": "^4.3.
|
|
75
|
-
"@things-factory/grist-ui": "^4.3.
|
|
76
|
-
"@things-factory/help": "^4.3.
|
|
77
|
-
"@things-factory/i18n-base": "^4.3.
|
|
78
|
-
"@things-factory/
|
|
79
|
-
"@things-factory/
|
|
80
|
-
"@things-factory/
|
|
81
|
-
"@things-factory/
|
|
82
|
-
"@things-factory/
|
|
83
|
-
"@things-factory/
|
|
84
|
-
"@things-factory/
|
|
62
|
+
"@things-factory/apptool-ui": "^4.3.176",
|
|
63
|
+
"@things-factory/attachment-base": "^4.3.176",
|
|
64
|
+
"@things-factory/auth-ui": "^4.3.176",
|
|
65
|
+
"@things-factory/biz-base": "^4.3.176",
|
|
66
|
+
"@things-factory/board-service": "^4.3.176",
|
|
67
|
+
"@things-factory/board-ui": "^4.3.176",
|
|
68
|
+
"@things-factory/code-ui": "^4.3.176",
|
|
69
|
+
"@things-factory/context-ui": "^4.3.176",
|
|
70
|
+
"@things-factory/dashboard": "^4.3.176",
|
|
71
|
+
"@things-factory/export-ui": "^4.3.176",
|
|
72
|
+
"@things-factory/export-ui-csv": "^4.3.176",
|
|
73
|
+
"@things-factory/export-ui-excel": "^4.3.176",
|
|
74
|
+
"@things-factory/geography": "^4.3.176",
|
|
75
|
+
"@things-factory/grist-ui": "^4.3.176",
|
|
76
|
+
"@things-factory/help": "^4.3.176",
|
|
77
|
+
"@things-factory/i18n-base": "^4.3.176",
|
|
78
|
+
"@things-factory/import-ui": "^4.3.159",
|
|
79
|
+
"@things-factory/import-ui-excel": "^4.3.159",
|
|
80
|
+
"@things-factory/integration-fulfillment": "^4.3.176",
|
|
81
|
+
"@things-factory/integration-lmd": "^4.3.176",
|
|
82
|
+
"@things-factory/lite-menu": "^4.3.176",
|
|
83
|
+
"@things-factory/marketplace-base": "^4.3.177",
|
|
84
|
+
"@things-factory/more-ui": "^4.3.176",
|
|
85
|
+
"@things-factory/notification": "^4.3.176",
|
|
86
|
+
"@things-factory/oauth2-client": "^4.3.176",
|
|
85
87
|
"@things-factory/pdf": "^4.3.159",
|
|
86
|
-
"@things-factory/product-base": "^4.3.
|
|
87
|
-
"@things-factory/resource-ui": "^4.3.
|
|
88
|
+
"@things-factory/product-base": "^4.3.176",
|
|
89
|
+
"@things-factory/resource-ui": "^4.3.176",
|
|
88
90
|
"@things-factory/scene-data-transform": "^4.3.159",
|
|
89
91
|
"@things-factory/scene-excel": "^4.3.159",
|
|
90
92
|
"@things-factory/scene-firebase": "^4.3.159",
|
|
91
93
|
"@things-factory/scene-form": "^4.3.159",
|
|
92
94
|
"@things-factory/scene-google-map": "^4.3.159",
|
|
93
95
|
"@things-factory/scene-graphql": "^4.3.159",
|
|
94
|
-
"@things-factory/scene-label": "^4.3.
|
|
96
|
+
"@things-factory/scene-label": "^4.3.176",
|
|
95
97
|
"@things-factory/scene-marker": "^4.3.159",
|
|
96
98
|
"@things-factory/scene-mqtt": "^4.3.159",
|
|
97
99
|
"@things-factory/scene-restful": "^4.3.159",
|
|
98
100
|
"@things-factory/scene-visualizer": "^4.3.159",
|
|
99
|
-
"@things-factory/setting-ui": "^4.3.
|
|
100
|
-
"@things-factory/system-ui": "^4.3.
|
|
101
|
-
"@things-factory/warehouse-base": "^4.3.
|
|
101
|
+
"@things-factory/setting-ui": "^4.3.176",
|
|
102
|
+
"@things-factory/system-ui": "^4.3.176",
|
|
103
|
+
"@things-factory/warehouse-base": "^4.3.177"
|
|
102
104
|
},
|
|
103
105
|
"devDependencies": {
|
|
104
106
|
"@things-factory/builder": "^4.3.159",
|
|
105
107
|
"@types/node-fetch": "^2.5.7"
|
|
106
108
|
},
|
|
107
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "9fe26b4f1912973afbe913715116a27ba6ec0c35"
|
|
108
110
|
}
|
package/translations/en.json
CHANGED
|
@@ -285,6 +285,7 @@
|
|
|
285
285
|
"text.confirm_stock_replenishment": "confirm stock replenishment",
|
|
286
286
|
"text.create_a_draft_product": "create a draft product",
|
|
287
287
|
"text.create_new_variation_draft": "create new variation draft",
|
|
288
|
+
"text.data_imported_successfully": "data imported successfully",
|
|
288
289
|
"text.data_updated_successfully": "data updated successfully",
|
|
289
290
|
"text.delivery_type_is_empty": "delivery type is empty",
|
|
290
291
|
"text.do_you_want_to_update_x": "do you want to update {x}",
|