contentoh-components-library 21.2.27 → 21.2.28
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/.env.production +1 -0
- package/dist/assets/images/customSelect/searchIcon.png +0 -0
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +46 -53
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +18 -29
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +54 -0
- package/dist/components/molecules/CustomSelect/SelectItem.js +132 -0
- package/dist/components/molecules/CustomSelect/index.js +178 -0
- package/dist/components/molecules/CustomSelect/styles.js +20 -0
- package/dist/components/organisms/Calendar/styles.js +1 -1
- package/dist/components/organisms/DashboardMetric/index.js +5 -80
- package/dist/components/pages/Dashboard/Dashboard.stories.js +36 -1
- package/dist/components/pages/Dashboard/dashboardUtils.js +129 -0
- package/dist/components/pages/Dashboard/index.js +294 -65
- package/dist/components/pages/Dashboard/styles.js +1 -1
- package/dist/global-files/customHooks.js +0 -1
- package/package.json +1 -1
- package/src/assets/images/customSelect/searchIcon.png +0 -0
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +37 -55
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +69 -140
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +27 -0
- package/src/components/molecules/CustomSelect/SelectItem.js +97 -0
- package/src/components/molecules/CustomSelect/index.js +134 -0
- package/src/components/molecules/CustomSelect/styles.js +115 -0
- package/src/components/organisms/Calendar/styles.js +2 -0
- package/src/components/organisms/DashboardMetric/index.js +3 -58
- package/src/components/pages/Dashboard/Dashboard.stories.js +36 -1
- package/src/components/pages/Dashboard/dashboardUtils.js +62 -0
- package/src/components/pages/Dashboard/index.js +190 -26
- package/src/components/pages/Dashboard/styles.js +13 -0
- package/src/global-files/customHooks.js +0 -1
- package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +0 -36
- package/dist/components/atoms/ListCommercialRetailers/index.js +0 -64
- package/dist/components/atoms/ListCommercialRetailers/styles.js +0 -20
- package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +0 -37
- package/dist/components/atoms/MenuCommercialRetailers/index.js +0 -25
- package/dist/components/atoms/MenuCommercialRetailers/styles.js +0 -20
- package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +0 -28
- package/dist/components/atoms/MenuProductImage/index.js +0 -88
- package/dist/components/atoms/MenuProductImage/styles.js +0 -20
- package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +0 -25
- package/dist/components/molecules/ApproveRejetPanel/index.js +0 -49
- package/dist/components/molecules/ApproveRejetPanel/styles.js +0 -18
- package/dist/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +0 -28
- package/dist/components/molecules/SignInLoginCreationApp/index.js +0 -270
- package/dist/components/molecules/SignInLoginCreationApp/styles.js +0 -20
|
@@ -7,4 +7,39 @@ export default {
|
|
|
7
7
|
|
|
8
8
|
const Template = (args) => <Dashboard {...args} />;
|
|
9
9
|
export const DashboardDeafult = Template.bind({});
|
|
10
|
-
DashboardDeafult.args = {
|
|
10
|
+
DashboardDeafult.args = {
|
|
11
|
+
user: {
|
|
12
|
+
id_user: 30,
|
|
13
|
+
name: "Admin",
|
|
14
|
+
last_name: "Ulises",
|
|
15
|
+
email: "salmeron.5@hotmail.com",
|
|
16
|
+
position: "Admin",
|
|
17
|
+
telephone: null,
|
|
18
|
+
country: "México",
|
|
19
|
+
id_company: 2,
|
|
20
|
+
id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
|
|
21
|
+
birth_Date: null,
|
|
22
|
+
about_me: null,
|
|
23
|
+
zip_code: null,
|
|
24
|
+
address: null,
|
|
25
|
+
job: null,
|
|
26
|
+
id_stripe: null,
|
|
27
|
+
id_role: 4,
|
|
28
|
+
active: 1,
|
|
29
|
+
is_retailer: 0,
|
|
30
|
+
email_notify: 0,
|
|
31
|
+
membership: {
|
|
32
|
+
id: 2,
|
|
33
|
+
start_date: "2021-11-05T02:35:12.000Z",
|
|
34
|
+
end_date: "2022-11-05T02:34:49.000Z",
|
|
35
|
+
planID: 1,
|
|
36
|
+
plan: "prod_KtkvuFFLpOdP6e",
|
|
37
|
+
name: "Plan Free",
|
|
38
|
+
user_limit: "1",
|
|
39
|
+
products_limit: "3",
|
|
40
|
+
type: "PyMES",
|
|
41
|
+
},
|
|
42
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1662852605367",
|
|
43
|
+
},
|
|
44
|
+
jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjp0cnVlLCJjb2duaXRvOnVzZXJuYW1lIjoiYzk0YTczMDUtOTM2NS00NmZmLWE0MjMtNGI0YmMzYjhiMTgwIiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6ODk4NjcwMjMyODA3OnJvbGVcL2NvbnRlbnRvaC1kZXYtdXMtZWFzdC0xLWxhbWJkYVJvbGUiXSwiYXVkIjoiNWFjOHRwZ3M2Z2JzcTEzZnJ2cnBpZWVwNDAiLCJldmVudF9pZCI6ImQ0MDQ3ZWNiLWQwMGEtNGUyMS1iMjQ1LWEwMThlZjUzYjA4YSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjYyODUyNjAzLCJuYW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjYyODU2MjAzLCJpYXQiOjE2NjI4NTI2MDMsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.jEChPwSBUbK00Y8oQfzk9Qiul_zBo4nXaEH0hy5cOjfKMHd_caEh20aZqLPi3HeUgRo7H_oWpDHk2O8_IT1U52DmKNtjWl3GehIuZOkyCpJGO3bUW7YNqY911CslKvOVYgHlwGAywCZ0t_wbTSiH_DaeQ2xcutVVCe1dx0sObHjiQ_OHiYrRAOOPJC5y8R6WjaUSI2_4NBeBDtatpFT_oQ70rlH_uKHqg1BN9QAFC0au2elsri4uxpKTbAk20oNmPEgX5TaAdn4QcFhJSxUvyE1NAnpFnwYQhxKJphAblacGIuZziN8RnCC5c5fjhS1lDgH-mZcnGIBzzamGbRmqdA",
|
|
45
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
export const getProviders = async (jwt, companyId) => {
|
|
4
|
+
const query = companyId ? `?companyId=${companyId}` : "";
|
|
5
|
+
const companies = await axios.get(
|
|
6
|
+
`${process.env.REACT_APP_READ_PROVIDERS}${query}`,
|
|
7
|
+
{
|
|
8
|
+
headers: {
|
|
9
|
+
Authorization: jwt,
|
|
10
|
+
},
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
const finalArray = transformProvidersArray(
|
|
14
|
+
JSON.parse(companies.data.body || "{}")?.providers || []
|
|
15
|
+
);
|
|
16
|
+
return finalArray;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const transformProvidersArray = (array) => {
|
|
20
|
+
const newArray = [];
|
|
21
|
+
array.forEach((element) => {
|
|
22
|
+
newArray.push({ id: element.id_company, name: element.trade_name });
|
|
23
|
+
});
|
|
24
|
+
return newArray;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const getCategories = async () => {
|
|
28
|
+
const response = await axios.get(
|
|
29
|
+
`${process.env.REACT_APP_CATEGORY_ENDPOINT}`
|
|
30
|
+
);
|
|
31
|
+
const categories = JSON.parse(response.data.body)?.data;
|
|
32
|
+
const categoriesKeys = Object.keys(categories || {});
|
|
33
|
+
const subCategories = categoriesKeys?.map(
|
|
34
|
+
(key) => categories[key].sub_category
|
|
35
|
+
);
|
|
36
|
+
const finalArray = [];
|
|
37
|
+
let index = 0;
|
|
38
|
+
subCategories?.forEach((element) => {
|
|
39
|
+
element &&
|
|
40
|
+
Object.keys(element || {}).forEach((key) => {
|
|
41
|
+
const subCategory = element[key]?.sub_category || {};
|
|
42
|
+
const subOptions = [];
|
|
43
|
+
Object.keys(subCategory)?.forEach((subKey) => {
|
|
44
|
+
subOptions.push({
|
|
45
|
+
id: subCategory[subKey].id_category,
|
|
46
|
+
name: subKey,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
finalArray.push({ id: index++, name: key, subOptions });
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return finalArray;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const formatDate = (date) => {
|
|
57
|
+
const newDate = new Date(date);
|
|
58
|
+
const year = newDate.getFullYear();
|
|
59
|
+
const month = newDate.getMonth() + 1;
|
|
60
|
+
const day = newDate.getDate();
|
|
61
|
+
return `${year}-${month}-${day}`;
|
|
62
|
+
};
|
|
@@ -3,9 +3,11 @@ import { MetricCard } from "../../atoms/MetricCard";
|
|
|
3
3
|
import { DashboardMetric } from "../../organisms/DashboardMetric";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
5
|
import { Loading } from "../../atoms/Loading";
|
|
6
|
+
import { CustomSelect } from "../../molecules/CustomSelect";
|
|
7
|
+
import { getProviders, getCategories, formatDate } from "./dashboardUtils";
|
|
6
8
|
import axios from "axios";
|
|
7
9
|
|
|
8
|
-
export const Dashboard = () => {
|
|
10
|
+
export const Dashboard = ({ jwt, user }) => {
|
|
9
11
|
const [metricsData, setMetricsData] = useState([]);
|
|
10
12
|
const [productsByStatus, setProductsByStatus] = useState({});
|
|
11
13
|
const [requiredProducts, setRequiredProducts] = useState([]);
|
|
@@ -19,15 +21,33 @@ export const Dashboard = () => {
|
|
|
19
21
|
startDate: null,
|
|
20
22
|
endDate: null,
|
|
21
23
|
});
|
|
22
|
-
const [retailers, setRetailers] = useState(
|
|
24
|
+
const [retailers, setRetailers] = useState([]);
|
|
23
25
|
const [loading, setLoading] = useState(true);
|
|
26
|
+
const [providers, setProviders] = useState([]);
|
|
27
|
+
const [categories, setCategories] = useState([]);
|
|
28
|
+
const [retailerId, setRetailerId] = useState([]);
|
|
29
|
+
const [categoryId, setCategoryId] = useState([]);
|
|
30
|
+
const [companyId, setCompanyId] = useState([]);
|
|
31
|
+
const [datesRange, setDatesRange] = useState({
|
|
32
|
+
startDate: new Date("1900-01-01"),
|
|
33
|
+
endDate: new Date(),
|
|
34
|
+
});
|
|
35
|
+
const [dateOptions, setDateOptions] = useState([]);
|
|
24
36
|
|
|
25
37
|
const loadProductVersions = async (queryObject, byStatus = false) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
38
|
+
const keys = Object.keys(queryObject);
|
|
39
|
+
let string = [];
|
|
40
|
+
keys.forEach((key) => string.push(`${key}=${queryObject[key]}`));
|
|
41
|
+
const query = string.join("&");
|
|
42
|
+
const endpoint = byStatus
|
|
43
|
+
? process.env.REACT_APP_READ_ORDERS_BY_STATUS
|
|
44
|
+
: process.env.REACT_APP_READ_REQUIRED_ORDERS;
|
|
29
45
|
try {
|
|
30
|
-
const response = await axios.get(`${endpoint}?${query}
|
|
46
|
+
const response = await axios.get(`${endpoint}?${query}`, {
|
|
47
|
+
headers: {
|
|
48
|
+
Authorization: jwt,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
31
51
|
return JSON.parse(response.data.body);
|
|
32
52
|
} catch (error) {
|
|
33
53
|
console.log(error);
|
|
@@ -35,33 +55,41 @@ export const Dashboard = () => {
|
|
|
35
55
|
};
|
|
36
56
|
|
|
37
57
|
const getRetailers = async () => {
|
|
58
|
+
const isTHDUser = [657, 818, 819].includes(user.id_company);
|
|
38
59
|
const retailersResponse = await axios.get(
|
|
39
60
|
`${process.env.REACT_APP_RETAILER_ENDPOINT}`,
|
|
40
61
|
{
|
|
41
62
|
headers: {
|
|
42
|
-
Authorization:
|
|
63
|
+
Authorization: jwt,
|
|
43
64
|
},
|
|
44
65
|
}
|
|
45
66
|
);
|
|
46
67
|
const parsed = JSON.parse(retailersResponse.data.body).data;
|
|
47
|
-
const retailers =
|
|
48
|
-
|
|
49
|
-
|
|
68
|
+
const retailers = isTHDUser
|
|
69
|
+
? Object.values(parsed).filter((value) =>
|
|
70
|
+
[58, 59, 60, 61].includes(value.id)
|
|
71
|
+
)
|
|
72
|
+
: Object.values(parsed);
|
|
50
73
|
setRetailers(retailers);
|
|
51
74
|
};
|
|
52
75
|
|
|
53
76
|
const loadProductsByStatus = async (orderByStatus) => {
|
|
54
|
-
const { orders
|
|
55
|
-
const { total, R, ACA, PA } =
|
|
56
|
-
const inProcess = Object.keys(
|
|
57
|
-
|
|
58
|
-
|
|
77
|
+
const { orders } = (await loadProductVersions(orderByStatus, true)) || {};
|
|
78
|
+
const { total = 0, R = 0, ACA = 0, PA = 0 } = orders;
|
|
79
|
+
const inProcess = Object.keys(orders).reduce(
|
|
80
|
+
(prev, curr) =>
|
|
81
|
+
!["total", "ACA", "PA", "R"].includes(curr)
|
|
82
|
+
? prev + orders[curr]
|
|
83
|
+
: prev,
|
|
84
|
+
0
|
|
85
|
+
);
|
|
59
86
|
setMetricsData([
|
|
60
87
|
{ label: "Productos totales", value: total },
|
|
61
88
|
{ label: "Productos sin asignar", value: PA + R },
|
|
62
89
|
{ label: "Productos en proceso", value: inProcess },
|
|
63
90
|
{ label: "Productos terminados", value: ACA },
|
|
64
91
|
]);
|
|
92
|
+
delete orders.total;
|
|
65
93
|
setProductsByStatus(orders);
|
|
66
94
|
};
|
|
67
95
|
|
|
@@ -70,34 +98,170 @@ export const Dashboard = () => {
|
|
|
70
98
|
setRequiredProducts(dates);
|
|
71
99
|
};
|
|
72
100
|
|
|
73
|
-
|
|
101
|
+
const datesSelect = () => {
|
|
74
102
|
const today = new Date();
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
103
|
+
setDateOptions([
|
|
104
|
+
{ id: 0, name: "Rango de fechas" },
|
|
105
|
+
{
|
|
106
|
+
id: 1,
|
|
107
|
+
name: "Todo el tiempo",
|
|
108
|
+
function: () =>
|
|
109
|
+
setDatesRange({
|
|
110
|
+
startDate: new Date("1900-01-01"),
|
|
111
|
+
endDate: new Date(),
|
|
112
|
+
}),
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: 2,
|
|
116
|
+
name: "Hoy",
|
|
117
|
+
function: () =>
|
|
118
|
+
setDatesRange({
|
|
119
|
+
startDate: new Date(),
|
|
120
|
+
endDate: new Date(),
|
|
121
|
+
}),
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: 3,
|
|
125
|
+
name: "Ayer",
|
|
126
|
+
function: () =>
|
|
127
|
+
setDatesRange({
|
|
128
|
+
startDate: new Date(today.setDate(today.getDate() - 1)),
|
|
129
|
+
endDate: new Date(),
|
|
130
|
+
}),
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: 4,
|
|
134
|
+
name: "Esta semana",
|
|
135
|
+
function: () =>
|
|
136
|
+
setDatesRange({
|
|
137
|
+
startDate: new Date(
|
|
138
|
+
today.setDate(today.getDate() - today.getDay())
|
|
139
|
+
),
|
|
140
|
+
endDate: new Date(),
|
|
141
|
+
}),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 5,
|
|
145
|
+
name: "La semana pasada",
|
|
146
|
+
function: () =>
|
|
147
|
+
setDatesRange({
|
|
148
|
+
startDate: new Date(
|
|
149
|
+
today.setDate(today.getDate() - today.getDay() - 7)
|
|
150
|
+
),
|
|
151
|
+
endDate: new Date(
|
|
152
|
+
today.setDate(today.getDate() - today.getDay() + 7)
|
|
153
|
+
),
|
|
154
|
+
}),
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
id: 6,
|
|
158
|
+
name: "Este mes",
|
|
159
|
+
function: () =>
|
|
160
|
+
setDatesRange({
|
|
161
|
+
startDate: new Date(
|
|
162
|
+
`${today.getFullYear()}-${today.getMonth() + 1}-01`
|
|
163
|
+
),
|
|
164
|
+
endDate: today,
|
|
165
|
+
}),
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: 7,
|
|
169
|
+
name: "Este mes",
|
|
170
|
+
function: () =>
|
|
171
|
+
setDatesRange({
|
|
172
|
+
startDate: new Date(
|
|
173
|
+
`${today.getFullYear()}-${today.getMonth()}-01`
|
|
174
|
+
),
|
|
175
|
+
endDate: new Date(
|
|
176
|
+
`${today.getFullYear()}-${today.getMonth() + 1}-01`
|
|
177
|
+
),
|
|
178
|
+
}),
|
|
179
|
+
},
|
|
180
|
+
]);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
useEffect(async () => {
|
|
184
|
+
setProviders(await getProviders(jwt));
|
|
185
|
+
setCategories(await getCategories());
|
|
186
|
+
await getRetailers();
|
|
187
|
+
datesSelect();
|
|
188
|
+
const today = new Date();
|
|
189
|
+
const startDate = `1900-01-01`;
|
|
79
190
|
const endDate = `${today.getFullYear()}-${
|
|
80
191
|
today.getMonth() + 1
|
|
81
192
|
}-${today.getDate()}`;
|
|
82
|
-
const queryObject = {
|
|
193
|
+
const queryObject = { startDate, endDate };
|
|
194
|
+
setDatesRange({ startDate, endDate });
|
|
83
195
|
setOrderByStatus(queryObject);
|
|
84
196
|
setOrderByRequired(queryObject);
|
|
85
|
-
getRetailers();
|
|
86
197
|
loadProductsByStatus(queryObject);
|
|
87
198
|
loadRequiredProducts(queryObject);
|
|
88
199
|
}, []);
|
|
89
200
|
|
|
90
201
|
useEffect(() => {
|
|
91
|
-
orderByRequired?.
|
|
92
|
-
orderByStatus?.
|
|
202
|
+
orderByRequired?.startDate &&
|
|
203
|
+
orderByStatus?.endDate &&
|
|
93
204
|
metricsData.length > 0 &&
|
|
94
205
|
setLoading(false);
|
|
95
206
|
}, [orderByRequired, orderByStatus, metricsData]);
|
|
96
207
|
|
|
208
|
+
useEffect(async () => {
|
|
209
|
+
const { startDate, endDate } = datesRange;
|
|
210
|
+
const queryObject = {
|
|
211
|
+
startDate: formatDate(startDate),
|
|
212
|
+
endDate: formatDate(endDate),
|
|
213
|
+
};
|
|
214
|
+
companyId.length > 0 && (queryObject["companyId"] = companyId.join(","));
|
|
215
|
+
retailerId.length > 0 && (queryObject["retailerId"] = retailerId.join(","));
|
|
216
|
+
categoryId.length > 0 && (queryObject["categoryId"] = categoryId.join(","));
|
|
217
|
+
await loadProductsByStatus(queryObject);
|
|
218
|
+
await loadRequiredProducts(queryObject);
|
|
219
|
+
}, [companyId, retailerId, categoryId, datesRange]);
|
|
220
|
+
|
|
97
221
|
return loading ? (
|
|
98
222
|
<Loading />
|
|
99
223
|
) : (
|
|
100
224
|
<Container>
|
|
225
|
+
<div className="filters">
|
|
226
|
+
<CustomSelect
|
|
227
|
+
options={dateOptions}
|
|
228
|
+
selectLabel="Seleccionar Fecha"
|
|
229
|
+
placeHolder="Buscar Fecha"
|
|
230
|
+
customSelectId="dates-select"
|
|
231
|
+
parameterArray={datesRange}
|
|
232
|
+
setParameterArray={setDatesRange}
|
|
233
|
+
/>
|
|
234
|
+
<CustomSelect
|
|
235
|
+
showSearchBar={true}
|
|
236
|
+
options={providers}
|
|
237
|
+
selectLabel="Seleccionar Proveedor"
|
|
238
|
+
placeHolder="Buscar Proveedor"
|
|
239
|
+
customSelectId="providers-select"
|
|
240
|
+
parameterArray={companyId}
|
|
241
|
+
setParameterArray={setCompanyId}
|
|
242
|
+
defaultOption={"Todos los proveedores"}
|
|
243
|
+
/>
|
|
244
|
+
<CustomSelect
|
|
245
|
+
showSearchBar={true}
|
|
246
|
+
options={categories}
|
|
247
|
+
selectLabel="Seleccionar Departamento"
|
|
248
|
+
placeHolder="Buscar Departamento"
|
|
249
|
+
customSelectId="category-select"
|
|
250
|
+
parameterArray={categoryId}
|
|
251
|
+
setParameterArray={setCategoryId}
|
|
252
|
+
defaultOption={"Todas las categorías"}
|
|
253
|
+
/>
|
|
254
|
+
<CustomSelect
|
|
255
|
+
showSearchBar={true}
|
|
256
|
+
options={retailers}
|
|
257
|
+
selectLabel="Seleccionar Alcance"
|
|
258
|
+
placeHolder="Buscar Cadena"
|
|
259
|
+
customSelectId="retailers-select"
|
|
260
|
+
parameterArray={retailerId}
|
|
261
|
+
setParameterArray={setRetailerId}
|
|
262
|
+
defaultOption={"Todos los alcances"}
|
|
263
|
+
/>
|
|
264
|
+
</div>
|
|
101
265
|
<div className="metric-cards">
|
|
102
266
|
{metricsData.map((metric, index) => (
|
|
103
267
|
<MetricCard
|
|
@@ -115,12 +279,13 @@ export const Dashboard = () => {
|
|
|
115
279
|
}
|
|
116
280
|
dataObject={productsByStatus}
|
|
117
281
|
retailerSelected={orderByStatus.retailerId}
|
|
118
|
-
retailers={retailers}
|
|
119
282
|
queryObject={orderByStatus}
|
|
120
283
|
setQueryObject={(evt) => {
|
|
121
284
|
loadProductsByStatus(evt);
|
|
122
285
|
setOrderByStatus(evt);
|
|
123
286
|
}}
|
|
287
|
+
type="doughnut"
|
|
288
|
+
displayLegend={true}
|
|
124
289
|
/>
|
|
125
290
|
<DashboardMetric
|
|
126
291
|
label={"Productos solicitados"}
|
|
@@ -132,7 +297,6 @@ export const Dashboard = () => {
|
|
|
132
297
|
indexAxis="x"
|
|
133
298
|
scale="x"
|
|
134
299
|
displayScale={true}
|
|
135
|
-
retailers={retailers}
|
|
136
300
|
retailerSelected={orderByRequired.retailerId}
|
|
137
301
|
queryObject={orderByRequired}
|
|
138
302
|
setQueryObject={(evt) => {
|
|
@@ -2,6 +2,19 @@ import styled from "styled-components";
|
|
|
2
2
|
|
|
3
3
|
export const Container = styled.div`
|
|
4
4
|
padding: 30px;
|
|
5
|
+
|
|
6
|
+
.filters {
|
|
7
|
+
display: flex;
|
|
8
|
+
& > * {
|
|
9
|
+
& + * {
|
|
10
|
+
margin-left: 10px;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
& + * {
|
|
14
|
+
margin-top: 20px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
5
18
|
.metric-cards {
|
|
6
19
|
display: flex;
|
|
7
20
|
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.ListCommercialRetailersDefault = void 0;
|
|
7
|
-
|
|
8
|
-
var _index = require("./index");
|
|
9
|
-
|
|
10
|
-
var _default = {
|
|
11
|
-
title: "Components/atoms/ListCommercialRetailers",
|
|
12
|
-
component: _index.ListCommercialRetailers
|
|
13
|
-
};
|
|
14
|
-
exports.default = _default;
|
|
15
|
-
|
|
16
|
-
var Template = function Template(args) {
|
|
17
|
-
return /*#__PURE__*/React.createElement(_index.ListCommercialRetailers, args);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
var ListCommercialRetailersDefault = Template.bind({});
|
|
21
|
-
exports.ListCommercialRetailersDefault = ListCommercialRetailersDefault;
|
|
22
|
-
ListCommercialRetailersDefault.args = {
|
|
23
|
-
retailersAvailable: [{
|
|
24
|
-
id: 54,
|
|
25
|
-
name: "Construrama",
|
|
26
|
-
country: "México",
|
|
27
|
-
id_region: 1,
|
|
28
|
-
active: 1
|
|
29
|
-
}, {
|
|
30
|
-
id: 4,
|
|
31
|
-
name: "Walmart Super y Superama"
|
|
32
|
-
}, {
|
|
33
|
-
id: 6,
|
|
34
|
-
name: "HEB"
|
|
35
|
-
}]
|
|
36
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.ListCommercialRetailers = void 0;
|
|
9
|
-
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
-
|
|
12
|
-
var _styles = require("./styles");
|
|
13
|
-
|
|
14
|
-
var _listCommercialRetailers = _interopRequireDefault(require("../../../assets/images/listCommercialRetailers/listCommercialRetailers.svg"));
|
|
15
|
-
|
|
16
|
-
var _react = require("react");
|
|
17
|
-
|
|
18
|
-
var _index = require("../CheckBox/index");
|
|
19
|
-
|
|
20
|
-
var ListCommercialRetailers = function ListCommercialRetailers(_ref) {
|
|
21
|
-
var retailersAvailable = _ref.retailersAvailable;
|
|
22
|
-
|
|
23
|
-
var _useState = (0, _react.useState)(false),
|
|
24
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
25
|
-
showMenu = _useState2[0],
|
|
26
|
-
setShowMenu = _useState2[1];
|
|
27
|
-
|
|
28
|
-
var closeMenu = function closeMenu(e) {
|
|
29
|
-
if (!e.target.closest(".menu-list-commercial-retailers") && showMenu) {
|
|
30
|
-
document.removeEventListener("click", closeMenu, false);
|
|
31
|
-
setShowMenu(false);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
(0, _react.useEffect)(function () {
|
|
36
|
-
if (showMenu) {
|
|
37
|
-
document.addEventListener("click", closeMenu, false);
|
|
38
|
-
}
|
|
39
|
-
}, [showMenu]);
|
|
40
|
-
return /*#__PURE__*/React.createElement(_styles.Container, {
|
|
41
|
-
onClick: function onClick(event) {
|
|
42
|
-
if (!showMenu) {
|
|
43
|
-
setShowMenu(true);
|
|
44
|
-
} else if (showMenu && !event.target.closest(".menu-list-commercial-retailers")) {
|
|
45
|
-
setShowMenu(false);
|
|
46
|
-
document.removeEventListener("click", closeMenu, false);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
className: "list-commercial-retailers"
|
|
50
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
51
|
-
src: _listCommercialRetailers.default,
|
|
52
|
-
alt: "button up icon"
|
|
53
|
-
}), showMenu && /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: "menu-list-commercial-retailers"
|
|
55
|
-
}, retailersAvailable === null || retailersAvailable === void 0 ? void 0 : retailersAvailable.map(function (component, index) {
|
|
56
|
-
return /*#__PURE__*/React.createElement(_index.CheckBox, {
|
|
57
|
-
id: component.id,
|
|
58
|
-
label: component.name,
|
|
59
|
-
key: index + "-" + component.id
|
|
60
|
-
});
|
|
61
|
-
})));
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
exports.ListCommercialRetailers = ListCommercialRetailers;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.Container = void 0;
|
|
9
|
-
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
11
|
-
|
|
12
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _variables = require("../../../global-files/variables");
|
|
15
|
-
|
|
16
|
-
var _templateObject;
|
|
17
|
-
|
|
18
|
-
var Container = _styledComponents.default.button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: transparent;\n border: 1px solid ", ";\n border-radius: 2px;\n padding: 3px;\n display: flex;\n align-items: center;\n cursor: pointer;\n position: relative;\n height: 30px;\n .menu-list-commercial-retailers {\n width: 540px;\n height: auto;\n border-radius: 7px;\n background-color: ", ";\n padding: 14px 14px 8px 20px;\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);\n position: absolute;\n top: calc(100% + 3px);\n right: calc(100% - 20px);\n display: flex;\n flex-wrap: wrap;\n z-index: 1;\n div {\n & + * {\n margin-left: 15px;\n }\n p {\n font-size: 11px;\n }\n }\n }\n"])), _variables.GlobalColors.magenta_s2, _variables.GlobalColors.s2);
|
|
19
|
-
|
|
20
|
-
exports.Container = Container;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.MenuCommercialRetailersDefault = void 0;
|
|
7
|
-
|
|
8
|
-
var _index = require("./index");
|
|
9
|
-
|
|
10
|
-
var _default = {
|
|
11
|
-
title: "Components/atoms/MenuCommercialRetailers",
|
|
12
|
-
component: _index.MenuCommercialRetailers
|
|
13
|
-
};
|
|
14
|
-
exports.default = _default;
|
|
15
|
-
|
|
16
|
-
var Template = function Template(args) {
|
|
17
|
-
return /*#__PURE__*/React.createElement(_index.MenuCommercialRetailers, args);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
var MenuCommercialRetailersDefault = Template.bind({});
|
|
21
|
-
exports.MenuCommercialRetailersDefault = MenuCommercialRetailersDefault;
|
|
22
|
-
MenuCommercialRetailersDefault.args = {
|
|
23
|
-
editType: "3",
|
|
24
|
-
retailersAvailable: [{
|
|
25
|
-
id: 54,
|
|
26
|
-
name: "Construrama",
|
|
27
|
-
country: "México",
|
|
28
|
-
id_region: 1,
|
|
29
|
-
active: 1
|
|
30
|
-
}, {
|
|
31
|
-
id: 4,
|
|
32
|
-
name: "Walmart Super y Superama"
|
|
33
|
-
}, {
|
|
34
|
-
id: 6,
|
|
35
|
-
name: "HEB"
|
|
36
|
-
}]
|
|
37
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MenuCommercialRetailers = void 0;
|
|
7
|
-
|
|
8
|
-
var _styles = require("./styles");
|
|
9
|
-
|
|
10
|
-
var _StatusTag = require("../StatusTag");
|
|
11
|
-
|
|
12
|
-
var _ListCommercialRetailers = require("../ListCommercialRetailers");
|
|
13
|
-
|
|
14
|
-
var MenuCommercialRetailers = function MenuCommercialRetailers(_ref) {
|
|
15
|
-
var editType = _ref.editType,
|
|
16
|
-
retailersAvailable = _ref.retailersAvailable;
|
|
17
|
-
return /*#__PURE__*/React.createElement(_styles.Container, null, /*#__PURE__*/React.createElement(_StatusTag.StatusTag, {
|
|
18
|
-
editType: editType,
|
|
19
|
-
ovalForm: true
|
|
20
|
-
}), /*#__PURE__*/React.createElement(_ListCommercialRetailers.ListCommercialRetailers, {
|
|
21
|
-
retailersAvailable: retailersAvailable
|
|
22
|
-
}));
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
exports.MenuCommercialRetailers = MenuCommercialRetailers;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.Container = void 0;
|
|
9
|
-
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
11
|
-
|
|
12
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _variables = require("../../../global-files/variables");
|
|
15
|
-
|
|
16
|
-
var _templateObject;
|
|
17
|
-
|
|
18
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n .status-version {\n & + * {\n margin-left: 5px;\n }\n }\n .list-commercial-retailers {\n border: 1px solid transparent;\n img {\n display: none;\n }\n &:hover {\n border: 1px solid ", ";\n img {\n display: block;\n }\n }\n }\n"])), _variables.GlobalColors.magenta_s2);
|
|
19
|
-
|
|
20
|
-
exports.Container = Container;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = exports.MenuProductImageDefault = void 0;
|
|
9
|
-
|
|
10
|
-
var _index = require("./index");
|
|
11
|
-
|
|
12
|
-
var _menuProductImage = _interopRequireDefault(require("../../../assets/images/menuProductImage/menuProductImage.svg"));
|
|
13
|
-
|
|
14
|
-
var _default = {
|
|
15
|
-
title: "Components/atoms/MenuProductImage",
|
|
16
|
-
component: _index.MenuProductImage
|
|
17
|
-
};
|
|
18
|
-
exports.default = _default;
|
|
19
|
-
|
|
20
|
-
var Template = function Template(args) {
|
|
21
|
-
return /*#__PURE__*/React.createElement(_index.MenuProductImage, args);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
var MenuProductImageDefault = Template.bind({});
|
|
25
|
-
exports.MenuProductImageDefault = MenuProductImageDefault;
|
|
26
|
-
MenuProductImageDefault.args = {
|
|
27
|
-
ProductImg: _menuProductImage.default
|
|
28
|
-
};
|