@grafosoft/excel-validator 1.1.0 → 1.1.1
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/README.md +25 -25
- package/dist/components/ExcelValidator.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ export default function Page() {
|
|
|
49
49
|
const initData: SettingsProps = {
|
|
50
50
|
apikey: "794340c3-4956-4763-b8ab-145da3510100",
|
|
51
51
|
companyId: "1",
|
|
52
|
-
environment: "https://lab.globho.com/",
|
|
52
|
+
environment: "https://lab.globho.com/api/v1/",
|
|
53
53
|
title: "Catálogo Cuental",
|
|
54
54
|
type: "items",
|
|
55
55
|
};
|
|
@@ -58,7 +58,7 @@ export default function Page() {
|
|
|
58
58
|
"int",
|
|
59
59
|
{
|
|
60
60
|
type: "fetch",
|
|
61
|
-
url: "
|
|
61
|
+
url: "codesystem/item-groups",
|
|
62
62
|
prop: "name",
|
|
63
63
|
},
|
|
64
64
|
"string(255)",
|
|
@@ -119,7 +119,7 @@ const jsonValidator = [
|
|
|
119
119
|
"int",
|
|
120
120
|
{
|
|
121
121
|
type: "string-empty",
|
|
122
|
-
url: "
|
|
122
|
+
url: "codesystem/accounts",
|
|
123
123
|
prop: "code",
|
|
124
124
|
validation: "code(20)",
|
|
125
125
|
},
|
|
@@ -137,12 +137,12 @@ const jsonValidator = [
|
|
|
137
137
|
const jsonValidator = [
|
|
138
138
|
{
|
|
139
139
|
type: "fetch",
|
|
140
|
-
url: "
|
|
140
|
+
url: "codesystem/accounts",
|
|
141
141
|
prop: "code",
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
type: "fetch",
|
|
145
|
-
url: "
|
|
145
|
+
url: "codesystem/contacts",
|
|
146
146
|
prop: "code",
|
|
147
147
|
},
|
|
148
148
|
"decimal",
|
|
@@ -160,7 +160,7 @@ const jsonValidator = [
|
|
|
160
160
|
"string(255)",
|
|
161
161
|
{
|
|
162
162
|
type: "fetch",
|
|
163
|
-
url: "
|
|
163
|
+
url: "codesystem/item-groups",
|
|
164
164
|
prop: "id",
|
|
165
165
|
},
|
|
166
166
|
"$string(20)",
|
|
@@ -171,19 +171,19 @@ const jsonValidator = [
|
|
|
171
171
|
"$string(20)",
|
|
172
172
|
{
|
|
173
173
|
type: "fetch",
|
|
174
|
-
url: "
|
|
174
|
+
url: "valueset/units",
|
|
175
175
|
prop: "code",
|
|
176
176
|
},
|
|
177
177
|
{
|
|
178
178
|
type: "fetch",
|
|
179
|
-
url: "
|
|
179
|
+
url: "valueset/pharmaceuticalForms",
|
|
180
180
|
prop: "id",
|
|
181
181
|
},
|
|
182
182
|
"decimal",
|
|
183
183
|
"decimal",
|
|
184
184
|
{
|
|
185
185
|
type: "fetch",
|
|
186
|
-
url: "
|
|
186
|
+
url: "valueset/taxes",
|
|
187
187
|
prop: "code",
|
|
188
188
|
},
|
|
189
189
|
"$string(255)",
|
|
@@ -204,7 +204,7 @@ const jsonValidator = [
|
|
|
204
204
|
"int",
|
|
205
205
|
{
|
|
206
206
|
type: "fetch",
|
|
207
|
-
url: "
|
|
207
|
+
url: "codesystem/item-groups",
|
|
208
208
|
prop: "name",
|
|
209
209
|
},
|
|
210
210
|
"string(255)",
|
|
@@ -225,22 +225,22 @@ const jsonValidator = [
|
|
|
225
225
|
"int",
|
|
226
226
|
{
|
|
227
227
|
type: "fetch",
|
|
228
|
-
url: "
|
|
228
|
+
url: "valueset/contactTypes",
|
|
229
229
|
prop: "id",
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
232
|
type: "fetch",
|
|
233
|
-
url: "
|
|
233
|
+
url: "valueset/contactPersons",
|
|
234
234
|
prop: "id",
|
|
235
235
|
},
|
|
236
236
|
{
|
|
237
237
|
type: "fetch",
|
|
238
|
-
url: "
|
|
238
|
+
url: "valueset/identificationTypes",
|
|
239
239
|
prop: "id",
|
|
240
240
|
},
|
|
241
241
|
{
|
|
242
242
|
type: "string-empty",
|
|
243
|
-
url: "
|
|
243
|
+
url: "codesystem/contacts",
|
|
244
244
|
prop: "code",
|
|
245
245
|
validation: "code(20)",
|
|
246
246
|
},
|
|
@@ -255,13 +255,13 @@ const jsonValidator = [
|
|
|
255
255
|
"$string(500)",
|
|
256
256
|
{
|
|
257
257
|
type: "fetch",
|
|
258
|
-
url: "
|
|
258
|
+
url: "valueset/cities",
|
|
259
259
|
prop: "code",
|
|
260
260
|
},
|
|
261
261
|
"$string(100)",
|
|
262
262
|
{
|
|
263
263
|
type: "fetch",
|
|
264
|
-
url: "
|
|
264
|
+
url: "valueset/contactRegimes",
|
|
265
265
|
prop: "id",
|
|
266
266
|
},
|
|
267
267
|
"$string(100)",
|
|
@@ -275,19 +275,19 @@ const jsonValidator = [
|
|
|
275
275
|
"$string(100)",
|
|
276
276
|
{
|
|
277
277
|
type: "fetch",
|
|
278
|
-
url: "
|
|
278
|
+
url: "valueset/activities",
|
|
279
279
|
prop: "id",
|
|
280
280
|
},
|
|
281
281
|
{
|
|
282
282
|
type: "fetch",
|
|
283
|
-
url: "
|
|
283
|
+
url: "valueset/contactResponsibilities",
|
|
284
284
|
prop: "id",
|
|
285
285
|
},
|
|
286
286
|
"$string(6)",
|
|
287
287
|
"bool",
|
|
288
288
|
{
|
|
289
289
|
type: "fetch",
|
|
290
|
-
url: "
|
|
290
|
+
url: "valueset/taxTypes",
|
|
291
291
|
prop: "id",
|
|
292
292
|
},
|
|
293
293
|
];
|
|
@@ -301,7 +301,7 @@ const jsonValidator = [
|
|
|
301
301
|
"code(20)",
|
|
302
302
|
{
|
|
303
303
|
type: "fetch",
|
|
304
|
-
url: "
|
|
304
|
+
url: "valueset/identificationTypes",
|
|
305
305
|
prop: "id",
|
|
306
306
|
},
|
|
307
307
|
"string(50)",
|
|
@@ -311,12 +311,12 @@ const jsonValidator = [
|
|
|
311
311
|
"string(yyyy-mm-dd)",
|
|
312
312
|
{
|
|
313
313
|
type: "fetch",
|
|
314
|
-
url: "
|
|
314
|
+
url: "valueset/genderGroups",
|
|
315
315
|
prop: "id",
|
|
316
316
|
},
|
|
317
317
|
{
|
|
318
318
|
type: "fetch",
|
|
319
|
-
url: "
|
|
319
|
+
url: "valueset/genderIdentities",
|
|
320
320
|
prop: "id",
|
|
321
321
|
},
|
|
322
322
|
"$string(100)",
|
|
@@ -324,17 +324,17 @@ const jsonValidator = [
|
|
|
324
324
|
"$string(100)",
|
|
325
325
|
{
|
|
326
326
|
type: "fetch",
|
|
327
|
-
url: "
|
|
327
|
+
url: "valueset/cities",
|
|
328
328
|
prop: "code",
|
|
329
329
|
},
|
|
330
330
|
{
|
|
331
331
|
type: "fetch",
|
|
332
|
-
url: "
|
|
332
|
+
url: "valueset/patientRegimes",
|
|
333
333
|
prop: "code",
|
|
334
334
|
},
|
|
335
335
|
{
|
|
336
336
|
type: "fetch",
|
|
337
|
-
url: "
|
|
337
|
+
url: "valueset/patientStatus",
|
|
338
338
|
prop: "id",
|
|
339
339
|
},
|
|
340
340
|
];
|
|
@@ -33,7 +33,7 @@ const ExcelValidator = ({ initData, fileContent, matrix, validationErrors, onSel
|
|
|
33
33
|
}
|
|
34
34
|
const base64 = btoa(binary);
|
|
35
35
|
try {
|
|
36
|
-
const response = await fetch(`${initData.environment}
|
|
36
|
+
const response = await fetch(`${initData.environment}plains/upload?companyId=${initData.companyId}&apikey=${initData.apikey}`, {
|
|
37
37
|
method: "POST",
|
|
38
38
|
headers: {
|
|
39
39
|
"Content-Type": "application/json",
|
|
@@ -68,7 +68,7 @@ const ExcelValidator = ({ initData, fileContent, matrix, validationErrors, onSel
|
|
|
68
68
|
};
|
|
69
69
|
return ((0, jsx_runtime_1.jsxs)("section", { className: "mt-5 bg-content1 max-h-[calc(100vh-11.5rem)] overflow-y-auto pr-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex xl:flex-row lg:flex-col mb-3 justify-between items-center", children: [(0, jsx_runtime_1.jsx)("h2", { className: "text-xl font-semibold text-default-700", children: "Validaciones" }), (0, jsx_runtime_1.jsx)(react_1.Chip, { color: validationErrors.length > 0 ? "danger" : "success", variant: "solid", className: "text-white", startContent: validationErrors.length > 0 ? ((0, jsx_runtime_1.jsx)(tb_1.TbAlertCircle, { size: 20 })) : ((0, jsx_runtime_1.jsx)(tb_1.TbCheck, { size: 20 })), children: (0, jsx_runtime_1.jsxs)("p", { className: "pl-1", children: [validationErrors.length, " ", validationErrors.length === 1
|
|
70
70
|
? "error encontrado"
|
|
71
|
-
: "errores encontrados"] }) })] }), hasBalanceDifference ? ((0, jsx_runtime_1.jsx)(react_1.Alert, { color: "danger", title: "Hay diferencias en los saldos iniciales", variant: "faded", hideIcon: true, startContent: (0, jsx_runtime_1.jsx)(tb_1.TbAlertCircle, { size: 30 }), className: "mb-3" })) : null, validationErrors.length === 0 && !hasBalanceDifference ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Alert, { color: "success", title: "Sin errores de validaci\u00F3n.", variant: "faded", hideIcon: true, startContent: (0, jsx_runtime_1.jsx)(tb_1.TbCircleCheck, { size: 30 }) }), (0, jsx_runtime_1.jsx)(react_1.Button, { color: "success", className: "mt-4 w-full", variant: "flat", endContent: (0, jsx_runtime_1.jsx)(tb_1.TbUpload, { size: 20 }), radius: "sm", isLoading: isUploadingTemplate, onPress: handleTXTFormat, children: "Enviar Plantilla" }), uploadMessage ? ((0, jsx_runtime_1.jsx)("p", { className: `mt-2 text-sm ${uploadMessage.type === "success"
|
|
71
|
+
: "errores encontrados"] }) })] }), hasBalanceDifference ? ((0, jsx_runtime_1.jsx)(react_1.Alert, { color: "danger", title: "Hay diferencias en los saldos iniciales", variant: "faded", hideIcon: true, startContent: (0, jsx_runtime_1.jsx)(tb_1.TbAlertCircle, { size: 30 }), className: "mb-3" })) : null, (0, jsx_runtime_1.jsx)(react_1.Button, { color: "success", className: "mt-4 w-full", variant: "flat", endContent: (0, jsx_runtime_1.jsx)(tb_1.TbUpload, { size: 20 }), radius: "sm", isLoading: isUploadingTemplate, onPress: handleTXTFormat, children: "Enviar Plantilla" }), validationErrors.length === 0 && !hasBalanceDifference ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Alert, { color: "success", title: "Sin errores de validaci\u00F3n.", variant: "faded", hideIcon: true, startContent: (0, jsx_runtime_1.jsx)(tb_1.TbCircleCheck, { size: 30 }) }), (0, jsx_runtime_1.jsx)(react_1.Button, { color: "success", className: "mt-4 w-full", variant: "flat", endContent: (0, jsx_runtime_1.jsx)(tb_1.TbUpload, { size: 20 }), radius: "sm", isLoading: isUploadingTemplate, onPress: handleTXTFormat, children: "Enviar Plantilla" }), uploadMessage ? ((0, jsx_runtime_1.jsx)("p", { className: `mt-2 text-sm ${uploadMessage.type === "success"
|
|
72
72
|
? "text-success-600"
|
|
73
73
|
: "text-danger-600"}`, children: uploadMessage.text })) : null] })) : ((0, jsx_runtime_1.jsx)(react_1.Accordion, { selectionMode: "multiple", showDivider: false, children: Object.entries(validationErrors.reduce((groups, error) => {
|
|
74
74
|
const key = error.columnName;
|