contentoh-components-library 21.3.61 → 21.3.63
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/.env.development +2 -0
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +68 -11
- package/dist/components/organisms/Chat/Chat.stories.js +21 -1
- package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +343 -191
- package/dist/components/organisms/Chat/Footer/index.js +48 -39
- package/dist/components/organisms/Chat/index.js +48 -3
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/organisms/SideModal/SideModal.stories.js +42 -0
- package/dist/components/organisms/SideModal/index.js +61 -0
- package/dist/components/organisms/SideModal/styles.js +18 -0
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +172 -127
- package/dist/components/pages/ProviderProductEdition/index.js +200 -134
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +40 -28
- package/dist/components/pages/RetailerProductEdition/index.js +266 -273
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
- package/dist/index.js +13 -0
- package/package.json +1 -1
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +52 -6
- package/src/components/organisms/Chat/Chat.stories.js +21 -0
- package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
- package/src/components/organisms/Chat/ContainerItems/styles.js +10 -2
- package/src/components/organisms/Chat/ContentChat/index.js +81 -6
- package/src/components/organisms/Chat/Footer/index.js +11 -0
- package/src/components/organisms/Chat/index.js +47 -3
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/SideModal/SideModal.stories.js +23 -0
- package/src/components/organisms/SideModal/index.js +41 -0
- package/src/components/organisms/SideModal/styles.js +21 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +177 -130
- package/src/components/pages/ProviderProductEdition/index.js +116 -59
- package/src/components/pages/ProviderProductEdition/styles.js +5 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +38 -26
- package/src/components/pages/RetailerProductEdition/index.js +110 -135
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/components/pages/RetailerProductEdition/utils.js +37 -0
- package/src/index.js +1 -0
|
@@ -13,7 +13,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
13
13
|
|
|
14
14
|
var _templateObject;
|
|
15
15
|
|
|
16
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: calc(100% - 341px);\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button,\n .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n }\n }\n .container {\n width: 100%;\n height: 100%;\n .dropzone {\n height: 100%;\n width: 100%;\n }\n }\n"])), function (_ref) {
|
|
16
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: calc(100% - 341px);\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button,\n .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n }\n }\n #modal-message-box {\n width: 400px;\n height: 100px;\n }\n .container {\n width: 100%;\n height: 100%;\n .dropzone {\n height: 100%;\n width: 100%;\n }\n }\n"])), function (_ref) {
|
|
17
17
|
var headerTop = _ref.headerTop;
|
|
18
18
|
return headerTop;
|
|
19
19
|
});
|
|
@@ -5,14 +5,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.getInputsData = exports.getAuditVersion = void 0;
|
|
8
|
+
exports.translateService = exports.sendMessage = exports.getInputsData = exports.getAuditVersion = exports.createMessage = void 0;
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
13
|
+
|
|
12
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
13
15
|
|
|
14
16
|
var _axios = _interopRequireDefault(require("axios"));
|
|
15
17
|
|
|
18
|
+
var _handle_http = require("../../../global-files/handle_http");
|
|
19
|
+
|
|
16
20
|
var getAuditVersion = /*#__PURE__*/function () {
|
|
17
21
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(articleId, setState, token) {
|
|
18
22
|
var auditResponse;
|
|
@@ -64,4 +68,59 @@ var getInputsData = function getInputsData(services, activeRetailer, setDatashee
|
|
|
64
68
|
}
|
|
65
69
|
};
|
|
66
70
|
|
|
67
|
-
exports.getInputsData = getInputsData;
|
|
71
|
+
exports.getInputsData = getInputsData;
|
|
72
|
+
|
|
73
|
+
var translateService = function translateService(tab) {
|
|
74
|
+
switch (tab) {
|
|
75
|
+
case "description":
|
|
76
|
+
case "Descripción":
|
|
77
|
+
return "Descripciones";
|
|
78
|
+
|
|
79
|
+
case "datasheet":
|
|
80
|
+
case "Ficha técnica":
|
|
81
|
+
return "Fichas técnicas";
|
|
82
|
+
|
|
83
|
+
case "images":
|
|
84
|
+
case "Imágenes":
|
|
85
|
+
return "Imágenes";
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
exports.translateService = translateService;
|
|
90
|
+
|
|
91
|
+
var createMessage = function createMessage(retailers, idRetailer, oldStatus, newStatus, service) {
|
|
92
|
+
var _ref2 = (retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (ret) {
|
|
93
|
+
return ret.id === idRetailer;
|
|
94
|
+
})) || [],
|
|
95
|
+
_ref3 = (0, _slicedToArray2.default)(_ref2, 1),
|
|
96
|
+
retailer = _ref3[0];
|
|
97
|
+
|
|
98
|
+
return "".concat(translateService(service), " de ").concat(retailer.name, " |").concat(oldStatus, "| a |").concat(newStatus);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
exports.createMessage = createMessage;
|
|
102
|
+
|
|
103
|
+
var sendMessage = /*#__PURE__*/function () {
|
|
104
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(data) {
|
|
105
|
+
var paramsBody, paramsHeader;
|
|
106
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
107
|
+
while (1) {
|
|
108
|
+
switch (_context2.prev = _context2.next) {
|
|
109
|
+
case 0:
|
|
110
|
+
paramsBody = data.paramsBody, paramsHeader = data.paramsHeader;
|
|
111
|
+
return _context2.abrupt("return", (0, _handle_http.fetchPOST)(process.env.REACT_APP_CREATE_MESSAGES, paramsBody, paramsHeader));
|
|
112
|
+
|
|
113
|
+
case 2:
|
|
114
|
+
case "end":
|
|
115
|
+
return _context2.stop();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, _callee2);
|
|
119
|
+
}));
|
|
120
|
+
|
|
121
|
+
return function sendMessage(_x4) {
|
|
122
|
+
return _ref4.apply(this, arguments);
|
|
123
|
+
};
|
|
124
|
+
}();
|
|
125
|
+
|
|
126
|
+
exports.sendMessage = sendMessage;
|
package/dist/index.js
CHANGED
|
@@ -992,6 +992,19 @@ Object.keys(_TableResizable).forEach(function (key) {
|
|
|
992
992
|
});
|
|
993
993
|
});
|
|
994
994
|
|
|
995
|
+
var _index74 = require("./components/organisms/SideModal/index");
|
|
996
|
+
|
|
997
|
+
Object.keys(_index74).forEach(function (key) {
|
|
998
|
+
if (key === "default" || key === "__esModule") return;
|
|
999
|
+
if (key in exports && exports[key] === _index74[key]) return;
|
|
1000
|
+
Object.defineProperty(exports, key, {
|
|
1001
|
+
enumerable: true,
|
|
1002
|
+
get: function get() {
|
|
1003
|
+
return _index74[key];
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
});
|
|
1007
|
+
|
|
995
1008
|
var _ChangePasswordLogin = require("./components/pages/ChangePasswordLogin");
|
|
996
1009
|
|
|
997
1010
|
Object.keys(_ChangePasswordLogin).forEach(function (key) {
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ export const CarouselImagesLogin = ({
|
|
|
27
27
|
img2.src = images[i];
|
|
28
28
|
const circulo_actual = Array.from(circulos).find((el) => el.id === i);
|
|
29
29
|
Array.from(circulos).forEach((cir) => cir.classList.remove("resaltado"));
|
|
30
|
-
circulo_actual
|
|
30
|
+
circulo_actual?.classList.add("resaltado");
|
|
31
31
|
img1.classList.add("right");
|
|
32
32
|
img2.classList.add("active");
|
|
33
33
|
i++;
|
|
@@ -4,10 +4,13 @@ import { Button } from "../../atoms/GeneralButton/index";
|
|
|
4
4
|
import { useEffect, useRef } from "react";
|
|
5
5
|
import { Chat } from "../../organisms/Chat";
|
|
6
6
|
import auditIcon from "../../../../src/assets/images/generalButton/Icono AB.svg";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { render } from "@testing-library/react";
|
|
7
9
|
|
|
8
10
|
export const HeaderTop = ({
|
|
9
11
|
setHeaderTop,
|
|
10
12
|
withChat,
|
|
13
|
+
chatType,
|
|
11
14
|
productSelected,
|
|
12
15
|
token,
|
|
13
16
|
auditableVersion,
|
|
@@ -16,16 +19,51 @@ export const HeaderTop = ({
|
|
|
16
19
|
activeRetailer,
|
|
17
20
|
}) => {
|
|
18
21
|
const headerTop = useRef();
|
|
22
|
+
const [chat, setChat] = useState(null);
|
|
23
|
+
const [chatData, setChatData] = useState(null);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (activeRetailer.id && productSelected && token.length) {
|
|
27
|
+
setChatData({
|
|
28
|
+
id: productSelected?.article?.id_article || productSelected?.id_article,
|
|
29
|
+
version: productSelected?.version,
|
|
30
|
+
retailerId: activeRetailer?.id,
|
|
31
|
+
status: productSelected?.status,
|
|
32
|
+
userToken: token,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}, [activeRetailer, productSelected, token]);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (chatType) renderChat(chatType);
|
|
39
|
+
}, [chatData, chatType]);
|
|
19
40
|
|
|
20
41
|
useEffect(() => {
|
|
21
42
|
setHeaderTop && setHeaderTop(headerTop.current.clientHeight);
|
|
22
43
|
}, []);
|
|
23
44
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
const renderChat = (chatType) => {
|
|
46
|
+
switch (chatType) {
|
|
47
|
+
case "product_status":
|
|
48
|
+
chatData &&
|
|
49
|
+
setChat(
|
|
50
|
+
<Chat
|
|
51
|
+
chatType="product_status"
|
|
52
|
+
chatContainerType="popUp"
|
|
53
|
+
chatData={{
|
|
54
|
+
id: chatData?.id,
|
|
55
|
+
version: chatData?.version,
|
|
56
|
+
retailerId: chatData?.retailerId,
|
|
57
|
+
status: chatData?.status,
|
|
58
|
+
userToken: chatData?.userToken,
|
|
59
|
+
}}
|
|
60
|
+
size={18}
|
|
61
|
+
activeRetailer={activeRetailer}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
setChat(
|
|
29
67
|
<Chat
|
|
30
68
|
chatType="merchant_product"
|
|
31
69
|
chatContainerType="popUp"
|
|
@@ -37,8 +75,16 @@ export const HeaderTop = ({
|
|
|
37
75
|
size={18}
|
|
38
76
|
activeRetailer={activeRetailer}
|
|
39
77
|
/>
|
|
40
|
-
)
|
|
78
|
+
);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
41
82
|
|
|
83
|
+
return (
|
|
84
|
+
<Container ref={headerTop}>
|
|
85
|
+
<ScreenHeader text="Edición de producto" />
|
|
86
|
+
<div className="buttons-container">
|
|
87
|
+
{withChat && chat}
|
|
42
88
|
{isAuditor && auditableVersion && (
|
|
43
89
|
<Button
|
|
44
90
|
buttonType="general-white-button circular-button"
|
|
@@ -162,3 +162,24 @@ chatTicket_userTECH.args = {
|
|
|
162
162
|
},
|
|
163
163
|
classNameContainerFixed: "chatTicket",
|
|
164
164
|
};
|
|
165
|
+
|
|
166
|
+
// ejemplo del chat para los cambios de status del producto.
|
|
167
|
+
export const chatProduct_status = Template.bind({});
|
|
168
|
+
chatProduct_status.args = {
|
|
169
|
+
chatType: "product_status",
|
|
170
|
+
chatContainerType: "popUp",
|
|
171
|
+
chatData: {
|
|
172
|
+
id: 37414,
|
|
173
|
+
version: 7,
|
|
174
|
+
retailerId: 70,
|
|
175
|
+
status: "AA",
|
|
176
|
+
orderId: 15189,
|
|
177
|
+
userToken:
|
|
178
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJhOWFhMDQ4Zi05YzRjLTQxODMtYWUzMS03OWVjNjBhY2NjZGYiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4MzU4ODM4OSwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4MzU5MTk4OSwiaWF0IjoxNjgzNTg4Mzg5LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.k9FQfRR02XC3WWfOzWhrbJGmp69AmCHJEIrgtXKhIwC69trdphSm1AKkZnDJMsEdkpUgjF_zAOsa_xYRxO6goXy7WXVc_p7N-yFHlkhZrRyn3LEFKaLzD8vVqlWx4kgfSERm7KhI1AxPmrA-lw8eF6Axvqn3PvuszAw89_WhPOcnOt8vU0MxAVhLgS8oM6vyHFmHEHWQ2FnSYYed9sEvAxGh_B44aIgWeDteQGeGdYhsm6rUcxgkrskywZJp9FW5VgYXuDcC5NpvomMMRy_v95UV897JzCHl__sK2Z9ahm0eczVN3tAc0GbKnlN96ZrGTQ_nmNHbuMDPQBPXH5HXZQ",
|
|
179
|
+
currentUser: {
|
|
180
|
+
id: 37,
|
|
181
|
+
companyId: 2,
|
|
182
|
+
isUserTech: false,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
};
|
|
@@ -22,6 +22,7 @@ import { Tooltip } from "../../../atoms/Tooltip";
|
|
|
22
22
|
import { Slide, Zoom } from "@mui/material";
|
|
23
23
|
import { useRef } from "react";
|
|
24
24
|
import { ImagePreview } from "../../../atoms/ImagePreview";
|
|
25
|
+
import { Status } from "../../../atoms/Status";
|
|
25
26
|
import { isUserTech } from "../../../../global-files/handle_userTech";
|
|
26
27
|
import { container } from "aws-amplify";
|
|
27
28
|
|
|
@@ -55,7 +56,10 @@ export const ContainerItems = (props) => {
|
|
|
55
56
|
|
|
56
57
|
useEffect(() => {
|
|
57
58
|
if (!items) return;
|
|
58
|
-
if (
|
|
59
|
+
if (
|
|
60
|
+
["merchant_product", "order_product", "product_status"].includes(chatType)
|
|
61
|
+
)
|
|
62
|
+
renderItems();
|
|
59
63
|
else if (chatType === "ticket") renderItemsTicket();
|
|
60
64
|
else setCustomItems([]);
|
|
61
65
|
}, [items]);
|
|
@@ -130,6 +134,16 @@ export const ContainerItems = (props) => {
|
|
|
130
134
|
return <label className="item-statusTicket">{item.value}</label>;
|
|
131
135
|
};
|
|
132
136
|
|
|
137
|
+
const renderStatusItem = (item) => {
|
|
138
|
+
const splitText = item.value.split("|");
|
|
139
|
+
let message = [];
|
|
140
|
+
splitText.forEach((text, i) => {
|
|
141
|
+
if (i === 1 || i === 3) message.push(<Status statusType={text} />);
|
|
142
|
+
else message.push(text);
|
|
143
|
+
});
|
|
144
|
+
return <label className="item-statusItem">{message}</label>;
|
|
145
|
+
};
|
|
146
|
+
|
|
133
147
|
const renderStatusTicketNeutral = (item) => {
|
|
134
148
|
return (
|
|
135
149
|
<Tooltip
|
|
@@ -304,7 +318,7 @@ export const ContainerItems = (props) => {
|
|
|
304
318
|
>
|
|
305
319
|
<li
|
|
306
320
|
className={
|
|
307
|
-
(ownMessage ? "own-message " : "") +
|
|
321
|
+
(ownMessage && item.type !== "status" ? "own-message " : "") +
|
|
308
322
|
(lastUserId === item.userId ? "sameUser" : "")
|
|
309
323
|
}
|
|
310
324
|
>
|
|
@@ -339,6 +353,8 @@ export const ContainerItems = (props) => {
|
|
|
339
353
|
? renderComment(item)
|
|
340
354
|
: item.type === "img"
|
|
341
355
|
? renderImg(item)
|
|
356
|
+
: item.type === "status"
|
|
357
|
+
? renderStatusItem(item)
|
|
342
358
|
: item.type === "file"
|
|
343
359
|
? renderFile(item, ownMessage)
|
|
344
360
|
: item.type === "statusTicket" &&
|
|
@@ -158,7 +158,8 @@ export const Container = styled.div`
|
|
|
158
158
|
.item-message,
|
|
159
159
|
.item-comment,
|
|
160
160
|
.item-file,
|
|
161
|
-
.item-statusTicket
|
|
161
|
+
.item-statusTicket,
|
|
162
|
+
.item-statusItem {
|
|
162
163
|
border-radius: 10px;
|
|
163
164
|
padding: 10px;
|
|
164
165
|
font-family: ${FontFamily.RobotoRegular}, sans-serif;
|
|
@@ -173,10 +174,17 @@ export const Container = styled.div`
|
|
|
173
174
|
.item-file {
|
|
174
175
|
background-color: #8386ee;
|
|
175
176
|
}
|
|
176
|
-
.item-statusTicket
|
|
177
|
+
.item-statusTicket,
|
|
178
|
+
.item-statusItem {
|
|
177
179
|
background-color: #85bc5b;
|
|
178
180
|
}
|
|
179
181
|
|
|
182
|
+
.item-statusItem {
|
|
183
|
+
display: flex;
|
|
184
|
+
gap: 3px;
|
|
185
|
+
align-items: center;
|
|
186
|
+
}
|
|
187
|
+
|
|
180
188
|
.item-message {
|
|
181
189
|
&.different-company {
|
|
182
190
|
border: 1px solid #e33aa9;
|
|
@@ -100,6 +100,7 @@ export const ContentChat = (props) => {
|
|
|
100
100
|
}
|
|
101
101
|
if (chatType === "merchant_product") getInitialMerchantProduct();
|
|
102
102
|
else if (chatType === "order_product") getInitialOrderProduct();
|
|
103
|
+
else if (chatType === "product_status") getInitialProductStatus();
|
|
103
104
|
else getInitialTicket();
|
|
104
105
|
}
|
|
105
106
|
if (!showPopUpChat) {
|
|
@@ -126,6 +127,8 @@ export const ContentChat = (props) => {
|
|
|
126
127
|
} else if (chatType === "order_product") {
|
|
127
128
|
if (companies) getUpdateLatestOrderProduct(true);
|
|
128
129
|
else getInitialOrderProduct();
|
|
130
|
+
} else if (chatType === "product_status") {
|
|
131
|
+
getInitialProductStatus();
|
|
129
132
|
} else {
|
|
130
133
|
if (singleChat.items) getUpdateLatestTicket(true);
|
|
131
134
|
else getInitialTicket();
|
|
@@ -135,6 +138,47 @@ export const ContentChat = (props) => {
|
|
|
135
138
|
/*=======================================================================
|
|
136
139
|
PETICION GET INICIAL SEGUN EL TIPO DE CHAT
|
|
137
140
|
======================================================================= */
|
|
141
|
+
const getInitialProductStatus = async () => {
|
|
142
|
+
const paramsQuery = {
|
|
143
|
+
articleData: {
|
|
144
|
+
articleId: JSON.stringify(dataChat.id),
|
|
145
|
+
version: JSON.stringify(dataChat.version),
|
|
146
|
+
retailerId: JSON.stringify(dataChat.retailerId),
|
|
147
|
+
status: dataChat.status,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
151
|
+
const response = await fetchGET(
|
|
152
|
+
process.env.REACT_APP_READ_MESSAGES,
|
|
153
|
+
paramsQuery,
|
|
154
|
+
paramsHeaders
|
|
155
|
+
);
|
|
156
|
+
if (!response.body) {
|
|
157
|
+
setErrorChat({
|
|
158
|
+
existError: true,
|
|
159
|
+
code: 400,
|
|
160
|
+
message: response.message,
|
|
161
|
+
errorDetail: response.errorDetail,
|
|
162
|
+
});
|
|
163
|
+
setIsLoading(false);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// success
|
|
167
|
+
setStartUpdate((prev) => prev + 1);
|
|
168
|
+
setCurrentUser({
|
|
169
|
+
id: response.body.data.currentUserId,
|
|
170
|
+
companyId: response.body.data.currentCompanyId,
|
|
171
|
+
});
|
|
172
|
+
setLastUpdateDate(response.body.data.lastUpdateDate);
|
|
173
|
+
setAllUsers(response.body.users);
|
|
174
|
+
setSingleChat({
|
|
175
|
+
items: response.body.items,
|
|
176
|
+
enabledLoadMore: response.body.items.length === 50,
|
|
177
|
+
});
|
|
178
|
+
setErrorChat({ existError: false });
|
|
179
|
+
setIsLoading(false);
|
|
180
|
+
};
|
|
181
|
+
|
|
138
182
|
const getInitialMerchantProduct = async () => {
|
|
139
183
|
const paramsQuery = {
|
|
140
184
|
getType: "initial",
|
|
@@ -609,12 +653,14 @@ export const ContentChat = (props) => {
|
|
|
609
653
|
// enviar items a la BD
|
|
610
654
|
if (chatType === "merchant_product") {
|
|
611
655
|
errorCreate = await createItemsMerchantProduct(items);
|
|
656
|
+
} else if (chatType === "product_status") {
|
|
657
|
+
errorCreate = await createItemsProductStatus(items);
|
|
612
658
|
} else if (chatType === "order_product") {
|
|
613
659
|
errorCreate = await createItemsOrderProduct(items);
|
|
614
660
|
} else errorCreate = await createItemsTicket(items);
|
|
615
661
|
|
|
616
662
|
// actualizar chat para que aparezcan los items enviados
|
|
617
|
-
if (
|
|
663
|
+
if (["merchant_product", "product_status"].includes(chatType)) {
|
|
618
664
|
await getUpdateLatestMerchantProduct();
|
|
619
665
|
} else if (chatType === "order_product") {
|
|
620
666
|
await getUpdateLatestOrderProduct();
|
|
@@ -627,9 +673,10 @@ export const ContentChat = (props) => {
|
|
|
627
673
|
};
|
|
628
674
|
|
|
629
675
|
const createItemsMerchantProduct = async (items = []) => {
|
|
630
|
-
const { id, version } = dataChat;
|
|
676
|
+
const { id, version, orderId } = dataChat;
|
|
631
677
|
const { id: retailerId } = activeRetailer;
|
|
632
678
|
const paramsBody = { id, version, items, retailerId };
|
|
679
|
+
if (chatType === "product_status") paramsBody["orderId"] = orderId;
|
|
633
680
|
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
634
681
|
const response = await fetchPOST(
|
|
635
682
|
process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT,
|
|
@@ -643,6 +690,23 @@ export const ContentChat = (props) => {
|
|
|
643
690
|
};
|
|
644
691
|
}
|
|
645
692
|
};
|
|
693
|
+
const createItemsProductStatus = async (items = []) => {
|
|
694
|
+
const { id, version, orderId, status } = dataChat;
|
|
695
|
+
const { id: retailerId } = activeRetailer;
|
|
696
|
+
const paramsBody = { id, version, items, retailerId, orderId, status };
|
|
697
|
+
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
698
|
+
const response = await fetchPOST(
|
|
699
|
+
process.env.REACT_APP_CREATE_MESSAGES,
|
|
700
|
+
paramsBody,
|
|
701
|
+
paramsHeaders
|
|
702
|
+
);
|
|
703
|
+
if (!response.body) {
|
|
704
|
+
return {
|
|
705
|
+
message: response.message,
|
|
706
|
+
errorDetail: response.errorDetail,
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
};
|
|
646
710
|
|
|
647
711
|
const createItemsOrderProduct = async (items = []) => {
|
|
648
712
|
const paramsBody = {
|
|
@@ -690,7 +754,11 @@ export const ContentChat = (props) => {
|
|
|
690
754
|
SECCION DE FUNCIONES
|
|
691
755
|
======================================================================= */
|
|
692
756
|
const isSingleChat = () => {
|
|
693
|
-
if (
|
|
757
|
+
if (
|
|
758
|
+
chatType === "merchant_product" ||
|
|
759
|
+
chatType === "ticket" ||
|
|
760
|
+
chatType === "product_status"
|
|
761
|
+
) {
|
|
694
762
|
return true;
|
|
695
763
|
}
|
|
696
764
|
if (companies && Object.keys(companies).length < 2) return true;
|
|
@@ -801,7 +869,7 @@ export const ContentChat = (props) => {
|
|
|
801
869
|
// mostrar chat?
|
|
802
870
|
let items;
|
|
803
871
|
let enabledLoadMore;
|
|
804
|
-
if (["merchant_product", "ticket"].includes(chatType)) {
|
|
872
|
+
if (["merchant_product", "ticket", "product_status"].includes(chatType)) {
|
|
805
873
|
items = singleChat.items;
|
|
806
874
|
enabledLoadMore = singleChat.enabledLoadMore;
|
|
807
875
|
}
|
|
@@ -843,7 +911,9 @@ export const ContentChat = (props) => {
|
|
|
843
911
|
activeCompanyId={activeCompanyId}
|
|
844
912
|
ticketCompany={ticketCompany}
|
|
845
913
|
currentUser={
|
|
846
|
-
["merchant_product", "order_product"].includes(
|
|
914
|
+
["merchant_product", "order_product", "product_status"].includes(
|
|
915
|
+
chatType
|
|
916
|
+
)
|
|
847
917
|
? currentUser
|
|
848
918
|
: dataChat.currentUser
|
|
849
919
|
}
|
|
@@ -882,6 +952,12 @@ export const ContentChat = (props) => {
|
|
|
882
952
|
? { id: dataChat.id, version: currentArticle.version }
|
|
883
953
|
: chatType === "ticket"
|
|
884
954
|
? { id: dataChat.id }
|
|
955
|
+
: chatType === "product_status"
|
|
956
|
+
? {
|
|
957
|
+
id: dataChat.id,
|
|
958
|
+
version: dataChat.version,
|
|
959
|
+
retailerId: dataChat.retailerId,
|
|
960
|
+
}
|
|
885
961
|
: undefined
|
|
886
962
|
}
|
|
887
963
|
chatCompany={getChatCompany()}
|
|
@@ -924,7 +1000,6 @@ export const ContentChat = (props) => {
|
|
|
924
1000
|
}}
|
|
925
1001
|
/>
|
|
926
1002
|
)}
|
|
927
|
-
|
|
928
1003
|
{/* body */}
|
|
929
1004
|
{renderBodyChat()}
|
|
930
1005
|
</Container>
|
|
@@ -169,6 +169,17 @@ export const Footer = (props) => {
|
|
|
169
169
|
errorMessage = "El ID del ticket no es valido";
|
|
170
170
|
}
|
|
171
171
|
break;
|
|
172
|
+
case "product_status":
|
|
173
|
+
if (
|
|
174
|
+
isValidNaturalNumber(dataChat?.id) &&
|
|
175
|
+
isValidNaturalNumber(dataChat?.version) &&
|
|
176
|
+
isValidNaturalNumber(dataChat?.retailerId)
|
|
177
|
+
) {
|
|
178
|
+
fileKey += `productStatus/${dataChat.id}-${dataChat?.version}-${dataChat?.retailerId}/`;
|
|
179
|
+
} else {
|
|
180
|
+
errorMessage = "El ID del ticket no es valido";
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
172
183
|
|
|
173
184
|
default:
|
|
174
185
|
errorMessage =
|
|
@@ -24,7 +24,7 @@ export const Chat = (props) => {
|
|
|
24
24
|
const [showPopUpChat, setShowPopUpChat] = useState(false);
|
|
25
25
|
const [data, setData] = useState();
|
|
26
26
|
|
|
27
|
-
const { ticketCompany } = chatData || {};
|
|
27
|
+
const { ticketCompany, retailerId } = chatData || {};
|
|
28
28
|
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
switch (chatType) {
|
|
@@ -37,6 +37,9 @@ export const Chat = (props) => {
|
|
|
37
37
|
case "ticket":
|
|
38
38
|
validateChatTicket();
|
|
39
39
|
break;
|
|
40
|
+
case "product_status":
|
|
41
|
+
validateProductStatus();
|
|
42
|
+
break;
|
|
40
43
|
default:
|
|
41
44
|
setData({
|
|
42
45
|
code: 404,
|
|
@@ -46,6 +49,45 @@ export const Chat = (props) => {
|
|
|
46
49
|
}
|
|
47
50
|
}, [chatType]);
|
|
48
51
|
|
|
52
|
+
const validateProductStatus = () => {
|
|
53
|
+
const {
|
|
54
|
+
userToken, // string
|
|
55
|
+
id, // number
|
|
56
|
+
version,
|
|
57
|
+
retailerId, // number
|
|
58
|
+
status,
|
|
59
|
+
orderId,
|
|
60
|
+
} = chatData;
|
|
61
|
+
|
|
62
|
+
if (!isValidGeneral(userToken, id)) return;
|
|
63
|
+
|
|
64
|
+
// validar el ID de la cadena asociada al producto en la OT
|
|
65
|
+
if (!isValidNaturalNumber(retailerId)) {
|
|
66
|
+
setDataError("La cadena relacionada al producto no es válida");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// validar el ID de la version asociada al producto en la OT
|
|
71
|
+
if (!isValidNaturalNumber(version)) {
|
|
72
|
+
setDataError("La versión del producto no es válida");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (orderId && !isValidNaturalNumber(orderId)) {
|
|
77
|
+
setDataError("La orden del producto no es válida");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setData({
|
|
82
|
+
userToken,
|
|
83
|
+
id,
|
|
84
|
+
version,
|
|
85
|
+
retailerId,
|
|
86
|
+
orderId,
|
|
87
|
+
status,
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
49
91
|
const isValidGeneral = (userToken, id) => {
|
|
50
92
|
// validar token del user
|
|
51
93
|
if (isStringEmpty(userToken)) {
|
|
@@ -69,6 +111,8 @@ export const Chat = (props) => {
|
|
|
69
111
|
retailerId, // number
|
|
70
112
|
} = chatData;
|
|
71
113
|
|
|
114
|
+
console.log(chatData, "chatData");
|
|
115
|
+
|
|
72
116
|
if (!isValidGeneral(userToken, id)) return;
|
|
73
117
|
|
|
74
118
|
// validar el ID de la OT en donde se encuentra el producto
|
|
@@ -197,7 +241,7 @@ export const Chat = (props) => {
|
|
|
197
241
|
dataChat={data}
|
|
198
242
|
showBtnClose={false}
|
|
199
243
|
ticketCompany={ticketCompany}
|
|
200
|
-
activeRetailer={props.activeRetailer}
|
|
244
|
+
activeRetailer={props.activeRetailer || { id: retailerId }}
|
|
201
245
|
/>
|
|
202
246
|
</ContainerFixed>
|
|
203
247
|
);
|
|
@@ -230,7 +274,7 @@ export const Chat = (props) => {
|
|
|
230
274
|
onClickBtnClose={() => {
|
|
231
275
|
setShowPopUpChat(false);
|
|
232
276
|
}}
|
|
233
|
-
activeRetailer={props.activeRetailer}
|
|
277
|
+
activeRetailer={props.activeRetailer || { id: retailerId }}
|
|
234
278
|
/>
|
|
235
279
|
</ContainerPopUp>
|
|
236
280
|
</Slide>
|
|
@@ -23,7 +23,7 @@ export const FullProductNameHeader = ({
|
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
const rtls = headerData?.retailers || headerData?.retailersAvailable;
|
|
25
25
|
servicesData &&
|
|
26
|
-
rtls
|
|
26
|
+
rtls?.forEach((rt) => {
|
|
27
27
|
const element = [];
|
|
28
28
|
servicesData.forEach((sd) => {
|
|
29
29
|
if (sd.id_retailer === rt.id) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SideModal } from ".";
|
|
2
|
+
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/organisms/SideModal",
|
|
6
|
+
component: SideModal,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template = (args) => <SideModal {...args} />;
|
|
10
|
+
|
|
11
|
+
export const DefaultSideModal = Template.bind({});
|
|
12
|
+
DefaultSideModal.args = {
|
|
13
|
+
show: false,
|
|
14
|
+
header: [
|
|
15
|
+
<div className="title-container">
|
|
16
|
+
<h2></h2>
|
|
17
|
+
</div>,
|
|
18
|
+
<ButtonV2 label="Ir al Checkout" />,
|
|
19
|
+
<ButtonV2 label="X" />,
|
|
20
|
+
],
|
|
21
|
+
body: <></>,
|
|
22
|
+
footer: <></>,
|
|
23
|
+
};
|