@things-factory/operato-wms 4.0.23 → 4.0.27

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 (101) hide show
  1. package/client/bootstrap.js +1 -1
  2. package/client/pages/adjustment/transfer-inventory.js +32 -6
  3. package/client/pages/billing/claim-chit/claim-chit-detail.js +32 -35
  4. package/client/pages/billing/claim-chit/claim-chit-list.js +17 -17
  5. package/client/pages/billing/claim-chit/create-claim-chit.js +39 -30
  6. package/client/pages/billing/transport-summary-report.js +21 -23
  7. package/client/pages/bulk-operation/bulk-operation.js +189 -64
  8. package/client/pages/bulk-operation/validate-gan-popup.js +391 -0
  9. package/client/pages/bulk-operation/validate-ro-popup.js +44 -54
  10. package/client/pages/components/popup-unloading.js +47 -34
  11. package/client/pages/components/select-product-popup.js +74 -27
  12. package/client/pages/components/worksheet-information-popup.js +100 -0
  13. package/client/pages/inbound/expiry-date-popup.js +2 -2
  14. package/client/pages/inbound/inbound-reusable-pallet.js +21 -19
  15. package/client/pages/inbound/palletizing-pallets-popup.js +10 -9
  16. package/client/pages/inbound/putaway-product.js +196 -235
  17. package/client/pages/inbound/putaway-worksheet-generate-popup.js +4 -4
  18. package/client/pages/inbound/undo-unload-popup.js +295 -0
  19. package/client/pages/inbound/unload-product.js +236 -646
  20. package/client/pages/inbound/unloaded-inventories-popup.js +129 -0
  21. package/client/pages/inbound/vas-selector.js +9 -8
  22. package/client/pages/inbound/worksheet-unloading.js +15 -11
  23. package/client/pages/inventory/inventory-adjustment.js +9 -10
  24. package/client/pages/inventory-check/check-inventory-popup.js +20 -18
  25. package/client/pages/inventory-check/cycle-count-recheck-popup.js +25 -15
  26. package/client/pages/inventory-check/inspecting-product.js +2 -2
  27. package/client/pages/inventory-check/inventory-check-list.js +30 -19
  28. package/client/pages/inventory-check/search-popup.js +15 -14
  29. package/client/pages/inventory-check/worksheet-cycle-count.js +17 -15
  30. package/client/pages/master/location-list.js +60 -52
  31. package/client/pages/master/pallet-list.js +34 -30
  32. package/client/pages/master/print-location-label.js +37 -36
  33. package/client/pages/master/product/product-list.js +1 -1
  34. package/client/pages/master/warehouse-list.js +33 -29
  35. package/client/pages/master/worker-list.js +30 -30
  36. package/client/pages/order/arrival-notice/arrival-notice-detail.js +409 -21
  37. package/client/pages/order/arrival-notice/assign-buffer-location.js +1 -1
  38. package/client/pages/order/arrival-notice/create-arrival-notice.js +89 -13
  39. package/client/pages/order/arrival-notice/duplicate-arrival-notice.js +90 -10
  40. package/client/pages/order/arrival-notice/edit-product-popup.js +2 -2
  41. package/client/pages/order/goods-received-note/customer-grn-list.js +9 -8
  42. package/client/pages/order/goods-received-note/customer-received-note.js +8 -7
  43. package/client/pages/order/goods-received-note/received-note-list.js +9 -8
  44. package/client/pages/order/release-order/b2b/b2b-order-list.js +78 -2
  45. package/client/pages/order/release-order/b2b/b2b-order-requests.js +32 -16
  46. package/client/pages/order/release-order/b2c/b2c-order-requests.js +49 -5
  47. package/client/pages/order/release-order/batch-generate-single-picking-worksheet-popup.js +314 -0
  48. package/client/pages/order/release-order/batch-picking-popup.js +19 -2
  49. package/client/pages/order/release-order/create-release-order.js +194 -89
  50. package/client/pages/order/release-order/release-extra-product-popup.js +3 -7
  51. package/client/pages/order/release-order/release-order-detail.js +390 -107
  52. package/client/pages/order/return-order/check-return-order.js +15 -13
  53. package/client/pages/order/return-order/create-return-order.js +3 -3
  54. package/client/pages/order/return-order/receive-return-order-requests.js +25 -22
  55. package/client/pages/order/return-order/rejected-return-order.js +8 -14
  56. package/client/pages/order/return-order/return-order-assign-buffer-location.js +16 -14
  57. package/client/pages/order/return-order/return-order-detail.js +35 -31
  58. package/client/pages/order/return-order/return-order-list.js +9 -8
  59. package/client/pages/order/return-order/return-order-requests.js +20 -18
  60. package/client/pages/order/reverse-kitting-order/reverse-kitting-order-list.js +9 -8
  61. package/client/pages/order/transfer-order/receive-transfer-order-request.js +67 -66
  62. package/client/pages/order/transfer-order/rejected-transfer-order.js +7 -6
  63. package/client/pages/order/transfer-order/transfer-order-detail.js +7 -6
  64. package/client/pages/order/transfer-order/transfer-order-requests.js +20 -18
  65. package/client/pages/order/transport-order/contact-point-selector-popup.js +20 -20
  66. package/client/pages/order/transport-order/create-delivery-order.js +1 -1
  67. package/client/pages/order/transport-order/delivery-note-popup.js +52 -46
  68. package/client/pages/order/transport-order/delivery-order-list.js +1 -1
  69. package/client/pages/order/transport-order/print-delivery-note.js +17 -16
  70. package/client/pages/order/transport-order/upload-delivery-note.js +21 -18
  71. package/client/pages/order/transport-order/view-delivery-note.js +19 -22
  72. package/client/pages/order/vas-order/create-vas-order.js +12 -11
  73. package/client/pages/order/vas-order/receive-vas-order.js +25 -22
  74. package/client/pages/order/vas-order/vas-order-detail.js +26 -23
  75. package/client/pages/order/vas-order/vas-order-list.js +9 -8
  76. package/client/pages/order/vas-order/vas-order-requests.js +11 -12
  77. package/client/pages/outbound/outbound-reusable-pallet.js +25 -33
  78. package/client/pages/outbound/packing-product.js +111 -236
  79. package/client/pages/outbound/picking-product.js +288 -380
  80. package/client/pages/outbound/single-outbound-worksheet.js +9 -8
  81. package/client/pages/outbound/sorting-product.js +66 -63
  82. package/client/pages/outbound/worksheet-loading.js +7 -3
  83. package/client/pages/outbound/worksheet-packing.js +3 -3
  84. package/client/pages/outbound/worksheet-picking.js +22 -18
  85. package/client/pages/report/job-sheet-list.js +9 -8
  86. package/client/pages/vas/print-product-label.js +17 -9
  87. package/client/route.js +16 -32
  88. package/dist-server/graphql/resolvers/reports/product-label-report.js +1 -0
  89. package/dist-server/graphql/resolvers/reports/product-label-report.js.map +1 -1
  90. package/package.json +65 -65
  91. package/server/graphql/resolvers/reports/product-label-report.ts +1 -0
  92. package/things-factory.config.js +0 -16
  93. package/translations/en.json +34 -2
  94. package/translations/ko.json +34 -3
  95. package/translations/ms.json +34 -3
  96. package/translations/zh.json +34 -3
  97. package/client/pages/inbound/location-selector.js +0 -224
  98. package/client/pages/master/picking-bin-list.js +0 -354
  99. package/client/pages/order/retail-replenishment-order/retail-replenishment-order-detail.js +0 -315
  100. package/client/pages/order/retail-replenishment-order/retail-replenishment-order-requests.js +0 -307
  101. package/client/pages/order/vas-order/rejected-vas-order.js +0 -300
