@things-factory/operato-wms 4.3.37 → 4.3.40

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 (42) hide show
  1. package/client/pages/bulk-operation/bulk-operation.js +13 -2
  2. package/client/pages/bulk-operation/validate-ro-popup.js +40 -0
  3. package/client/pages/inbound/pallet-label-popup.js +2 -0
  4. package/client/pages/order/arrival-notice/arrival-notice-detail.js +2 -2
  5. package/client/pages/order/arrival-notice/create-arrival-notice.js +2 -2
  6. package/client/pages/order/goods-received-note/received-note-detail.js +187 -15
  7. package/client/pages/order/release-order/create-release-order.js +500 -6
  8. package/client/pages/order/release-order/release-order-detail.js +760 -169
  9. package/client/pages/order/transport-order/delivery-note-popup.js +970 -126
  10. package/client/pages/order/transport-order/print-delivery-note.js +162 -2
  11. package/client/pages/outbound/loading-product.js +87 -77
  12. package/client/pages/outbound/merged-outbound-worksheet.js +2 -2
  13. package/client/pages/outbound/picking-product.js +11 -7
  14. package/client/pages/outbound/route-label-popup.js +283 -191
  15. package/client/pages/outbound/sorting-product.js +7 -7
  16. package/client/pages/report/inbound-serial-number-report.js +86 -9
  17. package/client/pages/report/inventory-report.js +10 -0
  18. package/client/pages/report/outbound-serial-number-report.js +87 -9
  19. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js +10 -5
  20. package/dist-server/graphql/resolvers/dashboard/inventory-expiry-monitor.js.map +1 -1
  21. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js +11 -5
  22. package/dist-server/graphql/resolvers/dashboard/outbound-order-by-status.js.map +1 -1
  23. package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js +33 -4
  24. package/dist-server/graphql/resolvers/reports/inbound-serial-number-report.js.map +1 -1
  25. package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js +33 -8
  26. package/dist-server/graphql/resolvers/reports/outbound-serial-number-report.js.map +1 -1
  27. package/dist-server/utils/report-query-util.js +3 -2
  28. package/dist-server/utils/report-query-util.js.map +1 -1
  29. package/helps/release-note.ko.md +10 -12
  30. package/helps/release-note.md +10 -12
  31. package/helps/release-note.ms.md +10 -12
  32. package/helps/release-note.zh.md +10 -12
  33. package/package.json +21 -20
  34. package/server/graphql/resolvers/dashboard/inventory-expiry-monitor.ts +10 -8
  35. package/server/graphql/resolvers/dashboard/outbound-order-by-status.ts +10 -7
  36. package/server/graphql/resolvers/reports/inbound-serial-number-report.ts +34 -4
  37. package/server/graphql/resolvers/reports/outbound-serial-number-report.ts +34 -8
  38. package/server/utils/report-query-util.ts +3 -2
  39. package/translations/en.json +31 -0
  40. package/translations/ko.json +10 -1
  41. package/translations/ms.json +11 -1
  42. package/translations/zh.json +10 -1
@@ -1,5 +1,11 @@
1
1
  import { MultiColumnFormStyles } from '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
+ import '@things-factory/import-ui'
4
+ import '@things-factory/component-ui'
5
+ import '@things-factory/biz-ui'
6
+ import { sleep } from '@operato/utils'
7
+ import '../../outbound/transport-vehicles-popup'
8
+
3
9
  import { i18next, localize } from '@things-factory/i18n-base'
4
10
  import { openPopup } from '@things-factory/layout-base'
5
11
  import { client } from '@things-factory/shell'
@@ -30,15 +36,87 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
30
36
  selectedCP: String,
31
37
  status: String,
32
38
  orderInfo: Object,
33
- contactPointInput: String
39
+ contactPointInput: String,
40
+ roNo: String,
41
+ refNo: String,
42
+ coNo: String,
43
+ totalPalletQty: String,
44
+ _transportType: Array,
45
+ _statusOwnTransport: Boolean,
46
+ /* Shipping Form Field */
47
+ _contactPointId: String,
48
+ _contactPointName: String,
49
+ _companyName: String,
50
+ _attentionTo: String,
51
+ _deliveryCountry: String,
52
+ _deliveryPostCode: Array,
53
+ _deliveryState: String,
54
+ _deliveryCity: String,
55
+ _deliveryContact: String,
56
+ _deliveryFullAddress: String,
57
+ _selectedPostCode: String,
58
+ _billingCountry: String,
59
+ _billingPostCode: Array,
60
+ _billingState: String,
61
+ _billingCity: String,
62
+ _billingContact: String,
63
+ _billingFullAddress: String,
64
+ _selectedBillingPostCode: String,
65
+ _selectedOwnTransport: Boolean,
66
+ _valueOfTransportType: String,
67
+ _showCoNumber: Boolean,
68
+ _exportOption: Boolean,
69
+ _selectedDeliveryCountry: String,
70
+ _selectedBillingCountry: String,
71
+ _deliveryAllCountry: Array,
72
+ _billingAllCountry: Array,
73
+ _determineOwnCollection: String,
74
+
75
+ // Export Form Field
76
+
77
+ _containerArrivalDate: Date,
78
+ _containerLeavingDate: Date,
79
+ _containerNo: String,
80
+ _shipName: String,
81
+
82
+ /* Tab Toggle*/
83
+ _showReleasedOrderInfo: Boolean,
84
+ _showShippingInfo: Boolean,
85
+ _disableBillingAddress: Boolean
34
86
  }
35
87
  }
36
88
 
37
89
  constructor() {
38
90
  super()
91
+ this._deliveryAllCountry = []
39
92
  this._otherDestination = false
40
93
  this._isDisabled = true
94
+ this._showReleasedOrderInfo = false
95
+ this._showShippingInfo = true
96
+ this._exportOption = false
97
+ this._attentionTo = ''
98
+ this._companyName = ''
99
+ this._deliveryCountry = 'Malaysia'
100
+ this._deliveryPostCode = []
101
+ this._deliveryState = ''
102
+ this._deliveryCity = ''
103
+ this._deliveryFullAddress = ''
104
+ this._deliveryContact = ''
105
+ this._billingCountry = 'Malaysia'
106
+ this._billingPostCode = []
107
+ this._billingState = ''
108
+ this._billingCity = ''
109
+ this._billingFullAddress = ''
110
+ this._billingContact = ''
111
+ this._selectedPostCode = ''
112
+ this._selectedBillingPostCode = ''
113
+ this._selectedTransportType = ''
41
114
  this.status = ''
115
+ this._transportType = ['Own Transport', 'Warehouse Transport']
116
+ this._switchDeliveryCountryInput = false
117
+ this._switchBillingCountryInput = false
118
+ this._selectedDeliveryCountry = 'MALAYSIA'
119
+ this._selectedBillingCountry = 'MALAYSIA'
42
120
  }
