@things-factory/operato-wms 4.3.593 → 4.3.596

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 (118) hide show
  1. package/client/pages/components/list-view/product-list-view.js +378 -0
  2. package/client/pages/constants/picking-standard.js +1 -0
  3. package/client/pages/constants/worksheet.js +12 -0
  4. package/client/pages/order/release-order/b2b/b2b-order-list.js +91 -39
  5. package/client/pages/outbound/generate-worksheet-popup.js +188 -25
  6. package/client/pages/outbound/loading-v2/delivery-order-info.js +205 -0
  7. package/client/pages/outbound/loading-v2/load-by-qty.js +151 -0
  8. package/client/pages/outbound/loading-v2/loading-execution-base.js +514 -0
  9. package/client/pages/outbound/loading-v2/loading-execution.js +392 -0
  10. package/client/pages/outbound/loading-v2/loading.js +419 -0
  11. package/client/pages/outbound/loading-v2/release-good-info.js +93 -0
  12. package/client/pages/outbound/loading-v2/show-my-loading-worksheet-list-popup.js +93 -0
  13. package/client/pages/outbound/loading-v2/warehouse-return-popup.js +194 -0
  14. package/client/pages/outbound/picking-v2/issue-details-popup.js +163 -0
  15. package/client/pages/outbound/picking-v2/picking-execution-base.js +482 -0
  16. package/client/pages/outbound/picking-v2/picking-execution.js +379 -0
  17. package/client/pages/outbound/picking-v2/picking.js +387 -0
  18. package/client/pages/outbound/picking-v2/report-issue-popup.js +139 -0
  19. package/client/pages/outbound/picking-v2/scan-bin-no-popup.js +126 -0
  20. package/client/pages/outbound/picking-v2/worksheet-info.js +200 -0
  21. package/client/pages/outbound/select-operator-popup.js +6 -3
  22. package/client/pages/outbound/show-my-worksheet-list-popup.js +6 -2
  23. package/client/pages/outbound/worksheet-zone-picking.js +507 -0
  24. package/client/pages/outbound/zone-worksheet.js +574 -0
  25. package/client/route.js +15 -0
  26. package/dist-server/graphql/resolvers/index.js +11 -2
  27. package/dist-server/graphql/resolvers/index.js.map +1 -1
  28. package/dist-server/graphql/resolvers/outbound/complete-load.js +96 -0
  29. package/dist-server/graphql/resolvers/outbound/complete-load.js.map +1 -0
  30. package/dist-server/graphql/resolvers/outbound/find-loadable-release-good.js +58 -0
  31. package/dist-server/graphql/resolvers/outbound/find-loadable-release-good.js.map +1 -0
  32. package/dist-server/graphql/resolvers/outbound/get-delivery-orders.js +29 -0
  33. package/dist-server/graphql/resolvers/outbound/get-delivery-orders.js.map +1 -0
  34. package/dist-server/graphql/resolvers/outbound/get-loading-task.js +86 -0
  35. package/dist-server/graphql/resolvers/outbound/get-loading-task.js.map +1 -0
  36. package/dist-server/graphql/resolvers/outbound/index.js +16 -0
  37. package/dist-server/graphql/resolvers/outbound/index.js.map +1 -0
  38. package/dist-server/graphql/resolvers/outbound/load-by-qty.js +112 -0
  39. package/dist-server/graphql/resolvers/outbound/load-by-qty.js.map +1 -0
  40. package/dist-server/graphql/resolvers/outbound/loading-worksheet-v2.js +122 -0
  41. package/dist-server/graphql/resolvers/outbound/loading-worksheet-v2.js.map +1 -0
  42. package/dist-server/graphql/resolvers/outbound/my-loading-assignment-status.js +32 -0
  43. package/dist-server/graphql/resolvers/outbound/my-loading-assignment-status.js.map +1 -0
  44. package/dist-server/graphql/resolvers/outbound/sort-item.js +65 -0
  45. package/dist-server/graphql/resolvers/outbound/sort-item.js.map +1 -0
  46. package/dist-server/graphql/resolvers/outbound/undo-load.js +72 -0
  47. package/dist-server/graphql/resolvers/outbound/undo-load.js.map +1 -0
  48. package/dist-server/graphql/resolvers/outbound/warehouse-return.js +101 -0
  49. package/dist-server/graphql/resolvers/outbound/warehouse-return.js.map +1 -0
  50. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js +53 -25
  51. package/dist-server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.js.map +1 -1
  52. package/dist-server/graphql/resolvers/zone-worksheet/activate-zone-worksheet.js +91 -0
  53. package/dist-server/graphql/resolvers/zone-worksheet/activate-zone-worksheet.js.map +1 -0
  54. package/dist-server/graphql/resolvers/zone-worksheet/assign-sorter.js +36 -0
  55. package/dist-server/graphql/resolvers/zone-worksheet/assign-sorter.js.map +1 -0
  56. package/dist-server/graphql/resolvers/zone-worksheet/generate-zone-worksheet.js +103 -0
  57. package/dist-server/graphql/resolvers/zone-worksheet/generate-zone-worksheet.js.map +1 -0
  58. package/dist-server/graphql/resolvers/zone-worksheet/get-zone-picking-task.js +98 -0
  59. package/dist-server/graphql/resolvers/zone-worksheet/get-zone-picking-task.js.map +1 -0
  60. package/dist-server/graphql/resolvers/zone-worksheet/index.js +12 -0
  61. package/dist-server/graphql/resolvers/zone-worksheet/index.js.map +1 -0
  62. package/dist-server/graphql/resolvers/zone-worksheet/zone-picking.js +327 -0
  63. package/dist-server/graphql/resolvers/zone-worksheet/zone-picking.js.map +1 -0
  64. package/dist-server/graphql/resolvers/zone-worksheet/zone-worksheet.js +146 -0
  65. package/dist-server/graphql/resolvers/zone-worksheet/zone-worksheet.js.map +1 -0
  66. package/dist-server/graphql/types/index.js +11 -3
  67. package/dist-server/graphql/types/index.js.map +1 -1
  68. package/dist-server/graphql/types/outbound/delivery-order-info-list.js +14 -0
  69. package/dist-server/graphql/types/outbound/delivery-order-info-list.js.map +1 -0
  70. package/dist-server/graphql/types/outbound/index.js +23 -0
  71. package/dist-server/graphql/types/outbound/index.js.map +1 -0
  72. package/dist-server/graphql/types/outbound/loading-assignment.js +15 -0
  73. package/dist-server/graphql/types/outbound/loading-assignment.js.map +1 -0
  74. package/dist-server/graphql/types/outbound/loading-worksheet-type.js +25 -0
  75. package/dist-server/graphql/types/outbound/loading-worksheet-type.js.map +1 -0
  76. package/dist-server/graphql/types/zone-worksheet/index.js +22 -0
  77. package/dist-server/graphql/types/zone-worksheet/index.js.map +1 -0
  78. package/dist-server/graphql/types/zone-worksheet/zone-picking-worksheet.js +18 -0
  79. package/dist-server/graphql/types/zone-worksheet/zone-picking-worksheet.js.map +1 -0
  80. package/dist-server/graphql/types/zone-worksheet/zone-worksheet-overview-list.js +13 -0
  81. package/dist-server/graphql/types/zone-worksheet/zone-worksheet-overview-list.js.map +1 -0
  82. package/dist-server/graphql/types/zone-worksheet/zone-worksheet-overview.js +16 -0
  83. package/dist-server/graphql/types/zone-worksheet/zone-worksheet-overview.js.map +1 -0
  84. package/package.json +8 -8
  85. package/server/graphql/resolvers/index.ts +11 -2
  86. package/server/graphql/resolvers/outbound/complete-load.ts +126 -0
  87. package/server/graphql/resolvers/outbound/find-loadable-release-good.ts +61 -0
  88. package/server/graphql/resolvers/outbound/get-delivery-orders.ts +32 -0
  89. package/server/graphql/resolvers/outbound/get-loading-task.ts +105 -0
  90. package/server/graphql/resolvers/outbound/index.ts +26 -0
  91. package/server/graphql/resolvers/outbound/load-by-qty.ts +176 -0
  92. package/server/graphql/resolvers/outbound/loading-worksheet-v2.ts +131 -0
  93. package/server/graphql/resolvers/outbound/my-loading-assignment-status.ts +35 -0
  94. package/server/graphql/resolvers/outbound/sort-item.ts +81 -0
  95. package/server/graphql/resolvers/outbound/undo-load.ts +83 -0
  96. package/server/graphql/resolvers/outbound/warehouse-return.ts +129 -0
  97. package/server/graphql/resolvers/warehouse-inventory-adjustment/warehouse-intentory-adjustment.ts +77 -35
  98. package/server/graphql/resolvers/zone-worksheet/activate-zone-worksheet.ts +124 -0
  99. package/server/graphql/resolvers/zone-worksheet/assign-sorter.ts +49 -0
  100. package/server/graphql/resolvers/zone-worksheet/generate-zone-worksheet.ts +133 -0
  101. package/server/graphql/resolvers/zone-worksheet/get-zone-picking-task.ts +118 -0
  102. package/server/graphql/resolvers/zone-worksheet/index.ts +20 -0
  103. package/server/graphql/resolvers/zone-worksheet/zone-picking.ts +458 -0
  104. package/server/graphql/resolvers/zone-worksheet/zone-worksheet.ts +183 -0
  105. package/server/graphql/types/index.ts +11 -3
  106. package/server/graphql/types/outbound/delivery-order-info-list.ts +8 -0
  107. package/server/graphql/types/outbound/index.ts +22 -0
  108. package/server/graphql/types/outbound/loading-assignment.ts +9 -0
  109. package/server/graphql/types/outbound/loading-worksheet-type.ts +20 -0
  110. package/server/graphql/types/zone-worksheet/index.ts +21 -0
  111. package/server/graphql/types/zone-worksheet/zone-picking-worksheet.ts +12 -0
  112. package/server/graphql/types/zone-worksheet/zone-worksheet-overview-list.ts +7 -0
  113. package/server/graphql/types/zone-worksheet/zone-worksheet-overview.ts +10 -0
  114. package/things-factory.config.js +16 -0
  115. package/translations/en.json +30 -1
  116. package/translations/ko.json +27 -0
  117. package/translations/ms.json +29 -2
  118. package/translations/zh.json +27 -0