@@ -2,6 +2,7 @@ import '@things-factory/grist-ui'
2
2
  import '../../components/attachment-viewer'
3
3
  import '../../components/vas-templates'
4
4
  import './release-extra-product-popup'
5
+ import '../../components/popup-note'
5
6
 
6
7
  import gql from 'graphql-tag'
7
8
  import { css, html } from 'lit-element'
@@ -52,7 +53,9 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
52
53
  _releaseOrder: Object,
53
54
  _shippingOrder: Object,
54
55
  _containerArrivalDate: Date,
55
- _containerLeavingDate: Date
56
+ _containerLeavingDate: Date,
57
+ _vasExpanded: Boolean,
58
+ isUserBelongsDomain: Boolean
56
59
  }
57
60
  }
58
61
 
@@ -110,6 +113,20 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
110
113
  padding-top: var(--grist-title-with-grid-padding);
111
114
  }
112
115
 
116
+ .vas[collapsable] {
117
+ height: 40%;
118
+ }
119
+ .vas[collapsable][collapsed] {
120
+ display: none;
121
+ }
122
+ data-grist#vas-grist {
123
+ padding-top: 0px;
124
+ height: 100%;
125
+ }
126
+ h2.vas-title {
127
+ padding-bottom: 0px;
128
+ }
129
+
113
130
  [options-wrap] *,