43
121
 
44
122
  static get styles() {
@@ -58,6 +136,15 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
58
136
  min-height: 20vh;
59
137
  }
60
138
 
139
+ [title] {
140
+ margin-top: -10px;
141
+ margin-bottom: -10px;
142
+ }
143
+
144
+ [export] {
145
+ margin-top: -10px;
146
+ }
147
+
61
148
  .grist {
62
149
  display: flex;
63
150
  flex-direction: column;
@@ -90,6 +177,10 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
90
177
  background-color: var(--button-container-background);
91
178
  height: var(--button-container-height);
92
179
  }
180
+
181
+ .content-container {
182
+ overflow-y: auto;
183
+ }
93
184
  `
94
185
  ]
95
186
  }
@@ -99,10 +190,17 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
99
190
  this._truckNo = this.orderInfo.truckNo || ''
100
191
  const deliverTo = this.orderInfo.deliverTo || {}
101
192
  this.selectedCP = deliverTo.id || null
102
- this.contactPointInput.value =
103
- deliverTo.contactName && deliverTo.address ? `${deliverTo.contactName}, ${deliverTo.address}` : ''
193
+ // this.contactPointInput.value = deliverTo.contactName && deliverTo.address ? `${deliverTo.contactName}, ${deliverTo.address}` : ''
194
+ await this.fetchCountry()
195
+ await this._getAllPostCode()
196
+
197
+ const response = await this.fetchDeliveryInfo(this.manualDo)
198
+ const roResponse = await this._fetchReleaseOrder(this.roNo)
199
+ const doRepsonse = await this._fetchDeliveryOrder(this.doNo)
200
+
201
+ this.totalPalletQty = doRepsonse.data.deliveryOrder.palletQty
104
202
 
105
- await this.fetchDeliveryInfo(this.manualDo)
203
+ roResponse.ownTransport == true ? (this._showCoNumber = false) : (this._showCoNumber = true)
106
204
 
107
205
  this._isDisabled = await fetchSettingRule('disable-reusable-pallet')
108
206
 
@@ -167,138 +265,425 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
167
265
  }
168
266
 
169
267
  render() {
268
+ const RELEASE_ORDER_TABS = {
269
+ SHIPPING_INFO: i18next.t('label.shipment'),
270
+ RELEASE_ORDER_INFO: i18next.t('label.order')
271
+ }
272
+
273
+ const orderSet = {
274
+ [RELEASE_ORDER_TABS.RELEASE_ORDER_INFO]: {},
275
+ [RELEASE_ORDER_TABS.SHIPPING_INFO]: {}
276
+ }
277
+
170
278
  return html`
