@things-factory/product-ui 4.3.156 → 4.3.159
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.
|
@@ -341,13 +341,6 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
341
341
|
header: i18next.t('field.volume'),
|
|
342
342
|
width: 70
|
|
343
343
|
},
|
|
344
|
-
{
|
|
345
|
-
type: 'float',
|
|
346
|
-
name: 'costPrice',
|
|
347
|
-
record: { editable: true, options: { min: 0 } },
|
|
348
|
-
header: i18next.t('field.unit_cost'),
|
|
349
|
-
width: 70
|
|
350
|
-
},
|
|
351
344
|
{
|
|
352
345
|
type: 'string',
|
|
353
346
|
name: 'auxUnit1',
|
|
@@ -540,16 +533,6 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
540
533
|
|
|
541
534
|
let data = this._updateRowOption(response.data.productDetails.items)
|
|
542
535
|
|
|
543
|
-
data.map(item => {
|
|
544
|
-
if (item.costPrice) {
|
|
545
|
-
item.costPrice = item.costPrice.toFixed(2)
|
|
546
|
-
}
|
|
547
|
-
if (!item.costPrice) {
|
|
548
|
-
item.costPrice = 0
|
|
549
|
-
item.costPrice = item.costPrice.toFixed(2)
|
|
550
|
-
}
|
|
551
|
-
})
|
|
552
|
-
|
|
553
536
|
if (!response.errors) {
|
|
554
537
|
this._data = {
|
|
555
538
|
total: response.data.productDetails.total || 0,
|
|
@@ -574,9 +557,6 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
574
557
|
this._validate()
|
|
575
558
|
|
|
576
559
|
let patches = this.dataGrist._data.records.map(itm => {
|
|
577
|
-
if (itm.costPrice) {
|
|
578
|
-
itm.costPrice = itm.costPrice
|
|
579
|
-
}
|
|
580
560
|
return {
|
|
581
561
|
id: itm.id,
|
|
582
562
|
name: itm.name,
|
|
@@ -617,7 +597,7 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
617
597
|
auxValue5: itm.auxValue5,
|
|
618
598
|
isTrackedAsInventory: itm.isTrackedAsInventory,
|
|
619
599
|
discountId: itm.discountId,
|
|
620
|
-
costPrice: itm
|
|
600
|
+
costPrice: itm.costPrice,
|
|
621
601
|
mrpPrice: itm.mrpPrice,
|
|
622
602
|
sellPrice: itm.sellPrice,
|
|
623
603
|
afterTaxCostPrice: itm.afterTaxCostPrice,
|
|
@@ -666,9 +646,7 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
666
646
|
|
|
667
647
|
_validate() {
|
|
668
648
|
let errors = []
|
|
669
|
-
|
|
670
|
-
throw new Error(i18next.t('text.nothing_changed'))
|
|
671
|
-
}
|
|
649
|
+
|
|
672
650
|
if (!this.dataGrist._data.records.find(x => x.isDefault)) {
|
|
673
651
|
errors.push({ type: 'isDefault', value: 'Must have 1 default' })
|
|
674
652
|
}
|
|
@@ -715,9 +693,6 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
715
693
|
if (!errors.find(err => err.type == 'uomValue'))
|
|
716
694
|
errors.push({ type: 'uomValue', value: 'UOM Value is required' })
|
|
717
695
|
}
|
|
718
|
-
if (itm.costPrice < 0) {
|
|
719
|
-
throw new Error(i18next.t('text.unit_cost_cannot_be_negative_value'))
|
|
720
|
-
}
|
|
721
696
|
return itm
|
|
722
697
|
})
|
|
723
698
|
|
|
@@ -732,7 +707,6 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
732
707
|
}
|
|
733
708
|
|
|
734
709
|
_fieldChange(e) {
|
|
735
|
-
let unitCostError = ''
|
|
736
710
|
var { after, before, column, record, row } = e.detail
|
|
737
711
|
let updatedRecords = {
|
|
738
712
|
...this.dataGrist._data,
|
|
@@ -762,17 +736,6 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
762
736
|
updatedRecords.records[row].uomValue = 1
|
|
763
737
|
}
|
|
764
738
|
break
|
|
765
|
-
|
|
766
|
-
case 'costPrice':
|
|
767
|
-
if (isNaN(after) === true) {
|
|
768
|
-
unitCostError = 'not a number'
|
|
769
|
-
updatedRecords.records[row].costPrice = updatedRecords.records[row].__dirtyfields__.costPrice.before
|
|
770
|
-
this._showToast({ type: 'error', message: `Invalid value in Unit Cost (${unitCostError})` })
|
|
771
|
-
}
|
|
772
|
-
if (after < 0) {
|
|
773
|
-
unitCostError = 'negative value'
|
|
774
|
-
}
|
|
775
|
-
break
|
|
776
739
|
default:
|
|
777
740
|
break
|
|
778
741
|
}
|
|
@@ -783,11 +746,7 @@ export class ProductDetailsPopup extends localize(i18next)(LitElement) {
|
|
|
783
746
|
...this.dataGrist._data
|
|
784
747
|
}
|
|
785
748
|
|
|
786
|
-
|
|
787
|
-
this._showToast({ type: 'error', message: `Invalid value in Unit Cost (${unitCostError})` })
|
|
788
|
-
} else {
|
|
789
|
-
this._showToast({ type: 'error', message: `Minimum value of ${column.record.options.min} is required.` })
|
|
790
|
-
}
|
|
749
|
+
this._showToast({ type: 'error', message: `Minimum value of ${column.record.options.min} is required.` })
|
|
791
750
|
}
|
|
792
751
|
|
|
793
752
|
this._data = { ...updatedRecords }
|
|
@@ -359,15 +359,6 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
359
359
|
sortable: true,
|
|
360
360
|
width: 140
|
|
361
361
|
},
|
|
362
|
-
{
|
|
363
|
-
type: 'integer',
|
|
364
|
-
name: 'shelfLife',
|
|
365
|
-
record: { editable: true },
|
|
366
|
-
imex: { header: i18next.t('field.shelf_life'), key: 'shelfLife', width: 30, type: 'integer' },
|
|
367
|
-
header: i18next.t('field.shelf_life'),
|
|
368
|
-
sortable: true,
|
|
369
|
-
width: 140
|
|
370
|
-
},
|
|
371
362
|
{
|
|
372
363
|
type: 'boolean',
|
|
373
364
|
name: 'isRequiredCheckExpiry',
|
|
@@ -580,14 +571,6 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
580
571
|
header: i18next.t('field.volume_size'),
|
|
581
572
|
width: 100
|
|
582
573
|
},
|
|
583
|
-
{
|
|
584
|
-
type: 'float',
|
|
585
|
-
name: 'costPrice',
|
|
586
|
-
record: { editable: true },
|
|
587
|
-
imex: { header: `${i18next.t('field.unit_cost')} 1`, key: 'costPrice', width: 20, type: 'number' },
|
|
588
|
-
header: `${i18next.t('field.unit_cost')}`,
|
|
589
|
-
width: 100
|
|
590
|
-
},
|
|
591
574
|
{
|
|
592
575
|
type: 'string',
|
|
593
576
|
name: 'auxUnit1',
|
|
@@ -739,7 +722,6 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
739
722
|
inventoryAccountCode
|
|
740
723
|
cogsAccountCode
|
|
741
724
|
expirationPeriod
|
|
742
|
-
shelfLife
|
|
743
725
|
isRequiredCheckExpiry
|
|
744
726
|
isRequireSerialNumberScanning
|
|
745
727
|
isRequireSerialNumberScanningInbound
|
|
@@ -798,13 +780,9 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
798
780
|
total: response.data.myBizplaceProducts.total || 0,
|
|
799
781
|
records:
|
|
800
782
|
response.data.myBizplaceProducts.items.map(itm => {
|
|
801
|
-
if (itm.costPrice == NaN || itm.costPrice == null) {
|
|
802
|
-
itm.costPrice = 0
|
|
803
|
-
}
|
|
804
783
|
return {
|
|
805
784
|
...itm,
|
|
806
|
-
productRef: { name: itm?.productRef ? '(' + itm.productRef.sku + ') ' + itm.productRef.name : '' }
|
|
807
|
-
costPrice: parseFloat(itm.costPrice).toFixed(2)
|
|
785
|
+
productRef: { name: itm?.productRef ? '(' + itm.productRef.sku + ') ' + itm.productRef.name : '' }
|
|
808
786
|
}
|
|
809
787
|
}) || []
|
|
810
788
|
}
|
|
@@ -878,26 +856,17 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
878
856
|
return this.showToast(i18next.t('text.nothing_changed'))
|
|
879
857
|
}
|
|
880
858
|
|
|
881
|
-
this._validate(this.dataGrist.dirtyRecords)
|
|
882
|
-
|
|
883
859
|
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
860
|
return {
|
|
892
861
|
...patch,
|
|
893
|
-
costPrice: patch?.costPrice ? parseFloat(patch.costPrice) : undefined,
|
|
894
862
|
expirationPeriod: patch?.expirationPeriod ? parseInt(patch.expirationPeriod) : undefined,
|
|
895
|
-
shelfLife: patch?.shelfLife ? parseInt(patch.shelfLife) : undefined,
|
|
896
863
|
productRef: patch.productRef?.id ? { id: patch.productRef?.id } : undefined,
|
|
897
864
|
parentProductRef: patch.parentProductRef?.id ? { id: patch.parentProductRef?.id } : undefined
|
|
898
865
|
}
|
|
899
866
|
})
|
|
900
867
|
|
|
868
|
+
this._validate(this.dataGrist.dirtyRecords)
|
|
869
|
+
|
|
901
870
|
const response = await client.mutate({
|
|
902
871
|
mutation: gql`
|
|
903
872
|
mutation updateMultipleProduct($patches: [ProductPatch!]!) {
|
|
@@ -924,28 +893,16 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
924
893
|
if (!patches?.length) {
|
|
925
894
|
return this.showToast(i18next.t('text.nothing_changed'))
|
|
926
895
|
}
|
|
896
|
+
|
|
927
897
|
patches = patches.map(patch => {
|
|
928
|
-
if (patch.costPrice) {
|
|
929
|
-
patch.costPrice = parseFloat(patch.costPrice).toFixed(2)
|
|
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
|
-
}
|
|
939
898
|
return {
|
|
940
899
|
...patch,
|
|
941
|
-
costPrice: patch?.costPrice ? parseFloat(patch.costPrice) : undefined,
|
|
942
900
|
uomValue: patch?.uomValue ? parseFloat(patch.uomValue) : undefined,
|
|
943
901
|
bufferQty: patch?.bufferQty ? parseInt(patch.bufferQty) : undefined,
|
|
944
902
|
minQty: patch?.minQty ? parseInt(patch.minQty) : undefined,
|
|
945
903
|
maxQty: patch?.maxQty ? parseInt(patch.maxQty) : undefined,
|
|
946
904
|
packingSize: patch?.packingSize ? parseInt(patch.packingSize) : undefined,
|
|
947
905
|
expirationPeriod: patch?.expirationPeriod ? parseInt(patch.expirationPeriod) : undefined,
|
|
948
|
-
shelfLife: patch?.shelfLife ? parseInt(patch.shelfLife) : undefined,
|
|
949
906
|
productRef: patch.productRef?.id ? { id: patch.productRef?.id } : undefined,
|
|
950
907
|
pickingStrategy: patch?.pickingStrategy ? patch.pickingStrategy.toUpperCase() : undefined
|
|
951
908
|
}
|
|
@@ -997,38 +954,6 @@ class ProductList extends localize(i18next)(PageView) {
|
|
|
997
954
|
if (!errors.find(err => err.type == 'uomValue'))
|
|
998
955
|
errors.push({ type: 'uomValue', value: 'UOM Value is required' })
|
|
999
956
|
}
|
|
1000
|
-
if (itm?.shelfLife < 0) {
|
|
1001
|
-
if (!errors.find(err => err.type == 'shelfLife'))
|
|
1002
|
-
errors.push({ type: 'shelfLife', value: 'Shelf Life cannot be negative' })
|
|
1003
|
-
}
|
|
1004
|
-
if (itm?.expirationPeriod < 0) {
|
|
1005
|
-
if (!errors.find(err => err.type == 'expirationPeriod'))
|
|
1006
|
-
errors.push({ type: 'expirationPeriod', value: 'Expiration period cannot be negative' })
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
if (itm.costPrice < 0 && itm.__dirty__ != '+') {
|
|
1010
|
-
if (!errors.find(err => err.type == 'costPrice'))
|
|
1011
|
-
errors.push({ type: 'costPrice', value: 'invalid unit cost (negative value)' })
|
|
1012
|
-
}
|
|
1013
|
-
if (!itm.costPrice && itm.__dirty__ != '+') {
|
|
1014
|
-
if (itm.costPrice == 0) {
|
|
1015
|
-
itm.costPrice = 0
|
|
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
|
-
}
|
|
1031
|
-
}
|
|
1032
957
|
return itm
|
|
1033
958
|
})
|
|
1034
959
|
|
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.159",
|
|
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.159",
|
|
32
|
+
"@things-factory/shell": "^4.3.159"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "4ef9913b22e5b7baee27d9057fb04c707f7f49ec"
|
|
35
35
|
}
|
package/translations/en.json
CHANGED
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"field.require_serial_number_scanning_outbound": "require serial number scanning outbound",
|
|
52
52
|
"field.require_serial_number_scanning": "require serial number scanning",
|
|
53
53
|
"field.required_checking_expiry": "required checking expiry",
|
|
54
|
-
"field.shelf_life": "shelf life",
|
|
55
54
|
"field.sku": "SKU",
|
|
56
55
|
"field.sub_brand": "sub brand",
|
|
57
56
|
"field.threshold_qty": "threshold qty",
|
|
@@ -64,7 +63,6 @@
|
|
|
64
63
|
"field.weight_unit": "weight unit",
|
|
65
64
|
"field.weight": "weight",
|
|
66
65
|
"field.width": "width",
|
|
67
|
-
"field.unit_cost": "unit cost",
|
|
68
66
|
"label.fefo": "FEFO",
|
|
69
67
|
"label.fmfo": "FMFO",
|
|
70
68
|
"label.fifo": "FIFO",
|
package/translations/ko.json
CHANGED
|
@@ -77,7 +77,5 @@
|
|
|
77
77
|
"title.product_bundle": "[ko]product bundle",
|
|
78
78
|
"title.product_set": "[ko]product set",
|
|
79
79
|
"title.product": "[ko]product",
|
|
80
|
-
"field.child_product_detail": "[ko] child product detail"
|
|
81
|
-
"field.unit_cost": "[ko] unit cost",
|
|
82
|
-
"field.shelf_life": "[ko] shelf life"
|
|
80
|
+
"field.child_product_detail": "[ko] child product detail"
|
|
83
81
|
}
|
package/translations/ms.json
CHANGED
|
@@ -77,7 +77,5 @@
|
|
|
77
77
|
"title.product_bundle": "[ms]product bundle",
|
|
78
78
|
"title.product_set": "[ms]product set",
|
|
79
79
|
"title.product": "[ms]product",
|
|
80
|
-
"field.child_product_detail": "[ms] child product detail"
|
|
81
|
-
"field.unit_cost": "[ms] unit cost",
|
|
82
|
-
"field.shelf_life": "[ms] shelf life"
|
|
80
|
+
"field.child_product_detail": "[ms] child product detail"
|
|
83
81
|
}
|
package/translations/zh.json
CHANGED
|
@@ -77,7 +77,5 @@
|
|
|
77
77
|
"title.product_bundle": "[zh]product bundle",
|
|
78
78
|
"title.product_set": "[zh]product set",
|
|
79
79
|
"title.product": "[zh]product",
|
|
80
|
-
"field.child_product_detail": "[zh] child product detail"
|
|
81
|
-
"field.unit_cost": "[zh] unit cost",
|
|
82
|
-
"field.shelf_life": "[zh] shelf life"
|
|
80
|
+
"field.child_product_detail": "[zh] child product detail"
|
|
83
81
|
}
|