114
131
  [attachment-wrap] a * {
115
132
  vertical-align: middle;
@@ -234,18 +251,20 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
234
251
  />
235
252
  <label for="exportOption">${i18next.t('label.export')}</label>
236
253
 
237
- ${this._crossDocking
238
- ? html`
239
- <input
240
- id="crossDocking"
241
- type="checkbox"
242
- name="crossDocking"
243
- ?checked="${this._crossDocking}"
244
- disabled
245
- />
246
- <label for="crossDocking">${i18next.t('label.cross_docking')}</label>
247
- `
248
- : ''}
254
+ ${
255
+ this._crossDocking
256
+ ? html`
257
+ <input
258
+ id="crossDocking"
259
+ type="checkbox"
260
+ name="crossDocking"
261
+ ?checked="${this._crossDocking}"
262
+ disabled
263
+ />
264
+ <label for="crossDocking">${i18next.t('label.cross_docking')}</label>
265
+ `
266
+ : ''
267
+ }
249
268
  </div>
250
269
 
251
270
  <label>${i18next.t('label.company')}</label>
@@ -275,75 +294,81 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
275
294
  <label ?hidden="${this.roType === 'b2b'}">${i18next.t('label.delivery_address')}</label>
276
295
  <textarea name="deliveryAddress1" ?hidden="${this.roType === 'b2b'}" rows="5" readonly></textarea>
277
296
 
278
- ${this._crossDocking
279
- ? html`
280
- <label for="ganNo">${i18next.t('label.arrival_notice')}</label>
281
- <input disabled name="ganNo" .value="${this._ganNo}" />
282
- `
283
- : ''}
284
- ${this._attachments?.length > 0
285
- ? html`
286
- <label>${i18next.t('label.attachment')}</label>
287
- <ul attachment-wrap>
288
- ${(this._attachments || []).map(
289
- attachment =>
290
- html`
291
- <li>
292
- <a href="${location.origin}/attachment/${attachment.path}" download
293
- ><mwc-icon>attach_file</mwc-icon> ${attachment.name}</a
294
- >
295
- </li>
296
- `
297
- )}
298
- </ul>
299
- `
300
- : ''}
297
+ ${
298
+ this._crossDocking
299
+ ? html`
300
+ <label for="ganNo">${i18next.t('label.arrival_notice')}</label>
301
+ <input disabled name="ganNo" .value="${this._ganNo}" />
302
+ `
303
+ : ''
304
+ }
305
+ ${
306
+ this._attachments?.length > 0
307
+ ? html`
308
+ <label>${i18next.t('label.attachment')}</label>
309
+ <ul attachment-wrap>
310
+ ${(this._attachments || []).map(
311
+ attachment =>
312
+ html`
313
+ <li>
314
+ <a href="${location.origin}/attachment/${attachment.path}" download
315
+ ><mwc-icon>attach_file</mwc-icon> ${attachment.name}</a
316
+ >
317
+ </li>
318
+ `
319
+ )}
320
+ </ul>
321
+ `
322
+ : ''
323
+ }
301
324
  </fieldset>
302
325
  </form>
303
326
 
304
327
  <barcode-tag bcid="qrcode" .value=${this._releaseOrderNo}></barcode-tag>
305
328
  </div>
306
329
 
307
- ${this._exportOption
308
- ? html`
309
- <div class="so-form-container">
310
- <form name="shippingOrder" class="multi-column-form">
311
- <fieldset>
312
- <legend>${i18next.t('title.export_order')}</legend>
313
- <label>${i18next.t('label.container_no')}</label>
314
- <input name="containerNo" ?readonly="${!this?._editable}" required />
315
-
316
- <label>${i18next.t('label.container_arrival_date')}</label>
317
- <input
318
- name="containerArrivalDate"
319
- type="date"
320
- ?readonly="${!this?._editable}"
321
- .value="${this._containerArrivalDate}"
322
- @change="${e => {
323
- this._containerLeavingDateInput.setAttribute('min', e.currentTarget.value)
324
- required
325
- }}"
326
- />
327
-
328
- <label>${i18next.t('label.container_leaving_date')}</label>
329
- <input
330
- name="containerLeavingDate"
331
- type="date"
332
- ?readonly="${!this?._editable}"
333
- .value="${this._containerLeavingDate}"
334
- @change="${e => {
335
- this._containerArrivalDateInput.setAttribute('max', e.currentTarget.value)
336
- required
337
- }}"
338
- />
339
-
340
- <label>${i18next.t('label.ship_name')}</label>
341
- <input name="shipName" ?readonly="${!this?._editable}" required />
342
- </fieldset>
343
- </form>
344
- </div>
345
- `
346
- : ''}
330
+ ${
331
+ this._exportOption
332
+ ? html`
333
+ <div class="so-form-container">
334
+ <form name="shippingOrder" class="multi-column-form">
335
+ <fieldset>
336
+ <legend>${i18next.t('title.export_order')}</legend>
337
+ <label>${i18next.t('label.container_no')}</label>
338
+ <input name="containerNo" ?readonly="${!this?._editable}" required />
339
+
340
+ <label>${i18next.t('label.container_arrival_date')}</label>
341
+ <input
342
+ name="containerArrivalDate"
343
+ type="date"
344
+ ?readonly="${!this?._editable}"
345
+ .value="${this._containerArrivalDate}"
346
+ @change="${e => {
347
+ this._containerLeavingDateInput.setAttribute('min', e.currentTarget.value)
348
+ required
349
+ }}"
350
+ />
351
+
352
+ <label>${i18next.t('label.container_leaving_date')}</label>
353
+ <input
354
+ name="containerLeavingDate"
355
+ type="date"
356
+ ?readonly="${!this?._editable}"
357
+ .value="${this._containerLeavingDate}"
358
+ @change="${e => {
359
+ this._containerArrivalDateInput.setAttribute('max', e.currentTarget.value)
360
+ required
361
+ }}"
362
+ />
363
+
364
+ <label>${i18next.t('label.ship_name')}</label>
365
+ <input name="shipName" ?readonly="${!this?._editable}" required />
366
+ </fieldset>
367
+ </form>
368
+ </div>
369
+ `
370
+ : ''
371
+ }
347
372
 
348
373
  <div class="container">
349
374
  <div class="grist">
@@ -355,13 +380,24 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
355
380
  .data=${this.inventoryData}
356
381
  ></data-grist>
357
382
 
358
- <h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.vas')}</h2>
359
- <data-grist
360
- id="vas-grist"
361
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
362
- .config=${this.vasGristConfig}
363
- .data="${this.vasData}"
364
- ></data-grist>
383
+ <h2
384
+ @click="${e => {
385
+ this._vasExpanded = !this._vasExpanded
386
+ }}"
387
+ >
388
+ <mwc-icon>list_alt</mwc-icon>${i18next.t('title.vas')}<mwc-icon
389
+ >${this._vasExpanded ? 'expand_less' : 'expand_more'}</mwc-icon
390
+ >
391
+ </h2>
392
+ <div class="vas" collapsable ?collapsed=${!this._vasExpanded}>
393
+ <data-grist
394
+ id="vas-grist"
395
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
396
+ .config=${this.vasGristConfig}
397
+ .data="${this.vasData}"
398
+ ></data-grist>
399
+ </div>
400
+ </div>
365
401
  </div>