171
- <form id="input-form" name="doForm" class="multi-column-form">
172
- <fieldset>
173
- <legend>${i18next.t('title.delivery_information')} - ${this.doNo}</legend>
174
- <label>${i18next.t('label.delivery_date')}</label>
175
- <input
176
- name="deliveryDate"
177
- type="date"
178
- min=${this.status === ORDER_STATUS.READY_TO_DISPATCH.value
179
- ? `${this._getStdDate()}`
180
- : `${this.orderInfo.createdDate}`}
181
- value="${this.orderInfo.deliveryDate}"
182
- required
183
- />
184
-
185
- <label>${i18next.t('label.driver_name')}</label>
186
- <input name="otherDriver" value="${this.orderInfo.otherDriver}" ?hidden="${!this._ownCollection}" />
187
- <input
188
- name="ownDriver"
189
- ?hidden="${this._ownCollection}"
190
- value="${this.orderInfo.driverName}"
191
- @click="${this._openDriverSelector.bind(this)}"
192
- readonly
193
- />
194
-
195
- <label>${i18next.t('label.truck_no')}</label>
196
- <input name="otherTruck" ?hidden="${!this._ownCollection}" value="${this._truckNo}" />
197
- <input
198
- name="ownTruck"
199
- ?hidden="${this._ownCollection}"
200
- readonly
201
- @click="${this._openTruckSelector.bind(this)}"
202
- value="${this.orderInfo.truckNo || ''}"
203
- />
204
-
205
- <label ?hidden="${this._otherDestination}">${i18next.t('label.to')}</label>
206
- <input
207
- name="contactPoint"
208
- ?hidden="${this._otherDestination}"
209
- readonly
210
- @click="${this._openCPSelector.bind(this)}"
211
- />
212
-
213
- <input
214
- name="otherDestBoolean"
215
- type="checkbox"
216
- ?checked="${this._otherDestination}"
217
- @change="${e => (this._otherDestination = e.currentTarget.checked)}"
218
- />
219
- <label>${i18next.t('label.other_destination')}</label>
220
-
221
- <label ?hidden="${!this._otherDestination}">${i18next.t('label.contact_name')}</label>
222
- <input name="contactName" ?hidden="${!this._otherDestination}" />
223
-
224
- <label ?hidden="${!this._otherDestination}">${i18next.t('label.contact_phone_no')}</label>
225
- <input
226
- name="contactPhone"
227
- ?hidden="${!this._otherDestination}"
228
- placeholder="(${i18next.t('text.optional')})"
229
- />
230
-
231
- <label ?hidden="${!this._otherDestination}">${i18next.t('label.contact_email')}</label>
232
- <input
233
- name="contactEmail"
234
- ?hidden="${!this._otherDestination}"
235
- placeholder="(${i18next.t('text.optional')})"
236
- />
237
-
238
- <label ?hidden="${!this._otherDestination}">${i18next.t('label.company_name')}</label>
239
- <input
240
- name="contactCompany"
241
- ?hidden="${!this._otherDestination}"
242
- placeholder="(${i18next.t('text.optional')})"
243
- />
244
-
245
- <label ?hidden="${!this._otherDestination}">${i18next.t('label.contact_type')}</label>
246
- <select name="contactType" ?hidden="${!this._otherDestination}">
247
- <option value="">-- ${i18next.t('text.please_select_the_contact_type')} --</option>
248
- <!-- Temporarily use hardcoded value -->
249
- <option value="CUSTOMER">${i18next.t('text.customer')}</option>
250
- <option value="SUPPLIER">${i18next.t('text.supplier')}</option>
279
+ <div>
280
+ <quick-find-content
281
+ id="order-items-list"
282
+ .data="${orderSet}"
283
+ @tabChanged="${e => {
284
+ this.currentTab = e.detail.currentTabKey
285
+ this._tabChange(e.detail.currentTabKey)
286
+ }}"
287
+ ></quick-find-content>
288
+ </div>
289
+ <div class="content-container">
290
+ <div ?hidden="${this._showReleasedOrderInfo}">
291
+ <form id="input-form" name="doForm" class="multi-column-form">
292
+ <fieldset>
293
+ <legend>${i18next.t('title.delivery_information')} - ${this.doNo}</legend>
294
+ <label>${i18next.t('label.delivery_date')}</label>
295
+ <input
296
+ name="deliveryDate"
297
+ type="date"
298
+ min=${
299
+ this.status === ORDER_STATUS.READY_TO_DISPATCH.value
300
+ ? `${this._getStdDate()}`
301
+ : `${this.orderInfo.createdDate}`
302
+ }
303
+ value="${this.orderInfo.deliveryDate}"
304
+ required
305
+ />
306
+
307
+ <label>${i18next.t('label.release_good_no')}</label>
308
+ <input name="releaseGoodNo" ?disabled="${true}" value="${this.roNo}" />
309
+
310
+ <label>${i18next.t('label.ref_no')}</label>
311
+ <input name="refNo" ?disabled="${true}" value="${this.refNo}" />
312
+
313
+ <label>${i18next.t('label.transport_type')}</label>
314
+ <select
315
+ name="transportType"
316
+ @change=${e => {
317
+ this._setTransportType(e.target.value, e.target.name)
318
+ }}
319
+ >
320
+ ${this._transportType.map(
321
+ (tp, key) => html`<option value=${tp} ?selected=${this._determineOwnCollection === tp}>${tp}</option>`
322
+ )}
323
+ </select>
324
+
325
+ <label ?hidden="${this._showCoNumber}"
326
+ >${i18next.t('label.co_no')}</label
327
+ >
328
+ <input
329
+ name="coNo"
330
+ ?hidden="${this._showCoNumber}"
331
+ value="${this.coNo}"
332
+ />
333
+
334
+ <label>${i18next.t('label.driver_name')}</label>
335
+ <input name="otherDriver" value="${this.orderInfo.otherDriver}" ?hidden="${!this._ownCollection}" />
336
+ <input
337
+ name="ownDriver"
338
+ ?hidden="${this._ownCollection}"
339
+ value="${this.orderInfo.driverName}"
340
+ @click="${this._openDriverSelector.bind(this)}"
341
+ readonly
342
+ />
343
+
344
+ <label>${i18next.t('label.vehicle_no')}</label>
345
+ <input name="otherTruck" ?hidden="${!this._ownCollection}" value="${this._truckNo}" />
346
+ <input
347
+ name="ownTruck"
348
+ readonly
349
+ ?hidden="${this._ownCollection}"
350
+ @click="${this._openBufferSelector.bind(this)}"
351
+ value="${this.orderInfo.truckNo || ''}"
352
+ />
353
+
354
+ <label ?hidden="${!this._otherDestination}">${i18next.t('label.contact_name')}</label>
355
+ <input name="contactName" ?hidden="${!this._otherDestination}" />
356
+
357
+ <label ?hidden="${!this._otherDestination}">${i18next.t('label.contact_phone_no')}</label>
358
+ <input
359
+ name="contactPhone"
360
+ ?hidden="${!this._otherDestination}"
361
+ placeholder="(${i18next.t('text.optional')})"
362
+ />
363
+
364
+ <label ?hidden="${!this._otherDestination}">${i18next.t('label.contact_email')}</label>
365
+ <input
366
+ name="contactEmail"
367
+ ?hidden="${!this._otherDestination}"
368
+ placeholder="(${i18next.t('text.optional')})"
369
+ />
370
+
371
+ <label ?hidden="${!this._otherDestination}">${i18next.t('label.company_name')}</label>
372
+ <input
373
+ name="contactCompany"
374
+ ?hidden="${!this._otherDestination}"
375
+ placeholder="(${i18next.t('text.optional')})"
376
+ />
377
+
378
+ <label ?hidden="${!this._otherDestination}">${i18next.t('label.contact_type')}</label>
379
+ <select name="contactType" ?hidden="${!this._otherDestination}">
380
+ <option value="">-- ${i18next.t('text.please_select_the_contact_type')} --</option>
381
+ <!-- Temporarily use hardcoded value -->
382
+ <option value="CUSTOMER">${i18next.t('text.customer')}</option>
383
+ <option value="SUPPLIER">${i18next.t('text.supplier')}</option>
384
+ </select>
385
+
386
+ <label ?hidden="${!this._otherDestination}">${i18next.t('label.delivery_address')}</label>
387
+ <textarea name="otherDestination" ?hidden="${!this._otherDestination}"></textarea>
388
+
389
+ <label ?hidden="${!this._otherDestination}">${i18next.t('label.billing_address')}</label>
390
+ <textarea name="billingAddress" ?hidden="${!this._otherDestination}"></textarea>
391
+
392
+ <label>${i18next.t('label.total_pallet_qty')}</label>
393
+ <input name="totalPalletQty" value="${this.totalPalletQty}" />
394
+
395
+ <label>${i18next.t('label.overall_remark')}</label>
396
+ <textarea name="remark" value="${this.orderInfo.remark}">${this.orderInfo.remark}</textarea>
397
+
398
+ <input
399
+ id="exportOption"
400
+ type="checkbox"
401
+ name="exportOption"
402
+ ?hidden=${this._determineOwnCollection == 'Warehouse Transport'}
403
+ ?checked="${this._exportOption}"
404
+ @change="${e => {
405
+ this._exportOption = e.currentTarget.checked
406
+ if (this._exportOption == true) {
407
+ this._exportOption = true
408
+ this._valueOfTransportType = 'Own Transport'
409
+ this._showCoNumber = false
410
+ }
411
+ if (this._exportOption == false) {
412
+ this._exportOption = false
413
+ this._showCoNumber = true
414
+ this._valueOfTransportType = 'Warehouse Transport'
415
+ }
416
+ }}"
417
+ />
418
+ <label for="exportOption" ?hidden=${
419
+ this._determineOwnCollection == 'Warehouse Transport'
420
+ }>${i18next.t('label.export')}</label>
421
+ </fieldset>
422
+ </form>
423
+
424
+
425
+ </div>
426
+
427
+ <div class="so-form-container" export ?hidden=${!this._exportOption}>
428
+ <form name="shippingOrder" class="multi-column-form">
429
+ <fieldset>
430
+ <legend>${i18next.t('title.export_order')}</legend>
431
+ <label>${i18next.t('label.container_no')}</label>
432
+ <input name="containerNo" .value="${this._containerNo}" required />
433
+
434
+ <label>${i18next.t('label.container_arrival_date')}</label>
435
+ <input
436
+ name="containerArrivalDate"
437
+ type="date"
438
+ .value="${this._containerArrivalDate}"
439
+ @change="${e => {
440
+ this._containerLeavingDateInput.setAttribute('min', e.currentTarget.value)
441
+ }}"
442
+ required
443
+ />
444
+
445
+ <label>${i18next.t('label.container_leaving_date')}</label>
446
+ <input
447
+ name="containerLeavingDate"
448
+ type="date"
449
+ .value="${this._containerLeavingDate}"
450
+ @change="${e => {
451
+ this._containerArrivalDateInput.setAttribute('max', e.currentTarget.value)
452
+ }}"
453
+ required
454
+ />
455
+
456
+ <label>${i18next.t('label.ship_name')}</label>
457
+ <input name="shipName" .value="${this._shipName}" required />
458
+ </fieldset>
459
+ </form>
460
+ </div>
461
+
462
+ <div ?hidden="${this._showShippingInfo}">
463
+ <form name="deliveryOrderInfo" class="multi-column-form" autocomplete="off">
464
+ <fieldset>
465
+
466
+ <legend>${i18next.t('title.shipping_information')}</legend>
467
+
468
+ <label>${i18next.t('label.search')}</label>
469
+ <input type="hidden" name="contactPointId" value="${this._contactPointId}" />
470
+ <input
471
+ type="text"
472
+ name="contactPointName"
473
+ value="${this._contactPointName}"
474
+ @click="${this._openContactPointSelector.bind(this)}"
475
+ />
476
+ </fieldset>
477
+ </form>
478
+
479
+ <form name="contactPointInfo" class="multi-column-form" autocomplete="off">
480
+ <label>${i18next.t('label.company')}</label>
481
+ <input name="companyName" required .value="${this._companyName}" />
482
+
483
+ <label>${i18next.t('label.attention_to')}</label>
484
+ <input name="attentionTo" required .value="${this._attentionTo}" />
485
+
486
+
487
+ </fieldset>
488
+ </form>
489
+
490
+ <form class="multi-column-form">
491
+ <label>${i18next.t('label.delivery_address')}</label>
492
+ </form>
493
+
494
+ <form name="deliveryAddressInfo" class="multi-column-form" autocomplete="off">
495
+ <!-- delivery -->
496
+ <fieldset>
497
+ <label>${i18next.t('label.country')}</label>
498
+
499
+ <select
500
+ name="deliveryCountry"
501
+ @change=${e => {
502
+ this._validateCountry(e)
503
+ }}
504
+ >
505
+ <option value=${this._selectedDeliveryCountry ? this._selectedDeliveryCountry : ''} selected>
506
+ ${this._selectedDeliveryCountry ? this._selectedDeliveryCountry : ''}
507
+ </option>
508
+ ${this._deliveryAllCountry?.map(
509
+ (country, key) => html`<option value=${country.name}>${country.name}</option>`
510
+ )}
251
511
  </select>
