contentoh-components-library 21.5.98 → 21.5.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/components/atoms/GeneralButton/styles.js +1 -1
  2. package/dist/components/atoms/GeneralInput/index.js +54 -249
  3. package/dist/components/atoms/GeneralInput/styles.js +3 -7
  4. package/dist/components/atoms/InputFormatter/index.js +68 -223
  5. package/dist/components/atoms/InputFormatter/styles.js +4 -20
  6. package/dist/components/molecules/StatusAsignationInfo/index.js +1 -11
  7. package/dist/components/molecules/TabsMenu/index.js +1 -13
  8. package/dist/components/molecules/TagAndInput/index.js +24 -364
  9. package/dist/components/molecules/TagAndInput/styles.js +2 -2
  10. package/dist/components/organisms/FullProductNameHeader/index.js +22 -6
  11. package/dist/components/organisms/InputGroup/index.js +18 -22
  12. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +337 -150
  13. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +15 -15
  14. package/dist/components/pages/ProviderProductEdition/index.js +377 -413
  15. package/dist/components/pages/ProviderProductEdition/utils.js +0 -1
  16. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +211 -125
  17. package/dist/components/pages/RetailerProductEdition/index.js +2236 -1738
  18. package/dist/components/pages/RetailerProductEdition/styles.js +2 -4
  19. package/dist/components/pages/RetailerProductEdition/utils.js +2 -251
  20. package/package.json +2 -4
  21. package/src/components/atoms/GeneralButton/styles.js +0 -4
  22. package/src/components/atoms/GeneralInput/index.js +60 -241
  23. package/src/components/atoms/GeneralInput/styles.js +0 -81
  24. package/src/components/atoms/InputFormatter/index.js +51 -200
  25. package/src/components/atoms/InputFormatter/styles.js +0 -284
  26. package/src/components/molecules/StatusAsignationInfo/index.js +1 -9
  27. package/src/components/molecules/TabsMenu/index.js +0 -12
  28. package/src/components/molecules/TagAndInput/index.js +21 -294
  29. package/src/components/molecules/TagAndInput/styles.js +17 -59
  30. package/src/components/organisms/FullProductNameHeader/index.js +28 -4
  31. package/src/components/organisms/FullTabsMenu/index.js +1 -1
  32. package/src/components/organisms/InputGroup/index.js +4 -12
  33. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +202 -174
  34. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
  35. package/src/components/pages/ProviderProductEdition/index.js +418 -486
  36. package/src/components/pages/ProviderProductEdition/utils.js +2 -2
  37. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +243 -136
  38. package/src/components/pages/RetailerProductEdition/index.js +1717 -1563
  39. package/src/components/pages/RetailerProductEdition/styles.js +2 -67
  40. package/src/components/pages/RetailerProductEdition/utils.js +0 -240
  41. package/src/ai/utils/compare-strings.js +0 -45
  42. package/src/assets/images/Icons/arrow.png +0 -0
  43. package/src/assets/images/Icons/cancel.png +0 -0
  44. package/src/assets/images/Icons/ia-icon.png +0 -0
  45. package/src/assets/images/Icons/loading.svg +0 -5
  46. package/src/assets/images/Icons/reload.png +0 -0
  47. package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +0 -10
  48. package/src/components/atoms/RetailerSelector/index.js +0 -3
  49. package/src/components/atoms/RetailerSelector/styles.js +0 -0
  50. package/src/components/organisms/ChangeStatusModal/index.jsx +0 -488
  51. package/src/components/organisms/ChangeStatusModal/styles.js +0 -333
  52. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +0 -575
  53. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +0 -62
  54. package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +0 -344
  55. package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +0 -155
  56. package/src/components/pages/RetailerProductEdition/context/reducers/product.js +0 -114
  57. package/src/components/pages/RetailerProductEdition/context/reducers/system.js +0 -60
  58. package/src/components/pages/RetailerProductEdition/index_old.js +0 -1979
  59. package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +0 -101
  60. package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +0 -115
  61. package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +0 -174
  62. package/src/contexts/AiProductEdition.jsx +0 -347
  63. package/src/global-files/statusDictionary.js +0 -103
@@ -42,7 +42,6 @@ import errorIcon from "../../../assets/images/genericModal/errorModal.svg";
42
42
  import warningIcon from "../../../assets/images/genericModal/genericModalWarning.svg";
43
43
 
44
44
  import { Container } from "./styles";
45
- import { AiProductEditionProvider } from "../../../contexts/AiProductEdition";
46
45
 
