contentoh-components-library 21.4.60 → 21.4.62

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.
Files changed (73) hide show
  1. package/dist/components/molecules/BoxAttribute/styles.js +1 -1
  2. package/dist/components/molecules/BoxButtons/index.js +1 -0
  3. package/dist/components/molecules/TagAndInput/index.js +64 -3
  4. package/dist/components/organisms/InputGroup/index.js +153 -48
  5. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +82 -146
  6. package/dist/components/pages/ProviderProductEdition/index.js +231 -203
  7. package/dist/components/pages/RetailerProductEdition/index.js +5 -5
  8. package/dist/global-files/data.js +8 -4
  9. package/package.json +1 -1
  10. package/src/assets/images/Icons/info.svg +8 -0
  11. package/src/components/atoms/TabSection/styles.js +23 -0
  12. package/src/components/molecules/BoxAttribute/BoxAttribute.stories.js +16 -0
  13. package/src/components/molecules/BoxAttribute/index.js +71 -0
  14. package/src/components/molecules/BoxAttribute/styles.js +38 -0
  15. package/src/components/molecules/BoxButtons/BoxButtons.stories.js +15 -0
  16. package/src/components/molecules/BoxButtons/index.js +28 -0
  17. package/src/components/molecules/BoxButtons/styles.js +43 -0
  18. package/src/components/molecules/TagAndInput/index.js +52 -8
  19. package/src/components/organisms/Box/Box.stories.js +17 -0
  20. package/src/components/organisms/Box/index.js +103 -0
  21. package/src/components/organisms/Box/styles.js +48 -0
  22. package/src/components/organisms/BoxOnboarding/BoxOnboarding.stories.js +17 -0
  23. package/src/components/organisms/BoxOnboarding/index.js +60 -0
  24. package/src/components/organisms/BoxOnboarding/styles.js +44 -0
  25. package/src/components/organisms/InputGroup/index.js +233 -87
  26. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +86 -175
  27. package/src/components/pages/ProviderProductEdition/index.js +97 -73
  28. package/src/components/pages/ProviderProductEdition/out.json +0 -0
  29. package/src/components/pages/RetailerProductEdition/index.js +7 -5
  30. package/src/global-files/data.js +11 -2
  31. package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
  32. package/dist/components/atoms/ImageCarousel/ImgeSlider.stories.js +0 -90
  33. package/dist/components/atoms/ImageCarousel/index.js +0 -120
  34. package/dist/components/atoms/ImageCarousel/styles.js +0 -18
  35. package/dist/components/atoms/PercentTag/PercentTag.stories.js +0 -31
  36. package/dist/components/atoms/PercentTag/index.js +0 -23
  37. package/dist/components/atoms/PercentTag/styles.js +0 -22
  38. package/dist/components/atoms/RatingStars/RatingStars.stories.js +0 -30
  39. package/dist/components/atoms/RatingStars/index.js +0 -53
  40. package/dist/components/atoms/RatingStars/styles.js +0 -18
  41. package/dist/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +0 -48
  42. package/dist/components/atoms/RetailerCatalog/index.js +0 -69
  43. package/dist/components/atoms/RetailerCatalog/styles.js +0 -20
  44. package/dist/components/atoms/RetailerOption/RetailerOption.stories.js +0 -33
  45. package/dist/components/atoms/RetailerOption/index.js +0 -62
  46. package/dist/components/atoms/RetailerOption/styles.js +0 -20
  47. package/dist/components/atoms/RetailersList/RetailersList.stories.js +0 -45
  48. package/dist/components/atoms/RetailersList/index.js +0 -46
  49. package/dist/components/atoms/RetailersList/styles.js +0 -18
  50. package/dist/components/atoms/UserCatalog/UserCatalog.stories.js +0 -73
  51. package/dist/components/atoms/UserCatalog/index.js +0 -101
  52. package/dist/components/atoms/UserCatalog/styles.js +0 -18
  53. package/dist/components/atoms/UserOption/UserOption.stories.js +0 -40
  54. package/dist/components/atoms/UserOption/index.js +0 -130
  55. package/dist/components/atoms/UserOption/styles.js +0 -20
  56. package/dist/components/atoms/UserSelector/UserSelector.stories.js +0 -40
  57. package/dist/components/atoms/UserSelector/index.js +0 -98
  58. package/dist/components/atoms/UserSelector/styles.js +0 -32
  59. package/dist/components/molecules/GridItem/GridItem.stories.js +0 -123
  60. package/dist/components/molecules/GridItem/index.js +0 -152
  61. package/dist/components/molecules/GridItem/styles.js +0 -20
  62. package/dist/components/molecules/HeaderItem/ColumnItem.js +0 -23
  63. package/dist/components/molecules/HeaderItem/HeaderItem.stories.js +0 -70
  64. package/dist/components/molecules/HeaderItem/index.js +0 -42
  65. package/dist/components/molecules/HeaderItem/styles.js +0 -30
  66. package/dist/components/molecules/RowItem/ColumnItem.js +0 -23
  67. package/dist/components/molecules/RowItem/RowItem.stories.js +0 -5242
  68. package/dist/components/molecules/RowItem/index.js +0 -58
  69. package/dist/components/molecules/RowItem/styles.js +0 -30
  70. package/dist/components/organisms/GridProducts/GridProducts.stories.js +0 -5097
  71. package/dist/components/organisms/GridProducts/index.js +0 -63
  72. package/dist/components/organisms/GridProducts/styles.js +0 -18
  73. package/dist/components/organisms/GridProducts/utils.js +0 -149
