@things-factory/operato-wms 4.3.41 → 4.3.44

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.
@@ -78,13 +78,13 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
78
78
  _disableTransport: Boolean,
79
79
  _enableTransportationServiceSetting: Boolean,
80
80
  _vasExpanded: Boolean,
81
+ _selectedCP: String,
81
82
 
82
83
  /* Shipping Form Field */
83
84
  _contactPointId: String,
84
85
  _contactPointName: String,
85
86
  _companyName: String,
86
87
  _attentionTo: String,
87
- _deliveryCountry: String,
88
88
  _deliveryPostCode: Array,
89
89
  _deliveryState: String,
90
90
  _deliveryCity: String,
@@ -102,8 +102,10 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
102
102
  _selectedBillingPostCode: String,
103
103
  _switchDeliveryCountryInput: Boolean,
104
104
  _switchBillingCountryInput: Boolean,
105
- _deliveryAllCountry: Array,
106
- _billingAllCountry: Array,
105
+ _allCountry: Array,
106
+
107
+ // refractor
108
+ _contactPointInfo: Object,
107
109
 
108
110
  /* Tab Toggle*/
109
111
  _showReleasedOrderInfo: Boolean,
@@ -241,6 +243,25 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
241
243
  width: 6%;
242
244
  }
243
245
  }
246
+
247
+ .section-header {
248
+ grid-column: span 36 / auto !important;
249
+ text-align: left !important;
250
+ margin-top: 10px !important;
251
+ font-weight: 600 !important;
252
+ }
253
+ .quick-find-content-container {
254
+ margin: 0 15px;
255
+ }
256
+
257
+ @media screen and (max-width: 480px) {
258
+ .section-header {
259
+ grid-column: span 12 / auto !important;
260
+ }
261
+ .quick-find-content-container {
262
+ margin: 0;
263
+ }
264
+ }
244
265
  `
245
266
  ]
246
267
  }
@@ -280,19 +301,16 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
280
301
  }
281
302
 
282
303
  return html`
283
- <form class="single-column-form" autocomplete="off" style="margin-bottom:-18px">
284
- <div>
285
- <quick-find-content
286
- id="order-items-list"
287
- name="quickFindContent"
288
- .data="${orderSet}"
289
- @tabChanged="${e => {
290
- this._tabChange(e.detail.currentTabKey)
291
- }}"
292
- ></quick-find-content>
293
- </div>
294
-
295
- </form>
304
+ <div class="quick-find-content-container" >
305
+ <quick-find-content
306
+ id="order-items-list"
307
+ name="quickFindContent"
308
+ .data="${orderSet}"
309
+ @tabChanged="${e => {
310
+ this._tabChange(e.detail.currentTabKey)
311
+ }}"
312
+ ></quick-find-content>
313
+ </div>
296
314
 
297
315
  <form name="releaseOrder" class="multi-column-form" autocomplete="off" ?hidden="${this._showReleasedOrderInfo}">
298
316
  <fieldset>
@@ -460,122 +478,81 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
460
478
  </fieldset>
461
479
  </form>
462
480
 
463
- <form name="deliveryOrderInfo" ?hidden="${this._showShippingInfo}" class="multi-column-form" autocomplete="off">
464
- <fieldset>
465
-
466
- <legend>${i18next.t('title.shipping_information')}</legend>
467
481
 
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
-
480
- <form name="contactPointInfo" ?hidden="${this._showShippingInfo}" class="multi-column-form" autocomplete="off">
482
+ <form name="shippingInfo" ?hidden="${this._showShippingInfo}" class="multi-column-form" autocomplete="off">
483
+ <legend>${i18next.t('title.shipping_information')}</legend>
481
484
  <label>${i18next.t('label.company')}</label>
482
- <input name="companyName" required .value="${this._companyName}" />
485
+ <input name="attentionCompany" required .value="${this._companyName}" />
483
486
 
484
487
  <label>${i18next.t('label.attention_to')}</label>
485
488
  <input name="attentionTo" required .value="${this._attentionTo}" />
486
489
 
