@things-factory/sales-ui 4.3.239 → 4.3.241
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/constants/index.js +1 -0
- package/client/constants/vas.js +4 -0
- package/client/pages/vas-list.js +64 -104
- package/package.json +4 -4
- package/translations/en.json +6 -2
- package/translations/ko.json +5 -1
- package/translations/ms.json +5 -1
- package/translations/zh.json +5 -1
package/client/pages/vas-list.js
CHANGED
|
@@ -8,6 +8,7 @@ import { isMobileDevice } from '@things-factory/utils'
|
|
|
8
8
|
import { ScrollbarStyles, CommonButtonStyles } from '@things-factory/styles'
|
|
9
9
|
import gql from 'graphql-tag'
|
|
10
10
|
import { css, html } from 'lit-element'
|
|
11
|
+
import { VAS_TYPES } from '../constants'
|
|
11
12
|
|
|
12
13
|
class VasList extends localize(i18next)(PageView) {
|
|
13
14
|
static get properties() {
|
|
@@ -93,8 +94,7 @@ class VasList extends localize(i18next)(PageView) {
|
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
async pageInitialized() {
|
|
96
|
-
this.
|
|
97
|
-
this._vasTypes = await getCodeByName('VAS_TYPES')
|
|
97
|
+
this._vasTypes = VAS_TYPES
|
|
98
98
|
|
|
99
99
|
this._searchFields = [
|
|
100
100
|
{
|
|
@@ -136,94 +136,32 @@ class VasList extends localize(i18next)(PageView) {
|
|
|
136
136
|
width: 200
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
|
-
type: '
|
|
139
|
+
type: 'select',
|
|
140
140
|
name: 'type',
|
|
141
141
|
header: i18next.t('field.type'),
|
|
142
142
|
record: {
|
|
143
143
|
editable: true,
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
options: [
|
|
145
|
+
'',
|
|
146
|
+
...Object.values(this._vasTypes)
|
|
147
|
+
.map(type => type)
|
|
148
|
+
.sort()
|
|
149
|
+
]
|
|
146
150
|
},
|
|
147
151
|
imex: {
|
|
148
152
|
header: i18next.t('field.type'),
|
|
149
153
|
key: 'type',
|
|
150
|
-
width: 70,
|
|
151
|
-
type: 'array',
|
|
152
|
-
arrData: this._vasTypes.map(_vasTypes => {
|
|
153
|
-
return {
|
|
154
|
-
name: _vasTypes.name,
|
|
155
|
-
id: _vasTypes.name
|
|
156
|
-
}
|
|
157
|
-
})
|
|
158
|
-
},
|
|
159
|
-
sortable: true,
|
|
160
|
-
width: 100
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
type: 'string',
|
|
164
|
-
name: 'operationGuideType',
|
|
165
|
-
header: i18next.t('field.operation_guide_type'),
|
|
166
|
-
record: { editable: true, align: 'center' },
|
|
167
|
-
imex: {
|
|
168
|
-
header: i18next.t('field.operation_guide_type'),
|
|
169
|
-
key: 'operationGuideType',
|
|
170
|
-
width: 50,
|
|
171
|
-
type: 'string'
|
|
172
|
-
},
|
|
173
|
-
sortable: true,
|
|
174
|
-
width: 160
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
type: 'string',
|
|
178
|
-
name: 'operationGuide',
|
|
179
|
-
header: i18next.t('field.operation_guide'),
|
|
180
|
-
record: { editable: true, align: 'center' },
|
|
181
|
-
imex: { header: i18next.t('field.operation_guide'), key: 'operationGuide', width: 50, type: 'string' },
|
|
182
|
-
sortable: true,
|
|
183
|
-
width: 160
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
type: 'string',
|
|
187
|
-
name: 'uom',
|
|
188
|
-
header: i18next.t('field.uom'),
|
|
189
|
-
record: { editable: true, align: 'left' },
|
|
190
|
-
imex: { header: i18next.t('field.uom'), key: 'uom', width: 50, type: 'string' },
|
|
191
|
-
sortable: true,
|
|
192
|
-
width: 160
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
type: 'code',
|
|
196
|
-
name: 'currency',
|
|
197
|
-
header: i18next.t('field.currency'),
|
|
198
|
-
record: {
|
|
199
|
-
editable: true,
|
|
200
|
-
align: 'center',
|
|
201
|
-
codeName: 'CURRENCY'
|
|
202
|
-
},
|
|
203
|
-
imex: {
|
|
204
|
-
header: i18next.t('field.currency'),
|
|
205
|
-
key: 'currency',
|
|
206
154
|
width: 50,
|
|
207
155
|
type: 'array',
|
|
208
|
-
arrData: this.
|
|
156
|
+
arrData: Object.values(this._vasTypes).map(type => {
|
|
209
157
|
return {
|
|
210
|
-
name:
|
|
211
|
-
id: _currencyType.name
|
|
158
|
+
name: type
|
|
212
159
|
}
|
|
213
160
|
})
|
|
214
161
|
},
|
|
215
162
|
sortable: true,
|
|
216
163
|
width: 100
|
|
217
164
|
},
|
|
218
|
-
{
|
|
219
|
-
type: 'float',
|
|
220
|
-
name: 'defaultPrice',
|
|
221
|
-
header: i18next.t('field.default_price'),
|
|
222
|
-
record: { editable: true, align: 'center' },
|
|
223
|
-
imex: { header: i18next.t('field.default_price'), key: 'defaultPrice', width: 50, type: 'float' },
|
|
224
|
-
sortable: true,
|
|
225
|
-
width: 60
|
|
226
|
-
},
|
|
227
165
|
{
|
|
228
166
|
type: 'datetime',
|
|
229
167
|
name: 'updatedAt',
|
|
@@ -239,6 +177,14 @@ class VasList extends localize(i18next)(PageView) {
|
|
|
239
177
|
record: { editable: false, align: 'center' },
|
|
240
178
|
sortable: true,
|
|
241
179
|
width: 150
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
type: 'object',
|
|
183
|
+
name: 'creator',
|
|
184
|
+
header: i18next.t('field.creator'),
|
|
185
|
+
record: { editable: false, align: 'center' },
|
|
186
|
+
sortable: true,
|
|
187
|
+
width: 150
|
|
242
188
|
}
|
|
243
189
|
]
|
|
244
190
|
}
|
|
@@ -259,17 +205,16 @@ class VasList extends localize(i18next)(PageView) {
|
|
|
259
205
|
id
|
|
260
206
|
name
|
|
261
207
|
description
|
|
262
|
-
defaultPrice
|
|
263
|
-
currency
|
|
264
|
-
uom
|
|
265
208
|
type
|
|
266
|
-
operationGuideType
|
|
267
|
-
operationGuide
|
|
268
209
|
updatedAt
|
|
269
210
|
updater {
|
|
270
211
|
name
|
|
271
212
|
description
|
|
272
213
|
}
|
|
214
|
+
creator {
|
|
215
|
+
name
|
|
216
|
+
description
|
|
217
|
+
}
|
|
273
218
|
}
|
|
274
219
|
total
|
|
275
220
|
}
|
|
@@ -289,39 +234,54 @@ class VasList extends localize(i18next)(PageView) {
|
|
|
289
234
|
}
|
|
290
235
|
|
|
291
236
|
async _saveVas(patches) {
|
|
292
|
-
|
|
293
|
-
patches.
|
|
294
|
-
|
|
295
|
-
vas.defaultPrice = parseFloat(vas.defaultPrice)
|
|
296
|
-
return vas
|
|
297
|
-
}
|
|
298
|
-
})
|
|
237
|
+
try {
|
|
238
|
+
if (patches && patches.length) {
|
|
239
|
+
this.validateVas(patches)
|
|
299
240
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
241
|
+
const response = await client.mutate({
|
|
242
|
+
mutation: gql`
|
|
243
|
+
mutation updateMultipleVas($patches: [VasPatch!]!) {
|
|
244
|
+
updateMultipleVas(patches: $patches) {
|
|
245
|
+
name
|
|
246
|
+
}
|
|
305
247
|
}
|
|
248
|
+
`,
|
|
249
|
+
variables: {
|
|
250
|
+
patches
|
|
306
251
|
}
|
|
307
|
-
|
|
308
|
-
variables: {
|
|
309
|
-
patches
|
|
310
|
-
}
|
|
311
|
-
})
|
|
252
|
+
})
|
|
312
253
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
254
|
+
if (!response.errors) {
|
|
255
|
+
this.dataGrist.fetch()
|
|
256
|
+
this.showToast(i18next.t('text.data_updated_successfully'))
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
CustomAlert({
|
|
260
|
+
title: i18next.t('text.nothing_changed'),
|
|
261
|
+
text: i18next.t('text.there_is_nothing_to_save')
|
|
262
|
+
})
|
|
316
263
|
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
title: i18next.t('text.nothing_changed'),
|
|
320
|
-
text: i18next.t('text.there_is_nothing_to_save')
|
|
321
|
-
})
|
|
264
|
+
} catch (error) {
|
|
265
|
+
this.showToast(error)
|
|
322
266
|
}
|
|
323
267
|
}
|
|
324
268
|
|
|
269
|
+
validateVas(patches) {
|
|
270
|
+
const test = patches
|
|
271
|
+
test
|
|
272
|
+
patches.map(patch => {
|
|
273
|
+
if (patch.name == ''|| patch.name === null || (patch.cuFlag == '+' && !patch.name)) {
|
|
274
|
+
throw new Error(i18next.t('text.empty_field_field', { field: 'name' }))
|
|
275
|
+
}
|
|
276
|
+
if (patch.type == '' || patch.type === null || (patch.cuFlag == '+' && !patch.type)) {
|
|
277
|
+
throw new Error(i18next.t('text.empty_field_field', { field: 'type' }))
|
|
278
|
+
}
|
|
279
|
+
if (patch.type && patch.type != this._vasTypes.MATERIALS && patch.type != this._vasTypes.SERVICE) {
|
|
280
|
+
throw new Error(i18next.t('text.invalid_input_in_field', { field: 'type' }))
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
|
|
325
285
|
async _deleteVas() {
|
|
326
286
|
const ids = this.dataGrist.selected.map(record => record.id)
|
|
327
287
|
if (ids && ids.length) {
|
|
@@ -337,7 +297,7 @@ class VasList extends localize(i18next)(PageView) {
|
|
|
337
297
|
|
|
338
298
|
const response = await client.mutate({
|
|
339
299
|
mutation: gql`
|
|
340
|
-
mutation deleteVass($ids: [String!]) {
|
|
300
|
+
mutation deleteVass($ids: [String!]!) {
|
|
341
301
|
deleteVass(ids: $ids)
|
|
342
302
|
}
|
|
343
303
|
`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/sales-ui",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.241",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@things-factory/grist-ui": "^4.3.237",
|
|
29
29
|
"@things-factory/i18n-base": "^4.3.237",
|
|
30
30
|
"@things-factory/import-ui": "^4.3.237",
|
|
31
|
-
"@things-factory/sales-base": "^4.3.
|
|
31
|
+
"@things-factory/sales-base": "^4.3.241",
|
|
32
32
|
"@things-factory/setting-ui": "^4.3.237",
|
|
33
33
|
"@things-factory/shell": "^4.3.237",
|
|
34
|
-
"@things-factory/warehouse-ui": "^4.3.
|
|
34
|
+
"@things-factory/warehouse-ui": "^4.3.241"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "507fce6438f95509d660bc61cd1ddc615c868ee3"
|
|
37
37
|
}
|
package/translations/en.json
CHANGED
|
@@ -26,12 +26,18 @@
|
|
|
26
26
|
"label.total_disc_amt": "total disc amt",
|
|
27
27
|
"label.unit_price": "unit price",
|
|
28
28
|
"text.draft_order_saved": "draft order saved",
|
|
29
|
+
"text.empty_field_field": "empty field ({field})",
|
|
29
30
|
"text.generate_release_order(s)": "generate release order(s)",
|
|
31
|
+
"text.invalid_input_in_field": "invalid input ({field})",
|
|
32
|
+
"text.invalid_input_in_unit_price": "invalid input in unit price",
|
|
33
|
+
"text.negative_value_field": "negative value ({field})",
|
|
30
34
|
"text.please_select_a_valid_draft_order_to_generate_release_order": "please select a valid draft order to generate release order",
|
|
31
35
|
"text.purchase_order_form_invalid": "purchase order form invalid",
|
|
32
36
|
"text.purchase_order_saved": "purchase order saved",
|
|
33
37
|
"text.purchase_order_updated": "purchase order updated",
|
|
38
|
+
"text.qty_vas_exceed_release_qty_sku": "qty exceed release qty for vas ({sku})",
|
|
34
39
|
"text.release_order(s)_has_been_generated": "release order(s) has been generated",
|
|
40
|
+
"text.there_is_duplicated_products_with_same_batch_no": "there is duplicated products with same batch no",
|
|
35
41
|
"text.total_price_exceed_x_y": "total price exceed {x}{y}",
|
|
36
42
|
"text.update_draft_release_order": "update draft release order",
|
|
37
43
|
"text.update_purchase_order": "update purchase order",
|
|
@@ -44,7 +50,5 @@
|
|
|
44
50
|
"title.purchase_order": "purchase order",
|
|
45
51
|
"title.purchase_orders_approval": "purchase orders approval",
|
|
46
52
|
"title.purchase_orders": "purchase orders",
|
|
47
|
-
"text.there_is_duplicated_products_with_same_batch_no": "there is duplicated products with same batch no",
|
|
48
|
-
"text.invalid_input_in_unit_price": "invalid input in unit price",
|
|
49
53
|
"title.tolerance_limit": "tolerance limit"
|
|
50
54
|
}
|
package/translations/ko.json
CHANGED
|
@@ -46,5 +46,9 @@
|
|
|
46
46
|
"label.tax_rate": "[ko] tax rate",
|
|
47
47
|
"text.purchase_order_updated": "[ko] purchase order updated",
|
|
48
48
|
"text.there_is_duplicated_products_with_same_batch_no": "[ko] there is duplicated products with same batch no",
|
|
49
|
-
"text.invalid_input_in_unit_price": "[ko] invalid input in unit price"
|
|
49
|
+
"text.invalid_input_in_unit_price": "[ko] invalid input in unit price",
|
|
50
|
+
"text.empty_field_field": "[ko] empty field ({field})",
|
|
51
|
+
"text.invalid_input_in_field": "[ko] invalid input ({field})",
|
|
52
|
+
"text.negative_value_field": "[ko] negative value ({field})",
|
|
53
|
+
"text.qty_vas_exceed_release_qty_sku": "[ko] qty exceed release qty for vas ({sku})"
|
|
50
54
|
}
|
package/translations/ms.json
CHANGED
|
@@ -46,5 +46,9 @@
|
|
|
46
46
|
"label.tax_rate": "[ms] tax rate",
|
|
47
47
|
"text.purchase_order_updated": "[ms] purchase order updated",
|
|
48
48
|
"text.there_is_duplicated_products_with_same_batch_no": "[ms] there is duplicated products with same batch no",
|
|
49
|
-
"text.invalid_input_in_unit_price": "[ms] invalid input in unit price"
|
|
49
|
+
"text.invalid_input_in_unit_price": "[ms] invalid input in unit price",
|
|
50
|
+
"text.empty_field_field": "[ms] empty field ({field})",
|
|
51
|
+
"text.invalid_input_in_field": "[ms] invalid input ({field})",
|
|
52
|
+
"text.negative_value_field": "[ms] negative value ({field})",
|
|
53
|
+
"text.qty_vas_exceed_release_qty_sku": "[ms] qty exceed release qty for vas ({sku})"
|
|
50
54
|
}
|
package/translations/zh.json
CHANGED
|
@@ -46,5 +46,9 @@
|
|
|
46
46
|
"label.tax_rate": "[zh] tax rate",
|
|
47
47
|
"text.purchase_order_updated": "[zh] purchase order updated",
|
|
48
48
|
"text.there_is_duplicated_products_with_same_batch_no": "[zh] there is duplicated products with same batch no",
|
|
49
|
-
"text.invalid_input_in_unit_price": "[zh] invalid input in unit price"
|
|
49
|
+
"text.invalid_input_in_unit_price": "[zh] invalid input in unit price",
|
|
50
|
+
"text.empty_field_field": "[zh] empty field ({field})",
|
|
51
|
+
"text.invalid_input_in_field": "[zh] invalid input ({field})",
|
|
52
|
+
"text.negative_value_field": "[zh] negative value ({field})",
|
|
53
|
+
"text.qty_vas_exceed_release_qty_sku": "[zh] qty exceed release qty for vas ({sku})"
|
|
50
54
|
}
|