366
402
 
367
403
  <div class="guide-container">${this._template}</div>
@@ -375,9 +411,11 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
375
411
  this._editable = false
376
412
  this._disableTransport = false
377
413
  this._shippingOrder = null
414
+ this._vasExpanded = false
378
415
  }
379
416
 
380
417
  get context() {
418
+ this._vasExpanded = false
381
419
  let userIsOfficeAdmin = this._userRoles
382
420
  ? this._userRoles.find(x => x.name?.toLowerCase() === 'office admin')
383
421
  : false
@@ -385,21 +423,74 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
385
423
  var actions = [
386
424
  {
387
425
  title: i18next.t('button.back_to_list'),
388
- action: () =>
389
- this.roType === 'b2b'
390
- ? userIsOfficeAdmin
391
- ? navigate(`b2b_order_requests`)
392
- : navigate(`b2b_orders`)
393
- : navigate(`b2c_order_requests`),
426
+ action: () => (this.roType === 'b2b' ? navigate(`b2b_orders`) : navigate(`b2c_order_requests`)),
394
427
  ...CommonButtonStyles.back
395
428
  }
396
429
  ]
397
- if (this._editable) {
398
- actions.push({
399
- title: i18next.t('button.update_order_details'),
400
- action: this._updateReleaseGoodDetails.bind(this),
401
- ...CommonButtonStyles.add
402
- })
430
+ if (this.isUserBelongsDomain) {
431
+ if (this._status === ORDER_STATUS.PENDING_RECEIVE.value && !this._crossDocking) {
432
+ actions.push(
433
+ {
434
+ title: i18next.t('button.reject'),
435
+ action: this._rejectReleaseOrder.bind(this),
436
+ ...CommonButtonStyles.reject
437
+ },
438
+ {
439
+ title: i18next.t('button.receive'),
440
+ action: this._receiveReleaseOrder.bind(this),
441
+ ...CommonButtonStyles.confirm
442
+ }
443
+ )
444
+ }
445
+
446
+ if (this._status === ORDER_STATUS.PENDING_CANCEL.value && !this._crossDocking) {
447
+ actions.push(
448
+ {
449
+ title: i18next.t('button.approve_cancellation'),
450
+ action: this._confirmCancellationReleaseOrder.bind(this),
451
+ ...CommonButtonStyles.cancel
452
+ },
453
+ {
454
+ title: i18next.t('button.reject_cancellation'),
455
+ action: this._rejectCancellationReleaseOrder.bind(this),
456
+ ...CommonButtonStyles.reject
457
+ }
458
+ )
459
+ }
460
+
461
+ if (this._status === ORDER_STATUS.PENDING_WORKSHEET.value && !this._crossDocking) {
462
+ actions.push({
463
+ title: i18next.t('button.generate_picking_worksheet'),
464
+ action: this._generateSinglePickingWorksheet.bind(this),
465
+ ...CommonButtonStyles.generate
466
+ })
467
+ }
468
+
469
+ if (this._crossDocking) {
470
+ const params = new URLSearchParams()
471
+ params.append('name', this._ganNo)
472
+ actions.push({
473
+ title: i18next.t('button.move_to_x', { state: { x: i18next.t('title.arrival_notice') } }),
474
+ action: () => navigate(`arrival_notice_requests?${params.toString()}`)
475
+ })
476
+ }
477
+
478
+ if (this._editable) {
479
+ actions.push({
480
+ title: i18next.t('button.update_order_details'),
481
+ action: this._updateReleaseGoodDetails.bind(this),
482
+ ...CommonButtonStyles.add
483
+ })
484
+ }
485
+
486
+ let addProductStatus = [ORDER_STATUS.PICKING.value, ORDER_STATUS.LOADING.value]
487
+ if (addProductStatus.indexOf(this._status) >= 0 && this._allowROAddProductSetting) {
488
+ actions.push({
489
+ title: i18next.t('button.edit'),
490
+ action: this._openExtraProductPopup.bind(this),
491
+ ...CommonButtonStyles.edit
492
+ })
493
+ }
403
494
  }
404
495
 
405
496
  if (this._status === ORDER_STATUS.PENDING.value) {
@@ -432,15 +523,6 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
432
523
  })
433
524
  }
