contentoh-components-library 21.2.58 → 21.2.60
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 +26 -23
- package/dist/assets/images/chatPopup/Spinner.gif +0 -0
- package/dist/assets/images/chatPopup/close.svg +3 -0
- package/dist/assets/images/chatPopup/defaultImage.png +0 -0
- package/dist/assets/images/chatPopup/defaultProfile.png +0 -0
- package/dist/assets/images/chatPopup/doc.svg +1 -0
- package/dist/assets/images/chatPopup/document.svg +1 -0
- package/dist/assets/images/chatPopup/iconChat.svg +19 -0
- package/dist/assets/images/chatPopup/iconPlus.svg +3 -0
- package/dist/assets/images/chatPopup/pdf.svg +75 -0
- package/dist/assets/images/chatPopup/remove.svg +4 -0
- package/dist/assets/images/chatPopup/send.svg +3 -0
- package/dist/assets/images/chatPopup/svgIcon.svg +109 -0
- package/dist/assets/images/chatPopup/upload_file.svg +3 -0
- package/dist/assets/images/chatPopup/xls.svg +53 -0
- package/dist/components/atoms/ChatPopUp/ChatPopUp.stories.js +28 -0
- package/dist/components/atoms/ChatPopUp/index.js +841 -0
- package/dist/components/atoms/ChatPopUp/styles.js +27 -0
- package/dist/components/atoms/ChatPopUp/utils/handlersChat.js +182 -0
- package/dist/components/atoms/Graphic/index.js +2 -1
- package/dist/components/atoms/Tooltip/Tooltip.stories.js +36 -0
- package/dist/components/atoms/Tooltip/index.js +55 -0
- package/dist/components/atoms/Tooltip/styles.js +18 -0
- package/dist/components/molecules/CustomSelect/index.js +4 -1
- package/dist/components/molecules/CustomSelect/styles.js +4 -1
- package/dist/components/molecules/HeaderTop/index.js +10 -5
- package/dist/components/molecules/HeaderTop/styles.js +1 -1
- package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +6 -0
- package/dist/components/organisms/DashboardMetric/index.js +3 -4
- package/dist/components/pages/Dashboard/Dashboard.stories.js +25 -25
- package/dist/components/pages/Dashboard/dashboardUtils.js +1 -1
- package/dist/components/pages/Dashboard/index.js +65 -103
- package/package.json +6 -1
- package/src/assets/images/chatPopup/Spinner.gif +0 -0
- package/src/assets/images/chatPopup/close.svg +3 -0
- package/src/assets/images/chatPopup/defaultImage.png +0 -0
- package/src/assets/images/chatPopup/defaultProfile.png +0 -0
- package/src/assets/images/chatPopup/doc.svg +1 -0
- package/src/assets/images/chatPopup/document.svg +1 -0
- package/src/assets/images/chatPopup/iconChat.svg +19 -0
- package/src/assets/images/chatPopup/iconPlus.svg +3 -0
- package/src/assets/images/chatPopup/pdf.svg +75 -0
- package/src/assets/images/chatPopup/remove.svg +4 -0
- package/src/assets/images/chatPopup/send.svg +3 -0
- package/src/assets/images/chatPopup/svgIcon.svg +109 -0
- package/src/assets/images/chatPopup/upload_file.svg +3 -0
- package/src/assets/images/chatPopup/xls.svg +53 -0
- package/src/components/atoms/ChatPopUp/ChatPopUp.stories.js +11 -0
- package/src/components/atoms/ChatPopUp/index.js +541 -0
- package/src/components/atoms/ChatPopUp/styles.js +278 -0
- package/src/components/atoms/ChatPopUp/utils/handlersChat.js +104 -0
- package/src/components/atoms/Graphic/index.js +4 -1
- package/src/components/atoms/Tooltip/Tooltip.stories.js +15 -0
- package/src/components/atoms/Tooltip/index.js +35 -0
- package/src/components/atoms/Tooltip/styles.js +5 -0
- package/src/components/molecules/CustomSelect/index.js +11 -2
- package/src/components/molecules/CustomSelect/styles.js +3 -1
- package/src/components/molecules/HeaderTop/index.js +10 -6
- package/src/components/molecules/HeaderTop/styles.js +4 -0
- package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +4 -0
- package/src/components/organisms/DashboardMetric/index.js +2 -2
- package/src/components/pages/Dashboard/Dashboard.stories.js +25 -25
- package/src/components/pages/Dashboard/dashboardUtils.js +1 -1
- package/src/components/pages/Dashboard/index.js +34 -40
|
@@ -29,8 +29,8 @@ export const Dashboard = ({ jwt, user, company }) => {
|
|
|
29
29
|
const [categoryId, setCategoryId] = useState([]);
|
|
30
30
|
const [companyId, setCompanyId] = useState([]);
|
|
31
31
|
const [datesRange, setDatesRange] = useState({
|
|
32
|
-
startDate: new Date("1900-01-01"),
|
|
33
|
-
endDate: new Date(),
|
|
32
|
+
startDate: formatDate(new Date("1900-01-01")),
|
|
33
|
+
endDate: formatDate(new Date()),
|
|
34
34
|
});
|
|
35
35
|
const [dateOptions, setDateOptions] = useState([]);
|
|
36
36
|
const applicants = [
|
|
@@ -40,21 +40,19 @@ export const Dashboard = ({ jwt, user, company }) => {
|
|
|
40
40
|
const [applicantsFilter, setApplicantsFilter] = useState([]);
|
|
41
41
|
const [totalCount, setTotalCount] = useState(0);
|
|
42
42
|
|
|
43
|
-
const loadProductVersions = async (queryObject
|
|
43
|
+
const loadProductVersions = async (queryObject) => {
|
|
44
44
|
const keys = Object.keys(queryObject);
|
|
45
45
|
let string = [];
|
|
46
46
|
keys.forEach((key) => string.push(`${key}=${queryObject[key]}`));
|
|
47
47
|
const query = string.join("&");
|
|
48
|
-
const endpoint =
|
|
49
|
-
? process.env.REACT_APP_READ_ORDERS_BY_STATUS
|
|
50
|
-
: process.env.REACT_APP_READ_REQUIRED_ORDERS;
|
|
48
|
+
const endpoint = process.env.REACT_APP_READ_ORDERS_BY_STATUS;
|
|
51
49
|
try {
|
|
52
50
|
const response = await axios.get(`${endpoint}?${query}`, {
|
|
53
51
|
headers: {
|
|
54
52
|
Authorization: jwt,
|
|
55
53
|
},
|
|
56
54
|
});
|
|
57
|
-
return JSON.parse(response.data.body);
|
|
55
|
+
return JSON.parse(response.data.body).data;
|
|
58
56
|
} catch (error) {
|
|
59
57
|
console.log(error);
|
|
60
58
|
}
|
|
@@ -79,34 +77,34 @@ export const Dashboard = ({ jwt, user, company }) => {
|
|
|
79
77
|
setRetailers(retailers);
|
|
80
78
|
};
|
|
81
79
|
|
|
82
|
-
const loadProductsByStatus = async (orderByStatus) => {
|
|
83
|
-
const {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const { total = 0, R = 0, ACA = 0, PA = 0 } = orders;
|
|
89
|
-
const inProcess = Object.keys(orders).reduce(
|
|
80
|
+
const loadProductsByStatus = async (orderByStatus, filter) => {
|
|
81
|
+
const { ordersBydate, ordersByStatus } =
|
|
82
|
+
(await loadProductVersions(orderByStatus)) || {};
|
|
83
|
+
|
|
84
|
+
const { total = 0, R = 0, ACA = 0, PA = 0 } = ordersByStatus;
|
|
85
|
+
const inProcess = Object.keys(ordersByStatus).reduce(
|
|
90
86
|
(prev, curr) =>
|
|
91
87
|
!["total", "ACA", "PA", "R"].includes(curr)
|
|
92
|
-
? prev +
|
|
88
|
+
? prev + ordersByStatus[curr]
|
|
93
89
|
: prev,
|
|
94
90
|
0
|
|
95
91
|
);
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
let metricsArray = [
|
|
93
|
+
metricsData[0]
|
|
94
|
+
? metricsData[0]
|
|
95
|
+
: { label: "Productos totales", value: total },
|
|
96
|
+
];
|
|
97
|
+
metricsArray.push(
|
|
98
|
+
{ label: "Productos filtrados", value: total },
|
|
98
99
|
{ label: "Productos sin asignar", value: PA + R },
|
|
99
100
|
{ label: "Productos en proceso", value: inProcess },
|
|
100
|
-
{ label: "Productos terminados", value: ACA }
|
|
101
|
-
|
|
101
|
+
{ label: "Productos terminados", value: ACA }
|
|
102
|
+
);
|
|
103
|
+
setMetricsData(metricsArray);
|
|
102
104
|
setTotalCount(total);
|
|
103
|
-
delete
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const loadRequiredProducts = async (orderByRequired) => {
|
|
108
|
-
const { dates } = await loadProductVersions(orderByRequired);
|
|
109
|
-
setRequiredProducts(dates);
|
|
105
|
+
delete ordersByStatus.total;
|
|
106
|
+
setRequiredProducts(ordersBydate);
|
|
107
|
+
setProductsByStatus(ordersByStatus);
|
|
110
108
|
};
|
|
111
109
|
|
|
112
110
|
const datesSelect = () => {
|
|
@@ -118,8 +116,8 @@ export const Dashboard = ({ jwt, user, company }) => {
|
|
|
118
116
|
name: "Todo el tiempo",
|
|
119
117
|
function: () =>
|
|
120
118
|
setDatesRange({
|
|
121
|
-
startDate: new Date("1900-01-01"),
|
|
122
|
-
endDate: new Date(),
|
|
119
|
+
startDate: formatDate(new Date("1900-01-01")),
|
|
120
|
+
endDate: formatDate(new Date()),
|
|
123
121
|
}),
|
|
124
122
|
},
|
|
125
123
|
{
|
|
@@ -197,16 +195,13 @@ export const Dashboard = ({ jwt, user, company }) => {
|
|
|
197
195
|
await getRetailers();
|
|
198
196
|
datesSelect();
|
|
199
197
|
const today = new Date();
|
|
200
|
-
const startDate =
|
|
201
|
-
const endDate =
|
|
202
|
-
today.getMonth() + 1
|
|
203
|
-
}-${today.getDate()}`;
|
|
198
|
+
const startDate = formatDate("1900-01-01");
|
|
199
|
+
const endDate = formatDate(today);
|
|
204
200
|
const queryObject = { startDate, endDate };
|
|
205
201
|
setDatesRange({ startDate, endDate });
|
|
206
202
|
setOrderByStatus(queryObject);
|
|
207
203
|
setOrderByRequired(queryObject);
|
|
208
204
|
loadProductsByStatus(queryObject);
|
|
209
|
-
loadRequiredProducts(queryObject);
|
|
210
205
|
}, []);
|
|
211
206
|
|
|
212
207
|
useEffect(() => {
|
|
@@ -219,8 +214,8 @@ export const Dashboard = ({ jwt, user, company }) => {
|
|
|
219
214
|
useEffect(async () => {
|
|
220
215
|
const { startDate, endDate } = datesRange;
|
|
221
216
|
const queryObject = {
|
|
222
|
-
startDate:
|
|
223
|
-
endDate:
|
|
217
|
+
startDate: startDate,
|
|
218
|
+
endDate: endDate,
|
|
224
219
|
};
|
|
225
220
|
companyId.length > 0 && (queryObject["companyId"] = companyId.join(","));
|
|
226
221
|
retailerId.length > 0 && (queryObject["retailerId"] = retailerId.join(","));
|
|
@@ -228,8 +223,7 @@ export const Dashboard = ({ jwt, user, company }) => {
|
|
|
228
223
|
applicantsFilter.length > 0 &&
|
|
229
224
|
(queryObject["requestedBy"] = applicantsFilter.join(","));
|
|
230
225
|
|
|
231
|
-
await loadProductsByStatus(queryObject);
|
|
232
|
-
await loadRequiredProducts(queryObject);
|
|
226
|
+
await loadProductsByStatus(queryObject, true);
|
|
233
227
|
}, [companyId, retailerId, categoryId, datesRange, applicantsFilter]);
|
|
234
228
|
|
|
235
229
|
return loading ? (
|
|
@@ -317,7 +311,8 @@ export const Dashboard = ({ jwt, user, company }) => {
|
|
|
317
311
|
displayLegend={true}
|
|
318
312
|
showPercent={true}
|
|
319
313
|
displayScale={false}
|
|
320
|
-
|
|
314
|
+
totalFiltered={totalCount}
|
|
315
|
+
total={metricsData[0]?.value}
|
|
321
316
|
/>
|
|
322
317
|
<DashboardMetric
|
|
323
318
|
label={"Productos solicitados"}
|
|
@@ -331,7 +326,6 @@ export const Dashboard = ({ jwt, user, company }) => {
|
|
|
331
326
|
retailerSelected={orderByRequired.retailerId}
|
|
332
327
|
queryObject={orderByRequired}
|
|
333
328
|
setQueryObject={(evt) => {
|
|
334
|
-
loadRequiredProducts(evt);
|
|
335
329
|
setOrderByRequired(evt);
|
|
336
330
|
}}
|
|
337
331
|
borderColor={"#3B1366"}
|