@things-factory/operato-wms 4.3.450 → 4.3.453
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/order.js +2 -1
- package/client/pages/order/draft-release-good/draft-release-good-card.js +292 -0
- package/client/pages/order/draft-release-good/draft-release-good-detail.js +24 -5
- package/client/pages/order/draft-release-good/draft-release-good-list.js +82 -27
- package/client/pages/order/draft-release-good/draft-release-good-popup.js +366 -0
- package/client/pages/order/release-order/b2b/b2b-order-list.js +33 -5
- package/client/pages/order/release-order/b2c/b2c-order-requests.js +12 -0
- package/client/pages/order/release-order/create-release-order.js +63 -27
- package/client/pages/order/release-order/release-order-detail.js +90 -27
- package/client/pages/order/vas-order/popup/order-vas-popup.js +236 -0
- package/client/pages/report/order-vas-report.js +101 -39
- package/client/pages/report/vas-report.js +2 -25
- package/client/pages/vas/add-vas-order-level.js +383 -0
- package/client/pages/vas/vas-execution-page.js +41 -5
- package/client/pages/vas/worksheet-ref-vas.js +20 -18
- package/dist-server/graphql/resolvers/reports/shortage-report.js +3 -2
- package/dist-server/graphql/resolvers/reports/shortage-report.js.map +1 -1
- package/dist-server/graphql/resolvers/reports/vas-report.js +199 -88
- package/dist-server/graphql/resolvers/reports/vas-report.js.map +1 -1
- package/helps/release-note.md +9 -6
- package/package.json +21 -21
- package/server/graphql/resolvers/reports/shortage-report.ts +3 -2
- package/server/graphql/resolvers/reports/vas-report.ts +203 -95
- package/translations/en.json +13 -0
- package/translations/ko.json +13 -0
- package/translations/ms.json +13 -0
- package/translations/zh.json +13 -0
|
@@ -282,7 +282,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
282
282
|
ORDER_STATUS.PENDING.value,
|
|
283
283
|
ORDER_STATUS.PENDING_RECEIVE.value,
|
|
284
284
|
ORDER_STATUS.PENDING_WORKSHEET.value,
|
|
285
|
-
ORDER_STATUS.READY_TO_PICK.value
|
|
285
|
+
ORDER_STATUS.READY_TO_PICK.value,
|
|
286
|
+
ORDER_STATUS.PICKING.value
|
|
286
287
|
]
|
|
287
288
|
}
|
|
288
289
|
//vas -- edit this. make vas editable if status != PICKING
|
|
@@ -1169,13 +1170,14 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1169
1170
|
'uomValue',
|
|
1170
1171
|
'vas',
|
|
1171
1172
|
'vasQty',
|
|
1173
|
+
'newBatchId',
|
|
1172
1174
|
'newSku',
|
|
1173
1175
|
'newPackingType',
|
|
1174
1176
|
'newUom',
|
|
1175
1177
|
'newUnitUomValue',
|
|
1176
1178
|
'newUomValue',
|
|
1177
1179
|
'outputQty',
|
|
1178
|
-
'
|
|
1180
|
+
'vasRemark'
|
|
1179
1181
|
]
|
|
1180
1182
|
},
|
|
1181
1183
|
pagination: { infinite: true },
|
|
@@ -1208,6 +1210,18 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1208
1210
|
this._showToast(e)
|
|
1209
1211
|
}
|
|
1210
1212
|
}
|
|
1213
|
+
if (column.name === 'newBatchId') {
|
|
1214
|
+
try {
|
|
1215
|
+
if (!record.newProductId) {
|
|
1216
|
+
column.record.editable = false
|
|
1217
|
+
throw new Error(i18next.t('text.new_sku_empty'))
|
|
1218
|
+
} else {
|
|
1219
|
+
column.record.editable = true
|
|
1220
|
+
}
|
|
1221
|
+
} catch (e) {
|
|
1222
|
+
this._showToast(e)
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1211
1225
|
}
|
|
1212
1226
|
}
|
|
1213
1227
|
}
|
|
@@ -1294,6 +1308,13 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1294
1308
|
record: { editable: true, options: { min: 0 } },
|
|
1295
1309
|
width: 80
|
|
1296
1310
|
},
|
|
1311
|
+
{
|
|
1312
|
+
type: 'string',
|
|
1313
|
+
name: 'newBatchId',
|
|
1314
|
+
header: i18next.t('field.batch_no_(new_sku)'),
|
|
1315
|
+
record: { editable: true },
|
|
1316
|
+
width: 150
|
|
1317
|
+
},
|
|
1297
1318
|
{
|
|
1298
1319
|
type: 'string',
|
|
1299
1320
|
name: 'newSku',
|
|
@@ -1340,7 +1361,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1340
1361
|
},
|
|
1341
1362
|
{
|
|
1342
1363
|
type: 'string',
|
|
1343
|
-
name: '
|
|
1364
|
+
name: 'vasRemark',
|
|
1344
1365
|
header: i18next.t('field.remark'),
|
|
1345
1366
|
record: { editable: true },
|
|
1346
1367
|
width: 400
|
|
@@ -1491,6 +1512,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1491
1512
|
orderVass {
|
|
1492
1513
|
id
|
|
1493
1514
|
name
|
|
1515
|
+
createdAt
|
|
1494
1516
|
orderVasItems {
|
|
1495
1517
|
id
|
|
1496
1518
|
vas {
|
|
@@ -1500,6 +1522,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1500
1522
|
type
|
|
1501
1523
|
}
|
|
1502
1524
|
vasQty
|
|
1525
|
+
vasRemark
|
|
1503
1526
|
}
|
|
1504
1527
|
batchId
|
|
1505
1528
|
product {
|
|
@@ -1532,6 +1555,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1532
1555
|
qty
|
|
1533
1556
|
uom
|
|
1534
1557
|
uomValue
|
|
1558
|
+
newBatchId
|
|
1535
1559
|
newPackingType
|
|
1536
1560
|
newUom
|
|
1537
1561
|
newUomValue
|
|
@@ -1690,7 +1714,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1690
1714
|
this.deletedVas = []
|
|
1691
1715
|
this.vasData = {
|
|
1692
1716
|
records: orderVass
|
|
1693
|
-
.sort((a, b) => a.
|
|
1717
|
+
.sort((a, b) => new Date(a.createdAt) - new Date(b.createdAt))
|
|
1694
1718
|
.reduce((acc, orderVas, groupIdx) => {
|
|
1695
1719
|
const releaseQty = orderProducts.find(op => op.batchId === orderVas.batchId)?.releaseQty || 0
|
|
1696
1720
|
acc.push({
|
|
@@ -1718,7 +1742,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1718
1742
|
vasName: itm.vas.name,
|
|
1719
1743
|
type: itm.vas.type
|
|
1720
1744
|
},
|
|
1721
|
-
vasQty: itm.vasQty
|
|
1745
|
+
vasQty: itm.vasQty,
|
|
1746
|
+
vasRemark: itm.vasRemark
|
|
1722
1747
|
}
|
|
1723
1748
|
} else {
|
|
1724
1749
|
acc.push({
|
|
@@ -1731,7 +1756,8 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1731
1756
|
vasName: itm.vas.name,
|
|
1732
1757
|
type: itm.vas.type
|
|
1733
1758
|
},
|
|
1734
|
-
vasQty: itm.vasQty
|
|
1759
|
+
vasQty: itm.vasQty,
|
|
1760
|
+
vasRemark: itm.vasRemark
|
|
1735
1761
|
})
|
|
1736
1762
|
}
|
|
1737
1763
|
})
|
|
@@ -2256,6 +2282,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2256
2282
|
newUom: e.detail.uom,
|
|
2257
2283
|
newProductId: e.detail.product.id,
|
|
2258
2284
|
newUomValue: e.detail.uomValue,
|
|
2285
|
+
newUnitUomValue: e.detail.uomValue,
|
|
2259
2286
|
newProductDetailId: e.detail.productDetailId,
|
|
2260
2287
|
cuFlag: 'M',
|
|
2261
2288
|
__dirty__: 'M',
|
|
@@ -2272,14 +2299,17 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2272
2299
|
...this.vasGrist.dirtyData.records[rowIndex],
|
|
2273
2300
|
...newRecords
|
|
2274
2301
|
})
|
|
2275
|
-
this.vasGrist.dirtyData.records.map(record => {
|
|
2276
|
-
record.newSku
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2302
|
+
this.vasGrist.dirtyData.records.map((record, index) => {
|
|
2303
|
+
if (index === rowIndex && record.newSku) {
|
|
2304
|
+
if (record.qty) {
|
|
2305
|
+
record.outputQty = record.qty
|
|
2306
|
+
record.newUnitUomValue = record.newUomValue
|
|
2307
|
+
record.newUomValue = record.qty * record.newUomValue
|
|
2308
|
+
} else {
|
|
2309
|
+
record.newUomValue = null
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
return record
|
|
2283
2313
|
})
|
|
2284
2314
|
this.vasData = {
|
|
2285
2315
|
...this.vasData,
|
|
@@ -2320,10 +2350,12 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2320
2350
|
}, [])}"
|
|
2321
2351
|
@selected="${e => {
|
|
2322
2352
|
let newRecords = []
|
|
2353
|
+
let oldRecords = this.vasGrist.dirtyData.records
|
|
2323
2354
|
let firstIndex = this.vasGrist.dirtyData.records.findIndex(oldData => oldData.group == record.group)
|
|
2324
2355
|
let lastIndex = this.vasGrist.dirtyData.records.findLastIndex(oldData => oldData.group == record.group)
|
|
2325
2356
|
|
|
2326
2357
|
for (let i = 0; i < e.detail.length; i++) {
|
|
2358
|
+
let a = oldRecords.find(vb => vb.vas?.id === e.detail[i].id)
|
|
2327
2359
|
if (i == 0) {
|
|
2328
2360
|
newRecords.push({
|
|
2329
2361
|
...this.vasGrist.dirtyData.records[firstIndex],
|
|
@@ -2333,7 +2365,14 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2333
2365
|
name: e.detail[i].name,
|
|
2334
2366
|
vasName: e.detail[i].name
|
|
2335
2367
|
},
|
|
2336
|
-
vasQty: this.vasGrist.dirtyData.records[firstIndex].qty,
|
|
2368
|
+
vasQty: a?.vasQty ? a.vasQty : this.vasGrist.dirtyData.records[firstIndex].qty,
|
|
2369
|
+
newBatchId: this.vasGrist.dirtyData.records[firstIndex].newBatchId,
|
|
2370
|
+
newProduct: this.vasGrist.dirtyData.records[firstIndex].newProduct,
|
|
2371
|
+
newProductDetail: this.vasGrist.dirtyData.records[firstIndex].newProductDetail,
|
|
2372
|
+
newSku: this.vasGrist.dirtyData.records[firstIndex].newSku,
|
|
2373
|
+
newUom: this.vasGrist.dirtyData.records[firstIndex].newUom,
|
|
2374
|
+
newUomValue: this.vasGrist.dirtyData.records[firstIndex].newUomValue,
|
|
2375
|
+
vasRemark: a?.vasRemark ? a.vasRemark : '',
|
|
2337
2376
|
cuFlag: '+',
|
|
2338
2377
|
__dirty__: '+',
|
|
2339
2378
|
__dirtyfields__: {
|
|
@@ -2357,6 +2396,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2357
2396
|
name: e.detail[i].name,
|
|
2358
2397
|
vasName: e.detail[i].name
|
|
2359
2398
|
},
|
|
2399
|
+
vasRemark: a?.vasRemark ? a.vasRemark : '',
|
|
2360
2400
|
cuFlag: '+',
|
|
2361
2401
|
__dirty__: '+',
|
|
2362
2402
|
__dirtyfields__: {
|
|
@@ -2476,6 +2516,14 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2476
2516
|
imex: { header: i18next.t('field.vas_qty'), key: 'vasQty', width: 25, type: 'integer' },
|
|
2477
2517
|
width: 150
|
|
2478
2518
|
},
|
|
2519
|
+
{
|
|
2520
|
+
type: 'integer',
|
|
2521
|
+
name: 'newBatchId',
|
|
2522
|
+
header: i18next.t('field.batch_no_(new_sku)'),
|
|
2523
|
+
sortable: false,
|
|
2524
|
+
imex: { header: i18next.t('field.batch_no_(new_sku)'), key: 'newBatchId', width: 25, type: 'string' },
|
|
2525
|
+
width: 150
|
|
2526
|
+
},
|
|
2479
2527
|
{
|
|
2480
2528
|
type: 'string',
|
|
2481
2529
|
name: 'newSku',
|
|
@@ -2525,6 +2573,15 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2525
2573
|
type: 'string'
|
|
2526
2574
|
},
|
|
2527
2575
|
width: 150
|
|
2576
|
+
},
|
|
2577
|
+
{
|
|
2578
|
+
type: 'string',
|
|
2579
|
+
name: 'vasRemark',
|
|
2580
|
+
header: i18next.t('field.remark'),
|
|
2581
|
+
record: { align: 'center' },
|
|
2582
|
+
sortable: false,
|
|
2583
|
+
imex: { header: i18next.t('field.remark'), key: 'vasRemark', width: 75, type: 'string' },
|
|
2584
|
+
width: 200
|
|
2528
2585
|
}
|
|
2529
2586
|
]
|
|
2530
2587
|
}
|
|
@@ -2599,8 +2656,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
2599
2656
|
changedColumn === 'newUom' ||
|
|
2600
2657
|
changedColumn === 'newUomValue' ||
|
|
2601
2658
|
changedColumn === 'newUnitUomValue' ||
|
|
2602
|
-
changedColumn === 'outputQty'
|
|
2603
|
-
changedColumn === 'remark'
|
|
2659
|
+
changedColumn === 'outputQty'
|
|
2604
2660
|
)
|
|
2605
2661
|
if (!changeRecord.productId && !changeRecord.productDetailId && !changeRecord.batchId) {
|
|
2606
2662
|
delete event.detail.after[event.detail.column.name]
|
|
@@ -3142,7 +3198,10 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
3142
3198
|
this._validateVas()
|
|
3143
3199
|
let orderVasPatch = []
|
|
3144
3200
|
let orderVasItemPatch = []
|
|
3145
|
-
let vasStatus =
|
|
3201
|
+
let vasStatus =
|
|
3202
|
+
this._releaseOrder.status === 'READY_TO_PICK' || this._releaseOrder.status === 'PICKING'
|
|
3203
|
+
? 'READY_TO_PROCESS'
|
|
3204
|
+
: 'PENDING_RECEIVE'
|
|
3146
3205
|
|
|
3147
3206
|
orderVasPatch = this.vasGrist.dirtyData.records.filter(p => p.product)
|
|
3148
3207
|
// orderVasItemPatch = this.vasGrist.dirtyData.records.filter(
|
|
@@ -3155,7 +3214,7 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
3155
3214
|
|
|
3156
3215
|
orderVasPatch = orderVasPatch.map(ov => {
|
|
3157
3216
|
return {
|
|
3158
|
-
id: ov
|
|
3217
|
+
id: ov?.id,
|
|
3159
3218
|
bizplace: !ov.id && ov.cuFlag !== '-' ? this._releaseOrder.bizplace : undefined,
|
|
3160
3219
|
releaseGood: !ov.id && ov.cuFlag !== '-' ? { id: this._releaseOrderId } : undefined,
|
|
3161
3220
|
batchId: ov.batchId,
|
|
@@ -3168,21 +3227,22 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
3168
3227
|
packingType: ov.packingType,
|
|
3169
3228
|
uom: ov.uom,
|
|
3170
3229
|
uomValue: ov.uomValue,
|
|
3171
|
-
newProduct: ov
|
|
3172
|
-
newProductDetail: ov
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3230
|
+
newProduct: ov?.newProductId,
|
|
3231
|
+
newProductDetail: ov?.newProductDetailId,
|
|
3232
|
+
newBatchId: ov?.newBatchId,
|
|
3233
|
+
newPackingType: ov?.newPackingType,
|
|
3234
|
+
newUom: ov?.newUom,
|
|
3235
|
+
newUomValue: parseFloat(ov?.newUomValue),
|
|
3236
|
+
outputQty: ov?.outputQty ? ov.outputQty : ov.qty,
|
|
3178
3237
|
orderVasItemsPatch: this.vasGrist.dirtyData.records.reduce((acc, cur) => {
|
|
3179
3238
|
if (cur.group === ov.group) {
|
|
3180
3239
|
return [
|
|
3181
3240
|
...acc,
|
|
3182
3241
|
{
|
|
3183
|
-
id: cur
|
|
3242
|
+
id: cur?.orderVasItemId,
|
|
3184
3243
|
vas: { id: cur.vas.id, name: cur.vas.name },
|
|
3185
3244
|
vasQty: cur.vasQty,
|
|
3245
|
+
vasRemark: cur?.vasRemark,
|
|
3186
3246
|
cuFlag: ov.cuFlag ? ov.cuFlag : 'M'
|
|
3187
3247
|
}
|
|
3188
3248
|
]
|
|
@@ -3297,6 +3357,9 @@ class ReleaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
3297
3357
|
i18next.t('text.negative_value_field', { field: i18next.t('field.uom_value_sku', { sku: 'NEW SKU' }) })
|
|
3298
3358
|
)
|
|
3299
3359
|
}
|
|
3360
|
+
if (!record?.newBatchId && record?.newProductId) {
|
|
3361
|
+
throw new Error(i18next.t('text.please_insert_batch_no'))
|
|
3362
|
+
}
|
|
3300
3363
|
})
|
|
3301
3364
|
}
|
|
3302
3365
|
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import '@things-factory/grist-ui'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
|
+
|
|
6
|
+
import { MultiColumnFormStyles } from '@things-factory/form-ui'
|
|
7
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
8
|
+
import { client, CustomAlert } from '@things-factory/shell'
|
|
9
|
+
import { isMobileDevice } from '@things-factory/utils'
|
|
10
|
+
import { VAS_TYPES } from '@things-factory/sales-ui/client/constants/vas'
|
|
11
|
+
|
|
12
|
+
class orderVasPopup extends localize(i18next)(LitElement) {
|
|
13
|
+
static get properties() {
|
|
14
|
+
return {
|
|
15
|
+
vasConfig: Object,
|
|
16
|
+
vasData: Object,
|
|
17
|
+
type: String,
|
|
18
|
+
bizplaceIds: Array,
|
|
19
|
+
selectedVasData: Object
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static get styles() {
|
|
24
|
+
return [
|
|
25
|
+
css`
|
|
26
|
+
:host {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
background-color: white;
|
|
31
|
+
}
|
|
32
|
+
.container {
|
|
33
|
+
flex: 1;
|
|
34
|
+
display: flex;
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
min-height: 20vh;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.grist {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
flex: 1;
|
|
43
|
+
overflow-y: auto;
|
|
44
|
+
}
|
|
45
|
+
.grist h2 mwc-icon {
|
|
46
|
+
vertical-align: middle;
|
|
47
|
+
margin: var(--grist-title-icon-margin);
|
|
48
|
+
font-size: var(--grist-title-icon-size);
|
|
49
|
+
color: var(--grist-title-icon-color);
|
|
50
|
+
}
|
|
51
|
+
data-grist {
|
|
52
|
+
overflow-y: hidden;
|
|
53
|
+
flex: 1;
|
|
54
|
+
}
|
|
55
|
+
h2 {
|
|
56
|
+
padding: var(--subtitle-padding);
|
|
57
|
+
font: var(--subtitle-font);
|
|
58
|
+
color: var(--subtitle-text-color);
|
|
59
|
+
}
|
|
60
|
+
h3 {
|
|
61
|
+
font: var(--subtitle-font);
|
|
62
|
+
color: var(--subtitle-text-color);
|
|
63
|
+
text-align: center;
|
|
64
|
+
}
|
|
65
|
+
.grist h2 {
|
|
66
|
+
font: var(--grist-title-font);
|
|
67
|
+
}
|
|
68
|
+
.button-container {
|
|
69
|
+
padding: var(--button-container-padding);
|
|
70
|
+
margin: var(--button-container-margin);
|
|
71
|
+
text-align: var(--button-container-align);
|
|
72
|
+
background-color: var(--button-container-background);
|
|
73
|
+
height: var(--button-container-height);
|
|
74
|
+
}
|
|
75
|
+
`
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
constructor() {
|
|
80
|
+
super()
|
|
81
|
+
this.bizplaceIds = []
|
|
82
|
+
this.vasData = { records: [], total: 0 }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
render() {
|
|
86
|
+
return html`
|
|
87
|
+
<div class="container">
|
|
88
|
+
<div class="grist">
|
|
89
|
+
<search-form id="vas" .fields=${this._vasSearchFields} @submit=${() => this.vasGrist.fetch()}></search-form>
|
|
90
|
+
<h2><mwc-icon>arrow_forward</mwc-icon>${i18next.t('title.vas')}</h2>
|
|
91
|
+
<data-grist
|
|
92
|
+
id="vas"
|
|
93
|
+
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
94
|
+
.config=${this.vasConfig}
|
|
95
|
+
.fetchHandler="${this.fetchVas.bind(this)}"
|
|
96
|
+
></data-grist>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div class="button-container">
|
|
101
|
+
<mwc-button @click=${this._cancel.bind(this)} label="${`${i18next.t('button.cancel')}`}" raised></mwc-button>
|
|
102
|
+
|
|
103
|
+
<mwc-button @click=${this._selectVas.bind(this)} label="${`${i18next.t('button.select')}`}" raised></mwc-button>
|
|
104
|
+
</div>
|
|
105
|
+
`
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
firstUpdated() {
|
|
109
|
+
this.vasConfig = {
|
|
110
|
+
list: {
|
|
111
|
+
fields: ['name', 'description', 'type']
|
|
112
|
+
},
|
|
113
|
+
pagination: { pages: [10, 20, 50, 100] },
|
|
114
|
+
rows: {
|
|
115
|
+
selectable: {
|
|
116
|
+
multiple: true
|
|
117
|
+
},
|
|
118
|
+
appendable: false
|
|
119
|
+
},
|
|
120
|
+
columns: [
|
|
121
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
122
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
123
|
+
{
|
|
124
|
+
type: 'string',
|
|
125
|
+
name: 'name',
|
|
126
|
+
header: i18next.t('field.name'),
|
|
127
|
+
width: 300
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
type: 'string',
|
|
131
|
+
name: 'description',
|
|
132
|
+
header: i18next.t('field.description'),
|
|
133
|
+
width: 350
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'string',
|
|
137
|
+
name: 'type',
|
|
138
|
+
header: i18next.t('field.type'),
|
|
139
|
+
width: 350
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const type = VAS_TYPES
|
|
145
|
+
|
|
146
|
+
this._vasSearchFields = [
|
|
147
|
+
{
|
|
148
|
+
label: i18next.t('label.vas'),
|
|
149
|
+
name: 'vas_info',
|
|
150
|
+
type: 'text',
|
|
151
|
+
props: { searchOper: 'i_like' }
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
label: i18next.t('field.type'),
|
|
155
|
+
name: 'type',
|
|
156
|
+
type: 'select',
|
|
157
|
+
options: [
|
|
158
|
+
{ value: '' },
|
|
159
|
+
...Object.values(type)
|
|
160
|
+
.map(type => {
|
|
161
|
+
return {
|
|
162
|
+
name: type,
|
|
163
|
+
value: type
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
.sort()
|
|
167
|
+
],
|
|
168
|
+
props: { searchOper: 'eq' }
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
get vasGrist() {
|
|
174
|
+
return this.shadowRoot.querySelector('data-grist#vas')
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
get vasSearchForm() {
|
|
178
|
+
return this.shadowRoot.querySelector('search-form#vas')
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async fetchVas({ page, limit, sorters = [{ name: 'name' }] }) {
|
|
182
|
+
let filters = await this.vasSearchForm.getQueryFilters()
|
|
183
|
+
|
|
184
|
+
if (this.bizplaceIds && this.bizplaceIds.length > 0)
|
|
185
|
+
filters = [...filters, { name: 'bizplace_id', operator: 'in', value: this.bizplaceIds }]
|
|
186
|
+
|
|
187
|
+
const response = await client.query({
|
|
188
|
+
query: gql`
|
|
189
|
+
query vass($filters: [Filter!]!, $pagination: Pagination, $sortings: [Sorting!]!) {
|
|
190
|
+
vass(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
191
|
+
items {
|
|
192
|
+
id
|
|
193
|
+
name
|
|
194
|
+
description
|
|
195
|
+
type
|
|
196
|
+
}
|
|
197
|
+
total
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
`,
|
|
201
|
+
variables: { filters, pagination: { page, limit }, sortings: sorters }
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
this.vasData = {
|
|
205
|
+
total: response.data.vass.total || 0,
|
|
206
|
+
records:
|
|
207
|
+
response.data.vass.items.map(res => {
|
|
208
|
+
return {
|
|
209
|
+
...res
|
|
210
|
+
}
|
|
211
|
+
}) || []
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
total: this.vasData.total,
|
|
216
|
+
records: this.vasData?.records
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
async _selectVas() {
|
|
221
|
+
let selectedVas = this.vasGrist.dirtyData.records.filter(vas => vas?.__selected__ === true)
|
|
222
|
+
|
|
223
|
+
if (selectedVas?.length > 0) {
|
|
224
|
+
this.dispatchEvent(new CustomEvent('selected', { detail: selectedVas }))
|
|
225
|
+
history.back()
|
|
226
|
+
} else {
|
|
227
|
+
document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.nothing_selected') } }))
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
_cancel() {
|
|
232
|
+
history.back()
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
window.customElements.define('order-vas-popup', orderVasPopup)
|