@things-factory/import-ui 4.3.642 → 4.3.671

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.
@@ -1,10 +1,11 @@
1
1
  import '@material/mwc-button/mwc-button'
2
2
  import '@things-factory/grist-ui'
3
3
  import { i18next, localize } from '@things-factory/i18n-base'
4
- import { CustomAlert } from '@things-factory/shell'
4
+ import { CustomAlert,client } from '@things-factory/shell'
5
5
  import { ScrollbarStyles } from '@things-factory/styles'
6
6
  import { isMobileDevice } from '@things-factory/utils'
7
7
  import { css, html, LitElement } from 'lit'
8
+ import gql from 'graphql-tag'
8
9
 
9
10
  class ImportPopUp extends localize(i18next)(LitElement) {
10
11
  static get properties() {
@@ -12,7 +13,8 @@ class ImportPopUp extends localize(i18next)(LitElement) {
12
13
  importHandler: Object,
13
14
  config: Object,
14
15
  _config: Object,
15
- records: Array
16
+ records: Array,
17
+ enableDirectInbound: Boolean
16
18
  }
17
19
  }
18
20
 
@@ -25,6 +27,8 @@ class ImportPopUp extends localize(i18next)(LitElement) {
25
27
  flex-direction: column;
26
28
  overflow: hidden;
27
29
  background-color: white;
30
+ --grid-record-emphasized-background-color: #ffdbdb;
31
+ --grid-record-emphasized-color: #703f3f;
28
32
  }
29
33
 
30
34
  .grist {
@@ -102,15 +106,65 @@ class ImportPopUp extends localize(i18next)(LitElement) {
102
106
  pagination: { infinite: true },
103
107
  columns: [{ type: 'gutter', gutterName: 'row-selector', multiple: true }, ...columns]
104
108
  }
109
+ if(this.enableDirectInbound){
110
+ this._config.rows = {
111
+ appendable: false,
112
+ classifier: (record, rowIndex) => {
113
+ return {
114
+ emphasized: record.errMsg && record.errMsg != ''
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ this.dataGrist.data = {
121
+ records: this.records,
122
+ total: this.records.length
105
123
  }
106
124
  }
107
125
 
108
- firstUpdated() {
126
+ async firstUpdated() {
109
127
  this.dataGrist.data = {
110
128
  records: this.records,
111
129
  total: this.records.length
112
130
  }
113
- }
131
+ if (this.enableDirectInbound){
132
+ try{
133
+ const response = await client.query({
134
+ query: gql`
135
+ query bulkUploadValidateOrderProducts($orderProducts: [NewOrderProduct!]) {
136
+ bulkUploadValidateOrderProducts(orderProducts: $orderProducts) {
137
+ packingType
138
+ uom
139
+ uomValue
140
+ packQty
141
+ palletQty
142
+ manufactureDate
143
+ batchId
144
+ batchIdRef
145
+ unitPrice
146
+ remark
147
+ productSKU
148
+ warehouseName
149
+ location{
150
+ id
151
+ name
152
+ }
153
+ errMsg
154
+ }
155
+ }
156
+ `,
157
+ variables: { orderProducts: this.records }
158
+ })
159
+ if (!response.errors) {
160
+ this.records = response.data.bulkUploadValidateOrderProducts
161
+ this.records.length = response.data.bulkUploadValidateOrderProducts.length
162
+ }
163
+ } catch (e) {
164
+ console.error(e)
165
+ }
166
+ }
167
+ }
114
168
 
115
169
  getCurrentRecord() {
116
170
  // 1. Check whether there are selected records
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/import-ui",
3
- "version": "4.3.642",
3
+ "version": "4.3.671",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -23,11 +23,11 @@
23
23
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
24
24
  },
25
25
  "dependencies": {
26
- "@things-factory/context-base": "^4.3.591",
27
- "@things-factory/grist-ui": "^4.3.642",
28
- "@things-factory/i18n-base": "^4.3.591",
29
- "@things-factory/import-base": "^4.3.591",
30
- "@things-factory/layout-base": "^4.3.591"
26
+ "@things-factory/context-base": "^4.3.671",
27
+ "@things-factory/grist-ui": "^4.3.671",
28
+ "@things-factory/i18n-base": "^4.3.671",
29
+ "@things-factory/import-base": "^4.3.671",
30
+ "@things-factory/layout-base": "^4.3.671"
31
31
  },
32
- "gitHead": "7796a1553e51d21f017f3746f80f25cae9e1c695"
32
+ "gitHead": "ef524cb207378186ec71917d9a8546363d4300b2"
33
33
  }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":""}