487
-
488
- </fieldset>
489
- </form>
490
-
491
- <form class="multi-column-form" title ?hidden="${this._showShippingInfo}">
492
- <label>${i18next.t('label.delivery_address')}</label>
493
- </form>
494
-
495
-
496
- <form name="deliveryAddressInfo" ?hidden="${this._showShippingInfo}" class="multi-column-form" autocomplete="off">
497
- <!-- delivery -->
498
- <fieldset>
499
- <label>${i18next.t('label.country')}</label>
500
-
501
- <select
502
- name="deliveryCountry"
503
- @change=${e => {
504
- this._validateCountry(e)
505
- }}
506
- >
507
- <option value=${this._selectedDeliveryCountry ? this._selectedDeliveryCountry : ''} selected>
508
- ${this._selectedDeliveryCountry ? this._selectedDeliveryCountry : ''}
509
- </option>
510
- ${this._deliveryAllCountry?.map(
511
- (country, key) => html`<option value=${country.name}>${country.name}</option>`
512
- )}
513
- </select>
514
-
515
-
516
- <label>${i18next.t('label.zip_postal_code')}</label>
490
+ <button type="button" @click="${this._openContactPointSelector.bind(this)}">import</button>
517
491
 
518
- ${
519
- this._switchDeliveryCountryInput
520
- ? html` <input name="deliveryPostalCode" required .value="" /> `
521
- : html`<select
522
- name="deliveryPostalCode"
523
- @change=${e => {
524
- this._getStateAndCityByPostCode(e.target.value, e.target.name)
525
- }}
526
- >
527
- <option value=${this._selectedPostCode ? this._selectedPostCode : ''} selected>
528
- ${this._selectedPostCode ? this._selectedPostCode : ''}
529
- </option>
530
- ${this._deliveryPostCode.map(
531
- (country, key) => html`<option value=${country.postalCode}>${country.postalCode}</option>`
532
- )}
533
- </select>`
534
- }
492
+ <!-- delivery -->
493
+ <label class="section-header">${i18next.t('label.delivery_address')}</label>
535
494
 
495
+ <label>${i18next.t('label.country')}</label>
496
+ <select
497
+ name="country"
498
+ @change=${e => {
499
+ this._validateCountry(e)
500
+ }}
501
+ >
502
+ ${this._allCountry?.map((country, key) => html`<option value=${country.name}>${country.name}</option>`)}
503
+ </select>
536
504
 
537
- <label>${i18next.t('label.state')}</label>
538
- <input name="deliveryState" required .value="${this._deliveryState}" />
539
505
 
540
- <label>${i18next.t('label.city')}</label>
541
- <input name="deliveryCity" required .value="${this._deliveryCity}" />
506
+ <label>${i18next.t('label.zip_postal_code')}</label>
542
507
 
543
- <label>${i18next.t('label.delivery_address')}</label>
544
- <textarea name="deliveryFullAddress" required .value="${this._deliveryFullAddress}"></textarea>
508
+ ${
509
+ this._switchDeliveryCountryInput
510
+ ? html` <input name="postalCode" required .value="" /> `
511
+ : html`<select
512
+ name="postalCode"
513
+ @change=${e => {
514
+ this._getStateAndCityByPostCode(e.target.value, e.target.name)
515
+ }}
516
+ >
517
+ <option value=""></option>
518
+ ${this._deliveryPostCode?.map(
519
+ (country, key) =>
520
+ html`<option value=${country.postalCode} ?selected=${this._selectedPostCode === country.postalCode}>
521
+ ${country.postalCode}
522
+ </option>`
523
+ )}
524
+ </select>`
525
+ }
526
+
545
527
 
546
- <label>${i18next.t('label.contact')}</label>
547
- <input name="contact" required .value="${this._deliveryContact}" />
548
- </fieldset>
549
- </form>
528
+ <label>${i18next.t('label.state')}</label>
529
+ <input name="state" required .value="${this._deliveryState}" />
550
530
 
531
+ <label>${i18next.t('label.city')}</label>
532
+ <input name="city" required .value="${this._deliveryCity}" />
551
533
 
552
- <form class="multi-column-form" title ?hidden="${this._showShippingInfo}">
553
- <label>${i18next.t('label.billing_address')}</label>
554
- </form>
534
+ <label>${i18next.t('label.delivery_address')}</label>
535
+ <textarea name="deliveryAddress1" required .value="${this._deliveryFullAddress}"></textarea>
555
536
 
556
- <form name="billingAddressInfo" ?hidden="${this._showShippingInfo}" class="multi-column-form" autocomplete="off">
537
+ <label>${i18next.t('label.contact')}</label>
538
+ <input name="phone1" required .value="${this._deliveryContact}" />
557
539
 
558
- <!-- billing -->
559
- <fieldset>
560
540
 
