contentoh-components-library 21.4.2 → 21.4.4
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 +0 -1
- package/.env.production +0 -1
- package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
- package/dist/components/atoms/Avatar/index.js +2 -3
- package/dist/components/atoms/CheckBox/index.js +1 -4
- package/dist/components/atoms/CheckBox/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +28 -41
- package/dist/components/pages/RetailerProductEdition/index.js +0 -23
- package/dist/global-files/customHooks.js +0 -1
- package/dist/index.js +58 -201
- package/package.json +1 -2
- package/src/components/atoms/Avatar/index.js +2 -8
- package/src/components/atoms/CheckBox/index.js +1 -2
- package/src/components/atoms/CheckBox/styles.js +0 -2
- package/src/components/organisms/OrderDetail/utils/Table/utils.js +16 -6
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +21 -39
- package/src/components/pages/RetailerProductEdition/index.js +0 -12
- package/src/global-files/customHooks.js +0 -1
- package/src/index.js +0 -12
- package/dist/components/atoms/ImageCarousel/ImgeSlider.stories.js +0 -90
- package/dist/components/atoms/ImageCarousel/index.js +0 -120
- package/dist/components/atoms/ImageCarousel/styles.js +0 -18
- package/dist/components/atoms/PercentTag/PercentTag.stories.js +0 -31
- package/dist/components/atoms/PercentTag/index.js +0 -23
- package/dist/components/atoms/PercentTag/styles.js +0 -22
- package/dist/components/atoms/RatingStars/RatingStars.stories.js +0 -30
- package/dist/components/atoms/RatingStars/index.js +0 -53
- package/dist/components/atoms/RatingStars/styles.js +0 -18
- package/dist/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +0 -48
- package/dist/components/atoms/RetailerCatalog/index.js +0 -70
- package/dist/components/atoms/RetailerCatalog/styles.js +0 -20
- package/dist/components/atoms/RetailerOption/RetailerOption.stories.js +0 -33
- package/dist/components/atoms/RetailerOption/index.js +0 -62
- package/dist/components/atoms/RetailerOption/styles.js +0 -20
- package/dist/components/atoms/RetailersList/RetailersList.stories.js +0 -45
- package/dist/components/atoms/RetailersList/index.js +0 -46
- package/dist/components/atoms/RetailersList/styles.js +0 -18
- package/dist/components/atoms/UserCatalog/UserCatalog.stories.js +0 -73
- package/dist/components/atoms/UserCatalog/index.js +0 -103
- package/dist/components/atoms/UserCatalog/styles.js +0 -18
- package/dist/components/atoms/UserOption/UserOption.stories.js +0 -40
- package/dist/components/atoms/UserOption/index.js +0 -127
- package/dist/components/atoms/UserOption/styles.js +0 -20
- package/dist/components/atoms/UserSelector/UserSelector.stories.js +0 -40
- package/dist/components/atoms/UserSelector/index.js +0 -100
- package/dist/components/atoms/UserSelector/styles.js +0 -32
- package/dist/components/molecules/GridItem/GridItem.stories.js +0 -123
- package/dist/components/molecules/GridItem/index.js +0 -123
- package/dist/components/molecules/GridItem/styles.js +0 -20
- package/dist/components/molecules/HeaderItem/ColumnItem.js +0 -23
- package/dist/components/molecules/HeaderItem/HeaderItem.stories.js +0 -70
- package/dist/components/molecules/HeaderItem/index.js +0 -42
- package/dist/components/molecules/HeaderItem/styles.js +0 -30
- package/dist/components/molecules/RowItem/ColumnItem.js +0 -23
- package/dist/components/molecules/RowItem/RowItem.stories.js +0 -5242
- package/dist/components/molecules/RowItem/index.js +0 -58
- package/dist/components/molecules/RowItem/styles.js +0 -30
- package/dist/components/organisms/GridProducts/GridProducts.stories.js +0 -5097
- package/dist/components/organisms/GridProducts/index.js +0 -63
- package/dist/components/organisms/GridProducts/styles.js +0 -18
- package/dist/components/organisms/GridProducts/utils.js +0 -144
- package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +0 -76
- package/src/components/atoms/ImageCarousel/index.js +0 -103
- package/src/components/atoms/ImageCarousel/styles.js +0 -79
- package/src/components/atoms/PercentTag/PercentTag.stories.js +0 -7
- package/src/components/atoms/PercentTag/index.js +0 -9
- package/src/components/atoms/PercentTag/styles.js +0 -69
- package/src/components/atoms/RatingStars/RatingStars.stories.js +0 -10
- package/src/components/atoms/RatingStars/index.js +0 -31
- package/src/components/atoms/RatingStars/styles.js +0 -28
- package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +0 -36
- package/src/components/atoms/RetailerCatalog/index.js +0 -49
- package/src/components/atoms/RetailerCatalog/styles.js +0 -30
- package/src/components/atoms/RetailerOption/RetailerOption.stories.js +0 -15
- package/src/components/atoms/RetailerOption/index.js +0 -53
- package/src/components/atoms/RetailerOption/styles.js +0 -41
- package/src/components/atoms/RetailersList/RetailersList.stories.js +0 -33
- package/src/components/atoms/RetailersList/index.js +0 -20
- package/src/components/atoms/RetailersList/styles.js +0 -19
- package/src/components/atoms/UserCatalog/UserCatalog.stories.js +0 -67
- package/src/components/atoms/UserCatalog/index.js +0 -96
- package/src/components/atoms/UserCatalog/styles.js +0 -24
- package/src/components/atoms/UserOption/UserOption.stories.js +0 -25
- package/src/components/atoms/UserOption/index.js +0 -88
- package/src/components/atoms/UserOption/styles.js +0 -61
- package/src/components/atoms/UserSelector/UserSelector.stories.js +0 -25
- package/src/components/atoms/UserSelector/index.js +0 -88
- package/src/components/atoms/UserSelector/styles.js +0 -55
- package/src/components/molecules/GridItem/GridItem.stories.js +0 -126
- package/src/components/molecules/GridItem/index.js +0 -83
- package/src/components/molecules/GridItem/styles.js +0 -85
- package/src/components/molecules/HeaderItem/ColumnItem.js +0 -9
- package/src/components/molecules/HeaderItem/HeaderItem.stories.js +0 -24
- package/src/components/molecules/HeaderItem/index.js +0 -26
- package/src/components/molecules/HeaderItem/styles.js +0 -27
- package/src/components/molecules/RowItem/ColumnItem.js +0 -9
- package/src/components/molecules/RowItem/RowItem.stories.js +0 -5660
- package/src/components/molecules/RowItem/index.js +0 -45
- package/src/components/molecules/RowItem/styles.js +0 -38
- package/src/components/organisms/GridProducts/GridProducts.stories.js +0 -5485
- package/src/components/organisms/GridProducts/index.js +0 -50
- package/src/components/organisms/GridProducts/styles.js +0 -15
- package/src/components/organisms/GridProducts/utils.js +0 -108
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { Avatar } from "../Avatar";
|
|
3
|
-
import { Container } from "./styles";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
import { useCloseModal } from "../../../global-files/customHooks";
|
|
6
|
-
import { RetailersList } from "../RetailersList";
|
|
7
|
-
|
|
8
|
-
export const RetailerCatalog = ({
|
|
9
|
-
retailers = [],
|
|
10
|
-
limit = 3,
|
|
11
|
-
article,
|
|
12
|
-
id = "retailers-catalog",
|
|
13
|
-
}) => {
|
|
14
|
-
const [retLimit, setRetLimit] = useState(0);
|
|
15
|
-
const [showRetailers, setShowRetailers] = useCloseModal(id);
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
setRetLimit(limit);
|
|
19
|
-
}, [retailers]);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Container
|
|
23
|
-
onClick={(e) => {
|
|
24
|
-
e.stopPropagation();
|
|
25
|
-
setShowRetailers(true);
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
{retailers.map(
|
|
29
|
-
(retailer, i) =>
|
|
30
|
-
i < limit && (
|
|
31
|
-
<Avatar
|
|
32
|
-
key={retailer.id + "-" + i}
|
|
33
|
-
image={`https://content-management-images.s3.amazonaws.com/retailers/${retailer.id}.png`}
|
|
34
|
-
altText={retailer?.name}
|
|
35
|
-
imageType={"medium-image"}
|
|
36
|
-
/>
|
|
37
|
-
)
|
|
38
|
-
)}
|
|
39
|
-
{retailers.length > retLimit && (
|
|
40
|
-
<div className="retailers-limit">
|
|
41
|
-
<p>+{retailers.length - retLimit}</p>
|
|
42
|
-
</div>
|
|
43
|
-
)}
|
|
44
|
-
{showRetailers && (
|
|
45
|
-
<RetailersList retailers={retailers} article={article} id={id} />
|
|
46
|
-
)}
|
|
47
|
-
</Container>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { FontFamily } from "../../../global-files/variables";
|
|
3
|
-
|
|
4
|
-
export const Container = styled.div`
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
justify-content: center;
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
position: relative;
|
|
10
|
-
width: 100%;
|
|
11
|
-
|
|
12
|
-
.retailers-limit {
|
|
13
|
-
width: 26px;
|
|
14
|
-
height: 26px;
|
|
15
|
-
border-radius: 50%;
|
|
16
|
-
background-color: #f0f0f0;
|
|
17
|
-
|
|
18
|
-
p {
|
|
19
|
-
font-family: ${FontFamily.Lato};
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
line-height: 26px;
|
|
22
|
-
color: #262626;
|
|
23
|
-
text-align: center;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
> * + * {
|
|
28
|
-
margin-left: -5px;
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { RetailerOption } from ".";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/atoms/RetailerOptions",
|
|
5
|
-
component: RetailerOption,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const Template = (args) => <RetailerOption {...args} />;
|
|
9
|
-
export const RetailerOptionDefault = Template.bind({});
|
|
10
|
-
RetailerOptionDefault.args = {
|
|
11
|
-
retailer: {
|
|
12
|
-
id: 58,
|
|
13
|
-
name: "The Home Depot Golden",
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { Avatar } from "../Avatar";
|
|
3
|
-
import { Container } from "./styles";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
|
|
6
|
-
export const RetailerOption = ({ retailer, services = {} }) => {
|
|
7
|
-
const [service, setService] = useState([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (services[retailer.id]) {
|
|
11
|
-
setService(Object.keys(services[retailer.id]));
|
|
12
|
-
}
|
|
13
|
-
}, [services]);
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<Container>
|
|
17
|
-
<div className="avatar-and-retailer">
|
|
18
|
-
<Avatar
|
|
19
|
-
image={`https://content-management-images.s3.amazonaws.com/retailers/${retailer.id}.png`}
|
|
20
|
-
altText={retailer?.name}
|
|
21
|
-
imageType={"medium-image"}
|
|
22
|
-
/>
|
|
23
|
-
<p className="retailer-name">{retailer?.name}</p>
|
|
24
|
-
</div>
|
|
25
|
-
<div className="services-icons">
|
|
26
|
-
<span
|
|
27
|
-
key="datasheet"
|
|
28
|
-
className={`material-icons small ${
|
|
29
|
-
service.includes("datasheet") && "is-active"
|
|
30
|
-
}`}
|
|
31
|
-
>
|
|
32
|
-

|
|
33
|
-
</span>
|
|
34
|
-
<span
|
|
35
|
-
key="description"
|
|
36
|
-
className={`material-icons small ${
|
|
37
|
-
service.includes("description") && "is-active"
|
|
38
|
-
}`}
|
|
39
|
-
>
|
|
40
|
-

|
|
41
|
-
</span>
|
|
42
|
-
<span
|
|
43
|
-
key="images"
|
|
44
|
-
className={`material-icons small ${
|
|
45
|
-
service.includes("images") && "is-active"
|
|
46
|
-
}`}
|
|
47
|
-
>
|
|
48
|
-

|
|
49
|
-
</span>
|
|
50
|
-
</div>
|
|
51
|
-
</Container>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { FontFamily } from "../../../global-files/variables";
|
|
3
|
-
|
|
4
|
-
export const Container = styled.div`
|
|
5
|
-
display: flex;
|
|
6
|
-
padding: 7px;
|
|
7
|
-
border: 1px solid #f0f0f0;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: space-between;
|
|
10
|
-
border-radius: 5px;
|
|
11
|
-
|
|
12
|
-
.avatar-and-retailer {
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
.retailer-name {
|
|
16
|
-
font-family: ${FontFamily.Lato};
|
|
17
|
-
font-size: 12px;
|
|
18
|
-
color: #262626;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
> * + * {
|
|
22
|
-
margin-left: 10px;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.services-icons {
|
|
27
|
-
display: flex;
|
|
28
|
-
|
|
29
|
-
span {
|
|
30
|
-
color: #f0f0f0;
|
|
31
|
-
font-size: 14px;
|
|
32
|
-
&.is-active {
|
|
33
|
-
color: #8a6caa;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
> * + * {
|
|
38
|
-
margin-left: 9px;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { RetailersList } from ".";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/atoms/RetailersList",
|
|
5
|
-
component: RetailersList,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const Template = (args) => <RetailersList {...args} />;
|
|
9
|
-
export const RetailersListDefault = Template.bind({});
|
|
10
|
-
RetailersListDefault.args = {
|
|
11
|
-
retailers: [
|
|
12
|
-
{
|
|
13
|
-
id: 58,
|
|
14
|
-
name: "The Home Depot Golden",
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
id: 59,
|
|
18
|
-
name: "The Home Depot Platinum",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 60,
|
|
22
|
-
name: "The Home Depot Resizing",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: 61,
|
|
26
|
-
name: "Home Depot TAB",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: 68,
|
|
30
|
-
name: "The Home Depot Dropship",
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Container } from "./styles";
|
|
2
|
-
import { RetailerOption } from "../RetailerOption";
|
|
3
|
-
import { useState, useEffect } from "react";
|
|
4
|
-
import axios from "axios";
|
|
5
|
-
|
|
6
|
-
export const RetailersList = ({ retailers, article, id }) => {
|
|
7
|
-
const [services, setServices] = useState({});
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (article) setServices(article.statusByRetailer);
|
|
11
|
-
}, [article]);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Container id={id}>
|
|
15
|
-
{retailers.map((retailer, i) => (
|
|
16
|
-
<RetailerOption key={i} retailer={retailer} services={services} />
|
|
17
|
-
))}
|
|
18
|
-
</Container>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
export const Container = styled.div`
|
|
4
|
-
width: 370px;
|
|
5
|
-
max-height: 200px;
|
|
6
|
-
overflow: auto;
|
|
7
|
-
position: absolute;
|
|
8
|
-
z-index: 500;
|
|
9
|
-
right: 0%;
|
|
10
|
-
top: 100%;
|
|
11
|
-
border: 1px solid #f0f0f0;
|
|
12
|
-
padding: 10px;
|
|
13
|
-
padding-right: 5px;
|
|
14
|
-
background-color: white;
|
|
15
|
-
|
|
16
|
-
> * + * {
|
|
17
|
-
margin-top: 5px;
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { UserCatalog } from ".";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/atoms/UserCatalog",
|
|
5
|
-
component: UserCatalog,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const Template = (args) => <UserCatalog {...args} />;
|
|
9
|
-
export const UserCatalogDefault = Template.bind({});
|
|
10
|
-
UserCatalogDefault.args = {
|
|
11
|
-
product: "product",
|
|
12
|
-
datasheet: 54,
|
|
13
|
-
description: 54,
|
|
14
|
-
images: 55,
|
|
15
|
-
auditor: 37,
|
|
16
|
-
auditors: [
|
|
17
|
-
{
|
|
18
|
-
name: "José",
|
|
19
|
-
last_name: "Castañeda",
|
|
20
|
-
id_user: 37,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: "Eduardo ",
|
|
24
|
-
last_name: " Reyes",
|
|
25
|
-
id_user: 195,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
textSpecialists: [
|
|
29
|
-
{
|
|
30
|
-
name: "Especialista",
|
|
31
|
-
last_name: "Textos",
|
|
32
|
-
id_user: 36,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: "ESPECIALISTA TXTS PRUEBA",
|
|
36
|
-
last_name: "",
|
|
37
|
-
id_user: 54,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "Gerson",
|
|
41
|
-
last_name: "Martínez",
|
|
42
|
-
id_user: 57,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "Angel",
|
|
46
|
-
last_name: "Perea",
|
|
47
|
-
id_user: 232,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
imagesSpecialists: [
|
|
51
|
-
{
|
|
52
|
-
name: "Especialista",
|
|
53
|
-
last_name: "Imágenes",
|
|
54
|
-
id_user: 35,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: "ESPECIALISTA ED PRUEBA",
|
|
58
|
-
last_name: "",
|
|
59
|
-
id_user: 55,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: "Uriel",
|
|
63
|
-
last_name: "Herrera",
|
|
64
|
-
id_user: 196,
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { Container } from "./styles";
|
|
2
|
-
import { Avatar } from "../Avatar";
|
|
3
|
-
import { getProfilePicture } from "../../../global-files/data";
|
|
4
|
-
import { UserOption } from "../UserOption";
|
|
5
|
-
import { useCloseModal } from "../../../global-files/customHooks";
|
|
6
|
-
import { useState } from "react";
|
|
7
|
-
import { useEffect } from "react";
|
|
8
|
-
|
|
9
|
-
export const UserCatalog = ({
|
|
10
|
-
datasheet,
|
|
11
|
-
description,
|
|
12
|
-
images,
|
|
13
|
-
auditor,
|
|
14
|
-
auditors = [],
|
|
15
|
-
textSpecialists = [],
|
|
16
|
-
imagesSpecialists = [],
|
|
17
|
-
id = "list-modal",
|
|
18
|
-
onAssign,
|
|
19
|
-
product,
|
|
20
|
-
}) => {
|
|
21
|
-
const [showList, setShowList] = useCloseModal(id);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Container
|
|
25
|
-
id={id}
|
|
26
|
-
onClick={() => {
|
|
27
|
-
setShowList(true);
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
{datasheet && (
|
|
31
|
-
<Avatar
|
|
32
|
-
image={getProfilePicture(datasheet, 26, 26)}
|
|
33
|
-
altText={"datasheet specialist"}
|
|
34
|
-
imageType={"medium-image"}
|
|
35
|
-
/>
|
|
36
|
-
)}
|
|
37
|
-
{description && (
|
|
38
|
-
<Avatar
|
|
39
|
-
image={getProfilePicture(description, 26, 26)}
|
|
40
|
-
altText={"description specialist"}
|
|
41
|
-
imageType={"medium-image"}
|
|
42
|
-
/>
|
|
43
|
-
)}
|
|
44
|
-
{images && (
|
|
45
|
-
<Avatar
|
|
46
|
-
image={getProfilePicture(images, 26, 26)}
|
|
47
|
-
altText={"images specialist"}
|
|
48
|
-
imageType={"medium-image"}
|
|
49
|
-
/>
|
|
50
|
-
)}
|
|
51
|
-
{auditor && (
|
|
52
|
-
<Avatar
|
|
53
|
-
image={getProfilePicture(auditor, 26, 26)}
|
|
54
|
-
altText={"auditor"}
|
|
55
|
-
imageType={"medium-image"}
|
|
56
|
-
/>
|
|
57
|
-
)}
|
|
58
|
-
{showList && (
|
|
59
|
-
<div className="users-assigned-list">
|
|
60
|
-
<UserOption
|
|
61
|
-
onAssign={onAssign}
|
|
62
|
-
product={product}
|
|
63
|
-
userId={datasheet}
|
|
64
|
-
usersArray={textSpecialists}
|
|
65
|
-
id={id + "-datasheet"}
|
|
66
|
-
index={"datasheet"}
|
|
67
|
-
/>
|
|
68
|
-
<UserOption
|
|
69
|
-
onAssign={onAssign}
|
|
70
|
-
product={product}
|
|
71
|
-
userId={description}
|
|
72
|
-
usersArray={textSpecialists}
|
|
73
|
-
id={id + "-description"}
|
|
74
|
-
index={"description"}
|
|
75
|
-
/>
|
|
76
|
-
<UserOption
|
|
77
|
-
onAssign={onAssign}
|
|
78
|
-
product={product}
|
|
79
|
-
userId={images}
|
|
80
|
-
usersArray={imagesSpecialists}
|
|
81
|
-
id={id + "-images"}
|
|
82
|
-
index={"image"}
|
|
83
|
-
/>
|
|
84
|
-
<UserOption
|
|
85
|
-
onAssign={onAssign}
|
|
86
|
-
product={product}
|
|
87
|
-
userId={auditor}
|
|
88
|
-
usersArray={auditors}
|
|
89
|
-
id={id + "-auditor"}
|
|
90
|
-
index={"auditor"}
|
|
91
|
-
/>
|
|
92
|
-
</div>
|
|
93
|
-
)}
|
|
94
|
-
</Container>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
|
|
3
|
-
export const Container = styled.div`
|
|
4
|
-
display: flex;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
width: 100%;
|
|
7
|
-
height: 100%;
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
position: relative;
|
|
10
|
-
|
|
11
|
-
.users-assigned-list {
|
|
12
|
-
background-color: white;
|
|
13
|
-
padding: 10px;
|
|
14
|
-
box-shadow: 0px 2px 4px #00000040;
|
|
15
|
-
position: absolute;
|
|
16
|
-
top: 100%;
|
|
17
|
-
left: 0;
|
|
18
|
-
z-index: 400;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
> * + * {
|
|
22
|
-
margin-left: -10px;
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { UserOption } from ".";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/atoms/UserOption",
|
|
5
|
-
component: UserOption,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const Template = (args) => <UserOption {...args} />;
|
|
9
|
-
export const UserOptionDefault = Template.bind({});
|
|
10
|
-
UserOptionDefault.args = {
|
|
11
|
-
userId: 37,
|
|
12
|
-
index: "datasheet",
|
|
13
|
-
usersArray: [
|
|
14
|
-
{
|
|
15
|
-
name: "José",
|
|
16
|
-
last_name: "Castañeda",
|
|
17
|
-
id_user: 37,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "Eduardo ",
|
|
21
|
-
last_name: " Reyes",
|
|
22
|
-
id_user: 195,
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { Container } from "./styles";
|
|
2
|
-
import { Avatar } from "../Avatar";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
import { getProfilePicture } from "../../../global-files/data";
|
|
6
|
-
import { servicesCodeIcon } from "../../organisms/OrderDetail/utils/Table/utils";
|
|
7
|
-
import { UserSelector } from "../UserSelector";
|
|
8
|
-
import { useCloseModal } from "../../../global-files/customHooks";
|
|
9
|
-
|
|
10
|
-
export const UserOption = ({
|
|
11
|
-
userId,
|
|
12
|
-
index,
|
|
13
|
-
usersArray,
|
|
14
|
-
id,
|
|
15
|
-
onAssign,
|
|
16
|
-
product,
|
|
17
|
-
}) => {
|
|
18
|
-
const [userAssigned, setUserAssigned] = useState({});
|
|
19
|
-
const [showSelector, setShowSelector] = useCloseModal(id);
|
|
20
|
-
const [assignationTarget, setAssignationTarget] = useState("");
|
|
21
|
-
const [concept, setConcept] = useState("");
|
|
22
|
-
const [target, setTarget] = useState("");
|
|
23
|
-
|
|
24
|
-
const icons = servicesCodeIcon;
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (usersArray) {
|
|
28
|
-
usersArray.forEach((user) => {
|
|
29
|
-
if (user.id_user === userId) {
|
|
30
|
-
setUserAssigned(user);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}, [userId, usersArray]);
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
switch (index) {
|
|
38
|
-
case "datasheet":
|
|
39
|
-
case "description":
|
|
40
|
-
setAssignationTarget(`id_${index}_specialist`);
|
|
41
|
-
setConcept(index);
|
|
42
|
-
setTarget("specialist");
|
|
43
|
-
break;
|
|
44
|
-
case "image":
|
|
45
|
-
setAssignationTarget(`id_${index}s_specialist`);
|
|
46
|
-
setConcept(index + "s");
|
|
47
|
-
setTarget("specialist");
|
|
48
|
-
break;
|
|
49
|
-
case "auditor":
|
|
50
|
-
setAssignationTarget(`id_${index}`);
|
|
51
|
-
setConcept(index);
|
|
52
|
-
setTarget(index);
|
|
53
|
-
break;
|
|
54
|
-
default:
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}, [index]);
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<Container onClick={() => setShowSelector(true)}>
|
|
61
|
-
<div className="image-and-name">
|
|
62
|
-
<Avatar
|
|
63
|
-
image={getProfilePicture(userAssigned?.id_user, 26, 26)}
|
|
64
|
-
altText={"datasheet specialist"}
|
|
65
|
-
imageType={"medium-image"}
|
|
66
|
-
/>
|
|
67
|
-
<p>
|
|
68
|
-
{userAssigned?.name} {userAssigned?.last_name}
|
|
69
|
-
</p>
|
|
70
|
-
</div>
|
|
71
|
-
<div className="icon-container">{icons[index]}</div>
|
|
72
|
-
{showSelector && (
|
|
73
|
-
<UserSelector
|
|
74
|
-
id={id}
|
|
75
|
-
searchLabel="Buscar Usuario"
|
|
76
|
-
index={index}
|
|
77
|
-
usersArray={usersArray}
|
|
78
|
-
position="absolute"
|
|
79
|
-
onAssign={onAssign}
|
|
80
|
-
product={product}
|
|
81
|
-
assignationTarget={assignationTarget}
|
|
82
|
-
target={target}
|
|
83
|
-
concept={concept}
|
|
84
|
-
/>
|
|
85
|
-
)}
|
|
86
|
-
</Container>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { FontFamily } from "../../../global-files/variables";
|
|
3
|
-
|
|
4
|
-
export const Container = styled.div`
|
|
5
|
-
border: 1px solid #f0f0f0;
|
|
6
|
-
border-radius: 5px;
|
|
7
|
-
color: #262626;
|
|
8
|
-
font-size: 12px;
|
|
9
|
-
font-family: ${FontFamily.Lato};
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
padding: 5px 10px;
|
|
13
|
-
justify-content: space-between;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
position: relative;
|
|
16
|
-
background-color: white;
|
|
17
|
-
|
|
18
|
-
.image-and-name {
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
|
|
22
|
-
div + p {
|
|
23
|
-
margin-left: 10px;
|
|
24
|
-
white-space: nowrap;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
& + * {
|
|
28
|
-
margin-left: 10px;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.icon-container {
|
|
33
|
-
position: relative;
|
|
34
|
-
span {
|
|
35
|
-
color: #808080;
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
|
|
38
|
-
& + span {
|
|
39
|
-
display: none;
|
|
40
|
-
position: absolute;
|
|
41
|
-
right: 120%;
|
|
42
|
-
top: 50%;
|
|
43
|
-
transform: translateY(-50%);
|
|
44
|
-
white-space: nowrap;
|
|
45
|
-
border: 1px solid #f0f0f0;
|
|
46
|
-
padding: 5px;
|
|
47
|
-
background-color: white;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&:hover {
|
|
51
|
-
& + span {
|
|
52
|
-
display: block;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
& + * {
|
|
59
|
-
margin-top: 5px;
|
|
60
|
-
}
|
|
61
|
-
`;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { UserSelector } from ".";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/atoms/UserSelector",
|
|
5
|
-
component: UserSelector,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const Template = (args) => <UserSelector {...args} />;
|
|
9
|
-
export const UserSelectorDefault = Template.bind({});
|
|
10
|
-
UserSelectorDefault.args = {
|
|
11
|
-
searchLabel: "Buscar auditor",
|
|
12
|
-
index: "auditor",
|
|
13
|
-
usersArray: [
|
|
14
|
-
{
|
|
15
|
-
name: "José",
|
|
16
|
-
last_name: "Castañeda",
|
|
17
|
-
id_user: 37,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "Eduardo ",
|
|
21
|
-
last_name: " Reyes",
|
|
22
|
-
id_user: 195,
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
};
|