contentoh-components-library 21.1.63 → 21.1.64
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 +1 -0
- package/dist/components/atoms/GeneralButton/index.js +3 -1
- package/dist/components/atoms/GeneralButton/styles.js +2 -2
- package/dist/components/atoms/InputFormatter/index.js +3 -3
- package/dist/components/atoms/ProductPercentCard/Percent.stories.js +1 -1
- package/dist/components/atoms/ProductPercentCard/styles.js +1 -1
- package/dist/components/atoms/Select/VersionSelect.js +37 -0
- package/dist/components/atoms/Select/index.js +4 -3
- package/dist/components/atoms/Select/style.js +10 -4
- package/dist/components/atoms/SliderToolTip/styles.js +2 -2
- package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +1 -1
- package/dist/components/molecules/AssignedWork/styles.js +1 -1
- package/dist/components/molecules/StatusAsignationInfo/index.js +9 -1
- package/dist/components/molecules/VersionItem/VersionItem.stories.js +28 -0
- package/dist/components/molecules/VersionItem/index.js +64 -0
- package/dist/components/molecules/VersionItem/styles.js +20 -0
- package/dist/components/organisms/CreateVersion/CreateVersion.stories.js +31 -0
- package/dist/components/organisms/CreateVersion/RenderChilds.js +157 -0
- package/dist/components/organisms/CreateVersion/index.js +170 -0
- package/dist/components/organisms/CreateVersion/styles.js +28 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/organisms/FullTabsMenu/index.js +6 -2
- package/dist/components/organisms/VersionSelector/VersionSelector.stories.js +32 -0
- package/dist/components/organisms/VersionSelector/index.js +129 -0
- package/dist/components/organisms/VersionSelector/styles.js +20 -0
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +102 -112
- package/dist/components/pages/ProviderProductEdition/index.js +449 -431
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +53 -72
- package/dist/components/pages/RetailerProductEdition/index.js +245 -231
- package/dist/global-files/customHooks.js +35 -0
- package/dist/global-files/data.js +8 -8
- package/package.json +2 -2
- package/src/assets/images/versionSelector/acceptIcon.svg +3 -0
- package/src/assets/images/versionSelector/addVersion.svg +5 -0
- package/src/assets/images/versionSelector/closeVersionSelector.svg +4 -0
- package/src/assets/images/versionSelector/createVersion.svg +3 -0
- package/src/assets/images/versionSelector/nullIcon.svg +3 -0
- package/src/assets/images/versionSelector/versionSelected.svg +3 -0
- package/src/components/atoms/GeneralButton/index.js +2 -0
- package/src/components/atoms/GeneralButton/styles.js +18 -0
- package/src/components/atoms/InputFormatter/index.js +6 -3
- package/src/components/atoms/ProductPercentCard/Percent.stories.js +12 -11
- package/src/components/atoms/ProductPercentCard/styles.js +9 -9
- package/src/components/atoms/ProgressBar/styles.js +69 -0
- package/src/components/atoms/Select/VersionSelect.js +25 -0
- package/src/components/atoms/Select/index.js +1 -1
- package/src/components/atoms/Select/style.js +19 -0
- package/src/components/atoms/SliderToolTip/styles.js +18 -14
- package/src/components/molecules/AssignedWork/AssignedWork.stories.js +8 -8
- package/src/components/molecules/AssignedWork/styles.js +10 -9
- package/src/components/molecules/StatusAsignationInfo/index.js +10 -1
- package/src/components/molecules/VersionItem/VersionItem.stories.js +14 -0
- package/src/components/molecules/VersionItem/index.js +47 -0
- package/src/components/molecules/VersionItem/styles.js +32 -0
- package/src/components/organisms/CreateVersion/CreateVersion.stories.js +14 -0
- package/src/components/organisms/CreateVersion/RenderChilds.js +137 -0
- package/src/components/organisms/CreateVersion/index.js +88 -0
- package/src/components/organisms/CreateVersion/styles.js +79 -0
- package/src/components/organisms/FullProductNameHeader/index.js +2 -2
- package/src/components/organisms/FullTabsMenu/index.js +5 -1
- package/src/components/organisms/VersionSelector/VersionSelector.stories.js +15 -0
- package/src/components/organisms/VersionSelector/index.js +75 -0
- package/src/components/organisms/VersionSelector/styles.js +28 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +116 -134
- package/src/components/pages/ProviderProductEdition/index.js +267 -234
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +53 -74
- package/src/components/pages/RetailerProductEdition/index.js +201 -151
- package/src/global-files/customHooks.js +26 -0
- package/src/global-files/data.js +8 -8
- package/src/global-files/global-styles.css +1 -0
|
@@ -40,6 +40,8 @@ import Slide1_2 from "../../../assets/images/sliderToolTip/slide2.svg";
|
|
|
40
40
|
import Slide1_3 from "../../../assets/images/sliderToolTip/slide3.svg";
|
|
41
41
|
import Slide1_4 from "../../../assets/images/sliderToolTip/slide4.svg";
|
|
42
42
|
import Slide1_5 from "../../../assets/images/sliderToolTip/slide5.svg";
|
|
43
|
+
import { VersionSelector } from "../../organisms/VersionSelector";
|
|
44
|
+
import { closeModals } from "../../../global-files/customHooks";
|
|
43
45
|
|
|
44
46
|
const reducerImages = (state, action) => {
|
|
45
47
|
let { values, attrForImgs } = state;
|
|
@@ -88,6 +90,7 @@ export const ProviderProductEdition = ({
|
|
|
88
90
|
revision = false,
|
|
89
91
|
setShowContentohRequestModal,
|
|
90
92
|
showSurvey,
|
|
93
|
+
company,
|
|
91
94
|
}) => {
|
|
92
95
|
const [activeTab, setActiveTab] = useState("Descripción");
|
|
93
96
|
const [activeImage, setActiveImage] = useState();
|
|
@@ -160,9 +163,14 @@ export const ProviderProductEdition = ({
|
|
|
160
163
|
: productToEdit
|
|
161
164
|
);
|
|
162
165
|
const [icon, setIcon] = useState(null);
|
|
163
|
-
const [version] = useState(product?.version);
|
|
164
|
-
const [comments] = useState({});
|
|
166
|
+
const [version, setVersion] = useState(product?.version);
|
|
167
|
+
const [comments, setComments] = useState({});
|
|
165
168
|
const [comment, setComment] = useState("");
|
|
169
|
+
const [requiredNull, setRequiredNull] = useState({
|
|
170
|
+
"Ficha técnica": 0,
|
|
171
|
+
Descripción: 0,
|
|
172
|
+
Imágenes: 0,
|
|
173
|
+
});
|
|
166
174
|
const [crossComment, setCrossComment] = useState(false);
|
|
167
175
|
const [userGroups, setUserGroups] = useState([]);
|
|
168
176
|
const [assig, setAssig] = useState({});
|
|
@@ -171,6 +179,7 @@ export const ProviderProductEdition = ({
|
|
|
171
179
|
const [checkAll, setCheckAll] = useState(false);
|
|
172
180
|
const isRetailer = user?.is_retailer;
|
|
173
181
|
const [loading, setLoading] = useState(true);
|
|
182
|
+
const [statusArray, setStatusArray] = useState([]);
|
|
174
183
|
|
|
175
184
|
const originProp = location?.state?.origin;
|
|
176
185
|
const [origin, setOrigin] = useState({
|
|
@@ -202,9 +211,8 @@ export const ProviderProductEdition = ({
|
|
|
202
211
|
const [modalViewTextArea, setModalViewTextArea] = useState(false);
|
|
203
212
|
const [socketType, setSocketType] = useState(null);
|
|
204
213
|
const [saving, setSaving] = useState(loading);
|
|
205
|
-
const [
|
|
206
|
-
|
|
207
|
-
);
|
|
214
|
+
const [showVersionSelector, setShowVersionSelector] =
|
|
215
|
+
closeModals("version-selector");
|
|
208
216
|
|
|
209
217
|
useEffect(() => {
|
|
210
218
|
checkAll && setSelectedImages(images.values);
|
|
@@ -215,7 +223,7 @@ export const ProviderProductEdition = ({
|
|
|
215
223
|
product?.id_article || product?.article?.id_article,
|
|
216
224
|
product?.article?.company_name || product?.categoryName,
|
|
217
225
|
parseInt(product?.article?.id_category || product?.id_category),
|
|
218
|
-
|
|
226
|
+
version
|
|
219
227
|
);
|
|
220
228
|
|
|
221
229
|
//Converts the data inside the datasheets object to array
|
|
@@ -230,8 +238,11 @@ export const ProviderProductEdition = ({
|
|
|
230
238
|
);
|
|
231
239
|
}
|
|
232
240
|
|
|
233
|
-
//
|
|
234
|
-
setImages({
|
|
241
|
+
//setActiveRetailer(product?.retailers[0]);
|
|
242
|
+
setImages({
|
|
243
|
+
action: "init",
|
|
244
|
+
init: services[2],
|
|
245
|
+
});
|
|
235
246
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
236
247
|
|
|
237
248
|
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
@@ -250,11 +261,10 @@ export const ProviderProductEdition = ({
|
|
|
250
261
|
}&end=true`
|
|
251
262
|
);
|
|
252
263
|
const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
|
|
253
|
-
const retailerResponse = parsedResponse?.map((srv) => srv.id_retailer);
|
|
254
264
|
let retailers = product.retailers || product.retailersAvailable;
|
|
255
|
-
let active = retailers?.
|
|
256
|
-
|
|
257
|
-
);
|
|
265
|
+
let active = retailers?.filter((retailer) =>
|
|
266
|
+
parsedResponse?.map((srv) => srv.id_retailer).includes(retailer.id)
|
|
267
|
+
)[0];
|
|
258
268
|
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
259
269
|
setServicesData(parsedResponse);
|
|
260
270
|
}
|
|
@@ -275,15 +285,15 @@ export const ProviderProductEdition = ({
|
|
|
275
285
|
if (revision && currentService === "AP") return true;
|
|
276
286
|
} else {
|
|
277
287
|
const { product } = productEdit;
|
|
278
|
-
|
|
279
|
-
orgn === "
|
|
280
|
-
(["
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
if (
|
|
289
|
+
orgn === "Contentoh" ||
|
|
290
|
+
(["RECEIVED", "IN_PROGRESS"].includes(currentService) &&
|
|
291
|
+
orgn === "RequestWithoutContentoh") ||
|
|
292
|
+
(currentService === "AA" && orgn === "RequestWithContentoh") ||
|
|
293
|
+
(currentService === "RC" &&
|
|
294
|
+
orgn === "RequestWithoutContentoh" &&
|
|
295
|
+
(!product.id_order || !product.orderId))
|
|
296
|
+
)
|
|
287
297
|
return true;
|
|
288
298
|
}
|
|
289
299
|
}
|
|
@@ -300,12 +310,31 @@ export const ProviderProductEdition = ({
|
|
|
300
310
|
setInCart(arr.some((e) => e.articleId === product.id_article));
|
|
301
311
|
};
|
|
302
312
|
|
|
303
|
-
useEffect(() => {
|
|
313
|
+
useEffect(async () => {
|
|
314
|
+
setLoading(true);
|
|
304
315
|
sessionStorage.setItem("user", JSON.stringify(user));
|
|
305
316
|
loadData();
|
|
306
317
|
getCart();
|
|
307
|
-
fetchUsers(token)
|
|
308
|
-
|
|
318
|
+
setUserGroups(await fetchUsers(token));
|
|
319
|
+
let arr = [];
|
|
320
|
+
switch (user.id_role) {
|
|
321
|
+
case 7:
|
|
322
|
+
case 8:
|
|
323
|
+
arr = ["IN_PROGRESS", "RF", "RA"];
|
|
324
|
+
break;
|
|
325
|
+
case 4:
|
|
326
|
+
case 5:
|
|
327
|
+
arr = ["RF", "AF", "AA", "AP", "AC"];
|
|
328
|
+
break;
|
|
329
|
+
case 6:
|
|
330
|
+
arr = ["RP", "RC", "AF"];
|
|
331
|
+
break;
|
|
332
|
+
default:
|
|
333
|
+
arr = [];
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
setStatusArray(arr);
|
|
337
|
+
}, [product, version]);
|
|
309
338
|
|
|
310
339
|
const loadAssignations = (currentProduct) => {
|
|
311
340
|
setAssig(product?.asignations);
|
|
@@ -319,9 +348,9 @@ export const ProviderProductEdition = ({
|
|
|
319
348
|
const productTemp = product;
|
|
320
349
|
const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
|
|
321
350
|
retailers?.forEach((retailer) => {
|
|
322
|
-
retailer["percentage"] = percentages?.
|
|
351
|
+
retailer["percentage"] = percentages?.filter(
|
|
323
352
|
(percent) => retailer?.id === percent?.id_retailer
|
|
324
|
-
)?.percentage;
|
|
353
|
+
)[0]?.percentage;
|
|
325
354
|
});
|
|
326
355
|
|
|
327
356
|
setProduct(productTemp);
|
|
@@ -397,7 +426,7 @@ export const ProviderProductEdition = ({
|
|
|
397
426
|
};
|
|
398
427
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
399
428
|
try {
|
|
400
|
-
|
|
429
|
+
await axios.put(
|
|
401
430
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
|
|
402
431
|
dataObject,
|
|
403
432
|
{
|
|
@@ -406,10 +435,8 @@ export const ProviderProductEdition = ({
|
|
|
406
435
|
},
|
|
407
436
|
}
|
|
408
437
|
);
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
await loadData();
|
|
412
|
-
}
|
|
438
|
+
setMessage("Descripciones guardadas con éxito");
|
|
439
|
+
loadData();
|
|
413
440
|
} catch (error) {
|
|
414
441
|
console.log(error);
|
|
415
442
|
}
|
|
@@ -432,10 +459,8 @@ export const ProviderProductEdition = ({
|
|
|
432
459
|
},
|
|
433
460
|
}
|
|
434
461
|
);
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
await loadData();
|
|
438
|
-
}
|
|
462
|
+
setMessage("Fichas técnicas guardadas");
|
|
463
|
+
loadData();
|
|
439
464
|
} catch (error) {
|
|
440
465
|
console.log(error);
|
|
441
466
|
}
|
|
@@ -533,7 +558,7 @@ export const ProviderProductEdition = ({
|
|
|
533
558
|
return e;
|
|
534
559
|
});
|
|
535
560
|
try {
|
|
536
|
-
|
|
561
|
+
await axios.put(
|
|
537
562
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
538
563
|
dataImages,
|
|
539
564
|
{
|
|
@@ -542,11 +567,9 @@ export const ProviderProductEdition = ({
|
|
|
542
567
|
},
|
|
543
568
|
}
|
|
544
569
|
);
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
await loadData();
|
|
549
|
-
}
|
|
570
|
+
setMessage("Imágenes guardadas con éxito");
|
|
571
|
+
sessionStorage.removeItem("imagesList");
|
|
572
|
+
loadData();
|
|
550
573
|
} catch (error) {
|
|
551
574
|
console.log(error);
|
|
552
575
|
}
|
|
@@ -648,12 +671,12 @@ export const ProviderProductEdition = ({
|
|
|
648
671
|
},
|
|
649
672
|
],
|
|
650
673
|
concept: concept,
|
|
651
|
-
|
|
674
|
+
[`${assignationType}Id`]: assignationId,
|
|
652
675
|
};
|
|
653
|
-
|
|
676
|
+
axios({
|
|
654
677
|
method: "post",
|
|
655
678
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
656
|
-
data,
|
|
679
|
+
data: data,
|
|
657
680
|
headers: {
|
|
658
681
|
Authorization: token,
|
|
659
682
|
},
|
|
@@ -671,7 +694,7 @@ export const ProviderProductEdition = ({
|
|
|
671
694
|
serv = serv.filter((f) => f.id_retailer === activeRetailer.id);
|
|
672
695
|
}
|
|
673
696
|
const statusArray =
|
|
674
|
-
user.is_retailer === 1 ? ["
|
|
697
|
+
user.is_retailer === 1 ? ["AC", "RC"] : ["AP", "RP", "AC"];
|
|
675
698
|
return (
|
|
676
699
|
serv.length > 0 && serv.every((item) => statusArray.includes(item.status))
|
|
677
700
|
);
|
|
@@ -774,7 +797,7 @@ export const ProviderProductEdition = ({
|
|
|
774
797
|
const { datasheet_status, description_status, images_status } = product;
|
|
775
798
|
const completionStates =
|
|
776
799
|
user.is_retailer === 1
|
|
777
|
-
? ["
|
|
800
|
+
? ["AC", "Evaluated", "NS"]
|
|
778
801
|
: ["AP", "Evaluated", "NS"];
|
|
779
802
|
const dsEvaluated = completionStates.includes(datasheet_status);
|
|
780
803
|
const descsEvaluated = completionStates.includes(description_status);
|
|
@@ -787,69 +810,54 @@ export const ProviderProductEdition = ({
|
|
|
787
810
|
|
|
788
811
|
const sendEvaluation = async (result) => {
|
|
789
812
|
setLoading(true);
|
|
790
|
-
|
|
791
|
-
const productTemp = product;
|
|
792
|
-
const articleId = productTemp.id_article;
|
|
793
|
-
const orderId = productTemp.id_order ?? productTemp.orderId;
|
|
794
|
-
const sectionStatusKey = `${getConcept(activeTab)}_status`;
|
|
795
|
-
const evalStatus = product[sectionStatusKey] || product?.version_status;
|
|
796
|
-
let data = { articleId, orderId, concept, evalStatus };
|
|
813
|
+
let data = {};
|
|
797
814
|
const retailerId = activeRetailer?.id;
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
if (newServiceStatus) {
|
|
842
|
-
status = newServiceStatus[articleId][`${concept}Status`];
|
|
843
|
-
productTemp[`${concept}_status`] = status;
|
|
844
|
-
}
|
|
845
|
-
setProduct(productTemp);
|
|
846
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
847
|
-
setOrigin((prev) => ({ ...prev, [concept]: status }));
|
|
848
|
-
}
|
|
849
|
-
} catch (err) {
|
|
850
|
-
console.log(err);
|
|
815
|
+
if (result) {
|
|
816
|
+
data = {
|
|
817
|
+
articleId: product.id_article,
|
|
818
|
+
orderId: product.id_order ?? product.orderId,
|
|
819
|
+
concept: getConcept(activeTab),
|
|
820
|
+
result: result,
|
|
821
|
+
retailerId,
|
|
822
|
+
};
|
|
823
|
+
await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
824
|
+
headers: {
|
|
825
|
+
Authorization: token,
|
|
826
|
+
},
|
|
827
|
+
});
|
|
828
|
+
} else {
|
|
829
|
+
const productTemp = product;
|
|
830
|
+
const concept = getConcept(activeTab);
|
|
831
|
+
productTemp[`${concept}_status`] = "Evaluated";
|
|
832
|
+
data = {
|
|
833
|
+
articleId: product.id_article,
|
|
834
|
+
orderId: product.id_order ?? product.orderId,
|
|
835
|
+
concept,
|
|
836
|
+
};
|
|
837
|
+
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
838
|
+
headers: {
|
|
839
|
+
Authorization: token,
|
|
840
|
+
},
|
|
841
|
+
});
|
|
842
|
+
setProduct(productTemp);
|
|
843
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
844
|
+
setProductEdit({
|
|
845
|
+
ArticleId: productTemp.id_article,
|
|
846
|
+
idCategory: productTemp.article.id_category,
|
|
847
|
+
product: productTemp,
|
|
848
|
+
});
|
|
849
|
+
sessionStorage.setItem(
|
|
850
|
+
"productEdit",
|
|
851
|
+
JSON.stringify({
|
|
852
|
+
ArticleId: productTemp.id_article,
|
|
853
|
+
idCategory: productTemp.article.id_category,
|
|
854
|
+
product: productTemp,
|
|
855
|
+
})
|
|
856
|
+
);
|
|
857
|
+
setOrigin((prev) => ({ ...prev, [concept]: "Evaluated" }));
|
|
851
858
|
}
|
|
852
859
|
loadData();
|
|
860
|
+
showSurvey && showSurvey(confirmStatusComplete());
|
|
853
861
|
};
|
|
854
862
|
|
|
855
863
|
const validateAll = async (result) => {
|
|
@@ -858,18 +866,14 @@ export const ProviderProductEdition = ({
|
|
|
858
866
|
const evaluationArray = [];
|
|
859
867
|
const sendAll = [];
|
|
860
868
|
const conceptArray = ["description", "datasheet", "images"];
|
|
861
|
-
|
|
862
|
-
articleId: product.id_article,
|
|
863
|
-
orderId: product.id_order ?? product.orderId,
|
|
864
|
-
result,
|
|
865
|
-
};
|
|
869
|
+
|
|
866
870
|
servicesData?.forEach((ret) => {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
concept: service,
|
|
871
|
-
|
|
872
|
-
|
|
871
|
+
let data = {
|
|
872
|
+
articleId: product.id_article,
|
|
873
|
+
orderId: product.id_order ?? product.orderId,
|
|
874
|
+
concept: ret.service,
|
|
875
|
+
result: result,
|
|
876
|
+
retailerId: ret.id_retailer,
|
|
873
877
|
};
|
|
874
878
|
evaluationArray.push(
|
|
875
879
|
axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
@@ -878,6 +882,16 @@ export const ProviderProductEdition = ({
|
|
|
878
882
|
},
|
|
879
883
|
})
|
|
880
884
|
);
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
await Promise.all(evaluationArray);
|
|
888
|
+
|
|
889
|
+
conceptArray?.forEach((concept) => {
|
|
890
|
+
let data = {
|
|
891
|
+
articleId: product.id_article,
|
|
892
|
+
orderId: product.id_order ?? product.orderId,
|
|
893
|
+
concept,
|
|
894
|
+
};
|
|
881
895
|
sendAll.push(
|
|
882
896
|
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
883
897
|
headers: {
|
|
@@ -887,27 +901,15 @@ export const ProviderProductEdition = ({
|
|
|
887
901
|
);
|
|
888
902
|
});
|
|
889
903
|
|
|
890
|
-
await Promise.all(
|
|
891
|
-
|
|
904
|
+
await Promise.all(sendAll);
|
|
892
905
|
const productTemp = product;
|
|
893
|
-
productTemp.article_status = `${result}
|
|
906
|
+
productTemp.article_status = `${result}C`;
|
|
894
907
|
productTemp.datasheet_status =
|
|
895
|
-
productTemp.datasheet_status === "NA" ? "NA" : `${result}
|
|
908
|
+
productTemp.datasheet_status === "NA" ? "NA" : `${result}C`;
|
|
896
909
|
productTemp.description_status =
|
|
897
|
-
productTemp.description_status === "NA" ? "NA" : `${result}
|
|
910
|
+
productTemp.description_status === "NA" ? "NA" : `${result}C`;
|
|
898
911
|
productTemp.images_status =
|
|
899
|
-
productTemp.images_status === "NA" ? "NA" : `${result}
|
|
900
|
-
|
|
901
|
-
const retailerStatusCopy = { ...retailerStatus };
|
|
902
|
-
Object.keys(retailerStatusCopy).forEach((key) => {
|
|
903
|
-
conceptArray.forEach((concept) => {
|
|
904
|
-
if (retailerStatusCopy[key][concept]) {
|
|
905
|
-
retailerStatusCopy[key][concept] = `${result}CA`;
|
|
906
|
-
}
|
|
907
|
-
});
|
|
908
|
-
});
|
|
909
|
-
setRetailerStatus(retailerStatusCopy);
|
|
910
|
-
productTemp.statusByRetailer = retailerStatusCopy;
|
|
912
|
+
productTemp.images_status === "NA" ? "NA" : `${result}C`;
|
|
911
913
|
setProduct(productTemp);
|
|
912
914
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
913
915
|
setProductEdit({
|
|
@@ -924,7 +926,7 @@ export const ProviderProductEdition = ({
|
|
|
924
926
|
})
|
|
925
927
|
);
|
|
926
928
|
|
|
927
|
-
|
|
929
|
+
loadData();
|
|
928
930
|
} catch (error) {
|
|
929
931
|
console.log(error);
|
|
930
932
|
}
|
|
@@ -945,7 +947,7 @@ export const ProviderProductEdition = ({
|
|
|
945
947
|
},
|
|
946
948
|
});
|
|
947
949
|
const prod = productEdit;
|
|
948
|
-
const statusComplete = user.is_retailer ? `${result}
|
|
950
|
+
const statusComplete = user.is_retailer ? `${result}C` : `${result}P`;
|
|
949
951
|
prod.product.datasheet_status = statusComplete;
|
|
950
952
|
prod.product.description_status = statusComplete;
|
|
951
953
|
prod.product.images_status = statusComplete;
|
|
@@ -954,22 +956,24 @@ export const ProviderProductEdition = ({
|
|
|
954
956
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
955
957
|
setProduct(prod);
|
|
956
958
|
setShowGenericModal && setShowGenericModal(false);
|
|
957
|
-
|
|
959
|
+
loadData();
|
|
958
960
|
};
|
|
959
961
|
|
|
960
962
|
const getSectionStatus = () => {
|
|
961
963
|
const concept = getConcept(activeTab);
|
|
962
|
-
return ["AA", "AP", "
|
|
964
|
+
return ["AA", "AP", "RECEIVED", "IN_PROGRESS", "RC"].includes(
|
|
963
965
|
productEdit.product[`${concept}_status`]
|
|
964
966
|
);
|
|
965
967
|
};
|
|
966
968
|
|
|
967
969
|
const enableActions = (versionStatus) => {
|
|
968
970
|
try {
|
|
969
|
-
|
|
971
|
+
const userIsRetailer = user.is_retailer;
|
|
972
|
+
|
|
973
|
+
if (userIsRetailer) return false;
|
|
970
974
|
|
|
971
975
|
if (versionStatus) {
|
|
972
|
-
return ["AP", "
|
|
976
|
+
return ["AP", "AC", "RC", null].includes(versionStatus);
|
|
973
977
|
}
|
|
974
978
|
return true;
|
|
975
979
|
} catch (err) {
|
|
@@ -1059,21 +1063,23 @@ export const ProviderProductEdition = ({
|
|
|
1059
1063
|
},
|
|
1060
1064
|
}));
|
|
1061
1065
|
setShowGenericModal(true);
|
|
1062
|
-
} else
|
|
1063
|
-
if (
|
|
1064
|
-
|
|
1066
|
+
} else {
|
|
1067
|
+
if (user.is_retailer) {
|
|
1068
|
+
if (product.id_order || product.orderId) {
|
|
1069
|
+
validateAll("A");
|
|
1070
|
+
} else {
|
|
1071
|
+
setDataGenericModal((prev) => ({
|
|
1072
|
+
...prev,
|
|
1073
|
+
button2: {
|
|
1074
|
+
name: "Continuar",
|
|
1075
|
+
action: () => evaluationToRetailer("A"),
|
|
1076
|
+
},
|
|
1077
|
+
}));
|
|
1078
|
+
setShowGenericModal(true);
|
|
1079
|
+
}
|
|
1065
1080
|
} else {
|
|
1066
|
-
|
|
1067
|
-
...prev,
|
|
1068
|
-
button2: {
|
|
1069
|
-
name: "Continuar",
|
|
1070
|
-
action: () => evaluationToRetailer("A"),
|
|
1071
|
-
},
|
|
1072
|
-
}));
|
|
1073
|
-
setShowGenericModal(true);
|
|
1081
|
+
validateAll("A");
|
|
1074
1082
|
}
|
|
1075
|
-
} else {
|
|
1076
|
-
validateAll("A");
|
|
1077
1083
|
}
|
|
1078
1084
|
}}
|
|
1079
1085
|
rejectAll={() => {
|
|
@@ -1083,23 +1089,25 @@ export const ProviderProductEdition = ({
|
|
|
1083
1089
|
(!product.id_order || !product.orderId)
|
|
1084
1090
|
) {
|
|
1085
1091
|
return;
|
|
1086
|
-
} else
|
|
1087
|
-
if (
|
|
1092
|
+
} else {
|
|
1093
|
+
if (user.is_retailer) {
|
|
1094
|
+
if (product.id_order || product.orderId) {
|
|
1095
|
+
validateAll("R");
|
|
1096
|
+
setModalViewError(true);
|
|
1097
|
+
} else {
|
|
1098
|
+
setDataGenericModal((prev) => ({
|
|
1099
|
+
...prev,
|
|
1100
|
+
button2: {
|
|
1101
|
+
name: "Continuar",
|
|
1102
|
+
action: () => evaluationToRetailer("R"),
|
|
1103
|
+
},
|
|
1104
|
+
}));
|
|
1105
|
+
setShowGenericModal(true);
|
|
1106
|
+
}
|
|
1107
|
+
} else {
|
|
1088
1108
|
validateAll("R");
|
|
1089
1109
|
setModalViewError(true);
|
|
1090
|
-
} else {
|
|
1091
|
-
setDataGenericModal((prev) => ({
|
|
1092
|
-
...prev,
|
|
1093
|
-
button2: {
|
|
1094
|
-
name: "Continuar",
|
|
1095
|
-
action: () => evaluationToRetailer("R"),
|
|
1096
|
-
},
|
|
1097
|
-
}));
|
|
1098
|
-
setShowGenericModal(true);
|
|
1099
1110
|
}
|
|
1100
|
-
} else {
|
|
1101
|
-
validateAll("R");
|
|
1102
|
-
setModalViewError(true);
|
|
1103
1111
|
}
|
|
1104
1112
|
}}
|
|
1105
1113
|
approve={() => {
|
|
@@ -1116,21 +1124,23 @@ export const ProviderProductEdition = ({
|
|
|
1116
1124
|
},
|
|
1117
1125
|
}));
|
|
1118
1126
|
setShowGenericModal(true);
|
|
1119
|
-
} else
|
|
1120
|
-
if (
|
|
1121
|
-
|
|
1127
|
+
} else {
|
|
1128
|
+
if (user.is_retailer) {
|
|
1129
|
+
if (product.id_order || product.orderId) {
|
|
1130
|
+
sendEvaluation("A");
|
|
1131
|
+
} else {
|
|
1132
|
+
setDataGenericModal((prev) => ({
|
|
1133
|
+
...prev,
|
|
1134
|
+
button2: {
|
|
1135
|
+
name: "Continuar",
|
|
1136
|
+
action: () => evaluationToRetailer("A"),
|
|
1137
|
+
},
|
|
1138
|
+
}));
|
|
1139
|
+
setShowGenericModal(true);
|
|
1140
|
+
}
|
|
1122
1141
|
} else {
|
|
1123
|
-
|
|
1124
|
-
...prev,
|
|
1125
|
-
button2: {
|
|
1126
|
-
name: "Continuar",
|
|
1127
|
-
action: () => evaluationToRetailer("A"),
|
|
1128
|
-
},
|
|
1129
|
-
}));
|
|
1130
|
-
setShowGenericModal(true);
|
|
1142
|
+
sendEvaluation("A");
|
|
1131
1143
|
}
|
|
1132
|
-
} else {
|
|
1133
|
-
sendEvaluation("A");
|
|
1134
1144
|
}
|
|
1135
1145
|
}}
|
|
1136
1146
|
reject={() => {
|
|
@@ -1140,33 +1150,33 @@ export const ProviderProductEdition = ({
|
|
|
1140
1150
|
(!product.id_order || !product.orderId)
|
|
1141
1151
|
) {
|
|
1142
1152
|
return;
|
|
1143
|
-
} else
|
|
1144
|
-
if (
|
|
1153
|
+
} else {
|
|
1154
|
+
if (user.is_retailer) {
|
|
1155
|
+
if (product.id_order || product.orderId) {
|
|
1156
|
+
sendEvaluation("R");
|
|
1157
|
+
setModalViewError(true);
|
|
1158
|
+
} else {
|
|
1159
|
+
setDataGenericModal((prev) => ({
|
|
1160
|
+
...prev,
|
|
1161
|
+
button2: {
|
|
1162
|
+
name: "Continuar",
|
|
1163
|
+
action: () => evaluationToRetailer("R"),
|
|
1164
|
+
},
|
|
1165
|
+
}));
|
|
1166
|
+
setShowGenericModal(true);
|
|
1167
|
+
}
|
|
1168
|
+
} else {
|
|
1145
1169
|
sendEvaluation("R");
|
|
1146
1170
|
setModalViewError(true);
|
|
1147
|
-
} else {
|
|
1148
|
-
setDataGenericModal((prev) => ({
|
|
1149
|
-
...prev,
|
|
1150
|
-
button2: {
|
|
1151
|
-
name: "Continuar",
|
|
1152
|
-
action: () => evaluationToRetailer("R"),
|
|
1153
|
-
},
|
|
1154
|
-
}));
|
|
1155
|
-
setShowGenericModal(true);
|
|
1156
1171
|
}
|
|
1157
|
-
} else {
|
|
1158
|
-
sendEvaluation("R");
|
|
1159
|
-
setModalViewError(true);
|
|
1160
1172
|
}
|
|
1161
1173
|
}}
|
|
1162
1174
|
/>
|
|
1163
1175
|
<FullTabsMenu
|
|
1164
1176
|
tabsSections={tabsSections}
|
|
1165
1177
|
status={
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
"NS"
|
|
1169
|
-
: "-"
|
|
1178
|
+
product[`${getConcept(activeTab)}_status`] ||
|
|
1179
|
+
product?.version_status
|
|
1170
1180
|
}
|
|
1171
1181
|
activeTab={activeTab}
|
|
1172
1182
|
setActiveTab={setActiveTab}
|
|
@@ -1177,6 +1187,8 @@ export const ProviderProductEdition = ({
|
|
|
1177
1187
|
setAssignation={setAssignation}
|
|
1178
1188
|
isRetailer={isRetailer}
|
|
1179
1189
|
showSaveButton={enableActions(product.version_status)}
|
|
1190
|
+
version={version}
|
|
1191
|
+
setShowVersionSelector={setShowVersionSelector}
|
|
1180
1192
|
onClickSave={() => {
|
|
1181
1193
|
switch (activeTab) {
|
|
1182
1194
|
case "Descripción":
|
|
@@ -1309,44 +1321,56 @@ export const ProviderProductEdition = ({
|
|
|
1309
1321
|
/>
|
|
1310
1322
|
</div>
|
|
1311
1323
|
)}
|
|
1324
|
+
<Button
|
|
1325
|
+
buttonType={
|
|
1326
|
+
evaluationComplete(activeTab) &&
|
|
1327
|
+
(productEdit.product.id_order || productEdit.product.orderId)
|
|
1328
|
+
? "general-green-button"
|
|
1329
|
+
: "general-button-disabled"
|
|
1330
|
+
}
|
|
1331
|
+
label={"Enviar evaluación"}
|
|
1332
|
+
onClick={() => {
|
|
1333
|
+
//setModalSent(true);
|
|
1334
|
+
sendEvaluation();
|
|
1335
|
+
setMessage(`¡Evaluación de ${activeTab} completada!`);
|
|
1336
|
+
}}
|
|
1337
|
+
/>
|
|
1312
1338
|
</div>
|
|
1313
|
-
) : (
|
|
1314
|
-
|
|
1315
|
-
<div
|
|
1316
|
-
<
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
</p>
|
|
1322
|
-
</div>
|
|
1323
|
-
{inCart ? (
|
|
1324
|
-
<button type="button">
|
|
1325
|
-
<Link to="/checkout">
|
|
1326
|
-
<p>Articulo en carrito</p>
|
|
1327
|
-
<p>Ir a checkout</p>
|
|
1328
|
-
</Link>
|
|
1329
|
-
</button>
|
|
1330
|
-
) : (
|
|
1331
|
-
<>
|
|
1332
|
-
<SliderToolTip
|
|
1333
|
-
infoIcon={InfoIcon}
|
|
1334
|
-
slidefront={slidefront}
|
|
1335
|
-
iconSize={"big-image"}
|
|
1336
|
-
slidePosition={"top-slide"}
|
|
1337
|
-
/>
|
|
1338
|
-
<Button
|
|
1339
|
-
onClick={() => {
|
|
1340
|
-
setShowContentohRequestModal &&
|
|
1341
|
-
setShowContentohRequestModal(true);
|
|
1342
|
-
}}
|
|
1343
|
-
buttonType="general-default-button"
|
|
1344
|
-
label="Enviar a Content-oh!"
|
|
1345
|
-
/>
|
|
1346
|
-
</>
|
|
1347
|
-
)}
|
|
1339
|
+
) : revision ? null : (
|
|
1340
|
+
<div className="required-inputs-message">
|
|
1341
|
+
<div>
|
|
1342
|
+
<p>
|
|
1343
|
+
Los atributos son requeridos por las plataformas de las
|
|
1344
|
+
cadenas, es muy importante completar los campos requeridos ya
|
|
1345
|
+
que pueden rechazar el producto por falta de información.
|
|
1346
|
+
</p>
|
|
1348
1347
|
</div>
|
|
1349
|
-
|
|
1348
|
+
{inCart ? (
|
|
1349
|
+
<button type="button">
|
|
1350
|
+
<Link to="/checkout">
|
|
1351
|
+
<p>Articulo en carrito</p>
|
|
1352
|
+
<p>Ir a checkout</p>
|
|
1353
|
+
</Link>
|
|
1354
|
+
</button>
|
|
1355
|
+
) : (
|
|
1356
|
+
<>
|
|
1357
|
+
<SliderToolTip
|
|
1358
|
+
infoIcon={InfoIcon}
|
|
1359
|
+
slidefront={slidefront}
|
|
1360
|
+
iconSize={"big-image"}
|
|
1361
|
+
slidePosition={"top-slide"}
|
|
1362
|
+
></SliderToolTip>
|
|
1363
|
+
<Button
|
|
1364
|
+
onClick={() => {
|
|
1365
|
+
setShowContentohRequestModal &&
|
|
1366
|
+
setShowContentohRequestModal(true);
|
|
1367
|
+
}}
|
|
1368
|
+
buttonType="general-default-button"
|
|
1369
|
+
label="Enviar a Content-oh!"
|
|
1370
|
+
/>
|
|
1371
|
+
</>
|
|
1372
|
+
)}
|
|
1373
|
+
</div>
|
|
1350
1374
|
)}
|
|
1351
1375
|
</div>
|
|
1352
1376
|
</div>
|
|
@@ -1423,6 +1447,15 @@ export const ProviderProductEdition = ({
|
|
|
1423
1447
|
textArea={false}
|
|
1424
1448
|
/>
|
|
1425
1449
|
)}
|
|
1450
|
+
{showVersionSelector && (
|
|
1451
|
+
<VersionSelector
|
|
1452
|
+
modalId={"version-selector"}
|
|
1453
|
+
articleId={product.id_article}
|
|
1454
|
+
setVersion={setVersion}
|
|
1455
|
+
companyName={company.company_name}
|
|
1456
|
+
currentVersion={version}
|
|
1457
|
+
/>
|
|
1458
|
+
)}
|
|
1426
1459
|
</Container>
|
|
1427
1460
|
);
|
|
1428
1461
|
};
|