561
- <label>${i18next.t('label.country')}</label>
541
+ <!-- billing -->
542
+ <label class="section-header">${i18next.t('label.billing_address')}</label>
562
543
 
563
- <select
564
- name="billingCountry"
565
- ?disabled=${this._disableBillingAddress ? true : false}
566
- @change=${e => {
567
- this._validateBillingCountry(e)
568
- }}
569
- >
570
- <option value=${this._selectedBillingCountry ? this._selectedBillingCountry : ''} selected>
571
- ${this._selectedBillingCountry ? this._selectedBillingCountry : ''}
572
- </option>
573
- ${this._deliveryAllCountry.map(
574
- (country, key) => html`<option value=${country.name}>${country.name}</option>`
575
- )}
576
- </select>
544
+ <label>${i18next.t('label.country')}</label>
545
+ <select
546
+ name="billingCountry"
547
+ ?disabled=${this._disableBillingAddress ? true : false}
548
+ @change=${e => {
549
+ this._validateBillingCountry(e)
550
+ }}
551
+ >
552
+ ${this._allCountry?.map((country, key) => html`<option value=${country.name}>${country.name}</option>`)}
553
+ </select>
577
554
 
578
- <label>${i18next.t('label.zip_postal_code')}</label>
555
+ <label>${i18next.t('label.zip_postal_code')}</label>
579
556
 