@@ -0,0 +1,387 @@
1
+ import '@things-factory/barcode-ui'
2
+ import '@things-factory/grist-ui'
3
+ import '../show-my-worksheet-list-popup'
4
+ import './picking-execution'
5
+
6
+ import gql from 'graphql-tag'
7
+ import { css, html, property } from 'lit-element'
8
+ import { sleep } from '@operato/utils'
9
+ import { MultiColumnFormStyles, SingleColumnFormStyles } from '@things-factory/form-ui'
10
+ import { i18next, localize } from '@things-factory/i18n-base'
11
+ import { openPopup } from '@things-factory/layout-base'
12
+ import { client, gqlContext, PageView, store } from '@things-factory/shell'
13
+ import { CommonButtonStyles } from '@things-factory/styles'
14
+ import { isMobileDevice } from '@things-factory/utils'
15
+ import { connect } from 'pwa-helpers/connect-mixin.js'
16
+
17
+ import { fetchLocationSortingRule } from '../../../fetch-location-sorting-rule'
18
+
19
+ import { showToast } from '../../../util'
20
+ import {
21
+ BATCH_PICKING,
22
+ LOCATION_SORTING_RULE,
23
+ PICKING,
24
+ WORKSHEET_STATUS
25
+ } from '../../constants'
26
+
27
+ const PICKING_TYPES = { PICKING, BATCH_PICKING }
28
+
29
+ class PickingProductV2 extends connect(store)(localize(i18next)(PageView)) {
30
+ static get properties() {
31
+ return {
32
+ _state: Object,
33
+ _data: Object,
34
+ _context: Object
35
+ }
36
+ }
37
+
38
+ @property() _context = {
39
+ title: i18next.t('title.picking'),
40
+ help: 'operato-wms/outbound/picking-product-2'
41
+ }
42
+
43
+ static get styles() {
44
+ return [
45
+ MultiColumnFormStyles,
46
+ SingleColumnFormStyles,
47
+ css`
48
+ :host {
49
+ display: flex;
50
+ flex-direction: column;
51
+ overflow: hidden;
52
+ padding: 0;
53
+ }
54
+ data-grist {
55
+ overflow: auto;
56
+ flex: 1;
57
+ }
58
+ h2 {
59
+ padding: var(--subtitle-padding);
60
+ font: var(--subtitle-font);
61
+ color: var(--subtitle-text-color);
62
+ border-bottom: var(--subtitle-border-bottom);
63
+ }
64
+ legend mwc-icon {
65
+ vertical-align: middle;
66
+ margin: var(--grist-title-icon-margin);
67
+ font-size: var(--grist-title-icon-size);
68
+ color: var(--grist-title-icon-color);
69
+ cursor: pointer;
70
+ }
71
+ #worksheet-form {
72
+ grid-column: span 12;
73
+ padding: 0 10px;
74
+ }
75
+
76
+ @media screen and (max-width: 460px) {
77
+ .single-column-form {
78
+ max-width: 100%;
79
+ grid-gap: 5px;
80
+ }
81
+ }
82
+ `
83
+ ]
84
+ }
85
+
86
+ configContext(
87
+ actions = [
88
+ {
89
+ title: i18next.t('button.get_task'),
90
+ action: this.getTask.bind(this),
91
+ ...CommonButtonStyles.assignment
92
+ },
93
+ {
94
+ title: i18next.t('button.my_worksheet'),
95
+ action: showWorksheetList.bind(this),
96
+ ...CommonButtonStyles.inspect
97
+ }
98
+ ]
99
+ ) {
100
+ this._context = {
101
+ ...this._context,
102
+ actions
103
+ }
104
+
105
+ this.updateContext()
106
+ }
107
+
108
+ get context() {
109
+ return this._context
110
+ }
111
+
112
+ get worksheetNoInput() {
113
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=worksheetNo]')?.shadowRoot.querySelector('input')
114
+ }
115
+
116
+ constructor() {
117
+ super()
118
+ this.configContext()
119
+ }
120
+
121
+ render() {
122
+ if (this._data) {
123
+ return html`<picking-execution .parent=${this} .data=${this._data}></picking-execution>`
124
+ } else {
125
+ return html` <div class="${isMobileDevice() ? 'single-column-form' : 'multi-column-form'}">
126
+ <form id="worksheet-form">
127
+ <fieldset>
128
+ <legend>${i18next.t('title.scan')}</legend>
129
+ <label>${i18next.t('label.worksheet_no')}</label>
130
+ <barcode-scanable-input
131
+ name="worksheetNo"
132
+ custom-input
133
+ @keypress="${async e => {
134
+ try {
135
+ if (e.keyCode === 13) {
136
+ e.preventDefault()
137
+ this._data = await fetchWorksheet(this.worksheetNoInput.value, this.context.locationSortingRules)
138
+ this.updateContext()
139
+ }
140
+ } catch (e) {}
141
+ }}"
142
+ >
143
+ </barcode-scanable-input>
144
+ </fieldset>
145
+ </form>
146
+ </div>`
147
+ }
148
+ }
149
+
150
+ async pageUpdated(changes, lifecycle) {
151
+ if (this.active) {
152
+ }
153
+ }
154
+
155
+ async pageInitialized() {
156
+ this._context = {
157
+ ...this._context,
158
+ locationSortingRules: await fetchLocationSortingRule(LOCATION_SORTING_RULE.PICKING_PRODUCT.value)
159
+ }
160
+ }
161
+
162
+ async getTask() {
163
+ try {
164
+ const response = await client.mutate({
165
+ mutation: gql`
166
+ mutation getZonePickingTask {
167
+ getZonePickingTask {
168
+ worksheet {
169
+ id
170
+ name
171
+ type
172
+ status
173
+ startedAt
174
+ bizplace {
175
+ name
176
+ }
177
+ }
178
+ groupedOrderInventories {
179
+ inventory {
180
+ id
181
+ palletId
182
+ cartonId
183
+ batchId
184
+ expirationDate
185
+ location {
186
+ name
187
+ description
188
+ }
189
+ }
190
+ product {
191
+ sku
192
+ name
193
+ description
194
+ }
195
+ releaseQty
196
+ pickedQty
197
+ status
198
+ packingType
199
+ packingSize
200
+ }
201
+ inventoryChanges {
202
+ id
203
+ inventory {
204
+ id
205
+ product {
206
+ sku
207
+ name
208
+ }
209
+ }
210
+ palletId
211
+ status
212
+ transactionType
213
+ details
214
+ }
215
+ completable
216
+ }
217
+ }
218
+ `
219
+ })
220
+
221
+ if (!response.errors) {
222
+ let data = response.data.getZonePickingTask
223
+ this._data = mapWorksheetData(data)
224
+ }
225
+ } catch (e) {
226
+ showToast('Something went wrong. Please contact support.')
227
+ }
228
+ }
229
+ }
230
+
231
+ window.customElements.define('picking-product-v2', PickingProductV2)
232
+
233
+ async function fetchWorksheet(worksheetNo, locationSortingRules) {
234
+ if (!worksheetNo) return
235
+
236
+ try {
237
+ let response = await client.query({
238
+ query: gql`
239
+ query zonePickingWorksheet($name: String!, $locationSortingRules: [Sorting!], $filter: String) {
240
+ zonePickingWorksheet(name: $name, locationSortingRules: $locationSortingRules, filter: $filter) {
241
+ worksheet {
242
+ id
243
+ name
244
+ type
245
+ status
246
+ startedAt
247
+ bizplace {
248
+ name
249
+ }
250
+ }
251
+ groupedOrderInventories {
252
+ inventory {
253
+ id
254
+ palletId
255
+ cartonId
256
+ batchId
257
+ expirationDate
258
+ location {
259
+ name
260
+ description
261
+ }
262
+ }
263
+ product {
264
+ sku
265
+ name
266
+ description
267
+ }
268
+ releaseQty
269
+ pickedQty
270
+ status
271
+ packingType
272
+ packingSize
273
+ }
274
+ inventoryChanges {
275
+ id
276
+ inventory {
277
+ id
278
+ product {
279
+ sku
280
+ name
281
+ }
282
+ }
283
+ palletId
284
+ status
285
+ transactionType
286
+ details
287
+ }
288
+ completable
289
+ }
290
+ }
291
+ `,
292
+ variables: { name: worksheetNo, locationSortingRules: locationSortingRules, filter: 'PICKING' }
293
+ })
294
+
295
+ if (!response.errors) {
296
+ let data = response.data.zonePickingWorksheet
297
+ if (data.worksheet.status === WORKSHEET_STATUS.DONE.value) {
298
+ return showToast({ type: 'failed', message: 'Worksheet is already done' })
299
+ } else if (data.worksheet.status === WORKSHEET_STATUS.DEACTIVATED.value) {
300
+ return showToast({ type: 'failed', message: 'Worksheet is not activated' })
301
+ }
302
+ return mapWorksheetData(data)
303
+ }
304
+ } catch (e) {
305
+ throw new Error(e.message)
306
+ }
307
+ }
308
+
309
+ function mapWorksheetData(data) {
310
+ const worksheetInfo = {
311
+ id: data.worksheet.id,
312
+ name: data.worksheet.name,
313
+ type: data.worksheet.type,
314
+ status: data.worksheet.status,
315
+ bizplaceName: data.worksheet.bizplace.name,
316
+ startedAt: data.worksheet.startedAt
317
+ ? new Date(parseInt(data.worksheet.startedAt)).toLocaleString('en-CA', {
318
+ year: 'numeric',
319
+ month: '2-digit',
320
+ day: '2-digit',
321
+ hour: '2-digit',
322
+ minute: '2-digit',
323
+ hour12: false
324
+ }).replace(',', '')
325
+ : null
326
+ }
327
+
328
+ const worksheetDetailInfos = data.groupedOrderInventories.map(orderInv => ({
329
+ inventoryId: orderInv.inventory.id,
330
+ palletId: orderInv.inventory.palletId,
331
+ cartonId: orderInv.inventory.cartonId,
332
+ batchId: orderInv.inventory.batchId,
333
+ product: {
334
+ sku: orderInv.product.sku,
335
+ name: orderInv.product.name,
336
+ description: orderInv.product.description
337
+ },
338
+ qty: orderInv.pickedQty,
339
+ releaseQty: orderInv.releaseQty,
340
+ pickedQty: orderInv.pickedQty,
341
+ expirationDate: orderInv.inventory.expirationDate
342
+ ? new Date(orderInv.inventory.expirationDate).toISOString().slice(0, 10).replace('-', '/').replace('-', '/')
343
+ : null,
344
+ status: orderInv.status,
345
+ packingType: orderInv.packingType,
346
+ packingSize: orderInv.packingSize,
347
+ location: {
348
+ name: orderInv.inventory.location.name,
349
+ description: orderInv.inventory.location.description
350
+ },
351
+ relatedOrderInv: {
352
+ id: orderInv.id,
353
+ batchId: orderInv.inventory.batchId,
354
+ packingType: orderInv.packingType,
355
+ product: {
356
+ sku: orderInv.product.sku,
357
+ name: orderInv.product.name,
358
+ description: orderInv.product.description
359
+ }
360
+ }
361
+ }))
362
+
363
+ const issues = data.inventoryChanges.map(ic => {
364
+ return {
365
+ ...ic,
366
+ inventoryId: ic.inventory.id
367
+ }
368
+ })
369
+
370
+ const completable = data.completable
371
+
372
+ return {
373
+ worksheetInfo,
374
+ worksheetDetailInfos,
375
+ issues,
376
+ completable
377
+ }
378
+ }
379
+
380
+ async function showWorksheetList() {
381
+ await sleep(1010)
382
+ openPopup(html` <show-my-worksheet-list-popup .type="ZONE_PICKING"></show-my-worksheet-list-popup> `, {
383
+ backdrop: true,
384
+ size: 'small',
385
+ title: i18next.t('title.my_worksheet_list')
386
+ })
387
+ }
@@ -0,0 +1,139 @@
1
+ import gql from 'graphql-tag'
2
+ import { i18next, localize } from '@things-factory/i18n-base'
3
+ import { client, CustomAlert } from '@things-factory/shell'
4
+ import { css, html, LitElement } from 'lit-element'
5
+ import { SingleColumnFormStyles } from '@things-factory/form-ui'
6
+ import { showToast } from '../../../util'
7
+
8
+ const ISSUE_TYPES = {
9
+ MISSING: 'MISSING',
10
+ EXPIRED: 'EXPIRED'
11
+ }
12
+
13
+ class ReportIssuePopup extends localize(i18next)(LitElement) {
14
+ static get properties() {
15
+ return {
16
+ _palletId: String
17
+ }
18
+ }
19
+
20
+ static get styles() {
21
+ return [
22
+ SingleColumnFormStyles,
23
+ css`
24
+ :host {
25
+ display: flex;
26
+ flex-direction: column;
27
+ overflow: hidden;
28
+ background-color: var(--main-section-background-color);
29
+ }
30
+ .container {
31
+ display: flex;
32
+ flex-direction: column;
33
+ }
34
+ .single-column-form select,
35
+ .single-column-form textarea,
36
+ .single-column-form label {
37
+ grid-column: span 12;
38
+ }
39
+ .button-container {
40
+ padding: 20px;
41
+ margin: var(--button-container-margin);
42
+ justify-self: center;
43
+ align-self: center;
44
+ }
45
+ #input-form {
46
+ width: auto;
47
+ grid-gap: 5px;
48
+ margin: 30px;
49
+ }
50
+ .text-left {
51
+ text-align: left !important;
52
+ }
53
+ .mt-5px {
54
+ margin-top: 5px;
55
+ }
56
+ `
57
+ ]
58
+ }
59
+
60
+ render() {
61
+ return html`
62
+ <div class="container">
63
+ <form id="input-form" class="single-column-form">
64
+ <fieldset>
65
+ <label class="mt-5px text-left">${i18next.t('label.issue_type')}</label>
66
+ <select name="issue">
67
+ <option value="">${i18next.t('label.select_issue_type')}</option>
68
+ ${Object.entries(ISSUE_TYPES).map(([key, value]) => html`<option value="${value}">${key}</option>`)}
69
+ </select>
70
+ <label class="mt-5px text-left">${i18next.t('label.details')} (Optional)</label>
71
+ <textarea name="details" rows="3"></textarea>
72
+ </fieldset>
73
+ </form>
74
+ </div>
75
+ <div class="button-container">
76
+ <mwc-button
77
+ raised
78
+ @click="${e => {
79
+ this.submit(e)
80
+ }}"
81
+ label="${i18next.t('button.submit')}"
82
+ ></mwc-button>
83
+ </div>
84
+ `
85
+ }
86
+
87
+ get issueTypeInput() {
88
+ return this.shadowRoot?.querySelector('select[name=issue]')
89
+ }
90
+
91
+ get detailsInput() {
92
+ return this.shadowRoot?.querySelector('textarea[name=details]')
93
+ }
94
+
95
+ async submit(e) {
96
+ try {
97
+ if (!this.issueTypeInput.value) throw new Error('Please select an issue type')
98
+ else if (this.issueTypeInput.value == 'OTHER_ISSUE' && !this.detailsInput.value) {
99
+ throw new Error('Details is required for OTHER ISSUE')
100
+ }
101
+
102
+ const patch = {
103
+ palletId: this._palletId,
104
+ transactionType: this.issueTypeInput?.value,
105
+ details: this.detailsInput?.value,
106
+ obsolete: this.issueTypeInput.value === ISSUE_TYPES.EXPIRED ? true : false
107
+ }
108
+
109
+ const patches = [patch]
110
+
111
+ const result = await CustomAlert({
112
+ title: i18next.t('title.are_you_sure'),
113
+ text: i18next.t('text.this_action_will_affect_all_orders_related_to_this_inventory'),
114
+ confirmButton: { text: i18next.t('button.confirm') },
115
+ cancelButton: { text: i18next.t('button.cancel') }
116
+ })
117
+
118
+ if (!result.value) return
119
+
120
+ const response = await client.mutate({
121
+ mutation: gql`
122
+ mutation submitInventoryChanges($patches: [InventoryPatch!]!) {
123
+ submitInventoryChanges(patches: $patches)
124
+ }
125
+ `,
126
+ variables: { patches }
127
+ })
128
+
129
+ if (!response.error) {
130
+ showToast({ type: 'success', message: 'Issue reported successfully.' })
131
+ this.dispatchEvent(new CustomEvent('submit', { detail: '' }))
132
+ }
133
+ } catch (e) {
134
+ showToast(e)
135
+ }
136
+ }
137
+ }
138
+
139
+ window.customElements.define('report-issue-popup', ReportIssuePopup)
@@ -0,0 +1,126 @@
1
+ import gql from 'graphql-tag'
2
+ import { i18next, localize } from '@things-factory/i18n-base'
3
+ import { navigate, client } from '@things-factory/shell'
4
+ import { css, html, LitElement } from 'lit-element'
5
+ import { SingleColumnFormStyles } from '@things-factory/form-ui'
6
+
7
+ class ScanBinNo extends localize(i18next)(LitElement) {
8
+ static get styles() {
9
+ return [
10
+ SingleColumnFormStyles,
11
+ css`
12
+ :host {
13
+ display: flex;
14
+ flex-direction: column;
15
+ overflow: hidden;
16
+ background-color: var(--main-section-background-color);
17
+ }
18
+ .container {
19
+ display: flex;
20
+ flex-direction: column;
21
+ }
22
+ .single-column-form [custom-input] {
23
+ grid-column: span 12;
24
+ }
25
+ .single-column-form label {
26
+ grid-column: span 12;
27
+ text-align: left;
28
+ margin: 25px 0px 5px;
29
+ }
30
+ .button-container {
31
+ margin: var(--button-container-margin);
32
+ justify-self: center;
33
+ align-self: center;
34
+ padding-bottom: 50px;
35
+ }
36
+ label {
37
+ align-self: center;
38
+ }
39
+ #input-form {
40
+ width: auto;
41
+ grid-gap: 5px;
42
+ margin: 20px;
43
+ }
44
+ .color-teal {
45
+ color: #007e7f;
46
+ }
47
+ [cancel] {
48
+ --mdc-theme-primary: var(--main-section-background-color);
49
+ }
50
+ `
51
+ ]
52
+ }
53
+
54
+ render() {
55
+ return html`
56
+ <div class="container">
57
+ <form id="input-form" class="single-column-form">
58
+ <fieldset>
59
+ <legend>${i18next.t('title.scan_new_bin_no')}</legend>
60
+ <label>${i18next.t('label.bin_no')}</label>
61
+ <barcode-scanable-input name="binNo" custom-input></barcode-scanable-input>
62
+ </fieldset>
63
+ </form>
64
+ </div>
65
+ <div class="button-container">
66
+ <mwc-button
67
+ cancel
68
+ raised
69
+ @click="${e => {
70
+ this._cancel(e)
71
+ }}"
72
+ ><label class="color-teal">${i18next.t('button.cancel')}</label>
73
+ </mwc-button>
74
+ <mwc-button
75
+ raised
76
+ @click="${e => {
77
+ this._confirm(e)
78
+ }}"
79
+ label="${i18next.t('button.confirm')}"
80
+ ></mwc-button>
81
+ </div>
82
+ `
83
+ }
84
+
85
+ get binNo() {
86
+ return this.shadowRoot.querySelector('barcode-scanable-input[name=binNo]')?.shadowRoot.querySelector('input')
87
+ }
88
+
89
+ async _confirm(e) {
90
+ if (!this.binNo.value) {
91
+ throw new Error('invalid bin no')
92
+ } else {
93
+ let newBinNo = await this.validateBinNo(this.binNo.value)
94
+ if (newBinNo) {
95
+ await this.dispatchEvent(new CustomEvent('updateBinNo', { detail: newBinNo }))
96
+ }
97
+ }
98
+ }
99
+
100
+ _cancel() {
101
+ history.back()
102
+ }
103
+
104
+ async validateBinNo(binNo) {
105
+ if (!binNo) return
106
+ const response = await client.query({
107
+ query: gql`
108
+ query binLocation($name: String!) {
109
+ binLocation(name: $name) {
110
+ id
111
+ name
112
+ }
113
+ }
114
+ `,
115
+ variables: { name: binNo }
116
+ })
117
+
118
+ if (!response.errors) {
119
+ return response.data.binLocation.name
120
+ } else {
121
+ this.binNo.value = ''
122
+ }
123
+ }
124
+ }
125
+
126
+ window.customElements.define('scan-bin-no', ScanBinNo)