47
46
  const ProviderProductEditionView = ({
48
47
  tabsSections,
@@ -70,6 +69,7 @@ const ProviderProductEditionView = ({
70
69
 
71
70
  const isRetailer = user?.is_retailer;
72
71
 
72
+ const [boxData, setBoxData] = useState(null);
73
73
  const [showModal, setShowModal] = useState(false);
74
74
  const [showRejectModal, setShowRejectModal] = useState(false);
75
75
  const [headerTop, setHeaderTop] = useState(0);
@@ -143,16 +143,19 @@ const ProviderProductEditionView = ({
143
143
  useEffect(() => {
144
144
  const setProductData = () => {
145
145
  try {
146
- const product = productSelected
147
- ? productSelected
148
- : JSON.parse(sessionStorage.getItem("productSelected"));
146
+ const product = JSON.parse(sessionStorage.getItem("productSelected"))
147
+ ? JSON.parse(sessionStorage.getItem("productSelected"))
148
+ : productSelected;
149
149
 
150
150
  const productNormalized = normalizeProduct(product);
151
151
 
152
+ console.log({ productNormalized });
153
+
152
154
  dispatch({
153
155
  type: "SET_PRODUCT",
154
156
  payload: productNormalized,
155
157
  });
158
+
156
159
  if (
157
160
  productNormalized.categoryRetailerInOrder.length > 0 &&
158
161
  productNormalized.statusByRetailer
@@ -253,29 +256,6 @@ const ProviderProductEditionView = ({
253
256
  return orderA - orderB;
254
257
  });
255
258
 
256
- //Cuando carguemos la información de los servicios, las actualizamos en el estado del producto
257
-
258
- const updatedStatusByRetailer = servicesDataRes.reduce(
259
- (acc, current, idx) => {
260
- const { id_retailer, service, status } = current;
261
-
262
- if (!acc[id_retailer]) acc[id_retailer] = {};
263
-
264
- acc[id_retailer][service] = status;
265
-
266
- return acc;
267
- },
268
- {},
269
- );
270
-
271
- dispatch({
272
- type: "SET_PRODUCT",
273
- payload: {
274
- ...state.product,
275
- statusByRetailer: updatedStatusByRetailer,
276
- },
277
- });
278
-
279
259
  dispatch({
280
260
  type: "SET_SERVICES",
281
261
  payload: {
@@ -307,16 +287,7 @@ const ProviderProductEditionView = ({
307
287
  };
308
288
 
309
289
  fetchData();
310
- }, [
311
- state.product?.datasheet_status,
312
- state.product?.description_status,
313
- state.product?.images_status,
314
- state.product?.status,
315
- state.product?.percentages,
316
- state.product?.version,
317
- state.active_retailer,
318
- token,
319
- ]);
290
+ }, [state.product, state.active_retailer, token]);
320
291
 
321
292
  // Actualizador de campos del ui para que coincidan con el retailer activo
322
293
  useEffect(() => {
@@ -324,14 +295,15 @@ const ProviderProductEditionView = ({
324
295
  console.log("Actualizar inputs del retailer activo");
325
296
  const updateInputsActiveRetailer = () => {
326
297
  if (!state.services) return;
327
-
328
298
  if (state.services.datasheets) {
329
299
  const retailerDatasheets =
330
300
  state.services.datasheets[state.active_retailer.id_retailer];
301
+
331
302
  const datasheetsActiveRetailer = {
332
303
  ...retailerDatasheets,
333
304
  data: Object.values(retailerDatasheets.data),
334
305
  };
306
+
335
307
  dispatch({
336
308
  type: "SET_DATASHEETS_INPUTS",
337
309
  payload: [datasheetsActiveRetailer, state.services.datasheets.inputs],
@@ -377,51 +349,37 @@ const ProviderProductEditionView = ({
377
349
  const canShowValidationButtons = () => {
378
350
  if (!state.product?.statusByRetailer) return false;
379
351
 
380
- try {
381
- const currentService = getConceptByTab(state.active_tab);
382
- // const currentStatus = state.product[`${currentService}_status`];
383
- const currentRetailer = state.active_retailer.id_retailer;
384
-
385
- //Información del servicio de la cadena seleccionada
386
- const { status: currentStatus } = state.services_data.find(
387
- (service) =>
388
- service.service === currentService &&
389
- service.id_retailer === currentRetailer,
390
- );
391
-
392
- const originTab = origin[state.active_tab];
393
- const isRetailerUser = user?.is_retailer === 1;
394
-
395
- const validStatuses = ["AA", "AP", "R", "CA", "RCA"];
396
- if (!validStatuses.includes(currentStatus)) return false;
352
+ const currentService = getConceptByTab(state.active_tab);
353
+ const currentStatus = state.product[`${currentService}_status`];
354
+ const originTab = origin[state.active_tab];
355
+ const isRetailerUser = user?.is_retailer === 1;
397
356
 
398
- const validOrigins = [
399
- "RequestWithContentoh",
400
- "RequestWithoutContentoh",
401
- "Contentoh",
402
- ];
357
+ const validStatuses = ["AA", "AP", "R", "CA", "RCA"];
358
+ if (!validStatuses.includes(currentStatus)) return false;
403
359
 
404
- if (!validOrigins.includes(originTab)) return false;
360
+ const validOrigins = [
361
+ "RequestWithContentoh",
362
+ "RequestWithoutContentoh",
363
+ "Contentoh",
364
+ ];
405
365
 
406
- // Retailer: solo AP
407
- if (isRetailerUser) {
408
- return currentStatus === "AP";
409
- }
366
+ if (!validOrigins.includes(originTab)) return false;
410
367
 
411
- // No retailer
412
- const hasNoOrder = !state.product.id_order && !state.product.orderId;
368
+ // Retailer: solo AP
369
+ if (isRetailerUser) {
370
+ return currentStatus === "AP";
371
+ }
413
372
 
414
- const condition =
415
- (originTab === "RequestWithoutContentoh" &&
416
- (["R", "CA"].includes(currentStatus) ||
417
- (currentStatus === "RCA" && hasNoOrder))) ||
418
- (["RequestWithContentoh", "Contentoh"].includes(originTab) &&
419
- currentStatus === "AA");
373
+ // No retailer
374
+ const hasNoOrder = !state.product.id_order && !state.product.orderId;
420
375
 
421
- return condition;
422
- } catch (error) {
423
- return false;
424
- }
376
+ return (
377
+ (originTab === "RequestWithoutContentoh" &&
378
+ (["R", "CA"].includes(currentStatus) ||
379
+ (currentStatus === "RCA" && hasNoOrder))) ||
380
+ (["RequestWithContentoh", "Contentoh"].includes(originTab) &&
381
+ currentStatus === "AA")
382
+ );
425
383
  };
426
384
 
427
385
  const canShowSaveButton = (version_status) => {
@@ -438,14 +396,12 @@ const ProviderProductEditionView = ({
438
396
 
439
397
  const getStatusByCurrentServiceAndRetailer = () => {
440
398
  const { statusByRetailer } = state.product;
441
- if (!statusByRetailer || Object.keys(statusByRetailer).length === 0)
442
- return "-";
399
+ if (!statusByRetailer) return "-";
443
400
 
444
401
  const currentService = getConceptByTab(state.active_tab);
445
402
  const currentRetailer = state.active_retailer.id_retailer;
446
-
447
403
  const currentStatus =
448
- statusByRetailer[currentRetailer][currentService] || "N/S";
404
+ statusByRetailer[currentRetailer][currentService] || "ERR";
449
405
  return currentStatus;
450
406
  };
451
407
 
@@ -707,7 +663,6 @@ const ProviderProductEditionView = ({
707
663
  state.product[sectionStatusKey] || state.product?.version_status;
708
664
 
709
665
  let data = { articleId, orderId, concept, evalStatus };
710
-
711
666
  const retailerId = state.active_retailer?.id_retailer;
712
667
 
713
668
  try {
@@ -736,22 +691,12 @@ const ProviderProductEditionView = ({
736
691
  ...state.product.statusByRetailer,
737
692
  [retailerId]: {
738
693
  ...state.product.statusByRetailer[retailerId],
739
- [concept]: newStatuses?.newStatus ?? serviceStatus,
694
+ [concept]: serviceStatus,
740
695
  },
741
696
  },
742
697
  };
743
698
 
744
- const updatedServicesData = state.services_data?.map((service) => ({
745
- ...service,
746
- status:
747
- service?.id_retailer === retailerId && service?.service === concept
748
- ? newStatuses?.newStatus ?? serviceStatus
749
- : service?.status,
750
- }));
751
-
752
- dispatch({ type: "SET_SERVICES_DATA", payload: updatedServicesData });
753
-
754
- // console.log({ updatedProduct });
699
+ console.log({ updatedProduct });
755
700
 
756
701
  dispatch({ type: "SET_PRODUCT", payload: updatedProduct });
757
702
 
@@ -1091,424 +1036,411 @@ const ProviderProductEditionView = ({
1091
1036
  if (state.loading || !state.services || !state.product) return <Loading />;
1092
1037
 
1093
1038
  return (
1094
- <AiProductEditionProvider isCreatorsEdition={false} state={state}>
1095
- <Container headerTop={headerTop}>
1096
- {showVersionSelector && (
1097
- <VersionSelector
1098
- modalId={"version-selector"}
1099
- articleId={state.product.id_article}
1100
- setVersion={handleOnChangeProductVersion}
1101
- companyName={company.company_name}
1102
- currentVersion={state.product.version}
1103
- setShowVersionSelector={setShowVersionSelector}
1104
- jwt={token}
1105
- />
1106
- )}
1107
- {showModal && (
1108
- <ProductImageModal
1109
- images={state.images_values}
1110
- setShowModal={setShowModal}
1111
- approveRejectButtons={canShowValidationButtons()}
1112
- sendToFacilitator={handleOnSendEvaluation}
1113
- />
1114
- )}
1115
- {state.modal.show && (
1116
- <GenericModal
1117
- componentsArray={[
1118
- state.modal.image && (
1119
- <img key="1" src={state.modal.image} alt="modal icon" />
1120
- ),
1121
- state.modal.title && (
1122
- <ScreenHeader
1123
- key="2"
1124
- headerType={"retailer-name-header"}
1125
- text={state.modal.title}
1126
- color={"white"}
1127
- />
1128
- ),
1129
- state.modal.message && (
1130
- <ScreenHeader
1131
- key="3"
1132
- headerType={"retailer-name-header"}
1133
- text={state.modal.message}
1134
- color={"white"}
1135
- />
1136
- ),
1137
- state.modal.buttons && (
1138
- <div key="4" style={{ marginTop: "16px" }}>
1139
- {state.modal.buttons.map((button, index) => (
1140
- <Button
1141
- key={index}
1142
- buttonType={button.buttonType}
1143
- label={button.text}
1144
- onClick={button.action}
1145
- />
1146
- ))}
1147
- </div>
1148
- ),
1149
- ].filter(Boolean)}
1150
- onClick={() =>
1151
- dispatch({
1152
- type: "SET_MODAL",
1153
- payload: { show: false, title: "", message: "", image: null },
1154
- })
1155
- }
1156
- />
1157
- )}
1158
- {showRejectModal && (
1159
- <Modal
1160
- title={
1161
- rejectAll
1162
- ? "Agregar mensaje para rechazar todo"
1163
- : "Agregar mensaje de rechazo"
1164
- }
1165
- show={showRejectModal}
1166
- customComponent={
1167
- <TagAndInput
1168
- inputType={"textarea"}
1169
- inputId={"modal-message-box"}
1170
- index={0}
1039
+ <Container headerTop={headerTop}>
1040
+ {/* <button onClick={() => console.log(state)}>log</button> */}
1041
+ {showVersionSelector && (
1042
+ <VersionSelector
1043
+ modalId={"version-selector"}
1044
+ articleId={state.product.id_article}
1045
+ setVersion={handleOnChangeProductVersion}
1046
+ companyName={company.company_name}
1047
+ currentVersion={state.product.version}
1048
+ setShowVersionSelector={setShowVersionSelector}
1049
+ jwt={token}
1050
+ />
1051
+ )}
1052
+ {showModal && (
1053
+ <ProductImageModal
1054
+ images={state.images_values}
1055
+ setShowModal={setShowModal}
1056
+ approveRejectButtons={canShowValidationButtons()}
1057
+ sendToFacilitator={handleOnSendEvaluation}
1058
+ />
1059
+ )}
1060
+ {state.modal.show && (
1061
+ <GenericModal
1062
+ componentsArray={[
1063
+ state.modal.image && (
1064
+ <img key="1" src={state.modal.image} alt="modal icon" />
1065
+ ),
1066
+ state.modal.title && (
1067
+ <ScreenHeader
1068
+ key="2"
1069
+ headerType={"retailer-name-header"}
1070
+ text={state.modal.title}
1171
1071
  color={"white"}
1172
1072
  />
1173
- }
1174
- buttons={[
1175
- <ButtonV2
1176
- key={"btn-Cancelar"}
1177
- type={"white"}
1178
- label={"Cancelar"}
1179
- size={12}
1180
- onClick={() => {
1181
- setShowRejectModal(false);
1182
- }}
1183
- />,
1184
- <ButtonV2
1185
- key={"btn-Aceptar"}
1186
- type={"pink"}
1187
- label={"Aceptar"}
1188
- size={12}
1189
- onClick={async () => {
1190
- const elements = document.querySelectorAll(
1191
- "#modal-message-box .ql-container .ql-editor > p",
1192
- );
1073
+ ),
1074
+ state.modal.message && (
1075
+ <ScreenHeader
1076
+ key="3"
1077
+ headerType={"retailer-name-header"}
1078
+ text={state.modal.message}
1079
+ color={"white"}
1080
+ />
1081
+ ),
1082
+ state.modal.buttons && (
1083
+ <div key="4" style={{ marginTop: "16px" }}>
1084
+ {state.modal.buttons.map((button, index) => (
1085
+ <Button
1086
+ key={index}
1087
+ buttonType={button.buttonType}
1088
+ label={button.text}
1089
+ onClick={button.action}
1090
+ />
1091
+ ))}
1092
+ </div>
1093
+ ),
1094
+ ].filter(Boolean)}
1095
+ onClick={() =>
1096
+ dispatch({
1097
+ type: "SET_MODAL",
1098
+ payload: { show: false, title: "", message: "", image: null },
1099
+ })
1100
+ }
1101
+ />
1102
+ )}
1103
+ {showRejectModal && (
1104
+ <Modal
1105
+ title={
1106
+ rejectAll
1107
+ ? "Agregar mensaje para rechazar todo"
1108
+ : "Agregar mensaje de rechazo"
1109
+ }
1110
+ show={showRejectModal}
1111
+ customComponent={
1112
+ <TagAndInput
1113
+ inputType={"textarea"}
1114
+ inputId={"modal-message-box"}
1115
+ index={0}
1116
+ color={"white"}
1117
+ />
1118
+ }
1119
+ buttons={[
1120
+ <ButtonV2
1121
+ key={"btn-Cancelar"}
1122
+ type={"white"}
1123
+ label={"Cancelar"}
1124
+ size={12}
1125
+ onClick={() => {
1126
+ setShowRejectModal(false);
1127
+ }}
1128
+ />,
1129
+ <ButtonV2
1130
+ key={"btn-Aceptar"}
1131
+ type={"pink"}
1132
+ label={"Aceptar"}
1133
+ size={12}
1134
+ onClick={async () => {
1135
+ const elements = document.querySelectorAll(
1136
+ "#modal-message-box .ql-container .ql-editor > p",
1137
+ );
1138
+
1139
+ if (!elements || elements.length === 0) {
1140
+ console.error("Elemento no encontrado");
1141
+ return;
1142
+ }
1193
1143
 
1194
- if (!elements || elements.length === 0) {
1195
- console.error("Elemento no encontrado");
1196
- return;
1197
- }
1144
+ const isMessageEmpty = Array.from(elements).every((el) => {
1145
+ const body = el.innerHTML;
1146
+ return !body || body.replace(/<.*?\/?>/gm, "").trim() === "";
1147
+ });
1198
1148
 
1199
- const isMessageEmpty = Array.from(elements).every((el) => {
1200
- const body = el.innerHTML;
1201
- return (
1202
- !body || body.replace(/<.*?\/?>/gm, "").trim() === ""
1203
- );
1204
- });
1205
-
1206
- if (isMessageEmpty) {
1207
- const container = document.querySelector(
1208
- ".container-customComponent",
1209
- );
1210
- const existingAlert =
1211
- container.querySelector(".alert-error");
1212
-
1213
- if (!existingAlert) {
1214
- const alert = document.createElement("div");
1215
- alert.className = "alert-error";
1216
- alert.style.cssText = `
1217
- color: #d32f2f;
1218
- background-color: #ffebee;
1219
- border: 1px solid #ef5350;
1220
- border-radius: 4px;
1221
- padding: 12px 16px;
1222
- margin-top: 10px;
1223
- font-size: 14px;
1224
- display: flex;
1225
- align-items: center;
1226
- gap: 8px;
1227
- font-family: 'Roboto', sans-serif;
1228
- text-align: center;
1229
- `;
1230
- alert.innerHTML = `<span>El mensaje no puede estar vacío.</span>`;
1231
- container.appendChild(alert);
1232
- }
1233
- return;
1149
+ if (isMessageEmpty) {
1150
+ const container = document.querySelector(
1151
+ ".container-customComponent",
1152
+ );
1153
+ const existingAlert = container.querySelector(".alert-error");
1154
+
1155
+ if (!existingAlert) {
1156
+ const alert = document.createElement("div");
1157
+ alert.className = "alert-error";
1158
+ alert.style.cssText = `
1159
+ color: #d32f2f;
1160
+ background-color: #ffebee;
1161
+ border: 1px solid #ef5350;
1162
+ border-radius: 4px;
1163
+ padding: 12px 16px;
1164
+ margin-top: 10px;
1165
+ font-size: 14px;
1166
+ display: flex;
1167
+ align-items: center;
1168
+ gap: 8px;
1169
+ font-family: 'Roboto', sans-serif;
1170
+ text-align: center;
1171
+ `;
1172
+ alert.innerHTML = `<span>El mensaje no puede estar vacío.</span>`;
1173
+ container.appendChild(alert);
1234
1174
  }
1175
+ return;
1176
+ }
1235
1177
 
1236
- const fullMessage = Array.from(elements)
1237
- .map((element) => element.innerHTML)
1238
- .join("")
1239
- .replace(/<br\s*\/?>/gi, "\n");
1178
+ const fullMessage = Array.from(elements)
1179
+ .map((element) => element.innerHTML)
1180
+ .join("")
1181
+ .replace(/<br\s*\/?>/gi, "\n");
1240
1182
 
1241
- await createComment(fullMessage, token);
1183
+ await createComment(fullMessage);
1242
1184
 
1243
- rejectAll
1244
- ? handleOnEvaluateAll("R")
1245
- : handleOnSendEvaluation("R");
1246
- setShowRejectModal(false);
1247
- }}
1248
- />,
1249
- ]}
1250
- />
1251
- )}
1252
- <HeaderTop
1253
- setHeaderTop={setHeaderTop}
1254
- withChat={location?.state?.withChat}
1255
- chatType={location?.state?.chatType}
1256
- productSelected={state.product}
1257
- token={token}
1258
- activeRetailer={{
1259
- id: state.active_retailer?.id_retailer,
1260
- name: state.active_retailer?.retailer,
1261
- }}
1185
+ rejectAll
1186
+ ? handleOnEvaluateAll("R")
1187
+ : handleOnSendEvaluation("R");
1188
+ setShowRejectModal(false);
1189
+ }}
1190
+ />,
1191
+ ]}
1262
1192
  />
1263
- <div className="data-container">
1264
- <div className="image-data-panel">
1265
- <ImagePreviewer
1266
- activeImage={
1267
- state.images_values.values[state.current_image] ?? {}
1268
- }
1269
- imagesArray={state.images_values || []}
1270
- setActiveImage={handleOnChangeCurrentImage}
1271
- setShowModal={handleOnShowModalGalery}
1193
+ )}
1194
+ <HeaderTop
1195
+ setHeaderTop={setHeaderTop}
1196
+ withChat={location?.state?.withChat}
1197
+ chatType={location?.state?.chatType}
1198
+ productSelected={state.product}
1199
+ token={token}
1200
+ activeRetailer={{
1201
+ id: state.active_retailer?.id_retailer,
1202
+ name: state.active_retailer?.retailer,
1203
+ }}
1204
+ />
1205
+ <div className="data-container">
1206
+ <div className="image-data-panel">
1207
+ <ImagePreviewer
1208
+ activeImage={state.images_values.values[state.current_image] ?? {}}
1209
+ imagesArray={state.images_values || []}
1210
+ setActiveImage={handleOnChangeCurrentImage}
1211
+ setShowModal={handleOnShowModalGalery}
1212
+ />
1213
+ <ImageDataTable
1214
+ lists={state.images_values || []}
1215
+ activeImage={
1216
+ state.images_values?.values
1217
+ ? state.images_values?.values[state.current_image]
1218
+ : {}
1219
+ }
1220
+ assignationsImages={assig}
1221
+ retailerSelected={state.active_retailer?.id_retailer}
1222
+ imagesStatus={state.product?.images_status || "-"}
1223
+ isRetailer={isRetailer}
1224
+ setShowVersionSelector={setShowVersionSelector}
1225
+ version={state.product.version}
1226
+ setImages={handleOnChangeCurrentImage}
1227
+ onClickSave={handleOnClickSaveImages}
1228
+ setAssignation={handleOnChangeAssignations} // No se usa?
1229
+ />
1230
+ </div>
1231
+ <div className="product-information">
1232
+ <div className="product-information">
1233
+ <FullProductNameHeader
1234
+ headerData={state.product}
1235
+ percent={state.active_percentage.percentagesGeneral.required}
1236
+ activeRetailer={{
1237
+ id: state.active_retailer?.id_retailer,
1238
+ name: state.active_retailer?.retailer,
1239
+ image: state.active_retailer?.image,
1240
+ }}
1241
+ showValidationButtons={canShowValidationButtons()}
1242
+ showApproveRejectAll={canShowValidationButtons()}
1243
+ servicesData={state.services_data ? state.services_data : null}
1244
+ approveAll={handleOnApproveAll}
1245
+ rejectAll={handleOnRejectAll}
1246
+ approve={() => handleOnSendEvaluation("A")}
1247
+ reject={handleOnReject}
1248
+ setActiveRetailer={handleOnChangeActiveRetailer}
1272
1249
  />
1273
- <ImageDataTable
1274
- lists={state.images_values || []}
1275
- activeImage={
1276
- state.images_values?.values
1277
- ? state.images_values?.values[state.current_image]
1278
- : {}
1279
- }
1280
- assignationsImages={assig}
1281
- retailerSelected={state.active_retailer?.id_retailer}
1282
- imagesStatus={state.product?.images_status || "-"}
1250
+ <FullTabsMenu
1251
+ tabsSections={tabsSections}
1252
+ status={getStatusByCurrentServiceAndRetailer()}
1253
+ activeTab={state.active_tab}
1254
+ user={user}
1283
1255
  isRetailer={isRetailer}
1284
- setShowVersionSelector={setShowVersionSelector}
1256
+ assig={assig}
1285
1257
  version={state.product.version}
1286
- setImages={handleOnChangeCurrentImage}
1287
- onClickSave={handleOnClickSaveImages}
1288
- setAssignation={handleOnChangeAssignations} // No se usa?
1258
+ updatedDescriptions={state.updated_descriptions_inputs}
1259
+ updatedDatasheets={state.updated_datasheets_inputs}
1260
+ updatedImages={state.updated_images_values}
1261
+ images={state.services.images}
1262
+ // actions
1263
+ downloadImages={handleOnDownloadImages}
1264
+ askToDeleteImages={handleOnAskToDeleteImages}
1265
+ showSaveButton={canShowSaveButton(state.product.version_status)}
1266
+ onClickSave={handleOnClickSave}
1267
+ // setters
1268
+ setActiveTab={handleOnChangeActiveTab}
1269
+ setImageLayout={handleOnSetImageLayout}
1270
+ setUpdatedDescriptions={handleOnSetUpdatedDescriptions}
1271
+ setUpdatedDatasheets={handleOnSetUpdatedDatasheets}
1272
+ setAssignation={handleOnSetAssignation} // No se usa?
1273
+ setImages={handleOnSetImages} // No se usa?
1274
+ // setSelectedImages={handleOnSetSelectedImages} // Se pasa hasta TabsMenu, pero no se usa
1275
+ setShowVersionSelector={setShowVersionSelector}
1289
1276
  />
1290
- </div>
1291
- <div className="product-information">
1292
- <div className="product-information">
1293
- <FullProductNameHeader
1294
- headerData={state.product}
1295
- percent={state.active_percentage.percentagesGeneral.required}
1296
- activeRetailer={{
1297
- id: state.active_retailer?.id_retailer,
1298
- name: state.active_retailer?.retailer,
1299
- image: state.active_retailer?.image,
1300
- }}
1301
- showValidationButtons={canShowValidationButtons()}
1302
- showApproveRejectAll={canShowValidationButtons()}
1303
- servicesData={state.services_data ? state.services_data : null}
1304
- approveAll={handleOnApproveAll}
1305
- rejectAll={handleOnRejectAll}
1306
- approve={() => handleOnSendEvaluation("A")}
1307
- reject={handleOnReject}
1308
- setActiveRetailer={handleOnChangeActiveRetailer}
1309
- />
1310
- <FullTabsMenu
1311
- tabsSections={tabsSections}
1312
- status={getStatusByCurrentServiceAndRetailer()}
1313
- activeTab={state.active_tab}
1314
- user={user}
1315
- isRetailer={isRetailer}
1316
- assig={assig}
1317
- version={state.product.version}
1318
- updatedDescriptions={state.updated_descriptions_inputs}
1319
- updatedDatasheets={state.updated_datasheets_inputs}
1320
- updatedImages={state.updated_images_values}
1321
- images={state.services.images}
1322
- // actions
1323
- downloadImages={handleOnDownloadImages}
1324
- askToDeleteImages={handleOnAskToDeleteImages}
1325
- showSaveButton={canShowSaveButton(state.product.version_status)}
1326
- onClickSave={handleOnClickSave}
1327
- // setters
1328
- setActiveTab={handleOnChangeActiveTab}
1329
- setImageLayout={handleOnSetImageLayout}
1330
- setUpdatedDescriptions={handleOnSetUpdatedDescriptions}
1331
- setUpdatedDatasheets={handleOnSetUpdatedDatasheets}
1332
- setAssignation={handleOnSetAssignation} // No se usa?
1333
- setImages={handleOnSetImages} // No se usa?
1334
- // setSelectedImages={handleOnSetSelectedImages} // Se pasa hasta TabsMenu, pero no se usa
1335
- setShowVersionSelector={setShowVersionSelector}
1336
- />
1337
- <div
1338
- className={
1339
- "services-information-container " +
1340
- (imageLayout && state.active_tab === "Imágenes"
1341
- ? "image-services"
1342
- : "")
1343
- }
1344
- >
1345
- {state.saving ? (
1346
- <Loading />
1347
- ) : (
1348
- <>
1349
- {state.active_tab === "Descripción" &&
1350
- (state.product?.description_status !== "NS" ? (
1351
- <InputGroup
1352
- activeSection={state.active_tab}
1353
- inputGroup={state.descriptions_inputs[0]}
1354
- updatedDescriptions={
1355
- state.updated_descriptions_inputs
1356
- }
1357
- articleId={state.product?.id_article}
1358
- version={state.product.version}
1359
- isShowbox={false}
1360
- dinamicHeight={true}
1361
- setUpdatedDescriptions={
1362
- handleOnSetUpdatedDescriptions
1363
- }
1364
- updateApprovedInputs={handleOnUpdateApprovedInputs} // No se usa?
1365
- />
1366
- ) : (
1367
- <ScreenHeader
1368
- text={"No cuentas con este servicio"}
1369
- headerType={"input-name-header"}
1370
- />
1371
- ))}
1372
-
1373
- {state.active_tab === "Ficha técnica" &&
1374
- (state.product?.datasheet_status !== "NS" ? (
1375
- <>
1376
- {state.datasheets_inputs[0]?.data?.map(
1377
- (dataGroup, index) => (
1378
- <InputGroup
1379
- index={index}
1380
- key={
1381
- index + "-" + state.active_retailer.retailer
1382
- }
1383
- articleId={state.product.id_article}
1384
- version={state.version}
1385
- activeSection={state.active_tab}
1386
- inputGroup={dataGroup}
1387
- dataInputs={state.datasheets_inputs[1] ?? []}
1388
- activeRetailer={
1389
- state.services.datasheets[
1390
- state.active_retailer.id_retailer
1391
- ]
1392
- }
1393
- groupData={
1394
- state.services.datasheets[
1395
- state.active_retailer.id_retailer
1396
- ].data
1397
- }
1398
- updatedDatasheets={
1399
- state.updated_datasheets_inputs
1400
- }
1401
- setUpdatedDatasheets={
1402
- handleOnSetUpdatedDatasheets
1403
- }
1404
- isShowbox={true}
1405
- setUpdatedBoxData={(e) => {
1406
- setBoxData(e);
1407
- }}
1408
- updateApprovedInputs={
1409
- handleOnUpdateApprovedInputs // No se usa?
1410
- }
1411
- />
1412
- ),
1413
- )}
1414
- </>
1415
- ) : (
1416
- <ScreenHeader
1417
- text={"No cuentas con este servicio"}
1418
- headerType={"input-name-header"}
1419
- />
1420
- ))}
1421
-
1422
- {state.active_tab === "Imágenes" &&
1423
- (state.product?.images_status !== "NS" ? (
1424
- <>
1425
- {!imageLayout && (
1426
- <GalleryHeader
1427
- checkAll={state.all_image_checked} // Determina si el checkbox "Seleccionar todo" está marcado
1428
- setCheckAll={handleOnSetCheckAll} // Toggler de true o false para el checkbox "Seleccionar todo"
1429
- setSelectedImages={handleOnSetSelectedImages}
1277
+ <div
1278
+ className={
1279
+ "services-information-container " +
1280
+ (imageLayout && state.active_tab === "Imágenes"
1281
+ ? "image-services"
1282
+ : "")
1283
+ }
1284
+ >
1285
+ {state.saving ? (
1286
+ <Loading />
1287
+ ) : (
1288
+ <>
1289
+ {state.active_tab === "Descripción" &&
1290
+ (state.product?.description_status !== "NS" ? (
1291
+ <InputGroup
1292
+ activeSection={state.active_tab}
1293
+ inputGroup={state.descriptions_inputs[0]}
1294
+ updatedDescriptions={state.updated_descriptions_inputs}
1295
+ articleId={state.product?.id_article}
1296
+ version={state.product.version}
1297
+ isShowbox={false}
1298
+ dinamicHeight={true}
1299
+ setUpdatedDescriptions={handleOnSetUpdatedDescriptions}
1300
+ updateApprovedInputs={handleOnUpdateApprovedInputs} // No se usa?
1301
+ />
1302
+ ) : (
1303
+ <ScreenHeader
1304
+ text={"No cuentas con este servicio"}
1305
+ headerType={"input-name-header"}
1306
+ />
1307
+ ))}
1308
+
1309
+ {state.active_tab === "Ficha técnica" &&
1310
+ (state.product?.datasheet_status !== "NS" ? (
1311
+ <>
1312
+ {state.datasheets_inputs[0].data?.map(
1313
+ (dataGroup, index) => (
1314
+ <InputGroup
1315
+ index={index}
1316
+ key={index + "-" + state.active_retailer.retailer}
1317
+ articleId={state.product.id_article}
1318
+ version={state.version}
1319
+ activeSection={state.active_tab}
1320
+ inputGroup={dataGroup}
1321
+ dataInputs={state.datasheets_inputs[1] ?? []}
1322
+ activeRetailer={
1323
+ state.services.datasheets[
1324
+ state.active_retailer.id_retailer
1325
+ ]
1326
+ }
1327
+ groupData={
1328
+ state.services.datasheets[
1329
+ state.active_retailer.id_retailer
1330
+ ].data
1331
+ }
1332
+ updatedDatasheets={
1333
+ state.updated_datasheets_inputs
1334
+ }
1335
+ setUpdatedDatasheets={
1336
+ handleOnSetUpdatedDatasheets
1337
+ }
1338
+ isShowbox={true}
1339
+ setUpdatedBoxData={(e) => {
1340
+ setBoxData(e);
1341
+ }}
1342
+ updateApprovedInputs={
1343
+ handleOnUpdateApprovedInputs // No se usa?
1344
+ }
1430
1345
  />
1431
- )}
1432
- <section
1433
- className="container"
1434
- style={{ position: "relative" }}
1346
+ ),
1347
+ )}
1348
+ </>
1349
+ ) : (
1350
+ <ScreenHeader
1351
+ text={"No cuentas con este servicio"}
1352
+ headerType={"input-name-header"}
1353
+ />
1354
+ ))}
1355
+
1356
+ {state.active_tab === "Imágenes" &&
1357
+ (state.product?.images_status !== "NS" ? (
1358
+ <>
1359
+ {!imageLayout && (
1360
+ <GalleryHeader
1361
+ checkAll={state.all_image_checked} // Determina si el checkbox "Seleccionar todo" está marcado
1362
+ setCheckAll={handleOnSetCheckAll} // Toggler de true o false para el checkbox "Seleccionar todo"
1363
+ setSelectedImages={handleOnSetSelectedImages}
1364
+ />
1365
+ )}
1366
+ <section
1367
+ className="container"
1368
+ style={{ position: "relative" }}
1369
+ >
1370
+ <div
1371
+ {...getRootProps({
1372
+ className: `dropzone ${
1373
+ isDragActive ? "drag-active" : ""
1374
+ }`,
1375
+ })}
1435
1376
  >
1377
+ <input {...getInputProps()} />
1378
+ {isDragActive && (
1379
+ <div className="drag-overlay">
1380
+ <p>Suelta las imágenes aquí</p>
1381
+ </div>
1382
+ )}
1383
+ <aside>{thumbs()}</aside>
1384
+ </div>
1385
+ {state.images_values?.values.length === 0 && (
1436
1386
  <div
1437
- {...getRootProps({
1438
- className: `dropzone ${
1439
- isDragActive ? "drag-active" : ""
1440
- }`,
1441
- })}
1387
+ style={{
1388
+ position: "absolute",
1389
+ top: "50%",
1390
+ left: "50%",
1391
+ transform: "translate(-50%, -50%)",
1392
+ textAlign: "center",
1393
+ padding: "40px",
1394
+ width: "80%",
1395
+ maxWidth: "500px",
1396
+ fontFamily: "Arial, sans-serif",
1397
+ }}
1442
1398
  >
1443
- <input {...getInputProps()} />
1444
- {isDragActive && (
1445
- <div className="drag-overlay">
1446
- <p>Suelta las imágenes aquí</p>
1447
- </div>
1448
- )}
1449
- <aside>{thumbs()}</aside>
1450
- </div>
1451
- {state.images_values?.values.length === 0 && (
1452
- <div
1399
+ <p
1453
1400
  style={{
1454
- position: "absolute",
1455
- top: "50%",
1456
- left: "50%",
1457
- transform: "translate(-50%, -50%)",
1458
- textAlign: "center",
1459
- padding: "40px",
1460
- width: "80%",
1461
- maxWidth: "500px",
1462
- fontFamily: "Arial, sans-serif",
1401
+ fontSize: "18px",
1402
+ color: "#666",
1403
+ marginBottom: "16px",
1463
1404
  }}
1464
1405
  >
1465
- <p
1466
- style={{
1467
- fontSize: "18px",
1468
- color: "#666",
1469
- marginBottom: "16px",
1470
- }}
1471
- >
1472
- Este producto no tiene imágenes
1473
- </p>
1474
- <p
1406
+ Este producto no tiene imágenes
1407
+ </p>
1408
+ <p
1409
+ style={{
1410
+ fontSize: "14px",
1411
+ color: "#999",
1412
+ marginBottom: "20px",
1413
+ }}
1414
+ >
1415
+ Arrastra las imágenes aquí o{" "}
1416
+ <span
1417
+ onClick={open}
1475
1418
  style={{
1476
- fontSize: "14px",
1477
- color: "#999",
1478
- marginBottom: "20px",
1419
+ color: "#007bff",
1420
+ cursor: "pointer",
1421
+ textDecoration: "underline",
1479
1422
  }}
1480
1423
  >
1481
- Arrastra las imágenes aquí o{" "}
1482
- <span
1483
- onClick={open}
1484
- style={{
1485
- color: "#007bff",
1486
- cursor: "pointer",
1487
- textDecoration: "underline",
1488
- }}
1489
- >
1490
- haz clic para abrir el explorador de
1491
- archivos
1492
- </span>
1493
- </p>
1494
- </div>
1495
- )}
1496
- </section>
1497
- </>
1498
- ) : (
1499
- <ScreenHeader
1500
- text={"No cuentas con este servicio"}
1501
- headerType={"input-name-header"}
1502
- />
1503
- ))}
1504
- </>
1505
- )}
1506
- </div>
1424
+ haz clic para abrir el explorador de archivos
1425
+ </span>
1426
+ </p>
1427
+ </div>
1428
+ )}
1429
+ </section>
1430
+ </>
1431
+ ) : (
1432
+ <ScreenHeader
1433
+ text={"No cuentas con este servicio"}
1434
+ headerType={"input-name-header"}
1435
+ />
1436
+ ))}
1437
+ </>
1438
+ )}
1507
1439
  </div>
1508
1440
  </div>
1509
1441
  </div>
1510
- </Container>
1511
- </AiProductEditionProvider>
1442
+ </div>
1443
+ </Container>
1512
1444
  );
1513
1445
  };
1514
1446