580
557
  ${
581
558
  this._switchBillingCountryInput
@@ -597,34 +574,30 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
597
574
  <option value=${this._selectedBillingPostCode ? this._selectedBillingPostCode : ''} selected>
598
575
  ${this._selectedBillingPostCode ? this._selectedBillingPostCode : ''}
599
576
  </option>
600
- ${this._billingPostCode.map(
577
+ ${this._billingPostCode?.map(
601
578
  (country, key) => html`<option value=${country.postalCode}>${country.postalCode}</option>`
602
579
  )}
603
580
  </select>`
604
581
  }
605
582
 
606
- <label>${i18next.t('label.state')}</label>
607
- <input ?disabled=${this._disableBillingAddress ? true : false} name="billingState" required .value="${
608
- this._billingState
609
- }" />
610
-
611
- <label>${i18next.t('label.city')}</label>
612
- <input ?disabled=${this._disableBillingAddress ? true : false} name="billingCity" required .value="${
613
- this._billingCity
614
- }" />
615
-
616
- <label>${i18next.t('label.billing_address')}</label>
617
- <textarea ?disabled=${
618
- this._disableBillingAddress ? true : false
619
- } name="billingFullAddress" required .value="${this._billingFullAddress}"></textarea>
620
-
621
- <input type="checkbox" id="matchDeliveryAddress" name="matchDeliveryAddressInputa" @click=${e => {
622
- e.currentTarget.checked ? (this._disableBillingAddress = true) : (this._disableBillingAddress = false)
623
- e.currentTarget.checked ? this.matchDeliveryAddress() : ''
624
- }} />
625
- <label for="matchDeliveryAddress">${i18next.t('label.match_delivery_address')}</label>
626
-
627
- </fieldset>
583
+ <label>${i18next.t('label.state')}</label>
584
+ <input ?disabled=${this._disableBillingAddress ? true : false} name="billingState" required
585
+ .value="${this._billingState}" />
586
+
587
+ <label>${i18next.t('label.city')}</label>
588
+ <input ?disabled=${this._disableBillingAddress ? true : false} name="billingCity" required
589
+ .value="${this._billingCity}" />
590
+
591
+ <label>${i18next.t('label.billing_address')}</label>
592
+ <textarea ?disabled=${this._disableBillingAddress ? true : false} name="billingAddress" required
593
+ .value="${this._billingFullAddress}"></textarea>
594
+
595
+ <input type="checkbox" id="matchDeliveryAddress" name="matchDeliveryAddressInput" @click=${e => {
596
+ e.currentTarget.checked ? (this._disableBillingAddress = true) : (this._disableBillingAddress = false)
597
+ }} />
598
+ <label for="matchDeliveryAddress">${i18next.t('label.match_delivery_address')}</label>
599
+
600
+
628
601
  </form>
629
602
 
630
603
 
@@ -765,12 +738,8 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
765
738
  return this.shadowRoot.querySelector('form[name=releaseOrder]')
766
739
  }
767
740
 
768
- get getDeliveryOrderForm() {
769
- return this.shadowRoot.querySelector('form[name=deliveryOrderInfo]')
770
- }
771
-
772
- get getContactPointForm() {
773
- return this.shadowRoot.querySelector('form[name=contactPointInfo]')
741
+ get shippingInfoForm() {
742
+ return this.shadowRoot.querySelector('form[name=shippingInfo]')
774
743
  }
775
744
 
776
745
  get getDeliveryAddressInfoForm() {
@@ -781,10 +750,6 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
781
750
  return this.shadowRoot.querySelector('form[name=billingAddressInfo]')
782
751
  }
783
752
 
784
- get getDeliveryOrderForm() {
785
- return this.shadowRoot.querySelector('form[name=deliveryOrderInfo]')
786
- }
787
-
788
753
  get _containerArrivalDateInput() {
789
754
  return this.shadowRoot.querySelector('input[name=containerArrivalDate]')
790
755
  }
@@ -801,6 +766,22 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
801
766
  return this.shadowRoot.querySelector('input[name=ownTransport]')
802
767
  }
803
768
 
769
+ get _cityInput() {
770
+ return this.shadowRoot.querySelector('input[name=city]')
771
+ }
772
+
773
+ get _stateInput() {
774
+ return this.shadowRoot.querySelector('input[name=state]')
775
+ }
776
+
777
+ get _cityBillingInput() {
778
+ return this.shadowRoot.querySelector('input[name=billingCity]')
779
+ }
780
+
781
+ get _stateBillingInput() {
782
+ return this.shadowRoot.querySelector('input[name=billingState]')
783
+ }
784
+
804
785
  get _warehouseTransportInput() {
805
786
  return this.shadowRoot.querySelector('input[name=warehouseTransport]')
806
787
  }
@@ -838,7 +819,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
838
819
  }
839
820
 
840
821
  get matchDeliveryAddressInput() {
841
- return this.shadowRoot?.querySelector('input[name=matchDeliveryAddressInputa]')
822
+ return this.shadowRoot?.querySelector('input[name=matchDeliveryAddressInput]')
842
823
  }
843
824
 
844
825
  get _inventoryColumns() {
@@ -1066,7 +1047,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
1066
1047
  this.releaseDate = ''
1067
1048
  this.collectionOrderNo = ''
1068
1049
  this._files = []
1069
- this._deliveryAllCountry = []
1050
+ this._allCountry = []
1070
1051
  this.containerNo = ''
1071
1052
  this.containerArrivalDate = ''
1072
1053
  this.containerLeavingDate = ''
@@ -1078,20 +1059,14 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
1078
1059
  this._showShippingInfo = true
1079
1060
  this._attentionTo = ''
1080
1061
  this._companyName = ''
1081
- this._deliveryCountry = 'Malaysia'
1082
- this._deliveryPostCode = []
1083
1062
  this._deliveryState = ''
1084
1063
  this._deliveryCity = ''
1085
1064
  this._deliveryFullAddress = ''
1086
1065
  this._deliveryContact = ''
1087
- this._billingCountry = 'Malaysia'
1088
- this._billingPostCode = []
1089
1066
  this._billingState = ''
1090
1067
  this._billingCity = ''
1091
1068
  this._billingFullAddress = ''
1092
1069
  this._billingContact = ''
1093
- this._selectedPostCode = ''
1094
- this._selectedBillingPostCode = ''
1095
1070
  this._switchDeliveryCountryInput = false
1096
1071
  this._switchBillingCountryInput = false
1097
1072
  this._disableBillingAddress = false
@@ -1822,8 +1797,7 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
1822
1797
  })
1823
1798
 
1824
1799
  if (!response.error) {
1825
- this._billingAllCountry = response.data.geoCountriesWithoutParam.items
1826
- this._deliveryAllCountry = response.data.geoCountriesWithoutParam.items
1800
+ this._allCountry = response.data.geoCountriesWithoutParam.items
1827
1801
  }
1828
1802
  }
1829
1803
 
@@ -1919,35 +1893,22 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
1919
1893
 
1920
1894
  let shippingOrderInfo = {}
1921
1895
 
1922
- let contactPointInfo = this._serializeForm(this.getContactPointForm)
1923
-
1924
- let deliveryAddressInfo = this._serializeForm(this.getDeliveryAddressInfoForm)
1925
-
1926
- let billingAddressInfo = this._serializeForm(this.getBillingAddressInfoForm)
1896
+ let contactPointInfo = this._serializeForm(this.shippingInfoForm)
1927
1897
 
1928
1898
  shippingOrderInfo = {
1929
- ...contactPointInfo,
1930
- ...deliveryAddressInfo,
1931
- ...billingAddressInfo
1899
+ ...contactPointInfo
1932
1900
  }
1933
1901
 
1934
1902
  delete shippingOrderInfo['']
1903
+ delete shippingOrderInfo.matchDeliveryAddressInput
1904
+
1905
+ // If match delivery address is ticked, all the billing address info will be the same with delivery address info
1935
1906
  if (this._disableBillingAddress) {
1936
- shippingOrderInfo.billingAddress = deliveryAddressInfo.deliveryFullAddress
1937
- shippingOrderInfo.billingPostalCode = deliveryAddressInfo.deliveryPostalCode
1938
- shippingOrderInfo.billingCity = deliveryAddressInfo.deliveryCity
1939
- shippingOrderInfo.billingState = deliveryAddressInfo.deliveryState
1940
- } else {
1941
- shippingOrderInfo.billingAddress = billingAddressInfo.billingFullAddress
1907
+ shippingOrderInfo.billingAddress = shippingOrderInfo.deliveryAddress1
1908
+ shippingOrderInfo.billingPostalCode = shippingOrderInfo.postalCode
1909
+ shippingOrderInfo.billingCity = shippingOrderInfo.city
1910
+ shippingOrderInfo.billingState = shippingOrderInfo.state
1942
1911
  }
1943
- shippingOrderInfo.deliveryAddress = deliveryAddressInfo.deliveryFullAddress
1944
- shippingOrderInfo.billingCountry = this._selectedBillingCountry
1945
-
1946
- delete shippingOrderInfo.deliveryFullAddress
1947
- delete shippingOrderInfo.billingFullAddress
1948
- delete shippingOrderInfo.matchDeliveryAddressInputa
1949
-
1950
- this.matchDeliveryAddressInput
1951
1912
 
1952
1913
  let result = await CustomAlert({
1953
1914
  title: i18next.t('title.are_you_sure'),
@@ -2013,6 +1974,12 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2013
1974
 
2014
1975
  if (!response.errors) {
2015
1976
  this.resetPage()
1977
+ this._resetShippingInfoForm()
1978
+ this._deliveryPostCode = []
1979
+ this._billingPostCode = []
1980
+ this._selectedPostCode = ''
1981
+ this._selectedBillingPostCode = ''
1982
+
2016
1983
  navigate(`release_order_detail/${response.data.generateReleaseGood.name}`)
2017
1984
  this._showToast({ message: i18next.t('text.release_order_created') })
2018
1985
  } else {
@@ -2431,13 +2398,6 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2431
2398
  .flat()
2432
2399
  }
2433
2400
 
2434
- matchDeliveryAddress() {
2435
- this._billingFullAddress = ''
2436
- this._billingState = ''
2437
- this._billingCity = ''
2438
- this._getBillingPostalCodeInput.value = ''
2439
- }
2440
-
2441
2401
  _validateCountry(e) {
2442
2402
  if (e.target.value != 'MALAYSIA') {
2443
2403
  this._switchDeliveryCountryInput = true
@@ -2484,14 +2444,15 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2484
2444
  async _getStateAndCityByPostCode(value, name) {
2485
2445
  const postCode = value
2486
2446
 
2447
+ // If user select the first empty postal code, the city and state will change to empty
2487
2448
  if (postCode == '') {
2488
- if (name == 'deliveryPostalCode') {
2489
- this._deliveryState = ''
2490
- this._deliveryCity = ''
2449
+ if (name == 'postalCode') {
2450
+ this._cityInput.value = ''
2451
+ this._stateInput.value = ''
2491
2452
  return
2492
2453
  } else if (name == 'billingPostalCode') {
2493
- this._billingState = ''
2494
- this._billingCity = ''
2454
+ this._cityBillingInput.value = ''
2455
+ this._stateBillingInput.value = ''
2495
2456
  return
2496
2457
  }
2497
2458
  }
@@ -2515,14 +2476,14 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2515
2476
  const { stateName, cityName } = response.data.geoAreasGetStateAndCityByPosCode
2516
2477
 
2517
2478
  switch (name) {
2518
- case 'deliveryPostalCode':
2519
- this._deliveryState = stateName
2520
- this._deliveryCity = cityName.toUpperCase()
2479
+ case 'postalCode':
2480
+ this._cityInput.value = stateName
2481
+ this._stateInput.value = cityName.toUpperCase()
2521
2482
  break
2522
2483
 
2523
2484
  case 'billingPostalCode':
2524
- this._billingState = stateName
2525
- this._billingCity = cityName.toUpperCase()
2485
+ this._cityBillingInput.value = stateName
2486
+ this._stateBillingInput.value = cityName.toUpperCase()
2526
2487
 
2527
2488
  default:
2528
2489
  break
@@ -2713,6 +2674,8 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2713
2674
  this._bizplaceId = e.detail.id
2714
2675
  this._bizplaceName = e.detail.name
2715
2676
  this.switchPickingType()
2677
+ // this._resetShippingInfoForm()
2678
+ this.fetchCountry()
2716
2679
  }}"
2717
2680
  ></popup-partner-bizplaces-selector>
2718
2681
  `,
@@ -2729,20 +2692,9 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2729
2692
  html`
2730
2693
  <contact-points-popup
2731
2694
  @selected="${e => {
2732
- this._companyName = e.detail.companyName
2733
- this._attentionTo = e.detail.name
2734
- this._deliveryCountry = 'MALAYSIA'
2735
- this._deliveryCity = e.detail.city ? e.detail.city : ''
2736
- this._selectedPostCode = e.detail.postCode ? e.detail.postCode : ''
2737
- this._deliveryState = e.detail.state ? e.detail.state : ''
2738
- this._deliveryContact = e.detail.phone ? e.detail.phone : ''
2739
- this._deliveryFullAddress = e.detail.address
2740
- ? e.detail.address
2741
- : '' + e.detail.address2
2742
- ? e.detail.address2
2743
- : ''
2744
- this._billingFullAddress = e.detail.billingAddress
2695
+ this._fillUpDeliveryInfo(e.detail)
2745
2696
  }}"
2697
+ .partnerBizplaceIds="${this._bizplaces.map(itm => itm.id)}"
2746
2698
  ></contact-points-popup>
2747
2699
  `,
2748
2700
  {
@@ -2960,6 +2912,53 @@ class CreateReleaseOrder extends localize(i18next)(PageView) {
2960
2912
  }
2961
2913
  }
2962
2914
 
2915
+ _fillUpDeliveryInfo(data) {
2916
+ // remapping according release good table
2917
+ const remapData = {
2918
+ attentionCompany: data.companyName || '',
2919
+ attentionTo: data.name || '',
2920
+ city: data.city || '',
2921
+ state: data.state || '',
2922
+ postalCode: data.postCode || '',
2923
+ country: 'Malaysia',
2924
+ phone1: data.phone || '',
2925
+ deliveryAddress1: data.address ? data.address : '' + data.address2 ? data.address2 : '',
2926
+ billingAddress: data.billingAddress
2927
+ }
2928
+
2929
+ this._selectedPostCode = data.postCode
2930
+
2931
+ this._fillupForm(this.shippingInfoForm, remapData)
2932
+ }
2933
+
2934
+ _resetShippingInfoForm() {
2935
+ this.shippingInfoForm.reset()
2936
+ }
2937
+
2938
+ _fillupForm(form, data) {
2939
+ if (form) {
2940
+ form.reset()
2941
+ for (let key in data) {
2942
+ Array.from(form.querySelectorAll('input, textarea', 'select')).forEach(field => {
2943
+ if (field.name === key && field.type === 'checkbox') {
2944
+ field.checked = data[key]
2945
+ } else if (field.name === key && field.type === 'datetime-local') {
2946
+ const datetime = Number(data[key])
2947
+ const timezoneOffset = new Date(datetime).getTimezoneOffset() * 60000
2948
+ field.value = new Date(datetime - timezoneOffset).toISOString().slice(0, -1)
2949
+ } else if (field.name === key) {
2950
+ if (data[key] instanceof Object) {
2951
+ const objectData = data[key]
2952
+ field.value = `${objectData.name} ${objectData.description ? `(${objectData.description})` : ''}`
2953
+ } else {
2954
+ field.value = data[key]
2955
+ }
2956
+ }
2957
+ })
2958
+ }
2959
+ }
2960
+ }
2961
+
2963
2962
  _showToast({ type, message }) {
2964
2963
  document.dispatchEvent(
2965
2964
  new CustomEvent('notify', {