admin-lib-cms 1.2.17 → 1.2.18
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/index.js +849 -31
- package/dist/index.mjs +857 -33
- package/dist/storage.js +70 -26
- package/dist/storage.mjs +70 -26
- package/dist/types.d.mts +31 -0
- package/dist/types.d.ts +31 -0
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -35,9 +35,13 @@ import {
|
|
|
35
35
|
Switch,
|
|
36
36
|
Button,
|
|
37
37
|
Image,
|
|
38
|
-
App
|
|
38
|
+
App,
|
|
39
|
+
Tag,
|
|
40
|
+
Progress,
|
|
41
|
+
Radio,
|
|
42
|
+
Segmented
|
|
39
43
|
} from "antd";
|
|
40
|
-
import
|
|
44
|
+
import dayjs2 from "dayjs";
|
|
41
45
|
import {
|
|
42
46
|
FileText,
|
|
43
47
|
Boxes,
|
|
@@ -68,9 +72,226 @@ import {
|
|
|
68
72
|
Check,
|
|
69
73
|
GripVertical,
|
|
70
74
|
AlertTriangle,
|
|
71
|
-
FileDown
|
|
75
|
+
FileDown,
|
|
76
|
+
FileUp,
|
|
77
|
+
FileSpreadsheet
|
|
72
78
|
} from "lucide-react";
|
|
73
79
|
|
|
80
|
+
// src/admin/excel.ts
|
|
81
|
+
import * as XLSX from "xlsx";
|
|
82
|
+
import dayjs from "dayjs";
|
|
83
|
+
function filterEntriesByDateRange(entries, fieldId, startDate, endDate) {
|
|
84
|
+
if (!startDate && !endDate) return entries;
|
|
85
|
+
const startDayjs = startDate ? dayjs(startDate).startOf("day") : null;
|
|
86
|
+
const endDayjs = endDate ? dayjs(endDate).endOf("day") : null;
|
|
87
|
+
return entries.filter((e) => {
|
|
88
|
+
const val = e[fieldId];
|
|
89
|
+
if (!val) return false;
|
|
90
|
+
const d = dayjs(String(val));
|
|
91
|
+
if (!d.isValid()) return false;
|
|
92
|
+
if (startDayjs && d.isBefore(startDayjs)) return false;
|
|
93
|
+
if (endDayjs && d.isAfter(endDayjs)) return false;
|
|
94
|
+
return true;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function findExistingEntry(item, existingEntries, collection) {
|
|
98
|
+
if (item.id && !item.id.startsWith("item_")) {
|
|
99
|
+
const cleanId = String(item.id).trim().toLowerCase();
|
|
100
|
+
const matchById = existingEntries.find(
|
|
101
|
+
(e) => e.id && String(e.id).trim().toLowerCase() === cleanId || e._id && String(e._id).trim().toLowerCase() === cleanId
|
|
102
|
+
);
|
|
103
|
+
if (matchById) return matchById;
|
|
104
|
+
}
|
|
105
|
+
const uniqueFieldIds = [];
|
|
106
|
+
(collection.fields || []).forEach((f) => {
|
|
107
|
+
if (f.unique && !uniqueFieldIds.includes(f.id)) {
|
|
108
|
+
uniqueFieldIds.push(f.id);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
(collection.uniqueFields || []).forEach((uf) => {
|
|
112
|
+
if (!uniqueFieldIds.includes(uf)) {
|
|
113
|
+
uniqueFieldIds.push(uf);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
for (const ufId of uniqueFieldIds) {
|
|
117
|
+
const itemVal = item[ufId];
|
|
118
|
+
if (itemVal !== void 0 && itemVal !== null && String(itemVal).trim() !== "") {
|
|
119
|
+
const cleanVal = String(itemVal).trim().toLowerCase();
|
|
120
|
+
const match = existingEntries.find((e) => {
|
|
121
|
+
const eVal = e[ufId];
|
|
122
|
+
return eVal !== void 0 && eVal !== null && String(eVal).trim().toLowerCase() === cleanVal;
|
|
123
|
+
});
|
|
124
|
+
if (match) return match;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
function formatValueForExport(val, field) {
|
|
130
|
+
if (val === void 0 || val === null) return "";
|
|
131
|
+
if (typeof val === "number" || typeof val === "boolean") return val;
|
|
132
|
+
if (Array.isArray(val)) {
|
|
133
|
+
return val.map((item) => typeof item === "object" && item !== null ? JSON.stringify(item) : String(item)).join(", ");
|
|
134
|
+
}
|
|
135
|
+
if (typeof val === "object") {
|
|
136
|
+
try {
|
|
137
|
+
return JSON.stringify(val);
|
|
138
|
+
} catch {
|
|
139
|
+
return String(val);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return String(val);
|
|
143
|
+
}
|
|
144
|
+
function exportCollectionToExcel(collection, entries, fileNamePrefix) {
|
|
145
|
+
const columns = [
|
|
146
|
+
{ key: "id", label: "ID" }
|
|
147
|
+
];
|
|
148
|
+
(collection.fields || []).forEach((f) => {
|
|
149
|
+
columns.push({
|
|
150
|
+
key: f.id,
|
|
151
|
+
label: f.label || f.id,
|
|
152
|
+
field: f
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
const rows = entries.map((entry) => {
|
|
156
|
+
const rowObj = {};
|
|
157
|
+
columns.forEach((col) => {
|
|
158
|
+
const rawVal = entry[col.key];
|
|
159
|
+
rowObj[col.label] = formatValueForExport(rawVal, col.field);
|
|
160
|
+
});
|
|
161
|
+
return rowObj;
|
|
162
|
+
});
|
|
163
|
+
const worksheet = XLSX.utils.json_to_sheet(rows);
|
|
164
|
+
const colWidths = columns.map((col) => {
|
|
165
|
+
let maxLen = col.label.length;
|
|
166
|
+
for (let i = 0; i < Math.min(rows.length, 100); i++) {
|
|
167
|
+
const cellVal = String(rows[i]?.[col.label] ?? "");
|
|
168
|
+
if (cellVal.length > maxLen) {
|
|
169
|
+
maxLen = Math.min(cellVal.length, 45);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return { wch: Math.max(maxLen + 3, 12) };
|
|
173
|
+
});
|
|
174
|
+
worksheet["!cols"] = colWidths;
|
|
175
|
+
const workbook = XLSX.utils.book_new();
|
|
176
|
+
const safeSheetName = (collection.name || collection.id).replace(/[\\/?*[\]:]/g, "").slice(0, 31) || "Datos";
|
|
177
|
+
XLSX.utils.book_append_sheet(workbook, worksheet, safeSheetName);
|
|
178
|
+
const dateStr = dayjs().format("YYYY-MM-DD");
|
|
179
|
+
const baseName = fileNamePrefix || (collection.name || collection.id).toLowerCase().replace(/[^a-z0-9_-]+/g, "_");
|
|
180
|
+
const fileName = `${baseName}_${dateStr}.xlsx`;
|
|
181
|
+
XLSX.writeFile(workbook, fileName);
|
|
182
|
+
}
|
|
183
|
+
async function parseExcelForCollection(file, collection, existingEntries = []) {
|
|
184
|
+
const data = await file.arrayBuffer();
|
|
185
|
+
const workbook = XLSX.read(data, { type: "array" });
|
|
186
|
+
const firstSheetName = workbook.SheetNames[0];
|
|
187
|
+
if (!firstSheetName) {
|
|
188
|
+
throw new Error("El archivo no contiene ninguna hoja de c\xE1lculo.");
|
|
189
|
+
}
|
|
190
|
+
const worksheet = workbook.Sheets[firstSheetName];
|
|
191
|
+
const rawRows = XLSX.utils.sheet_to_json(worksheet, { defval: "" });
|
|
192
|
+
if (!rawRows.length) {
|
|
193
|
+
return {
|
|
194
|
+
records: [],
|
|
195
|
+
totalRows: 0,
|
|
196
|
+
matchedFields: [],
|
|
197
|
+
unmatchedHeaders: [],
|
|
198
|
+
samplePreview: [],
|
|
199
|
+
errors: ["El archivo no contiene filas con datos."]
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const headers = Object.keys(rawRows[0] || {});
|
|
203
|
+
const matchedFields = [];
|
|
204
|
+
const unmatchedHeaders = [];
|
|
205
|
+
const headerToFieldMap = /* @__PURE__ */ new Map();
|
|
206
|
+
headers.forEach((header) => {
|
|
207
|
+
const cleanHeader = header.trim().toLowerCase();
|
|
208
|
+
if (cleanHeader === "id" || cleanHeader === "_id" || cleanHeader === "identificador") {
|
|
209
|
+
headerToFieldMap.set(header, "id");
|
|
210
|
+
matchedFields.push({ label: header, fieldId: "id" });
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const matched = (collection.fields || []).find((f) => {
|
|
214
|
+
const fieldLabel = (f.label || "").trim().toLowerCase();
|
|
215
|
+
const fieldId = f.id.trim().toLowerCase();
|
|
216
|
+
return fieldLabel === cleanHeader || fieldId === cleanHeader;
|
|
217
|
+
});
|
|
218
|
+
if (matched) {
|
|
219
|
+
headerToFieldMap.set(header, matched);
|
|
220
|
+
matchedFields.push({ label: header, fieldId: matched.id });
|
|
221
|
+
} else {
|
|
222
|
+
unmatchedHeaders.push(header);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
const records = [];
|
|
226
|
+
const errors = [];
|
|
227
|
+
rawRows.forEach((row, idx) => {
|
|
228
|
+
const entry = { id: "" };
|
|
229
|
+
(collection.fields || []).forEach((f) => {
|
|
230
|
+
if (f.defaultValue !== void 0) {
|
|
231
|
+
entry[f.id] = f.defaultValue;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
headers.forEach((header) => {
|
|
235
|
+
const mapping = headerToFieldMap.get(header);
|
|
236
|
+
const rawVal = row[header];
|
|
237
|
+
if (rawVal === void 0 || rawVal === "") return;
|
|
238
|
+
if (mapping === "id") {
|
|
239
|
+
entry.id = String(rawVal).trim();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (!mapping) return;
|
|
243
|
+
const field = mapping;
|
|
244
|
+
if (field.type === "number") {
|
|
245
|
+
const num = Number(String(rawVal).replace(/[^0-9.-]/g, ""));
|
|
246
|
+
entry[field.id] = isNaN(num) ? rawVal : num;
|
|
247
|
+
} else if (field.type === "boolean") {
|
|
248
|
+
const str = String(rawVal).trim().toLowerCase();
|
|
249
|
+
entry[field.id] = str === "true" || str === "si" || str === "s\xED" || str === "yes" || str === "1" || str === "verdadero";
|
|
250
|
+
} else if (field.multiple || field.type === "list") {
|
|
251
|
+
if (typeof rawVal === "string") {
|
|
252
|
+
entry[field.id] = rawVal.split(/[,;\n]/).map((s) => s.trim()).filter(Boolean);
|
|
253
|
+
} else if (Array.isArray(rawVal)) {
|
|
254
|
+
entry[field.id] = rawVal;
|
|
255
|
+
} else {
|
|
256
|
+
entry[field.id] = [String(rawVal)];
|
|
257
|
+
}
|
|
258
|
+
} else if (typeof rawVal === "string" && (rawVal.startsWith("{") || rawVal.startsWith("["))) {
|
|
259
|
+
try {
|
|
260
|
+
entry[field.id] = JSON.parse(rawVal);
|
|
261
|
+
} catch {
|
|
262
|
+
entry[field.id] = rawVal;
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
entry[field.id] = rawVal;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
if (!entry.id) {
|
|
269
|
+
entry.id = typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : `item_${Date.now()}_${idx}`;
|
|
270
|
+
}
|
|
271
|
+
records.push(entry);
|
|
272
|
+
});
|
|
273
|
+
let existingCount = 0;
|
|
274
|
+
let newCount = 0;
|
|
275
|
+
records.forEach((rec) => {
|
|
276
|
+
const existing = findExistingEntry(rec, existingEntries, collection);
|
|
277
|
+
if (existing) {
|
|
278
|
+
existingCount++;
|
|
279
|
+
} else {
|
|
280
|
+
newCount++;
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
return {
|
|
284
|
+
records,
|
|
285
|
+
totalRows: records.length,
|
|
286
|
+
matchedFields,
|
|
287
|
+
unmatchedHeaders,
|
|
288
|
+
samplePreview: records.slice(0, 5),
|
|
289
|
+
existingRecordsCount: existingCount,
|
|
290
|
+
newRecordsCount: newCount,
|
|
291
|
+
errors
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
74
295
|
// src/admin/i18n.ts
|
|
75
296
|
var translations = {
|
|
76
297
|
es: {
|
|
@@ -155,6 +376,29 @@ var translations = {
|
|
|
155
376
|
submissions: "Mensajes y Formularios",
|
|
156
377
|
noSubmissions: "No hay env\xEDos registrados",
|
|
157
378
|
exportCsv: "Exportar CSV",
|
|
379
|
+
exportExcel: "Exportar Excel",
|
|
380
|
+
importExcel: "Importar Excel",
|
|
381
|
+
exportSuccess: "Archivo Excel exportado con \xE9xito.",
|
|
382
|
+
importSuccess: "registros procesados exitosamente.",
|
|
383
|
+
exportModalTitle: "Exportar a Excel",
|
|
384
|
+
exportAllRecords: "Todos los registros",
|
|
385
|
+
exportFilterByDate: "Filtrar por rango de fechas",
|
|
386
|
+
exportDateFieldLabel: "Campo de fecha",
|
|
387
|
+
exportDateRangeLabel: "Rango de fechas",
|
|
388
|
+
exportDownloadBtn: "Descargar Excel",
|
|
389
|
+
exportNoRecordsInRange: "No se encontraron registros en el rango seleccionado.",
|
|
390
|
+
importModalTitle: "Importar datos desde Excel / CSV",
|
|
391
|
+
importModalDesc: "Carga un archivo .xlsx, .xls o .csv para agregar o actualizar registros autom\xE1ticamente.",
|
|
392
|
+
importDropzone: "Haz clic o arrastra un archivo Excel aqu\xED",
|
|
393
|
+
importDropzoneSub: "Formatos compatibles: .xlsx, .xls, .csv. La primera fila debe contener los encabezados.",
|
|
394
|
+
importPreviewTitle: "Vista previa de importaci\xF3n",
|
|
395
|
+
importConfirmBtn: "Importar registros",
|
|
396
|
+
importOverwritesWarning: "Tratamiento de registros ya existentes:",
|
|
397
|
+
importingProgress: "Importando registros...",
|
|
398
|
+
importExistingOmit: "Omitir existentes (no volver a crear ni duplicar)",
|
|
399
|
+
importExistingUpdate: "Actualizar existentes con datos del archivo",
|
|
400
|
+
importExistingDetected: "ya existentes",
|
|
401
|
+
importNewDetected: "nuevos a crear",
|
|
158
402
|
markRead: "Marcar como le\xEDdo",
|
|
159
403
|
settingsTitle: "Ajustes del sitio",
|
|
160
404
|
entries: "registros"
|
|
@@ -241,6 +485,29 @@ var translations = {
|
|
|
241
485
|
submissions: "Form Submissions",
|
|
242
486
|
noSubmissions: "No submissions yet",
|
|
243
487
|
exportCsv: "Export CSV",
|
|
488
|
+
exportExcel: "Export Excel",
|
|
489
|
+
importExcel: "Import Excel",
|
|
490
|
+
exportSuccess: "Excel file exported successfully.",
|
|
491
|
+
importSuccess: "records processed successfully.",
|
|
492
|
+
exportModalTitle: "Export to Excel",
|
|
493
|
+
exportAllRecords: "All records",
|
|
494
|
+
exportFilterByDate: "Filter by date range",
|
|
495
|
+
exportDateFieldLabel: "Date field",
|
|
496
|
+
exportDateRangeLabel: "Date range",
|
|
497
|
+
exportDownloadBtn: "Download Excel",
|
|
498
|
+
exportNoRecordsInRange: "No records found in the selected date range.",
|
|
499
|
+
importModalTitle: "Import data from Excel / CSV",
|
|
500
|
+
importModalDesc: "Upload a .xlsx, .xls or .csv file to automatically create or update records.",
|
|
501
|
+
importDropzone: "Click or drag an Excel file here",
|
|
502
|
+
importDropzoneSub: "Supported formats: .xlsx, .xls, .csv. The first row must contain column headers.",
|
|
503
|
+
importPreviewTitle: "Import Preview",
|
|
504
|
+
importConfirmBtn: "Import records",
|
|
505
|
+
importOverwritesWarning: "Handling of existing records:",
|
|
506
|
+
importingProgress: "Importing records...",
|
|
507
|
+
importExistingOmit: "Skip existing (do not recreate or duplicate)",
|
|
508
|
+
importExistingUpdate: "Update existing with file data",
|
|
509
|
+
importExistingDetected: "existing records",
|
|
510
|
+
importNewDetected: "new to create",
|
|
244
511
|
markRead: "Mark as read",
|
|
245
512
|
settingsTitle: "Site Settings",
|
|
246
513
|
entries: "entries"
|
|
@@ -311,13 +578,13 @@ function toDayjsTime(value) {
|
|
|
311
578
|
const isPm = match12[3].toLowerCase().startsWith("p");
|
|
312
579
|
if (isPm && h < 12) h += 12;
|
|
313
580
|
if (!isPm && h === 12) h = 0;
|
|
314
|
-
return
|
|
581
|
+
return dayjs2().hour(h).minute(m).second(0).millisecond(0);
|
|
315
582
|
}
|
|
316
583
|
const match24 = /^([01]?\d|2[0-3]):([0-5]\d)$/.exec(str);
|
|
317
584
|
if (match24) {
|
|
318
|
-
return
|
|
585
|
+
return dayjs2().hour(Number(match24[1])).minute(Number(match24[2])).second(0).millisecond(0);
|
|
319
586
|
}
|
|
320
|
-
const parsed =
|
|
587
|
+
const parsed = dayjs2(str, ["h:mm a", "h:mm A", "hh:mm a", "hh:mm A", "HH:mm"]);
|
|
321
588
|
return parsed.isValid() ? parsed : null;
|
|
322
589
|
}
|
|
323
590
|
function toStoredTime(value) {
|
|
@@ -1697,37 +1964,37 @@ function CollectionsSection() {
|
|
|
1697
1964
|
});
|
|
1698
1965
|
}, [ctx.adapter, colIds, ctx.collectionChangedAt]);
|
|
1699
1966
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
|
|
1700
|
-
/* @__PURE__ */ jsxs("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
|
|
1701
|
-
/* @__PURE__ */ jsx("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Collections" }),
|
|
1702
|
-
/* @__PURE__ */ jsxs("ul", { className: "flex overflow-x-auto gap-
|
|
1967
|
+
/* @__PURE__ */ jsxs("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-2 sm:p-3 md:p-4", children: [
|
|
1968
|
+
/* @__PURE__ */ jsx("div", { className: "hidden md:block mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Collections" }),
|
|
1969
|
+
/* @__PURE__ */ jsxs("ul", { className: "flex items-center md:items-stretch overflow-x-auto gap-1.5 p-1 md:p-0 md:block md:space-x-0 md:space-y-1 md:overflow-visible", children: [
|
|
1703
1970
|
collections.map((c, idx) => {
|
|
1704
1971
|
if (c.isSeparator) {
|
|
1705
1972
|
return /* @__PURE__ */ jsx(
|
|
1706
1973
|
"li",
|
|
1707
1974
|
{
|
|
1708
|
-
className: "my-3 border-t border-slate-200/80 pt-2 px-1 list-none",
|
|
1709
|
-
children: c.name && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold uppercase tracking-wider text-slate-400", children: c.name })
|
|
1975
|
+
className: "self-center shrink-0 h-6 w-px bg-slate-200 mx-1 md:h-auto md:w-auto md:mx-0 md:my-3 md:border-t md:border-slate-200/80 md:pt-2 md:px-1 list-none",
|
|
1976
|
+
children: c.name && /* @__PURE__ */ jsx("span", { className: "hidden md:block text-[10px] font-bold uppercase tracking-wider text-slate-400", children: c.name })
|
|
1710
1977
|
},
|
|
1711
1978
|
c.id || `sep-${idx}`
|
|
1712
1979
|
);
|
|
1713
1980
|
}
|
|
1714
|
-
return /* @__PURE__ */ jsx("li", { className: "shrink-0
|
|
1981
|
+
return /* @__PURE__ */ jsx("li", { className: "shrink-0 md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs(
|
|
1715
1982
|
"button",
|
|
1716
1983
|
{
|
|
1717
1984
|
onClick: () => setSelected(c),
|
|
1718
|
-
className: `w-full
|
|
1985
|
+
className: `rounded-xl px-3.5 py-2 md:w-full md:px-3 md:py-2.5 text-left text-xs md:text-sm transition-all duration-200 ${selected?.id === c.id ? "bg-white border border-slate-200/90 shadow-2xs font-semibold" : "text-slate-600 hover:text-slate-900 hover:bg-slate-100/70 border border-transparent"}`,
|
|
1719
1986
|
children: [
|
|
1720
1987
|
/* @__PURE__ */ jsx(
|
|
1721
1988
|
"div",
|
|
1722
1989
|
{
|
|
1723
|
-
className: selected?.id === c.id ? "text-slate-900" : "text-slate-700",
|
|
1990
|
+
className: selected?.id === c.id ? "text-slate-900 font-bold" : "text-slate-700 font-medium",
|
|
1724
1991
|
children: c.name
|
|
1725
1992
|
}
|
|
1726
1993
|
),
|
|
1727
1994
|
/* @__PURE__ */ jsxs(
|
|
1728
1995
|
"div",
|
|
1729
1996
|
{
|
|
1730
|
-
className: `text-xs mt-0.5 ${selected?.id === c.id ? "text-indigo-
|
|
1997
|
+
className: `text-[10px] md:text-xs mt-0.5 ${selected?.id === c.id ? "text-indigo-600 font-medium" : "text-slate-400"}`,
|
|
1731
1998
|
children: [
|
|
1732
1999
|
counts[c.id] ?? 0,
|
|
1733
2000
|
" items"
|
|
@@ -1741,7 +2008,7 @@ function CollectionsSection() {
|
|
|
1741
2008
|
collections.length === 0 && /* @__PURE__ */ jsx("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200", children: "No collections registered." })
|
|
1742
2009
|
] })
|
|
1743
2010
|
] }),
|
|
1744
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
|
|
2011
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-auto p-2 sm:p-4 md:p-8 relative", children: [
|
|
1745
2012
|
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-grid-slate-100 [mask-image:linear-gradient(0deg,white,rgba(255,255,255,0.6))] -z-10 pointer-events-none" }),
|
|
1746
2013
|
selected ? /* @__PURE__ */ jsx(CollectionEditor, { collection: selected }, selected.id) : /* @__PURE__ */ jsx("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a collection to manage its entries." })
|
|
1747
2014
|
] })
|
|
@@ -1757,6 +2024,16 @@ function CollectionEditor({ collection }) {
|
|
|
1757
2024
|
const [duplicateErrors, setDuplicateErrors] = useState({});
|
|
1758
2025
|
const [isCreatingManual, setIsCreatingManual] = useState(false);
|
|
1759
2026
|
const [isViewingDetail, setIsViewingDetail] = useState(false);
|
|
2027
|
+
const [customViewingRecord, setCustomViewingRecord] = useState(null);
|
|
2028
|
+
const [isCustomEditing, setIsCustomEditing] = useState(false);
|
|
2029
|
+
const [customActiveView, setCustomActiveView] = useState(null);
|
|
2030
|
+
const [isCustomCreating, setIsCustomCreating] = useState(false);
|
|
2031
|
+
useEffect(() => {
|
|
2032
|
+
setCustomViewingRecord(null);
|
|
2033
|
+
setIsCustomEditing(false);
|
|
2034
|
+
setCustomActiveView(null);
|
|
2035
|
+
setIsCustomCreating(false);
|
|
2036
|
+
}, [collection.id]);
|
|
1760
2037
|
const [saving, setSaving] = useState(false);
|
|
1761
2038
|
const [deletingId, setDeletingId] = useState(null);
|
|
1762
2039
|
const [loadingEntries, setLoadingEntries] = useState(true);
|
|
@@ -1766,6 +2043,47 @@ function CollectionEditor({ collection }) {
|
|
|
1766
2043
|
const [filters, setFilters] = useState({});
|
|
1767
2044
|
const [page, setPage] = useState(1);
|
|
1768
2045
|
const itemsPerPage = 10;
|
|
2046
|
+
const dateFields = useMemo(() => {
|
|
2047
|
+
const list = [];
|
|
2048
|
+
(collection.fields || []).forEach((f) => {
|
|
2049
|
+
if (f.type === "date" || f.type === "datetime" || f.id === "fecha" || f.id.toLowerCase().includes("fecha") || f.id.toLowerCase().includes("date")) {
|
|
2050
|
+
list.push({ id: f.id, label: f.label || f.id });
|
|
2051
|
+
}
|
|
2052
|
+
});
|
|
2053
|
+
const hasCreatedAt = entries.some((e) => e._createdAt);
|
|
2054
|
+
if (hasCreatedAt && !list.some((f) => f.id === "_createdAt")) {
|
|
2055
|
+
list.push({ id: "_createdAt", label: "Fecha de creaci\xF3n (_createdAt)" });
|
|
2056
|
+
}
|
|
2057
|
+
return list;
|
|
2058
|
+
}, [collection.fields, entries]);
|
|
2059
|
+
const [isExportModalOpen, setIsExportModalOpen] = useState(false);
|
|
2060
|
+
const [exportMode, setExportMode] = useState("all");
|
|
2061
|
+
const [exportDateField, setExportDateField] = useState("");
|
|
2062
|
+
const [exportDateRange, setExportDateRange] = useState(null);
|
|
2063
|
+
useEffect(() => {
|
|
2064
|
+
if (dateFields.length > 0 && !exportDateField) {
|
|
2065
|
+
setExportDateField(dateFields[0].id);
|
|
2066
|
+
}
|
|
2067
|
+
}, [dateFields, exportDateField]);
|
|
2068
|
+
const exportTargetEntries = useMemo(() => {
|
|
2069
|
+
if (exportMode === "all" || !exportDateField || !exportDateRange || !exportDateRange[0] || !exportDateRange[1]) {
|
|
2070
|
+
return entries;
|
|
2071
|
+
}
|
|
2072
|
+
return filterEntriesByDateRange(
|
|
2073
|
+
entries,
|
|
2074
|
+
exportDateField,
|
|
2075
|
+
exportDateRange[0].format("YYYY-MM-DD"),
|
|
2076
|
+
exportDateRange[1].format("YYYY-MM-DD")
|
|
2077
|
+
);
|
|
2078
|
+
}, [entries, exportMode, exportDateField, exportDateRange]);
|
|
2079
|
+
const [isImportModalOpen, setIsImportModalOpen] = useState(false);
|
|
2080
|
+
const [importFile, setImportFile] = useState(null);
|
|
2081
|
+
const [importResult, setImportResult] = useState(null);
|
|
2082
|
+
const [isParsingImport, setIsParsingImport] = useState(false);
|
|
2083
|
+
const [isImporting, setIsImporting] = useState(false);
|
|
2084
|
+
const [importExistingAction, setImportExistingAction] = useState("omit");
|
|
2085
|
+
const [importProgress, setImportProgress] = useState({ current: 0, total: 0 });
|
|
2086
|
+
const fileInputRef = useRef(null);
|
|
1769
2087
|
const load = useCallback(() => {
|
|
1770
2088
|
setLoadingEntries(true);
|
|
1771
2089
|
ctx.adapter.listEntries(collection.id).then((res) => {
|
|
@@ -1801,7 +2119,111 @@ function CollectionEditor({ collection }) {
|
|
|
1801
2119
|
useEffect(() => {
|
|
1802
2120
|
load();
|
|
1803
2121
|
}, [load]);
|
|
2122
|
+
const handleOpenExportModal = () => {
|
|
2123
|
+
if (dateFields.length === 0) {
|
|
2124
|
+
try {
|
|
2125
|
+
exportCollectionToExcel(collection, entries);
|
|
2126
|
+
message.success(t.exportSuccess);
|
|
2127
|
+
} catch (err) {
|
|
2128
|
+
console.error("Error exportando a Excel:", err);
|
|
2129
|
+
message.error("No se pudo exportar a Excel.");
|
|
2130
|
+
}
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
setIsExportModalOpen(true);
|
|
2134
|
+
};
|
|
2135
|
+
const handleConfirmExport = () => {
|
|
2136
|
+
try {
|
|
2137
|
+
let suffix = "";
|
|
2138
|
+
if (exportMode === "byDate" && exportDateRange?.[0] && exportDateRange?.[1]) {
|
|
2139
|
+
suffix = `${(collection.name || collection.id).toLowerCase()}_${exportDateRange[0].format("YYYYMMDD")}_al_${exportDateRange[1].format("YYYYMMDD")}`;
|
|
2140
|
+
}
|
|
2141
|
+
exportCollectionToExcel(collection, exportTargetEntries, suffix);
|
|
2142
|
+
message.success(t.exportSuccess);
|
|
2143
|
+
setIsExportModalOpen(false);
|
|
2144
|
+
} catch (err) {
|
|
2145
|
+
console.error("Error exportando a Excel:", err);
|
|
2146
|
+
message.error("No se pudo exportar a Excel.");
|
|
2147
|
+
}
|
|
2148
|
+
};
|
|
2149
|
+
const handleProcessImportFile = async (file) => {
|
|
2150
|
+
setIsParsingImport(true);
|
|
2151
|
+
setImportFile(file);
|
|
2152
|
+
try {
|
|
2153
|
+
const res = await parseExcelForCollection(file, collection, entries);
|
|
2154
|
+
setImportResult(res);
|
|
2155
|
+
if (res.errors.length > 0) {
|
|
2156
|
+
message.warning(res.errors[0]);
|
|
2157
|
+
}
|
|
2158
|
+
} catch (err) {
|
|
2159
|
+
console.error("Error parseando archivo Excel:", err);
|
|
2160
|
+
message.error(err?.message || "Error al leer el archivo Excel.");
|
|
2161
|
+
setImportResult(null);
|
|
2162
|
+
setImportFile(null);
|
|
2163
|
+
} finally {
|
|
2164
|
+
setIsParsingImport(false);
|
|
2165
|
+
}
|
|
2166
|
+
};
|
|
2167
|
+
const handleExecuteImport = async () => {
|
|
2168
|
+
if (!importResult || !importResult.records.length) return;
|
|
2169
|
+
setIsImporting(true);
|
|
2170
|
+
const total = importResult.records.length;
|
|
2171
|
+
setImportProgress({ current: 0, total });
|
|
2172
|
+
try {
|
|
2173
|
+
let createdCount = 0;
|
|
2174
|
+
let updatedCount = 0;
|
|
2175
|
+
let omittedCount = 0;
|
|
2176
|
+
for (let i = 0; i < total; i++) {
|
|
2177
|
+
const item = { ...importResult.records[i] };
|
|
2178
|
+
const existing = findExistingEntry(item, entries, collection);
|
|
2179
|
+
if (existing) {
|
|
2180
|
+
if (importExistingAction === "omit") {
|
|
2181
|
+
omittedCount++;
|
|
2182
|
+
} else {
|
|
2183
|
+
const merged = { ...existing, ...item, id: existing.id };
|
|
2184
|
+
if (existing._id) merged._id = existing._id;
|
|
2185
|
+
await ctx.adapter.putEntry(collection.id, merged);
|
|
2186
|
+
updatedCount++;
|
|
2187
|
+
}
|
|
2188
|
+
} else {
|
|
2189
|
+
await ctx.adapter.putEntry(collection.id, item);
|
|
2190
|
+
createdCount++;
|
|
2191
|
+
}
|
|
2192
|
+
setImportProgress({ current: i + 1, total });
|
|
2193
|
+
}
|
|
2194
|
+
if (createdCount > 0 && omittedCount > 0) {
|
|
2195
|
+
message.success(
|
|
2196
|
+
`Se importaron ${createdCount} registros nuevos. Se omitieron ${omittedCount} registros ya existentes.`
|
|
2197
|
+
);
|
|
2198
|
+
} else if (createdCount > 0 && updatedCount > 0) {
|
|
2199
|
+
message.success(
|
|
2200
|
+
`Se crearon ${createdCount} registros y se actualizaron ${updatedCount} existentes.`
|
|
2201
|
+
);
|
|
2202
|
+
} else if (createdCount > 0) {
|
|
2203
|
+
message.success(`Se importaron ${createdCount} registros exitosamente.`);
|
|
2204
|
+
} else if (omittedCount > 0) {
|
|
2205
|
+
message.info(
|
|
2206
|
+
`Los ${omittedCount} registros ya se encontraban creados. No se duplic\xF3 ning\xFAn dato.`
|
|
2207
|
+
);
|
|
2208
|
+
} else if (updatedCount > 0) {
|
|
2209
|
+
message.success(`Se actualizaron ${updatedCount} registros existentes.`);
|
|
2210
|
+
}
|
|
2211
|
+
load();
|
|
2212
|
+
setIsImportModalOpen(false);
|
|
2213
|
+
setImportResult(null);
|
|
2214
|
+
setImportFile(null);
|
|
2215
|
+
} catch (err) {
|
|
2216
|
+
console.error("Error importando registros:", err);
|
|
2217
|
+
message.error("Ocurri\xF3 un error al guardar los registros importados.");
|
|
2218
|
+
} finally {
|
|
2219
|
+
setIsImporting(false);
|
|
2220
|
+
}
|
|
2221
|
+
};
|
|
1804
2222
|
const startNew = () => {
|
|
2223
|
+
if (collection.customCreateView) {
|
|
2224
|
+
setIsCustomCreating(true);
|
|
2225
|
+
return;
|
|
2226
|
+
}
|
|
1805
2227
|
setIsCreatingManual(true);
|
|
1806
2228
|
setOriginalId(null);
|
|
1807
2229
|
setDuplicateErrors({});
|
|
@@ -1988,23 +2410,80 @@ function CollectionEditor({ collection }) {
|
|
|
1988
2410
|
};
|
|
1989
2411
|
const visibleFields = collection.tableFields?.length ? collection.tableFields.map((tf) => collection.fields.find((f) => f.id === tf)).filter(Boolean) : collection.fields.filter((f) => !["richtext", "list", "password"].includes(f.type) && f.id !== "order" && !f.hidden).slice(0, 6);
|
|
1990
2412
|
const isCreatingEntry = isCreatingManual || (editing ? !entries.some((entry) => entry.id && entry.id === editing.id || entry._id && entry._id === (editing._id || editing.id)) : false);
|
|
2413
|
+
if (isCustomCreating && collection.customCreateView) {
|
|
2414
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full", children: collection.customCreateView({
|
|
2415
|
+
onBack: () => setIsCustomCreating(false),
|
|
2416
|
+
reload: () => {
|
|
2417
|
+
load();
|
|
2418
|
+
}
|
|
2419
|
+
}) });
|
|
2420
|
+
}
|
|
2421
|
+
if (customActiveView) {
|
|
2422
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full", children: customActiveView({
|
|
2423
|
+
onBack: () => setCustomActiveView(null),
|
|
2424
|
+
reload: () => {
|
|
2425
|
+
load();
|
|
2426
|
+
}
|
|
2427
|
+
}) });
|
|
2428
|
+
}
|
|
2429
|
+
if (customViewingRecord && (collection.customDetailView || collection.renderCustomDetail || collection.customEditView)) {
|
|
2430
|
+
const renderFn = isCustomEditing && collection.customEditView ? collection.customEditView : collection.customDetailView || collection.renderCustomDetail;
|
|
2431
|
+
if (renderFn) {
|
|
2432
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full", children: renderFn({
|
|
2433
|
+
record: customViewingRecord,
|
|
2434
|
+
isEditing: isCustomEditing,
|
|
2435
|
+
onBack: () => {
|
|
2436
|
+
setCustomViewingRecord(null);
|
|
2437
|
+
setIsCustomEditing(false);
|
|
2438
|
+
},
|
|
2439
|
+
reload: () => {
|
|
2440
|
+
load();
|
|
2441
|
+
}
|
|
2442
|
+
}) });
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
1991
2445
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-5xl", children: [
|
|
1992
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-8 flex items-center justify-between", children: [
|
|
2446
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-8 flex flex-col sm:flex-row sm:items-center justify-between gap-4", children: [
|
|
1993
2447
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1994
2448
|
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: collection.name }),
|
|
1995
2449
|
collection.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500 mt-1", children: collection.description })
|
|
1996
2450
|
] }),
|
|
1997
|
-
/* @__PURE__ */
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2451
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
2452
|
+
!collection.disableExport && /* @__PURE__ */ jsx(
|
|
2453
|
+
Button,
|
|
2454
|
+
{
|
|
2455
|
+
size: "large",
|
|
2456
|
+
icon: /* @__PURE__ */ jsx(FileDown, { className: "h-4 w-4 text-emerald-600" }),
|
|
2457
|
+
onClick: handleOpenExportModal,
|
|
2458
|
+
disabled: loadingEntries || entries.length === 0,
|
|
2459
|
+
className: "rounded-xl font-medium border-slate-200 hover:border-emerald-500 hover:text-emerald-600 shadow-sm",
|
|
2460
|
+
title: "Descargar registros en formato Excel (soporta filtro por fechas)",
|
|
2461
|
+
children: t.exportExcel
|
|
2462
|
+
}
|
|
2463
|
+
),
|
|
2464
|
+
!collection.disableImport && /* @__PURE__ */ jsx(
|
|
2465
|
+
Button,
|
|
2466
|
+
{
|
|
2467
|
+
size: "large",
|
|
2468
|
+
icon: /* @__PURE__ */ jsx(FileUp, { className: "h-4 w-4 text-sky-600" }),
|
|
2469
|
+
onClick: () => setIsImportModalOpen(true),
|
|
2470
|
+
className: "rounded-xl font-medium border-slate-200 hover:border-sky-500 hover:text-sky-600 shadow-sm",
|
|
2471
|
+
title: "Cargar registros desde un archivo Excel o CSV",
|
|
2472
|
+
children: t.importExcel
|
|
2473
|
+
}
|
|
2474
|
+
),
|
|
2475
|
+
/* @__PURE__ */ jsx(
|
|
2476
|
+
Button,
|
|
2477
|
+
{
|
|
2478
|
+
type: "primary",
|
|
2479
|
+
size: "large",
|
|
2480
|
+
icon: /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
|
|
2481
|
+
onClick: startNew,
|
|
2482
|
+
className: "rounded-xl font-bold shadow-sm",
|
|
2483
|
+
children: t.newEntry
|
|
2484
|
+
}
|
|
2485
|
+
)
|
|
2486
|
+
] })
|
|
2008
2487
|
] }),
|
|
2009
2488
|
!editing && (collection.searchBy?.length || collection.filterBy?.length) && /* @__PURE__ */ jsxs("div", { className: "mb-6 flex flex-wrap gap-4 items-center p-4 bg-white rounded-2xl border border-slate-200 shadow-sm animate-in fade-in slide-in-from-top-2", children: [
|
|
2010
2489
|
collection.searchBy?.length ? /* @__PURE__ */ jsx("div", { className: "relative flex-1 min-w-[220px]", children: /* @__PURE__ */ jsx(
|
|
@@ -2029,7 +2508,7 @@ function CollectionEditor({ collection }) {
|
|
|
2029
2508
|
const fieldDef = collection.fields.find((cf) => cf.id === f);
|
|
2030
2509
|
if (!fieldDef) return null;
|
|
2031
2510
|
if (fieldDef.type === "date") {
|
|
2032
|
-
const dateVal = filters[f] ?
|
|
2511
|
+
const dateVal = filters[f] ? dayjs2(filters[f], ["YYYY/MM/DD", "YYYY-MM-DD", "YYYY-M-D"]).isValid() ? dayjs2(filters[f], ["YYYY/MM/DD", "YYYY-MM-DD", "YYYY-M-D"]) : null : null;
|
|
2033
2512
|
return /* @__PURE__ */ jsx("div", { className: "min-w-[180px]", children: /* @__PURE__ */ jsx(
|
|
2034
2513
|
DatePicker,
|
|
2035
2514
|
{
|
|
@@ -2184,7 +2663,7 @@ function CollectionEditor({ collection }) {
|
|
|
2184
2663
|
String(editing[f.id]).includes("maps") ? "Ver en Google Maps" : String(editing[f.id])
|
|
2185
2664
|
]
|
|
2186
2665
|
}
|
|
2187
|
-
) : /* @__PURE__ */ jsx("span", { className: "text-xs text-slate-400 py-1 block", children: "\u2014" }) : f.type === "textarea" ? /* @__PURE__ */ jsx("div", { className: "rounded-xl bg-slate-50 border border-slate-200 px-3.5 py-2.5 text-sm text-slate-800 whitespace-pre-line leading-relaxed", children: String(editing[f.id] || "\u2014") }) : f.type === "time" || f.id.toLowerCase().includes("hora") || f.id === "inicioServicio" || f.id === "finServicio" ? /* @__PURE__ */ jsx("div", { className: "rounded-xl bg-slate-50 border border-slate-200 px-3.5 py-2 text-sm text-slate-800 font-medium", children: formatTo12Hour(editing[f.id]) || String(editing[f.id] ?? "\u2014") }) : /* @__PURE__ */ jsx("div", { className: "rounded-xl bg-slate-50 border border-slate-200 px-3.5 py-2 text-sm text-slate-800 font-medium", children: String(editing[f.id] ?? "\u2014") })
|
|
2666
|
+
) : /* @__PURE__ */ jsx("span", { className: "text-xs text-slate-400 py-1 block", children: "\u2014" }) : f.type === "textarea" ? /* @__PURE__ */ jsx("div", { className: "rounded-xl bg-slate-50 border border-slate-200 px-3.5 py-2.5 text-sm text-slate-800 whitespace-pre-line leading-relaxed", children: String(editing[f.id] || "\u2014") }) : f.type === "time" || f.id.toLowerCase().includes("hora") || f.id === "inicioServicio" || f.id === "finServicio" ? /* @__PURE__ */ jsx("div", { className: "rounded-xl bg-slate-50 border border-slate-200 px-3.5 py-2 text-sm text-slate-800 font-medium", children: formatTo12Hour(editing[f.id]) || String(editing[f.id] ?? "\u2014") }) : f.renderCell ? /* @__PURE__ */ jsx("div", { className: "rounded-xl bg-slate-50 border border-slate-200 px-3.5 py-2 text-sm text-slate-800 font-medium", children: f.renderCell(editing[f.id], editing) }) : /* @__PURE__ */ jsx("div", { className: "rounded-xl bg-slate-50 border border-slate-200 px-3.5 py-2 text-sm text-slate-800 font-medium", children: String(editing[f.id] ?? "\u2014") })
|
|
2188
2667
|
] }, f.id);
|
|
2189
2668
|
}
|
|
2190
2669
|
return /* @__PURE__ */ jsxs("div", { className: `block ${colSpanClass}`, children: [
|
|
@@ -2235,7 +2714,7 @@ function CollectionEditor({ collection }) {
|
|
|
2235
2714
|
DatePicker,
|
|
2236
2715
|
{
|
|
2237
2716
|
size: "large",
|
|
2238
|
-
value: editing[f.id] ?
|
|
2717
|
+
value: editing[f.id] ? dayjs2(String(editing[f.id])).isValid() ? dayjs2(String(editing[f.id])) : null : null,
|
|
2239
2718
|
onChange: (date, dateString) => setEditing({ ...editing, [f.id]: (Array.isArray(dateString) ? dateString[0] : dateString) || (date ? date.format("YYYY/MM/DD") : "") }),
|
|
2240
2719
|
format: "YYYY/MM/DD",
|
|
2241
2720
|
placeholder: `Seleccionar ${f.label.toLowerCase()}...`,
|
|
@@ -2775,6 +3254,304 @@ function CollectionEditor({ collection }) {
|
|
|
2775
3254
|
] }) })
|
|
2776
3255
|
}
|
|
2777
3256
|
),
|
|
3257
|
+
/* @__PURE__ */ jsx(
|
|
3258
|
+
Modal,
|
|
3259
|
+
{
|
|
3260
|
+
open: isExportModalOpen,
|
|
3261
|
+
title: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-slate-900 font-bold text-lg", children: [
|
|
3262
|
+
/* @__PURE__ */ jsx(FileDown, { className: "h-5 w-5 text-emerald-600" }),
|
|
3263
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
3264
|
+
t.exportModalTitle,
|
|
3265
|
+
" - ",
|
|
3266
|
+
collection.name
|
|
3267
|
+
] })
|
|
3268
|
+
] }),
|
|
3269
|
+
onCancel: () => setIsExportModalOpen(false),
|
|
3270
|
+
footer: null,
|
|
3271
|
+
centered: true,
|
|
3272
|
+
width: "min(560px, calc(100vw - 32px))",
|
|
3273
|
+
mask: { blur: true },
|
|
3274
|
+
children: /* @__PURE__ */ jsxs("div", { className: "py-2 space-y-4", children: [
|
|
3275
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500", children: "Descarga los registros en formato Excel estructurado (.xlsx)." }),
|
|
3276
|
+
/* @__PURE__ */ jsx(
|
|
3277
|
+
Segmented,
|
|
3278
|
+
{
|
|
3279
|
+
size: "large",
|
|
3280
|
+
block: true,
|
|
3281
|
+
value: exportMode,
|
|
3282
|
+
onChange: (val) => setExportMode(val),
|
|
3283
|
+
options: [
|
|
3284
|
+
{ label: `${t.exportAllRecords} (${entries.length})`, value: "all" },
|
|
3285
|
+
{ label: t.exportFilterByDate, value: "byDate" }
|
|
3286
|
+
]
|
|
3287
|
+
}
|
|
3288
|
+
),
|
|
3289
|
+
exportMode === "byDate" && /* @__PURE__ */ jsxs("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3 animate-in fade-in", children: [
|
|
3290
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
3291
|
+
/* @__PURE__ */ jsxs("label", { className: "text-xs font-semibold text-slate-600", children: [
|
|
3292
|
+
t.exportDateRangeLabel,
|
|
3293
|
+
":"
|
|
3294
|
+
] }),
|
|
3295
|
+
/* @__PURE__ */ jsx(
|
|
3296
|
+
DatePicker.RangePicker,
|
|
3297
|
+
{
|
|
3298
|
+
size: "large",
|
|
3299
|
+
className: "w-full rounded-xl",
|
|
3300
|
+
value: exportDateRange,
|
|
3301
|
+
onChange: (dates) => setExportDateRange(dates),
|
|
3302
|
+
presets: [
|
|
3303
|
+
{ label: "Hoy", value: [dayjs2().startOf("day"), dayjs2().endOf("day")] },
|
|
3304
|
+
{ label: "Esta semana", value: [dayjs2().startOf("week"), dayjs2().endOf("week")] },
|
|
3305
|
+
{ label: "Este mes", value: [dayjs2().startOf("month"), dayjs2().endOf("month")] },
|
|
3306
|
+
{ label: "\xDAltimos 30 d\xEDas", value: [dayjs2().subtract(30, "day"), dayjs2()] },
|
|
3307
|
+
{ label: "Este a\xF1o", value: [dayjs2().startOf("year"), dayjs2().endOf("year")] }
|
|
3308
|
+
]
|
|
3309
|
+
}
|
|
3310
|
+
)
|
|
3311
|
+
] }),
|
|
3312
|
+
/* @__PURE__ */ jsxs("div", { className: "pt-1 flex items-center justify-between text-xs", children: [
|
|
3313
|
+
/* @__PURE__ */ jsx("span", { className: "text-slate-500 font-medium", children: "Registros coincidentes:" }),
|
|
3314
|
+
/* @__PURE__ */ jsxs(
|
|
3315
|
+
"span",
|
|
3316
|
+
{
|
|
3317
|
+
className: `font-bold ${exportTargetEntries.length > 0 ? "text-emerald-600" : "text-amber-600"}`,
|
|
3318
|
+
children: [
|
|
3319
|
+
exportTargetEntries.length,
|
|
3320
|
+
" de ",
|
|
3321
|
+
entries.length,
|
|
3322
|
+
" registros"
|
|
3323
|
+
]
|
|
3324
|
+
}
|
|
3325
|
+
)
|
|
3326
|
+
] })
|
|
3327
|
+
] }),
|
|
3328
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
3329
|
+
/* @__PURE__ */ jsx(Button, { size: "large", onClick: () => setIsExportModalOpen(false), children: t.cancel }),
|
|
3330
|
+
/* @__PURE__ */ jsxs(
|
|
3331
|
+
Button,
|
|
3332
|
+
{
|
|
3333
|
+
type: "primary",
|
|
3334
|
+
size: "large",
|
|
3335
|
+
icon: /* @__PURE__ */ jsx(FileDown, { className: "h-4 w-4" }),
|
|
3336
|
+
onClick: handleConfirmExport,
|
|
3337
|
+
disabled: exportTargetEntries.length === 0,
|
|
3338
|
+
className: "rounded-xl font-bold bg-emerald-600 hover:bg-emerald-500",
|
|
3339
|
+
children: [
|
|
3340
|
+
t.exportDownloadBtn,
|
|
3341
|
+
" (",
|
|
3342
|
+
exportTargetEntries.length,
|
|
3343
|
+
")"
|
|
3344
|
+
]
|
|
3345
|
+
}
|
|
3346
|
+
)
|
|
3347
|
+
] })
|
|
3348
|
+
] })
|
|
3349
|
+
}
|
|
3350
|
+
),
|
|
3351
|
+
/* @__PURE__ */ jsx(
|
|
3352
|
+
Modal,
|
|
3353
|
+
{
|
|
3354
|
+
open: isImportModalOpen,
|
|
3355
|
+
title: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-slate-900 font-bold text-lg", children: [
|
|
3356
|
+
/* @__PURE__ */ jsx(FileSpreadsheet, { className: "h-5 w-5 text-emerald-600" }),
|
|
3357
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
3358
|
+
t.importModalTitle,
|
|
3359
|
+
" - ",
|
|
3360
|
+
collection.name
|
|
3361
|
+
] })
|
|
3362
|
+
] }),
|
|
3363
|
+
onCancel: () => {
|
|
3364
|
+
if (!isImporting) {
|
|
3365
|
+
setIsImportModalOpen(false);
|
|
3366
|
+
setImportResult(null);
|
|
3367
|
+
setImportFile(null);
|
|
3368
|
+
}
|
|
3369
|
+
},
|
|
3370
|
+
footer: null,
|
|
3371
|
+
centered: true,
|
|
3372
|
+
width: "min(800px, calc(100vw - 32px))",
|
|
3373
|
+
mask: { blur: true },
|
|
3374
|
+
children: /* @__PURE__ */ jsxs("div", { className: "py-2 space-y-4", children: [
|
|
3375
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500", children: t.importModalDesc }),
|
|
3376
|
+
!importResult ? /* @__PURE__ */ jsxs(
|
|
3377
|
+
"div",
|
|
3378
|
+
{
|
|
3379
|
+
onDragOver: (e) => {
|
|
3380
|
+
e.preventDefault();
|
|
3381
|
+
e.stopPropagation();
|
|
3382
|
+
},
|
|
3383
|
+
onDrop: (e) => {
|
|
3384
|
+
e.preventDefault();
|
|
3385
|
+
e.stopPropagation();
|
|
3386
|
+
const file = e.dataTransfer.files?.[0];
|
|
3387
|
+
if (file) handleProcessImportFile(file);
|
|
3388
|
+
},
|
|
3389
|
+
onClick: () => fileInputRef.current?.click(),
|
|
3390
|
+
className: "border-2 border-dashed border-slate-300 hover:border-emerald-500 rounded-2xl p-8 text-center cursor-pointer bg-slate-50 hover:bg-emerald-50/30 transition-all flex flex-col items-center justify-center gap-3",
|
|
3391
|
+
children: [
|
|
3392
|
+
/* @__PURE__ */ jsx(
|
|
3393
|
+
"input",
|
|
3394
|
+
{
|
|
3395
|
+
ref: fileInputRef,
|
|
3396
|
+
type: "file",
|
|
3397
|
+
accept: ".xlsx,.xls,.csv",
|
|
3398
|
+
className: "hidden",
|
|
3399
|
+
onChange: (e) => {
|
|
3400
|
+
const file = e.target.files?.[0];
|
|
3401
|
+
if (file) handleProcessImportFile(file);
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
),
|
|
3405
|
+
/* @__PURE__ */ jsx("div", { className: "size-14 rounded-full bg-emerald-100 flex items-center justify-center text-emerald-600 shadow-sm", children: /* @__PURE__ */ jsx(FileSpreadsheet, { className: "size-7" }) }),
|
|
3406
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3407
|
+
/* @__PURE__ */ jsx("p", { className: "font-semibold text-sm text-slate-700", children: t.importDropzone }),
|
|
3408
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-slate-400 mt-1", children: t.importDropzoneSub })
|
|
3409
|
+
] }),
|
|
3410
|
+
/* @__PURE__ */ jsx(Button, { size: "middle", loading: isParsingImport, className: "mt-2 rounded-lg font-medium", children: isParsingImport ? "Leyendo archivo..." : "Seleccionar archivo" })
|
|
3411
|
+
]
|
|
3412
|
+
}
|
|
3413
|
+
) : /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
3414
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-3.5 bg-emerald-50/60 border border-emerald-200 rounded-xl", children: [
|
|
3415
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3416
|
+
/* @__PURE__ */ jsx("div", { className: "size-9 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center font-bold", children: /* @__PURE__ */ jsx(FileSpreadsheet, { className: "size-5" }) }),
|
|
3417
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3418
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-bold text-slate-900", children: importFile?.name }),
|
|
3419
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-emerald-700 font-medium", children: [
|
|
3420
|
+
importResult.totalRows,
|
|
3421
|
+
" registros encontrados en el archivo"
|
|
3422
|
+
] })
|
|
3423
|
+
] })
|
|
3424
|
+
] }),
|
|
3425
|
+
/* @__PURE__ */ jsx(
|
|
3426
|
+
Button,
|
|
3427
|
+
{
|
|
3428
|
+
size: "small",
|
|
3429
|
+
onClick: () => {
|
|
3430
|
+
setImportResult(null);
|
|
3431
|
+
setImportFile(null);
|
|
3432
|
+
},
|
|
3433
|
+
disabled: isImporting,
|
|
3434
|
+
children: "Cambiar archivo"
|
|
3435
|
+
}
|
|
3436
|
+
)
|
|
3437
|
+
] }),
|
|
3438
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 p-3 bg-slate-50 border border-slate-200 rounded-xl", children: [
|
|
3439
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-slate-700", children: "Estado de los registros:" }),
|
|
3440
|
+
/* @__PURE__ */ jsxs(Tag, { color: "green", className: "text-xs font-medium", children: [
|
|
3441
|
+
"\u2713 ",
|
|
3442
|
+
importResult.newRecordsCount,
|
|
3443
|
+
" ",
|
|
3444
|
+
t.importNewDetected
|
|
3445
|
+
] }),
|
|
3446
|
+
importResult.existingRecordsCount > 0 && /* @__PURE__ */ jsxs(Tag, { color: "gold", className: "text-xs font-medium", children: [
|
|
3447
|
+
"\u2139\uFE0F ",
|
|
3448
|
+
importResult.existingRecordsCount,
|
|
3449
|
+
" ",
|
|
3450
|
+
t.importExistingDetected
|
|
3451
|
+
] })
|
|
3452
|
+
] }),
|
|
3453
|
+
importResult.existingRecordsCount > 0 && /* @__PURE__ */ jsxs("div", { className: "p-3.5 bg-slate-50/90 rounded-xl border border-slate-200 space-y-2", children: [
|
|
3454
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-slate-700 block", children: t.importOverwritesWarning }),
|
|
3455
|
+
/* @__PURE__ */ jsxs(
|
|
3456
|
+
Radio.Group,
|
|
3457
|
+
{
|
|
3458
|
+
value: importExistingAction,
|
|
3459
|
+
onChange: (e) => setImportExistingAction(e.target.value),
|
|
3460
|
+
disabled: isImporting,
|
|
3461
|
+
className: "flex flex-col gap-2.5",
|
|
3462
|
+
children: [
|
|
3463
|
+
/* @__PURE__ */ jsxs(Radio, { value: "omit", className: "text-xs text-slate-700", children: [
|
|
3464
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-emerald-700 block", children: t.importExistingOmit }),
|
|
3465
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-slate-500 block", children: "Si ya existe por ID o campo \xFAnico, no se vuelve a crear ni duplicar en la base de datos." })
|
|
3466
|
+
] }),
|
|
3467
|
+
/* @__PURE__ */ jsxs(Radio, { value: "update", className: "text-xs text-slate-700", children: [
|
|
3468
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-sky-700 block", children: t.importExistingUpdate }),
|
|
3469
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-slate-500 block", children: "Actualiza los campos de los registros ya existentes con los datos del archivo." })
|
|
3470
|
+
] })
|
|
3471
|
+
]
|
|
3472
|
+
}
|
|
3473
|
+
)
|
|
3474
|
+
] }),
|
|
3475
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3476
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-bold text-slate-600 uppercase tracking-wider block mb-1.5", children: [
|
|
3477
|
+
"Campos reconocidos (",
|
|
3478
|
+
importResult.matchedFields.length,
|
|
3479
|
+
"):"
|
|
3480
|
+
] }),
|
|
3481
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1.5", children: [
|
|
3482
|
+
importResult.matchedFields.map((m, idx) => /* @__PURE__ */ jsxs(Tag, { color: "green", className: "text-xs py-0.5", children: [
|
|
3483
|
+
"\u2713 ",
|
|
3484
|
+
m.label
|
|
3485
|
+
] }, idx)),
|
|
3486
|
+
importResult.unmatchedHeaders.map((u, idx) => /* @__PURE__ */ jsxs(Tag, { color: "orange", className: "text-xs py-0.5", children: [
|
|
3487
|
+
"\u26A0\uFE0F ",
|
|
3488
|
+
u,
|
|
3489
|
+
" (omitido)"
|
|
3490
|
+
] }, idx))
|
|
3491
|
+
] })
|
|
3492
|
+
] }),
|
|
3493
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3494
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-bold text-slate-600 uppercase tracking-wider block mb-1.5", children: [
|
|
3495
|
+
t.importPreviewTitle,
|
|
3496
|
+
" (",
|
|
3497
|
+
Math.min(5, importResult.samplePreview.length),
|
|
3498
|
+
" de ",
|
|
3499
|
+
importResult.totalRows,
|
|
3500
|
+
"):"
|
|
3501
|
+
] }),
|
|
3502
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto border border-slate-200 rounded-xl max-h-48 text-xs", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-left", children: [
|
|
3503
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-slate-100/80 text-slate-700 font-semibold border-b border-slate-200", children: /* @__PURE__ */ jsx("tr", { children: importResult.matchedFields.slice(0, 6).map((m, idx) => /* @__PURE__ */ jsx("th", { className: "p-2 whitespace-nowrap", children: m.label }, idx)) }) }),
|
|
3504
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-slate-100", children: importResult.samplePreview.map((row, rIdx) => /* @__PURE__ */ jsx("tr", { className: "hover:bg-slate-50/60", children: importResult.matchedFields.slice(0, 6).map((m, cIdx) => /* @__PURE__ */ jsx("td", { className: "p-2 whitespace-nowrap max-w-[160px] truncate text-slate-600", children: String(row[m.fieldId] ?? "") }, cIdx)) }, rIdx)) })
|
|
3505
|
+
] }) })
|
|
3506
|
+
] }),
|
|
3507
|
+
isImporting && /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
3508
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-xs text-slate-600 font-medium", children: [
|
|
3509
|
+
/* @__PURE__ */ jsx("span", { children: t.importingProgress }),
|
|
3510
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
3511
|
+
importProgress.current,
|
|
3512
|
+
" / ",
|
|
3513
|
+
importProgress.total
|
|
3514
|
+
] })
|
|
3515
|
+
] }),
|
|
3516
|
+
/* @__PURE__ */ jsx(
|
|
3517
|
+
Progress,
|
|
3518
|
+
{
|
|
3519
|
+
percent: Math.round(importProgress.current / (importProgress.total || 1) * 100),
|
|
3520
|
+
status: "active"
|
|
3521
|
+
}
|
|
3522
|
+
)
|
|
3523
|
+
] }),
|
|
3524
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
3525
|
+
/* @__PURE__ */ jsx(
|
|
3526
|
+
Button,
|
|
3527
|
+
{
|
|
3528
|
+
size: "large",
|
|
3529
|
+
onClick: () => setIsImportModalOpen(false),
|
|
3530
|
+
disabled: isImporting,
|
|
3531
|
+
children: t.cancel
|
|
3532
|
+
}
|
|
3533
|
+
),
|
|
3534
|
+
/* @__PURE__ */ jsxs(
|
|
3535
|
+
Button,
|
|
3536
|
+
{
|
|
3537
|
+
type: "primary",
|
|
3538
|
+
size: "large",
|
|
3539
|
+
loading: isImporting,
|
|
3540
|
+
onClick: handleExecuteImport,
|
|
3541
|
+
className: "rounded-xl font-bold bg-emerald-600 hover:bg-emerald-500",
|
|
3542
|
+
children: [
|
|
3543
|
+
t.importConfirmBtn,
|
|
3544
|
+
" (",
|
|
3545
|
+
importExistingAction === "omit" && importResult.existingRecordsCount > 0 ? importResult.newRecordsCount : importResult.totalRows,
|
|
3546
|
+
")"
|
|
3547
|
+
]
|
|
3548
|
+
}
|
|
3549
|
+
)
|
|
3550
|
+
] })
|
|
3551
|
+
] })
|
|
3552
|
+
] })
|
|
3553
|
+
}
|
|
3554
|
+
),
|
|
2778
3555
|
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-sm text-left", children: [
|
|
2779
3556
|
/* @__PURE__ */ jsx("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
2780
3557
|
visibleFields.map((f) => /* @__PURE__ */ jsx("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: f.label }, f.id)),
|
|
@@ -2868,10 +3645,52 @@ function CollectionEditor({ collection }) {
|
|
|
2868
3645
|
}
|
|
2869
3646
|
) : f.type === "time" || f.id.toLowerCase().includes("hora") || f.id === "inicioServicio" || f.id === "finServicio" ? formatTo12Hour(e[f.id]) || String(e[f.id] ?? "") : String(e[f.id] ?? "") }, f.id)),
|
|
2870
3647
|
/* @__PURE__ */ jsx("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-1.5", children: [
|
|
2871
|
-
|
|
3648
|
+
collection.customRowActions && collection.customRowActions({
|
|
3649
|
+
record: e,
|
|
3650
|
+
openDetail: () => {
|
|
3651
|
+
if (collection.customDetailView || collection.renderCustomDetail) {
|
|
3652
|
+
setCustomViewingRecord(e);
|
|
3653
|
+
setIsCustomEditing(false);
|
|
3654
|
+
return;
|
|
3655
|
+
}
|
|
3656
|
+
if (collection.onViewRecord) {
|
|
3657
|
+
collection.onViewRecord(e);
|
|
3658
|
+
return;
|
|
3659
|
+
}
|
|
3660
|
+
setIsCreatingManual(false);
|
|
3661
|
+
setIsViewingDetail(true);
|
|
3662
|
+
setOriginalId(String(e.id || ""));
|
|
3663
|
+
setDuplicateErrors({});
|
|
3664
|
+
setEditing({ ...e });
|
|
3665
|
+
},
|
|
3666
|
+
openEdit: () => {
|
|
3667
|
+
if (collection.customEditView) {
|
|
3668
|
+
setCustomViewingRecord(e);
|
|
3669
|
+
setIsCustomEditing(true);
|
|
3670
|
+
return;
|
|
3671
|
+
}
|
|
3672
|
+
setIsCreatingManual(false);
|
|
3673
|
+
setIsViewingDetail(false);
|
|
3674
|
+
setOriginalId(String(e.id || ""));
|
|
3675
|
+
setDuplicateErrors({});
|
|
3676
|
+
setEditing({ ...e });
|
|
3677
|
+
},
|
|
3678
|
+
openCustomView: (renderFn) => {
|
|
3679
|
+
setCustomActiveView(() => renderFn);
|
|
3680
|
+
},
|
|
3681
|
+
reload: () => {
|
|
3682
|
+
load();
|
|
3683
|
+
}
|
|
3684
|
+
}),
|
|
3685
|
+
(collection.enableDetailView || collection.onViewRecord || collection.customDetailView || collection.renderCustomDetail) && /* @__PURE__ */ jsx(
|
|
2872
3686
|
"button",
|
|
2873
3687
|
{
|
|
2874
3688
|
onClick: () => {
|
|
3689
|
+
if (collection.customDetailView || collection.renderCustomDetail) {
|
|
3690
|
+
setCustomViewingRecord(e);
|
|
3691
|
+
setIsCustomEditing(false);
|
|
3692
|
+
return;
|
|
3693
|
+
}
|
|
2875
3694
|
if (collection.onViewRecord) {
|
|
2876
3695
|
collection.onViewRecord(e);
|
|
2877
3696
|
return;
|
|
@@ -2900,6 +3719,11 @@ function CollectionEditor({ collection }) {
|
|
|
2900
3719
|
"button",
|
|
2901
3720
|
{
|
|
2902
3721
|
onClick: () => {
|
|
3722
|
+
if (collection.customEditView) {
|
|
3723
|
+
setCustomViewingRecord(e);
|
|
3724
|
+
setIsCustomEditing(true);
|
|
3725
|
+
return;
|
|
3726
|
+
}
|
|
2903
3727
|
setIsCreatingManual(false);
|
|
2904
3728
|
setIsViewingDetail(false);
|
|
2905
3729
|
setOriginalId(String(e.id || ""));
|
|
@@ -2911,7 +3735,7 @@ function CollectionEditor({ collection }) {
|
|
|
2911
3735
|
children: /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4" })
|
|
2912
3736
|
}
|
|
2913
3737
|
),
|
|
2914
|
-
!collection.disableDelete && /* @__PURE__ */ jsx(
|
|
3738
|
+
!collection.disableDelete && !collection.hideDelete && (!collection.canDelete || collection.canDelete(e)) && /* @__PURE__ */ jsx(
|
|
2915
3739
|
"button",
|
|
2916
3740
|
{
|
|
2917
3741
|
onClick: () => remove(e.id),
|