contentoh-components-library 21.1.60 → 21.1.63
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/dist/components/atoms/ProductPercentCard/Percent.stories.js +1 -1
- package/dist/components/atoms/ProductPercentCard/styles.js +1 -1
- package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +1 -1
- package/dist/components/molecules/AssignedWork/styles.js +1 -1
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +93 -109
- package/dist/components/pages/ProviderProductEdition/index.js +430 -429
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +1 -1
- package/dist/components/pages/RetailerProductEdition/index.js +217 -200
- package/dist/global-files/data.js +8 -8
- package/package.json +1 -1
- package/src/components/atoms/ProductPercentCard/Percent.stories.js +11 -12
- package/src/components/atoms/ProductPercentCard/styles.js +9 -9
- package/src/components/molecules/AssignedWork/AssignedWork.stories.js +8 -8
- package/src/components/molecules/AssignedWork/styles.js +9 -10
- package/src/components/organisms/FullProductNameHeader/index.js +2 -2
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +95 -114
- package/src/components/pages/ProviderProductEdition/index.js +232 -248
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +1 -1
- package/src/components/pages/RetailerProductEdition/index.js +149 -173
- package/src/global-files/data.js +8 -8
- package/src/components/atoms/ProgressBar/styles.js +0 -69
|
@@ -160,14 +160,9 @@ export const ProviderProductEdition = ({
|
|
|
160
160
|
: productToEdit
|
|
161
161
|
);
|
|
162
162
|
const [icon, setIcon] = useState(null);
|
|
163
|
-
const [version
|
|
164
|
-
const [comments
|
|
163
|
+
const [version] = useState(product?.version);
|
|
164
|
+
const [comments] = useState({});
|
|
165
165
|
const [comment, setComment] = useState("");
|
|
166
|
-
const [requiredNull, setRequiredNull] = useState({
|
|
167
|
-
"Ficha técnica": 0,
|
|
168
|
-
Descripción: 0,
|
|
169
|
-
Imágenes: 0,
|
|
170
|
-
});
|
|
171
166
|
const [crossComment, setCrossComment] = useState(false);
|
|
172
167
|
const [userGroups, setUserGroups] = useState([]);
|
|
173
168
|
const [assig, setAssig] = useState({});
|
|
@@ -176,7 +171,6 @@ export const ProviderProductEdition = ({
|
|
|
176
171
|
const [checkAll, setCheckAll] = useState(false);
|
|
177
172
|
const isRetailer = user?.is_retailer;
|
|
178
173
|
const [loading, setLoading] = useState(true);
|
|
179
|
-
const [statusArray, setStatusArray] = useState([]);
|
|
180
174
|
|
|
181
175
|
const originProp = location?.state?.origin;
|
|
182
176
|
const [origin, setOrigin] = useState({
|
|
@@ -208,6 +202,9 @@ export const ProviderProductEdition = ({
|
|
|
208
202
|
const [modalViewTextArea, setModalViewTextArea] = useState(false);
|
|
209
203
|
const [socketType, setSocketType] = useState(null);
|
|
210
204
|
const [saving, setSaving] = useState(loading);
|
|
205
|
+
const [retailerStatus, setRetailerStatus] = useState(
|
|
206
|
+
product.statusByRetailer
|
|
207
|
+
);
|
|
211
208
|
|
|
212
209
|
useEffect(() => {
|
|
213
210
|
checkAll && setSelectedImages(images.values);
|
|
@@ -233,11 +230,8 @@ export const ProviderProductEdition = ({
|
|
|
233
230
|
);
|
|
234
231
|
}
|
|
235
232
|
|
|
236
|
-
//setActiveRetailer(product?.retailers[0]);
|
|
237
|
-
setImages({
|
|
238
|
-
action: "init",
|
|
239
|
-
init: services[2],
|
|
240
|
-
});
|
|
233
|
+
// setActiveRetailer(product?.retailers[0]);
|
|
234
|
+
setImages({ action: "init", init: services[2] });
|
|
241
235
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
242
236
|
|
|
243
237
|
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
@@ -256,10 +250,11 @@ export const ProviderProductEdition = ({
|
|
|
256
250
|
}&end=true`
|
|
257
251
|
);
|
|
258
252
|
const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
|
|
253
|
+
const retailerResponse = parsedResponse?.map((srv) => srv.id_retailer);
|
|
259
254
|
let retailers = product.retailers || product.retailersAvailable;
|
|
260
|
-
let active = retailers?.
|
|
261
|
-
|
|
262
|
-
)
|
|
255
|
+
let active = retailers?.find((retailer) =>
|
|
256
|
+
retailerResponse.includes(retailer.id)
|
|
257
|
+
);
|
|
263
258
|
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
264
259
|
setServicesData(parsedResponse);
|
|
265
260
|
}
|
|
@@ -280,15 +275,15 @@ export const ProviderProductEdition = ({
|
|
|
280
275
|
if (revision && currentService === "AP") return true;
|
|
281
276
|
} else {
|
|
282
277
|
const { product } = productEdit;
|
|
283
|
-
|
|
284
|
-
orgn === "
|
|
285
|
-
(["
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
)
|
|
278
|
+
const isRequestWithoutContentoh =
|
|
279
|
+
orgn === "RequestWithoutContentoh" &&
|
|
280
|
+
(["R", "CA"].includes(currentService) ||
|
|
281
|
+
(currentService === "RCA" &&
|
|
282
|
+
(!product.id_order || !product.orderId)));
|
|
283
|
+
const isRequestWithContentoh =
|
|
284
|
+
orgn === "RequestWithContentoh" && currentService === "AA";
|
|
285
|
+
const isContentoh = orgn === "Contentoh" && currentService === "AA";
|
|
286
|
+
if (isContentoh || isRequestWithoutContentoh || isRequestWithContentoh)
|
|
292
287
|
return true;
|
|
293
288
|
}
|
|
294
289
|
}
|
|
@@ -305,29 +300,11 @@ export const ProviderProductEdition = ({
|
|
|
305
300
|
setInCart(arr.some((e) => e.articleId === product.id_article));
|
|
306
301
|
};
|
|
307
302
|
|
|
308
|
-
useEffect(
|
|
303
|
+
useEffect(() => {
|
|
309
304
|
sessionStorage.setItem("user", JSON.stringify(user));
|
|
310
305
|
loadData();
|
|
311
306
|
getCart();
|
|
312
|
-
|
|
313
|
-
let arr = [];
|
|
314
|
-
switch (user.id_role) {
|
|
315
|
-
case 7:
|
|
316
|
-
case 8:
|
|
317
|
-
arr = ["IN_PROGRESS", "RF", "RA"];
|
|
318
|
-
break;
|
|
319
|
-
case 4:
|
|
320
|
-
case 5:
|
|
321
|
-
arr = ["RF", "AF", "AA", "AP", "AC"];
|
|
322
|
-
break;
|
|
323
|
-
case 6:
|
|
324
|
-
arr = ["RP", "RC", "AF"];
|
|
325
|
-
break;
|
|
326
|
-
default:
|
|
327
|
-
arr = [];
|
|
328
|
-
break;
|
|
329
|
-
}
|
|
330
|
-
setStatusArray(arr);
|
|
307
|
+
fetchUsers(token).then((res) => setUserGroups(res));
|
|
331
308
|
}, [product]);
|
|
332
309
|
|
|
333
310
|
const loadAssignations = (currentProduct) => {
|
|
@@ -342,9 +319,9 @@ export const ProviderProductEdition = ({
|
|
|
342
319
|
const productTemp = product;
|
|
343
320
|
const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
|
|
344
321
|
retailers?.forEach((retailer) => {
|
|
345
|
-
retailer["percentage"] = percentages?.
|
|
322
|
+
retailer["percentage"] = percentages?.find(
|
|
346
323
|
(percent) => retailer?.id === percent?.id_retailer
|
|
347
|
-
)
|
|
324
|
+
)?.percentage;
|
|
348
325
|
});
|
|
349
326
|
|
|
350
327
|
setProduct(productTemp);
|
|
@@ -420,7 +397,7 @@ export const ProviderProductEdition = ({
|
|
|
420
397
|
};
|
|
421
398
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
422
399
|
try {
|
|
423
|
-
await axios.put(
|
|
400
|
+
const res = await axios.put(
|
|
424
401
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
|
|
425
402
|
dataObject,
|
|
426
403
|
{
|
|
@@ -429,8 +406,10 @@ export const ProviderProductEdition = ({
|
|
|
429
406
|
},
|
|
430
407
|
}
|
|
431
408
|
);
|
|
432
|
-
|
|
433
|
-
|
|
409
|
+
if (res.data.statusCode === 200) {
|
|
410
|
+
setMessage("Descripciones guardadas con éxito");
|
|
411
|
+
await loadData();
|
|
412
|
+
}
|
|
434
413
|
} catch (error) {
|
|
435
414
|
console.log(error);
|
|
436
415
|
}
|
|
@@ -453,8 +432,10 @@ export const ProviderProductEdition = ({
|
|
|
453
432
|
},
|
|
454
433
|
}
|
|
455
434
|
);
|
|
456
|
-
|
|
457
|
-
|
|
435
|
+
if (res.data.statusCode === 200) {
|
|
436
|
+
setMessage("Fichas técnicas guardadas");
|
|
437
|
+
await loadData();
|
|
438
|
+
}
|
|
458
439
|
} catch (error) {
|
|
459
440
|
console.log(error);
|
|
460
441
|
}
|
|
@@ -552,7 +533,7 @@ export const ProviderProductEdition = ({
|
|
|
552
533
|
return e;
|
|
553
534
|
});
|
|
554
535
|
try {
|
|
555
|
-
await axios.put(
|
|
536
|
+
const res = await axios.put(
|
|
556
537
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
557
538
|
dataImages,
|
|
558
539
|
{
|
|
@@ -561,9 +542,11 @@ export const ProviderProductEdition = ({
|
|
|
561
542
|
},
|
|
562
543
|
}
|
|
563
544
|
);
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
545
|
+
if (res.data.statusCode === 200) {
|
|
546
|
+
setMessage("Imágenes guardadas con éxito");
|
|
547
|
+
sessionStorage.removeItem("imagesList");
|
|
548
|
+
await loadData();
|
|
549
|
+
}
|
|
567
550
|
} catch (error) {
|
|
568
551
|
console.log(error);
|
|
569
552
|
}
|
|
@@ -665,12 +648,12 @@ export const ProviderProductEdition = ({
|
|
|
665
648
|
},
|
|
666
649
|
],
|
|
667
650
|
concept: concept,
|
|
668
|
-
|
|
651
|
+
userId: assignationId,
|
|
669
652
|
};
|
|
670
|
-
axios({
|
|
653
|
+
await axios({
|
|
671
654
|
method: "post",
|
|
672
655
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
673
|
-
data
|
|
656
|
+
data,
|
|
674
657
|
headers: {
|
|
675
658
|
Authorization: token,
|
|
676
659
|
},
|
|
@@ -688,7 +671,7 @@ export const ProviderProductEdition = ({
|
|
|
688
671
|
serv = serv.filter((f) => f.id_retailer === activeRetailer.id);
|
|
689
672
|
}
|
|
690
673
|
const statusArray =
|
|
691
|
-
user.is_retailer === 1 ? ["
|
|
674
|
+
user.is_retailer === 1 ? ["ACA", "RCA"] : ["AP", "RP", "ACA"];
|
|
692
675
|
return (
|
|
693
676
|
serv.length > 0 && serv.every((item) => statusArray.includes(item.status))
|
|
694
677
|
);
|
|
@@ -791,7 +774,7 @@ export const ProviderProductEdition = ({
|
|
|
791
774
|
const { datasheet_status, description_status, images_status } = product;
|
|
792
775
|
const completionStates =
|
|
793
776
|
user.is_retailer === 1
|
|
794
|
-
? ["
|
|
777
|
+
? ["ACA", "Evaluated", "NS"]
|
|
795
778
|
: ["AP", "Evaluated", "NS"];
|
|
796
779
|
const dsEvaluated = completionStates.includes(datasheet_status);
|
|
797
780
|
const descsEvaluated = completionStates.includes(description_status);
|
|
@@ -804,54 +787,69 @@ export const ProviderProductEdition = ({
|
|
|
804
787
|
|
|
805
788
|
const sendEvaluation = async (result) => {
|
|
806
789
|
setLoading(true);
|
|
807
|
-
|
|
790
|
+
const concept = getConcept(activeTab);
|
|
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 };
|
|
808
797
|
const retailerId = activeRetailer?.id;
|
|
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
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
798
|
+
let res;
|
|
799
|
+
try {
|
|
800
|
+
if (result) {
|
|
801
|
+
data.result = result;
|
|
802
|
+
data.retailerId = retailerId;
|
|
803
|
+
res = await axios.put(
|
|
804
|
+
`${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
805
|
+
data,
|
|
806
|
+
{
|
|
807
|
+
headers: {
|
|
808
|
+
Authorization: token,
|
|
809
|
+
},
|
|
810
|
+
}
|
|
811
|
+
);
|
|
812
|
+
const newStatuses = JSON.parse(res.data.body);
|
|
813
|
+
const orderStatus = newStatuses.newOrderStatus;
|
|
814
|
+
const serviceStatus =
|
|
815
|
+
newStatuses.newServiceStatus[articleId][
|
|
816
|
+
`${getConcept(activeTab)}Status`
|
|
817
|
+
];
|
|
818
|
+
|
|
819
|
+
const newProductEdit = productEdit;
|
|
820
|
+
newProductEdit.product[sectionStatusKey] = serviceStatus;
|
|
821
|
+
setProductEdit(newProductEdit);
|
|
822
|
+
showSurvey &&
|
|
823
|
+
showSurvey(!user.is_retailer && orderStatus[orderId] === "AP");
|
|
824
|
+
} else {
|
|
825
|
+
res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
826
|
+
headers: {
|
|
827
|
+
Authorization: token,
|
|
828
|
+
},
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
if (res.data.statusCode === 200) {
|
|
832
|
+
const { newArticleStatus, newServiceStatus, newStatus } = JSON.parse(
|
|
833
|
+
res.data.body
|
|
834
|
+
);
|
|
835
|
+
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
836
|
+
const retailerStatusCopy = { ...retailerStatus };
|
|
837
|
+
retailerStatusCopy[activeRetailer.id][concept] = newStatus;
|
|
838
|
+
setRetailerStatus(retailerStatusCopy);
|
|
839
|
+
productTemp.statusByRetailer = retailerStatusCopy;
|
|
840
|
+
let status;
|
|
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);
|
|
852
851
|
}
|
|
853
852
|
loadData();
|
|
854
|
-
showSurvey && showSurvey(confirmStatusComplete());
|
|
855
853
|
};
|
|
856
854
|
|
|
857
855
|
const validateAll = async (result) => {
|
|
@@ -860,14 +858,18 @@ export const ProviderProductEdition = ({
|
|
|
860
858
|
const evaluationArray = [];
|
|
861
859
|
const sendAll = [];
|
|
862
860
|
const conceptArray = ["description", "datasheet", "images"];
|
|
863
|
-
|
|
861
|
+
const dataGeneral = {
|
|
862
|
+
articleId: product.id_article,
|
|
863
|
+
orderId: product.id_order ?? product.orderId,
|
|
864
|
+
result,
|
|
865
|
+
};
|
|
864
866
|
servicesData?.forEach((ret) => {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
concept:
|
|
869
|
-
|
|
870
|
-
|
|
867
|
+
const { service, id_retailer } = ret;
|
|
868
|
+
const data = {
|
|
869
|
+
...dataGeneral,
|
|
870
|
+
concept: service,
|
|
871
|
+
retailerId: id_retailer,
|
|
872
|
+
evalStatus: retailerStatus[id_retailer][service],
|
|
871
873
|
};
|
|
872
874
|
evaluationArray.push(
|
|
873
875
|
axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
@@ -876,16 +878,6 @@ export const ProviderProductEdition = ({
|
|
|
876
878
|
},
|
|
877
879
|
})
|
|
878
880
|
);
|
|
879
|
-
});
|
|
880
|
-
|
|
881
|
-
await Promise.all(evaluationArray);
|
|
882
|
-
|
|
883
|
-
conceptArray?.forEach((concept) => {
|
|
884
|
-
let data = {
|
|
885
|
-
articleId: product.id_article,
|
|
886
|
-
orderId: product.id_order ?? product.orderId,
|
|
887
|
-
concept,
|
|
888
|
-
};
|
|
889
881
|
sendAll.push(
|
|
890
882
|
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
891
883
|
headers: {
|
|
@@ -895,15 +887,27 @@ export const ProviderProductEdition = ({
|
|
|
895
887
|
);
|
|
896
888
|
});
|
|
897
889
|
|
|
898
|
-
await Promise.all(sendAll);
|
|
890
|
+
await Promise.all([...evaluationArray, ...sendAll]);
|
|
891
|
+
|
|
899
892
|
const productTemp = product;
|
|
900
|
-
productTemp.article_status = `${result}
|
|
893
|
+
productTemp.article_status = `${result}CA`;
|
|
901
894
|
productTemp.datasheet_status =
|
|
902
|
-
productTemp.datasheet_status === "NA" ? "NA" : `${result}
|
|
895
|
+
productTemp.datasheet_status === "NA" ? "NA" : `${result}CA`;
|
|
903
896
|
productTemp.description_status =
|
|
904
|
-
productTemp.description_status === "NA" ? "NA" : `${result}
|
|
897
|
+
productTemp.description_status === "NA" ? "NA" : `${result}CA`;
|
|
905
898
|
productTemp.images_status =
|
|
906
|
-
productTemp.images_status === "NA" ? "NA" : `${result}
|
|
899
|
+
productTemp.images_status === "NA" ? "NA" : `${result}CA`;
|
|
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;
|
|
907
911
|
setProduct(productTemp);
|
|
908
912
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
909
913
|
setProductEdit({
|
|
@@ -920,7 +924,7 @@ export const ProviderProductEdition = ({
|
|
|
920
924
|
})
|
|
921
925
|
);
|
|
922
926
|
|
|
923
|
-
loadData();
|
|
927
|
+
await loadData();
|
|
924
928
|
} catch (error) {
|
|
925
929
|
console.log(error);
|
|
926
930
|
}
|
|
@@ -941,7 +945,7 @@ export const ProviderProductEdition = ({
|
|
|
941
945
|
},
|
|
942
946
|
});
|
|
943
947
|
const prod = productEdit;
|
|
944
|
-
const statusComplete = user.is_retailer ? `${result}
|
|
948
|
+
const statusComplete = user.is_retailer ? `${result}CA` : `${result}P`;
|
|
945
949
|
prod.product.datasheet_status = statusComplete;
|
|
946
950
|
prod.product.description_status = statusComplete;
|
|
947
951
|
prod.product.images_status = statusComplete;
|
|
@@ -950,24 +954,22 @@ export const ProviderProductEdition = ({
|
|
|
950
954
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
951
955
|
setProduct(prod);
|
|
952
956
|
setShowGenericModal && setShowGenericModal(false);
|
|
953
|
-
loadData();
|
|
957
|
+
await loadData();
|
|
954
958
|
};
|
|
955
959
|
|
|
956
960
|
const getSectionStatus = () => {
|
|
957
961
|
const concept = getConcept(activeTab);
|
|
958
|
-
return ["AA", "AP", "
|
|
962
|
+
return ["AA", "AP", "R", "CA", "RCA"].includes(
|
|
959
963
|
productEdit.product[`${concept}_status`]
|
|
960
964
|
);
|
|
961
965
|
};
|
|
962
966
|
|
|
963
967
|
const enableActions = (versionStatus) => {
|
|
964
968
|
try {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
if (userIsRetailer) return false;
|
|
969
|
+
if (user.is_retailer) return false;
|
|
968
970
|
|
|
969
971
|
if (versionStatus) {
|
|
970
|
-
return ["AP", "
|
|
972
|
+
return ["AP", "ACA", "RCA", null].includes(versionStatus);
|
|
971
973
|
}
|
|
972
974
|
return true;
|
|
973
975
|
} catch (err) {
|
|
@@ -1057,23 +1059,21 @@ export const ProviderProductEdition = ({
|
|
|
1057
1059
|
},
|
|
1058
1060
|
}));
|
|
1059
1061
|
setShowGenericModal(true);
|
|
1060
|
-
} else {
|
|
1061
|
-
if (
|
|
1062
|
-
if (product.id_order || product.orderId) {
|
|
1063
|
-
validateAll("A");
|
|
1064
|
-
} else {
|
|
1065
|
-
setDataGenericModal((prev) => ({
|
|
1066
|
-
...prev,
|
|
1067
|
-
button2: {
|
|
1068
|
-
name: "Continuar",
|
|
1069
|
-
action: () => evaluationToRetailer("A"),
|
|
1070
|
-
},
|
|
1071
|
-
}));
|
|
1072
|
-
setShowGenericModal(true);
|
|
1073
|
-
}
|
|
1074
|
-
} else {
|
|
1062
|
+
} else if (user.is_retailer) {
|
|
1063
|
+
if (product.id_order || product.orderId) {
|
|
1075
1064
|
validateAll("A");
|
|
1065
|
+
} else {
|
|
1066
|
+
setDataGenericModal((prev) => ({
|
|
1067
|
+
...prev,
|
|
1068
|
+
button2: {
|
|
1069
|
+
name: "Continuar",
|
|
1070
|
+
action: () => evaluationToRetailer("A"),
|
|
1071
|
+
},
|
|
1072
|
+
}));
|
|
1073
|
+
setShowGenericModal(true);
|
|
1076
1074
|
}
|
|
1075
|
+
} else {
|
|
1076
|
+
validateAll("A");
|
|
1077
1077
|
}
|
|
1078
1078
|
}}
|
|
1079
1079
|
rejectAll={() => {
|
|
@@ -1083,25 +1083,23 @@ export const ProviderProductEdition = ({
|
|
|
1083
1083
|
(!product.id_order || !product.orderId)
|
|
1084
1084
|
) {
|
|
1085
1085
|
return;
|
|
1086
|
-
} else {
|
|
1087
|
-
if (
|
|
1088
|
-
if (product.id_order || product.orderId) {
|
|
1089
|
-
validateAll("R");
|
|
1090
|
-
setModalViewError(true);
|
|
1091
|
-
} else {
|
|
1092
|
-
setDataGenericModal((prev) => ({
|
|
1093
|
-
...prev,
|
|
1094
|
-
button2: {
|
|
1095
|
-
name: "Continuar",
|
|
1096
|
-
action: () => evaluationToRetailer("R"),
|
|
1097
|
-
},
|
|
1098
|
-
}));
|
|
1099
|
-
setShowGenericModal(true);
|
|
1100
|
-
}
|
|
1101
|
-
} else {
|
|
1086
|
+
} else if (user.is_retailer) {
|
|
1087
|
+
if (product.id_order || product.orderId) {
|
|
1102
1088
|
validateAll("R");
|
|
1103
1089
|
setModalViewError(true);
|
|
1090
|
+
} else {
|
|
1091
|
+
setDataGenericModal((prev) => ({
|
|
1092
|
+
...prev,
|
|
1093
|
+
button2: {
|
|
1094
|
+
name: "Continuar",
|
|
1095
|
+
action: () => evaluationToRetailer("R"),
|
|
1096
|
+
},
|
|
1097
|
+
}));
|
|
1098
|
+
setShowGenericModal(true);
|
|
1104
1099
|
}
|
|
1100
|
+
} else {
|
|
1101
|
+
validateAll("R");
|
|
1102
|
+
setModalViewError(true);
|
|
1105
1103
|
}
|
|
1106
1104
|
}}
|
|
1107
1105
|
approve={() => {
|
|
@@ -1118,23 +1116,21 @@ export const ProviderProductEdition = ({
|
|
|
1118
1116
|
},
|
|
1119
1117
|
}));
|
|
1120
1118
|
setShowGenericModal(true);
|
|
1121
|
-
} else {
|
|
1122
|
-
if (
|
|
1123
|
-
if (product.id_order || product.orderId) {
|
|
1124
|
-
sendEvaluation("A");
|
|
1125
|
-
} else {
|
|
1126
|
-
setDataGenericModal((prev) => ({
|
|
1127
|
-
...prev,
|
|
1128
|
-
button2: {
|
|
1129
|
-
name: "Continuar",
|
|
1130
|
-
action: () => evaluationToRetailer("A"),
|
|
1131
|
-
},
|
|
1132
|
-
}));
|
|
1133
|
-
setShowGenericModal(true);
|
|
1134
|
-
}
|
|
1135
|
-
} else {
|
|
1119
|
+
} else if (user.is_retailer) {
|
|
1120
|
+
if (product.id_order || product.orderId) {
|
|
1136
1121
|
sendEvaluation("A");
|
|
1122
|
+
} else {
|
|
1123
|
+
setDataGenericModal((prev) => ({
|
|
1124
|
+
...prev,
|
|
1125
|
+
button2: {
|
|
1126
|
+
name: "Continuar",
|
|
1127
|
+
action: () => evaluationToRetailer("A"),
|
|
1128
|
+
},
|
|
1129
|
+
}));
|
|
1130
|
+
setShowGenericModal(true);
|
|
1137
1131
|
}
|
|
1132
|
+
} else {
|
|
1133
|
+
sendEvaluation("A");
|
|
1138
1134
|
}
|
|
1139
1135
|
}}
|
|
1140
1136
|
reject={() => {
|
|
@@ -1144,33 +1140,33 @@ export const ProviderProductEdition = ({
|
|
|
1144
1140
|
(!product.id_order || !product.orderId)
|
|
1145
1141
|
) {
|
|
1146
1142
|
return;
|
|
1147
|
-
} else {
|
|
1148
|
-
if (
|
|
1149
|
-
if (product.id_order || product.orderId) {
|
|
1150
|
-
sendEvaluation("R");
|
|
1151
|
-
setModalViewError(true);
|
|
1152
|
-
} else {
|
|
1153
|
-
setDataGenericModal((prev) => ({
|
|
1154
|
-
...prev,
|
|
1155
|
-
button2: {
|
|
1156
|
-
name: "Continuar",
|
|
1157
|
-
action: () => evaluationToRetailer("R"),
|
|
1158
|
-
},
|
|
1159
|
-
}));
|
|
1160
|
-
setShowGenericModal(true);
|
|
1161
|
-
}
|
|
1162
|
-
} else {
|
|
1143
|
+
} else if (user.is_retailer) {
|
|
1144
|
+
if (product.id_order || product.orderId) {
|
|
1163
1145
|
sendEvaluation("R");
|
|
1164
1146
|
setModalViewError(true);
|
|
1147
|
+
} else {
|
|
1148
|
+
setDataGenericModal((prev) => ({
|
|
1149
|
+
...prev,
|
|
1150
|
+
button2: {
|
|
1151
|
+
name: "Continuar",
|
|
1152
|
+
action: () => evaluationToRetailer("R"),
|
|
1153
|
+
},
|
|
1154
|
+
}));
|
|
1155
|
+
setShowGenericModal(true);
|
|
1165
1156
|
}
|
|
1157
|
+
} else {
|
|
1158
|
+
sendEvaluation("R");
|
|
1159
|
+
setModalViewError(true);
|
|
1166
1160
|
}
|
|
1167
1161
|
}}
|
|
1168
1162
|
/>
|
|
1169
1163
|
<FullTabsMenu
|
|
1170
1164
|
tabsSections={tabsSections}
|
|
1171
1165
|
status={
|
|
1172
|
-
|
|
1173
|
-
|
|
1166
|
+
activeRetailer.id && retailerStatus
|
|
1167
|
+
? retailerStatus[activeRetailer?.id][getConcept(activeTab)] ||
|
|
1168
|
+
"NS"
|
|
1169
|
+
: "-"
|
|
1174
1170
|
}
|
|
1175
1171
|
activeTab={activeTab}
|
|
1176
1172
|
setActiveTab={setActiveTab}
|
|
@@ -1313,56 +1309,44 @@ export const ProviderProductEdition = ({
|
|
|
1313
1309
|
/>
|
|
1314
1310
|
</div>
|
|
1315
1311
|
)}
|
|
1316
|
-
<Button
|
|
1317
|
-
buttonType={
|
|
1318
|
-
evaluationComplete(activeTab) &&
|
|
1319
|
-
(productEdit.product.id_order || productEdit.product.orderId)
|
|
1320
|
-
? "general-green-button"
|
|
1321
|
-
: "general-button-disabled"
|
|
1322
|
-
}
|
|
1323
|
-
label={"Enviar evaluación"}
|
|
1324
|
-
onClick={() => {
|
|
1325
|
-
//setModalSent(true);
|
|
1326
|
-
sendEvaluation();
|
|
1327
|
-
setMessage(`¡Evaluación de ${activeTab} completada!`);
|
|
1328
|
-
}}
|
|
1329
|
-
/>
|
|
1330
1312
|
</div>
|
|
1331
|
-
) :
|
|
1332
|
-
|
|
1333
|
-
<div>
|
|
1334
|
-
<
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1313
|
+
) : (
|
|
1314
|
+
!revision && (
|
|
1315
|
+
<div className="required-inputs-message">
|
|
1316
|
+
<div>
|
|
1317
|
+
<p>
|
|
1318
|
+
Los atributos son requeridos por las plataformas de las
|
|
1319
|
+
cadenas, es muy importante completar los campos requeridos
|
|
1320
|
+
ya que pueden rechazar el producto por falta de información.
|
|
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
1348
|
</div>
|
|
1340
|
-
|
|
1341
|
-
<button type="button">
|
|
1342
|
-
<Link to="/checkout">
|
|
1343
|
-
<p>Articulo en carrito</p>
|
|
1344
|
-
<p>Ir a checkout</p>
|
|
1345
|
-
</Link>
|
|
1346
|
-
</button>
|
|
1347
|
-
) : (
|
|
1348
|
-
<>
|
|
1349
|
-
<SliderToolTip
|
|
1350
|
-
infoIcon={InfoIcon}
|
|
1351
|
-
slidefront={slidefront}
|
|
1352
|
-
iconSize={"big-image"}
|
|
1353
|
-
slidePosition={"top-slide"}
|
|
1354
|
-
></SliderToolTip>
|
|
1355
|
-
<Button
|
|
1356
|
-
onClick={() => {
|
|
1357
|
-
setShowContentohRequestModal &&
|
|
1358
|
-
setShowContentohRequestModal(true);
|
|
1359
|
-
}}
|
|
1360
|
-
buttonType="general-default-button"
|
|
1361
|
-
label="Enviar a Content-oh!"
|
|
1362
|
-
/>
|
|
1363
|
-
</>
|
|
1364
|
-
)}
|
|
1365
|
-
</div>
|
|
1349
|
+
)
|
|
1366
1350
|
)}
|
|
1367
1351
|
</div>
|
|
1368
1352
|
</div>
|