434
525
 
435
- let addProductStatus = [ORDER_STATUS.PICKING.value, ORDER_STATUS.LOADING.value]
436
- if (addProductStatus.indexOf(this._status) >= 0 && this._allowROAddProductSetting) {
437
- actions.push({
438
- title: i18next.t('button.edit'),
439
- action: this._openExtraProductPopup.bind(this),
440
- ...CommonButtonStyles.edit
441
- })
442
- }
443
-
444
526
  return {
445
527
  title: i18next.t('title.release_order_detail'),
446
528
  actions
@@ -493,6 +575,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
493
575
  }
494
576
 
495
577
  async pageInitialized() {
578
+ this.isUserBelongsDomain = await this._checkUserBelongsDomain()
496
579
  let [allowROAddProductSetting, userRoles] = [fetchSettingRule('allow-ro-add-product'), this.fetchUserRoleHandler()]
497
580
  let [enableTransportationServiceSetting] = await Promise.all([fetchSettingRule('enable-transportation-service')])
498
581
 
@@ -882,6 +965,188 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
882
965
  }
883
966
  }
884
967
 
968
+ async _rejectReleaseOrder() {
969
+ const popup = openPopup(
970
+ html`
971
+ <popup-note
972
+ .title="${i18next.t('title.remark')}"
973
+ @submit="${async e => {
974
+ try {
975
+ if (!e.detail.value) throw new Error(i18next.t('text.remark_is_empty'))
976
+ const result = await CustomAlert({
977
+ title: i18next.t('title.are_you_sure'),
978
+ text: i18next.t('text.reject_release_order'),
979
+ confirmButton: { text: i18next.t('button.confirm') },
980
+ cancelButton: { text: i18next.t('button.cancel') }
981
+ })
982
+
983
+ if (!result.value) {
984
+ return
985
+ }
986
+
987
+ if (this._crossDocking) {
988
+ const result = await CustomAlert({
989
+ title: i18next.t('title.cross_docking'),
990
+ text: i18next.t('text.related_order_will_be_rejected'),
991
+ confirmButton: { text: i18next.t('button.confirm') },
992
+ cancelButton: { text: i18next.t('button.cancel') }
993
+ })
994
+
995
+ if (!result.value) return
996
+ }
997
+
998
+ const response = await client.mutate({
999
+ mutation: gql`
1000
+ mutation rejectReleaseGood($name: String!, $patch: ReleaseGoodPatch!) {
1001
+ rejectReleaseGood(name: $name, patch: $patch) {
1002
+ name
1003
+ }
1004
+ }
1005
+ `,
1006
+ variables: { name: this._releaseOrderNo, patch: { remark: e.detail.value } }
1007
+ })
1008
+
1009
+ if (!response.errors) {
1010
+ if (this.roType === 'b2b') {
1011
+ navigate(`b2b_orders`)
1012
+ } else {
1013
+ navigate(`b2c_order_requests`)
1014
+ }
1015
+ this._showToast({ message: i18next.t('text.release_order_rejected') })
1016
+ }
1017
+ } catch (e) {
1018
+ this._showToast(e)
1019
+ }
1020
+ }}"
1021
+ ></popup-note>
1022
+ `,
1023
+ {
1024
+ backdrop: true,
1025
+ size: 'medium',
1026
+ title: i18next.t('title.reject_release_order')
1027
+ }
1028
+ )
1029
+
1030
+ popup.onclosed
1031
+ }
1032
+
1033
+ async _receiveReleaseOrder() {
1034
+ try {
1035
+ const result = await CustomAlert({
1036
+ title: i18next.t('title.are_you_sure'),
1037
+ text: i18next.t('text.accept_release_order'),
1038
+ confirmButton: { text: i18next.t('button.confirm') },
1039
+ cancelButton: { text: i18next.t('button.cancel') }
1040
+ })
1041
+
1042
+ if (!result.value) {
1043
+ return
1044
+ }
1045
+
1046
+ const response = await client.mutate({
1047
+ mutation: gql`
1048
+ mutation receiveReleaseGood($name: String!) {
1049
+ receiveReleaseGood(name: $name) {
1050
+ name
1051
+ status
1052
+ }
1053
+ }
1054
+ `,
1055
+ variables: { name: this._releaseOrderNo }
1056
+ })
1057
+
1058
+ if (!response.errors) {
1059
+ this._status = response.data.receiveReleaseGood.status
1060
+ this.updateContext()
1061
+ this._showToast({ message: i18next.t('text.release_order_received') })
1062
+ }
1063
+ } catch (e) {
1064
+ this._showToast(e)
1065
+ }
1066
+ }
1067
+
1068
+ async _confirmCancellationReleaseOrder() {
1069
+ try {
1070
+ const result = await CustomAlert({
1071
+ title: i18next.t('title.are_you_sure'),
1072
+ text: i18next.t('text.you_wont_be_able_to_revert_this'),
1073
+ confirmButton: { text: i18next.t('button.confirm') },
1074
+ cancelButton: { text: i18next.t('button.cancel') }
1075
+ })
1076
+
1077
+ if (!result.value) return
1078
+
1079
+ const response = await client.mutate({
1080
+ mutation: gql`
1081
+ mutation confirmCancellationReleaseOrder($name: String!) {
1082
+ confirmCancellationReleaseOrder(name: $name)
1083
+ }
1084
+ `,
1085
+ variables: { name: this._releaseOrderNo }
1086
+ })
1087
+
1088
+ if (!response.errors) {
1089
+ this._showToast({ message: i18next.t('text.release_order_has_been_cancelled') })
1090
+ this.roType === 'b2b' ? navigate(`b2b_orders`) : navigate(`b2c_order_requests`)
1091
+ }
1092
+ } catch (e) {
1093
+ throw e
1094
+ }
1095
+ }
1096
+
1097
+ async _rejectCancellationReleaseOrder() {
1098
+ try {
1099
+ const result = await CustomAlert({
1100
+ title: i18next.t('title.are_you_sure'),
1101
+ text: i18next.t('text.you_wont_be_able_to_revert_this'),
1102
+ confirmButton: { text: i18next.t('button.confirm') },
1103
+ cancelButton: { text: i18next.t('button.cancel') }
1104
+ })
1105
+
1106
+ if (!result.value) return
1107
+
1108
+ const response = await client.mutate({
1109
+ mutation: gql`
1110
+ mutation rejectCancellationReleaseOrder($name: String!) {
1111
+ rejectCancellationReleaseOrder(name: $name)
1112
+ }
1113
+ `,
1114
+ variables: { name: this._releaseOrderNo }
1115
+ })
1116
+
1117
+ if (!response.errors) {
1118
+ this._showToast({ message: i18next.t('text.cancellation_request_has_been_rejected') })
1119
+ this.roType === 'b2b' ? navigate(`b2b_orders`) : navigate(`b2c_order_requests`)
1120
+ }
1121
+ } catch (e) {
1122
+ throw e
1123
+ }
1124
+ }
1125
+
1126
+ async _generateSinglePickingWorksheet() {
1127
+ try {
1128
+ const response = await client.mutate({
1129
+ mutation: gql`
1130
+ mutation generateReleaseGoodWorksheet($releaseGoodNo: String!) {
1131
+ generateReleaseGoodWorksheet(releaseGoodNo: $releaseGoodNo) {
1132
+ pickingWorksheet {
1133
+ name
1134
+ }
1135
+ }
1136
+ }
1137
+ `,
1138
+ variables: { releaseGoodNo: this._releaseOrderNo }
1139
+ })
1140
+
1141
+ if (!response.errors) {
1142
+ navigate('single_outbound_worksheets')
1143
+ this._showToast({ message: i18next.t('text.worksheet_has_been_generated') })
1144
+ }
1145
+ } catch (e) {
1146
+ this._showToast(e)
1147
+ }
1148
+ }
1149
+
885
1150
  get _isDownloadable() {
886
1151
  return this._status !== ORDER_STATUS.PENDING.value
887
1152
  }
