contentoh-components-library 21.1.20 → 21.1.21
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/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +54 -18
- package/dist/components/pages/ProviderProductEdition/index.js +13 -5
- package/package.json +1 -1
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +60 -18
- package/src/components/pages/ProviderProductEdition/index.js +13 -4
|
@@ -36,45 +36,81 @@ ProviderProductEditionDefault.args = {
|
|
|
36
36
|
category: 846,
|
|
37
37
|
version: 2,
|
|
38
38
|
productSelected: {
|
|
39
|
-
id_article:
|
|
40
|
-
id_category: "
|
|
41
|
-
name: "
|
|
42
|
-
upc: "
|
|
43
|
-
timestamp: "2022-06-
|
|
39
|
+
id_article: 55070,
|
|
40
|
+
id_category: "2976",
|
|
41
|
+
name: "TOALLERO CORTO ACCESS NEGRO ÉBANO",
|
|
42
|
+
upc: "161788",
|
|
43
|
+
timestamp: "2022-06-17T17:31:14.000Z",
|
|
44
44
|
status: "NULL",
|
|
45
|
-
categoryName: "
|
|
45
|
+
categoryName: "BAÑOS|ACCESORIOS PARA BAÑO|TOALLEROS",
|
|
46
46
|
asignations: [],
|
|
47
|
-
version:
|
|
48
|
-
version_status:
|
|
47
|
+
version: 1,
|
|
48
|
+
version_status: null,
|
|
49
49
|
retailersAvailable: [{
|
|
50
50
|
id: 58,
|
|
51
51
|
name: "The Home Depot Golden",
|
|
52
52
|
country: "México",
|
|
53
53
|
id_region: 1,
|
|
54
54
|
active: 1
|
|
55
|
+
}, {
|
|
56
|
+
id: 59,
|
|
57
|
+
name: "The Home Depot Platinum",
|
|
58
|
+
country: "México",
|
|
59
|
+
id_region: 1,
|
|
60
|
+
active: 1
|
|
61
|
+
}, {
|
|
62
|
+
id: 60,
|
|
63
|
+
name: "The Home Depot Resizing",
|
|
64
|
+
country: "México",
|
|
65
|
+
id_region: 1,
|
|
66
|
+
active: 1
|
|
67
|
+
}, {
|
|
68
|
+
id: 61,
|
|
69
|
+
name: "Home Depot TAB",
|
|
70
|
+
country: "México",
|
|
71
|
+
id_region: 1,
|
|
72
|
+
active: 1
|
|
55
73
|
}],
|
|
56
74
|
missing: {}
|
|
57
75
|
},
|
|
58
76
|
productToEdit: {
|
|
59
|
-
idCategory: "
|
|
60
|
-
ArticleId:
|
|
77
|
+
idCategory: "2976",
|
|
78
|
+
ArticleId: 55070,
|
|
61
79
|
product: [{
|
|
62
|
-
id_article:
|
|
63
|
-
id_category: "
|
|
64
|
-
name: "
|
|
65
|
-
upc: "
|
|
66
|
-
timestamp: "2022-06-
|
|
80
|
+
id_article: 55070,
|
|
81
|
+
id_category: "2976",
|
|
82
|
+
name: "TOALLERO CORTO ACCESS NEGRO ÉBANO",
|
|
83
|
+
upc: "161788",
|
|
84
|
+
timestamp: "2022-06-17T17:31:14.000Z",
|
|
67
85
|
status: "NULL",
|
|
68
|
-
categoryName: "
|
|
86
|
+
categoryName: "BAÑOS|ACCESORIOS PARA BAÑO|TOALLEROS",
|
|
69
87
|
asignations: [],
|
|
70
|
-
version:
|
|
71
|
-
version_status:
|
|
88
|
+
version: 1,
|
|
89
|
+
version_status: null,
|
|
72
90
|
retailersAvailable: [{
|
|
73
91
|
id: 58,
|
|
74
92
|
name: "The Home Depot Golden",
|
|
75
93
|
country: "México",
|
|
76
94
|
id_region: 1,
|
|
77
95
|
active: 1
|
|
96
|
+
}, {
|
|
97
|
+
id: 59,
|
|
98
|
+
name: "The Home Depot Platinum",
|
|
99
|
+
country: "México",
|
|
100
|
+
id_region: 1,
|
|
101
|
+
active: 1
|
|
102
|
+
}, {
|
|
103
|
+
id: 60,
|
|
104
|
+
name: "The Home Depot Resizing",
|
|
105
|
+
country: "México",
|
|
106
|
+
id_region: 1,
|
|
107
|
+
active: 1
|
|
108
|
+
}, {
|
|
109
|
+
id: 61,
|
|
110
|
+
name: "Home Depot TAB",
|
|
111
|
+
country: "México",
|
|
112
|
+
id_region: 1,
|
|
113
|
+
active: 1
|
|
78
114
|
}],
|
|
79
115
|
missing: {}
|
|
80
116
|
}]
|
|
@@ -1465,11 +1465,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1465
1465
|
};
|
|
1466
1466
|
|
|
1467
1467
|
var enableActions = function enableActions(versionStatus) {
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1468
|
+
try {
|
|
1469
|
+
var userIsRetailer = user.is_retailer;
|
|
1470
|
+
if (userIsRetailer) return false;
|
|
1471
|
+
|
|
1472
|
+
if (versionStatus) {
|
|
1473
|
+
return ["AP", "AC", "RC", null].includes(versionStatus);
|
|
1474
|
+
}
|
|
1471
1475
|
|
|
1472
|
-
|
|
1476
|
+
return true;
|
|
1477
|
+
} catch (err) {
|
|
1478
|
+
console.log(err, "Unable de check if user is retailer");
|
|
1479
|
+
return false;
|
|
1480
|
+
}
|
|
1473
1481
|
};
|
|
1474
1482
|
|
|
1475
1483
|
(0, _react.useEffect)(function () {
|
|
@@ -1585,7 +1593,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1585
1593
|
assig: assig,
|
|
1586
1594
|
setAssignation: setAssignation,
|
|
1587
1595
|
isRetailer: isRetailer,
|
|
1588
|
-
showSaveButton:
|
|
1596
|
+
showSaveButton: enableActions(product.version_status),
|
|
1589
1597
|
onClickSave: function onClickSave() {
|
|
1590
1598
|
switch (activeTab) {
|
|
1591
1599
|
case "Descripción":
|
package/package.json
CHANGED
|
@@ -21,16 +21,16 @@ ProviderProductEditionDefault.args = {
|
|
|
21
21
|
category: 846,
|
|
22
22
|
version: 2,
|
|
23
23
|
productSelected: {
|
|
24
|
-
id_article:
|
|
25
|
-
id_category: "
|
|
26
|
-
name: "
|
|
27
|
-
upc: "
|
|
28
|
-
timestamp: "2022-06-
|
|
24
|
+
id_article: 55070,
|
|
25
|
+
id_category: "2976",
|
|
26
|
+
name: "TOALLERO CORTO ACCESS NEGRO ÉBANO",
|
|
27
|
+
upc: "161788",
|
|
28
|
+
timestamp: "2022-06-17T17:31:14.000Z",
|
|
29
29
|
status: "NULL",
|
|
30
|
-
categoryName: "
|
|
30
|
+
categoryName: "BAÑOS|ACCESORIOS PARA BAÑO|TOALLEROS",
|
|
31
31
|
asignations: [],
|
|
32
|
-
version:
|
|
33
|
-
version_status:
|
|
32
|
+
version: 1,
|
|
33
|
+
version_status: null,
|
|
34
34
|
retailersAvailable: [
|
|
35
35
|
{
|
|
36
36
|
id: 58,
|
|
@@ -39,24 +39,45 @@ ProviderProductEditionDefault.args = {
|
|
|
39
39
|
id_region: 1,
|
|
40
40
|
active: 1,
|
|
41
41
|
},
|
|
42
|
+
{
|
|
43
|
+
id: 59,
|
|
44
|
+
name: "The Home Depot Platinum",
|
|
45
|
+
country: "México",
|
|
46
|
+
id_region: 1,
|
|
47
|
+
active: 1,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 60,
|
|
51
|
+
name: "The Home Depot Resizing",
|
|
52
|
+
country: "México",
|
|
53
|
+
id_region: 1,
|
|
54
|
+
active: 1,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 61,
|
|
58
|
+
name: "Home Depot TAB",
|
|
59
|
+
country: "México",
|
|
60
|
+
id_region: 1,
|
|
61
|
+
active: 1,
|
|
62
|
+
},
|
|
42
63
|
],
|
|
43
64
|
missing: {},
|
|
44
65
|
},
|
|
45
66
|
productToEdit: {
|
|
46
|
-
idCategory: "
|
|
47
|
-
ArticleId:
|
|
67
|
+
idCategory: "2976",
|
|
68
|
+
ArticleId: 55070,
|
|
48
69
|
product: [
|
|
49
70
|
{
|
|
50
|
-
id_article:
|
|
51
|
-
id_category: "
|
|
52
|
-
name: "
|
|
53
|
-
upc: "
|
|
54
|
-
timestamp: "2022-06-
|
|
71
|
+
id_article: 55070,
|
|
72
|
+
id_category: "2976",
|
|
73
|
+
name: "TOALLERO CORTO ACCESS NEGRO ÉBANO",
|
|
74
|
+
upc: "161788",
|
|
75
|
+
timestamp: "2022-06-17T17:31:14.000Z",
|
|
55
76
|
status: "NULL",
|
|
56
|
-
categoryName: "
|
|
77
|
+
categoryName: "BAÑOS|ACCESORIOS PARA BAÑO|TOALLEROS",
|
|
57
78
|
asignations: [],
|
|
58
|
-
version:
|
|
59
|
-
version_status:
|
|
79
|
+
version: 1,
|
|
80
|
+
version_status: null,
|
|
60
81
|
retailersAvailable: [
|
|
61
82
|
{
|
|
62
83
|
id: 58,
|
|
@@ -65,6 +86,27 @@ ProviderProductEditionDefault.args = {
|
|
|
65
86
|
id_region: 1,
|
|
66
87
|
active: 1,
|
|
67
88
|
},
|
|
89
|
+
{
|
|
90
|
+
id: 59,
|
|
91
|
+
name: "The Home Depot Platinum",
|
|
92
|
+
country: "México",
|
|
93
|
+
id_region: 1,
|
|
94
|
+
active: 1,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 60,
|
|
98
|
+
name: "The Home Depot Resizing",
|
|
99
|
+
country: "México",
|
|
100
|
+
id_region: 1,
|
|
101
|
+
active: 1,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 61,
|
|
105
|
+
name: "Home Depot TAB",
|
|
106
|
+
country: "México",
|
|
107
|
+
id_region: 1,
|
|
108
|
+
active: 1,
|
|
109
|
+
},
|
|
68
110
|
],
|
|
69
111
|
missing: {},
|
|
70
112
|
},
|
|
@@ -904,10 +904,19 @@ export const ProviderProductEdition = ({
|
|
|
904
904
|
};
|
|
905
905
|
|
|
906
906
|
const enableActions = (versionStatus) => {
|
|
907
|
-
|
|
908
|
-
|
|
907
|
+
try {
|
|
908
|
+
const userIsRetailer = user.is_retailer;
|
|
909
|
+
|
|
910
|
+
if (userIsRetailer) return false;
|
|
911
|
+
|
|
912
|
+
if (versionStatus) {
|
|
913
|
+
return ["AP", "AC", "RC", null].includes(versionStatus);
|
|
914
|
+
}
|
|
915
|
+
return true;
|
|
916
|
+
} catch (err) {
|
|
917
|
+
console.log(err, "Unable de check if user is retailer");
|
|
918
|
+
return false;
|
|
909
919
|
}
|
|
910
|
-
return true;
|
|
911
920
|
};
|
|
912
921
|
|
|
913
922
|
useEffect(() => {
|
|
@@ -1023,7 +1032,7 @@ export const ProviderProductEdition = ({
|
|
|
1023
1032
|
assig={assig}
|
|
1024
1033
|
setAssignation={setAssignation}
|
|
1025
1034
|
isRetailer={isRetailer}
|
|
1026
|
-
showSaveButton={
|
|
1035
|
+
showSaveButton={enableActions(product.version_status)}
|
|
1027
1036
|
onClickSave={() => {
|
|
1028
1037
|
switch (activeTab) {
|
|
1029
1038
|
case "Descripción":
|