contentoh-components-library 21.2.50 → 21.2.52
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 +1 -0
- package/.env.production +2 -1
- package/dist/components/atoms/Graphic/index.js +30 -1
- package/dist/components/molecules/CustomSelect/index.js +30 -2
- package/dist/components/molecules/CustomSelect/styles.js +1 -1
- package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -1
- package/dist/components/organisms/DashboardMetric/index.js +20 -2
- package/dist/components/organisms/DashboardMetric/styles.js +1 -1
- package/dist/components/pages/Dashboard/Dashboard.stories.js +38 -24
- package/dist/components/pages/Dashboard/dashboardUtils.js +28 -17
- package/dist/components/pages/Dashboard/index.js +48 -15
- package/package.json +1 -1
- package/src/components/atoms/Graphic/index.js +30 -1
- package/src/components/molecules/CustomSelect/index.js +23 -1
- package/src/components/molecules/CustomSelect/styles.js +8 -0
- package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -1
- package/src/components/organisms/DashboardMetric/index.js +15 -1
- package/src/components/organisms/DashboardMetric/styles.js +31 -0
- package/src/components/pages/Dashboard/Dashboard.stories.js +38 -24
- package/src/components/pages/Dashboard/dashboardUtils.js +18 -8
- package/src/components/pages/Dashboard/index.js +36 -9
- 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
|
@@ -13,6 +13,7 @@ export const CustomSelect = ({
|
|
|
13
13
|
customSelectId = "defaultSelectId",
|
|
14
14
|
defaultOption,
|
|
15
15
|
setParameterArray,
|
|
16
|
+
showFilterString,
|
|
16
17
|
}) => {
|
|
17
18
|
const [filters, setFilters] = useState(options || []);
|
|
18
19
|
const [showList, setShowList] = useCloseModal(customSelectId);
|
|
@@ -21,6 +22,8 @@ export const CustomSelect = ({
|
|
|
21
22
|
const [startDate, setStartDate] = useState(new Date());
|
|
22
23
|
const [endDate, setEndDate] = useState(new Date());
|
|
23
24
|
const [activeFilters, setActiveFilters] = useState({});
|
|
25
|
+
const [filtersString, setFiltersString] = useState(selectLabel);
|
|
26
|
+
const [filtersCounter, setFiltersCounter] = useState(0);
|
|
24
27
|
|
|
25
28
|
const onChange = (evt) => {
|
|
26
29
|
setText(evt.target.value);
|
|
@@ -63,10 +66,26 @@ export const CustomSelect = ({
|
|
|
63
66
|
setFilters(filteredArray);
|
|
64
67
|
}, [text]);
|
|
65
68
|
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
let newFiltersString = selectLabel;
|
|
71
|
+
let counter = 0;
|
|
72
|
+
const filtersArray = Object.keys(activeFilters);
|
|
73
|
+
filtersArray.length &&
|
|
74
|
+
filtersArray.forEach((key, index) => {
|
|
75
|
+
if (index === 0) newFiltersString = key;
|
|
76
|
+
else {
|
|
77
|
+
counter++;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
counter > 0 && setFiltersCounter(counter);
|
|
81
|
+
setFiltersString(newFiltersString);
|
|
82
|
+
}, [activeFilters]);
|
|
83
|
+
|
|
66
84
|
return (
|
|
67
85
|
<Container id={customSelectId}>
|
|
68
86
|
<div className="button-list" onClick={() => setShowList(!showList)}>
|
|
69
|
-
<p>{
|
|
87
|
+
<p>{filtersString}</p>
|
|
88
|
+
<p>{filtersCounter > 0 && `+${filtersCounter}`}</p>
|
|
70
89
|
<div className="arrow-item">◀</div>
|
|
71
90
|
</div>
|
|
72
91
|
{showList && (
|
|
@@ -89,6 +108,8 @@ export const CustomSelect = ({
|
|
|
89
108
|
setParameterArray([]);
|
|
90
109
|
setActiveFilters({});
|
|
91
110
|
setShowList(false);
|
|
111
|
+
setFiltersString(selectLabel);
|
|
112
|
+
setFiltersCounter(0);
|
|
92
113
|
}}
|
|
93
114
|
>
|
|
94
115
|
<p>{defaultOption}</p>
|
|
@@ -104,6 +125,7 @@ export const CustomSelect = ({
|
|
|
104
125
|
option.function
|
|
105
126
|
? option.function(setShowDatePicker)
|
|
106
127
|
: setShowDatePicker(true);
|
|
128
|
+
setFiltersString(option.name);
|
|
107
129
|
}}
|
|
108
130
|
>
|
|
109
131
|
<p>{option.name}</p>
|
|
@@ -4,6 +4,7 @@ import { FontFamily } from "../../../global-files/variables";
|
|
|
4
4
|
export const Container = styled.div`
|
|
5
5
|
width: fit-content;
|
|
6
6
|
position: relative;
|
|
7
|
+
min-width: 150px;
|
|
7
8
|
|
|
8
9
|
.button-list {
|
|
9
10
|
font-family: ${FontFamily.Raleway};
|
|
@@ -16,6 +17,13 @@ export const Container = styled.div`
|
|
|
16
17
|
border: 1px solid #f0f0f0;
|
|
17
18
|
cursor: pointer;
|
|
18
19
|
|
|
20
|
+
& > p {
|
|
21
|
+
max-width: 140px;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
.arrow-item {
|
|
20
28
|
transform: rotate(-90deg);
|
|
21
29
|
cursor: pointer;
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
removeOldStatus,
|
|
6
6
|
getStatusColor,
|
|
7
7
|
} from "./dashboardMetricUtils";
|
|
8
|
+
import { FontFamily } from "../../../global-files/variables";
|
|
8
9
|
|
|
9
10
|
export const DashboardMetric = ({
|
|
10
11
|
label,
|
|
@@ -24,7 +25,7 @@ export const DashboardMetric = ({
|
|
|
24
25
|
: Object.keys(dataObject);
|
|
25
26
|
const newObject =
|
|
26
27
|
type === "doughnut" ? removeOldStatus(dataObject) : dataObject;
|
|
27
|
-
const values = Object.values(newObject);
|
|
28
|
+
const values = Object.values(newObject) || [0];
|
|
28
29
|
const colorsArray = Object.keys(newObject).map((key) => getStatusColor(key));
|
|
29
30
|
|
|
30
31
|
const data = {
|
|
@@ -69,6 +70,13 @@ export const DashboardMetric = ({
|
|
|
69
70
|
boxWidth: 8,
|
|
70
71
|
},
|
|
71
72
|
},
|
|
73
|
+
counter: {
|
|
74
|
+
fontFamily: "sans-serif",
|
|
75
|
+
fontSize: 25,
|
|
76
|
+
fontColor: "#707070",
|
|
77
|
+
textAlign: "center",
|
|
78
|
+
value: values?.reduce((a, b) => a + b) || 0,
|
|
79
|
+
},
|
|
72
80
|
},
|
|
73
81
|
scales: {
|
|
74
82
|
[scale]: {
|
|
@@ -77,6 +85,7 @@ export const DashboardMetric = ({
|
|
|
77
85
|
},
|
|
78
86
|
},
|
|
79
87
|
},
|
|
88
|
+
showTooltips: true,
|
|
80
89
|
};
|
|
81
90
|
|
|
82
91
|
return (
|
|
@@ -89,6 +98,11 @@ export const DashboardMetric = ({
|
|
|
89
98
|
<div className="graphic-cotainer">
|
|
90
99
|
<Graphic data={data} options={options} type={type} />
|
|
91
100
|
</div>
|
|
101
|
+
{type === "line" && <p className="x-label">Fechas</p>}
|
|
102
|
+
{type === "line" && <p className="y-label">Productos</p>}
|
|
103
|
+
{/* {type === "doughnut" && values.length > 0 && (
|
|
104
|
+
<p className="center-label">{values?.reduce((a, b) => a + b) || 0}</p>
|
|
105
|
+
)} */}
|
|
92
106
|
</Container>
|
|
93
107
|
);
|
|
94
108
|
};
|
|
@@ -5,6 +5,7 @@ export const Container = styled.div`
|
|
|
5
5
|
border: 1px solid ${GlobalColors.s3};
|
|
6
6
|
border-radius: 5px;
|
|
7
7
|
padding: 24px;
|
|
8
|
+
position: relative;
|
|
8
9
|
|
|
9
10
|
.text-container {
|
|
10
11
|
p {
|
|
@@ -57,4 +58,34 @@ export const Container = styled.div`
|
|
|
57
58
|
height: fill-available;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
61
|
+
|
|
62
|
+
& > p {
|
|
63
|
+
font-family: ${FontFamily.Raleway};
|
|
64
|
+
color: ${GlobalColors.s5};
|
|
65
|
+
font-size: 17px;
|
|
66
|
+
|
|
67
|
+
&.x-label {
|
|
68
|
+
position: absolute;
|
|
69
|
+
left: 50%;
|
|
70
|
+
transform: translate(-50%);
|
|
71
|
+
bottom: 4px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.y-label {
|
|
75
|
+
position: absolute;
|
|
76
|
+
transform: rotate(-90deg);
|
|
77
|
+
left: -28px;
|
|
78
|
+
top: 50%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.center-label {
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: 52%;
|
|
84
|
+
right: 58%;
|
|
85
|
+
font-size: 28px;
|
|
86
|
+
color: #000;
|
|
87
|
+
font-feature-settings: "pnum", "lnum";
|
|
88
|
+
font-family: ${FontFamily.Raleway_600};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
60
91
|
`;
|
|
@@ -9,37 +9,51 @@ const Template = (args) => <Dashboard {...args} />;
|
|
|
9
9
|
export const DashboardDeafult = Template.bind({});
|
|
10
10
|
DashboardDeafult.args = {
|
|
11
11
|
user: {
|
|
12
|
-
id_user:
|
|
13
|
-
name: "
|
|
14
|
-
last_name: "
|
|
15
|
-
email: "
|
|
12
|
+
id_user: 30,
|
|
13
|
+
name: "Admin",
|
|
14
|
+
last_name: "Ulises",
|
|
15
|
+
email: "salmeron.5@hotmail.com",
|
|
16
16
|
position: "Admin",
|
|
17
|
-
telephone: "
|
|
17
|
+
telephone: "",
|
|
18
18
|
country: "México",
|
|
19
|
-
id_company:
|
|
20
|
-
id_cognito: "
|
|
19
|
+
id_company: 2,
|
|
20
|
+
id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
|
|
21
21
|
birth_Date: null,
|
|
22
|
-
about_me:
|
|
23
|
-
zip_code:
|
|
24
|
-
address:
|
|
25
|
-
job:
|
|
22
|
+
about_me: "",
|
|
23
|
+
zip_code: "",
|
|
24
|
+
address: "",
|
|
25
|
+
job: "",
|
|
26
26
|
id_stripe: "",
|
|
27
|
-
id_role:
|
|
27
|
+
id_role: 6,
|
|
28
28
|
active: 1,
|
|
29
|
-
is_retailer:
|
|
29
|
+
is_retailer: 0,
|
|
30
30
|
email_notify: 1,
|
|
31
31
|
membership: {
|
|
32
|
-
id:
|
|
33
|
-
start_date: "2021-11-
|
|
34
|
-
end_date: "2022-11-
|
|
35
|
-
planID:
|
|
36
|
-
plan: "
|
|
37
|
-
name: "Plan
|
|
38
|
-
user_limit: "
|
|
39
|
-
products_limit: "
|
|
40
|
-
type: "
|
|
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
41
|
},
|
|
42
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
42
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1664606284528",
|
|
43
|
+
},
|
|
44
|
+
company: {
|
|
45
|
+
id_company: 2,
|
|
46
|
+
trade_name: "VINÍCOLA PASO DE SERRA",
|
|
47
|
+
company_name: "VINÍCOLA PASO DE SERRA",
|
|
48
|
+
rfc: null,
|
|
49
|
+
adress: null,
|
|
50
|
+
about_company: null,
|
|
51
|
+
telephone: null,
|
|
52
|
+
web_site: null,
|
|
53
|
+
zip_code: null,
|
|
54
|
+
email: null,
|
|
55
|
+
social_link: null,
|
|
56
|
+
is_retailer: 0,
|
|
43
57
|
},
|
|
44
|
-
jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
58
|
+
jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjp0cnVlLCJjb2duaXRvOnVzZXJuYW1lIjoiYzk0YTczMDUtOTM2NS00NmZmLWE0MjMtNGI0YmMzYjhiMTgwIiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6ODk4NjcwMjMyODA3OnJvbGVcL2NvbnRlbnRvaC1kZXYtdXMtZWFzdC0xLWxhbWJkYVJvbGUiXSwiYXVkIjoiNWFjOHRwZ3M2Z2JzcTEzZnJ2cnBpZWVwNDAiLCJldmVudF9pZCI6Ijg3YjQwMTMzLTE0YTMtNDgyOC1iYzE0LWU3ZTgxM2I2YmFmMSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjY0NjA2Mjg0LCJuYW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjY0NjA5ODg0LCJpYXQiOjE2NjQ2MDYyODQsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.J0L3zmJ2cZdPx4LjjscrZlPG41yCp1tOxE6WLl8K2lT_6fa-fNAQQLekKRmA9RwW--yA6z97xLu1oCjd_ZrErdc_aLMxxA2wCffh068QOD6Vil5aOCNA12QuTz7WhZlz3oOHe7hgx4PIi65u8--mstLqtmTH2_5OfoaTfcYllk1M65w-AfayozTlFaaXQID05nrwuGCc2gBl3SorBhbVvatRzCeZZjWOHRqOrxaJYY0Q97zNS6E0Nd4nPioIibUjGsKh_Hl-RUivSkDcKtszS8OYl4Alia00Ownz74rx7svZy9gpMy8t9TOonSlTTnHqOR5gPyBYO__OZMa55RiGtQ",
|
|
45
59
|
};
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
|
|
3
|
-
export const getProviders = async (jwt, companyId) => {
|
|
3
|
+
export const getProviders = async (jwt, user, companyId) => {
|
|
4
4
|
const query = companyId ? `?companyId=${companyId}` : "";
|
|
5
5
|
const companies = await axios.get(
|
|
6
|
-
`${
|
|
6
|
+
`${
|
|
7
|
+
user.is_retailer
|
|
8
|
+
? process.env.REACT_APP_PENDING_INVITATIONS
|
|
9
|
+
: process.env.REACT_APP_READ_PROVIDERS
|
|
10
|
+
}${query}`,
|
|
7
11
|
{
|
|
8
12
|
headers: {
|
|
9
13
|
Authorization: jwt,
|
|
10
14
|
},
|
|
11
15
|
}
|
|
12
16
|
);
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
);
|
|
17
|
+
const { usersFinanced } = JSON.parse(companies.data.body || "{}")?.data || {};
|
|
18
|
+
const { providers } = JSON.parse(companies.data.body || "{}");
|
|
19
|
+
const finalArray = transformProvidersArray(providers || usersFinanced || []);
|
|
16
20
|
return finalArray;
|
|
17
21
|
};
|
|
18
22
|
|
|
@@ -24,9 +28,15 @@ const transformProvidersArray = (array) => {
|
|
|
24
28
|
return newArray;
|
|
25
29
|
};
|
|
26
30
|
|
|
27
|
-
export const getCategories = async () => {
|
|
31
|
+
export const getCategories = async (user, company) => {
|
|
32
|
+
const isTHDUser = user.is_retailer === 1;
|
|
33
|
+
const key = company.financedRetailers ? "financedRetailers" : "retailers";
|
|
34
|
+
const query =
|
|
35
|
+
isTHDUser || key === "financedRetailers"
|
|
36
|
+
? `?id=${encodeURIComponent(company[key].map((ret) => ret.id).join(","))}`
|
|
37
|
+
: "";
|
|
28
38
|
const response = await axios.get(
|
|
29
|
-
`${process.env.REACT_APP_CATEGORY_ENDPOINT}`
|
|
39
|
+
`${process.env.REACT_APP_CATEGORY_ENDPOINT}${query}`
|
|
30
40
|
);
|
|
31
41
|
const categories = JSON.parse(response.data.body)?.data;
|
|
32
42
|
const categoriesKeys = Object.keys(categories || {});
|
|
@@ -49,7 +59,7 @@ export const getCategories = async () => {
|
|
|
49
59
|
finalArray.push({ id: index++, name: key, subOptions });
|
|
50
60
|
});
|
|
51
61
|
});
|
|
52
|
-
|
|
62
|
+
finalArray.sort((a, b) => a.name.localeCompare(b.name));
|
|
53
63
|
return finalArray;
|
|
54
64
|
};
|
|
55
65
|
|
|
@@ -7,7 +7,7 @@ import { CustomSelect } from "../../molecules/CustomSelect";
|
|
|
7
7
|
import { getProviders, getCategories, formatDate } from "./dashboardUtils";
|
|
8
8
|
import axios from "axios";
|
|
9
9
|
|
|
10
|
-
export const Dashboard = ({ jwt, user }) => {
|
|
10
|
+
export const Dashboard = ({ jwt, user, company }) => {
|
|
11
11
|
const [metricsData, setMetricsData] = useState([]);
|
|
12
12
|
const [productsByStatus, setProductsByStatus] = useState({});
|
|
13
13
|
const [requiredProducts, setRequiredProducts] = useState([]);
|
|
@@ -33,6 +33,11 @@ export const Dashboard = ({ jwt, user }) => {
|
|
|
33
33
|
endDate: new Date(),
|
|
34
34
|
});
|
|
35
35
|
const [dateOptions, setDateOptions] = useState([]);
|
|
36
|
+
const applicants = [
|
|
37
|
+
{ id: "provider", name: "Proveedor" },
|
|
38
|
+
{ id: "retailer", name: "Cadena" },
|
|
39
|
+
];
|
|
40
|
+
const [applicantsFilter, setApplicantsFilter] = useState([]);
|
|
36
41
|
|
|
37
42
|
const loadProductVersions = async (queryObject, byStatus = false) => {
|
|
38
43
|
const keys = Object.keys(queryObject);
|
|
@@ -75,6 +80,10 @@ export const Dashboard = ({ jwt, user }) => {
|
|
|
75
80
|
|
|
76
81
|
const loadProductsByStatus = async (orderByStatus) => {
|
|
77
82
|
const { orders } = (await loadProductVersions(orderByStatus, true)) || {};
|
|
83
|
+
if (orders.null) {
|
|
84
|
+
orders.total -= orders.null;
|
|
85
|
+
delete orders.null;
|
|
86
|
+
}
|
|
78
87
|
const { total = 0, R = 0, ACA = 0, PA = 0 } = orders;
|
|
79
88
|
const inProcess = Object.keys(orders).reduce(
|
|
80
89
|
(prev, curr) =>
|
|
@@ -181,8 +190,8 @@ export const Dashboard = ({ jwt, user }) => {
|
|
|
181
190
|
};
|
|
182
191
|
|
|
183
192
|
useEffect(async () => {
|
|
184
|
-
setProviders(await getProviders(jwt));
|
|
185
|
-
setCategories(await getCategories());
|
|
193
|
+
setProviders(await getProviders(jwt, user));
|
|
194
|
+
setCategories(await getCategories(user, company));
|
|
186
195
|
await getRetailers();
|
|
187
196
|
datesSelect();
|
|
188
197
|
const today = new Date();
|
|
@@ -214,9 +223,12 @@ export const Dashboard = ({ jwt, user }) => {
|
|
|
214
223
|
companyId.length > 0 && (queryObject["companyId"] = companyId.join(","));
|
|
215
224
|
retailerId.length > 0 && (queryObject["retailerId"] = retailerId.join(","));
|
|
216
225
|
categoryId.length > 0 && (queryObject["categoryId"] = categoryId.join(","));
|
|
226
|
+
applicantsFilter.length > 0 &&
|
|
227
|
+
(queryObject["requestedBy"] = applicantsFilter.join(","));
|
|
228
|
+
|
|
217
229
|
await loadProductsByStatus(queryObject);
|
|
218
230
|
await loadRequiredProducts(queryObject);
|
|
219
|
-
}, [companyId, retailerId, categoryId, datesRange]);
|
|
231
|
+
}, [companyId, retailerId, categoryId, datesRange, applicantsFilter]);
|
|
220
232
|
|
|
221
233
|
return loading ? (
|
|
222
234
|
<Loading />
|
|
@@ -224,17 +236,19 @@ export const Dashboard = ({ jwt, user }) => {
|
|
|
224
236
|
<Container>
|
|
225
237
|
<div className="filters">
|
|
226
238
|
<CustomSelect
|
|
239
|
+
showFilterString={true}
|
|
227
240
|
options={dateOptions}
|
|
228
|
-
selectLabel="
|
|
241
|
+
selectLabel="Todo el tiempo"
|
|
229
242
|
placeHolder="Buscar Fecha"
|
|
230
243
|
customSelectId="dates-select"
|
|
231
244
|
parameterArray={datesRange}
|
|
232
245
|
setParameterArray={setDatesRange}
|
|
233
246
|
/>
|
|
234
247
|
<CustomSelect
|
|
248
|
+
showFilterString={true}
|
|
235
249
|
showSearchBar={true}
|
|
236
250
|
options={providers}
|
|
237
|
-
selectLabel="
|
|
251
|
+
selectLabel="Todos los proveedores"
|
|
238
252
|
placeHolder="Buscar Proveedor"
|
|
239
253
|
customSelectId="providers-select"
|
|
240
254
|
parameterArray={companyId}
|
|
@@ -242,9 +256,10 @@ export const Dashboard = ({ jwt, user }) => {
|
|
|
242
256
|
defaultOption={"Todos los proveedores"}
|
|
243
257
|
/>
|
|
244
258
|
<CustomSelect
|
|
259
|
+
showFilterString={true}
|
|
245
260
|
showSearchBar={true}
|
|
246
261
|
options={categories}
|
|
247
|
-
selectLabel="
|
|
262
|
+
selectLabel="Todas las categorías"
|
|
248
263
|
placeHolder="Buscar Departamento"
|
|
249
264
|
customSelectId="category-select"
|
|
250
265
|
parameterArray={categoryId}
|
|
@@ -252,15 +267,27 @@ export const Dashboard = ({ jwt, user }) => {
|
|
|
252
267
|
defaultOption={"Todas las categorías"}
|
|
253
268
|
/>
|
|
254
269
|
<CustomSelect
|
|
270
|
+
showFilterString={true}
|
|
255
271
|
showSearchBar={true}
|
|
256
272
|
options={retailers}
|
|
257
|
-
selectLabel="
|
|
273
|
+
selectLabel="Todos los alcances"
|
|
258
274
|
placeHolder="Buscar Cadena"
|
|
259
275
|
customSelectId="retailers-select"
|
|
260
276
|
parameterArray={retailerId}
|
|
261
277
|
setParameterArray={setRetailerId}
|
|
262
278
|
defaultOption={"Todos los alcances"}
|
|
263
279
|
/>
|
|
280
|
+
{user.is_retailer === 1 && (
|
|
281
|
+
<CustomSelect
|
|
282
|
+
showFilterString={true}
|
|
283
|
+
options={applicants}
|
|
284
|
+
selectLabel="Todos los solicitantes"
|
|
285
|
+
customSelectId="applicants-select"
|
|
286
|
+
parameterArray={applicantsFilter}
|
|
287
|
+
setParameterArray={setApplicantsFilter}
|
|
288
|
+
defaultOption={"Todos los solicitantes"}
|
|
289
|
+
/>
|
|
290
|
+
)}
|
|
264
291
|
</div>
|
|
265
292
|
<div className="metric-cards">
|
|
266
293
|
{metricsData.map((metric, index) => (
|
|
@@ -287,6 +314,7 @@ export const Dashboard = ({ jwt, user }) => {
|
|
|
287
314
|
type="doughnut"
|
|
288
315
|
displayLegend={true}
|
|
289
316
|
showPercent={true}
|
|
317
|
+
displayScale={false}
|
|
290
318
|
/>
|
|
291
319
|
<DashboardMetric
|
|
292
320
|
label={"Productos solicitados"}
|
|
@@ -296,7 +324,6 @@ export const Dashboard = ({ jwt, user }) => {
|
|
|
296
324
|
dataObject={requiredProducts}
|
|
297
325
|
type="line"
|
|
298
326
|
indexAxis="x"
|
|
299
|
-
scale="x"
|
|
300
327
|
displayScale={true}
|
|
301
328
|
retailerSelected={orderByRequired.retailerId}
|
|
302
329
|
queryObject={orderByRequired}
|
|
@@ -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;
|