@things-factory/product-ui 4.3.156 → 4.3.161
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.
|
@@ -541,11 +541,8 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
541
541
|
let data = this._updateRowOption(response.data.productDetails.items)
|
|
542
542
|
|
|
543
543
|
data.map(item => {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
if (!item.costPrice) {
|
|
548
|
-
item.costPrice = 0
|
|
544
|
+
item.costPrice === null ? (item.costPrice = 0) : item.costPrice
|
|
545
|
+
if (item.costPrice == 0 || item.costPrice) {
|
|
549
546
|
item.costPrice = item.costPrice.toFixed(2)
|
|
550
547
|
}
|
|
551
548
|
})
|
|
@@ -574,9 +571,6 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
574
571
|
this._validate()
|
|
575
572
|
|
|
576
573
|
let patches = this.dataGrist._data.records.map(itm => {
|
|
577
|
-
if (itm.costPrice) {
|
|
578
|
-
itm.costPrice = itm.costPrice
|
|
579
|
-
}
|
|
580
574
|
return {
|
|
581
575
|
id: itm.id,
|
|
582
576
|
name: itm.name,
|
|
@@ -617,7 +611,7 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
617
611
|
auxValue5: itm.auxValue5,
|
|
618
612
|
isTrackedAsInventory: itm.isTrackedAsInventory,
|
|
619
613
|
discountId: itm.discountId,
|
|
620
|
-
costPrice:
|
|
614
|
+
costPrice: parseFloat(itm.costPrice),
|
|
621
615
|
mrpPrice: itm.mrpPrice,
|
|
622
616
|
sellPrice: itm.sellPrice,
|
|
623
617
|
afterTaxCostPrice: itm.afterTaxCostPrice,
|
|
@@ -86,6 +86,9 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
86
86
|
},
|
|
87
87
|
importable: {
|
|
88
88
|
handler: records => {
|
|
89
|
+
records.map(record => {
|
|
90
|
+
record.costPrice = record.costPrice == null ? '0.00' : parseFloat(record.costPrice).toFixed(2)
|
|
91
|
+
})
|
|
89
92
|
const config = {
|
|
90
93
|
rows: this.productGristConfig.rows,
|
|
91
94
|
columns: [
|
|
@@ -362,7 +365,7 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
362
365
|
{
|
|
363
366
|
type: 'integer',
|
|
364
367
|
name: 'shelfLife',
|
|
365
|
-
record: { editable: true },
|
|
368
|
+
record: { editable: true, options: { min: 0 } },
|
|
366
369
|
imex: { header: i18next.t('field.shelf_life'), key: 'shelfLife', width: 30, type: 'integer' },
|
|
367
370
|
header: i18next.t('field.shelf_life'),
|
|
368
371
|
sortable: true,
|
|
@@ -584,7 +587,7 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
584
587
|
type: 'float',
|
|
585
588
|
name: 'costPrice',
|
|
586
589
|
record: { editable: true },
|
|
587
|
-
imex: { header: `${i18next.t('field.unit_cost')}
|
|
590
|
+
imex: { header: `${i18next.t('field.unit_cost')}`, key: 'costPrice', width: 20, type: 'number' },
|
|
588
591
|
header: `${i18next.t('field.unit_cost')}`,
|
|
589
592
|
width: 100
|
|
590
593
|
},
|
|
@@ -881,18 +884,12 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
881
884
|
this._validate(this.dataGrist.dirtyRecords)
|
|
882
885
|
|
|
883
886
|
patches = patches.map(patch => {
|
|
884
|
-
if (patch.costPrice) {
|
|
885
|
-
patch.costPrice = parseFloat(patch.costPrice).toFixed(2)
|
|
886
|
-
}
|
|
887
|
-
if (!patch.costPrice) {
|
|
888
|
-
patch.costPrice = 0
|
|
889
|
-
patch.costPrice = parseFloat(patch.costPrice).toFixed(2)
|
|
890
|
-
}
|
|
891
887
|
return {
|
|
892
888
|
...patch,
|
|
893
|
-
costPrice: patch?.costPrice ? parseFloat(patch.costPrice) : undefined,
|
|
894
|
-
expirationPeriod:
|
|
895
|
-
|
|
889
|
+
costPrice: patch?.costPrice || patch.costPrice == 0 ? parseFloat(patch.costPrice) : undefined,
|
|
890
|
+
expirationPeriod:
|
|
891
|
+
patch?.expirationPeriod || patch?.expirationPeriod == 0 ? parseInt(patch.expirationPeriod) : undefined,
|
|
892
|
+
shelfLife: patch?.shelfLife || patch?.shelfLife == 0 ? parseInt(patch.shelfLife) : undefined,
|
|
896
893
|
productRef: patch.productRef?.id ? { id: patch.productRef?.id } : undefined,
|
|
897
894
|
parentProductRef: patch.parentProductRef?.id ? { id: patch.parentProductRef?.id } : undefined
|
|
898
895
|
}
|
|
@@ -925,17 +922,8 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
925
922
|
return this.showToast(i18next.t('text.nothing_changed'))
|
|
926
923
|
}
|
|
927
924
|
patches = patches.map(patch => {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
}
|
|
931
|
-
if (!patch.costPrice) {
|
|
932
|
-
if (patch.costPrice == null) {
|
|
933
|
-
patch.costPrice = 0
|
|
934
|
-
patch.costPrice = parseFloat(patch.costPrice).toFixed(2)
|
|
935
|
-
} else {
|
|
936
|
-
patch.costPrice = parseFloat(patch.costPrice).toFixed(2)
|
|
937
|
-
}
|
|
938
|
-
}
|
|
925
|
+
patch.costPrice = patch.costPrice == null ? 0 : patch.costPrice
|
|
926
|
+
|
|
939
927
|
return {
|
|
940
928
|
...patch,
|
|
941
929
|
costPrice: patch?.costPrice ? parseFloat(patch.costPrice) : undefined,
|
|
@@ -1006,29 +994,14 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
1006
994
|
errors.push({ type: 'expirationPeriod', value: 'Expiration period cannot be negative' })
|
|
1007
995
|
}
|
|
1008
996
|
|
|
1009
|
-
if (itm.costPrice
|
|
1010
|
-
|
|
1011
|
-
errors.push({ type: 'costPrice', value: 'invalid unit cost (negative value)' })
|
|
997
|
+
if (isNaN(itm.costPrice) && itm.costPrice !== undefined) {
|
|
998
|
+
errors.push({ type: 'costPrice', value: 'invalid unit cost (not a number)' })
|
|
1012
999
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
} else {
|
|
1017
|
-
errors.push({ type: 'costPrice', value: 'invalid unit cost (not a number)' })
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
if (itm.__dirty__ == '+') {
|
|
1021
|
-
if (!itm.costPrice) {
|
|
1022
|
-
if (itm.costPrice == undefined || itm.costPrice == 0) {
|
|
1023
|
-
itm.costPrice = 0
|
|
1024
|
-
} else {
|
|
1025
|
-
errors.push({ type: 'costPrice', value: 'invalid unit cost (not a number)' })
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
if (itm.costPrice < 0) {
|
|
1029
|
-
errors.push({ type: 'costPrice', value: 'invalid unit cost (negative value)' })
|
|
1030
|
-
}
|
|
1000
|
+
|
|
1001
|
+
if (itm?.costPrice && itm?.costPrice < 0) {
|
|
1002
|
+
errors.push({ type: 'costPrice', value: 'invalid unit cost (negative value)' })
|
|
1031
1003
|
}
|
|
1004
|
+
|
|
1032
1005
|
return itm
|
|
1033
1006
|
})
|
|
1034
1007
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/product-ui",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.161",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@things-factory/form-ui": "^4.3.
|
|
27
|
-
"@things-factory/grist-ui": "^4.3.
|
|
28
|
-
"@things-factory/i18n-base": "^4.3.
|
|
29
|
-
"@things-factory/import-ui": "^4.3.
|
|
30
|
-
"@things-factory/layout-base": "^4.3.
|
|
31
|
-
"@things-factory/product-base": "^4.3.
|
|
32
|
-
"@things-factory/shell": "^4.3.
|
|
26
|
+
"@things-factory/form-ui": "^4.3.159",
|
|
27
|
+
"@things-factory/grist-ui": "^4.3.159",
|
|
28
|
+
"@things-factory/i18n-base": "^4.3.159",
|
|
29
|
+
"@things-factory/import-ui": "^4.3.159",
|
|
30
|
+
"@things-factory/layout-base": "^4.3.159",
|
|
31
|
+
"@things-factory/product-base": "^4.3.161",
|
|
32
|
+
"@things-factory/shell": "^4.3.159"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "7fe9232a64285ebaa04382258806889c47924157"
|
|
35
35
|
}
|