@@ -969,7 +1234,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
969
1234
 
970
1235
  if (!response.errors) {
971
1236
  this._showToast({ message: i18next.t('text.release_order_has_been_deleted') })
972
- userIsOfficeAdmin ? navigate(`b2b_order_requests`) : navigate(`b2b_orders`)
1237
+ navigate(`b2b_orders`)
973
1238
  }
974
1239
  } catch (e) {
975
1240
  this._showToast(e)
@@ -1002,7 +1267,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1002
1267
 
1003
1268
  if (!response.errors) {
1004
1269
  this._showToast({ message: i18next.t('text.release_order_is_submitted_for_cancellation') })
1005
- userIsOfficeAdmin ? navigate(`b2b_order_requests`) : navigate(`b2b_orders`)
1270
+ navigate(`b2b_orders`)
1006
1271
  }
1007
1272
  } catch (e) {
1008
1273
  throw e
@@ -1066,7 +1331,25 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1066
1331
 
1067
1332
  if (!response.errors) {
1068
1333
  this._showToast({ message: i18next.t('text.release_order_confirmed') })
1069
- userIsOfficeAdmin ? navigate(`b2b_order_requests`) : navigate(`b2b_orders`)
1334
+ navigate(`b2b_orders`)
1335
+ }
1336
+ } catch (e) {
1337
+ this._showToast(e)
1338
+ }
1339
+ }
1340
+
1341
+ async _checkUserBelongsDomain() {
1342
+ try {
1343
+ const response = await client.query({
1344
+ query: gql`
1345
+ query {
1346
+ checkUserBelongsDomain
1347
+ }
1348
+ `
1349
+ })
1350
+
1351
+ if (!response.errors) {
1352
+ return response.data.checkUserBelongsDomain
1070
1353
  }
1071
1354
  } catch (e) {
1072
1355
  this._showToast(e)
@@ -3,7 +3,7 @@ import '@things-factory/grist-ui'
3
3
  import { i18next, localize } from '@things-factory/i18n-base'
4
4
  import { client, CustomAlert, navigate, PageView, store } from '@things-factory/shell'
5
5
  import { CommonButtonStyles } from '@things-factory/styles'
6
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
6
+ import { isMobileDevice } from '@things-factory/utils'
7
7
  import gql from 'graphql-tag'
8
8
  import { css, html } from 'lit-element'
9
9
  import { connect } from 'pwa-helpers/connect-mixin'
@@ -315,10 +315,8 @@ class CheckReturnOrder extends connect(store)(localize(i18next)(PageView)) {
315
315
  if (!this._returnOrderNo) return
316
316
  const response = await client.query({
317
317
  query: gql`
318
- query {
319
- returnOrderDetail(${gqlBuilder.buildArgs({
320
- name: this._returnOrderNo
321
- })}) {
318
+ query returnOrderDetail($name: String!) {
319
+ returnOrderDetail(name: $name) {
322
320
  id
323
321
  name
324
322
  truckNo
@@ -361,7 +359,10 @@ class CheckReturnOrder extends connect(store)(localize(i18next)(PageView)) {
361
359
  }
362
360
  }
363
361
  }
364
- `
362
+ `,
363
+ variables: {
364
+ name: this._returnOrderNo
365
+ }
365
366
  })
366
367
 
367
368
  if (!response.errors) {
@@ -432,16 +433,17 @@ class CheckReturnOrder extends connect(store)(localize(i18next)(PageView)) {
432
433
 
433
434
  if (!result.value) return
434
435
 
435
- const response = await client.query({
436
- query: gql`
437
- mutation {
438
- checkReturnOrder(${gqlBuilder.buildArgs({
439
- name: this._returnOrderNo
440
- })}) {
436
+ const response = await client.mutate({
437
+ mutation: gql`
438
+ mutation checkReturnOrder($name: String!) {
439
+ checkReturnOrder(name: $name) {
441
440
  name
442
441
  }
443
442
  }
444
- `
443
+ `,
444
+ variables: {
445
+ name: this._returnOrderNo
446
+ }
445
447
  })
446
448
 
447
449
  if (!response.errors) {
@@ -313,9 +313,9 @@ class CreateReturnOrder extends localize(i18next)(PageView) {
313
313
  this._warehouseTransport = false
314
314
  this._checkTransport = false
315
315
 
316
- if (this._ownTransportInput) {
317
- this._ownTransportInput.checked = false
318
- }
316
+ // if (this._ownTransportInput) {
317
+ // this._ownTransportInput.checked = false
318
+ // }
319
319
 
320
320
  if (this._etaDateInput) {
321
321
  this._etaDateInput.value = ''