@@ -16,196 +16,107 @@ ProviderProductEditionDefault.args = {
16
16
  Imágenes: false,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIwZmUxYTZjMS05MzcyLTRiNjktOTgwMi1lN2QxOGM2MzU4YzQiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY5MzMzODMzMiwibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2OTMzNDE5MzIsImlhdCI6MTY5MzMzODMzMiwiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.lQwTS_RbJalEPmmpWcBsVYd8xx4tkw3U6uyW_laE6ucyHQpXSXYMfadAxxV2PZ5ObbgmX98nFKj32E2F4CxHxw3W7B1Wj7ZoGML409GjlylQ1RuVVHjwTw0OH5TtveV1JNNpts0belvzxbk5vX9E1vKoZLOKn8gO9yaFe0YawKjS0hW-P4NcjIonsNJ5KWMsh0fJCM2oAKAk8oAGZcszYHknMPF6ahf-fWeboVuK89UEsKlQukr7W8fnIePFI8aSlKM1nG0I7nOT_1734Pf-A9QQDXEwhfj8NMHHICb2c_ECgHPEspM9VxIR6Lbws-gCTSG6FTMjsIFKU3EqaQvlVw",
20
- articleId: 39485,
21
- category: 11,
22
- version: 3,
19
+ "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIyM2Q1NTlmYi1jMzIwLTRhMjItYjJmNy1lOThhYTFhZGEyNmYiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4MzkyNjgyMSwibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2ODM5MzA0MjEsImlhdCI6MTY4MzkyNjgyMSwiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.TvCoaKoctj5mypXWMz3NyV1Vm1ToBV0vJmpVyZSQw4-ikTChkxcZ5tFYvqhk1GdvNCFttfSQIqM-14dAYYBc28YwwKP86gqOuzB1fG41rN5x1Yx3tkJq6hiVRgiBbSHWtThA9c8VnxNQbrJiaRTvvkDiM5KNTEst1oxQHL5Ct9_iKQMJMRFie7Xv0xnyS0qZ6QHK4Q2A9OHsnDkAuumALZJcE19Zh6VgSitgWrZiz3x5Text4Q-U-R48NUAzUFirAzYZzJN_fCme5pGf1AnUaZjeUjPsmrV5TBVzPEYwXO0KG8lYjL8id80D7tbGs28ZIK6B4rf3-eqI_ngmBB4CjQ",
20
+ articleId: 39550,
21
+ category: 287,
22
+ version: 1,
23
23
  productSelected: {
24
- orderId: 15275,
25
- status: "AA",
26
- datasheet_status: "AA",
27
- prio: "none",
28
- version: 3,
29
- description_status: "AA",
30
- images_status: "AA",
31
- brand: null,
32
- retailerOrder: 0,
33
- missing: {
34
- datasheet: null,
35
- descriptions: null,
36
- images: null,
24
+ id_article:39550,
25
+ upc:43654697,
26
+ name:"Campana de Cocina",
27
+ timestamp:"2023-08-04T22:23:40.000Z",
28
+ categoryName:"Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
29
+ id_category:287,
30
+ version:1,
31
+ retailersAvailable:[
32
+ {name:"The Home Depot Golden","id":58},
33
+ {name:"The Home Depot Onboarding","id":68}],
34
+ percentage:"89"
37
35
  },
38
- services: {
39
- datasheets: 1,
40
- descriptions: 1,
41
- images: 1,
42
- },
43
- article: {
44
- category: "Abarrotes|Abarrotes Secos|Frutos Secos",
45
- company_name: "GRUPO BRAHMA",
46
- country: "México",
47
- id_category: "11",
48
- id_datasheet_especialist: 54,
49
- id_datasheet_facilitator: 52,
50
- id_description_especialist: 54,
51
- id_description_facilitator: 52,
52
- id_images_especialist: 55,
53
- id_images_facilitator: 53,
54
- id_order: 15275,
55
- id_article: 39485,
56
- id_auditor: 37,
57
- name: "Mix de nueces",
58
- timestamp: "2023-07-14T21:03:19.000Z",
59
- upc: "7543453453",
60
- },
61
- retailers: [
62
- {
63
- id: 34,
64
- name: "San Pablo",
65
- },
66
- ],
67
- statusByRetailer: {
68
- 34: {
69
- datasheet: "AA",
70
- description: "AA",
71
- images: "AA",
72
- },
73
- },
74
- retailersAvailable: [
75
- {
76
- id: 34,
77
- name: "San Pablo",
78
- },
79
- ],
80
- categoryName: "Abarrotes|Abarrotes Secos|Frutos Secos",
81
- upc: "7543453453",
82
- id_article: 39485,
83
- id_order: 15275,
84
- },
85
36
  productToEdit: {
86
- ArticleId: 39485,
87
- idCategory: "11",
88
- product: {
89
- orderId: 15275,
90
- status: "AA",
91
- datasheet_status: "AA",
92
- prio: "none",
93
- version: 3,
94
- description_status: "AA",
95
- images_status: "AA",
96
- brand: null,
97
- retailerOrder: 0,
98
- missing: {
99
- datasheet: null,
100
- descriptions: null,
101
- images: null,
102
- },
103
- services: {
104
- datasheets: 1,
105
- descriptions: 1,
106
- images: 1,
107
- },
108
- article: {
109
- category: "Abarrotes|Abarrotes Secos|Frutos Secos",
110
- company_name: "GRUPO BRAHMA",
111
- country: "México",
112
- id_category: "11",
113
- id_datasheet_especialist: 54,
114
- id_datasheet_facilitator: 52,
115
- id_description_especialist: 54,
116
- id_description_facilitator: 52,
117
- id_images_especialist: 55,
118
- id_images_facilitator: 53,
119
- id_order: 15275,
120
- id_article: 39485,
121
- id_auditor: 37,
122
- name: "Mix de nueces",
123
- timestamp: "2023-07-14T21:03:19.000Z",
124
- upc: "7543453453",
125
- },
126
- retailers: [
127
- {
128
- id: 34,
129
- name: "San Pablo",
130
- },
131
- ],
132
- statusByRetailer: {
133
- 34: {
134
- datasheet: "AA",
135
- description: "AA",
136
- images: "AA",
137
- },
138
- },
139
- retailersAvailable: [
140
- {
141
- id: 34,
142
- name: "San Pablo",
143
- },
37
+ idCategory:287,
38
+ ArticleId:39550,
39
+ product:[{
40
+ id_article:39550,
41
+ upc:43654697,
42
+ name:"Campana de Cocina",
43
+ timestamp:"2023-08-04T22:23:40.000Z",
44
+ categoryName:"Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
45
+ id_category:287,
46
+ version:1,
47
+ retailersAvailable:[
48
+ {name:"The Home Depot Golden",
49
+ id:58,
50
+ percentage:100},
51
+ {name:"The Home Depot Onboarding",
52
+ id:68,
53
+ percentage:78}
144
54
  ],
145
- categoryName: "Abarrotes|Abarrotes Secos|Frutos Secos",
146
- upc: "7543453453",
147
- id_article: 39485,
148
- id_order: 15275,
55
+ percentage:"89"}]
149
56
  },
150
- },
151
57
  location: {
152
58
  pathname: "/EditProducts",
153
59
  search: "",
154
60
  hash: "",
155
61
  state: {
62
+ withChat: true,
63
+ chatType: "product_status",
156
64
  origin: "RequestWithContentoh",
157
65
  },
158
66
  key: "24vwut",
159
67
  },
160
68
  user: {
161
- id_user: 28,
162
- name: "Ismael",
163
- last_name: "López",
164
- email: "ilopez@contentoh.com",
165
- position: "Test States",
166
- telephone: "+523111366336",
167
- country: "México",
168
- id_company: 1,
169
- id_cognito: "f5927f8e-cbf7-4922-9e09-e69ec0b2731a",
170
- birth_Date: null,
171
- about_me: "",
172
- zip_code: "",
173
- address: "",
174
- job: "",
175
- id_stripe: "cus_KuEt6R6vwmN09f",
176
- id_role: 0,
177
- active: 1,
178
- is_retailer: 0,
179
- email_notify: 1,
180
- is_user_tech: "ADMIN-AS",
181
- membership: {
182
- id: 76,
183
- start_date: "2022-01-18T17:25:35.000Z",
184
- end_date: "2023-01-18T17:25:35.000Z",
185
- planID: 8,
186
- plan: "prod_KtlhECVSFG2iro",
187
- name: "Plan Pro",
188
- user_limit: "50",
189
- products_limit: "5000",
190
- type: "Enterprise",
191
- },
192
- src: "https://content-management-profile.s3.amazonaws.com/id-28/28.png?1693338334183",
193
- },
69
+ id_user:191,
70
+ name:"Demo",
71
+ last_name:"Demo",
72
+ email:"merchants24feb@allfreemail.net",
73
+ position:"Test",
74
+ telephone:"+52123456789",
75
+ country:"México",
76
+ id_company:923,
77
+ id_cognito:"c3cd160c-76c2-497c-9357-5ef949307e1e",
78
+ birth_Date:null,
79
+ about_me:null,
80
+ zip_code:null,
81
+ address:null,
82
+ job:null,
83
+ id_stripe:null,
84
+ id_role:0,
85
+ active:1,
86
+ is_retailer:0,
87
+ email_notify:1,
88
+ is_user_tech:null,
89
+ membership:
90
+ {id:114,
91
+ start_date:"2023-02-24T18:14:43.000Z",
92
+ end_date:"2024-02-24T18:14:43.000Z",
93
+ planID:8,
94
+ plan:"prod_KtlhECVSFG2iro",
95
+ name:"Plan Pro",
96
+ user_limit:"50",
97
+ products_limit:"5000",
98
+ type:"Enterprise"},
99
+ src:"https://content-management-profile.s3.amazonaws.com/id-191/191.png?1697171804447"},
194
100
  company: {
195
- id_company: 1,
196
- trade_name: "GRUPO BRAHMA",
197
- company_name: "GRUPO BRAHMA",
198
- rfc: "XAXX010101000",
199
- adress: "AA",
200
- about_company: "",
201
- telephone: "",
202
- web_site: "",
203
- zip_code: "",
204
- email: null,
205
- social_link: "",
206
- is_retailer: 0,
207
- financedRetailers: [],
208
- retailers: [],
209
- },
101
+ id_company:923,
102
+ trade_name:"Demo",
103
+ company_name:"Demo",
104
+ rfc:"Demo",
105
+ adress:"Demo",
106
+ about_company:null,
107
+ telephone:null,
108
+ web_site:null,
109
+ zip_code:null,
110
+ email:null,
111
+ social_link:null,
112
+ is_retailer:0,
113
+ financedRetailers:
114
+ [{id:68,
115
+ name:"The Home Depot Onboarding",
116
+ country:"México",
117
+ id_region:1,
118
+ active:1,
119
+ flow:1}],
120
+ retailers:[{id:68,name:"The Home Depot Onboarding",country:"México",id_region:1,"active":1,flow:1}]},
210
121
  showSurvey: (v) => v && alert("se muestra"),
