@things-factory/biz-ui 4.3.740 → 4.3.745
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/contact-point-list.js +109 -1
- package/package.json +10 -10
- package/translations/en.json +3 -0
- package/translations/ja.json +3 -1
- package/translations/ko.json +3 -1
- package/translations/ms.json +3 -1
- package/translations/zh.json +3 -1
|
@@ -351,6 +351,25 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
351
351
|
},
|
|
352
352
|
width: 150
|
|
353
353
|
},
|
|
354
|
+
{
|
|
355
|
+
type: 'string',
|
|
356
|
+
name: 'businessRestDay',
|
|
357
|
+
record: {
|
|
358
|
+
editable: true,
|
|
359
|
+
validation: (after, before, record, column) => {
|
|
360
|
+
const validation = this._validateBusinessRestDay(after, true)
|
|
361
|
+
return validation.valid
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
header: i18next.t('field.business_rest_day'),
|
|
365
|
+
imex: {
|
|
366
|
+
header: i18next.t('field.business_rest_day'),
|
|
367
|
+
key: 'businessRestDay',
|
|
368
|
+
width: 40,
|
|
369
|
+
type: 'string'
|
|
370
|
+
},
|
|
371
|
+
width: 200
|
|
372
|
+
},
|
|
354
373
|
{
|
|
355
374
|
name: 'type',
|
|
356
375
|
record: { editable: true },
|
|
@@ -393,6 +412,49 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
393
412
|
}
|
|
394
413
|
}
|
|
395
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Validates businessRestDay value
|
|
417
|
+
* @param {any} value - The value to validate
|
|
418
|
+
* @param {boolean} allowEmpty - Whether to allow empty/null/undefined values (default: true)
|
|
419
|
+
* @returns {{valid: boolean, error?: string}} - Validation result with optional error message
|
|
420
|
+
*/
|
|
421
|
+
_validateBusinessRestDay(value, allowEmpty = true) {
|
|
422
|
+
const VALID_DAYS = ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY']
|
|
423
|
+
|
|
424
|
+
// Allow empty/null values if allowed
|
|
425
|
+
if (allowEmpty && (value === null || value === undefined || value === '')) {
|
|
426
|
+
return { valid: true }
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// If not allowed and empty, return error
|
|
430
|
+
if (!allowEmpty && (value === null || value === undefined || value === '')) {
|
|
431
|
+
return { valid: false, error: i18next.t('field.business_rest_day') + ' is required' }
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Check if it's a string
|
|
435
|
+
if (typeof value !== 'string') {
|
|
436
|
+
return {
|
|
437
|
+
valid: false,
|
|
438
|
+
error: i18next.t('field.business_rest_day') + ` must be a string. Valid options: ${VALID_DAYS.join(', ')}`
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Split by comma and validate each day
|
|
443
|
+
const days = value.split(',').map(day => day.trim().toUpperCase())
|
|
444
|
+
const invalidDays = days.filter(day => !VALID_DAYS.includes(day))
|
|
445
|
+
|
|
446
|
+
if (invalidDays.length > 0) {
|
|
447
|
+
return {
|
|
448
|
+
valid: false,
|
|
449
|
+
error:
|
|
450
|
+
i18next.t('field.business_rest_day') +
|
|
451
|
+
` contains invalid value(s): ${invalidDays.join(', ')}. Valid options: ${VALID_DAYS.join(', ')}`
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return { valid: true }
|
|
456
|
+
}
|
|
457
|
+
|
|
396
458
|
/**
|
|
397
459
|
* Validates releaseShelfLife value
|
|
398
460
|
* @param {any} value - The value to validate
|
|
@@ -446,6 +508,30 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
446
508
|
this.showToast(validation.error)
|
|
447
509
|
}
|
|
448
510
|
}
|
|
511
|
+
|
|
512
|
+
// Handle businessRestDay validation
|
|
513
|
+
if (column.name === 'businessRestDay') {
|
|
514
|
+
const validation = this._validateBusinessRestDay(after, true)
|
|
515
|
+
if (!validation.valid) {
|
|
516
|
+
// Revert to previous value
|
|
517
|
+
this.dataGrist._data.records[row][column.name] = before
|
|
518
|
+
this.data = {
|
|
519
|
+
...this.dataGrist._data
|
|
520
|
+
}
|
|
521
|
+
// Show error message
|
|
522
|
+
this.showToast(validation.error)
|
|
523
|
+
} else if (validation.valid && after) {
|
|
524
|
+
// Normalize to uppercase and trim
|
|
525
|
+
const normalized = after
|
|
526
|
+
.split(',')
|
|
527
|
+
.map(day => day.trim().toUpperCase())
|
|
528
|
+
.join(',')
|
|
529
|
+
this.dataGrist._data.records[row][column.name] = normalized
|
|
530
|
+
this.data = {
|
|
531
|
+
...this.dataGrist._data
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
449
535
|
}
|
|
450
536
|
|
|
451
537
|
_normalizeStringFields(record) {
|
|
@@ -467,7 +553,8 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
467
553
|
'state',
|
|
468
554
|
'country',
|
|
469
555
|
'billingAddress',
|
|
470
|
-
'type'
|
|
556
|
+
'type',
|
|
557
|
+
'businessRestDay'
|
|
471
558
|
]
|
|
472
559
|
stringFields.forEach(field => {
|
|
473
560
|
if (normalized[field] && typeof normalized[field] === 'object' && !Array.isArray(normalized[field])) {
|
|
@@ -568,6 +655,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
568
655
|
description
|
|
569
656
|
type
|
|
570
657
|
releaseShelfLife
|
|
658
|
+
businessRestDay
|
|
571
659
|
updatedAt
|
|
572
660
|
bizplace {
|
|
573
661
|
id
|
|
@@ -648,6 +736,18 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
648
736
|
}
|
|
649
737
|
}
|
|
650
738
|
|
|
739
|
+
// Validate businessRestDay: must be valid day(s)
|
|
740
|
+
const businessRestDayValidation = this._validateBusinessRestDay(itm.businessRestDay, true)
|
|
741
|
+
if (!businessRestDayValidation.valid) {
|
|
742
|
+
itm.error = true
|
|
743
|
+
if (!errors.find(err => err.type == 'businessRestDay')) {
|
|
744
|
+
errors.push({
|
|
745
|
+
type: 'businessRestDay',
|
|
746
|
+
value: businessRestDayValidation.error
|
|
747
|
+
})
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
651
751
|
return itm
|
|
652
752
|
})
|
|
653
753
|
|
|
@@ -746,6 +846,14 @@ export class ContactPointList extends localize(i18next)(PageView) {
|
|
|
746
846
|
}
|
|
747
847
|
}
|
|
748
848
|
|
|
849
|
+
// Validate businessRestDay: must be valid day(s)
|
|
850
|
+
const businessRestDayValidation = this._validateBusinessRestDay(item.businessRestDay, true)
|
|
851
|
+
if (!businessRestDayValidation.valid) {
|
|
852
|
+
if (!errors.find(error => error.type == 'businessRestDay')) {
|
|
853
|
+
errors.push({ type: 'businessRestDay', value: businessRestDayValidation.error })
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
749
857
|
return item
|
|
750
858
|
})
|
|
751
859
|
|
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.745",
|
|
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.
|
|
28
|
-
"@things-factory/form-ui": "^4.3.
|
|
29
|
-
"@things-factory/grist-ui": "^4.3.
|
|
30
|
-
"@things-factory/i18n-base": "^4.3.
|
|
31
|
-
"@things-factory/import-ui": "^4.3.
|
|
32
|
-
"@things-factory/layout-base": "^4.3.
|
|
33
|
-
"@things-factory/shell": "^4.3.
|
|
26
|
+
"@things-factory/biz-base": "^4.3.745",
|
|
27
|
+
"@things-factory/code-base": "^4.3.743",
|
|
28
|
+
"@things-factory/form-ui": "^4.3.743",
|
|
29
|
+
"@things-factory/grist-ui": "^4.3.743",
|
|
30
|
+
"@things-factory/i18n-base": "^4.3.743",
|
|
31
|
+
"@things-factory/import-ui": "^4.3.743",
|
|
32
|
+
"@things-factory/layout-base": "^4.3.743",
|
|
33
|
+
"@things-factory/shell": "^4.3.743"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "89c8b3c8c7ac589d4f547a984c1027a6f509671f"
|
|
36
36
|
}
|
package/translations/en.json
CHANGED
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"text.bizplace_is_not_selected": "customer is not selected",
|
|
12
12
|
"label.account_no": "account no",
|
|
13
13
|
"text.invalid_form": "invalid form",
|
|
14
|
+
"field.business_rest_day": "business rest day",
|
|
15
|
+
"field.business_rest_day_required": "business rest day is required",
|
|
16
|
+
"field.business_rest_day_must_be_string": "business rest day must be a string",
|
|
14
17
|
|
|
15
18
|
"field.contact_point_customer_name": "Customer Name",
|
|
16
19
|
"field.contact_point_company_name": "Company Name",
|
package/translations/ja.json
CHANGED
|
@@ -9,5 +9,7 @@
|
|
|
9
9
|
"title.contact_points": "[jp]contact points",
|
|
10
10
|
"title.select_supplier": "[jp]select supplier",
|
|
11
11
|
"text.bizplace_is_not_selected": "[jp]customer is not selected",
|
|
12
|
-
"label.account_no": "[jp]account no"
|
|
12
|
+
"label.account_no": "[jp]account no",
|
|
13
|
+
"field.business_rest_day": "[jp]business rest day",
|
|
14
|
+
"field.business_rest_day_required": "[jp]business rest day is required"
|
|
13
15
|
}
|
package/translations/ko.json
CHANGED
|
@@ -9,5 +9,7 @@
|
|
|
9
9
|
"title.contact_points": "[ko]contact points",
|
|
10
10
|
"title.select_supplier": "[ko]select supplier",
|
|
11
11
|
"text.bizplace_is_not_selected": "[ko]customer is not selected",
|
|
12
|
-
"label.account_no": "[ko]account no"
|
|
12
|
+
"label.account_no": "[ko]account no",
|
|
13
|
+
"field.business_rest_day": "[ko]business rest day",
|
|
14
|
+
"field.business_rest_day_required": "[ko]business rest day is required"
|
|
13
15
|
}
|
package/translations/ms.json
CHANGED
|
@@ -9,5 +9,7 @@
|
|
|
9
9
|
"title.contact_points": "[ms]contact points",
|
|
10
10
|
"title.select_supplier": "[ms]select supplier",
|
|
11
11
|
"text.bizplace_is_not_selected": "[ms]customer is not selected",
|
|
12
|
-
"label.account_no": "[ms]account no"
|
|
12
|
+
"label.account_no": "[ms]account no",
|
|
13
|
+
"field.business_rest_day": "[ms]business rest day",
|
|
14
|
+
"field.business_rest_day_required": "[ms]business rest day is required"
|
|
13
15
|
}
|
package/translations/zh.json
CHANGED
|
@@ -9,5 +9,7 @@
|
|
|
9
9
|
"title.contact_points": "[zh]contact points",
|
|
10
10
|
"title.select_supplier": "[zh]select supplier",
|
|
11
11
|
"text.bizplace_is_not_selected": "[zh]customer is not selected",
|
|
12
|
-
"label.account_no": "[zh]account no"
|
|
12
|
+
"label.account_no": "[zh]account no",
|
|
13
|
+
"field.business_rest_day": "[zh]business rest day",
|
|
14
|
+
"field.business_rest_day_required": "[zh]business rest day is required"
|
|
13
15
|
}
|