@things-factory/operato-wms 4.3.332 → 4.3.335
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.
- package/client/pages/order/release-order/b2c/b2c-order-requests.js +17 -1
- package/client/pages/order/release-order/b2c/b2c-release-order-detail.js +2093 -0
- package/client/pages/order/release-order/b2c/create-b2c-release-order.js +2354 -0
- package/client/pages/outbound/packing-product.js +153 -9
- package/client/pages/outbound/worksheet-picking.js +88 -22
- package/client/pages/outbound/worksheet-sorting.js +47 -6
- package/client/route.js +8 -1
- package/package.json +5 -5
- package/things-factory.config.js +11 -5
- package/translations/en.json +18 -0
- package/translations/ko.json +24 -0
- package/translations/ms.json +24 -0
- package/translations/zh.json +24 -0
|
@@ -0,0 +1,2093 @@
|
|
|
1
|
+
import '@things-factory/biz-ui'
|
|
2
|
+
import '@things-factory/grist-ui'
|
|
3
|
+
import '../../../components/attachment-viewer'
|
|
4
|
+
import '../release-extra-product-popup'
|
|
5
|
+
import '../../../components/popup-note'
|
|
6
|
+
import '../../release-order/tracking-information-popup'
|
|
7
|
+
import '@things-factory/component-ui'
|
|
8
|
+
import '@things-factory/import-ui'
|
|
9
|
+
import '../../../components/select-product-popup'
|
|
10
|
+
|
|
11
|
+
import gql from 'graphql-tag'
|
|
12
|
+
import {
|
|
13
|
+
css,
|
|
14
|
+
html
|
|
15
|
+
} from 'lit-element'
|
|
16
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
17
|
+
|
|
18
|
+
import { MultiColumnFormStyles } from '@things-factory/form-ui'
|
|
19
|
+
import {
|
|
20
|
+
i18next,
|
|
21
|
+
localize
|
|
22
|
+
} from '@things-factory/i18n-base'
|
|
23
|
+
import { openPopup } from '@things-factory/layout-base'
|
|
24
|
+
import {
|
|
25
|
+
client,
|
|
26
|
+
CustomAlert,
|
|
27
|
+
navigate,
|
|
28
|
+
PageView,
|
|
29
|
+
store
|
|
30
|
+
} from '@things-factory/shell'
|
|
31
|
+
import { CommonButtonStyles } from '@things-factory/styles'
|
|
32
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
33
|
+
|
|
34
|
+
import { fetchSettingRule } from '../../../../fetch-setting-value'
|
|
35
|
+
import {
|
|
36
|
+
ORDER_STATUS,
|
|
37
|
+
PICKING_STANDARD
|
|
38
|
+
} from '../../../constants'
|
|
39
|
+
|
|
40
|
+
class B2CReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
41
|
+
static get properties() {
|
|
42
|
+
return {
|
|
43
|
+
_isLmd: Boolean,
|
|
44
|
+
_userType: String,
|
|
45
|
+
_userRoles: Array,
|
|
46
|
+
_releaseOrderNo: String,
|
|
47
|
+
_roInfo: Object,
|
|
48
|
+
// _template: Object,
|
|
49
|
+
_ownTransport: Boolean,
|
|
50
|
+
_crossDocking: Boolean,
|
|
51
|
+
_ganNo: String,
|
|
52
|
+
_exportOption: Boolean,
|
|
53
|
+
_courierOption: Boolean,
|
|
54
|
+
_packingOption: Boolean,
|
|
55
|
+
roType: String,
|
|
56
|
+
_orderMethod: String,
|
|
57
|
+
customerBizplaceId: String,
|
|
58
|
+
partnerBizplaceId: String,
|
|
59
|
+
inventoryGristConfig: Object,
|
|
60
|
+
inventoryData: Object,
|
|
61
|
+
orderInventoryData: Object,
|
|
62
|
+
_attachments: Array,
|
|
63
|
+
_status: String,
|
|
64
|
+
_mimetype: String,
|
|
65
|
+
_doPath: String,
|
|
66
|
+
_allowROAddProductSetting: Boolean,
|
|
67
|
+
_releaseOrder: Object,
|
|
68
|
+
_shippingOrder: Object,
|
|
69
|
+
_containerArrivalDate: Date,
|
|
70
|
+
_containerLeavingDate: Date,
|
|
71
|
+
_beforeRemark: String,
|
|
72
|
+
isUserBelongsDomain: Boolean,
|
|
73
|
+
_isInBatchPicking: Boolean,
|
|
74
|
+
|
|
75
|
+
/* Shipping Form Field */
|
|
76
|
+
_contactPointId: String,
|
|
77
|
+
_contactPointName: String,
|
|
78
|
+
_companyName: String,
|
|
79
|
+
_attentionTo: String,
|
|
80
|
+
_deliveryCountry: String,
|
|
81
|
+
_deliveryPostCode: Array,
|
|
82
|
+
_deliveryState: String,
|
|
83
|
+
_deliveryCity: String,
|
|
84
|
+
_deliveryContact: String,
|
|
85
|
+
_deliveryFullAddress: String,
|
|
86
|
+
_selectedPostCode: String,
|
|
87
|
+
_selectedDeliveryCountry: String,
|
|
88
|
+
_billingCountry: String,
|
|
89
|
+
_billingPostCode: Array,
|
|
90
|
+
_billingState: String,
|
|
91
|
+
_billingCity: String,
|
|
92
|
+
_billingContact: String,
|
|
93
|
+
_billingFullAddress: String,
|
|
94
|
+
_selectedBillingPostCode: String,
|
|
95
|
+
_deliveryAllCountry: Array,
|
|
96
|
+
_containerClosureDate: Date,
|
|
97
|
+
_recallOption: Boolean,
|
|
98
|
+
|
|
99
|
+
// Refractor
|
|
100
|
+
_shippingInfo: Object,
|
|
101
|
+
_selectedCountry: String,
|
|
102
|
+
_selectedBillingCountry: String,
|
|
103
|
+
|
|
104
|
+
/* Tab Toggle*/
|
|
105
|
+
_showReleasedOrderInfo: Boolean,
|
|
106
|
+
_showShippingInfo: Boolean,
|
|
107
|
+
_disableBillingAddress: Boolean,
|
|
108
|
+
currentTab: Object
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static get styles() {
|
|
113
|
+
return [
|
|
114
|
+
MultiColumnFormStyles,
|
|
115
|
+
css`
|
|
116
|
+
:host {
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
overflow-x: auto;
|
|
120
|
+
}
|
|
121
|
+
.container {
|
|
122
|
+
flex: 1;
|
|
123
|
+
display: flex;
|
|
124
|
+
overflow-y: auto;
|
|
125
|
+
}
|
|
126
|
+
.grist {
|
|
127
|
+
background-color: var(--main-section-background-color);
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
flex: 1;
|
|
131
|
+
overflow-y: auto;
|
|
132
|
+
}
|
|
133
|
+
.guide-container {
|
|
134
|
+
max-width: 30vw;
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
}
|
|
138
|
+
data-grist {
|
|
139
|
+
overflow-y: hidden;
|
|
140
|
+
flex: 1;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.label-remind-container-departure {
|
|
144
|
+
margin-left: 20px;
|
|
145
|
+
width: 50%;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
h2 {
|
|
149
|
+
padding: var(--subtitle-padding);
|
|
150
|
+
font: var(--subtitle-font);
|
|
151
|
+
color: var(--subtitle-text-color);
|
|
152
|
+
border-bottom: var(--subtitle-border-bottom);
|
|
153
|
+
}
|
|
154
|
+
.grist h2 {
|
|
155
|
+
margin: var(--grist-title-margin);
|
|
156
|
+
border: var(--grist-title-border);
|
|
157
|
+
font: var(--grist-title-font);
|
|
158
|
+
color: var(--secondary-color);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.grist h2 mwc-icon {
|
|
162
|
+
vertical-align: middle;
|
|
163
|
+
margin: var(--grist-title-icon-margin);
|
|
164
|
+
font-size: var(--grist-title-icon-size);
|
|
165
|
+
color: var(--grist-title-icon-color);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
h2 + data-grist {
|
|
169
|
+
padding-top: var(--grist-title-with-grid-padding);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
[title] {
|
|
173
|
+
margin-top: -5px;
|
|
174
|
+
margin-bottom: -5px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
[options-wrap] *,
|
|
178
|
+
[attachment-wrap] a * {
|
|
179
|
+
vertical-align: middle;
|
|
180
|
+
}
|
|
181
|
+
[options-wrap] input[type='checkbox'] {
|
|
182
|
+
left: 0;
|
|
183
|
+
}
|
|
184
|
+
[options-wrap] input[type='checkbox'] + label {
|
|
185
|
+
margin-right: 20px;
|
|
186
|
+
padding-left: 0;
|
|
187
|
+
}
|
|
188
|
+
[attachment-wrap] {
|
|
189
|
+
grid-column: span 9 / auto;
|
|
190
|
+
}
|
|
191
|
+
[remind-wrap] {
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: row;
|
|
194
|
+
grid-column: span 36 / auto;
|
|
195
|
+
}
|
|
196
|
+
[remind-wrap] label {
|
|
197
|
+
width: 8%;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
[attachment-wrap] a {
|
|
201
|
+
display: block;
|
|
202
|
+
text-overflow: ellipsis;
|
|
203
|
+
overflow: hidden;
|
|
204
|
+
white-space: nowrap;
|
|
205
|
+
color: var(--primary-color);
|
|
206
|
+
font-size: var(--fontsize-default);
|
|
207
|
+
}
|
|
208
|
+
[attachment-wrap] {
|
|
209
|
+
margin: 0;
|
|
210
|
+
padding: 0;
|
|
211
|
+
list-style: none;
|
|
212
|
+
}
|
|
213
|
+
[attachment-wrap] a mwc-icon {
|
|
214
|
+
font-size: var(--fontsize-default);
|
|
215
|
+
}
|
|
216
|
+
barcode-tag {
|
|
217
|
+
width: 100px;
|
|
218
|
+
height: 100px;
|
|
219
|
+
margin: 10px;
|
|
220
|
+
}
|
|
221
|
+
.form-container {
|
|
222
|
+
display: flex;
|
|
223
|
+
}
|
|
224
|
+
.form-container > form {
|
|
225
|
+
flex: 1;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
[hidden] {
|
|
229
|
+
display: none;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.section-header {
|
|
233
|
+
grid-column: span 36 / auto !important;
|
|
234
|
+
text-align: left !important;
|
|
235
|
+
margin-top: 10px !important;
|
|
236
|
+
font-weight: 600 !important;
|
|
237
|
+
}
|
|
238
|
+
.quick-find-content-container {
|
|
239
|
+
margin: 0 15px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@media screen and (max-width: 480px) {
|
|
243
|
+
.section-header {
|
|
244
|
+
grid-column: span 12 / auto !important;
|
|
245
|
+
}
|
|
246
|
+
.quick-find-content-container {
|
|
247
|
+
margin: 0;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
`
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
render() {
|
|
255
|
+
const RELEASE_ORDER_TABS = {
|
|
256
|
+
RELEASE_ORDER_INFO: i18next.t('label.order'),
|
|
257
|
+
SHIPPING_INFO: i18next.t('label.shipment')
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const orderSet = {
|
|
261
|
+
[RELEASE_ORDER_TABS.RELEASE_ORDER_INFO]: {},
|
|
262
|
+
[RELEASE_ORDER_TABS.SHIPPING_INFO]: {}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return html`
|
|
266
|
+
<div class="quick-find-content-container">
|
|
267
|
+
<quick-find-content
|
|
268
|
+
id="order-items-list"
|
|
269
|
+
name="quickFindContent"
|
|
270
|
+
.data="${orderSet}"
|
|
271
|
+
@tabChanged="${e => {
|
|
272
|
+
this._tabChange(e.detail.currentTabKey)
|
|
273
|
+
}}"
|
|
274
|
+
></quick-find-content>
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
<div ?hidden="${this._showReleasedOrderInfo}">
|
|
278
|
+
<div class="form-container">
|
|
279
|
+
<form name="releaseOrder" class="multi-column-form">
|
|
280
|
+
<fieldset>
|
|
281
|
+
<legend>${i18next.t('title.release_order_no')}: ${this._releaseOrderNo}</legend>
|
|
282
|
+
|
|
283
|
+
<label>${i18next.t('label.options')}</label>
|
|
284
|
+
<div options-wrap>
|
|
285
|
+
<input
|
|
286
|
+
id="ownTransport"
|
|
287
|
+
type="checkbox"
|
|
288
|
+
name="lmdOption"
|
|
289
|
+
?checked="${this._isLmd}"
|
|
290
|
+
?disabled="${true}"
|
|
291
|
+
/>
|
|
292
|
+
<label for="ownTransport">${i18next.t('label.lmd')}</label>
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
<label>${i18next.t('label.company')}</label>
|
|
296
|
+
<input name="bizplaceName" disabled />
|
|
297
|
+
|
|
298
|
+
<label>${i18next.t('label.ref_no')}</label>
|
|
299
|
+
<input name="refNo" ?readonly="${!this?._editable}" />
|
|
300
|
+
|
|
301
|
+
<label>${i18next.t('label.ref_no_2')}</label>
|
|
302
|
+
<input name="refNo2" ?readonly="${!this?._editable}" />
|
|
303
|
+
|
|
304
|
+
<label>${i18next.t('label.ref_no_3')}</label>
|
|
305
|
+
<input name="refNo3" ?readonly="${!this?._editable}" />
|
|
306
|
+
|
|
307
|
+
<label>${i18next.t('label.release_date')}</label>
|
|
308
|
+
<input name="releaseDate" type="date" ?readonly="${!this?._editable}" min="${this._getStdDate()}" />
|
|
309
|
+
|
|
310
|
+
<label ?hidden="${!this._ownTransport}">${i18next.t('label.co_no')}</label>
|
|
311
|
+
<input name="collectionOrderNo" ?hidden="${!this._ownTransport}" ?readonly="${!this?._editable}" />
|
|
312
|
+
|
|
313
|
+
<label>${i18next.t('label.tracking_no')}</label>
|
|
314
|
+
<input
|
|
315
|
+
name="trackingNo"
|
|
316
|
+
?disabled="${!(this._roInfo?.orderPackages?.length === 1) || this._source !== 'OTHERS'}"
|
|
317
|
+
?readonly="${!this?._editable || this._manifestedAt == true}"
|
|
318
|
+
/>
|
|
319
|
+
|
|
320
|
+
${this._crossDocking
|
|
321
|
+
? html`
|
|
322
|
+
<label for="ganNo">${i18next.t('label.arrival_notice')}</label>
|
|
323
|
+
<input disabled name="ganNo" .value="${this._ganNo}" />
|
|
324
|
+
`
|
|
325
|
+
: ''}
|
|
326
|
+
${this._invoiceAttachments?.length > 0
|
|
327
|
+
? html`
|
|
328
|
+
<label>${i18next.t('label.invoice')}</label>
|
|
329
|
+
<ul attachment-wrap>
|
|
330
|
+
${(this._invoiceAttachments || []).map(
|
|
331
|
+
invoiceAttachment =>
|
|
332
|
+
html`
|
|
333
|
+
<li>
|
|
334
|
+
<a href="${location.origin}/attachment/${invoiceAttachment.path}" download
|
|
335
|
+
><mwc-icon>attach_file</mwc-icon> ${invoiceAttachment.name}</a
|
|
336
|
+
>
|
|
337
|
+
</li>
|
|
338
|
+
`
|
|
339
|
+
)}
|
|
340
|
+
</ul>
|
|
341
|
+
`
|
|
342
|
+
: ''}
|
|
343
|
+
${this._awbAttachments?.length > 0
|
|
344
|
+
? html`
|
|
345
|
+
<label>${i18next.t('label.awb')}</label>
|
|
346
|
+
<ul attachment-wrap>
|
|
347
|
+
${(this._awbAttachments || []).map(
|
|
348
|
+
awbAttachment =>
|
|
349
|
+
html`
|
|
350
|
+
<li>
|
|
351
|
+
<a href="${location.origin}/attachment/${awbAttachment.path}" download>
|
|
352
|
+
<mwc-icon>attach_file</mwc-icon> ${awbAttachment.name}
|
|
353
|
+
</a>
|
|
354
|
+
</li>
|
|
355
|
+
`
|
|
356
|
+
)}
|
|
357
|
+
</ul>
|
|
358
|
+
`
|
|
359
|
+
: ''}
|
|
360
|
+
</fieldset>
|
|
361
|
+
</form>
|
|
362
|
+
|
|
363
|
+
<barcode-tag bcid="qrcode" .value=${this._releaseOrderNo}></barcode-tag>
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
|
|
367
|
+
<form name="shippingInfo" ?hidden="${this._showShippingInfo}" class="multi-column-form" autocomplete="off">
|
|
368
|
+
<legend>${i18next.t('title.shipping_information')} (${this._releaseOrderNo})</legend>
|
|
369
|
+
|
|
370
|
+
<label>${i18next.t('label.attention_to')}</label>
|
|
371
|
+
<input name="attentionTo" required .value="${this._attentionTo}" />
|
|
372
|
+
|
|
373
|
+
<!-- delivery -->
|
|
374
|
+
|
|
375
|
+
<label class="section-header">${i18next.t('label.delivery_address')}</label>
|
|
376
|
+
<label>${i18next.t('label.country')}</label>
|
|
377
|
+
<select
|
|
378
|
+
name="country"
|
|
379
|
+
@change=${e => {
|
|
380
|
+
this._validateCountry(e)
|
|
381
|
+
}}
|
|
382
|
+
>
|
|
383
|
+
${this._deliveryAllCountry?.map(
|
|
384
|
+
(country, key) =>
|
|
385
|
+
html`<option value=${country.description} ?selected=${country.description === this._selectedCountry}>
|
|
386
|
+
${country.name}
|
|
387
|
+
</option>`
|
|
388
|
+
)}
|
|
389
|
+
</select>
|
|
390
|
+
|
|
391
|
+
<label>${i18next.t('label.zip_postal_code')}</label>
|
|
392
|
+
${this._selectedCountry !== 'MY'
|
|
393
|
+
? html` <input name="postalCode" .value="" /> `
|
|
394
|
+
: html`<select
|
|
395
|
+
name="postalCode"
|
|
396
|
+
@change=${e => {
|
|
397
|
+
this._getStateAndCityByPostCode(e.target.value, e.target.name)
|
|
398
|
+
}}
|
|
399
|
+
value=${this?._selectedPostCode || ''}
|
|
400
|
+
>
|
|
401
|
+
<option value=""></option>
|
|
402
|
+
${this._deliveryPostCode.map(
|
|
403
|
+
(country, key) =>
|
|
404
|
+
html`<option
|
|
405
|
+
?selected=${(this._selectedPostCode.length > 0
|
|
406
|
+
? this._selectedPostCode
|
|
407
|
+
: this._releaseOrder.postalCode) == country.postalCode}
|
|
408
|
+
value=${country.postalCode}
|
|
409
|
+
>
|
|
410
|
+
${country.postalCode}
|
|
411
|
+
</option>`
|
|
412
|
+
)}
|
|
413
|
+
</select>`}
|
|
414
|
+
|
|
415
|
+
<label>${i18next.t('label.state')}</label>
|
|
416
|
+
<input name="state" .value="${this._releaseOrder.state}" />
|
|
417
|
+
|
|
418
|
+
<label>${i18next.t('label.city')}</label>
|
|
419
|
+
<input name="city" .value="${this._releaseOrder.city}" />
|
|
420
|
+
|
|
421
|
+
<label>${i18next.t('label.delivery_address')}</label>
|
|
422
|
+
<textarea name="deliveryAddress1" .value="${this._releaseOrder.deliveryAddress1}"></textarea>
|
|
423
|
+
|
|
424
|
+
<label>${i18next.t('label.contact')}</label>
|
|
425
|
+
<input name="phone1" value="${this._releaseOrder.phone1}" />
|
|
426
|
+
|
|
427
|
+
<!-- billing -->
|
|
428
|
+
<label class="section-header">${i18next.t('label.billing_address')}</label>
|
|
429
|
+
<label>${i18next.t('label.country')}</label>
|
|
430
|
+
|
|
431
|
+
<select
|
|
432
|
+
name="billingCountry"
|
|
433
|
+
?disabled="${this._disableBillingAddress}"
|
|
434
|
+
@change=${e => {
|
|
435
|
+
this._validateBillingCountry(e)
|
|
436
|
+
}}
|
|
437
|
+
>
|
|
438
|
+
${this._deliveryAllCountry.map(
|
|
439
|
+
(country, key) =>
|
|
440
|
+
html`<option
|
|
441
|
+
value=${country.description}
|
|
442
|
+
?selected=${country.description === this._selectedBillingCountry}
|
|
443
|
+
>
|
|
444
|
+
${country.name}
|
|
445
|
+
</option>`
|
|
446
|
+
)}
|
|
447
|
+
</select>
|
|
448
|
+
|
|
449
|
+
<label>${i18next.t('label.zip_postal_code')}</label>
|
|
450
|
+
|
|
451
|
+
${this._selectedBillingCountry !== 'MY'
|
|
452
|
+
? html`
|
|
453
|
+
<input
|
|
454
|
+
?disabled=${this._disableBillingAddress}
|
|
455
|
+
name="billingPostalCode"
|
|
456
|
+
.value=${this._releaseOrder.billingPostalCode || this._releaseOrder.postalCode}
|
|
457
|
+
/>
|
|
458
|
+
`
|
|
459
|
+
: html`<select
|
|
460
|
+
?disabled="${this._disableBillingAddress}"
|
|
461
|
+
name="billingPostalCode"
|
|
462
|
+
@change=${e => {
|
|
463
|
+
this._getStateAndCityByPostCode(e.target.value, e.target.name)
|
|
464
|
+
}}
|
|
465
|
+
value=${this._releaseOrder.billingPostalCode || this._releaseOrder.postalCode}
|
|
466
|
+
>
|
|
467
|
+
<option value=""></option>
|
|
468
|
+
|
|
469
|
+
${this._billingPostCode.map(
|
|
470
|
+
(country, key) =>
|
|
471
|
+
html`<option
|
|
472
|
+
?selected=${(this._releaseOrder.billingPostalCode || this._releaseOrder.postalCode) ==
|
|
473
|
+
country.postalCode}
|
|
474
|
+
value=${country.postalCode}
|
|
475
|
+
>
|
|
476
|
+
${country.postalCode}
|
|
477
|
+
</option>`
|
|
478
|
+
)}
|
|
479
|
+
</select>`}
|
|
480
|
+
|
|
481
|
+
<label>${i18next.t('label.state')}</label>
|
|
482
|
+
<input
|
|
483
|
+
?disabled=${this._disableBillingAddress}
|
|
484
|
+
name="billingState"
|
|
485
|
+
.value="${this._releaseOrder.billingState}"
|
|
486
|
+
/>
|
|
487
|
+
|
|
488
|
+
<label>${i18next.t('label.city')}</label>
|
|
489
|
+
<input ?disabled=${this._disableBillingAddress} name="billingCity" .value="${this._releaseOrder.billingCity}" />
|
|
490
|
+
|
|
491
|
+
<label>${i18next.t('label.billing_address')}</label>
|
|
492
|
+
<textarea
|
|
493
|
+
?disabled=${this._disableBillingAddress}
|
|
494
|
+
name="billingAddress"
|
|
495
|
+
.value="${this._releaseOrder.billingAddress || ''}"
|
|
496
|
+
></textarea>
|
|
497
|
+
|
|
498
|
+
<input
|
|
499
|
+
type="checkbox"
|
|
500
|
+
id="matchDeliveryAddress"
|
|
501
|
+
name="matchDeliveryAddressInput"
|
|
502
|
+
?checked=${this._releaseOrder.postalCode == this._releaseOrder.billingPostalCode &&
|
|
503
|
+
this._releaseOrder.billingAddress == this._releaseOrder.deliveryAddress1}
|
|
504
|
+
@click=${e => {
|
|
505
|
+
e.currentTarget.checked ? (this._disableBillingAddress = true) : (this._disableBillingAddress = false)
|
|
506
|
+
e.currentTarget.checked ? this.matchDeliveryAddress() : ''
|
|
507
|
+
this.matchDeliveryAddressInput.value = this.matchDeliveryAddressInput.value === 'on' ? 'off' : 'on'
|
|
508
|
+
}}
|
|
509
|
+
/>
|
|
510
|
+
<label for="matchDeliveryAddress">${i18next.t('label.match_delivery_address')}</label>
|
|
511
|
+
</form>
|
|
512
|
+
|
|
513
|
+
<div class="container">
|
|
514
|
+
<div class="grist">
|
|
515
|
+
<!-- release product list-->
|
|
516
|
+
<h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.release_product_list')}</h2>
|
|
517
|
+
<data-grist
|
|
518
|
+
id="inventory-grist"
|
|
519
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
520
|
+
.config=${this.inventoryGristConfig}
|
|
521
|
+
.data=${this.inventoryData}
|
|
522
|
+
></data-grist>
|
|
523
|
+
</div>
|
|
524
|
+
</div>
|
|
525
|
+
`
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
constructor() {
|
|
529
|
+
super()
|
|
530
|
+
this._clearPage()
|
|
531
|
+
this._deliveryAllCountry = []
|
|
532
|
+
this._editable = false
|
|
533
|
+
this._disableTransport = false
|
|
534
|
+
this._shippingOrder = null
|
|
535
|
+
this._showReleasedOrderInfo = false
|
|
536
|
+
this._showShippingInfo = true
|
|
537
|
+
this._attentionTo = ''
|
|
538
|
+
this._source = ''
|
|
539
|
+
this._manifestedAt = false
|
|
540
|
+
this._companyName = ''
|
|
541
|
+
this._deliveryPostCode = []
|
|
542
|
+
this._deliveryState = ''
|
|
543
|
+
this._deliveryCity = ''
|
|
544
|
+
this._deliveryFullAddress = ''
|
|
545
|
+
this._deliveryContact = ''
|
|
546
|
+
this._billingPostCode = []
|
|
547
|
+
this._billingState = ''
|
|
548
|
+
this._billingCity = ''
|
|
549
|
+
this._billingFullAddress = ''
|
|
550
|
+
this._billingContact = ''
|
|
551
|
+
this._selectedPostCode = ''
|
|
552
|
+
this._selectedBillingPostCode = ''
|
|
553
|
+
this.currentTab = {
|
|
554
|
+
selected: 'order'
|
|
555
|
+
}
|
|
556
|
+
this._containerClosureDate = ''
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
_openTrackingInformation() {
|
|
560
|
+
openPopup(
|
|
561
|
+
html`
|
|
562
|
+
<tracking-information-popup
|
|
563
|
+
.releaseGoodId="${this._roInfo.id}"
|
|
564
|
+
.bizplaceId="${this.partnerBizplaceId}"
|
|
565
|
+
></tracking-information-popup>
|
|
566
|
+
`,
|
|
567
|
+
{
|
|
568
|
+
backdrop: true,
|
|
569
|
+
size: 'medium',
|
|
570
|
+
title: i18next.t('title.tracking_information')
|
|
571
|
+
}
|
|
572
|
+
)
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
get context() {
|
|
576
|
+
var actions = [
|
|
577
|
+
{
|
|
578
|
+
title: i18next.t('button.back_to_list'),
|
|
579
|
+
action: () => navigate(`b2c_order_requests`),
|
|
580
|
+
...CommonButtonStyles.back
|
|
581
|
+
}
|
|
582
|
+
]
|
|
583
|
+
|
|
584
|
+
if (this._roInfo?.orderPackages?.length) {
|
|
585
|
+
actions.push({
|
|
586
|
+
title: i18next.t('button.tracking_no'),
|
|
587
|
+
action: this._openTrackingInformation.bind(this),
|
|
588
|
+
...CommonButtonStyles.arrived
|
|
589
|
+
})
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
if (this.isUserBelongsDomain) {
|
|
593
|
+
if (this._status === ORDER_STATUS.PENDING_RECEIVE.value && !this._crossDocking) {
|
|
594
|
+
actions.push(
|
|
595
|
+
{
|
|
596
|
+
title: i18next.t('button.reject'),
|
|
597
|
+
action: this._rejectReleaseOrder.bind(this),
|
|
598
|
+
...CommonButtonStyles.reject
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
title: i18next.t('button.receive'),
|
|
602
|
+
action: this._receiveReleaseOrder.bind(this),
|
|
603
|
+
...CommonButtonStyles.confirm
|
|
604
|
+
}
|
|
605
|
+
)
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (this._status === ORDER_STATUS.PENDING_CANCEL.value && !this._crossDocking) {
|
|
609
|
+
actions.push(
|
|
610
|
+
{
|
|
611
|
+
title: i18next.t('button.approve_cancellation'),
|
|
612
|
+
action: this._confirmCancellationReleaseOrder.bind(this),
|
|
613
|
+
...CommonButtonStyles.cancel
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
title: i18next.t('button.reject_cancellation'),
|
|
617
|
+
action: this._rejectCancellationReleaseOrder.bind(this),
|
|
618
|
+
...CommonButtonStyles.reject
|
|
619
|
+
}
|
|
620
|
+
)
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
if (this._status === ORDER_STATUS.PENDING_WORKSHEET.value && !this._crossDocking) {
|
|
624
|
+
actions.push({
|
|
625
|
+
title: i18next.t('button.generate_picking_worksheet'),
|
|
626
|
+
action: this._generateSinglePickingWorksheet.bind(this),
|
|
627
|
+
...CommonButtonStyles.generate
|
|
628
|
+
})
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if (this._crossDocking) {
|
|
632
|
+
const params = new URLSearchParams()
|
|
633
|
+
params.append('name', this._ganNo)
|
|
634
|
+
actions.push({
|
|
635
|
+
title: i18next.t('button.move_to_x', { state: { x: i18next.t('title.arrival_notice') } }),
|
|
636
|
+
action: () => navigate(`arrival_notices?${params.toString()}`)
|
|
637
|
+
})
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
if (this._editable) {
|
|
641
|
+
actions.push({
|
|
642
|
+
title: i18next.t('button.update_order_details'),
|
|
643
|
+
action: this._updateReleaseGoodDetails.bind(this),
|
|
644
|
+
...CommonButtonStyles.add
|
|
645
|
+
})
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
let addProductStatus = [ORDER_STATUS.PICKING.value, ORDER_STATUS.LOADING.value]
|
|
649
|
+
if (addProductStatus.indexOf(this._status) >= 0 && this._allowROAddProductSetting && !this._isInBatchPicking) {
|
|
650
|
+
actions.push({
|
|
651
|
+
title: i18next.t('button.edit'),
|
|
652
|
+
action: this._openExtraProductPopup.bind(this),
|
|
653
|
+
...CommonButtonStyles.edit
|
|
654
|
+
})
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
if (this._status === ORDER_STATUS.PENDING.value) {
|
|
659
|
+
actions.push(
|
|
660
|
+
{
|
|
661
|
+
title: i18next.t('button.delete'),
|
|
662
|
+
action: this._deleteReleaseOrder.bind(this),
|
|
663
|
+
...CommonButtonStyles.delete
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
title: i18next.t('button.confirm'),
|
|
667
|
+
action: this._confirmReleaseOrder.bind(this),
|
|
668
|
+
...CommonButtonStyles.confirm
|
|
669
|
+
}
|
|
670
|
+
)
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
let cancelOrderStatus = [
|
|
674
|
+
ORDER_STATUS.PICKING.value,
|
|
675
|
+
ORDER_STATUS.PENDING_WORKSHEET.value,
|
|
676
|
+
ORDER_STATUS.READY_TO_PICK.value,
|
|
677
|
+
ORDER_STATUS.LOADING.value
|
|
678
|
+
]
|
|
679
|
+
|
|
680
|
+
if (cancelOrderStatus.indexOf(this._status) >= 0) {
|
|
681
|
+
actions.push({
|
|
682
|
+
title: i18next.t('button.cancel_order'),
|
|
683
|
+
action: this._submitCancellationReleaseOrder.bind(this),
|
|
684
|
+
...CommonButtonStyles.cancel
|
|
685
|
+
})
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
return {
|
|
689
|
+
title: i18next.t('title.release_order_detail'),
|
|
690
|
+
actions,
|
|
691
|
+
printable: {
|
|
692
|
+
accept: ['preview'],
|
|
693
|
+
content: this
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
get shippingInfoForm() {
|
|
699
|
+
return this.shadowRoot.querySelector('form[name=shippingInfo]')
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
get releaseOrderForm() {
|
|
703
|
+
return this.shadowRoot.querySelector('form[name=releaseOrder]')
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
get _containerClosureDateInput() {
|
|
707
|
+
return this.shadowRoot.querySelector('input[name=containerClosureDate]')
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
get exportInfoForm() {
|
|
711
|
+
return this.shadowRoot.querySelector('form[name=exportInfo]')
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
get deliveryOrderForm() {
|
|
715
|
+
return this.shadowRoot.querySelector('form[name=deliveryOrderInfo]')
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
get billingPostalCodeInput() {
|
|
719
|
+
return this.shadowRoot.querySelector('select[name=billingPostalCode]')
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
get shippingOrderForm() {
|
|
723
|
+
return this.shadowRoot.querySelector('form[name=shippingOrder]')
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
get contactPointForm() {
|
|
727
|
+
return this.shadowRoot.querySelector('form[name=contactPointInfo]')
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
get billingAddressForm() {
|
|
731
|
+
return this.shadowRoot.querySelector('form[name=billingAddressInfo]')
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
get deliveryAddressForm() {
|
|
735
|
+
return this.shadowRoot.querySelector('form[name=deliveryAddressInfo]')
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
get _ownTransportInput() {
|
|
739
|
+
return this.shadowRoot.querySelector('input[name=ownTransport]')
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
get _warehouseTransportInput() {
|
|
743
|
+
return this.shadowRoot.querySelector('input[name=warehouseTransport]')
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
get _remarkInput() {
|
|
747
|
+
return this.shadowRoot.querySelector('textarea[name=remark]')
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
get _exportInput() {
|
|
751
|
+
return this.shadowRoot.querySelector('input[name=exportOption]')
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
get _containerArrivalDateInput() {
|
|
755
|
+
return this.shadowRoot.querySelector('input[name=containerArrivalDate]')
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
get _containerLeavingDateInput() {
|
|
759
|
+
return this.shadowRoot.querySelector('input[name=containerLeavingDate]')
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
get inventoryGrist() {
|
|
763
|
+
return this.shadowRoot.querySelector('data-grist#inventory-grist')
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
get matchDeliveryAddressInput() {
|
|
767
|
+
return this.shadowRoot?.querySelector('input[name=matchDeliveryAddressInput]')
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
get deliveryCountryInput() {
|
|
771
|
+
return this.shadowRoot?.querySelector('select[name=country]')
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
get deliveryPostalCodeSelectInput() {
|
|
775
|
+
return this.shadowRoot?.querySelector('select[name=postalCode]')
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
get deliveryPostalCodeInput() {
|
|
779
|
+
return this.shadowRoot?.querySelector('input[name=postalCode]')
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
get deliveryStateInput() {
|
|
783
|
+
return this.shadowRoot?.querySelector('input[name=state]')
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
get deliveryCityInput() {
|
|
787
|
+
return this.shadowRoot?.querySelector('input[name=city]')
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
get deliveryAddressInput() {
|
|
791
|
+
return this.shadowRoot?.querySelector('textarea[name=deliveryAddress1]')
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
get deliveryContactInput() {
|
|
795
|
+
return this.shadowRoot?.querySelector('input[name=phone1]')
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
get billingCountryInput() {
|
|
799
|
+
return this.shadowRoot?.querySelector('select[name=billingCountry]')
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
get billingPostalCodeSelectInput() {
|
|
803
|
+
return this.shadowRoot?.querySelector('select[name=billingPostalCode]')
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
get billingPostalCodeInput() {
|
|
807
|
+
return this.shadowRoot?.querySelector('input[name=billingPostalCode]')
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
get billingStateInput() {
|
|
811
|
+
return this.shadowRoot?.querySelector('input[name=billingState]')
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
get billingCityInput() {
|
|
815
|
+
return this.shadowRoot?.querySelector('input[name=billingCity]')
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
get billingAddressInput() {
|
|
819
|
+
return this.shadowRoot?.querySelector('textarea[name=billingAddress]')
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
get attentionToInput() {
|
|
823
|
+
return this.shadowRoot?.querySelector('input[name=attentionTo]')
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
async pageUpdated(changes) {
|
|
827
|
+
if (this.active) {
|
|
828
|
+
if (changes.resourceId) {
|
|
829
|
+
this._releaseOrderNo = changes.resourceId
|
|
830
|
+
}
|
|
831
|
+
this._clearPage()
|
|
832
|
+
|
|
833
|
+
if (this._releaseOrderNo) {
|
|
834
|
+
await this._fetchReleaseOrder(this._releaseOrderNo)
|
|
835
|
+
this.updateContext()
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
async pageInitialized() {
|
|
841
|
+
await this._getAllPostCode()
|
|
842
|
+
await this.fetchCountry()
|
|
843
|
+
|
|
844
|
+
this.isUserBelongsDomain = await this._checkUserBelongsDomain()
|
|
845
|
+
let [allowROAddProductSetting, userRoles] = [fetchSettingRule('allow-ro-add-product'), this.fetchUserRoleHandler()]
|
|
846
|
+
let [enableTransportationServiceSetting] = await Promise.all([fetchSettingRule('enable-transportation-service')])
|
|
847
|
+
|
|
848
|
+
this._enableTransportationServiceSetting = enableTransportationServiceSetting
|
|
849
|
+
|
|
850
|
+
this._clearPage()
|
|
851
|
+
|
|
852
|
+
this.inventoryGristConfig = {
|
|
853
|
+
pagination: { infinite: true },
|
|
854
|
+
rows: { selectable: { multiple: true }, appendable: false },
|
|
855
|
+
list: { fields: ['sku', 'productName', 'batchId', 'invStatus', 'packingType', 'releaseQty', 'releaseUomValue'] },
|
|
856
|
+
columns: [
|
|
857
|
+
{ name: 'releaseUomValue', hidden: true },
|
|
858
|
+
{ name: 'remainUomValue', hidden: true },
|
|
859
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
860
|
+
{
|
|
861
|
+
type: 'boolean',
|
|
862
|
+
name: 'invStatus',
|
|
863
|
+
header: i18next.t('field.missing'),
|
|
864
|
+
imex: { header: i18next.t('field.missing'), key: 'invStatus', width: 20, type: 'string' },
|
|
865
|
+
sortable: true,
|
|
866
|
+
width: 100
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
type: 'string',
|
|
870
|
+
name: 'batchId',
|
|
871
|
+
header: i18next.t('field.batch_id'),
|
|
872
|
+
width: 100
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
type: 'string',
|
|
876
|
+
name: 'productSKU',
|
|
877
|
+
header: i18next.t('field.sku'),
|
|
878
|
+
width: 100
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
type: 'string',
|
|
882
|
+
name: 'productName',
|
|
883
|
+
header: i18next.t('field.product'),
|
|
884
|
+
width: 150
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
type: 'string',
|
|
888
|
+
name: 'productBrand',
|
|
889
|
+
header: i18next.t('field.brand'),
|
|
890
|
+
width: 100
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
type: 'string',
|
|
894
|
+
name: 'packingType',
|
|
895
|
+
header: i18next.t('field.packing_type'),
|
|
896
|
+
width: 150
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
type: 'number',
|
|
900
|
+
name: 'packingSize',
|
|
901
|
+
header: i18next.t('field.packing_size'),
|
|
902
|
+
width: 140
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
type: 'integer',
|
|
906
|
+
name: 'releaseQty',
|
|
907
|
+
header: i18next.t('field.release_qty'),
|
|
908
|
+
width: 130
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
type: 'string',
|
|
912
|
+
name: 'releaseUomValueWithUom',
|
|
913
|
+
header: i18next.t('field.release_uom_value'),
|
|
914
|
+
width: 150
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
type: 'string',
|
|
918
|
+
name: 'roundedUomValue',
|
|
919
|
+
header: i18next.t('field.rounded_uom_value'),
|
|
920
|
+
width: 150
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
type: 'string',
|
|
924
|
+
name: 'batchIdRef',
|
|
925
|
+
header: i18next.t('field.batch_no_ref'),
|
|
926
|
+
width: 100
|
|
927
|
+
}
|
|
928
|
+
]
|
|
929
|
+
}
|
|
930
|
+
this._allowROAddProductSetting = await allowROAddProductSetting
|
|
931
|
+
this._userRoles = await userRoles
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
async _fetchReleaseOrder() {
|
|
935
|
+
if (!this._releaseOrderNo) return
|
|
936
|
+
const response = await client.query({
|
|
937
|
+
query: gql`
|
|
938
|
+
query releaseGoodDetail($name: String!) {
|
|
939
|
+
releaseGoodDetail(name: $name) {
|
|
940
|
+
id
|
|
941
|
+
name
|
|
942
|
+
truckNo
|
|
943
|
+
type
|
|
944
|
+
attentionTo
|
|
945
|
+
attentionCompany
|
|
946
|
+
phone1
|
|
947
|
+
deliveryAddress1
|
|
948
|
+
billingAddress
|
|
949
|
+
billingCity
|
|
950
|
+
billingCountry
|
|
951
|
+
billingPostalCode
|
|
952
|
+
billingState
|
|
953
|
+
city
|
|
954
|
+
state
|
|
955
|
+
postalCode
|
|
956
|
+
country
|
|
957
|
+
remark
|
|
958
|
+
source
|
|
959
|
+
bizplace {
|
|
960
|
+
id
|
|
961
|
+
name
|
|
962
|
+
}
|
|
963
|
+
orderMethod
|
|
964
|
+
invStatus
|
|
965
|
+
status
|
|
966
|
+
refNo
|
|
967
|
+
refNo2
|
|
968
|
+
refNo3
|
|
969
|
+
lmdOption
|
|
970
|
+
crossDocking
|
|
971
|
+
arrivalNotice {
|
|
972
|
+
name
|
|
973
|
+
}
|
|
974
|
+
exportOption
|
|
975
|
+
courierOption
|
|
976
|
+
packingOption
|
|
977
|
+
recall
|
|
978
|
+
releaseDate
|
|
979
|
+
collectionOrderNo
|
|
980
|
+
invoiceAttachment {
|
|
981
|
+
id
|
|
982
|
+
name
|
|
983
|
+
refBy
|
|
984
|
+
path
|
|
985
|
+
mimetype
|
|
986
|
+
}
|
|
987
|
+
awbAttachment {
|
|
988
|
+
id
|
|
989
|
+
name
|
|
990
|
+
refBy
|
|
991
|
+
path
|
|
992
|
+
mimetype
|
|
993
|
+
}
|
|
994
|
+
bizplace {
|
|
995
|
+
id
|
|
996
|
+
name
|
|
997
|
+
description
|
|
998
|
+
}
|
|
999
|
+
orderPackages {
|
|
1000
|
+
id
|
|
1001
|
+
name
|
|
1002
|
+
trackingNo
|
|
1003
|
+
manifestedAt
|
|
1004
|
+
}
|
|
1005
|
+
orderProducts {
|
|
1006
|
+
id
|
|
1007
|
+
name
|
|
1008
|
+
batchId
|
|
1009
|
+
batchIdRef
|
|
1010
|
+
packingType
|
|
1011
|
+
packingSize
|
|
1012
|
+
product {
|
|
1013
|
+
id
|
|
1014
|
+
sku
|
|
1015
|
+
brand
|
|
1016
|
+
name
|
|
1017
|
+
description
|
|
1018
|
+
}
|
|
1019
|
+
productDetail {
|
|
1020
|
+
id
|
|
1021
|
+
name
|
|
1022
|
+
}
|
|
1023
|
+
uom
|
|
1024
|
+
releaseQty
|
|
1025
|
+
releaseUomValue
|
|
1026
|
+
status
|
|
1027
|
+
}
|
|
1028
|
+
inventoryInfos {
|
|
1029
|
+
id
|
|
1030
|
+
name
|
|
1031
|
+
batchId
|
|
1032
|
+
batchIdRef
|
|
1033
|
+
palletId
|
|
1034
|
+
product {
|
|
1035
|
+
id
|
|
1036
|
+
sku
|
|
1037
|
+
brand
|
|
1038
|
+
name
|
|
1039
|
+
description
|
|
1040
|
+
}
|
|
1041
|
+
productDetail {
|
|
1042
|
+
id
|
|
1043
|
+
}
|
|
1044
|
+
productName
|
|
1045
|
+
packingType
|
|
1046
|
+
packingSize
|
|
1047
|
+
qty
|
|
1048
|
+
lockedQty
|
|
1049
|
+
lockedUomValue
|
|
1050
|
+
uomValue
|
|
1051
|
+
releaseQty
|
|
1052
|
+
releaseUomValue
|
|
1053
|
+
uom
|
|
1054
|
+
location {
|
|
1055
|
+
id
|
|
1056
|
+
name
|
|
1057
|
+
}
|
|
1058
|
+
status
|
|
1059
|
+
refWorksheetId
|
|
1060
|
+
}
|
|
1061
|
+
shippingOrderInfo {
|
|
1062
|
+
id
|
|
1063
|
+
containerNo
|
|
1064
|
+
containerLeavingDate
|
|
1065
|
+
containerArrivalDate
|
|
1066
|
+
containerClosureDate
|
|
1067
|
+
containerSize
|
|
1068
|
+
remindContainerDeparture
|
|
1069
|
+
shipName
|
|
1070
|
+
remark
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
`,
|
|
1075
|
+
variables: { name: this._releaseOrderNo }
|
|
1076
|
+
})
|
|
1077
|
+
|
|
1078
|
+
if (!response.errors) {
|
|
1079
|
+
const releaseOrder = response.data.releaseGoodDetail
|
|
1080
|
+
const shippingOrder = releaseOrder.shippingOrderInfo
|
|
1081
|
+
const orderPackages = releaseOrder.orderPackages
|
|
1082
|
+
const orderProducts = releaseOrder.orderProducts.map(op => {
|
|
1083
|
+
let roundedUomValue = parseFloat(op.releaseUomValue.toFixed(2))
|
|
1084
|
+
return {
|
|
1085
|
+
...op,
|
|
1086
|
+
productSKU: op?.product?.sku || '',
|
|
1087
|
+
productName: ` ${op?.product?.name} (${op?.product?.description})` || '',
|
|
1088
|
+
productBrand: op?.product?.brand || '',
|
|
1089
|
+
roundedUomValue: `${roundedUomValue} ${op.uom}`,
|
|
1090
|
+
releaseUomValueWithUom: op.releaseUomValue + ' ' + op.uom
|
|
1091
|
+
}
|
|
1092
|
+
})
|
|
1093
|
+
|
|
1094
|
+
this._isLmd = response.data.lmdOption
|
|
1095
|
+
this._roInfo = releaseOrder
|
|
1096
|
+
this.roType = releaseOrder.type
|
|
1097
|
+
this._orderMethod = releaseOrder.orderMethod
|
|
1098
|
+
this._source = releaseOrder.source
|
|
1099
|
+
this._manifestedAt = orderPackages.some(op => op.manifestedAt)
|
|
1100
|
+
this._isInBatchPicking = releaseOrder.inventoryInfos.some(inventoryInfo => inventoryInfo.refWorksheetId)
|
|
1101
|
+
const orderInventories = releaseOrder.inventoryInfos.map(inventoryInfo => {
|
|
1102
|
+
let roundedUomValue = parseFloat(inventoryInfo.releaseUomValue.toFixed(2))
|
|
1103
|
+
return {
|
|
1104
|
+
...inventoryInfo,
|
|
1105
|
+
productSKU: inventoryInfo?.product?.sku || '',
|
|
1106
|
+
productBrand: inventoryInfo?.product?.brand || '',
|
|
1107
|
+
inventory: {
|
|
1108
|
+
id: inventoryInfo.id,
|
|
1109
|
+
name: inventoryInfo.name,
|
|
1110
|
+
palletId: inventoryInfo.palletId,
|
|
1111
|
+
product: inventoryInfo.product,
|
|
1112
|
+
productDetail: inventoryInfo.productDetail,
|
|
1113
|
+
batchId: inventoryInfo.batchId,
|
|
1114
|
+
batchIdRef: inventoryInfo.batchIdRef,
|
|
1115
|
+
location: inventoryInfo.location,
|
|
1116
|
+
packingType: inventoryInfo.packingType,
|
|
1117
|
+
remainQty: inventoryInfo.qty,
|
|
1118
|
+
remainUomValue: inventoryInfo.uomValue,
|
|
1119
|
+
releaseUomValue: inventoryInfo.releaseUomValue,
|
|
1120
|
+
releaseUomValueWithUom: inventoryInfo.releaseUomValue + ' ' + inventoryInfo.uom
|
|
1121
|
+
},
|
|
1122
|
+
qty: inventoryInfo.qty,
|
|
1123
|
+
remainQty: inventoryInfo.qty - inventoryInfo.lockedQty,
|
|
1124
|
+
uomValue: inventoryInfo.uomValue, //total
|
|
1125
|
+
releaseUomValue: inventoryInfo.releaseUomValue,
|
|
1126
|
+
remainUomValue: inventoryInfo.uomValue - inventoryInfo.lockedUomValue,
|
|
1127
|
+
availableUomValueWithUom: `${inventoryInfo.uomValue /*+ inventoryInfo.releaseUomValue*/} ${
|
|
1128
|
+
inventoryInfo.uom
|
|
1129
|
+
}`, //total
|
|
1130
|
+
releaseUomValueWithUom: inventoryInfo.releaseUomValue + ' ' + inventoryInfo.uom,
|
|
1131
|
+
remainUomValueWithUom: `${inventoryInfo.uomValue - inventoryInfo.releaseUomValue} ${inventoryInfo.uom}`,
|
|
1132
|
+
status: inventoryInfo.status,
|
|
1133
|
+
invStatus: inventoryInfo.status == 'MISSING',
|
|
1134
|
+
existing: true,
|
|
1135
|
+
roundedUomValue: `${roundedUomValue} ${inventoryInfo.uom}`,
|
|
1136
|
+
addableQty: inventoryInfo.qty - inventoryInfo.lockedQty,
|
|
1137
|
+
addableUomValue: inventoryInfo.uomValue - inventoryInfo.lockedUomValue
|
|
1138
|
+
}
|
|
1139
|
+
})
|
|
1140
|
+
|
|
1141
|
+
this._releaseOrder = {
|
|
1142
|
+
...releaseOrder
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
this._releaseOrderId = releaseOrder.id
|
|
1146
|
+
this.partnerBizplaceId = releaseOrder.bizplace.id
|
|
1147
|
+
this._exportOption = releaseOrder.exportOption
|
|
1148
|
+
this._recallOption = releaseOrder.recall
|
|
1149
|
+
|
|
1150
|
+
this._beforeRemark = releaseOrder?.remark
|
|
1151
|
+
this._courierOption = releaseOrder.courierOption
|
|
1152
|
+
this._packingOption = releaseOrder.packingOption
|
|
1153
|
+
this._crossDocking = releaseOrder?.crossDocking
|
|
1154
|
+
|
|
1155
|
+
if (
|
|
1156
|
+
releaseOrder?.postalCode === releaseOrder?.billingPostalCode &&
|
|
1157
|
+
releaseOrder?.billingAddress === releaseOrder.deliveryAddress1
|
|
1158
|
+
) {
|
|
1159
|
+
this._disableBillingAddress = true
|
|
1160
|
+
} else {
|
|
1161
|
+
this._disableBillingAddress = false
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
await this.updateComplete
|
|
1165
|
+
|
|
1166
|
+
this._ganNo = releaseOrder?.arrivalNotice?.name
|
|
1167
|
+
this._status = releaseOrder.status
|
|
1168
|
+
|
|
1169
|
+
this._fillupRGForm({
|
|
1170
|
+
...releaseOrder,
|
|
1171
|
+
bizplaceName: releaseOrder.bizplace?.name,
|
|
1172
|
+
trackingNo: orderPackages.length > 0 ? orderPackages.map(op => op.trackingNo).join(', ') : ''
|
|
1173
|
+
})
|
|
1174
|
+
|
|
1175
|
+
this._fillupDAForm(releaseOrder)
|
|
1176
|
+
|
|
1177
|
+
if (this._exportOption) {
|
|
1178
|
+
this._ownTransport = true
|
|
1179
|
+
this._ownTransportInput.checked = true
|
|
1180
|
+
} else if (!this._exportOption) {
|
|
1181
|
+
this._ownTransport = releaseOrder.ownTransport
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
if (releaseOrder && releaseOrder?.invoiceAttachment) {
|
|
1185
|
+
this._invoiceAttachments = [releaseOrder && releaseOrder.invoiceAttachment]
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
if (releaseOrder && releaseOrder?.awbAttachment) {
|
|
1189
|
+
this._awbAttachments = [releaseOrder && releaseOrder.awbAttachment]
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
const nonEditableStatus = ['DONE', 'PACKING']
|
|
1193
|
+
|
|
1194
|
+
if (!nonEditableStatus.includes(releaseOrder.status) && this.isUserBelongsDomain) {
|
|
1195
|
+
this._editable = true
|
|
1196
|
+
} else {
|
|
1197
|
+
this._editable = false
|
|
1198
|
+
}
|
|
1199
|
+
this.inventoryData = {
|
|
1200
|
+
records: this._orderMethod == PICKING_STANDARD.SELECT_BY_PRODUCT.value ? orderProducts : orderInventories
|
|
1201
|
+
}
|
|
1202
|
+
this.orderInventoryData = {
|
|
1203
|
+
records: orderInventories
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
async _rejectReleaseOrder() {
|
|
1209
|
+
const popup = openPopup(
|
|
1210
|
+
html`
|
|
1211
|
+
<popup-note
|
|
1212
|
+
.title="${i18next.t('title.remark')}"
|
|
1213
|
+
@submit="${async e => {
|
|
1214
|
+
try {
|
|
1215
|
+
if (!e.detail.value) throw new Error(i18next.t('text.remark_is_empty'))
|
|
1216
|
+
const result = await CustomAlert({
|
|
1217
|
+
title: i18next.t('title.are_you_sure'),
|
|
1218
|
+
text: i18next.t('text.reject_release_order'),
|
|
1219
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1220
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1221
|
+
})
|
|
1222
|
+
|
|
1223
|
+
if (!result.value) {
|
|
1224
|
+
return
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
if (this._crossDocking) {
|
|
1228
|
+
const result = await CustomAlert({
|
|
1229
|
+
title: i18next.t('title.cross_docking'),
|
|
1230
|
+
text: i18next.t('text.related_order_will_be_rejected'),
|
|
1231
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1232
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1233
|
+
})
|
|
1234
|
+
|
|
1235
|
+
if (!result.value) return
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
const response = await client.mutate({
|
|
1239
|
+
mutation: gql`
|
|
1240
|
+
mutation rejectReleaseGood($name: String!, $patch: ReleaseGoodPatch!) {
|
|
1241
|
+
rejectReleaseGood(name: $name, patch: $patch) {
|
|
1242
|
+
name
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
`,
|
|
1246
|
+
variables: { name: this._releaseOrderNo, patch: { remark: e.detail.value } }
|
|
1247
|
+
})
|
|
1248
|
+
|
|
1249
|
+
if (!response.errors) {
|
|
1250
|
+
navigate(`b2c_order_requests`)
|
|
1251
|
+
this._showToast({ message: i18next.t('text.release_order_rejected') })
|
|
1252
|
+
}
|
|
1253
|
+
} catch (e) {
|
|
1254
|
+
this._showToast(e)
|
|
1255
|
+
}
|
|
1256
|
+
}}"
|
|
1257
|
+
></popup-note>
|
|
1258
|
+
`,
|
|
1259
|
+
{
|
|
1260
|
+
backdrop: true,
|
|
1261
|
+
size: 'medium',
|
|
1262
|
+
title: i18next.t('title.reject_release_order')
|
|
1263
|
+
}
|
|
1264
|
+
)
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
async _receiveReleaseOrder() {
|
|
1268
|
+
try {
|
|
1269
|
+
const result = await CustomAlert({
|
|
1270
|
+
title: i18next.t('title.are_you_sure'),
|
|
1271
|
+
text: i18next.t('text.accept_release_order'),
|
|
1272
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1273
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1274
|
+
})
|
|
1275
|
+
|
|
1276
|
+
if (!result.value) {
|
|
1277
|
+
return
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
const response = await client.mutate({
|
|
1281
|
+
mutation: gql`
|
|
1282
|
+
mutation receiveReleaseGood($name: String!) {
|
|
1283
|
+
receiveReleaseGood(name: $name) {
|
|
1284
|
+
name
|
|
1285
|
+
status
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
`,
|
|
1289
|
+
variables: { name: this._releaseOrderNo }
|
|
1290
|
+
})
|
|
1291
|
+
|
|
1292
|
+
if (!response.errors) {
|
|
1293
|
+
this._status = response.data.receiveReleaseGood.status
|
|
1294
|
+
this.updateContext()
|
|
1295
|
+
this._showToast({ message: i18next.t('text.release_order_received') })
|
|
1296
|
+
}
|
|
1297
|
+
} catch (e) {
|
|
1298
|
+
this._showToast(e)
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
async _confirmCancellationReleaseOrder() {
|
|
1303
|
+
try {
|
|
1304
|
+
const result = await CustomAlert({
|
|
1305
|
+
title: i18next.t('title.are_you_sure'),
|
|
1306
|
+
text: i18next.t('text.you_wont_be_able_to_revert_this'),
|
|
1307
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1308
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1309
|
+
})
|
|
1310
|
+
|
|
1311
|
+
if (!result.value) return
|
|
1312
|
+
|
|
1313
|
+
const response = await client.mutate({
|
|
1314
|
+
mutation: gql`
|
|
1315
|
+
mutation confirmCancellationReleaseOrder($name: String!) {
|
|
1316
|
+
confirmCancellationReleaseOrder(name: $name)
|
|
1317
|
+
}
|
|
1318
|
+
`,
|
|
1319
|
+
variables: { name: this._releaseOrderNo }
|
|
1320
|
+
})
|
|
1321
|
+
|
|
1322
|
+
if (!response.errors) {
|
|
1323
|
+
this._showToast({ message: i18next.t('text.release_order_has_been_cancelled') })
|
|
1324
|
+
navigate(`b2c_order_requests`)
|
|
1325
|
+
}
|
|
1326
|
+
} catch (e) {
|
|
1327
|
+
throw e
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
async _rejectCancellationReleaseOrder() {
|
|
1332
|
+
try {
|
|
1333
|
+
const result = await CustomAlert({
|
|
1334
|
+
title: i18next.t('title.are_you_sure'),
|
|
1335
|
+
text: i18next.t('text.you_wont_be_able_to_revert_this'),
|
|
1336
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1337
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1338
|
+
})
|
|
1339
|
+
|
|
1340
|
+
if (!result.value) return
|
|
1341
|
+
|
|
1342
|
+
const response = await client.mutate({
|
|
1343
|
+
mutation: gql`
|
|
1344
|
+
mutation rejectCancellationReleaseOrder($name: String!) {
|
|
1345
|
+
rejectCancellationReleaseOrder(name: $name)
|
|
1346
|
+
}
|
|
1347
|
+
`,
|
|
1348
|
+
variables: { name: this._releaseOrderNo }
|
|
1349
|
+
})
|
|
1350
|
+
|
|
1351
|
+
if (!response.errors) {
|
|
1352
|
+
this._showToast({ message: i18next.t('text.cancellation_request_has_been_rejected') })
|
|
1353
|
+
navigate(`b2c_order_requests`)
|
|
1354
|
+
}
|
|
1355
|
+
} catch (e) {
|
|
1356
|
+
throw e
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
async _generateSinglePickingWorksheet() {
|
|
1361
|
+
try {
|
|
1362
|
+
const response = await client.mutate({
|
|
1363
|
+
mutation: gql`
|
|
1364
|
+
mutation generateReleaseGoodWorksheet($releaseGoodNo: String!, $currentStatus: String) {
|
|
1365
|
+
generateReleaseGoodWorksheet(releaseGoodNo: $releaseGoodNo, currentStatus: $currentStatus) {
|
|
1366
|
+
pickingWorksheet {
|
|
1367
|
+
name
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
`,
|
|
1372
|
+
variables: { releaseGoodNo: this._releaseOrderNo, currentStatus: this._status }
|
|
1373
|
+
})
|
|
1374
|
+
|
|
1375
|
+
if (!response.errors) {
|
|
1376
|
+
navigate('single_outbound_worksheets')
|
|
1377
|
+
this._showToast({ message: i18next.t('text.worksheet_has_been_generated') })
|
|
1378
|
+
}
|
|
1379
|
+
} catch (e) {
|
|
1380
|
+
this._showToast(e)
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
get _isDownloadable() {
|
|
1385
|
+
return this._status !== ORDER_STATUS.PENDING.value
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
_fillupRGForm(data) {
|
|
1389
|
+
this._fillupForm(this.releaseOrderForm, data)
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
_fillupDAForm(data) {
|
|
1393
|
+
this._fillupForm(this.shippingInfoForm, data)
|
|
1394
|
+
this._selectedCountry = data.country
|
|
1395
|
+
this._selectedBillingCountry = data.billingCountry || data.country
|
|
1396
|
+
this._releaseOrder.billingPostalCode = data.billingPostalCode
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
_fillupForm(form, data) {
|
|
1400
|
+
if (form) {
|
|
1401
|
+
form.reset()
|
|
1402
|
+
for (let key in data) {
|
|
1403
|
+
Array.from(form.querySelectorAll('input, textarea')).forEach(field => {
|
|
1404
|
+
if (field.name === key && field.type === 'checkbox') {
|
|
1405
|
+
field.checked = data[key]
|
|
1406
|
+
} else if (field.name === key && field.type === 'datetime-local') {
|
|
1407
|
+
const datetime = Number(data[key])
|
|
1408
|
+
const timezoneOffset = new Date(datetime).getTimezoneOffset() * 60000
|
|
1409
|
+
field.value = new Date(datetime - timezoneOffset).toISOString().slice(0, -1)
|
|
1410
|
+
} else if (field.name === key) {
|
|
1411
|
+
if (data[key] instanceof Object) {
|
|
1412
|
+
const objectData = data[key]
|
|
1413
|
+
field.value = `${objectData.name} ${objectData.description ? `(${objectData.description})` : ''}`
|
|
1414
|
+
} else {
|
|
1415
|
+
field.value = data[key]
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
})
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
_clearPage() {
|
|
1424
|
+
this._showReleasedOrderInfo = false
|
|
1425
|
+
this._showShippingInfo = true
|
|
1426
|
+
this._source = ''
|
|
1427
|
+
this._manifestedAt = false
|
|
1428
|
+
this._releaseOrder = {}
|
|
1429
|
+
this._status = null
|
|
1430
|
+
this.roType = ''
|
|
1431
|
+
this._orderMethod = PICKING_STANDARD.SELECT_BY_PRODUCT.value
|
|
1432
|
+
this._isInBatchPicking = false
|
|
1433
|
+
this._exportOption = false
|
|
1434
|
+
this._courierOption = false
|
|
1435
|
+
this._packingOption = false
|
|
1436
|
+
this._ownTransport = true
|
|
1437
|
+
this._downloadable = true
|
|
1438
|
+
this._beforeRemark = null
|
|
1439
|
+
this._attachments = []
|
|
1440
|
+
this._invoiceAttachments = []
|
|
1441
|
+
this._awbAttachments = []
|
|
1442
|
+
|
|
1443
|
+
this.inventoryData = { records: [] }
|
|
1444
|
+
this.orderInventoryData = { records: [] }
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
async _deleteReleaseOrder() {
|
|
1448
|
+
try {
|
|
1449
|
+
let result = await CustomAlert({
|
|
1450
|
+
title: i18next.t('title.are_you_sure'),
|
|
1451
|
+
text: i18next.t('text.you_wont_be_able_to_revert_this'),
|
|
1452
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1453
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1454
|
+
})
|
|
1455
|
+
|
|
1456
|
+
if (!result.value) return
|
|
1457
|
+
|
|
1458
|
+
if (this._crossDocking) {
|
|
1459
|
+
result = await CustomAlert({
|
|
1460
|
+
title: i18next.t('label.cross_docking'),
|
|
1461
|
+
text: i18next.t('text.related_arrival_notice_will_be_deleted'),
|
|
1462
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1463
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1464
|
+
})
|
|
1465
|
+
|
|
1466
|
+
if (!result.value) return
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
const response = await client.mutate({
|
|
1470
|
+
mutation: gql`
|
|
1471
|
+
mutation deleteReleaseGood($name: String!) {
|
|
1472
|
+
deleteReleaseGood(name: $name)
|
|
1473
|
+
}
|
|
1474
|
+
`,
|
|
1475
|
+
variables: { name: this._releaseOrderNo }
|
|
1476
|
+
})
|
|
1477
|
+
|
|
1478
|
+
if (!response.errors) {
|
|
1479
|
+
this._showToast({ message: i18next.t('text.release_order_has_been_deleted') })
|
|
1480
|
+
navigate(`b2c_order_requests`)
|
|
1481
|
+
}
|
|
1482
|
+
} catch (e) {
|
|
1483
|
+
this._showToast(e)
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
async _submitCancellationReleaseOrder() {
|
|
1488
|
+
try {
|
|
1489
|
+
const result = await CustomAlert({
|
|
1490
|
+
title: i18next.t('title.are_you_sure'),
|
|
1491
|
+
text: i18next.t('text.you_wont_be_able_to_revert_this'),
|
|
1492
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1493
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1494
|
+
})
|
|
1495
|
+
|
|
1496
|
+
if (!result.value) return
|
|
1497
|
+
|
|
1498
|
+
const response = await client.mutate({
|
|
1499
|
+
mutation: gql`
|
|
1500
|
+
mutation pendingCancellationReleaseOrder($name: String!) {
|
|
1501
|
+
pendingCancellationReleaseOrder(name: $name)
|
|
1502
|
+
}
|
|
1503
|
+
`,
|
|
1504
|
+
variables: { name: this._releaseOrderNo }
|
|
1505
|
+
})
|
|
1506
|
+
|
|
1507
|
+
if (!response.errors) {
|
|
1508
|
+
this._showToast({ message: i18next.t('text.release_order_is_submitted_for_cancellation') })
|
|
1509
|
+
navigate(`b2c_order_requests`)
|
|
1510
|
+
}
|
|
1511
|
+
} catch (e) {
|
|
1512
|
+
throw e
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
async _confirmReleaseOrder() {
|
|
1517
|
+
let result = await CustomAlert({
|
|
1518
|
+
title: i18next.t('title.are_you_sure'),
|
|
1519
|
+
text: i18next.t('text.confirm_release_good'),
|
|
1520
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1521
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1522
|
+
})
|
|
1523
|
+
|
|
1524
|
+
if (!result.value) return
|
|
1525
|
+
|
|
1526
|
+
if (this._crossDocking) {
|
|
1527
|
+
result = await CustomAlert({
|
|
1528
|
+
title: i18next.t('title.are_you_sure'),
|
|
1529
|
+
text: i18next.t('text.arrival_notice_will_be_confirmed'),
|
|
1530
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
1531
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1532
|
+
})
|
|
1533
|
+
|
|
1534
|
+
if (!result.value) return
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
try {
|
|
1538
|
+
const response = await client.mutate({
|
|
1539
|
+
mutation: gql`
|
|
1540
|
+
mutation confirmReleaseGood($name: String!) {
|
|
1541
|
+
confirmReleaseGood(name: $name) {
|
|
1542
|
+
name
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
`,
|
|
1546
|
+
variables: { name: this._releaseOrderNo }
|
|
1547
|
+
})
|
|
1548
|
+
|
|
1549
|
+
if (!response.errors) {
|
|
1550
|
+
this._showToast({ message: i18next.t('text.release_order_confirmed') })
|
|
1551
|
+
navigate(`b2c_order_requests`)
|
|
1552
|
+
}
|
|
1553
|
+
} catch (e) {
|
|
1554
|
+
this._showToast(e)
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
async _checkUserBelongsDomain() {
|
|
1559
|
+
try {
|
|
1560
|
+
const response = await client.query({
|
|
1561
|
+
query: gql`
|
|
1562
|
+
query checkUserBelongsDomain {
|
|
1563
|
+
checkUserBelongsDomain
|
|
1564
|
+
}
|
|
1565
|
+
`
|
|
1566
|
+
})
|
|
1567
|
+
|
|
1568
|
+
if (!response.errors) {
|
|
1569
|
+
return response.data.checkUserBelongsDomain
|
|
1570
|
+
}
|
|
1571
|
+
} catch (e) {
|
|
1572
|
+
this._showToast(e)
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
_openExtraProductPopup() {
|
|
1577
|
+
openPopup(
|
|
1578
|
+
html`
|
|
1579
|
+
<release-extra-product-popup
|
|
1580
|
+
.releaseGoodNo="${this._releaseOrderNo}"
|
|
1581
|
+
.bizplace="${this.partnerBizplaceId}"
|
|
1582
|
+
.existingInventoryData="${this.orderInventoryData}"
|
|
1583
|
+
.recall="${this._recallOption}"
|
|
1584
|
+
@completed="${e => {
|
|
1585
|
+
this._fetchReleaseOrder(this._releaseOrderNo)
|
|
1586
|
+
this.updateContext()
|
|
1587
|
+
}}"
|
|
1588
|
+
></release-extra-product-popup>
|
|
1589
|
+
`,
|
|
1590
|
+
{
|
|
1591
|
+
backdrop: true,
|
|
1592
|
+
size: 'large',
|
|
1593
|
+
title: i18next.t('title.extra_product')
|
|
1594
|
+
}
|
|
1595
|
+
)
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
_showToast({ type, message }) {
|
|
1599
|
+
document.dispatchEvent(
|
|
1600
|
+
new CustomEvent('notify', {
|
|
1601
|
+
detail: {
|
|
1602
|
+
type,
|
|
1603
|
+
message
|
|
1604
|
+
}
|
|
1605
|
+
})
|
|
1606
|
+
)
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
async fetchUserRoleHandler() {
|
|
1610
|
+
const response = await client.query({
|
|
1611
|
+
query: gql`
|
|
1612
|
+
query myRoles {
|
|
1613
|
+
myRoles {
|
|
1614
|
+
id
|
|
1615
|
+
name
|
|
1616
|
+
description
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
`
|
|
1620
|
+
})
|
|
1621
|
+
|
|
1622
|
+
if (!response.errors?.length) {
|
|
1623
|
+
return response.data.myRoles
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
return []
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
async _updateReleaseGoodDetails() {
|
|
1630
|
+
try {
|
|
1631
|
+
this._validateForm()
|
|
1632
|
+
|
|
1633
|
+
let releaseOrder = this._getFormInfo()
|
|
1634
|
+
|
|
1635
|
+
delete releaseOrder.warehouseTransport
|
|
1636
|
+
delete releaseOrder.bizplaceId
|
|
1637
|
+
delete releaseOrder.bizplaceName
|
|
1638
|
+
delete releaseOrder.status
|
|
1639
|
+
delete releaseOrder.ganNo
|
|
1640
|
+
delete releaseOrder.recall
|
|
1641
|
+
delete releaseOrder.lmdOption
|
|
1642
|
+
let oldResorder = this._releaseOrder
|
|
1643
|
+
|
|
1644
|
+
let formChanged
|
|
1645
|
+
for (const key in releaseOrder) {
|
|
1646
|
+
if (oldResorder.orderPackages.length > 0) {
|
|
1647
|
+
if (key == 'trackingNo' && releaseOrder[key] !== oldResorder.orderPackages[0].trackingNo) {
|
|
1648
|
+
if (
|
|
1649
|
+
!(
|
|
1650
|
+
(releaseOrder[key] == '' || releaseOrder[key] == null) &&
|
|
1651
|
+
(oldResorder.orderPackages[0].trackingNo == '' || oldResorder.orderPackages[0].trackingNo == null)
|
|
1652
|
+
)
|
|
1653
|
+
) {
|
|
1654
|
+
if (this._roInfo?.orderPackages.length === 1) {
|
|
1655
|
+
formChanged = true
|
|
1656
|
+
break
|
|
1657
|
+
} else {
|
|
1658
|
+
throw new Error(i18next.t('text.does_not_support_multi_package'))
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
} else if (releaseOrder.hasOwnProperty(key) && releaseOrder[key] !== oldResorder[key]) {
|
|
1663
|
+
if (
|
|
1664
|
+
!(
|
|
1665
|
+
(releaseOrder[key] == '' || releaseOrder[key] == null) &&
|
|
1666
|
+
(oldResorder[key] == '' || oldResorder[key] == null)
|
|
1667
|
+
)
|
|
1668
|
+
) {
|
|
1669
|
+
formChanged = true
|
|
1670
|
+
break
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
if (!formChanged) {
|
|
1676
|
+
throw new Error(i18next.t('text.there_is_nothing_changed'))
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
let shippingOrderInfo = {}
|
|
1680
|
+
|
|
1681
|
+
let contactPointInfo = this._serializeForm(this.shippingInfoForm)
|
|
1682
|
+
|
|
1683
|
+
shippingOrderInfo = {
|
|
1684
|
+
...contactPointInfo
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
delete shippingOrderInfo['']
|
|
1688
|
+
delete shippingOrderInfo.matchDeliveryAddressInput
|
|
1689
|
+
|
|
1690
|
+
// If match delivery address is ticked, all the billing address info will be the same with delivery address info
|
|
1691
|
+
if (this._disableBillingAddress) {
|
|
1692
|
+
shippingOrderInfo.billingAddress = contactPointInfo.deliveryAddress1
|
|
1693
|
+
shippingOrderInfo.billingPostalCode = contactPointInfo.postalCode
|
|
1694
|
+
shippingOrderInfo.billingCity = contactPointInfo.city
|
|
1695
|
+
shippingOrderInfo.billingState = contactPointInfo.state
|
|
1696
|
+
shippingOrderInfo.billingCountry = contactPointInfo.country
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
let afterRemarkValue
|
|
1700
|
+
if (releaseOrder?.remark) {
|
|
1701
|
+
afterRemarkValue = releaseOrder.remark = releaseOrder.remark.trimStart()
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
if (this.roType === 'b2c') {
|
|
1705
|
+
if (this._beforeRemark != null && this._beforeRemark !== afterRemarkValue) {
|
|
1706
|
+
if (!afterRemarkValue) {
|
|
1707
|
+
const remarkResult = await CustomAlert({
|
|
1708
|
+
title: i18next.t('title.removing_order_remark'),
|
|
1709
|
+
text: i18next.t('text.do_you_want_to_proceed'),
|
|
1710
|
+
confirmButton: { text: i18next.t('button.proceed') },
|
|
1711
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1712
|
+
})
|
|
1713
|
+
|
|
1714
|
+
if (!remarkResult.value) return
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
const result = await CustomAlert({
|
|
1720
|
+
title: i18next.t('title.are_you_sure'),
|
|
1721
|
+
text: i18next.t('text.update_release_order_details'),
|
|
1722
|
+
confirmButton: { text: i18next.t('button.submit') },
|
|
1723
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
1724
|
+
})
|
|
1725
|
+
|
|
1726
|
+
if (!result.value) return
|
|
1727
|
+
|
|
1728
|
+
const response = await client.mutate({
|
|
1729
|
+
mutation: gql`
|
|
1730
|
+
mutation updateReleaseGoodDetails(
|
|
1731
|
+
$releaseOrder: ReleaseGoodPatch!
|
|
1732
|
+
$shippingOrder: ShippingOrderPatch
|
|
1733
|
+
$shippingOrderInfo: ShippingOrderInfoPatch
|
|
1734
|
+
) {
|
|
1735
|
+
updateReleaseGoodDetails(
|
|
1736
|
+
releaseGood: $releaseOrder
|
|
1737
|
+
shippingOrder: $shippingOrder
|
|
1738
|
+
shippingOrderInfo: $shippingOrderInfo
|
|
1739
|
+
) {
|
|
1740
|
+
id
|
|
1741
|
+
name
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
`,
|
|
1745
|
+
variables: {
|
|
1746
|
+
releaseOrder: {
|
|
1747
|
+
...releaseOrder,
|
|
1748
|
+
id: this._releaseOrderId,
|
|
1749
|
+
name: this._releaseOrderNo,
|
|
1750
|
+
ownTransport: this._importCargo ? true : this._ownTransport
|
|
1751
|
+
},
|
|
1752
|
+
shippingOrder: this._exportOption ? this._serializeForm(this.exportInfoForm) : null,
|
|
1753
|
+
shippingOrderInfo: shippingOrderInfo ? shippingOrderInfo : null
|
|
1754
|
+
}
|
|
1755
|
+
})
|
|
1756
|
+
|
|
1757
|
+
if (!response.errors) {
|
|
1758
|
+
this._showToast({ message: i18next.t('text.release_order_details_updated') })
|
|
1759
|
+
await this._fetchReleaseOrder()
|
|
1760
|
+
}
|
|
1761
|
+
} catch (e) {
|
|
1762
|
+
this._showToast(e)
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
_openContactPointSelector() {
|
|
1767
|
+
openPopup(
|
|
1768
|
+
html`
|
|
1769
|
+
<contact-points-popup
|
|
1770
|
+
@selected="${e => {
|
|
1771
|
+
this._fillUpDeliveryInfo(e.detail)
|
|
1772
|
+
}}"
|
|
1773
|
+
></contact-points-popup>
|
|
1774
|
+
`,
|
|
1775
|
+
{
|
|
1776
|
+
backdrop: true,
|
|
1777
|
+
size: 'large',
|
|
1778
|
+
title: i18next.t('title.select_destination')
|
|
1779
|
+
}
|
|
1780
|
+
)
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
matchDeliveryAddress() {
|
|
1784
|
+
this._billingFullAddress = ''
|
|
1785
|
+
this._billingState = ''
|
|
1786
|
+
this._billingCity = ''
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
async _getAllPostCode() {
|
|
1790
|
+
try {
|
|
1791
|
+
const response = await client.query({
|
|
1792
|
+
query: gql`
|
|
1793
|
+
query geoAreasAllPostCode {
|
|
1794
|
+
geoAreasAllPostCode {
|
|
1795
|
+
items {
|
|
1796
|
+
postalCode
|
|
1797
|
+
}
|
|
1798
|
+
total
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
`
|
|
1802
|
+
})
|
|
1803
|
+
|
|
1804
|
+
if (!response.errors) {
|
|
1805
|
+
const items = response.data.geoAreasAllPostCode.items
|
|
1806
|
+
this._deliveryPostCode = items
|
|
1807
|
+
this._billingPostCode = items
|
|
1808
|
+
|
|
1809
|
+
return true
|
|
1810
|
+
}
|
|
1811
|
+
} catch (e) {
|
|
1812
|
+
this._showToast(e)
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
async _getStateAndCityByPostCode(value, name) {
|
|
1817
|
+
const postCode = value
|
|
1818
|
+
|
|
1819
|
+
// If user select the first empty postal code, the city and state will change to empty
|
|
1820
|
+
if (postCode == '') {
|
|
1821
|
+
if (name == 'postalCode') {
|
|
1822
|
+
this._cityInput.value = ''
|
|
1823
|
+
this._stateInput.value = ''
|
|
1824
|
+
if (this.matchDeliveryAddressInput.value === 'on') {
|
|
1825
|
+
this._cityBillingInput.value = ''
|
|
1826
|
+
this._stateBillingInput.value = ''
|
|
1827
|
+
this._billingPostCode.value = ''
|
|
1828
|
+
}
|
|
1829
|
+
return
|
|
1830
|
+
} else if (name == 'billingPostalCode') {
|
|
1831
|
+
this._cityBillingInput.value = ''
|
|
1832
|
+
this._stateBillingInput.value = ''
|
|
1833
|
+
return
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
try {
|
|
1838
|
+
const response = await client.query({
|
|
1839
|
+
query: gql`
|
|
1840
|
+
query geoAreasGetStateAndCityByPosCode($postCode: String!) {
|
|
1841
|
+
geoAreasGetStateAndCityByPosCode(postCode: $postCode) {
|
|
1842
|
+
stateName
|
|
1843
|
+
cityName
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
`,
|
|
1847
|
+
variables: {
|
|
1848
|
+
postCode
|
|
1849
|
+
}
|
|
1850
|
+
})
|
|
1851
|
+
|
|
1852
|
+
if (!response.errors) {
|
|
1853
|
+
const { stateName, cityName } = response.data.geoAreasGetStateAndCityByPosCode
|
|
1854
|
+
|
|
1855
|
+
switch (name) {
|
|
1856
|
+
case 'postalCode':
|
|
1857
|
+
this._cityInput.value = stateName
|
|
1858
|
+
this._stateInput.value = cityName.toUpperCase()
|
|
1859
|
+
if (this.matchDeliveryAddressInput.value === 'on') {
|
|
1860
|
+
this._cityBillingInput.value = stateName
|
|
1861
|
+
this._stateBillingInput.value = cityName.toUpperCase()
|
|
1862
|
+
this._billingPostCode.value = postcode
|
|
1863
|
+
}
|
|
1864
|
+
this._releaseOrder = { ...this._releaseOrder, city: cityName.toUpperCase(), state: stateName }
|
|
1865
|
+
break
|
|
1866
|
+
|
|
1867
|
+
case 'billingPostalCode':
|
|
1868
|
+
this._releaseOrder = { ...this._releaseOrder, billingCity: cityName.toUpperCase(), billingState: stateName }
|
|
1869
|
+
|
|
1870
|
+
default:
|
|
1871
|
+
break
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
} catch (error) {
|
|
1875
|
+
this._showToast(e)
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
async fetchCountry() {
|
|
1880
|
+
const response = await client.query({
|
|
1881
|
+
query: gql`
|
|
1882
|
+
query geoCountriesWithoutParam {
|
|
1883
|
+
geoCountriesWithoutParam {
|
|
1884
|
+
items {
|
|
1885
|
+
id
|
|
1886
|
+
name
|
|
1887
|
+
description
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
`
|
|
1892
|
+
})
|
|
1893
|
+
|
|
1894
|
+
if (!response.error) {
|
|
1895
|
+
this._billingAllCountry = response.data.geoCountriesWithoutParam.items
|
|
1896
|
+
this._deliveryAllCountry = response.data.geoCountriesWithoutParam.items
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
_getFormInfo() {
|
|
1901
|
+
let formData = this._serializeForm(this.releaseOrderForm)
|
|
1902
|
+
delete formData.importedOrder
|
|
1903
|
+
delete formData.vas
|
|
1904
|
+
|
|
1905
|
+
return formData
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
_serializeForm(form) {
|
|
1909
|
+
let obj = {}
|
|
1910
|
+
Array.from(form.querySelectorAll('input, select, textarea')).forEach(field => {
|
|
1911
|
+
if (!field.hasAttribute('hidden')) {
|
|
1912
|
+
obj[field.name] = field.type === 'checkbox' ? field.checked : field.value
|
|
1913
|
+
}
|
|
1914
|
+
})
|
|
1915
|
+
|
|
1916
|
+
return obj
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
_validateForm() {
|
|
1920
|
+
if (!this.releaseOrderForm.checkValidity()) {
|
|
1921
|
+
throw new Error(i18next.t('text.release_order_form_invalid'))
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
if (this._isLmd) {
|
|
1925
|
+
const checkShipmentFields = (
|
|
1926
|
+
attentionToInput,
|
|
1927
|
+
postalCodeInput,
|
|
1928
|
+
stateInput,
|
|
1929
|
+
cityInput,
|
|
1930
|
+
addressInput,
|
|
1931
|
+
contactInput
|
|
1932
|
+
) => {
|
|
1933
|
+
if (
|
|
1934
|
+
!attentionToInput.value &&
|
|
1935
|
+
!postalCodeInput.value &&
|
|
1936
|
+
!stateInput.value &&
|
|
1937
|
+
!cityInput.value &&
|
|
1938
|
+
!addressInput.value &&
|
|
1939
|
+
!contactInput.value
|
|
1940
|
+
) {
|
|
1941
|
+
throw new Error(i18next.t('text.please_fill_in_the_shipping_information_in_shipment_tab'))
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
if (!attentionToInput.value) {
|
|
1945
|
+
throw new Error(i18next.t('text.attention_to_is_empty_please_fill_in_the_data_before_proceed_create_order'))
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
if (!postalCodeInput.value) {
|
|
1949
|
+
throw new Error(
|
|
1950
|
+
i18next.t('text.zip/postal_code_is_empty_please_fill_in_the_data_before_proceed_create_order')
|
|
1951
|
+
)
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
if (!stateInput.value) {
|
|
1955
|
+
throw new Error(i18next.t('text.state_is_empty_please_fill_in_the_data_before_proceed_create_order'))
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
if (!cityInput.value) {
|
|
1959
|
+
throw new Error(i18next.t('text.city_is_empty_please_fill_in_the_data_before_proceed_create_order'))
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
if (!addressInput.value) {
|
|
1963
|
+
throw new Error(
|
|
1964
|
+
i18next.t('text.delivery_address_is_empty_please_fill_in_the_data_before_proceed_create_order')
|
|
1965
|
+
)
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
if (!contactInput.value) {
|
|
1969
|
+
throw new Error(i18next.t('text.contact_is_empty_please_fill_in_the_data_before_proceed_create_order'))
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
if (this.deliveryCountryInput.value == 'MY') {
|
|
1974
|
+
checkShipmentFields(
|
|
1975
|
+
this.deliveryPostalCodeSelectInput,
|
|
1976
|
+
this.deliveryStateInput,
|
|
1977
|
+
this.deliveryCityInput,
|
|
1978
|
+
this.deliveryAddressInput,
|
|
1979
|
+
this.deliveryContactInput
|
|
1980
|
+
)
|
|
1981
|
+
} else {
|
|
1982
|
+
checkShipmentFields(
|
|
1983
|
+
this.deliveryPostalCodeInput,
|
|
1984
|
+
this.deliveryStateInput,
|
|
1985
|
+
this.deliveryCityInput,
|
|
1986
|
+
this.deliveryAddressInput,
|
|
1987
|
+
this.deliveryContactInput
|
|
1988
|
+
)
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
if (!this.billingAddressInput.value && !this.matchDeliveryAddressInput.checked) {
|
|
1992
|
+
throw new Error(i18next.t('text.billing_address_is_empty_please_fill_in_the_data_before_proceed_create_order'))
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
// - condition: export is ticked
|
|
1997
|
+
if (this.shippingOrderForm) {
|
|
1998
|
+
if (!this.shippingOrderForm.checkValidity()) {
|
|
1999
|
+
throw new Error(i18next.t('text.shipping_order_form_invalid'))
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
validateDate(e) {
|
|
2005
|
+
let inputDate = e.currentTarget.value
|
|
2006
|
+
let todayDate = this._getStdDate()
|
|
2007
|
+
if (inputDate < todayDate) {
|
|
2008
|
+
this._showToast({
|
|
2009
|
+
message: 'Invalid date'
|
|
2010
|
+
})
|
|
2011
|
+
}
|
|
2012
|
+
return inputDate
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
checkInventoryValidity() {
|
|
2016
|
+
const inventories = this.inventoryGrist?.dirtyData?.records
|
|
2017
|
+
if (!inventories?.length) throw new Error(i18next.t('text.there_is_no_inventory'))
|
|
2018
|
+
|
|
2019
|
+
if (this._pickingStd === PICKING_STANDARD.SELECT_BY_PALLET && inventories.some(record => !record?.inventory?.id))
|
|
2020
|
+
throw new Error(i18next.t('text.invalid_inventory'))
|
|
2021
|
+
|
|
2022
|
+
if (inventories.some(record => !record.releaseQty)) throw new Error(i18next.t('text.invalid_release_qty'))
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
_getStdDate() {
|
|
2026
|
+
let date = new Date()
|
|
2027
|
+
date.setDate(date.getDate())
|
|
2028
|
+
return date.toISOString().split('T')[0]
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
_tabChange(key) {
|
|
2032
|
+
if (key == 'order') {
|
|
2033
|
+
this._showReleasedOrderInfo = false
|
|
2034
|
+
this._showShippingInfo = true
|
|
2035
|
+
} else if (key == 'shipment') {
|
|
2036
|
+
this._showReleasedOrderInfo = true
|
|
2037
|
+
this._showShippingInfo = false
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
_fillUpDeliveryInfo(data) {
|
|
2042
|
+
// remapping according release good table
|
|
2043
|
+
const remapData = {
|
|
2044
|
+
attentionCompany: data.companyName || '',
|
|
2045
|
+
attentionTo: data.name || '',
|
|
2046
|
+
city: data.city || '',
|
|
2047
|
+
state: data.state || '',
|
|
2048
|
+
postalCode: data.postCode || '',
|
|
2049
|
+
country: 'MY',
|
|
2050
|
+
phone1: data.phone || '',
|
|
2051
|
+
deliveryAddress1: data.address ? data.address : '' + data.address2 ? data.address2 : '',
|
|
2052
|
+
billingAddress: data.billingAddress
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
this._selectedPostCode = data.postCode
|
|
2056
|
+
|
|
2057
|
+
this._fillupForm(this.shippingInfoForm, remapData)
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
_validateCountry(e) {
|
|
2061
|
+
if (e.target.value != 'MY') {
|
|
2062
|
+
this._selectedCountry = e.target.value
|
|
2063
|
+
} else {
|
|
2064
|
+
this._selectedCountry = e.target.value
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
_validateBillingCountry(e) {
|
|
2069
|
+
if (e.target.value != 'MY') {
|
|
2070
|
+
this._selectedBillingCountry = e.target.value
|
|
2071
|
+
} else {
|
|
2072
|
+
this._selectedBillingCountry = e.target.value
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
sortByNameField(items, nameField, nameField2) {
|
|
2077
|
+
if (nameField2) {
|
|
2078
|
+
items?.sort((a, b) => {
|
|
2079
|
+
if (a[nameField] == b[nameField]) {
|
|
2080
|
+
return a[nameField2] > b[nameField2] ? 1 : a[nameField2] < b[nameField2] ? -1 : 0
|
|
2081
|
+
} else {
|
|
2082
|
+
return a[nameField] > b[nameField] ? 1 : a[nameField] < b[nameField] ? -1 : 0
|
|
2083
|
+
}
|
|
2084
|
+
})
|
|
2085
|
+
} else {
|
|
2086
|
+
items?.sort((a, b) => (a[nameField] > b[nameField] ? 1 : a[nameField] < b[nameField] ? -1 : 0))
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
return items
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
window.customElements.define('b2c-release-order-detail', B2CReleaseOrderDetail)
|