211
122
  };
@@ -140,6 +140,7 @@ export const ProviderProductEdition = ({
140
140
  const [datasheets, setDatasheets] = useState([]);
141
141
  const [images, setImages] = useReducer(reducerImages, {});
142
142
  const [showModal, setShowModal] = useState(false);
143
+ const [boxData, setBoxData] = useState();
143
144
  const { getRootProps, getInputProps } = useDropzone({
144
145
  accept: "image/*",
145
146
  noKeyboard: true,
@@ -491,7 +492,8 @@ export const ProviderProductEdition = ({
491
492
  product?.id_article || product?.article?.id_article,
492
493
  product?.article?.company_name || product?.categoryName,
493
494
  parseInt(product?.article?.id_category || product?.id_category),
494
- version
495
+ version,
496
+ token
495
497
  );
496
498
 
497
499
  //Converts the data inside the datasheets object to array
@@ -694,11 +696,27 @@ export const ProviderProductEdition = ({
694
696
  };
695
697
 
696
698
  const saveDatasheets = async () => {
697
- setLoading(true);
699
+ const parseBoxData = [];
700
+ Object.entries(boxData).forEach(([, box], index) => {
701
+ const { value } = box;
702
+ const attributesIds = Object.keys(value);
703
+ attributesIds.forEach((attributeId) => {
704
+ const boxId = index + 1;
705
+ const valueOfAtribute = value[attributeId];
706
+ parseBoxData.push({
707
+ attributeId,
708
+ value: valueOfAtribute,
709
+ boxId,
710
+ })
711
+ });
712
+ });
713
+
698
714
  const dataObject = {
699
715
  articleId: product?.id_article,
700
716
  articleData: updatedDatasheets,
701
- };
717
+ ...(parseBoxData.length > 0 && { boxData: parseBoxData }),
718
+ };
719
+
702
720
  if (product?.orderId) dataObject["orderId"] = product?.orderId;
703
721
  try {
704
722
  const res = await axios.put(
@@ -717,7 +735,8 @@ export const ProviderProductEdition = ({
717
735
  }
718
736
  } catch (error) {
719
737
  console.log(error);
720
- }
738
+ }
739
+ console.log(dataObject)
721
740
  };
722
741
 
723
742
  const updateImages = useCallback(async () => {
@@ -1031,62 +1050,54 @@ export const ProviderProductEdition = ({
1031
1050
  const retailerId = activeRetailer?.id;
1032
1051
  let res;
1033
1052
  try {
1034
- const body = {
1035
- orderArticleRetailers: [
1036
- { orderId, articleId, retailersIds: [activeRetailer.id] },
1037
- ],
1038
- isAproved: false,
1039
- service: concept,
1040
- };
1041
1053
  if (result) {
1042
- body.isAproved = result === "A";
1043
- res = await axios.post(
1044
- `${process.env.REACT_APP_EVALUATION_REFACTOR}`,
1045
- body,
1054
+ data.result = result;
1055
+ data.retailerId = retailerId;
1056
+ res = await axios.put(
1057
+ `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
1058
+ data,
1046
1059
  {
1047
1060
  headers: {
1048
1061
  Authorization: token,
1049
1062
  },
1050
1063
  }
1051
1064
  );
1052
-
1053
- const response = JSON.parse(res.data.body)?.successfulData;
1054
- const newStatuses = response;
1055
- const statusObject =
1056
- response[`${orderId}-${articleId}-${activeRetailer.id}`];
1057
- const orderStatus = statusObject["generalStatus"];
1058
- const serviceStatus = newStatuses[`${getConcept(activeTab)}Status`];
1065
+ const newStatuses = JSON.parse(res.data.body);
1066
+ const orderStatus = newStatuses.newOrderStatus;
1067
+ const serviceStatus =
1068
+ newStatuses.newServiceStatus[articleId][
1069
+ `${getConcept(activeTab)}Status`
1070
+ ];
1059
1071
 
1060
1072
  const newProductEdit = productEdit;
1061
1073
  newProductEdit.product[sectionStatusKey] = serviceStatus;
1062
1074
  setProductEdit(newProductEdit);
1063
- const showSurveyByProvider = !user.is_retailer && orderStatus === "AP";
1064
- const showSurveyByRetailer = user.is_retailer && orderStatus === "ACA";
1075
+ const showSurveyByProvider =
1076
+ !user.is_retailer && orderStatus[orderId] === "AP";
1077
+ const showSurveyByRetailer =
1078
+ user.is_retailer && orderStatus[orderId] === "ACA";
1065
1079
  showSurvey && showSurvey(showSurveyByProvider || showSurveyByRetailer);
1066
1080
  } else {
1067
- res = await axios.post(
1068
- `${process.env.REACT_APP_EVALUATION_REFACTOR}`,
1069
- body,
1070
- {
1071
- headers: {
1072
- Authorization: token,
1073
- },
1074
- }
1075
- );
1081
+ res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
1082
+ headers: {
1083
+ Authorization: token,
1084
+ },
1085
+ });
1076
1086
  }
1077
1087
  if (res.data.statusCode === 200) {
1078
- const response = JSON.parse(res.data.body)?.successfulData;
1079
- const statusObject =
1080
- response[`${orderId}-${articleId}-${activeRetailer.id}`];
1081
- productTemp.status = statusObject["generalStatus"];
1088
+ const { newArticleStatus, newServiceStatus, newStatus } = JSON.parse(
1089
+ res.data.body
1090
+ );
1091
+ if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
1082
1092
  const retailerStatusCopy = { ...retailerStatus };
1083
- retailerStatusCopy[activeRetailer.id][concept] =
1084
- statusObject[`${concept}Status`];
1093
+ retailerStatusCopy[activeRetailer.id][concept] = newStatus;
1085
1094
  setRetailerStatus(retailerStatusCopy);
1086
1095
  productTemp.statusByRetailer = retailerStatusCopy;
1087
1096
  let status;
1088
- status = statusObject[`${concept}Status`];
1089
- productTemp[`${concept}_status`] = status;
1097
+ if (newServiceStatus) {
1098
+ status = newServiceStatus[articleId][`${concept}Status`];
1099
+ productTemp[`${concept}_status`] = status;
1100
+ }
1090
1101
  setProduct(productTemp);
1091
1102
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1092
1103
  setOrigin((prev) => ({ ...prev, [concept]: status }));
@@ -1102,26 +1113,23 @@ export const ProviderProductEdition = ({
1102
1113
  setLoading(true);
1103
1114
  const evaluationArray = [];
1104
1115
  const conceptArray = ["description", "datasheet", "images"];
1105
- const isAproved = result === "A";
1106
- const retailersIds = [];
1107
- servicesData?.forEach((ret) => {
1108
- if (!retailersIds.includes(ret.id_retailer))
1109
- retailersIds.push(ret.id_retailer);
1110
- });
1111
- const body = {
1112
- orderArticleRetailers: [
1113
- {
1114
- orderId: product.id_order ?? product.orderId,
1115
- articleId: product.article.id_article,
1116
- retailersIds,
1117
- },
1118
- ],
1119
- isAproved,
1116
+ const dataGeneral = {
1117
+ articleId: product.id_article,
1118
+ orderId: product.id_order ?? product.orderId,
1119
+ result,
1120
+ isAproved: result === "A",
1120
1121
  };
1121
- conceptArray.forEach((concept) => {
1122
- body.service = concept;
1122
+ servicesData?.forEach((ret) => {
1123
+ const { service, id_retailer } = ret;
1124
+ let data = {};
1125
+ data = {
1126
+ ...dataGeneral,
1127
+ concept: service,
1128
+ retailerId: id_retailer,
1129
+ evalStatus: retailerStatus[id_retailer][service],
1130
+ };
1123
1131
  evaluationArray.push(
1124
- axios.post(`${process.env.REACT_APP_EVALUATION_REFACTOR}`, body, {
1132
+ axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
1125
1133
  headers: {
1126
1134
  Authorization: token,
1127
1135
  },
@@ -1133,7 +1141,7 @@ export const ProviderProductEdition = ({
1133
1141
 
1134
1142
  const productTemp = product;
1135
1143
  const status = `${result}${userType}`;
1136
- productTemp.status = status;
1144
+ productTemp.article_status = status;
1137
1145
  productTemp.datasheet_status =
1138
1146
  productTemp.datasheet_status === "NA" ? "NA" : status;
1139
1147
  productTemp.description_status =
@@ -1173,6 +1181,13 @@ export const ProviderProductEdition = ({
1173
1181
  }
1174
1182
  };
1175
1183
 
1184
+
1185
+
1186
+
1187
+
1188
+
1189
+
1190
+
1176
1191
  const evaluationToRetailer = async (result) => {
1177
1192
  const data = {
1178
1193
  articleId: product.id_article,
@@ -1479,19 +1494,28 @@ export const ProviderProductEdition = ({
1479
1494
  )}
1480
1495
  {activeTab === "Ficha técnica" &&
1481
1496
  (product?.datasheet_status !== "NS" ? (
1482
- datasheets[0]?.data?.map((dataGroup, index) => (
1483
- <InputGroup
1484
- key={index + "-" + activeRetailer.name}
1485
- articleId={product.id_article}
1486
- version={version}
1487
- activeSection={activeTab}
1488
- inputGroup={dataGroup}
1489
- dataInputs={datasheets[1]}
1490
- updatedDatasheets={updatedDatasheets}
1491
- setUpdatedDatasheets={setUpdatedDatasheets}
1492
- //enableActions={enableActions(product.version_status)} ADD THIS VALIDATION
1493
- />
1494
- ))
1497
+ <div>
1498
+ {datasheets[0]?.data?.map((dataGroup, index) => (
1499
+ <InputGroup
1500
+ key={index + "-" + activeRetailer.name}
1501
+ articleId={product.id_article}
1502
+ version={version}
1503
+ activeSection={activeTab}
1504
+ inputGroup={dataGroup}
1505
+ dataInputs={datasheets[1]}
1506
+ updatedDatasheets={updatedDatasheets}
1507
+ setUpdatedDatasheets={setUpdatedDatasheets}
1508
+ isShowbox={true}
1509
+ activeRetailer={services[0][activeRetailer.id]}
1510
+ groupData={services[0][activeRetailer.id].data}
1511
+ setUpdatedBoxData={(e) => {
1512
+ setBoxData(e);
1513
+ }}
1514
+ index={index}
1515
+ //enableActions={enableActions(product.version_status)} ADD THIS VALIDATION
1516
+ ></InputGroup>
1517
+ ))}
1518
+ </div>
1495
1519
  ) : (
1496
1520
  <ScreenHeader
1497
1521
  text={"No cuentas con este servicio"}
@@ -231,7 +231,8 @@ export const RetailerProductEdition = ({
231
231
  product?.article?.id_article,
232
232
  product?.article?.category,
233
233
  parseInt(product?.article?.id_category),
234
- auditableVersion.version
234
+ auditableVersion.version,
235
+ token
235
236
  );
236
237
  getInputsData(
237
238
  auditServices,
@@ -260,7 +261,8 @@ export const RetailerProductEdition = ({
260
261
  product?.article?.id_article,
261
262
  product?.article?.category,
262
263
  parseInt(product?.article?.id_category),
263
- version
264
+ version,
265
+ token
264
266
  );
265
267
  if (auditableVersion) {
266
268
  loadAuditableData();
@@ -828,7 +830,7 @@ export const RetailerProductEdition = ({
828
830
  if (result) {
829
831
  body.isAproved = result === "A";
830
832
  res = await axios.post(
831
- `${process.env.REACT_APP_EVALUATION_REFACTOR}`,
833
+ `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
832
834
  body,
833
835
  {
834
836
  headers: {
@@ -849,7 +851,7 @@ export const RetailerProductEdition = ({
849
851
  getSectionIcon();
850
852
  }
851
853
  res = await axios.post(
852
- `${process.env.REACT_APP_EVALUATION_REFACTOR}`,
854
+ `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
853
855
  body,
854
856
  {
855
857
  headers: {
@@ -1233,7 +1235,7 @@ export const RetailerProductEdition = ({
1233
1235
  conceptArray.forEach((concept) => {
1234
1236
  body.service = concept;
1235
1237
  evaluationArray.push(
1236
- axios.post(`${process.env.REACT_APP_EVALUATION_REFACTOR}`, body, {
1238
+ axios.post(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
1237
1239
  headers: {
1238
1240
  Authorization: token,
1239
1241
  },
@@ -6,12 +6,21 @@ export const getRetailerServices = async (
6
6
  articleId,
7
7
  category,
8
8
  categoryId,
9
- version
9
+ version,
10
+ token
10
11
  ) => {
11
12
  try {
12
13
  const responseArray = await Promise.all([
13
14
  axios.post(
14
- `${process.env.REACT_APP_ARTICLE_DATA_DATASHEET_ENDPOINT}?idCategory=${categoryId}&articleId=${articleId}&version=${version}`
15
+ `${process.env.REACT_APP_ARTICLE_DATA_DATASHEET_ENDPOINT}?idCategory=${categoryId}&articleId=${articleId}&version=${version}`,
16
+ {
17
+
18
+ },
19
+ {
20
+ headers: {
21
+ Authorization: token,
22
+ },
23
+ }
15
24
  ),
16
25
  axios.get(
17
26
  `${process.env.REACT_APP_ARTICLE_DATA_DESCRIPTION_ENDPOINT}?idCategory=${categoryId}&articleId=${articleId}&version=${version}`