252
512
 
253
- <label ?hidden="${!this._otherDestination}">${i18next.t('label.delivery_address')}</label>
254
- <textarea name="otherDestination" ?hidden="${!this._otherDestination}"></textarea>
255
-
256
- <label ?hidden="${!this._otherDestination}">${i18next.t('label.billing_address')}</label>
257
- <textarea name="billingAddress" ?hidden="${!this._otherDestination}"></textarea>
258
-
259
- <label>${i18next.t('label.overall_remark')}</label>
260
- <textarea name="remark" value="${this.orderInfo.remark}">${this.orderInfo.remark}</textarea>
261
-
262
- <label ?hidden="${this._isDisabled}">${i18next.t('label.reusable_pallet')}</label>
263
- <textarea
264
- name="reusablePallet"
265
- ?hidden="${this._isDisabled}"
266
- ?disabled="${this._isDisabled}"
267
- value="${this.orderInfo.reusablePallet}"
268
- placeholder="(${i18next.t('text.optional')})"
269
- >${this.orderInfo.reusablePallet}</textarea>
270
- </fieldset>
271
- </form>
272
-
273
- <div class="container">
274
- <div class="grist">
275
- <h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.edit_remark')}</h2>
276
-
277
- <data-grist
278
- id="do-grist"
279
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
280
- .config=${this.doGristConfig}
281
- .data=${this.doData}
282
- ></data-grist>
513
+ <label>${i18next.t('label.zip_postal_code')}</label>
514
+ ${
515
+ this._switchDeliveryCountryInput
516
+ ? html` <input name="deliveryPostalCode" .value="" /> `
517
+ : html`<select
518
+ name="deliveryPostalCode"
519
+ @change=${e => {
520
+ this._getStateAndCityByPostCode(e.target.value, e.target.name)
521
+ }}
522
+ >
523
+ <option value=${this._selectedPostCode ? this._selectedPostCode : ''} selected>
524
+ ${this._selectedPostCode ? this._selectedPostCode : ''}
525
+ </option>
526
+ ${this._deliveryPostCode.map(
527
+ (country, key) => html`<option value=${country.postalCode}>${country.postalCode}</option>`
528
+ )}
529
+ </select>`
530
+ }
531
+
532
+ <label>${i18next.t('label.state')}</label>
533
+ <input name="deliveryState" required .value="${this._deliveryState}" />
534
+
535
+ <label>${i18next.t('label.city')}</label>
536
+ <input name="deliveryCity" required .value="${this._deliveryCity}" />
537
+
538
+ <label>${i18next.t('label.delivery_address')}</label>
539
+ <textarea name="deliveryFullAddress" required .value="${this._deliveryFullAddress}"></textarea>
540
+
541
+ <label>${i18next.t('label.contact')}</label>
542
+ <input name="contact" required .value="${this._deliveryContact}" />
543
+ </fieldset>
544
+ </form>
545
+
546
+ <form class="multi-column-form">
547
+ <label>${i18next.t('label.billing_address')}</label>
548
+ </form>
549
+
550
+ <form name="billingAddressInfo" class="multi-column-form" autocomplete="off">
551
+ <!-- billing -->
552
+ <fieldset>
553
+
554
+ <label>${i18next.t('label.country')}</label>
555
+ <select
556
+ name="billingCountry"
557
+ ?disabled=${this._disableBillingAddress ? true : false}
558
+ @change=${e => {
559
+ this._validateBillingCountry(e)
560
+ }}
561
+ >
562
+ <option value=${this._selectedBillingCountry ? this._selectedBillingCountry : ''} selected>
563
+ ${this._selectedBillingCountry ? this._selectedBillingCountry : ''}
564
+ </option>
565
+ ${this._deliveryAllCountry.map(
566
+ (country, key) => html`<option value=${country.name}>${country.name}</option>`
567
+ )}
568
+ </select>
569
+
570
+ <label>${i18next.t('label.zip_postal_code')}</label>
571
+
572
+ ${
573
+ this._switchBillingCountryInput
574
+ ? html`
575
+ <input
576
+ ?disabled=${this._disableBillingAddress ? true : false}
577
+ name="billingPostalCode"
578
+ .value=""
579
+ />
580
+ `
581
+ : html`<select
582
+ ?disabled=${this._disableBillingAddress ? true : false}
583
+ name="billingPostalCode"
584
+ @change=${e => {
585
+ this._getStateAndCityByPostCode(e.target.value, e.target.name)
586
+ }}
587
+ >
588
+ <option value=${this._selectedBillingPostCode ? this._selectedBillingPostCode : ''} selected>
589
+ ${this._selectedBillingPostCode ? this._selectedBillingPostCode : ''}
590
+ </option>
591
+ ${this._billingPostCode.map(
592
+ (country, key) => html`<option value=${country.postalCode}>${country.postalCode}</option>`
593
+ )}
594
+ </select>`
595
+ }
596
+
597
+ <label>${i18next.t('label.state')}</label>
598
+ <input ?disabled=${this._disableBillingAddress ? true : false} name="billingState" required .value="${
599
+ this._billingState
600
+ }" />
601
+
602
+ <label>${i18next.t('label.city')}</label>
603
+ <input ?disabled=${this._disableBillingAddress ? true : false} name="billingCity" required .value="${
604
+ this._billingCity
605
+ }" />
606
+
607
+ <label>${i18next.t('label.billing_address')}</label>
608
+ <textarea ?disabled=${
609
+ this._disableBillingAddress ? true : false
610
+ } name="billingFullAddress" required .value="${this._billingFullAddress}"></textarea>
611
+
612
+ <input type="checkbox" id="matchDeliveryAddress" @click=${e => {
613
+ e.currentTarget.checked ? (this._disableBillingAddress = true) : (this._disableBillingAddress = false)
614
+ e.currentTarget.checked ? this.matchDeliveryAddress() : ''
615
+ }} />
616
+ <label for="matchDeliveryAddress">${i18next.t('label.match_delivery_address')}</label>
617
+
618
+ </fieldset>
619
+ </form>
620
+ </div>
621
+
622
+ <div class="container">
623
+ <div class="grist">
624
+ <h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.edit_remark')}</h2>
625
+
626
+ <data-grist
627
+ id="do-grist"
628
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
629
+ .config=${this.doGristConfig}
630
+ .data=${this.doData}
631
+ ></data-grist>
632
+ </div>
283
633
  </div>
