@things-factory/operato-wms 4.3.414 → 4.3.416
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/manifest/create-loading-manifest.js +463 -37
- package/client/pages/manifest/existing-manifest-list.js +270 -0
- package/client/pages/manifest/generate-manifest-popup.js +199 -0
- package/client/pages/manifest/loading-manifest-detail.js +141 -50
- package/client/pages/manifest/loading-manifest-list.js +13 -3
- package/client/pages/manifest/select-manifest-popup.js +157 -0
- package/client/pages/order/release-order/tracking-information-popup.js +10 -3
- package/client/route.js +3 -0
- package/helps/release-note.md +4 -12
- package/package.json +5 -5
- package/things-factory.config.js +4 -0
- package/translations/en.json +16 -1
- package/translations/ko.json +14 -0
- package/translations/ms.json +14 -0
- package/translations/zh.json +14 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import '@things-factory/form-ui'
|
|
2
|
+
import '@things-factory/grist-ui'
|
|
3
|
+
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
import {
|
|
6
|
+
css,
|
|
7
|
+
html
|
|
8
|
+
} from 'lit-element'
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
i18next,
|
|
12
|
+
localize
|
|
13
|
+
} from '@things-factory/i18n-base'
|
|
14
|
+
import {
|
|
15
|
+
client,
|
|
16
|
+
navigate,
|
|
17
|
+
PageView
|
|
18
|
+
} from '@things-factory/shell'
|
|
19
|
+
import {
|
|
20
|
+
CommonButtonStyles,
|
|
21
|
+
ScrollbarStyles
|
|
22
|
+
} from '@things-factory/styles'
|
|
23
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
24
|
+
|
|
25
|
+
class ExistingManifestList extends localize(i18next)(PageView) {
|
|
26
|
+
static get styles() {
|
|
27
|
+
return [
|
|
28
|
+
ScrollbarStyles,
|
|
29
|
+
css`
|
|
30
|
+
:host {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
search-form {
|
|
37
|
+
overflow: visible;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
data-grist {
|
|
41
|
+
overflow-y: auto;
|
|
42
|
+
flex: 1;
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static get properties() {
|
|
49
|
+
return {
|
|
50
|
+
_searchFields: Array,
|
|
51
|
+
config: Object,
|
|
52
|
+
data: Object,
|
|
53
|
+
_shippingProviderList: Array
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get context() {
|
|
58
|
+
return {
|
|
59
|
+
title: i18next.t('title.existing_manifest'),
|
|
60
|
+
actions: [
|
|
61
|
+
{
|
|
62
|
+
title: i18next.t('button.confirm'),
|
|
63
|
+
action: this._returnExisting.bind(this),
|
|
64
|
+
...CommonButtonStyles.submit
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: i18next.t('button.back'),
|
|
68
|
+
action: () => navigate(`create_loading_manifest`),
|
|
69
|
+
...CommonButtonStyles.back
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get searchForm() {
|
|
76
|
+
return this.shadowRoot.querySelector('search-form')
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get dataGrist() {
|
|
80
|
+
return this.shadowRoot.querySelector('data-grist')
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
render() {
|
|
84
|
+
return html`
|
|
85
|
+
<search-form id="search-form" .fields=${this._searchFields} @submit=${e => this.dataGrist.fetch()}></search-form>
|
|
86
|
+
|
|
87
|
+
<data-grist
|
|
88
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
89
|
+
.config=${this.config}
|
|
90
|
+
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
91
|
+
></data-grist>
|
|
92
|
+
`
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async pageUpdated(changes, lifecycle) {
|
|
96
|
+
if (this.active) {
|
|
97
|
+
this.dataGrist.fetch()
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
constructor() {
|
|
102
|
+
super()
|
|
103
|
+
this._shippingProviderList = []
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async pageInitialized() {
|
|
107
|
+
this._searchFields = [
|
|
108
|
+
{
|
|
109
|
+
label: i18next.t('field.manifest_no'),
|
|
110
|
+
name: 'name',
|
|
111
|
+
type: 'text',
|
|
112
|
+
props: { searchOper: 'i_like' }
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
label: i18next.t('field.transporter'),
|
|
116
|
+
name: 'shippingProvider',
|
|
117
|
+
type: 'select',
|
|
118
|
+
options: [
|
|
119
|
+
{ value: '' },
|
|
120
|
+
...this._shippingProviderList.map(sp => {
|
|
121
|
+
return {
|
|
122
|
+
name: sp,
|
|
123
|
+
value: sp
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
],
|
|
127
|
+
props: { searchOper: 'i_like' }
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
|
|
131
|
+
this.config = {
|
|
132
|
+
list: {
|
|
133
|
+
fields: ['name', 'shippingProvider', 'status', 'dispatchedAt', 'createdAt']
|
|
134
|
+
},
|
|
135
|
+
rows: { appendable: false, selectable: { multiple: false } },
|
|
136
|
+
columns: [
|
|
137
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
138
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
139
|
+
{
|
|
140
|
+
type: 'string',
|
|
141
|
+
name: 'name',
|
|
142
|
+
header: i18next.t('field.manifest_no'),
|
|
143
|
+
label: true,
|
|
144
|
+
sortable: true,
|
|
145
|
+
width: 180
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: 'int',
|
|
149
|
+
name: 'totalTrackingNo',
|
|
150
|
+
header: i18next.t('field.total_tracking_no'),
|
|
151
|
+
label: true,
|
|
152
|
+
width: 150
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
type: 'string',
|
|
156
|
+
name: 'shippingProvider',
|
|
157
|
+
header: i18next.t('field.transporter'),
|
|
158
|
+
label: true,
|
|
159
|
+
sortable: true,
|
|
160
|
+
width: 150
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
type: 'string',
|
|
164
|
+
name: 'status',
|
|
165
|
+
header: i18next.t('field.status'),
|
|
166
|
+
label: true,
|
|
167
|
+
sortable: true,
|
|
168
|
+
width: 150
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: 'datetime',
|
|
172
|
+
name: 'createdAt',
|
|
173
|
+
header: i18next.t('field.created_at'),
|
|
174
|
+
label: true,
|
|
175
|
+
sortable: true,
|
|
176
|
+
width: 160
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
type: 'object',
|
|
180
|
+
name: 'creator',
|
|
181
|
+
header: i18next.t('field.created_by'),
|
|
182
|
+
label: true,
|
|
183
|
+
sortable: true,
|
|
184
|
+
width: 200
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async fetchHandler({ page, limit, sorters = [{ name: 'createdAt', desc: true }] }) {
|
|
191
|
+
const filtersWithAdditional = [...this.searchForm.queryFilters]
|
|
192
|
+
const response = await client.query({
|
|
193
|
+
query: gql`
|
|
194
|
+
query manifests($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $isSelectOpen: Boolean) {
|
|
195
|
+
manifests(filters: $filters, pagination: $pagination, sortings: $sortings, isSelectOpen: $isSelectOpen) {
|
|
196
|
+
items {
|
|
197
|
+
id
|
|
198
|
+
name
|
|
199
|
+
shippingProvider
|
|
200
|
+
totalTrackingNo
|
|
201
|
+
status
|
|
202
|
+
createdAt
|
|
203
|
+
creator {
|
|
204
|
+
id
|
|
205
|
+
name
|
|
206
|
+
description
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
total
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
`,
|
|
213
|
+
variables: { filters: filtersWithAdditional, pagination: { page, limit }, sortings: sorters, isSelectOpen: true }
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
if (!response.errors) {
|
|
217
|
+
let shippingProviders = response.data.manifests.items.map(itm => itm.shippingProvider)
|
|
218
|
+
shippingProviders = [...new Set(shippingProviders)]
|
|
219
|
+
|
|
220
|
+
if (this._shippingProviderList.length < shippingProviders.length) {
|
|
221
|
+
this._shippingProviderList = shippingProviders
|
|
222
|
+
this._searchFields.filter(x => x.name == 'shippingProvider')[0].options = [
|
|
223
|
+
{ value: '' },
|
|
224
|
+
...this._shippingProviderList.map(sp => {
|
|
225
|
+
return {
|
|
226
|
+
name: sp,
|
|
227
|
+
value: sp
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
]
|
|
231
|
+
this._searchFields = [...this._searchFields]
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
total: response.data.manifests.total || 0,
|
|
235
|
+
records: response.data.manifests.items || []
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
get _columns() {
|
|
241
|
+
return this.config.columns
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
_returnExisting() {
|
|
245
|
+
const selected = this.dataGrist.selected
|
|
246
|
+
if (selected.length < 1) {
|
|
247
|
+
this._showToast({ message: i18next.t('text.please_select_a_manifest_to_proceed') })
|
|
248
|
+
return
|
|
249
|
+
}
|
|
250
|
+
let selectedObject = selected.reduce((acc, curr) => Object.assign(acc, curr), {})
|
|
251
|
+
const encodedShippingProvider = encodeURIComponent(selectedObject.shippingProvider)
|
|
252
|
+
|
|
253
|
+
const url = `create_loading_manifest?name=${selectedObject.name}&shippingProvider=${encodedShippingProvider}&id=${selectedObject.id}`
|
|
254
|
+
navigate(url)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
_showToast({ type, message, duration }) {
|
|
258
|
+
document.dispatchEvent(
|
|
259
|
+
new CustomEvent('notify', {
|
|
260
|
+
detail: {
|
|
261
|
+
type,
|
|
262
|
+
message,
|
|
263
|
+
option: { timer: duration ? duration : 1500 }
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
customElements.define('existing-manifest-list', ExistingManifestList)
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import '@things-factory/grist-ui'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import {
|
|
5
|
+
css,
|
|
6
|
+
html,
|
|
7
|
+
LitElement
|
|
8
|
+
} from 'lit-element'
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
i18next,
|
|
12
|
+
localize
|
|
13
|
+
} from '@things-factory/i18n-base'
|
|
14
|
+
import { client } from '@things-factory/shell'
|
|
15
|
+
import { ScrollbarStyles } from '@things-factory/styles'
|
|
16
|
+
|
|
17
|
+
class GenerateManifestPopup extends localize(i18next)(LitElement) {
|
|
18
|
+
static get styles() {
|
|
19
|
+
return [
|
|
20
|
+
ScrollbarStyles,
|
|
21
|
+
css`
|
|
22
|
+
:host {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
background-color: white;
|
|
27
|
+
width: 300px;
|
|
28
|
+
height: 200px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#courier {
|
|
32
|
+
width: 150px;
|
|
33
|
+
height: 30px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.container {
|
|
37
|
+
display: flex;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.select-courier {
|
|
43
|
+
margin-top: 13px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.button-container {
|
|
47
|
+
position: absolute;
|
|
48
|
+
left: 50%;
|
|
49
|
+
transform: translateX(-50%);
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
margin-top: 120px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.button-container input {
|
|
57
|
+
margin: 0 5px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.button-container input[class='cancel'] {
|
|
61
|
+
background-color: white;
|
|
62
|
+
color: red;
|
|
63
|
+
padding: 10px 20px;
|
|
64
|
+
border: 2px solid red;
|
|
65
|
+
border-radius: 5px;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
font-weight: bold;
|
|
68
|
+
padding: 8px 15px;
|
|
69
|
+
margin-right: 10px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.button-container input[class='confirm'] {
|
|
73
|
+
background-color: #117e7f;
|
|
74
|
+
color: white;
|
|
75
|
+
padding: 10px 20px;
|
|
76
|
+
border: 1px solid white;
|
|
77
|
+
border-radius: 5px;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
font-weight: bold;
|
|
80
|
+
display: flex;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
align-items: center;
|
|
83
|
+
}
|
|
84
|
+
`
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static get properties() {
|
|
89
|
+
return {
|
|
90
|
+
shippingData: Object,
|
|
91
|
+
isManifestNew: Boolean
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
render() {
|
|
96
|
+
return html` <div class="container">
|
|
97
|
+
<div class="select-courier">
|
|
98
|
+
<label for="courier-name">Courier:</label>
|
|
99
|
+
<select id="courier" name="courierSelector"></select>
|
|
100
|
+
</div>
|
|
101
|
+
<div class="button-container">
|
|
102
|
+
<input type="button" value="Confirm" class="confirm" @click=${() => this._createLoadingManifest()} />
|
|
103
|
+
<input type="button" value="Cancel" class="cancel" @click=${this.closePopup} />
|
|
104
|
+
</div>
|
|
105
|
+
</div>`
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
closePopup() {
|
|
109
|
+
history.back()
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
get courierSelector() {
|
|
113
|
+
return this.shadowRoot.querySelector('select[name=courierSelector]')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async handleCourierChange() {
|
|
117
|
+
try {
|
|
118
|
+
const response = await client.query({
|
|
119
|
+
query: gql`
|
|
120
|
+
query fetchTransport {
|
|
121
|
+
fetchTransport
|
|
122
|
+
}
|
|
123
|
+
`
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const couriers = response.data.fetchTransport
|
|
127
|
+
|
|
128
|
+
this.courierSelector.innerHTML = ''
|
|
129
|
+
|
|
130
|
+
// Create new options based on fetched data
|
|
131
|
+
couriers.forEach(courier => {
|
|
132
|
+
const option = document.createElement('option')
|
|
133
|
+
option.value = courier
|
|
134
|
+
option.textContent = courier
|
|
135
|
+
this.courierSelector.appendChild(option)
|
|
136
|
+
})
|
|
137
|
+
} catch (e) {
|
|
138
|
+
this._showToast(e)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async _createLoadingManifest() {
|
|
143
|
+
try {
|
|
144
|
+
const selectedCourier = this.shadowRoot.getElementById('courier').value
|
|
145
|
+
let manifestSelect = this.isManifestNew
|
|
146
|
+
|
|
147
|
+
let manifest = {
|
|
148
|
+
transporter: selectedCourier
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const response = await client.mutate({
|
|
152
|
+
mutation: gql`
|
|
153
|
+
mutation generateManifest($manifest: NewManifest!) {
|
|
154
|
+
generateManifest(manifest: $manifest) {
|
|
155
|
+
id
|
|
156
|
+
name
|
|
157
|
+
shippingProvider
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
`,
|
|
161
|
+
variables: { manifest }
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
if (!response.errors) {
|
|
165
|
+
const generatedManifest = response.data.generateManifest
|
|
166
|
+
this._showToast({ message: i18next.t('text.manifest_has_been_generated') })
|
|
167
|
+
this.dispatchEvent(
|
|
168
|
+
new CustomEvent('manifestGenerated', { detail: { generatedManifest }, bubbles: true, composed: true })
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
if (manifestSelect) {
|
|
172
|
+
history.go(-2)
|
|
173
|
+
} else {
|
|
174
|
+
history.back()
|
|
175
|
+
}
|
|
176
|
+
} catch (e) {
|
|
177
|
+
this._showToast(e)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
_showToast({ type, message }) {
|
|
182
|
+
document.dispatchEvent(
|
|
183
|
+
new CustomEvent('notify', {
|
|
184
|
+
detail: {
|
|
185
|
+
type,
|
|
186
|
+
message
|
|
187
|
+
}
|
|
188
|
+
})
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async connectedCallback() {
|
|
193
|
+
super.connectedCallback()
|
|
194
|
+
// Call the fetch function when the component is connected to the DOM
|
|
195
|
+
await this.handleCourierChange()
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
window.customElements.define('generate-manifest-popup', GenerateManifestPopup)
|