contentoh-components-library 21.2.17 → 21.2.20
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/organisms/DashboardMetric/index.js +3 -3
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +173 -108
- package/dist/components/pages/ProviderProductEdition/index.js +54 -41
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +69 -193
- package/dist/components/pages/RetailerProductEdition/index.js +98 -45
- package/package.json +1 -1
- package/src/components/organisms/DashboardMetric/index.js +4 -7
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +183 -117
- package/src/components/pages/ProviderProductEdition/index.js +15 -7
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +69 -489
- package/src/components/pages/RetailerProductEdition/index.js +64 -24
|
@@ -302,7 +302,7 @@ export const RetailerProductEdition = ({
|
|
|
302
302
|
switch (user.id_role) {
|
|
303
303
|
case 7:
|
|
304
304
|
case 8:
|
|
305
|
-
arr = ["CA", "RC", "RA"];
|
|
305
|
+
arr = ["AS", "CA", "RC", "RA"];
|
|
306
306
|
break;
|
|
307
307
|
case 4:
|
|
308
308
|
case 5:
|
|
@@ -713,6 +713,37 @@ export const RetailerProductEdition = ({
|
|
|
713
713
|
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
714
714
|
};
|
|
715
715
|
|
|
716
|
+
const approveRejectAllButtons = () => {
|
|
717
|
+
let concepts = [];
|
|
718
|
+
switch (user.id_role) {
|
|
719
|
+
case 4:
|
|
720
|
+
concepts = ["description", "datasheet"];
|
|
721
|
+
break;
|
|
722
|
+
case 5:
|
|
723
|
+
concepts = ["images"];
|
|
724
|
+
break;
|
|
725
|
+
|
|
726
|
+
default:
|
|
727
|
+
concepts = ["description", "datasheet", "images"];
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
const services = servicesData.filter(({ service }) =>
|
|
732
|
+
concepts.includes(service)
|
|
733
|
+
);
|
|
734
|
+
|
|
735
|
+
const adminFacilitatorCanEvaluate =
|
|
736
|
+
services.every((srv) => srv?.status?.replace(/.*\//, "") === "IE") &&
|
|
737
|
+
[1, 4, 5].includes(user.id_role);
|
|
738
|
+
|
|
739
|
+
//sessionStorage product
|
|
740
|
+
const adminAuditorCanEvaluate =
|
|
741
|
+
servicesData.every((srv) =>
|
|
742
|
+
["AC", "RP", "RCA"].includes(srv?.status?.replace(/.*\//, ""))
|
|
743
|
+
) && [1, 6].includes(user.id_role);
|
|
744
|
+
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
745
|
+
};
|
|
746
|
+
|
|
716
747
|
const getSectionIcon = () => {
|
|
717
748
|
switch (activeTab) {
|
|
718
749
|
case "Ficha técnica":
|
|
@@ -721,7 +752,7 @@ export const RetailerProductEdition = ({
|
|
|
721
752
|
case "Descripción":
|
|
722
753
|
setIcon(descriptionSent);
|
|
723
754
|
break;
|
|
724
|
-
case "
|
|
755
|
+
case "Imágenes":
|
|
725
756
|
setIcon(imagesSent);
|
|
726
757
|
break;
|
|
727
758
|
default:
|
|
@@ -1119,24 +1150,38 @@ export const RetailerProductEdition = ({
|
|
|
1119
1150
|
setLoading(true);
|
|
1120
1151
|
const evaluationArray = [];
|
|
1121
1152
|
const sendAll = [];
|
|
1122
|
-
|
|
1153
|
+
let conceptArray = [];
|
|
1154
|
+
switch (user.id_role) {
|
|
1155
|
+
case 4:
|
|
1156
|
+
conceptArray = ["description", "datasheet"];
|
|
1157
|
+
break;
|
|
1158
|
+
case 5:
|
|
1159
|
+
conceptArray = ["images"];
|
|
1160
|
+
break;
|
|
1161
|
+
|
|
1162
|
+
default:
|
|
1163
|
+
conceptArray = ["description", "datasheet", "images"];
|
|
1164
|
+
break;
|
|
1165
|
+
}
|
|
1123
1166
|
|
|
1124
1167
|
servicesData?.forEach((ret) => {
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1168
|
+
if (conceptArray.includes(ret.service)) {
|
|
1169
|
+
let data = {
|
|
1170
|
+
articleId: product.article.id_article,
|
|
1171
|
+
orderId: product.id_order ?? product.orderId,
|
|
1172
|
+
concept: ret.service,
|
|
1173
|
+
result: result,
|
|
1174
|
+
evalStatus: product[`${ret.service}_status`],
|
|
1175
|
+
retailerId: ret.id_retailer,
|
|
1176
|
+
};
|
|
1177
|
+
evaluationArray.push(
|
|
1178
|
+
axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
1179
|
+
headers: {
|
|
1180
|
+
Authorization: token,
|
|
1181
|
+
},
|
|
1182
|
+
})
|
|
1183
|
+
);
|
|
1184
|
+
}
|
|
1140
1185
|
});
|
|
1141
1186
|
|
|
1142
1187
|
await Promise.all(evaluationArray);
|
|
@@ -1247,12 +1292,7 @@ export const RetailerProductEdition = ({
|
|
|
1247
1292
|
]);
|
|
1248
1293
|
}}
|
|
1249
1294
|
showApproveRejectAll={
|
|
1250
|
-
|
|
1251
|
-
servicesData.every((serv) =>
|
|
1252
|
-
["RA", "AA", "AP", "ACA", "AC"].includes(serv.status)
|
|
1253
|
-
) &&
|
|
1254
|
-
approveRejectButtons() &&
|
|
1255
|
-
(auditorAssigned() || userAssigned())
|
|
1295
|
+
approveRejectAllButtons() && (auditorAssigned() || userAssigned())
|
|
1256
1296
|
}
|
|
1257
1297
|
showValidationButtons={
|
|
1258
1298
|
approveRejectButtons() && (auditorAssigned() || userAssigned())
|