284
- </div>
285
634
 
635
+ </div>
286
636
  <div class="button-container">
287
637
  <mwc-button
288
638
  @click="${this._saveDeliveryInfo.bind(this)}"
289
- label="${this.status === ORDER_STATUS.READY_TO_DISPATCH.value
290
- ? `${i18next.t('button.dispatch')}`
291
- : `${i18next.t('button.update')}`}"
639
+ label="${
640
+ this.status === ORDER_STATUS.READY_TO_DISPATCH.value
641
+ ? `${i18next.t('button.dispatch')}`
642
+ : `${i18next.t('button.update')}`
643
+ }"
292
644
  raised
293
645
  ></mwc-button>
294
646
  </div>
647
+
295
648
  `
296
649
  }
297
650
 
651
+ get getDeliveryOrderForm() {
652
+ return this.shadowRoot.querySelector('form[name=deliveryOrderInfo]')
653
+ }
654
+
655
+ get getContactPointForm() {
656
+ return this.shadowRoot.querySelector('form[name=contactPointInfo]')
657
+ }
658
+
659
+ get getDeliveryAddressInfoForm() {
660
+ return this.shadowRoot.querySelector('form[name=deliveryAddressInfo]')
661
+ }
662
+
663
+ get getBillingAddressInfoForm() {
664
+ return this.shadowRoot.querySelector('form[name=billingAddressInfo]')
665
+ }
666
+
667
+ get _getBillingPostalCodeInput() {
668
+ return this.shadowRoot.querySelector('select[name=billingPostalCode]')
669
+ }
670
+
671
+ get shippingOrderForm() {
672
+ return this.shadowRoot.querySelector('form[name=shippingOrder]')
673
+ }
674
+
675
+ get _exportOptionInput() {
676
+ return this.shadowRoot.querySelector('input[name=exportOption]')
677
+ }
678
+
298
679
  get doForm() {
299
680
  return this.shadowRoot.querySelector('form[name=doForm]')
300
681
  }
301
682
 
683
+ get otherDriverInput() {
684
+ return this.shadowRoot.querySelector('input[name=otherDriver]')
685
+ }
686
+
302
687
  get contactPointInput() {
303
688
  return this.shadowRoot.querySelector('input[name=contactPoint]')
304
689
  }
@@ -307,6 +692,10 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
307
692
  return this.shadowRoot.querySelector('input[name=ownTruck]')
308
693
  }
309
694
 
695
+ get _otherTruckInput() {
696
+ return this.shadowRoot.querySelector('input[name=otherTruck]')
697
+ }
698
+
310
699
  get _truckDriverInput() {
311
700
  return this.shadowRoot.querySelector('input[name=ownDriver]')
312
701
  }
@@ -346,6 +735,24 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
346
735
  return obj
347
736
  }
348
737
 
738
+ _setTransportType(e, v) {
739
+ if (e == 'Own Transport') {
740
+ this._showCoNumber = false
741
+ this._ownCollection = true
742
+ this._determineOwnCollection = 'Own Transport'
743
+ this._otherTruckInput.value = ''
744
+ this.otherDriverInput.value = ''
745
+ } else {
746
+ this._showCoNumber = true
747
+ this._exportOption = false
748
+ this._exportOptionInput.checked = false
749
+ this._ownCollection = false
750
+ this._determineOwnCollection = 'Warehouse Transport'
751
+ this._truckNoInput.value = ''
752
+ this._truckDriverInput.value = ''
753
+ }
754
+ }
755
+
349
756
  _openCPSelector() {
350
757
  openPopup(
351
758
  html`
