@things-factory/biz-ui 4.3.131 → 4.3.139
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.
|
@@ -4,6 +4,7 @@ import _ from 'lodash'
|
|
|
4
4
|
|
|
5
5
|
import gql from 'graphql-tag'
|
|
6
6
|
import { css, html } from 'lit'
|
|
7
|
+
import isEmpty from 'lodash-es/isEmpty'
|
|
7
8
|
|
|
8
9
|
import { getCodeByName } from '@things-factory/code-base'
|
|
9
10
|
import { i18next, localize } from '@things-factory/i18n-base'
|
|
@@ -87,11 +88,11 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
87
88
|
|
|
88
89
|
return patch
|
|
89
90
|
})
|
|
90
|
-
this._validateImport(patches)
|
|
91
|
+
await this._validateImport(patches)
|
|
91
92
|
await this._saveContactPoints(patches)
|
|
92
93
|
history.back()
|
|
93
94
|
} catch (e) {
|
|
94
|
-
this.showToast(e)
|
|
95
|
+
this.showToast(e.message)
|
|
95
96
|
}
|
|
96
97
|
})
|
|
97
98
|
}
|
|
@@ -138,6 +139,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
138
139
|
]
|
|
139
140
|
|
|
140
141
|
this.config = {
|
|
142
|
+
pagination: { limit: 50, pages: [50, 100, 200, 500] },
|
|
141
143
|
rows: {
|
|
142
144
|
selectable: {
|
|
143
145
|
multiple: true
|
|
@@ -157,7 +159,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
157
159
|
width: 40,
|
|
158
160
|
type: 'string'
|
|
159
161
|
},
|
|
160
|
-
header: i18next.t('field.contact_point_customer_name')
|
|
162
|
+
header: `*${i18next.t('field.contact_point_customer_name')}`,
|
|
161
163
|
width: 250
|
|
162
164
|
},
|
|
163
165
|
{
|
|
@@ -192,7 +194,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
192
194
|
name: 'companyName',
|
|
193
195
|
record: { editable: true },
|
|
194
196
|
imex: {
|
|
195
|
-
header:
|
|
197
|
+
header: i18next.t('field.contact_point_other_company_name'),
|
|
196
198
|
key: 'companyName',
|
|
197
199
|
width: 40,
|
|
198
200
|
type: 'string'
|
|
@@ -217,7 +219,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
217
219
|
type: 'string',
|
|
218
220
|
name: 'email',
|
|
219
221
|
record: { editable: true },
|
|
220
|
-
imex: { header:
|
|
222
|
+
imex: { header: i18next.t('field.contact_point_email'), key: 'email', width: 40, type: 'string' },
|
|
221
223
|
header: i18next.t('field.contact_point_email'),
|
|
222
224
|
width: 120
|
|
223
225
|
},
|
|
@@ -234,7 +236,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
234
236
|
name: 'phone',
|
|
235
237
|
record: { editable: true },
|
|
236
238
|
imex: { header: '*' + i18next.t('field.contact_point_phone'), key: 'phone', width: 40, type: 'string' },
|
|
237
|
-
header: i18next.t('field.contact_point_phone'),
|
|
239
|
+
header: '*' + i18next.t('field.contact_point_phone'),
|
|
238
240
|
width: 120
|
|
239
241
|
},
|
|
240
242
|
{
|
|
@@ -242,7 +244,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
242
244
|
name: 'accountNo',
|
|
243
245
|
record: { editable: true },
|
|
244
246
|
imex: {
|
|
245
|
-
header:
|
|
247
|
+
header: i18next.t('field.contact_point_account_no'),
|
|
246
248
|
key: 'accountNo',
|
|
247
249
|
width: 40,
|
|
248
250
|
type: 'string'
|
|
@@ -254,8 +256,13 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
254
256
|
type: 'string',
|
|
255
257
|
name: 'address',
|
|
256
258
|
record: { editable: true },
|
|
257
|
-
imex: {
|
|
258
|
-
|
|
259
|
+
imex: {
|
|
260
|
+
header: '*' + i18next.t('field.contact_point_company_address'),
|
|
261
|
+
key: 'address',
|
|
262
|
+
width: 40,
|
|
263
|
+
type: 'string'
|
|
264
|
+
},
|
|
265
|
+
header: '*' + i18next.t('field.contact_point_company_address'),
|
|
259
266
|
width: 300
|
|
260
267
|
},
|
|
261
268
|
{
|
|
@@ -300,7 +307,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
300
307
|
name: 'billingAddress',
|
|
301
308
|
record: { editable: true },
|
|
302
309
|
imex: {
|
|
303
|
-
header:
|
|
310
|
+
header: i18next.t('field.contact_point_billing_address'),
|
|
304
311
|
key: 'billingAddress',
|
|
305
312
|
width: 40,
|
|
306
313
|
type: 'string'
|
|
@@ -311,7 +318,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
311
318
|
{
|
|
312
319
|
name: 'type',
|
|
313
320
|
record: { editable: true },
|
|
314
|
-
header: i18next.t('field.contact_point_type'),
|
|
321
|
+
header: '*' + i18next.t('field.contact_point_type'),
|
|
315
322
|
type: 'code',
|
|
316
323
|
imex: {
|
|
317
324
|
header: '*' + i18next.t('field.contact_point_type'),
|
|
@@ -431,6 +438,8 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
431
438
|
return this.showToast(i18next.t('text.nothing_changed'))
|
|
432
439
|
}
|
|
433
440
|
|
|
441
|
+
this._validate()
|
|
442
|
+
|
|
434
443
|
const response = await client.mutate({
|
|
435
444
|
mutation: gql`
|
|
436
445
|
mutation updateMultipleContactPoint($patches: [ContactPointPatch!]!) {
|
|
@@ -448,7 +457,31 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
448
457
|
this.dataGrist.fetch()
|
|
449
458
|
}
|
|
450
459
|
} catch (error) {
|
|
451
|
-
this.showToast(error)
|
|
460
|
+
this.showToast(error.message)
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
_validate() {
|
|
465
|
+
let errors = []
|
|
466
|
+
|
|
467
|
+
let data = this.dataGrist._data.records.map(itm => {
|
|
468
|
+
itm.error = false
|
|
469
|
+
|
|
470
|
+
if (isEmpty(itm.name) || '') {
|
|
471
|
+
itm.error = true
|
|
472
|
+
if (!errors.find(err => err.type == 'customerName'))
|
|
473
|
+
errors.push({ type: 'customerName', value: 'customer name is required' })
|
|
474
|
+
}
|
|
475
|
+
return itm
|
|
476
|
+
})
|
|
477
|
+
|
|
478
|
+
if (errors.length > 0) {
|
|
479
|
+
this._data = {
|
|
480
|
+
...this.dataGrist.dirtyData,
|
|
481
|
+
records: data
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
throw new Error(errors.map(itm => itm.value).join(', '))
|
|
452
485
|
}
|
|
453
486
|
}
|
|
454
487
|
|
|
@@ -489,7 +522,8 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
489
522
|
}
|
|
490
523
|
}
|
|
491
524
|
|
|
492
|
-
_validateImport(data) {
|
|
525
|
+
async _validateImport(data) {
|
|
526
|
+
const contactTypes = await getCodeByName('CONTACT_TYPES')
|
|
493
527
|
let errors = []
|
|
494
528
|
|
|
495
529
|
data = data.map(item => {
|
|
@@ -523,6 +557,11 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
523
557
|
}
|
|
524
558
|
}
|
|
525
559
|
|
|
560
|
+
let foundContactTypes = contactTypes.find(exist => exist.name == item.type)
|
|
561
|
+
if (!foundContactTypes) {
|
|
562
|
+
throw new Error(i18next.t('text.contact_type_does_not_exist'))
|
|
563
|
+
}
|
|
564
|
+
|
|
526
565
|
return item
|
|
527
566
|
})
|
|
528
567
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/biz-ui",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.139",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@things-factory/biz-base": "^4.3.
|
|
27
|
-
"@things-factory/code-base": "^4.3.
|
|
26
|
+
"@things-factory/biz-base": "^4.3.138",
|
|
27
|
+
"@things-factory/code-base": "^4.3.138",
|
|
28
28
|
"@things-factory/form-ui": "^4.3.131",
|
|
29
|
-
"@things-factory/grist-ui": "^4.3.
|
|
29
|
+
"@things-factory/grist-ui": "^4.3.138",
|
|
30
30
|
"@things-factory/i18n-base": "^4.3.131",
|
|
31
|
-
"@things-factory/import-ui": "^4.3.
|
|
31
|
+
"@things-factory/import-ui": "^4.3.138",
|
|
32
32
|
"@things-factory/layout-base": "^4.3.131",
|
|
33
33
|
"@things-factory/shell": "^4.3.131"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "82a27c0caaf2f2c98cd094b92fc603bf768d2513"
|
|
36
36
|
}
|