contentoh-components-library 21.4.67 → 21.4.68
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/Avatar/index.js +2 -3
- package/dist/components/atoms/CheckBox/styles.js +1 -1
- package/dist/components/atoms/InputFormatter/styles.js +1 -1
- package/dist/components/atoms/SliderToolTip/styles.js +1 -1
- package/dist/components/molecules/BoxAttribute/index.js +3 -3
- package/dist/components/molecules/BoxAttribute/styles.js +1 -1
- package/dist/components/molecules/BoxButtons/index.js +1 -0
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +11 -68
- package/dist/components/molecules/SignInLogin/index.js +28 -36
- package/dist/components/molecules/StripeCardSelector/CardSelector.stories.js +2 -1
- package/dist/components/organisms/Chat/Chat.stories.js +8 -27
- package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +197 -350
- package/dist/components/organisms/Chat/Footer/index.js +39 -48
- package/dist/components/organisms/Chat/index.js +4 -49
- package/dist/components/organisms/Chat/styles.js +1 -1
- package/dist/components/organisms/DashboardMetric/index.js +6 -12
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/organisms/InputGroup/index.js +10 -1
- package/dist/components/organisms/Modal/styles.js +1 -1
- package/dist/components/pages/Dashboard/Dashboard.stories.js +36 -33
- package/dist/components/pages/Dashboard/index.js +18 -67
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +3 -3
- package/dist/components/pages/ProviderProductEdition/index.js +144 -120
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +3 -7
- package/dist/components/pages/RetailerProductEdition/index.js +433 -312
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
- package/dist/global-files/data.js +3 -11
- package/dist/global-files/variables.js +1 -5
- 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/styles.js +0 -2
- package/src/components/atoms/InputFormatter/styles.js +1 -2
- package/src/components/atoms/SliderToolTip/styles.js +1 -1
- package/src/components/atoms/TabSection/styles.js +1 -1
- package/src/components/molecules/BoxAttribute/index.js +25 -32
- package/src/components/molecules/BoxAttribute/styles.js +1 -1
- package/src/components/molecules/BoxButtons/index.js +22 -23
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +6 -52
- package/src/components/molecules/SignInLogin/index.js +11 -11
- package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +2 -1
- package/src/components/molecules/TagAndInput/index.js +5 -6
- package/src/components/organisms/Chat/Chat.stories.js +7 -27
- package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
- package/src/components/organisms/Chat/ContainerItems/styles.js +2 -14
- package/src/components/organisms/Chat/ContentChat/index.js +12 -88
- package/src/components/organisms/Chat/Footer/index.js +0 -11
- package/src/components/organisms/Chat/index.js +4 -46
- package/src/components/organisms/Chat/styles.js +0 -4
- package/src/components/organisms/DashboardMetric/index.js +3 -6
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/InputGroup/index.js +119 -131
- package/src/components/organisms/Modal/styles.js +1 -4
- package/src/components/organisms/OrderDetail/utils/Table/utils.js +16 -6
- package/src/components/pages/Dashboard/Dashboard.stories.js +38 -33
- package/src/components/pages/Dashboard/index.js +39 -80
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +83 -100
- package/src/components/pages/ProviderProductEdition/index.js +131 -100
- package/src/components/pages/ProviderProductEdition/styles.js +1 -5
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -6
- package/src/components/pages/RetailerProductEdition/index.js +309 -147
- package/src/components/pages/RetailerProductEdition/styles.js +0 -4
- package/src/components/pages/RetailerProductEdition/utils.js +0 -37
- package/src/global-files/data.js +13 -7
- package/src/global-files/variables.js +0 -4
- package/src/index.js +0 -11
- package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
- 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 -69
- 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 -101
- 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 -130
- 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 -98
- 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 -152
- 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 -149
- 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 -100
- 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 -95
- 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 -86
- 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 -105
- package/src/components/molecules/GridItem/styles.js +0 -104
- 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 -40
- 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 -14
- package/src/components/organisms/GridProducts/utils.js +0 -111
|
@@ -24,20 +24,15 @@ import descriptionSent from "../../../assets/images/modalsSVGs/descriptionSent.s
|
|
|
24
24
|
import imagesSent from "../../../assets/images/modalsSVGs/uploadingImages.svg";
|
|
25
25
|
import { TagAndInput } from "../../molecules/TagAndInput/index";
|
|
26
26
|
import { Button } from "../../atoms/GeneralButton";
|
|
27
|
+
import { Commentary } from "../../atoms/Commentary";
|
|
27
28
|
import { GenericModal } from "../../atoms/GenericModal";
|
|
28
29
|
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
29
30
|
import { Loading } from "../../atoms/Loading";
|
|
30
31
|
import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
|
|
32
|
+
import errorModal from "../../../assets/images/genericModal/errorModal.svg";
|
|
31
33
|
import { VersionSelector } from "../../organisms/VersionSelector";
|
|
32
34
|
import { useCloseModal } from "../../../global-files/customHooks";
|
|
33
|
-
import {
|
|
34
|
-
getAuditVersion,
|
|
35
|
-
getInputsData,
|
|
36
|
-
createMessage,
|
|
37
|
-
sendMessage,
|
|
38
|
-
} from "./utils";
|
|
39
|
-
import { Modal } from "../../organisms/Modal";
|
|
40
|
-
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
35
|
+
import { getAuditVersion, getInputsData } from "./utils";
|
|
41
36
|
|
|
42
37
|
const reducerImages = (state, action) => {
|
|
43
38
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -137,7 +132,6 @@ export const RetailerProductEdition = ({
|
|
|
137
132
|
const [datasheets, setDatasheets] = useState([]);
|
|
138
133
|
const [images, setImages] = useReducer(reducerImages, {});
|
|
139
134
|
const [showModal, setShowModal] = useState(false);
|
|
140
|
-
const [showRejectModal, setShowRejectModal] = useState(false);
|
|
141
135
|
const { getRootProps, getInputProps } = useDropzone({
|
|
142
136
|
accept: "image/*",
|
|
143
137
|
noKeyboard: true,
|
|
@@ -224,11 +218,6 @@ export const RetailerProductEdition = ({
|
|
|
224
218
|
const [auditDescriptions, setAuditDescriptions] = useState([]);
|
|
225
219
|
const [auditImages, setAuditImages] = useState([]);
|
|
226
220
|
const [compare, setCompare] = useState(false);
|
|
227
|
-
const [valRejAll, setValRejAll] = useState(false);
|
|
228
|
-
|
|
229
|
-
const [desc, setDesc] = useState([]);
|
|
230
|
-
const [fich, setFich] = useState([]);
|
|
231
|
-
const [imag, setImag] = useState([]);
|
|
232
221
|
|
|
233
222
|
useEffect(async () => {
|
|
234
223
|
const { id_article } = product?.article || {};
|
|
@@ -574,7 +563,6 @@ export const RetailerProductEdition = ({
|
|
|
574
563
|
active: images?.values?.some((value) => value?.image_id === e?.id),
|
|
575
564
|
}));
|
|
576
565
|
setSocketType(imageInputs);
|
|
577
|
-
console.log(images);
|
|
578
566
|
}, [images]);
|
|
579
567
|
|
|
580
568
|
const updateImages = useCallback(async () => {
|
|
@@ -820,6 +808,84 @@ export const RetailerProductEdition = ({
|
|
|
820
808
|
}
|
|
821
809
|
};
|
|
822
810
|
|
|
811
|
+
// const sendToFacilitator = async (result) => {
|
|
812
|
+
// setLoading(true);
|
|
813
|
+
// try {
|
|
814
|
+
// let concept = getConcept(activeTab);
|
|
815
|
+
|
|
816
|
+
// const productTemp = { ...product };
|
|
817
|
+
// const evalStatus = retailerStatus;
|
|
818
|
+
// const articleId = product.article.id_article;
|
|
819
|
+
// const orderId = product.orderId;
|
|
820
|
+
|
|
821
|
+
// // const body = {
|
|
822
|
+
// // orderArticleRetailers: [
|
|
823
|
+
// // { orderId, articleId, retailersIds: [activeRetailer.id] },
|
|
824
|
+
// // ],
|
|
825
|
+
// // isAproved: false,
|
|
826
|
+
// // service: concept,
|
|
827
|
+
// // };
|
|
828
|
+
|
|
829
|
+
// const body = {
|
|
830
|
+
// articleId: product.article.id_article,
|
|
831
|
+
// orderId: product.orderId,
|
|
832
|
+
// concept: concept,
|
|
833
|
+
// result: result,
|
|
834
|
+
// evalStatus: evalStatus,
|
|
835
|
+
// retailerId: activeRetailer.id,
|
|
836
|
+
// };
|
|
837
|
+
|
|
838
|
+
// let res;
|
|
839
|
+
// let message;
|
|
840
|
+
// if (result) {
|
|
841
|
+
// body.isAproved = result === "A";
|
|
842
|
+
// res = await axios.put(
|
|
843
|
+
// `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
844
|
+
// body,
|
|
845
|
+
// {
|
|
846
|
+
// headers: {
|
|
847
|
+
// Authorization: token,
|
|
848
|
+
// },
|
|
849
|
+
// }
|
|
850
|
+
// );
|
|
851
|
+
// console.log(JSON.parse(res.data.body), "res");
|
|
852
|
+
// getServices();
|
|
853
|
+
// } else {
|
|
854
|
+
// const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
|
|
855
|
+
|
|
856
|
+
// if (specialistDone) {
|
|
857
|
+
// message = `${activeTab} enviada a facilitador`;
|
|
858
|
+
// getSectionIcon();
|
|
859
|
+
// } else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
|
|
860
|
+
// message = "Evaluación enviada";
|
|
861
|
+
// getSectionIcon();
|
|
862
|
+
// }
|
|
863
|
+
// res = await axios.put(
|
|
864
|
+
// `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
865
|
+
// body,
|
|
866
|
+
// {
|
|
867
|
+
// headers: {
|
|
868
|
+
// Authorization: token,
|
|
869
|
+
// },
|
|
870
|
+
// }
|
|
871
|
+
// );
|
|
872
|
+
// }
|
|
873
|
+
// if (res.data.statusCode === 200) {
|
|
874
|
+
// const response = JSON.parse(res.data.body)?.successfulData;
|
|
875
|
+
// const statusObject =
|
|
876
|
+
// response[`${orderId}-${articleId}-${activeRetailer.id}`];
|
|
877
|
+
// productTemp.status = statusObject["generalStatus"];
|
|
878
|
+
// productTemp[`${concept}_status`] = statusObject[`${concept}Status`];
|
|
879
|
+
// await loadData();
|
|
880
|
+
// if (message) setMessage(message);
|
|
881
|
+
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
882
|
+
// setProduct(productTemp);
|
|
883
|
+
// }
|
|
884
|
+
// } catch (error) {
|
|
885
|
+
// console.log(error);
|
|
886
|
+
// }
|
|
887
|
+
// setLoading(false);
|
|
888
|
+
// };
|
|
823
889
|
const sendToFacilitator = async (result) => {
|
|
824
890
|
setLoading(true);
|
|
825
891
|
try {
|
|
@@ -830,27 +896,26 @@ export const RetailerProductEdition = ({
|
|
|
830
896
|
const articleId = product.article.id_article;
|
|
831
897
|
const orderId = product.orderId;
|
|
832
898
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
899
|
+
let data = {
|
|
900
|
+
articleId,
|
|
901
|
+
orderId,
|
|
902
|
+
concept,
|
|
903
|
+
evalStatus,
|
|
904
|
+
retailerId: activeRetailer.id,
|
|
839
905
|
};
|
|
840
906
|
let res;
|
|
841
907
|
let message;
|
|
842
908
|
if (result) {
|
|
843
|
-
|
|
844
|
-
res = await axios.
|
|
909
|
+
data.result = result;
|
|
910
|
+
res = await axios.put(
|
|
845
911
|
`${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
846
|
-
|
|
912
|
+
data,
|
|
847
913
|
{
|
|
848
914
|
headers: {
|
|
849
915
|
Authorization: token,
|
|
850
916
|
},
|
|
851
917
|
}
|
|
852
918
|
);
|
|
853
|
-
console.log(JSON.parse(res.data.body), "res");
|
|
854
919
|
getServices();
|
|
855
920
|
} else {
|
|
856
921
|
const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
|
|
@@ -862,39 +927,16 @@ export const RetailerProductEdition = ({
|
|
|
862
927
|
message = "Evaluación enviada";
|
|
863
928
|
getSectionIcon();
|
|
864
929
|
}
|
|
865
|
-
res = await axios.
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
Authorization: token,
|
|
871
|
-
},
|
|
872
|
-
}
|
|
873
|
-
);
|
|
930
|
+
res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
931
|
+
headers: {
|
|
932
|
+
Authorization: token,
|
|
933
|
+
},
|
|
934
|
+
});
|
|
874
935
|
}
|
|
875
936
|
if (res.data.statusCode === 200) {
|
|
876
937
|
const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse(
|
|
877
938
|
res.data.body
|
|
878
939
|
);
|
|
879
|
-
const messageToChat = createMessage(
|
|
880
|
-
product.retailers,
|
|
881
|
-
activeRetailer.id,
|
|
882
|
-
evalStatus,
|
|
883
|
-
newStatus,
|
|
884
|
-
activeTab
|
|
885
|
-
);
|
|
886
|
-
|
|
887
|
-
const data = {
|
|
888
|
-
paramsBody: {
|
|
889
|
-
id: product.article.id_article,
|
|
890
|
-
version: version,
|
|
891
|
-
items: [{ type: "status", value: messageToChat }],
|
|
892
|
-
retailerId: activeRetailer.id,
|
|
893
|
-
status: product.status,
|
|
894
|
-
},
|
|
895
|
-
paramsHeader: { Authorization: token },
|
|
896
|
-
};
|
|
897
|
-
await sendMessage(data);
|
|
898
940
|
if (newOrderStatus) productTemp.status = newArticleStatus[articleId];
|
|
899
941
|
productTemp[`${concept}_status`] = newStatus;
|
|
900
942
|
await loadData();
|
|
@@ -937,19 +979,35 @@ export const RetailerProductEdition = ({
|
|
|
937
979
|
return product?.article[`id_auditor`] === user.id_user;
|
|
938
980
|
};
|
|
939
981
|
|
|
940
|
-
const createComment = async (
|
|
982
|
+
const createComment = async (e, body, tab) => {
|
|
983
|
+
let concept = "";
|
|
984
|
+
switch (activeTab) {
|
|
985
|
+
case "Ficha técnica":
|
|
986
|
+
concept = "datasheet";
|
|
987
|
+
break;
|
|
988
|
+
case "Imágenes":
|
|
989
|
+
concept = "images";
|
|
990
|
+
break;
|
|
991
|
+
|
|
992
|
+
default:
|
|
993
|
+
concept = "description";
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
941
996
|
const data = {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
status: product.status,
|
|
948
|
-
},
|
|
949
|
-
paramsHeader: { Authorization: token },
|
|
997
|
+
articleId: product?.article?.id_article,
|
|
998
|
+
orderId: product?.orderId,
|
|
999
|
+
message: body?.replace(/<.*?\/?>/gm, ""),
|
|
1000
|
+
concept: concept,
|
|
1001
|
+
version: version,
|
|
950
1002
|
};
|
|
1003
|
+
await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
1004
|
+
headers: {
|
|
1005
|
+
Authorization: token,
|
|
1006
|
+
},
|
|
1007
|
+
});
|
|
1008
|
+
await getComments(tab);
|
|
951
1009
|
setMessage("");
|
|
952
|
-
|
|
1010
|
+
setComponentsArray([]);
|
|
953
1011
|
};
|
|
954
1012
|
|
|
955
1013
|
const getRequired = (services) => {
|
|
@@ -1201,7 +1259,6 @@ export const RetailerProductEdition = ({
|
|
|
1201
1259
|
};
|
|
1202
1260
|
|
|
1203
1261
|
useEffect(() => {
|
|
1204
|
-
console.log(servicesData, "servicesData");
|
|
1205
1262
|
let status = getRetailerStatus(servicesData, activeTab);
|
|
1206
1263
|
setRetailerStatus(status);
|
|
1207
1264
|
}, [activeTab, servicesData, activeRetailer]);
|
|
@@ -1214,11 +1271,76 @@ export const RetailerProductEdition = ({
|
|
|
1214
1271
|
setSaving(loading);
|
|
1215
1272
|
}, [loading]);
|
|
1216
1273
|
|
|
1274
|
+
// const validateAll = async (result) => {
|
|
1275
|
+
// try {
|
|
1276
|
+
// setLoading(true);
|
|
1277
|
+
// const evaluationArray = [];
|
|
1278
|
+
// let conceptArray = ["description", "datasheet", "images"];
|
|
1279
|
+
// switch (user.id_role) {
|
|
1280
|
+
// case 4:
|
|
1281
|
+
// conceptArray = ["description", "datasheet"];
|
|
1282
|
+
// break;
|
|
1283
|
+
// case 5:
|
|
1284
|
+
// conceptArray = ["images"];
|
|
1285
|
+
// break;
|
|
1286
|
+
|
|
1287
|
+
// default:
|
|
1288
|
+
// conceptArray = ["description", "datasheet", "images"];
|
|
1289
|
+
// break;
|
|
1290
|
+
// }
|
|
1291
|
+
|
|
1292
|
+
// const isAproved = result === "A";
|
|
1293
|
+
// const retailersIds = [];
|
|
1294
|
+
// servicesData?.forEach((ret) => {
|
|
1295
|
+
// if (!retailersIds.includes(ret.id_retailer))
|
|
1296
|
+
// retailersIds.push(ret.id_retailer);
|
|
1297
|
+
// });
|
|
1298
|
+
// const body = {
|
|
1299
|
+
// orderArticleRetailers: [
|
|
1300
|
+
// {
|
|
1301
|
+
// orderId: product.id_order ?? product.orderId,
|
|
1302
|
+
// articleId: product.article.id_article,
|
|
1303
|
+
// retailersIds,
|
|
1304
|
+
// },
|
|
1305
|
+
// ],
|
|
1306
|
+
// isAproved,
|
|
1307
|
+
// };
|
|
1308
|
+
// conceptArray.forEach((concept) => {
|
|
1309
|
+
// body.service = concept;
|
|
1310
|
+
// evaluationArray.push(
|
|
1311
|
+
// axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
|
|
1312
|
+
// headers: {
|
|
1313
|
+
// Authorization: token,
|
|
1314
|
+
// },
|
|
1315
|
+
// })
|
|
1316
|
+
// );
|
|
1317
|
+
// });
|
|
1318
|
+
|
|
1319
|
+
// await Promise.all(evaluationArray);
|
|
1320
|
+
|
|
1321
|
+
// const productTemp = product;
|
|
1322
|
+
// productTemp.status = `${result}A`;
|
|
1323
|
+
// productTemp.datasheet_status =
|
|
1324
|
+
// productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
|
|
1325
|
+
// productTemp.description_status =
|
|
1326
|
+
// productTemp.description_status === "NA" ? "NA" : `${result}A`;
|
|
1327
|
+
// productTemp.images_status =
|
|
1328
|
+
// productTemp.images_status === "NA" ? "NA" : `${result}A`;
|
|
1329
|
+
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1330
|
+
// setProduct(productTemp);
|
|
1331
|
+
|
|
1332
|
+
// await loadData();
|
|
1333
|
+
// } catch (error) {
|
|
1334
|
+
// console.log(error);
|
|
1335
|
+
// }
|
|
1336
|
+
// };
|
|
1337
|
+
|
|
1217
1338
|
const validateAll = async (result) => {
|
|
1339
|
+
|
|
1218
1340
|
try {
|
|
1219
1341
|
setLoading(true);
|
|
1220
1342
|
const evaluationArray = [];
|
|
1221
|
-
let conceptArray = [
|
|
1343
|
+
let conceptArray = [];
|
|
1222
1344
|
switch (user.id_role) {
|
|
1223
1345
|
case 4:
|
|
1224
1346
|
conceptArray = ["description", "datasheet"];
|
|
@@ -1232,45 +1354,38 @@ export const RetailerProductEdition = ({
|
|
|
1232
1354
|
break;
|
|
1233
1355
|
}
|
|
1234
1356
|
|
|
1235
|
-
const messages = [];
|
|
1236
|
-
|
|
1237
1357
|
servicesData?.forEach((ret) => {
|
|
1238
|
-
if (
|
|
1239
|
-
|
|
1240
|
-
});
|
|
1241
|
-
const body = {
|
|
1242
|
-
orderArticleRetailers: [
|
|
1243
|
-
{
|
|
1244
|
-
orderId: product.id_order ?? product.orderId,
|
|
1358
|
+
if (conceptArray.includes(ret.service)) {
|
|
1359
|
+
let data = {
|
|
1245
1360
|
articleId: product.article.id_article,
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1361
|
+
orderId: product.id_order ?? product.orderId,
|
|
1362
|
+
concept: ret.service,
|
|
1363
|
+
result: result,
|
|
1364
|
+
evalStatus: ret.status,
|
|
1365
|
+
retailerId: ret.id_retailer,
|
|
1366
|
+
};
|
|
1367
|
+
evaluationArray.push(
|
|
1368
|
+
axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
1369
|
+
headers: {
|
|
1370
|
+
Authorization: token,
|
|
1371
|
+
},
|
|
1372
|
+
})
|
|
1373
|
+
);
|
|
1374
|
+
}
|
|
1260
1375
|
});
|
|
1376
|
+
|
|
1261
1377
|
await Promise.all(evaluationArray);
|
|
1262
1378
|
|
|
1263
1379
|
const productTemp = product;
|
|
1264
1380
|
productTemp.status = `${result}A`;
|
|
1265
1381
|
productTemp.datasheet_status =
|
|
1266
|
-
productTemp.datasheet_status === "
|
|
1382
|
+
productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
|
|
1267
1383
|
productTemp.description_status =
|
|
1268
|
-
productTemp.description_status === "
|
|
1384
|
+
productTemp.description_status === "NA" ? "NA" : `${result}A`;
|
|
1269
1385
|
productTemp.images_status =
|
|
1270
|
-
productTemp.images_status === "
|
|
1386
|
+
productTemp.images_status === "NA" ? "NA" : `${result}A`;
|
|
1271
1387
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1272
1388
|
setProduct(productTemp);
|
|
1273
|
-
const messagesResponse = await Promise.all(messages);
|
|
1274
1389
|
|
|
1275
1390
|
await loadData();
|
|
1276
1391
|
} catch (error) {
|
|
@@ -1286,10 +1401,8 @@ export const RetailerProductEdition = ({
|
|
|
1286
1401
|
setCompare={setCompare}
|
|
1287
1402
|
isAuditor={[1, 6].includes(user.id_role)}
|
|
1288
1403
|
withChat={location?.state?.withChat}
|
|
1289
|
-
|
|
1290
|
-
productSelected={product}
|
|
1404
|
+
productSelected={productSelected}
|
|
1291
1405
|
token={token}
|
|
1292
|
-
activeRetailer={activeRetailer}
|
|
1293
1406
|
/>
|
|
1294
1407
|
<div className="data-container">
|
|
1295
1408
|
<div className="image-data-panel">
|
|
@@ -1329,7 +1442,36 @@ export const RetailerProductEdition = ({
|
|
|
1329
1442
|
sendToFacilitator("A");
|
|
1330
1443
|
}}
|
|
1331
1444
|
reject={() => {
|
|
1332
|
-
|
|
1445
|
+
sendToFacilitator("R");
|
|
1446
|
+
setMessage("Rechazado");
|
|
1447
|
+
setComponentsArray([
|
|
1448
|
+
<img src={errorModal} />,
|
|
1449
|
+
<ScreenHeader
|
|
1450
|
+
text={"Agrega tu comentarios para enviar el rechazo"}
|
|
1451
|
+
headerType={"input-name-header"}
|
|
1452
|
+
color={"white"}
|
|
1453
|
+
/>,
|
|
1454
|
+
<TagAndInput
|
|
1455
|
+
label={"Caja de Comentario"}
|
|
1456
|
+
inputType={"textarea"}
|
|
1457
|
+
inputId={"modal-commentary-box"}
|
|
1458
|
+
index={0}
|
|
1459
|
+
color={"white"}
|
|
1460
|
+
/>,
|
|
1461
|
+
<Button
|
|
1462
|
+
buttonType={"general-default-button"}
|
|
1463
|
+
label={"Enviar comentario"}
|
|
1464
|
+
onClick={(e) =>
|
|
1465
|
+
createComment(
|
|
1466
|
+
e,
|
|
1467
|
+
document.querySelector(
|
|
1468
|
+
"#modal-commentary-box .ql-container .ql-editor > p"
|
|
1469
|
+
).innerHTML,
|
|
1470
|
+
activeTab
|
|
1471
|
+
)
|
|
1472
|
+
}
|
|
1473
|
+
/>,
|
|
1474
|
+
]);
|
|
1333
1475
|
}}
|
|
1334
1476
|
showApproveRejectAll={
|
|
1335
1477
|
approveRejectAllButtons() && (auditorAssigned() || userAssigned())
|
|
@@ -1339,8 +1481,36 @@ export const RetailerProductEdition = ({
|
|
|
1339
1481
|
}
|
|
1340
1482
|
approveAll={() => validateAll("A")}
|
|
1341
1483
|
rejectAll={() => {
|
|
1342
|
-
|
|
1343
|
-
|
|
1484
|
+
validateAll("R");
|
|
1485
|
+
setMessage("Rechazado");
|
|
1486
|
+
setComponentsArray([
|
|
1487
|
+
<img src={errorModal} />,
|
|
1488
|
+
<ScreenHeader
|
|
1489
|
+
text={"Agrega tu comentarios para enviar el rechazo"}
|
|
1490
|
+
headerType={"input-name-header"}
|
|
1491
|
+
color={"white"}
|
|
1492
|
+
/>,
|
|
1493
|
+
<TagAndInput
|
|
1494
|
+
label={"Caja de Comentario"}
|
|
1495
|
+
inputType={"textarea"}
|
|
1496
|
+
inputId={"modal-commentary-box"}
|
|
1497
|
+
index={0}
|
|
1498
|
+
color={"white"}
|
|
1499
|
+
/>,
|
|
1500
|
+
<Button
|
|
1501
|
+
buttonType={"general-default-button"}
|
|
1502
|
+
label={"Enviar comentario"}
|
|
1503
|
+
onClick={(e) =>
|
|
1504
|
+
createComment(
|
|
1505
|
+
e,
|
|
1506
|
+
document.querySelector(
|
|
1507
|
+
"#modal-commentary-box .ql-container .ql-editor > p"
|
|
1508
|
+
).innerHTML,
|
|
1509
|
+
activeTab
|
|
1510
|
+
)
|
|
1511
|
+
}
|
|
1512
|
+
/>,
|
|
1513
|
+
]);
|
|
1344
1514
|
}}
|
|
1345
1515
|
/>
|
|
1346
1516
|
<FullTabsMenu
|
|
@@ -1356,12 +1526,6 @@ export const RetailerProductEdition = ({
|
|
|
1356
1526
|
isRetailer={isRetailer}
|
|
1357
1527
|
showSaveButton={auditorAssigned() || userAssigned()}
|
|
1358
1528
|
version={version}
|
|
1359
|
-
desc={desc}
|
|
1360
|
-
setDesc={setDesc}
|
|
1361
|
-
fich={fich}
|
|
1362
|
-
setFich={setFich}
|
|
1363
|
-
imag={imag}
|
|
1364
|
-
setImag={setImag}
|
|
1365
1529
|
updatedDescriptions={updatedDescriptions}
|
|
1366
1530
|
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
1367
1531
|
updatedDatasheets={updatedDatasheets}
|
|
@@ -1476,6 +1640,47 @@ export const RetailerProductEdition = ({
|
|
|
1476
1640
|
{(userAssigned(activeTab) || auditorAssigned()) &&
|
|
1477
1641
|
product[`${getConcept(activeTab)}_status`] !== "NS" && (
|
|
1478
1642
|
<div className="commentary-box">
|
|
1643
|
+
{!comment ? (
|
|
1644
|
+
<div className="commentary">
|
|
1645
|
+
<TagAndInput
|
|
1646
|
+
label={"Caja de Comentario"}
|
|
1647
|
+
inputType={"textarea"}
|
|
1648
|
+
inputCols={80}
|
|
1649
|
+
inputRows={4}
|
|
1650
|
+
inputId={"commentary-box"}
|
|
1651
|
+
index={0}
|
|
1652
|
+
/>
|
|
1653
|
+
<div className="buttons-box">
|
|
1654
|
+
<Button
|
|
1655
|
+
buttonType={"general-transparent-button"}
|
|
1656
|
+
label={"Enviar comentario"}
|
|
1657
|
+
onClick={(e) =>
|
|
1658
|
+
createComment(
|
|
1659
|
+
e,
|
|
1660
|
+
document.querySelector(
|
|
1661
|
+
"#commentary-box .ql-container .ql-editor > p"
|
|
1662
|
+
).innerHTML,
|
|
1663
|
+
activeTab
|
|
1664
|
+
)
|
|
1665
|
+
}
|
|
1666
|
+
/>
|
|
1667
|
+
</div>
|
|
1668
|
+
</div>
|
|
1669
|
+
) : (
|
|
1670
|
+
<div className="feedback-box">
|
|
1671
|
+
<Commentary
|
|
1672
|
+
comment={comment?.message?.replace(/<.*?\/?>/gm, "")}
|
|
1673
|
+
reviewed={crossComment}
|
|
1674
|
+
/>
|
|
1675
|
+
<Button
|
|
1676
|
+
buttonType={"circular-button accept-button"}
|
|
1677
|
+
onClick={async () => {
|
|
1678
|
+
setCrossComment(true);
|
|
1679
|
+
commentRevised();
|
|
1680
|
+
}}
|
|
1681
|
+
/>
|
|
1682
|
+
</div>
|
|
1683
|
+
)}
|
|
1479
1684
|
{[7, 8].includes(user.id_role) && (
|
|
1480
1685
|
<Button
|
|
1481
1686
|
buttonType={
|
|
@@ -1533,49 +1738,6 @@ export const RetailerProductEdition = ({
|
|
|
1533
1738
|
jwt={token}
|
|
1534
1739
|
/>
|
|
1535
1740
|
)}
|
|
1536
|
-
{showRejectModal && (
|
|
1537
|
-
<Modal
|
|
1538
|
-
title={`Agregar mensaje de rechazo para ${activeTab?.toLowerCase()}`}
|
|
1539
|
-
show={showRejectModal}
|
|
1540
|
-
customComponent={
|
|
1541
|
-
<TagAndInput
|
|
1542
|
-
inputType={"textarea"}
|
|
1543
|
-
inputId={"modal-message-box"}
|
|
1544
|
-
index={0}
|
|
1545
|
-
color={"white"}
|
|
1546
|
-
/>
|
|
1547
|
-
}
|
|
1548
|
-
buttons={[
|
|
1549
|
-
<ButtonV2
|
|
1550
|
-
key={"btn-Cancelar"}
|
|
1551
|
-
type={"white"}
|
|
1552
|
-
label={"Cancelar"}
|
|
1553
|
-
size={12}
|
|
1554
|
-
onClick={() => {
|
|
1555
|
-
setShowRejectModal(false);
|
|
1556
|
-
}}
|
|
1557
|
-
/>,
|
|
1558
|
-
<ButtonV2
|
|
1559
|
-
key={"btn-Aceptar"}
|
|
1560
|
-
type={"pink"}
|
|
1561
|
-
label={"Aceptar"}
|
|
1562
|
-
size={12}
|
|
1563
|
-
onClick={async () => {
|
|
1564
|
-
const body = document.querySelector(
|
|
1565
|
-
"#modal-message-box .ql-container .ql-editor > p"
|
|
1566
|
-
).innerHTML;
|
|
1567
|
-
const messages = [
|
|
1568
|
-
{ type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
|
|
1569
|
-
];
|
|
1570
|
-
await createComment(messages, activeRetailer.id);
|
|
1571
|
-
valRejAll ? validateAll("R") : sendToFacilitator("R");
|
|
1572
|
-
setMessage("Rechazado");
|
|
1573
|
-
setShowRejectModal(false);
|
|
1574
|
-
}}
|
|
1575
|
-
/>,
|
|
1576
|
-
]}
|
|
1577
|
-
/>
|
|
1578
|
-
)}
|
|
1579
1741
|
</Container>
|
|
1580
1742
|
);
|
|
1581
1743
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import { fetchPOST } from "../../../global-files/handle_http";
|
|
3
2
|
|
|
4
3
|
export const getAuditVersion = async (articleId, setState, token) => {
|
|
5
4
|
const auditResponse = await axios.get(
|
|
@@ -33,39 +32,3 @@ export const getInputsData = (
|
|
|
33
32
|
setDescriptionState(descriptions);
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
|
-
|
|
37
|
-
export const translateService = (tab) => {
|
|
38
|
-
switch (tab) {
|
|
39
|
-
case "description":
|
|
40
|
-
case "Descripción":
|
|
41
|
-
return "Descripciones";
|
|
42
|
-
case "datasheet":
|
|
43
|
-
case "Ficha técnica":
|
|
44
|
-
return "Fichas técnicas";
|
|
45
|
-
case "images":
|
|
46
|
-
case "Imágenes":
|
|
47
|
-
return "Imágenes";
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const createMessage = (
|
|
52
|
-
retailers,
|
|
53
|
-
idRetailer,
|
|
54
|
-
oldStatus,
|
|
55
|
-
newStatus,
|
|
56
|
-
service
|
|
57
|
-
) => {
|
|
58
|
-
const [retailer] = retailers?.filter((ret) => ret.id === idRetailer) || [];
|
|
59
|
-
return `${translateService(service)} de ${
|
|
60
|
-
retailer.name
|
|
61
|
-
} |${oldStatus}| a |${newStatus}`;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const sendMessage = async (data) => {
|
|
65
|
-
const { paramsBody, paramsHeader } = data;
|
|
66
|
-
return fetchPOST(
|
|
67
|
-
process.env.REACT_APP_CREATE_MESSAGES,
|
|
68
|
-
paramsBody,
|
|
69
|
-
paramsHeader
|
|
70
|
-
);
|
|
71
|
-
};
|