@@ -382,6 +789,23 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
382
789
  )
383
790
  }
384
791
 
792
+ async _openBufferSelector() {
793
+ openPopup(
794
+ html`
795
+ <transport-vehicles-popup
796
+ @selected="${e => {
797
+ this._truckNoInput.value = e.detail.name
798
+ }}"
799
+ ></transport-vehicles-popup>
800
+ `,
801
+ {
802
+ backdrop: true,
803
+ size: 'large',
804
+ title: i18next.t('label.lorry_no')
805
+ }
806
+ )
807
+ }
808
+
385
809
  _openDriverSelector() {
386
810
  openPopup(
387
811
  html`
@@ -399,6 +823,100 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
399
823
  )
400
824
  }
401
825
 
826
+ _openContactPointSelector() {
827
+ openPopup(
828
+ html`
829
+ <contact-points-popup
830
+ @selected="${e => {
831
+ this._companyName = e.detail.companyName
832
+ this._attentionTo = e.detail.name
833
+ this._deliveryCountry = 'MALAYSIA'
834
+ this._deliveryCity = e.detail.city ? e.detail.city : ''
835
+ this._selectedPostCode = e.detail.postCode ? e.detail.postCode : ''
836
+ this._deliveryState = e.detail.state ? e.detail.state : ''
837
+ this._deliveryContact = e.detail.phone ? e.detail.phone : ''
838
+ this._deliveryFullAddress = e.detail.address
839
+ ? e.detail.address
840
+ : '' + e.detail.address2
841
+ ? e.detail.address2
842
+ : ''
843
+ this._billingFullAddress = e.detail.billingAddress
844
+ }}"
845
+ ></contact-points-popup>
846
+ `,
847
+ {
848
+ backdrop: true,
849
+ size: 'large',
850
+ title: i18next.t('title.select_destination')
851
+ }
852
+ )
853
+ }
854
+
855
+ async _getAllPostCode() {
856
+ try {
857
+ const response = await client.query({
858
+ query: gql`
859
+ query geoAreasAllPostCode {
860
+ geoAreasAllPostCode {
861
+ items {
862
+ postalCode
863
+ }
864
+ total
865
+ }
866
+ }
867
+ `
868
+ })
869
+
870
+ if (!response.errors) {
871
+ const items = response.data.geoAreasAllPostCode.items
872
+ this._deliveryPostCode = items
873
+ this._billingPostCode = items
874
+ }
875
+ } catch (e) {
876
+ this._showToast(e)
877
+ }
878
+ }
879
+
880
+ async _getStateAndCityByPostCode(value, name) {
881
+ const postCode = value
882
+
883
+ try {
884
+ const response = await client.query({
885
+ query: gql`
886
+ query geoAreasGetStateAndCityByPosCode($postCode: String!) {
887
+ geoAreasGetStateAndCityByPosCode(postCode: $postCode) {
888
+ stateName
889
+ cityName
890
+ }
891
+ }
892
+ `,
893
+ variables: {
894
+ postCode
895
+ }
896
+ })
897
+
898
+ if (!response.errors) {
899
+ const { stateName, cityName } = response.data.geoAreasGetStateAndCityByPosCode
900
+
901
+ switch (name) {
902
+ case 'deliveryPostalCode':
903
+ this._deliveryState = stateName
904
+ this._deliveryCity = cityName ? cityName?.toUpperCase() : cityName
905
+ break
906
+
907
+ case 'billingPostalCode':
908
+ this._billingState = stateName
909
+ this._billingCity = cityName ? cityName?.toUpperCase() : cityName
910
+
911
+ default:
912
+ break
913
+ }
914
+ }
915
+ } catch (error) {
916
+ this._showToast(e)
917
+ }
918
+ }
919
+
402
920
  async _fetchTruckDriver() {
403
921
  const response = await client.query({
404
922
  query: gql`
@@ -452,6 +970,7 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
452
970
  }
453
971
 
454
972
  async fetchDeliveryInfo(isManualDO) {
973
+ let responseData = ''
455
974
  if (isManualDO) {
456
975
  const response = await client.query({
457
976
  query: gql`
@@ -462,6 +981,7 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
462
981
  releaseUomValue
463
982
  status
464
983
  remark
984
+ palletQty
465
985
  systemRemark
466
986
  batchId
467
987
  productId
@@ -481,7 +1001,9 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
481
1001
  this.doData = {
482
1002
  records: response.data.manualDeliveryOrderItems.items || []
483
1003
  }
1004
+ this.totalPalletQty = this.doData.palletQty
484
1005
  }
1006
+ responseData = response
485
1007
  } else {
486
1008
  const response = await client.query({
487
1009
  query: gql`
@@ -492,6 +1014,7 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
492
1014
  releaseUomValue
493
1015
  status
494
1016
  remark
1017
+ palletQty
495
1018
  systemRemark
496
1019
  batchId
497
1020
  productName
@@ -510,18 +1033,69 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
510
1033
  this.doData = {
511
1034
  records: response.data.deliveryOrderItems.items || []
512
1035
  }
1036
+
1037
+ this.totalPalletQty = this.doData.palletQty
513
1038
  }
1039
+ responseData = response
514
1040
  }
1041
+
1042
+ return responseData
515
1043
  }
516
1044
 
517
1045
  async _saveDeliveryInfo() {
1046
+ let shippingOrderInfo = {}
1047
+
1048
+ let contactPointInfo = this._serializeForm(this.getContactPointForm)
1049
+
1050
+ let deliveryAddressInfo = this._serializeForm(this.getDeliveryAddressInfoForm)
1051
+
1052
+ let billingAddressInfo = this._serializeForm(this.getBillingAddressInfoForm)
1053
+
1054
+ let exportInfo = {}
1055
+ if (this.shippingOrderForm != null) {
1056
+ exportInfo = this._serializeForm(this.shippingOrderForm)
1057
+ } else {
1058
+ exportInfo = {}
1059
+ }
1060
+
1061
+ shippingOrderInfo = {
1062
+ ...contactPointInfo,
1063
+ ...deliveryAddressInfo,
1064
+ ...billingAddressInfo,
1065
+ shippingOrder: {
1066
+ ...exportInfo
1067
+ }
1068
+ }
1069
+
1070
+ delete shippingOrderInfo['']
1071
+
1072
+ if (this._disableBillingAddress) {
1073
+ shippingOrderInfo.billingAddress = deliveryAddressInfo.deliveryFullAddress
1074
+ shippingOrderInfo.billingPostalCode = deliveryAddressInfo.deliveryPostalCode
1075
+ shippingOrderInfo.billingCity = deliveryAddressInfo.deliveryCity
1076
+ shippingOrderInfo.billingState = deliveryAddressInfo.deliveryState
1077
+ } else {
1078
+ shippingOrderInfo.billingAddress = billingAddressInfo.billingFullAddress
1079
+ }
1080
+
1081
+ shippingOrderInfo.deliveryAddress = this._deliveryFullAddress
1082
+ shippingOrderInfo.billingCountry = this._billingCountry
1083
+
518
1084
  try {
519
1085
  let response = null
520
1086
  if (this.manualDo) {
521
1087
  response = await client.mutate({
522
1088
  mutation: gql`
523
- mutation dispatchManualDeliveryOrder($orderInfo: DeliveryOrderPatch, $orderItems: [OrderInventoryPatch!]) {
524
- dispatchManualDeliveryOrder(orderInfo: $orderInfo, orderItems: $orderItems) {
1089
+ mutation dispatchManualDeliveryOrder(
1090
+ $orderInfo: DeliveryOrderPatch
1091
+ $orderItems: [OrderInventoryPatch!]
1092
+ $shippingOrderInfo: ShippingOrderInfoPatch
1093
+ ) {
1094
+ dispatchManualDeliveryOrder(
1095
+ orderInfo: $orderInfo
1096
+ orderItems: $orderItems
1097
+ shippingOrderInfo: $shippingOrderInfo
1098
+ ) {
525
1099
  id
526
1100
  name
527
1101
  description
@@ -531,14 +1105,23 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
531
1105
  `,
532
1106
  variables: {
533
1107
  orderInfo: { ...this._getDeliveryInfo() },
534
- orderItems: this._getOrderItems()
1108
+ orderItems: this._getOrderItems(),
1109
+ shippingOrderInfo: shippingOrderInfo ? shippingOrderInfo : null
535
1110
  }
536
1111
  })
537
1112
  } else {
538
1113
  response = await client.mutate({
539
1114
  mutation: gql`
540
- mutation dispatchDeliveryOrder($orderInfo: DeliveryOrderPatch, $orderItems: [OrderInventoryPatch!]) {
541
- dispatchDeliveryOrder(orderInfo: $orderInfo, orderItems: $orderItems) {
1115
+ mutation dispatchDeliveryOrder(
1116
+ $orderInfo: DeliveryOrderPatch
1117
+ $orderItems: [OrderInventoryPatch!]
1118
+ $shippingOrderInfo: ShippingOrderInfoPatch
1119
+ ) {
1120
+ dispatchDeliveryOrder(
1121
+ orderInfo: $orderInfo
1122
+ orderItems: $orderItems
1123
+ shippingOrderInfo: $shippingOrderInfo
1124
+ ) {
542
1125
  id
543
1126
  name
544
1127
  description
@@ -548,7 +1131,8 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
548
1131
  `,
549
1132
  variables: {
550
1133
  orderInfo: { ...this._getDeliveryInfo() },
551
- orderItems: this._getOrderItems()
1134
+ orderItems: this._getOrderItems(),
1135
+ shippingOrderInfo: shippingOrderInfo ? shippingOrderInfo : null
552
1136
  }
553
1137
  })
554
1138
  }
@@ -567,6 +1151,205 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
567
1151
  }
568
1152
  }
569
1153
 
1154
+ async fetchCountry() {
1155
+ const response = await client.query({
1156
+ query: gql`
1157
+ query geoCountriesWithoutParam {
1158
+ geoCountriesWithoutParam {
1159
+ items {
1160
+ id
1161
+ name
1162
+ description
1163
+ }
1164
+ }
1165
+ }
1166
+ `
1167
+ })
1168
+
1169
+ if (!response.error) {
1170
+ this._billingAllCountry = response.data.geoCountriesWithoutParam.items
1171
+ this._deliveryAllCountry = response.data.geoCountriesWithoutParam.items
1172
+ }
1173
+ }
1174
+
1175
+ async _fetchReleaseOrder(roNo) {
1176
+ if (!roNo) return
1177
+ const response = await client.query({
1178
+ query: gql`
1179
+ query releaseGoodDetail($name: String!) {
1180
+ releaseGoodDetail(name: $name) {
1181
+ id
1182
+ name
1183
+ truckNo
1184
+ type
1185
+ attentionTo
1186
+ attentionCompany
1187
+ phone1
1188
+ deliveryAddress1
1189
+ billingAddress
1190
+ billingCity
1191
+ billingCountry
1192
+ billingPostalCode
1193
+ billingState
1194
+ city
1195
+ state
1196
+ postalCode
1197
+ country
1198
+ remark
1199
+ bizplace {
1200
+ id
1201
+ name
1202
+ }
1203
+ invStatus
1204
+ status
1205
+ refNo
1206
+ refNo2
1207
+ refNo3
1208
+ ownTransport
1209
+ crossDocking
1210
+ arrivalNotice {
1211
+ name
1212
+ }
1213
+ exportOption
1214
+ courierOption
1215
+ packingOption
1216
+ releaseDate
1217
+ collectionOrderNo
1218
+ attachment {
1219
+ id
1220
+ name
1221
+ refBy
1222
+ path
1223
+ mimetype
1224
+ }
1225
+ bizplace {
1226
+ id
1227
+ name
1228
+ description
1229
+ }
1230
+ inventoryInfos {
1231
+ id
1232
+ name
1233
+ batchId
1234
+ batchIdRef
1235
+ palletId
1236
+ product {
1237
+ id
1238
+ sku
1239
+ brand
1240
+ name
1241
+ description
1242
+ }
1243
+ productName
1244
+ packingType
1245
+ packingSize
1246
+ qty
1247
+ lockedQty
1248
+ lockedUomValue
1249
+ uomValue
1250
+ releaseQty
1251
+ releaseUomValue
1252
+ uom
1253
+ location {
1254
+ id
1255
+ name
1256
+ }
1257
+ status
1258
+ }
1259
+ shippingOrderInfo {
1260
+ id
1261
+ containerNo
1262
+ containerLeavingDate
1263
+ containerArrivalDate
1264
+ shipName
1265
+ }
1266
+ orderVass {
1267
+ vas {
1268
+ name
1269
+ operationGuide
1270
+ operationGuideType
1271
+ }
1272
+ set
1273
+ targetType
1274
+ targetBatchId
1275
+ targetProduct {
1276
+ id
1277
+ name
1278
+ description
1279
+ }
1280
+ packingType
1281
+ qty
1282
+ uomValue
1283
+ otherTarget
1284
+ description
1285
+ remark
1286
+ status
1287
+ operationGuide
1288
+ }
1289
+ }
1290
+ }
1291
+ `,
1292
+ variables: { name: roNo }
1293
+ })
1294
+
1295
+ if (!response.errors) {
1296
+ const releaseOrder = response.data.releaseGoodDetail
1297
+ // shipment info
1298
+ this._billingFullAddress = releaseOrder?.billingAddress
1299
+ this._deliveryFullAddress = releaseOrder?.deliveryAddress1
1300
+ this._attentionTo = releaseOrder?.attentionTo
1301
+ this._companyName = releaseOrder?.attentionCompany
1302
+ this._deliveryCity = releaseOrder?.city
1303
+ this._deliveryState = releaseOrder?.state
1304
+ this._selectedPostCode = releaseOrder?.postalCode
1305
+ this._deliveryCountry = releaseOrder?.country
1306
+ this._deliveryContact = releaseOrder?.phone1
1307
+ this._selectedBillingPostCode = releaseOrder?.billingPostalCode
1308
+ this._billingCity = releaseOrder?.billingCity
1309
+ this._billingState = releaseOrder?.billingState
1310
+ this._billingCountry = releaseOrder?.billingCountry
1311
+ this._selectedOwnTransport = releaseOrder?.ownTransport
1312
+ this.coNo = releaseOrder?.collectionOrderNo
1313
+ this._containerArrivalDate = releaseOrder?.shippingOrderInfo.containerArrivalDate
1314
+ this._containerLeavingDate = releaseOrder?.shippingOrderInfo.containerLeavingDate
1315
+ this._containerNo = releaseOrder?.shippingOrderInfo.containerNo
1316
+ this._shipName = releaseOrder?.shippingOrderInfo.shipName
1317
+ this._exportOption = releaseOrder?.exportOption
1318
+
1319
+ return releaseOrder
1320
+ }
1321
+ }
1322
+
1323
+ async _fetchDeliveryOrder(doNo) {
1324
+ if (!doNo) return
1325
+
1326
+ const response = await client.query({
1327
+ query: gql`
1328
+ query deliveryOrder($name: String!) {
1329
+ deliveryOrder(name: $name) {
1330
+ palletQty
1331
+ ownCollection
1332
+ }
1333
+ }
1334
+ `,
1335
+ variables: { name: doNo }
1336
+ })
1337
+
1338
+ this._ownCollection = response.data.deliveryOrder.ownCollection
1339
+
1340
+ if (response.data.deliveryOrder.ownCollection) {
1341
+ this._determineOwnCollection = 'Own Transport'
1342
+ } else {
1343
+ this._determineOwnCollection = 'Warehouse Transport'
1344
+ }
1345
+
1346
+ return response
1347
+ }
1348
+
1349
+ initProperties() {
1350
+ this._transportType = ['Own Transport', 'Warehouse Transport']
1351
+ }
1352
+
570
1353
  _validateDeliveryInfo() {
571
1354
  let errorFields = []
572
1355
 
@@ -612,7 +1395,17 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
612
1395
 
613
1396
  _getDeliveryInfo() {
614
1397
  if (this.shadowRoot.querySelector('form').checkValidity()) {
615
- this._validateDeliveryInfo()
1398
+ // this._validateDeliveryInfo()
1399
+
1400
+ if (this._ownCollection) {
1401
+ if (this.otherDriverInput.value == '') {
1402
+ throw new Error(i18next.t('text.driver_is_empty'))
1403
+ }
1404
+ } else {
1405
+ if (this._truckDriverInput.value == '') {
1406
+ throw new Error(i18next.t('text.driver_is_empty'))
1407
+ }
1408
+ }
616
1409
 
617
1410
  const deliveryInfo = this._serializeForm(this.doForm)
618
1411
  delete deliveryInfo.otherDestBoolean
@@ -621,7 +1414,10 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
621
1414
  ...deliveryInfo,
622
1415
  name: this.doNo,
623
1416
  contactPoint: this._otherDestination ? null : this.selectedCP,
624
- otherTruck: this._ownCollection ? deliveryInfo.otherTruck.toUpperCase().replace(/\s+/g, '') : null
1417
+ otherTruck:
1418
+ this._ownCollection && deliveryInfo.otherTruck
1419
+ ? deliveryInfo.otherTruck.toUpperCase().replace(/\s+/g, '')
1420
+ : null
625
1421
  }
626
1422
  } else {
627
1423
  throw new Error(i18next.t('text.delivery_info_not_valid'))
@@ -646,6 +1442,54 @@ class DeliveryNotePopup extends localize(i18next)(LitElement) {
646
1442
  }
647
1443
  }
648
1444
 
1445
+ async _tabChange(key) {
1446
+ if (key == 'order') {
1447
+ this._showReleasedOrderInfo = false
1448
+ this._showShippingInfo = true
1449
+ this.initProperties()
1450
+ } else {
1451
+ this._showReleasedOrderInfo = true
1452
+ this._showShippingInfo = false
1453
+ this._exportOption = false
1454
+ }
1455
+ }
1456
+
1457
+ matchDeliveryAddress() {
1458
+ this._billingFullAddress = ''
1459
+ this._billingState = ''
1460
+ this._billingCity = ''
1461
+ this._getBillingPostalCodeInput.value = ''
1462
+ }
1463
+
1464
+ _validateCountry(e) {
1465
+ if (e.target.value != 'MALAYSIA') {
1466
+ this._switchDeliveryCountryInput = true
1467
+ } else {
1468
+ this._switchDeliveryCountryInput = false
1469
+ }
1470
+ }
1471
+
1472
+ _validateBillingCountry(e) {
1473
+ if (e.target.value != 'MALAYSIA') {
1474
+ this._switchBillingCountryInput = true
1475
+ this._selectedBillingCountry = e.target.value
1476
+ } else {
1477
+ this._switchBillingCountryInput = false
1478
+ this._selectedBillingCountry = e.target.value
1479
+ }
1480
+ }
1481
+
1482
+ _serializeFormRO(form) {
1483
+ let obj = {}
1484
+ Array.from(form.querySelectorAll('input, select')).forEach(field => {
1485
+ if (!field.hasAttribute('hidden') && field.value) {
1486
+ obj[field.name] = field.type === 'checkbox' ? field.checked : field.value
1487
+ }
1488
+ })
1489
+
1490
+ return obj
1491
+ }
1492
+
649
1493
  _showToast({ type, message }) {
650
1494
  document.dispatchEvent(
651
1495
  new CustomEvent('notify', {