admin-lib-cms 1.2.9 → 1.2.11
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.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +1627 -616
- package/dist/index.mjs +1639 -616
- package/dist/types.d.mts +20 -2
- package/dist/types.d.ts +20 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -22,8 +22,21 @@ import {
|
|
|
22
22
|
} from "./chunk-4KJKAYIC.mjs";
|
|
23
23
|
|
|
24
24
|
// src/admin/AdminApp.tsx
|
|
25
|
-
import { createElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
26
|
-
import {
|
|
25
|
+
import React, { createElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
26
|
+
import { createPortal } from "react-dom";
|
|
27
|
+
import {
|
|
28
|
+
ConfigProvider,
|
|
29
|
+
Modal,
|
|
30
|
+
TimePicker,
|
|
31
|
+
DatePicker,
|
|
32
|
+
Input,
|
|
33
|
+
InputNumber,
|
|
34
|
+
Select,
|
|
35
|
+
Switch,
|
|
36
|
+
Button,
|
|
37
|
+
Image,
|
|
38
|
+
message
|
|
39
|
+
} from "antd";
|
|
27
40
|
import dayjs from "dayjs";
|
|
28
41
|
import {
|
|
29
42
|
FileText,
|
|
@@ -55,8 +68,191 @@ import {
|
|
|
55
68
|
Check,
|
|
56
69
|
GripVertical
|
|
57
70
|
} from "lucide-react";
|
|
71
|
+
|
|
72
|
+
// src/admin/i18n.ts
|
|
73
|
+
var translations = {
|
|
74
|
+
es: {
|
|
75
|
+
menuDashboard: "Dashboard",
|
|
76
|
+
menuPages: "P\xE1ginas",
|
|
77
|
+
menuCollections: "Colecciones",
|
|
78
|
+
menuData: "Datos",
|
|
79
|
+
menuConfig: "Configuraci\xF3n",
|
|
80
|
+
menuSettings: "Ajustes",
|
|
81
|
+
menuSubscription: "Suscripci\xF3n",
|
|
82
|
+
liveEditor: "Editor en vivo",
|
|
83
|
+
viewSite: "Ver sitio",
|
|
84
|
+
signOut: "Cerrar sesi\xF3n",
|
|
85
|
+
signedInAs: "Conectado como",
|
|
86
|
+
saving: "Guardando...",
|
|
87
|
+
saved: "Guardado",
|
|
88
|
+
saveChanges: "Guardar cambios",
|
|
89
|
+
discardChanges: "Descartar",
|
|
90
|
+
unsavedChanges: "Cambios sin guardar",
|
|
91
|
+
desktop: "Escritorio",
|
|
92
|
+
tablet: "Tableta",
|
|
93
|
+
mobile: "M\xF3vil",
|
|
94
|
+
search: "Buscar...",
|
|
95
|
+
filterBy: "Filtrar por...",
|
|
96
|
+
all: "Todos",
|
|
97
|
+
actions: "Acciones",
|
|
98
|
+
edit: "Editar",
|
|
99
|
+
delete: "Eliminar",
|
|
100
|
+
cancel: "Cancelar",
|
|
101
|
+
save: "Guardar",
|
|
102
|
+
create: "Crear",
|
|
103
|
+
newEntry: "Nuevo",
|
|
104
|
+
createNew: "Crear nuevo",
|
|
105
|
+
confirmDeleteTitle: "\xBFEliminar este registro?",
|
|
106
|
+
confirmDeleteText: "Esta acci\xF3n no se puede deshacer.",
|
|
107
|
+
deleteSuccess: "Registro eliminado exitosamente.",
|
|
108
|
+
saveSuccess: "Registro guardado exitosamente.",
|
|
109
|
+
noRecords: "No hay registros disponibles.",
|
|
110
|
+
recordsFound: "registros encontrados",
|
|
111
|
+
back: "Volver",
|
|
112
|
+
apply: "Aplicar",
|
|
113
|
+
close: "Cerrar",
|
|
114
|
+
signatureRegistered: "Firma registrada",
|
|
115
|
+
viewLarger: "Click en la firma para verla en pantalla grande",
|
|
116
|
+
previewMask: "Ver m\xE1s grande",
|
|
117
|
+
addSignature: "AGREGAR FIRMA",
|
|
118
|
+
replaceSignature: "REEMPLAZAR FIRMA",
|
|
119
|
+
uploadImage: "SUBIR IMAGEN",
|
|
120
|
+
uploadNewImage: "SUBIR NUEVA IMAGEN",
|
|
121
|
+
signOnScreen: "Firmar en pantalla",
|
|
122
|
+
signInstructions: "Dibuja la firma en el recuadro usando el dedo o el mouse:",
|
|
123
|
+
clear: "Limpiar",
|
|
124
|
+
saveSignature: "Guardar Firma",
|
|
125
|
+
selectOption: "-- Selecciona una opci\xF3n --",
|
|
126
|
+
loadingOptions: "Cargando opciones...",
|
|
127
|
+
cantFindClient: "\xBFNo encuentras el cliente?",
|
|
128
|
+
createClient: "Crear cliente",
|
|
129
|
+
newBtn: "Nuevo",
|
|
130
|
+
basicDetails: "Datos b\xE1sicos",
|
|
131
|
+
clientType: "Tipo",
|
|
132
|
+
clientDocType: "Tipo de documento",
|
|
133
|
+
clientIdentification: "Identificaci\xF3n",
|
|
134
|
+
clientBranch: "Sucursal o sede",
|
|
135
|
+
clientName: "Nombre",
|
|
136
|
+
clientEmail: "Email",
|
|
137
|
+
clientPhone: "Tel\xE9fono",
|
|
138
|
+
clientCity: "Ciudad",
|
|
139
|
+
clientAddress: "direcci\xF3n",
|
|
140
|
+
clientCreatedSuccess: "Cliente creado y seleccionado exitosamente.",
|
|
141
|
+
idRequired: "La identificaci\xF3n es obligatoria.",
|
|
142
|
+
nameRequired: "El nombre es obligatorio.",
|
|
143
|
+
signInTitle: "Iniciar sesi\xF3n",
|
|
144
|
+
signInSubtitle: "Ingresa tus credenciales para acceder al panel",
|
|
145
|
+
emailLabel: "Correo electr\xF3nico",
|
|
146
|
+
passwordLabel: "Contrase\xF1a",
|
|
147
|
+
signInButton: "Iniciar sesi\xF3n",
|
|
148
|
+
invalidCredentials: "Credenciales inv\xE1lidas",
|
|
149
|
+
loggingIn: "Iniciando sesi\xF3n...",
|
|
150
|
+
submissions: "Mensajes y Formularios",
|
|
151
|
+
noSubmissions: "No hay env\xEDos registrados",
|
|
152
|
+
exportCsv: "Exportar CSV",
|
|
153
|
+
markRead: "Marcar como le\xEDdo",
|
|
154
|
+
settingsTitle: "Ajustes del sitio",
|
|
155
|
+
entries: "registros"
|
|
156
|
+
},
|
|
157
|
+
en: {
|
|
158
|
+
menuDashboard: "Dashboard",
|
|
159
|
+
menuPages: "Pages",
|
|
160
|
+
menuCollections: "Collections",
|
|
161
|
+
menuData: "Data",
|
|
162
|
+
menuConfig: "Settings",
|
|
163
|
+
menuSettings: "Preferences",
|
|
164
|
+
menuSubscription: "Subscription",
|
|
165
|
+
liveEditor: "Live Editor",
|
|
166
|
+
viewSite: "View site",
|
|
167
|
+
signOut: "Sign out",
|
|
168
|
+
signedInAs: "Signed in as",
|
|
169
|
+
saving: "Saving...",
|
|
170
|
+
saved: "Saved",
|
|
171
|
+
saveChanges: "Save changes",
|
|
172
|
+
discardChanges: "Discard",
|
|
173
|
+
unsavedChanges: "Unsaved changes",
|
|
174
|
+
desktop: "Desktop",
|
|
175
|
+
tablet: "Tablet",
|
|
176
|
+
mobile: "Mobile",
|
|
177
|
+
search: "Search...",
|
|
178
|
+
filterBy: "Filter by...",
|
|
179
|
+
all: "All",
|
|
180
|
+
actions: "Actions",
|
|
181
|
+
edit: "Edit",
|
|
182
|
+
delete: "Delete",
|
|
183
|
+
cancel: "Cancel",
|
|
184
|
+
save: "Save",
|
|
185
|
+
create: "Create",
|
|
186
|
+
newEntry: "New",
|
|
187
|
+
createNew: "Create new",
|
|
188
|
+
confirmDeleteTitle: "Delete this record?",
|
|
189
|
+
confirmDeleteText: "This action cannot be undone.",
|
|
190
|
+
deleteSuccess: "Record deleted successfully.",
|
|
191
|
+
saveSuccess: "Record saved successfully.",
|
|
192
|
+
noRecords: "No records found.",
|
|
193
|
+
recordsFound: "records found",
|
|
194
|
+
back: "Back",
|
|
195
|
+
apply: "Apply",
|
|
196
|
+
close: "Close",
|
|
197
|
+
signatureRegistered: "Signature registered",
|
|
198
|
+
viewLarger: "Click signature to view full size",
|
|
199
|
+
previewMask: "View larger",
|
|
200
|
+
addSignature: "ADD SIGNATURE",
|
|
201
|
+
replaceSignature: "REPLACE SIGNATURE",
|
|
202
|
+
uploadImage: "UPLOAD IMAGE",
|
|
203
|
+
uploadNewImage: "UPLOAD NEW IMAGE",
|
|
204
|
+
signOnScreen: "Sign on screen",
|
|
205
|
+
signInstructions: "Draw signature in the box using finger or mouse:",
|
|
206
|
+
clear: "Clear",
|
|
207
|
+
saveSignature: "Save Signature",
|
|
208
|
+
selectOption: "-- Select an option --",
|
|
209
|
+
loadingOptions: "Loading options...",
|
|
210
|
+
cantFindClient: "Can't find the client?",
|
|
211
|
+
createClient: "Create client",
|
|
212
|
+
newBtn: "New",
|
|
213
|
+
basicDetails: "Basic details",
|
|
214
|
+
clientType: "Type",
|
|
215
|
+
clientDocType: "Document type",
|
|
216
|
+
clientIdentification: "Identification",
|
|
217
|
+
clientBranch: "Branch or site",
|
|
218
|
+
clientName: "Name",
|
|
219
|
+
clientEmail: "Email",
|
|
220
|
+
clientPhone: "Phone",
|
|
221
|
+
clientCity: "City",
|
|
222
|
+
clientAddress: "Address",
|
|
223
|
+
clientCreatedSuccess: "Client created and selected successfully.",
|
|
224
|
+
idRequired: "Identification is required.",
|
|
225
|
+
nameRequired: "Name is required.",
|
|
226
|
+
signInTitle: "Sign In",
|
|
227
|
+
signInSubtitle: "Enter your credentials to access the panel",
|
|
228
|
+
emailLabel: "Email address",
|
|
229
|
+
passwordLabel: "Password",
|
|
230
|
+
signInButton: "Sign In",
|
|
231
|
+
invalidCredentials: "Invalid credentials",
|
|
232
|
+
loggingIn: "Signing in...",
|
|
233
|
+
submissions: "Form Submissions",
|
|
234
|
+
noSubmissions: "No submissions yet",
|
|
235
|
+
exportCsv: "Export CSV",
|
|
236
|
+
markRead: "Mark as read",
|
|
237
|
+
settingsTitle: "Site Settings",
|
|
238
|
+
entries: "entries"
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
function getAdminTranslations(locale) {
|
|
242
|
+
const norm = String(locale || "").trim().toLowerCase();
|
|
243
|
+
if (norm === "es" || norm.startsWith("es-")) {
|
|
244
|
+
return translations.es;
|
|
245
|
+
}
|
|
246
|
+
return translations.en;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// src/admin/AdminApp.tsx
|
|
58
250
|
import { CreditCard, BarChart3 } from "lucide-react";
|
|
59
251
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
252
|
+
var AdminI18nContext = React.createContext(getAdminTranslations("en"));
|
|
253
|
+
function useAdminI18n() {
|
|
254
|
+
return React.useContext(AdminI18nContext);
|
|
255
|
+
}
|
|
60
256
|
var TIME_STORAGE_FORMAT = "HH:mm";
|
|
61
257
|
var TIME_DISPLAY_FORMAT = "h:mm A";
|
|
62
258
|
var TIME_PICKER_THEME = {
|
|
@@ -97,23 +293,24 @@ function AdminTimeRangePicker(props) {
|
|
|
97
293
|
}
|
|
98
294
|
) });
|
|
99
295
|
}
|
|
100
|
-
function AdminTimePicker(props) {
|
|
101
|
-
return /* @__PURE__ */ jsx(ConfigProvider, { theme: TIME_PICKER_THEME, children: /* @__PURE__ */ jsx(
|
|
102
|
-
TimePicker,
|
|
103
|
-
{
|
|
104
|
-
...props,
|
|
105
|
-
className: `w-full min-w-0 ${props.className ?? ""}`,
|
|
106
|
-
style: {
|
|
107
|
-
boxShadow: "0 1px 2px rgba(15, 23, 42, 0.08)",
|
|
108
|
-
...props.style
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
) });
|
|
112
|
-
}
|
|
113
296
|
function toDayjsTime(value) {
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
116
|
-
|
|
297
|
+
const str = String(value ?? "").trim();
|
|
298
|
+
if (!str) return null;
|
|
299
|
+
const match12 = /^(\d{1,2}):(\d{2})\s*([ap]\.?m\.?)$/i.exec(str);
|
|
300
|
+
if (match12) {
|
|
301
|
+
let h = Number(match12[1]);
|
|
302
|
+
const m = Number(match12[2]);
|
|
303
|
+
const isPm = match12[3].toLowerCase().startsWith("p");
|
|
304
|
+
if (isPm && h < 12) h += 12;
|
|
305
|
+
if (!isPm && h === 12) h = 0;
|
|
306
|
+
return dayjs().hour(h).minute(m).second(0).millisecond(0);
|
|
307
|
+
}
|
|
308
|
+
const match24 = /^([01]?\d|2[0-3]):([0-5]\d)$/.exec(str);
|
|
309
|
+
if (match24) {
|
|
310
|
+
return dayjs().hour(Number(match24[1])).minute(Number(match24[2])).second(0).millisecond(0);
|
|
311
|
+
}
|
|
312
|
+
const parsed = dayjs(str, ["h:mm a", "h:mm A", "hh:mm a", "hh:mm A", "HH:mm"]);
|
|
313
|
+
return parsed.isValid() ? parsed : null;
|
|
117
314
|
}
|
|
118
315
|
function toStoredTime(value) {
|
|
119
316
|
return value?.format(TIME_STORAGE_FORMAT) ?? "";
|
|
@@ -174,6 +371,8 @@ function AdminApp(props) {
|
|
|
174
371
|
}
|
|
175
372
|
function AdminAppContent(props) {
|
|
176
373
|
const ctx = useCmsContext();
|
|
374
|
+
const rawLocale = props.locale ?? props.lang ?? ctx.config.locale ?? ctx.config.lang ?? "en";
|
|
375
|
+
const t = useMemo(() => getAdminTranslations(rawLocale), [rawLocale]);
|
|
177
376
|
const hasDashboard = Boolean(props.dashboard);
|
|
178
377
|
const [section, setSection] = useState(hasDashboard ? "dashboard" : "pages");
|
|
179
378
|
const [authChecking, setAuthChecking] = useState(true);
|
|
@@ -183,13 +382,13 @@ function AdminAppContent(props) {
|
|
|
183
382
|
const hideGlobals = props.hideGlobals ?? ctx.config.hideGlobals ?? false;
|
|
184
383
|
const hideConfig = props.hideConfig ?? ctx.config.hideConfig ?? false;
|
|
185
384
|
const menuLabels = {
|
|
186
|
-
dashboard:
|
|
187
|
-
pages:
|
|
188
|
-
collections:
|
|
189
|
-
data:
|
|
190
|
-
config:
|
|
191
|
-
settings:
|
|
192
|
-
subscription:
|
|
385
|
+
dashboard: t.menuDashboard,
|
|
386
|
+
pages: t.menuPages,
|
|
387
|
+
collections: t.menuCollections,
|
|
388
|
+
data: t.menuData,
|
|
389
|
+
config: t.menuConfig,
|
|
390
|
+
settings: t.menuSettings,
|
|
391
|
+
subscription: t.menuSubscription,
|
|
193
392
|
...ctx.config.menuLabels,
|
|
194
393
|
...props.menuLabels
|
|
195
394
|
};
|
|
@@ -225,7 +424,7 @@ function AdminAppContent(props) {
|
|
|
225
424
|
if (!isSubscriptionActive) {
|
|
226
425
|
return /* @__PURE__ */ jsx("div", { className: "flex flex-col lg:flex-row h-screen w-full overflow-hidden bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900", children: /* @__PURE__ */ jsx(SubscriptionPage, {}) });
|
|
227
426
|
}
|
|
228
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-screen w-full bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900 overflow-hidden", children: [
|
|
427
|
+
return /* @__PURE__ */ jsx(AdminI18nContext.Provider, { value: t, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-screen w-full bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900 overflow-hidden", children: [
|
|
229
428
|
daysOverdue > 0 && daysOverdue <= 15 && /* @__PURE__ */ jsx("div", { className: "bg-amber-400 text-amber-950 px-4 py-2.5 text-center text-sm font-semibold shadow-sm z-50", children: "Your account has an overdue balance. Please update your payment." }),
|
|
230
429
|
daysOverdue > 15 && daysOverdue < 30 && /* @__PURE__ */ jsx("div", { className: "bg-rose-600 text-white px-4 py-2.5 text-center text-sm font-bold shadow-sm z-50", children: "Attention: If you do not settle your balance, your account will be suspended soon." }),
|
|
231
430
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row flex-1 overflow-hidden relative", children: [
|
|
@@ -241,71 +440,155 @@ function AdminAppContent(props) {
|
|
|
241
440
|
] }),
|
|
242
441
|
/* @__PURE__ */ jsx("div", { className: "truncate font-bold text-lg text-slate-900", children: ctx.config.siteName ?? "Site Administration" })
|
|
243
442
|
] }),
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
443
|
+
/* @__PURE__ */ jsx("nav", { className: "flex flex-row lg:flex-col overflow-x-auto lg:overflow-visible space-x-2 lg:space-x-0 lg:space-y-1.5 p-3 lg:p-4 text-sm font-medium hide-scrollbar", children: (() => {
|
|
444
|
+
const navItemsMap = /* @__PURE__ */ new Map();
|
|
445
|
+
if (hasDashboard) {
|
|
446
|
+
navItemsMap.set(
|
|
447
|
+
"dashboard",
|
|
448
|
+
/* @__PURE__ */ jsx(
|
|
449
|
+
SideItem,
|
|
450
|
+
{
|
|
451
|
+
active: section === "dashboard",
|
|
452
|
+
onClick: () => setSection("dashboard"),
|
|
453
|
+
icon: /* @__PURE__ */ jsx(BarChart3, { className: "h-4 w-4 shrink-0" }),
|
|
454
|
+
children: menuLabels.dashboard
|
|
455
|
+
},
|
|
456
|
+
"dashboard"
|
|
457
|
+
)
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
navItemsMap.set(
|
|
461
|
+
"pages",
|
|
462
|
+
/* @__PURE__ */ jsx(
|
|
463
|
+
SideItem,
|
|
464
|
+
{
|
|
465
|
+
active: section === "pages",
|
|
466
|
+
onClick: () => setSection("pages"),
|
|
467
|
+
icon: /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4 shrink-0" }),
|
|
468
|
+
children: menuLabels.pages
|
|
469
|
+
},
|
|
470
|
+
"pages"
|
|
471
|
+
)
|
|
472
|
+
);
|
|
473
|
+
navItemsMap.set(
|
|
474
|
+
"collections",
|
|
475
|
+
/* @__PURE__ */ jsx(
|
|
476
|
+
SideItem,
|
|
477
|
+
{
|
|
478
|
+
active: section === "collections",
|
|
479
|
+
onClick: () => setSection("collections"),
|
|
480
|
+
icon: /* @__PURE__ */ jsx(Boxes, { className: "h-4 w-4 shrink-0" }),
|
|
481
|
+
children: menuLabels.collections
|
|
482
|
+
},
|
|
483
|
+
"collections"
|
|
484
|
+
)
|
|
485
|
+
);
|
|
486
|
+
props.customSections?.forEach((cs) => {
|
|
487
|
+
navItemsMap.set(
|
|
488
|
+
cs.id,
|
|
489
|
+
/* @__PURE__ */ jsx(
|
|
490
|
+
SideItem,
|
|
491
|
+
{
|
|
492
|
+
active: section === cs.id,
|
|
493
|
+
onClick: () => setSection(cs.id),
|
|
494
|
+
icon: cs.icon || /* @__PURE__ */ jsx(Boxes, { className: "h-4 w-4 shrink-0" }),
|
|
495
|
+
children: cs.label
|
|
496
|
+
},
|
|
497
|
+
cs.id
|
|
498
|
+
)
|
|
499
|
+
);
|
|
500
|
+
});
|
|
501
|
+
if (!hideData) {
|
|
502
|
+
navItemsMap.set(
|
|
503
|
+
"submissions",
|
|
504
|
+
/* @__PURE__ */ jsx(
|
|
505
|
+
SideItem,
|
|
506
|
+
{
|
|
507
|
+
active: section === "submissions",
|
|
508
|
+
onClick: () => setSection("submissions"),
|
|
509
|
+
icon: /* @__PURE__ */ jsx(Inbox, { className: "h-4 w-4 shrink-0" }),
|
|
510
|
+
children: menuLabels.data
|
|
511
|
+
},
|
|
512
|
+
"submissions"
|
|
513
|
+
)
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
if (!hideConfig && !hideGlobals) {
|
|
517
|
+
navItemsMap.set(
|
|
518
|
+
"config",
|
|
519
|
+
/* @__PURE__ */ jsx(
|
|
520
|
+
SideItem,
|
|
521
|
+
{
|
|
522
|
+
active: section === "config",
|
|
523
|
+
onClick: () => setSection("config"),
|
|
524
|
+
icon: /* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-4 w-4 shrink-0" }),
|
|
525
|
+
children: menuLabels.config
|
|
526
|
+
},
|
|
527
|
+
"config"
|
|
528
|
+
)
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
if (!hideSettings) {
|
|
532
|
+
navItemsMap.set(
|
|
533
|
+
"settings",
|
|
534
|
+
/* @__PURE__ */ jsx(
|
|
535
|
+
SideItem,
|
|
536
|
+
{
|
|
537
|
+
active: section === "settings",
|
|
538
|
+
onClick: () => setSection("settings"),
|
|
539
|
+
icon: /* @__PURE__ */ jsx(SettingsIcon, { className: "h-4 w-4 shrink-0" }),
|
|
540
|
+
children: menuLabels.settings
|
|
541
|
+
},
|
|
542
|
+
"settings"
|
|
543
|
+
)
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
if (subscriptionCtx) {
|
|
547
|
+
navItemsMap.set(
|
|
548
|
+
"subscription",
|
|
549
|
+
/* @__PURE__ */ jsx(
|
|
550
|
+
SideItem,
|
|
551
|
+
{
|
|
552
|
+
active: section === "subscription",
|
|
553
|
+
onClick: () => setSection("subscription"),
|
|
554
|
+
icon: /* @__PURE__ */ jsx(CreditCard, { className: "h-4 w-4 shrink-0" }),
|
|
555
|
+
children: menuLabels.subscription
|
|
556
|
+
},
|
|
557
|
+
"subscription"
|
|
558
|
+
)
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
const orderedKeys = [];
|
|
562
|
+
if (props.menuOrder && Array.isArray(props.menuOrder) && props.menuOrder.length > 0) {
|
|
563
|
+
props.menuOrder.forEach((k) => {
|
|
564
|
+
if (navItemsMap.has(k) && !orderedKeys.includes(k)) {
|
|
565
|
+
orderedKeys.push(k);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
navItemsMap.forEach((_, k) => {
|
|
569
|
+
if (!orderedKeys.includes(k)) {
|
|
570
|
+
orderedKeys.push(k);
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
} else {
|
|
574
|
+
const topCustom = (props.customSections || []).filter((cs) => cs.position === "top").map((cs) => cs.id);
|
|
575
|
+
const bottomCustom = (props.customSections || []).filter((cs) => cs.position === "bottom" || cs.position === "after-collections").map((cs) => cs.id);
|
|
576
|
+
const otherCustom = (props.customSections || []).filter(
|
|
577
|
+
(cs) => cs.position !== "top" && cs.position !== "bottom" && cs.position !== "after-collections"
|
|
578
|
+
).map((cs) => cs.id);
|
|
579
|
+
if (hasDashboard) orderedKeys.push("dashboard");
|
|
580
|
+
topCustom.forEach((k) => orderedKeys.push(k));
|
|
581
|
+
orderedKeys.push("pages");
|
|
582
|
+
orderedKeys.push("collections");
|
|
583
|
+
otherCustom.forEach((k) => orderedKeys.push(k));
|
|
584
|
+
bottomCustom.forEach((k) => orderedKeys.push(k));
|
|
585
|
+
if (!hideData) orderedKeys.push("submissions");
|
|
586
|
+
if (!hideConfig && !hideGlobals) orderedKeys.push("config");
|
|
587
|
+
if (!hideSettings) orderedKeys.push("settings");
|
|
588
|
+
if (subscriptionCtx) orderedKeys.push("subscription");
|
|
589
|
+
}
|
|
590
|
+
return orderedKeys.map((k) => navItemsMap.get(k));
|
|
591
|
+
})() }),
|
|
309
592
|
/* @__PURE__ */ jsx("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: /* @__PURE__ */ jsxs(
|
|
310
593
|
"button",
|
|
311
594
|
{
|
|
@@ -316,7 +599,7 @@ function AdminAppContent(props) {
|
|
|
316
599
|
className: "flex items-center justify-center gap-2 w-full px-3 py-2 text-sm font-medium text-red-600 bg-red-50 hover:bg-red-100 rounded-lg transition-colors",
|
|
317
600
|
children: [
|
|
318
601
|
/* @__PURE__ */ jsx(LogOut, { className: "w-4 h-4" }),
|
|
319
|
-
|
|
602
|
+
t.signOut
|
|
320
603
|
]
|
|
321
604
|
}
|
|
322
605
|
) })
|
|
@@ -328,10 +611,13 @@ function AdminAppContent(props) {
|
|
|
328
611
|
!hideData && section === "submissions" && /* @__PURE__ */ jsx(SubmissionsSection, {}),
|
|
329
612
|
!hideConfig && !hideGlobals && section === "config" && /* @__PURE__ */ jsx(ConfigSection, {}),
|
|
330
613
|
!hideSettings && section === "settings" && /* @__PURE__ */ jsx(SettingsSection, {}),
|
|
331
|
-
section === "subscription" && /* @__PURE__ */ jsx(SubscriptionPage, {})
|
|
614
|
+
section === "subscription" && /* @__PURE__ */ jsx(SubscriptionPage, {}),
|
|
615
|
+
props.customSections?.map(
|
|
616
|
+
(cs) => section === cs.id ? /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children: typeof cs.component === "function" ? createElement(cs.component) : cs.component }, cs.id) : null
|
|
617
|
+
)
|
|
332
618
|
] })
|
|
333
619
|
] })
|
|
334
|
-
] });
|
|
620
|
+
] }) });
|
|
335
621
|
}
|
|
336
622
|
function SideItem({
|
|
337
623
|
active,
|
|
@@ -440,6 +726,7 @@ function PagesSection() {
|
|
|
440
726
|
}
|
|
441
727
|
function PageEditor({ page, showList, onToggleList }) {
|
|
442
728
|
const ctx = useCmsContext();
|
|
729
|
+
const t = useAdminI18n();
|
|
443
730
|
const iframeRef = useRef(null);
|
|
444
731
|
const [registered, setRegistered] = useState([]);
|
|
445
732
|
const [selectedId, setSelectedId] = useState(null);
|
|
@@ -533,7 +820,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
533
820
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-semibold text-slate-700 hover:bg-slate-50 hover:text-slate-900 disabled:opacity-50 transition-colors bg-white shadow-sm shrink-0",
|
|
534
821
|
children: [
|
|
535
822
|
/* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" }),
|
|
536
|
-
|
|
823
|
+
t.discardChanges
|
|
537
824
|
]
|
|
538
825
|
}
|
|
539
826
|
),
|
|
@@ -545,7 +832,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
545
832
|
className: "inline-flex items-center gap-1.5 rounded-lg bg-indigo-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-indigo-700 disabled:opacity-50 transition-colors shadow-sm shrink-0",
|
|
546
833
|
children: [
|
|
547
834
|
/* @__PURE__ */ jsx(Boxes, { className: "h-3.5 w-3.5" }),
|
|
548
|
-
|
|
835
|
+
t.save
|
|
549
836
|
]
|
|
550
837
|
}
|
|
551
838
|
)
|
|
@@ -1378,13 +1665,18 @@ function CollectionsSection() {
|
|
|
1378
1665
|
collections.find((c) => !c.isSeparator) ?? null
|
|
1379
1666
|
);
|
|
1380
1667
|
const [counts, setCounts] = useState({});
|
|
1668
|
+
const colIds = useMemo(
|
|
1669
|
+
() => (ctx.config.collections ?? []).filter((c) => !c.isSeparator).map((c) => c.id).join(","),
|
|
1670
|
+
[ctx.config.collections]
|
|
1671
|
+
);
|
|
1381
1672
|
useEffect(() => {
|
|
1382
|
-
|
|
1673
|
+
const list = ctx.config.collections ?? [];
|
|
1674
|
+
list.filter((c) => !c.isSeparator).forEach((c) => {
|
|
1383
1675
|
ctx.adapter.listEntries(c.id).then((entries) => {
|
|
1384
|
-
setCounts((prev) =>
|
|
1676
|
+
setCounts((prev) => prev[c.id] === entries.length ? prev : { ...prev, [c.id]: entries.length });
|
|
1385
1677
|
});
|
|
1386
1678
|
});
|
|
1387
|
-
}, [ctx.adapter,
|
|
1679
|
+
}, [ctx.adapter, colIds, ctx.collectionChangedAt]);
|
|
1388
1680
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
|
|
1389
1681
|
/* @__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: [
|
|
1390
1682
|
/* @__PURE__ */ jsx("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Collections" }),
|
|
@@ -1394,7 +1686,8 @@ function CollectionsSection() {
|
|
|
1394
1686
|
return /* @__PURE__ */ jsx(
|
|
1395
1687
|
"li",
|
|
1396
1688
|
{
|
|
1397
|
-
className: "my-
|
|
1689
|
+
className: "my-3 border-t border-slate-200/80 pt-2 px-1 list-none",
|
|
1690
|
+
children: c.name && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold uppercase tracking-wider text-slate-400", children: c.name })
|
|
1398
1691
|
},
|
|
1399
1692
|
c.id || `sep-${idx}`
|
|
1400
1693
|
);
|
|
@@ -1437,6 +1730,7 @@ function CollectionsSection() {
|
|
|
1437
1730
|
}
|
|
1438
1731
|
function CollectionEditor({ collection }) {
|
|
1439
1732
|
const ctx = useCmsContext();
|
|
1733
|
+
const t = useAdminI18n();
|
|
1440
1734
|
const [entries, setEntries] = useState([]);
|
|
1441
1735
|
const [editing, setEditing] = useState(null);
|
|
1442
1736
|
const [saving, setSaving] = useState(false);
|
|
@@ -1498,6 +1792,16 @@ function CollectionEditor({ collection }) {
|
|
|
1498
1792
|
try {
|
|
1499
1793
|
const finalEditing = { ...editing };
|
|
1500
1794
|
collection.fields.forEach((f) => {
|
|
1795
|
+
if (f.autoIncrement && isCreatingEntry && (!finalEditing[f.id] || Number(finalEditing[f.id]) === 0)) {
|
|
1796
|
+
const maxVal = entries.reduce(
|
|
1797
|
+
(max, e) => Math.max(max, Number(e[f.id]) || 0),
|
|
1798
|
+
0
|
|
1799
|
+
);
|
|
1800
|
+
finalEditing[f.id] = maxVal > 0 ? maxVal + 1 : 1;
|
|
1801
|
+
}
|
|
1802
|
+
if (f.id === "estado" && !finalEditing[f.id]) {
|
|
1803
|
+
finalEditing[f.id] = "Nueva";
|
|
1804
|
+
}
|
|
1501
1805
|
if (f.type === "time-range") {
|
|
1502
1806
|
delete finalEditing[f.id];
|
|
1503
1807
|
} else if (f.type === "slug" && !finalEditing[f.id]) {
|
|
@@ -1553,6 +1857,7 @@ function CollectionEditor({ collection }) {
|
|
|
1553
1857
|
newEntries[i].order = i;
|
|
1554
1858
|
await ctx.adapter.putEntry(collection.id, newEntries[i]);
|
|
1555
1859
|
}
|
|
1860
|
+
ctx.notifyCollectionChanged();
|
|
1556
1861
|
};
|
|
1557
1862
|
const onDragEnd = (e) => {
|
|
1558
1863
|
const target = e.target;
|
|
@@ -1560,7 +1865,7 @@ function CollectionEditor({ collection }) {
|
|
|
1560
1865
|
setDraggedIdx(null);
|
|
1561
1866
|
setDragOverIdx(null);
|
|
1562
1867
|
};
|
|
1563
|
-
const visibleFields = collection.fields.filter((f) => !["richtext", "list", "password"].includes(f.type) && f.id !== "order" && !f.hidden).slice(0,
|
|
1868
|
+
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);
|
|
1564
1869
|
const isCreatingEntry = editing ? !entries.some((entry) => entry.id === editing.id) : false;
|
|
1565
1870
|
return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-5xl", children: [
|
|
1566
1871
|
/* @__PURE__ */ jsxs("div", { className: "mb-8 flex items-center justify-between", children: [
|
|
@@ -1568,69 +1873,110 @@ function CollectionEditor({ collection }) {
|
|
|
1568
1873
|
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: collection.name }),
|
|
1569
1874
|
collection.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500 mt-1", children: collection.description })
|
|
1570
1875
|
] }),
|
|
1571
|
-
/* @__PURE__ */
|
|
1572
|
-
|
|
1876
|
+
/* @__PURE__ */ jsx(
|
|
1877
|
+
Button,
|
|
1573
1878
|
{
|
|
1879
|
+
type: "primary",
|
|
1880
|
+
size: "large",
|
|
1881
|
+
icon: /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
|
|
1574
1882
|
onClick: startNew,
|
|
1575
|
-
className: "
|
|
1576
|
-
children:
|
|
1577
|
-
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
|
|
1578
|
-
" New Entry"
|
|
1579
|
-
]
|
|
1883
|
+
className: "rounded-xl font-bold shadow-sm",
|
|
1884
|
+
children: t.newEntry
|
|
1580
1885
|
}
|
|
1581
1886
|
)
|
|
1582
1887
|
] }),
|
|
1583
1888
|
!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: [
|
|
1584
|
-
collection.searchBy?.length ? /* @__PURE__ */
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
"
|
|
1588
|
-
{
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
] }) : null,
|
|
1889
|
+
collection.searchBy?.length ? /* @__PURE__ */ jsx("div", { className: "relative flex-1 min-w-[220px]", children: /* @__PURE__ */ jsx(
|
|
1890
|
+
Input,
|
|
1891
|
+
{
|
|
1892
|
+
size: "large",
|
|
1893
|
+
prefix: /* @__PURE__ */ jsx(Search, { className: "h-4 w-4 text-slate-400" }),
|
|
1894
|
+
placeholder: `Buscar por ${collection.searchBy.map((s) => s === "numero" ? "n\xFAmero" : s === "clienteNombre" ? "cliente" : s === "clienteId" ? "identificaci\xF3n" : s === "fecha" ? "fecha" : s).join(", ")}...`,
|
|
1895
|
+
value: search,
|
|
1896
|
+
allowClear: true,
|
|
1897
|
+
onChange: (e) => {
|
|
1898
|
+
setSearch(e.target.value);
|
|
1899
|
+
setPage(1);
|
|
1900
|
+
},
|
|
1901
|
+
className: "rounded-xl"
|
|
1902
|
+
}
|
|
1903
|
+
) }) : null,
|
|
1600
1904
|
collection.filterBy?.map((f) => {
|
|
1601
1905
|
const fieldDef = collection.fields.find((cf) => cf.id === f);
|
|
1602
|
-
|
|
1603
|
-
if (
|
|
1604
|
-
|
|
1605
|
-
/* @__PURE__ */
|
|
1606
|
-
|
|
1906
|
+
if (!fieldDef) return null;
|
|
1907
|
+
if (fieldDef.type === "date") {
|
|
1908
|
+
const dateVal = filters[f] ? dayjs(filters[f], ["YYYY/MM/DD", "YYYY-MM-DD", "YYYY-M-D"]).isValid() ? dayjs(filters[f], ["YYYY/MM/DD", "YYYY-MM-DD", "YYYY-M-D"]) : null : null;
|
|
1909
|
+
return /* @__PURE__ */ jsx("div", { className: "min-w-[180px]", children: /* @__PURE__ */ jsx(
|
|
1910
|
+
DatePicker,
|
|
1607
1911
|
{
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1912
|
+
size: "large",
|
|
1913
|
+
format: "YYYY/MM/DD",
|
|
1914
|
+
placeholder: `Filtrar por ${fieldDef.label}`,
|
|
1915
|
+
allowClear: true,
|
|
1916
|
+
value: dateVal,
|
|
1917
|
+
onChange: (_, dateStr) => {
|
|
1918
|
+
const val = Array.isArray(dateStr) ? dateStr[0] : dateStr;
|
|
1919
|
+
setFilters((prev) => ({ ...prev, [f]: val || "" }));
|
|
1611
1920
|
setPage(1);
|
|
1612
1921
|
},
|
|
1613
|
-
className: "w-full rounded-xl
|
|
1614
|
-
children: [
|
|
1615
|
-
/* @__PURE__ */ jsxs("option", { value: "", children: [
|
|
1616
|
-
"All ",
|
|
1617
|
-
fieldDef.label
|
|
1618
|
-
] }),
|
|
1619
|
-
uniqueVals.map((v) => /* @__PURE__ */ jsx("option", { value: v, children: v }, v))
|
|
1620
|
-
]
|
|
1922
|
+
className: "w-full rounded-xl"
|
|
1621
1923
|
}
|
|
1622
|
-
),
|
|
1623
|
-
|
|
1624
|
-
|
|
1924
|
+
) }, f);
|
|
1925
|
+
}
|
|
1926
|
+
const predefinedOptions = (fieldDef.options || []).map(
|
|
1927
|
+
(opt) => typeof opt === "string" ? { value: opt, label: opt } : opt
|
|
1928
|
+
);
|
|
1929
|
+
const entryVals = Array.from(new Set(entries.map((e) => String(e[f] || "")))).filter(Boolean);
|
|
1930
|
+
const combinedOptions = [...predefinedOptions];
|
|
1931
|
+
for (const ev of entryVals) {
|
|
1932
|
+
if (!combinedOptions.some((o) => o.value === ev)) {
|
|
1933
|
+
combinedOptions.push({ value: ev, label: ev });
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
return /* @__PURE__ */ jsx("div", { className: "min-w-[170px]", children: /* @__PURE__ */ jsx(
|
|
1937
|
+
Select,
|
|
1938
|
+
{
|
|
1939
|
+
size: "large",
|
|
1940
|
+
value: filters[f] || void 0,
|
|
1941
|
+
placeholder: `Filtrar por ${fieldDef.label}`,
|
|
1942
|
+
allowClear: true,
|
|
1943
|
+
onChange: (v) => {
|
|
1944
|
+
setFilters((prev) => ({ ...prev, [f]: v || "" }));
|
|
1945
|
+
setPage(1);
|
|
1946
|
+
},
|
|
1947
|
+
options: combinedOptions,
|
|
1948
|
+
className: "w-full"
|
|
1949
|
+
}
|
|
1950
|
+
) }, f);
|
|
1625
1951
|
})
|
|
1626
1952
|
] }),
|
|
1627
1953
|
/* @__PURE__ */ jsx(
|
|
1628
1954
|
Modal,
|
|
1629
1955
|
{
|
|
1630
1956
|
open: Boolean(editing),
|
|
1631
|
-
title: /* @__PURE__ */ jsxs("
|
|
1632
|
-
|
|
1633
|
-
|
|
1957
|
+
title: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pr-8", children: [
|
|
1958
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 text-slate-900 font-bold", children: [
|
|
1959
|
+
isCreatingEntry ? /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 text-indigo-600" }) : /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4 text-indigo-600" }),
|
|
1960
|
+
isCreatingEntry ? collection.createTitle || `Nueva ${collection.name.endsWith("s") ? collection.name.slice(0, -1) : collection.name}` : `Editar ${collection.name.endsWith("s") ? collection.name.slice(0, -1) : collection.name}`
|
|
1961
|
+
] }),
|
|
1962
|
+
!isCreatingEntry && editing && editing.estado !== void 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1963
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-slate-400 font-medium", children: "Estado:" }),
|
|
1964
|
+
/* @__PURE__ */ jsx(
|
|
1965
|
+
Select,
|
|
1966
|
+
{
|
|
1967
|
+
size: "middle",
|
|
1968
|
+
value: String(editing.estado || "Nueva"),
|
|
1969
|
+
onChange: (val) => setEditing({ ...editing, estado: val }),
|
|
1970
|
+
options: [
|
|
1971
|
+
{ value: "Nueva", label: "Nueva" },
|
|
1972
|
+
{ value: "Proceso", label: "Proceso" },
|
|
1973
|
+
{ value: "Terminado", label: "Terminado" },
|
|
1974
|
+
{ value: "Cancelado", label: "Cancelado" }
|
|
1975
|
+
],
|
|
1976
|
+
className: "w-32"
|
|
1977
|
+
}
|
|
1978
|
+
)
|
|
1979
|
+
] })
|
|
1634
1980
|
] }),
|
|
1635
1981
|
onCancel: () => {
|
|
1636
1982
|
if (!saving) setEditing(null);
|
|
@@ -1654,445 +2000,556 @@ function CollectionEditor({ collection }) {
|
|
|
1654
2000
|
backdropFilter: "blur(8px)"
|
|
1655
2001
|
}
|
|
1656
2002
|
},
|
|
1657
|
-
children: editing && /* @__PURE__ */ jsxs("div", { className: "flex max-h-[calc(100dvh-180px)] min-h-0 flex-col", children: [
|
|
1658
|
-
/* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-5", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order" && !f.hidden).
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
{
|
|
1666
|
-
|
|
1667
|
-
value: editing[f.id],
|
|
1668
|
-
globalPrice: Number(editing.price) || 0,
|
|
1669
|
-
globalDiscount: Number(editing.discountPercent) || 0,
|
|
1670
|
-
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
1671
|
-
}
|
|
1672
|
-
) : f.type === "boolean" ? /* @__PURE__ */ jsx("div", { className: "mt-1 h-10 flex items-center", children: /* @__PURE__ */ jsx(
|
|
1673
|
-
"input",
|
|
1674
|
-
{
|
|
1675
|
-
type: "checkbox",
|
|
1676
|
-
checked: !!editing[f.id],
|
|
1677
|
-
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.checked }),
|
|
1678
|
-
className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"
|
|
1679
|
-
}
|
|
1680
|
-
) }) : f.type === "number" ? /* @__PURE__ */ jsx(
|
|
1681
|
-
FormattedNumberInput,
|
|
1682
|
-
{
|
|
1683
|
-
value: editing[f.id],
|
|
1684
|
-
onChange: (val) => setEditing({ ...editing, [f.id]: val }),
|
|
1685
|
-
isPrice: f.id.toLowerCase().includes("price") || f.id.toLowerCase().includes("precio") || f.label.toLowerCase().includes("precio") || f.label.toLowerCase().includes("valor") || f.label.includes("$"),
|
|
1686
|
-
isPercent: f.id.toLowerCase().includes("discount") || f.id.toLowerCase().includes("descuento") || f.label.toLowerCase().includes("descuento")
|
|
1687
|
-
}
|
|
1688
|
-
) : f.type === "time-range" ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
1689
|
-
/* @__PURE__ */ jsx(
|
|
1690
|
-
AdminTimeRangePicker,
|
|
1691
|
-
{
|
|
1692
|
-
value: [
|
|
1693
|
-
toDayjsTime(f.startField ? editing[f.startField] : ""),
|
|
1694
|
-
toDayjsTime(f.endField ? editing[f.endField] : "")
|
|
1695
|
-
],
|
|
1696
|
-
onChange: (times) => setEditing(
|
|
1697
|
-
(current) => current ? {
|
|
1698
|
-
...current,
|
|
1699
|
-
...f.startField ? { [f.startField]: toStoredTime(times?.[0]) } : {},
|
|
1700
|
-
...f.endField ? { [f.endField]: toStoredTime(times?.[1]) } : {}
|
|
1701
|
-
} : current
|
|
1702
|
-
),
|
|
1703
|
-
allowEmpty: [true, true],
|
|
1704
|
-
className: "w-full",
|
|
1705
|
-
format: TIME_DISPLAY_FORMAT,
|
|
1706
|
-
order: false,
|
|
1707
|
-
placeholder: ["Hora de inicio", "Hora de cierre"],
|
|
1708
|
-
use12Hours: true
|
|
1709
|
-
}
|
|
1710
|
-
),
|
|
1711
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500", children: "Selecciona inicio y cierre en un mismo control. Usa AM/PM; si el cierre es anterior al inicio, el horario cruza medianoche. Deja ambos vac\xEDos para mantenerlo siempre disponible." })
|
|
1712
|
-
] }) : f.type === "time" ? /* @__PURE__ */ jsx(
|
|
1713
|
-
AdminTimePicker,
|
|
1714
|
-
{
|
|
1715
|
-
value: toDayjsTime(editing[f.id]),
|
|
1716
|
-
onChange: (time) => setEditing({ ...editing, [f.id]: toStoredTime(time) }),
|
|
1717
|
-
className: "w-full",
|
|
1718
|
-
format: TIME_DISPLAY_FORMAT,
|
|
1719
|
-
use12Hours: true
|
|
1720
|
-
}
|
|
1721
|
-
) : f.type === "richtext" ? /* @__PURE__ */ jsx(
|
|
1722
|
-
"textarea",
|
|
1723
|
-
{
|
|
1724
|
-
value: String(editing[f.id] ?? ""),
|
|
1725
|
-
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
1726
|
-
rows: 4,
|
|
1727
|
-
className: "w-full rounded-xl border border-slate-200 px-4 py-3 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all font-mono text-xs"
|
|
1728
|
-
}
|
|
1729
|
-
) : f.type === "icon" ? /* @__PURE__ */ jsx(
|
|
1730
|
-
SearchableSelect,
|
|
1731
|
-
{
|
|
1732
|
-
value: String(editing[f.id] ?? ""),
|
|
1733
|
-
onChange: (val) => setEditing({ ...editing, [f.id]: val }),
|
|
1734
|
-
options: f.options || [],
|
|
1735
|
-
placeholder: `Search ${f.label.toLowerCase()}...`,
|
|
1736
|
-
iconMap: ctx.iconMap
|
|
2003
|
+
children: editing && /* @__PURE__ */ jsx(ConfigProvider, { theme: TIME_PICKER_THEME, children: /* @__PURE__ */ jsxs("div", { className: "flex max-h-[calc(100dvh-180px)] min-h-0 flex-col", children: [
|
|
2004
|
+
/* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-5", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order" && !f.hidden).filter((f) => {
|
|
2005
|
+
if (f.id === "estado" && !isCreatingEntry) return false;
|
|
2006
|
+
if (isCreatingEntry && f.hideOnCreate) return false;
|
|
2007
|
+
if (f.dependsOn) {
|
|
2008
|
+
const targetVal = editing[f.dependsOn.field];
|
|
2009
|
+
if (Array.isArray(f.dependsOn.value)) {
|
|
2010
|
+
if (!f.dependsOn.value.includes(targetVal)) return false;
|
|
2011
|
+
} else if (targetVal !== f.dependsOn.value) {
|
|
2012
|
+
return false;
|
|
1737
2013
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
2014
|
+
}
|
|
2015
|
+
return true;
|
|
2016
|
+
}).map((f) => {
|
|
2017
|
+
const isFullWidth = f.colSpan === 2 || f.colSpan === 12 || f.type === "signature" || f.type === "date" || f.type === "datetime" || f.type === "richtext" || f.type === "textarea" || f.type === "list" || f.type === "branch-settings" || f.type === "time-range";
|
|
2018
|
+
const colSpanClass = isFullWidth ? "lg:col-span-2 col-span-1" : "col-span-1";
|
|
2019
|
+
return /* @__PURE__ */ jsxs("div", { className: `block ${colSpanClass}`, children: [
|
|
2020
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
|
|
2021
|
+
f.label,
|
|
2022
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-mono text-slate-300 bg-slate-50 px-1.5 py-0.5 rounded", children: f.type })
|
|
2023
|
+
] }),
|
|
2024
|
+
f.type === "branch-settings" ? /* @__PURE__ */ jsx(
|
|
2025
|
+
BranchSettingsEditor,
|
|
1741
2026
|
{
|
|
1742
|
-
|
|
1743
|
-
value:
|
|
1744
|
-
|
|
1745
|
-
|
|
2027
|
+
collectionId: f.collection || "",
|
|
2028
|
+
value: editing[f.id],
|
|
2029
|
+
globalPrice: Number(editing.price) || 0,
|
|
2030
|
+
globalDiscount: Number(editing.discountPercent) || 0,
|
|
2031
|
+
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
1746
2032
|
}
|
|
1747
|
-
),
|
|
1748
|
-
|
|
1749
|
-
|
|
2033
|
+
) : f.type === "boolean" ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-3", children: [
|
|
2034
|
+
/* @__PURE__ */ jsx(
|
|
2035
|
+
Switch,
|
|
2036
|
+
{
|
|
2037
|
+
checked: !!editing[f.id],
|
|
2038
|
+
onChange: (checked) => setEditing({ ...editing, [f.id]: checked })
|
|
2039
|
+
}
|
|
2040
|
+
),
|
|
2041
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-slate-700", children: editing[f.id] ? "Activado / S\xED" : "Desactivado / No" })
|
|
2042
|
+
] }) : f.type === "number" ? /* @__PURE__ */ jsx(
|
|
2043
|
+
InputNumber,
|
|
1750
2044
|
{
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
className: "px-4 py-2.5 bg-slate-100 hover:bg-slate-200 text-slate-700 text-sm font-semibold rounded-xl border border-slate-200 transition-colors",
|
|
1759
|
-
children: "Generate"
|
|
2045
|
+
size: "large",
|
|
2046
|
+
value: editing[f.id] !== void 0 && editing[f.id] !== null && editing[f.id] !== "" ? Number(editing[f.id]) : void 0,
|
|
2047
|
+
readOnly: f.readOnly || f.autoIncrement && !isCreatingEntry,
|
|
2048
|
+
disabled: f.readOnly,
|
|
2049
|
+
onChange: (val) => setEditing({ ...editing, [f.id]: val ?? 0 }),
|
|
2050
|
+
className: "w-full rounded-xl",
|
|
2051
|
+
placeholder: "0"
|
|
1760
2052
|
}
|
|
1761
|
-
)
|
|
1762
|
-
|
|
1763
|
-
ReferenceSelect,
|
|
1764
|
-
{
|
|
1765
|
-
collectionId: f.collection,
|
|
1766
|
-
displayField: f.displayField,
|
|
1767
|
-
valueField: f.valueField,
|
|
1768
|
-
fallbackOptions: f.options,
|
|
1769
|
-
multiple: f.multiple,
|
|
1770
|
-
searchable: f.searchable,
|
|
1771
|
-
max: f.max,
|
|
1772
|
-
value: editing[f.id],
|
|
1773
|
-
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
1774
|
-
}
|
|
1775
|
-
) : f.type === "select" ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
1776
|
-
/* @__PURE__ */ jsxs(
|
|
1777
|
-
"select",
|
|
2053
|
+
) : f.type === "date" || f.type === "datetime" ? /* @__PURE__ */ jsx(
|
|
2054
|
+
DatePicker,
|
|
1778
2055
|
{
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
const val = typeof opt === "string" ? opt : opt.value;
|
|
1786
|
-
const lab = typeof opt === "string" ? opt : opt.label;
|
|
1787
|
-
return /* @__PURE__ */ jsx("option", { value: val, children: lab }, val);
|
|
1788
|
-
})
|
|
1789
|
-
]
|
|
2056
|
+
size: "large",
|
|
2057
|
+
value: editing[f.id] ? dayjs(String(editing[f.id])).isValid() ? dayjs(String(editing[f.id])) : null : null,
|
|
2058
|
+
onChange: (date, dateString) => setEditing({ ...editing, [f.id]: (Array.isArray(dateString) ? dateString[0] : dateString) || (date ? date.format("YYYY/MM/DD") : "") }),
|
|
2059
|
+
format: "YYYY/MM/DD",
|
|
2060
|
+
placeholder: `Seleccionar ${f.label.toLowerCase()}...`,
|
|
2061
|
+
className: "w-full rounded-xl"
|
|
1790
2062
|
}
|
|
1791
|
-
),
|
|
1792
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
|
|
1793
|
-
] }) : f.type === "image" || f.type === "file" ? f.multiple ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1794
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: (editing[f.id] || []).map((url, i) => {
|
|
1795
|
-
const isVideo = typeof url === "string" && (url.match(/\.(mp4|webm|mov|ogg)$/i) || url.includes("video"));
|
|
1796
|
-
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group w-32 h-32", children: [
|
|
1797
|
-
isVideo ? /* @__PURE__ */ jsx("video", { src: url, className: "w-full h-full object-cover rounded-lg", autoPlay: true, muted: true, loop: true, playsInline: true }) : /* @__PURE__ */ jsx("img", { src: url, alt: "", className: "w-full h-full object-cover rounded-lg" }),
|
|
1798
|
-
/* @__PURE__ */ jsx(
|
|
1799
|
-
"button",
|
|
1800
|
-
{
|
|
1801
|
-
type: "button",
|
|
1802
|
-
onClick: () => {
|
|
1803
|
-
const arr = [...editing[f.id] || []];
|
|
1804
|
-
arr.splice(i, 1);
|
|
1805
|
-
setEditing({ ...editing, [f.id]: arr });
|
|
1806
|
-
},
|
|
1807
|
-
className: "absolute top-2 right-2 bg-red-500/80 text-white rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500",
|
|
1808
|
-
children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
|
|
1809
|
-
}
|
|
1810
|
-
)
|
|
1811
|
-
] }, i);
|
|
1812
|
-
}) }),
|
|
1813
|
-
(!f.max || (editing[f.id] || []).length < f.max) && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
2063
|
+
) : f.type === "time-range" ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
1814
2064
|
/* @__PURE__ */ jsx(
|
|
1815
|
-
|
|
2065
|
+
AdminTimeRangePicker,
|
|
1816
2066
|
{
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
2067
|
+
value: [
|
|
2068
|
+
toDayjsTime(f.startField ? editing[f.startField] : ""),
|
|
2069
|
+
toDayjsTime(f.endField ? editing[f.endField] : "")
|
|
2070
|
+
],
|
|
2071
|
+
onChange: (times) => setEditing(
|
|
2072
|
+
(current) => current ? {
|
|
2073
|
+
...current,
|
|
2074
|
+
...f.startField ? { [f.startField]: toStoredTime(times?.[0]) } : {},
|
|
2075
|
+
...f.endField ? { [f.endField]: toStoredTime(times?.[1]) } : {}
|
|
2076
|
+
} : current
|
|
2077
|
+
),
|
|
2078
|
+
allowEmpty: [true, true],
|
|
2079
|
+
className: "w-full",
|
|
2080
|
+
format: "h:mm a",
|
|
2081
|
+
order: false,
|
|
2082
|
+
placeholder: ["Hora de inicio", "Hora de cierre"],
|
|
2083
|
+
use12Hours: true
|
|
1828
2084
|
}
|
|
1829
2085
|
),
|
|
2086
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500", children: "Selecciona inicio y cierre en un mismo control. Usa AM/PM. Deja ambos vac\xEDos para mantenerlo siempre disponible." })
|
|
2087
|
+
] }) : f.type === "time" ? /* @__PURE__ */ jsx(
|
|
2088
|
+
TimePicker,
|
|
2089
|
+
{
|
|
2090
|
+
size: "large",
|
|
2091
|
+
use12Hours: true,
|
|
2092
|
+
format: "h:mm a",
|
|
2093
|
+
value: toDayjsTime(editing[f.id]),
|
|
2094
|
+
onChange: (time, timeString) => setEditing({
|
|
2095
|
+
...editing,
|
|
2096
|
+
[f.id]: (Array.isArray(timeString) ? timeString[0] : timeString) || (time ? time.format("h:mm a") : "")
|
|
2097
|
+
}),
|
|
2098
|
+
placeholder: `Seleccionar ${f.label.toLowerCase()}...`,
|
|
2099
|
+
className: "w-full rounded-xl"
|
|
2100
|
+
}
|
|
2101
|
+
) : f.type === "richtext" || f.type === "textarea" ? /* @__PURE__ */ jsx(
|
|
2102
|
+
Input.TextArea,
|
|
2103
|
+
{
|
|
2104
|
+
size: "large",
|
|
2105
|
+
value: String(editing[f.id] ?? ""),
|
|
2106
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
2107
|
+
rows: 4,
|
|
2108
|
+
placeholder: `Escribe ${f.label.toLowerCase()}...`,
|
|
2109
|
+
className: "w-full rounded-xl font-sans"
|
|
2110
|
+
}
|
|
2111
|
+
) : f.type === "icon" ? /* @__PURE__ */ jsx(
|
|
2112
|
+
SearchableSelect,
|
|
2113
|
+
{
|
|
2114
|
+
value: String(editing[f.id] ?? ""),
|
|
2115
|
+
onChange: (val) => setEditing({ ...editing, [f.id]: val }),
|
|
2116
|
+
options: f.options?.length ? f.options : ctx.iconMap ? Object.keys(ctx.iconMap) : [],
|
|
2117
|
+
placeholder: `Buscar icono ${f.label.toLowerCase()}...`,
|
|
2118
|
+
iconMap: ctx.iconMap
|
|
2119
|
+
}
|
|
2120
|
+
) : f.type === "slug" ? /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
1830
2121
|
/* @__PURE__ */ jsx(
|
|
1831
|
-
|
|
1832
|
-
{
|
|
1833
|
-
accept: "image/*,video/*",
|
|
1834
|
-
multiple: true,
|
|
1835
|
-
className: "flex-shrink-0 cursor-pointer rounded-xl border border-slate-200 bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-200",
|
|
1836
|
-
onFiles: (files) => {
|
|
1837
|
-
files.forEach((file) => {
|
|
1838
|
-
void handleImageFile(
|
|
1839
|
-
file,
|
|
1840
|
-
(url) => {
|
|
1841
|
-
setEditing((prev) => {
|
|
1842
|
-
if (!prev) return prev;
|
|
1843
|
-
const current = prev[f.id] || [];
|
|
1844
|
-
if (f.max && current.length >= f.max) {
|
|
1845
|
-
return prev;
|
|
1846
|
-
}
|
|
1847
|
-
return { ...prev, [f.id]: [...current, url] };
|
|
1848
|
-
});
|
|
1849
|
-
},
|
|
1850
|
-
ctx.uploadImage
|
|
1851
|
-
);
|
|
1852
|
-
});
|
|
1853
|
-
},
|
|
1854
|
-
children: "Upload"
|
|
1855
|
-
}
|
|
1856
|
-
)
|
|
1857
|
-
] })
|
|
1858
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1859
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
1860
|
-
/* @__PURE__ */ jsx(
|
|
1861
|
-
"input",
|
|
2122
|
+
Input,
|
|
1862
2123
|
{
|
|
1863
|
-
|
|
2124
|
+
size: "large",
|
|
1864
2125
|
value: String(editing[f.id] ?? ""),
|
|
1865
2126
|
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
1866
|
-
|
|
1867
|
-
className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
2127
|
+
className: "flex-1 rounded-xl"
|
|
1868
2128
|
}
|
|
1869
2129
|
),
|
|
1870
2130
|
/* @__PURE__ */ jsx(
|
|
1871
|
-
|
|
2131
|
+
Button,
|
|
1872
2132
|
{
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
file,
|
|
1880
|
-
(url) => setEditing(
|
|
1881
|
-
(current) => current ? { ...current, [f.id]: url } : current
|
|
1882
|
-
),
|
|
1883
|
-
ctx.uploadImage
|
|
1884
|
-
);
|
|
1885
|
-
}
|
|
2133
|
+
size: "large",
|
|
2134
|
+
onClick: () => {
|
|
2135
|
+
const sourceField = f.source || "title";
|
|
2136
|
+
let val = String(editing[sourceField] || editing.id || "");
|
|
2137
|
+
val = val.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)+/g, "");
|
|
2138
|
+
setEditing({ ...editing, [f.id]: val });
|
|
1886
2139
|
},
|
|
1887
|
-
|
|
2140
|
+
className: "rounded-xl font-semibold",
|
|
2141
|
+
children: "Generate"
|
|
1888
2142
|
}
|
|
1889
2143
|
)
|
|
1890
|
-
] })
|
|
1891
|
-
|
|
1892
|
-
"video",
|
|
1893
|
-
{
|
|
1894
|
-
src: String(editing[f.id]),
|
|
1895
|
-
controls: true,
|
|
1896
|
-
className: "w-full h-auto max-h-48 object-contain rounded-lg"
|
|
1897
|
-
}
|
|
1898
|
-
) : /* @__PURE__ */ jsx(
|
|
1899
|
-
"img",
|
|
1900
|
-
{
|
|
1901
|
-
src: String(editing[f.id]),
|
|
1902
|
-
alt: "",
|
|
1903
|
-
className: "w-full h-auto max-h-48 object-contain rounded-lg"
|
|
1904
|
-
}
|
|
1905
|
-
) }) : null
|
|
1906
|
-
] }) : f.type === "password" ? /* @__PURE__ */ jsx(
|
|
1907
|
-
PasswordField,
|
|
1908
|
-
{
|
|
1909
|
-
value: String(editing[f.id] ?? ""),
|
|
1910
|
-
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
1911
|
-
}
|
|
1912
|
-
) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1913
|
-
/* @__PURE__ */ jsx(
|
|
1914
|
-
"input",
|
|
1915
|
-
{
|
|
1916
|
-
type: "color",
|
|
1917
|
-
value: String(editing[f.id] ?? "#000000").startsWith("#") && String(editing[f.id] ?? "").length === 7 ? String(editing[f.id]) : "#000000",
|
|
1918
|
-
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
1919
|
-
className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
|
|
1920
|
-
}
|
|
1921
|
-
),
|
|
1922
|
-
/* @__PURE__ */ jsx(
|
|
1923
|
-
"input",
|
|
1924
|
-
{
|
|
1925
|
-
type: "text",
|
|
1926
|
-
value: String(editing[f.id] ?? ""),
|
|
1927
|
-
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
1928
|
-
placeholder: "#000000",
|
|
1929
|
-
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 font-mono shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1930
|
-
}
|
|
1931
|
-
),
|
|
1932
|
-
/* @__PURE__ */ jsx(
|
|
1933
|
-
"div",
|
|
2144
|
+
] }) : f.type === "reference" || f.type === "select" && f.collection ? /* @__PURE__ */ jsx(
|
|
2145
|
+
ReferenceSelect,
|
|
1934
2146
|
{
|
|
1935
|
-
|
|
1936
|
-
|
|
2147
|
+
collectionId: f.collection,
|
|
2148
|
+
displayField: f.displayField,
|
|
2149
|
+
valueField: f.valueField,
|
|
2150
|
+
fallbackOptions: f.options,
|
|
2151
|
+
multiple: f.multiple,
|
|
2152
|
+
searchable: f.searchable,
|
|
2153
|
+
max: f.max,
|
|
2154
|
+
value: editing[f.id],
|
|
2155
|
+
onChange: (val) => setEditing({ ...editing, [f.id]: val }),
|
|
2156
|
+
onSelectRecord: (rec) => {
|
|
2157
|
+
if (f.id === "clienteId" && rec) {
|
|
2158
|
+
setEditing((prev) => prev ? {
|
|
2159
|
+
...prev,
|
|
2160
|
+
clienteId: rec.id || prev.clienteId,
|
|
2161
|
+
clienteNombre: rec.nombre || rec.name || prev.clienteNombre,
|
|
2162
|
+
ciudad: rec.ciudad || prev.ciudad,
|
|
2163
|
+
direccion: rec.direccion || prev.direccion,
|
|
2164
|
+
telefono: rec.telefono || prev.telefono
|
|
2165
|
+
} : prev);
|
|
2166
|
+
} else if (f.id === "empleadoId" && rec) {
|
|
2167
|
+
setEditing((prev) => prev ? {
|
|
2168
|
+
...prev,
|
|
2169
|
+
empleadoId: rec.id || prev.empleadoId,
|
|
2170
|
+
empleadoNombre: rec.apellido ? `${rec.nombre || rec.name || ""} ${rec.apellido}`.trim() : rec.nombre || rec.name || prev.empleadoNombre
|
|
2171
|
+
} : prev);
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
1937
2174
|
}
|
|
1938
|
-
)
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
2175
|
+
) : f.type === "select" ? (() => {
|
|
2176
|
+
const dynamicOptions = f.optionsMap && f.dependsOnField ? f.optionsMap[String(editing[f.dependsOnField] || "")] || f.options || [] : f.options || [];
|
|
2177
|
+
return /* @__PURE__ */ jsx(
|
|
2178
|
+
Select,
|
|
2179
|
+
{
|
|
2180
|
+
size: "large",
|
|
2181
|
+
value: editing[f.id] ? String(editing[f.id]) : void 0,
|
|
2182
|
+
placeholder: f.label,
|
|
2183
|
+
allowClear: true,
|
|
2184
|
+
onChange: (val) => {
|
|
2185
|
+
const next = { ...editing, [f.id]: val || "" };
|
|
2186
|
+
collection.fields.forEach((otherField) => {
|
|
2187
|
+
if (otherField.dependsOnField === f.id && otherField.optionsMap) {
|
|
2188
|
+
const newOpts = otherField.optionsMap[String(val || "")];
|
|
2189
|
+
if (newOpts && newOpts.length > 0) {
|
|
2190
|
+
const firstVal = typeof newOpts[0] === "string" ? newOpts[0] : newOpts[0].value;
|
|
2191
|
+
next[otherField.id] = firstVal;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
});
|
|
2195
|
+
setEditing(next);
|
|
2196
|
+
},
|
|
2197
|
+
options: dynamicOptions.map((opt) => ({
|
|
2198
|
+
label: typeof opt === "string" ? opt : opt.label,
|
|
2199
|
+
value: typeof opt === "string" ? opt : opt.value
|
|
2200
|
+
})),
|
|
2201
|
+
className: "w-full"
|
|
2202
|
+
}
|
|
2203
|
+
);
|
|
2204
|
+
})() : f.type === "image" || f.type === "file" ? f.multiple ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2205
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: (editing[f.id] || []).map((url, i) => {
|
|
2206
|
+
const isVideo = typeof url === "string" && (url.match(/\.(mp4|webm|mov|ogg)$/i) || url.includes("video"));
|
|
2207
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group w-32 h-32", children: [
|
|
2208
|
+
isVideo ? /* @__PURE__ */ jsx("video", { src: url, className: "w-full h-full object-cover rounded-lg", autoPlay: true, muted: true, loop: true, playsInline: true }) : /* @__PURE__ */ jsx("img", { src: url, alt: "", className: "w-full h-full object-cover rounded-lg" }),
|
|
2209
|
+
/* @__PURE__ */ jsx(
|
|
2210
|
+
"button",
|
|
2211
|
+
{
|
|
2212
|
+
type: "button",
|
|
2213
|
+
onClick: () => {
|
|
2214
|
+
const arr = [...editing[f.id] || []];
|
|
2215
|
+
arr.splice(i, 1);
|
|
2216
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2217
|
+
},
|
|
2218
|
+
className: "absolute top-2 right-2 bg-red-500/80 text-white rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500",
|
|
2219
|
+
children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
|
|
2220
|
+
}
|
|
2221
|
+
)
|
|
2222
|
+
] }, i);
|
|
2223
|
+
}) }),
|
|
2224
|
+
(!f.max || (editing[f.id] || []).length < f.max) && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
2225
|
+
/* @__PURE__ */ jsx(
|
|
2226
|
+
"input",
|
|
2227
|
+
{
|
|
2228
|
+
type: "url",
|
|
2229
|
+
placeholder: "Add media URL and press Enter...",
|
|
2230
|
+
onKeyDown: (e) => {
|
|
2231
|
+
if (e.key === "Enter" && e.currentTarget.value) {
|
|
2232
|
+
e.preventDefault();
|
|
2233
|
+
const arr = [...editing[f.id] || [], e.currentTarget.value];
|
|
2234
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2235
|
+
e.currentTarget.value = "";
|
|
2236
|
+
}
|
|
1953
2237
|
},
|
|
1954
|
-
className: "w-
|
|
2238
|
+
className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1955
2239
|
}
|
|
1956
2240
|
),
|
|
1957
2241
|
/* @__PURE__ */ jsx(
|
|
1958
|
-
|
|
2242
|
+
FilePickerButton,
|
|
1959
2243
|
{
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2244
|
+
accept: "image/*,video/*",
|
|
2245
|
+
multiple: true,
|
|
2246
|
+
className: "flex-shrink-0 cursor-pointer rounded-xl border border-slate-200 bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-200",
|
|
2247
|
+
onFiles: (files) => {
|
|
2248
|
+
files.forEach((file) => {
|
|
2249
|
+
void handleImageFile(
|
|
2250
|
+
file,
|
|
2251
|
+
(url) => {
|
|
2252
|
+
setEditing((prev) => {
|
|
2253
|
+
if (!prev) return prev;
|
|
2254
|
+
const current = prev[f.id] || [];
|
|
2255
|
+
if (f.max && current.length >= f.max) {
|
|
2256
|
+
return prev;
|
|
2257
|
+
}
|
|
2258
|
+
return { ...prev, [f.id]: [...current, url] };
|
|
2259
|
+
});
|
|
2260
|
+
},
|
|
2261
|
+
ctx.uploadImage
|
|
2262
|
+
);
|
|
2263
|
+
});
|
|
1966
2264
|
},
|
|
1967
|
-
|
|
1968
|
-
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2 text-sm text-slate-800 font-mono shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
2265
|
+
children: "Upload"
|
|
1969
2266
|
}
|
|
1970
|
-
)
|
|
2267
|
+
)
|
|
2268
|
+
] })
|
|
2269
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2270
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
1971
2271
|
/* @__PURE__ */ jsx(
|
|
1972
|
-
"
|
|
2272
|
+
"input",
|
|
1973
2273
|
{
|
|
1974
|
-
|
|
1975
|
-
|
|
2274
|
+
type: "url",
|
|
2275
|
+
value: String(editing[f.id] ?? ""),
|
|
2276
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
2277
|
+
placeholder: "https://...",
|
|
2278
|
+
className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1976
2279
|
}
|
|
1977
2280
|
),
|
|
1978
2281
|
/* @__PURE__ */ jsx(
|
|
1979
|
-
|
|
2282
|
+
FilePickerButton,
|
|
1980
2283
|
{
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
2284
|
+
accept: "image/*,video/*",
|
|
2285
|
+
className: "flex-shrink-0 cursor-pointer rounded-xl border border-slate-200 bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-200",
|
|
2286
|
+
onFiles: (files) => {
|
|
2287
|
+
const file = files[0];
|
|
2288
|
+
if (file) {
|
|
2289
|
+
void handleImageFile(
|
|
2290
|
+
file,
|
|
2291
|
+
(url) => setEditing(
|
|
2292
|
+
(current) => current ? { ...current, [f.id]: url } : current
|
|
2293
|
+
),
|
|
2294
|
+
ctx.uploadImage
|
|
2295
|
+
);
|
|
2296
|
+
}
|
|
1986
2297
|
},
|
|
1987
|
-
|
|
1988
|
-
children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
|
|
2298
|
+
children: "Upload"
|
|
1989
2299
|
}
|
|
1990
2300
|
)
|
|
1991
|
-
] },
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2301
|
+
] }),
|
|
2302
|
+
editing[f.id] ? /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: String(editing[f.id]).match(/\.(mp4|webm|mov|ogg)$/i) || String(editing[f.id]).includes("video") ? /* @__PURE__ */ jsx(
|
|
2303
|
+
"video",
|
|
2304
|
+
{
|
|
2305
|
+
src: String(editing[f.id]),
|
|
2306
|
+
controls: true,
|
|
2307
|
+
className: "w-full h-auto max-h-48 object-contain rounded-lg"
|
|
2308
|
+
}
|
|
2309
|
+
) : /* @__PURE__ */ jsx(
|
|
2310
|
+
"img",
|
|
2311
|
+
{
|
|
2312
|
+
src: String(editing[f.id]),
|
|
2313
|
+
alt: "",
|
|
2314
|
+
className: "w-full h-auto max-h-48 object-contain rounded-lg"
|
|
2315
|
+
}
|
|
2316
|
+
) }) : null
|
|
2317
|
+
] }) : f.type === "password" ? /* @__PURE__ */ jsx(
|
|
2318
|
+
PasswordField,
|
|
1995
2319
|
{
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
1999
|
-
arr.push("#000000");
|
|
2000
|
-
setEditing({ ...editing, [f.id]: arr });
|
|
2001
|
-
},
|
|
2002
|
-
className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-lg border border-indigo-100 transition-colors",
|
|
2003
|
-
children: [
|
|
2004
|
-
/* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
|
|
2005
|
-
" Add Color"
|
|
2006
|
-
]
|
|
2320
|
+
value: String(editing[f.id] ?? ""),
|
|
2321
|
+
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
2007
2322
|
}
|
|
2008
|
-
)
|
|
2009
|
-
|
|
2010
|
-
|
|
2323
|
+
) : f.type === "signature" ? /* @__PURE__ */ jsx(
|
|
2324
|
+
SignatureInput,
|
|
2325
|
+
{
|
|
2326
|
+
value: editing[f.id],
|
|
2327
|
+
onChange: (val) => setEditing({ ...editing, [f.id]: val }),
|
|
2328
|
+
label: f.label
|
|
2329
|
+
}
|
|
2330
|
+
) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2331
|
+
/* @__PURE__ */ jsx(
|
|
2332
|
+
"input",
|
|
2333
|
+
{
|
|
2334
|
+
type: "color",
|
|
2335
|
+
value: String(editing[f.id] ?? "#000000").startsWith("#") && String(editing[f.id] ?? "").length === 7 ? String(editing[f.id]) : "#000000",
|
|
2336
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
2337
|
+
className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
|
|
2338
|
+
}
|
|
2339
|
+
),
|
|
2011
2340
|
/* @__PURE__ */ jsx(
|
|
2012
2341
|
"input",
|
|
2013
2342
|
{
|
|
2014
2343
|
type: "text",
|
|
2015
|
-
value: String(
|
|
2016
|
-
onChange: (e) => {
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
setEditing({ ...editing, [f.id]: arr });
|
|
2020
|
-
},
|
|
2021
|
-
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
2344
|
+
value: String(editing[f.id] ?? ""),
|
|
2345
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
2346
|
+
placeholder: "#000000",
|
|
2347
|
+
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 font-mono shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
2022
2348
|
}
|
|
2023
2349
|
),
|
|
2024
2350
|
/* @__PURE__ */ jsx(
|
|
2351
|
+
"div",
|
|
2352
|
+
{
|
|
2353
|
+
className: "w-8 h-8 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
|
|
2354
|
+
style: { backgroundColor: String(editing[f.id] ?? "#000000") }
|
|
2355
|
+
}
|
|
2356
|
+
)
|
|
2357
|
+
] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2358
|
+
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : []).map((item, idx) => {
|
|
2359
|
+
const colorVal = String(item ?? "").trim();
|
|
2360
|
+
const validHex = colorVal.startsWith("#") && (colorVal.length === 4 || colorVal.length === 7) ? colorVal : "#000000";
|
|
2361
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
2362
|
+
/* @__PURE__ */ jsx(
|
|
2363
|
+
"input",
|
|
2364
|
+
{
|
|
2365
|
+
type: "color",
|
|
2366
|
+
value: validHex.length === 7 ? validHex : "#000000",
|
|
2367
|
+
onChange: (e) => {
|
|
2368
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
2369
|
+
arr[idx] = e.target.value;
|
|
2370
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2371
|
+
},
|
|
2372
|
+
className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
|
|
2373
|
+
}
|
|
2374
|
+
),
|
|
2375
|
+
/* @__PURE__ */ jsx(
|
|
2376
|
+
"input",
|
|
2377
|
+
{
|
|
2378
|
+
type: "text",
|
|
2379
|
+
value: colorVal,
|
|
2380
|
+
onChange: (e) => {
|
|
2381
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
2382
|
+
arr[idx] = e.target.value;
|
|
2383
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2384
|
+
},
|
|
2385
|
+
placeholder: "#1c2a44",
|
|
2386
|
+
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2 text-sm text-slate-800 font-mono shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
2387
|
+
}
|
|
2388
|
+
),
|
|
2389
|
+
/* @__PURE__ */ jsx(
|
|
2390
|
+
"div",
|
|
2391
|
+
{
|
|
2392
|
+
className: "w-7 h-7 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
|
|
2393
|
+
style: { backgroundColor: colorVal || "#000000" }
|
|
2394
|
+
}
|
|
2395
|
+
),
|
|
2396
|
+
/* @__PURE__ */ jsx(
|
|
2397
|
+
"button",
|
|
2398
|
+
{
|
|
2399
|
+
type: "button",
|
|
2400
|
+
onClick: () => {
|
|
2401
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
2402
|
+
arr.splice(idx, 1);
|
|
2403
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2404
|
+
},
|
|
2405
|
+
className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",
|
|
2406
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
|
|
2407
|
+
}
|
|
2408
|
+
)
|
|
2409
|
+
] }, idx);
|
|
2410
|
+
}),
|
|
2411
|
+
/* @__PURE__ */ jsxs(
|
|
2412
|
+
"button",
|
|
2413
|
+
{
|
|
2414
|
+
type: "button",
|
|
2415
|
+
onClick: () => {
|
|
2416
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
2417
|
+
arr.push("#000000");
|
|
2418
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2419
|
+
},
|
|
2420
|
+
className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-lg border border-indigo-100 transition-colors",
|
|
2421
|
+
children: [
|
|
2422
|
+
/* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
|
|
2423
|
+
" Add Color"
|
|
2424
|
+
]
|
|
2425
|
+
}
|
|
2426
|
+
)
|
|
2427
|
+
] }) : f.type === "list" ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2428
|
+
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) => {
|
|
2429
|
+
const isFeatures = f.id === "features" || f.label.toLowerCase().includes("caracter\xEDstica") || f.label.toLowerCase().includes("beneficio");
|
|
2430
|
+
const placeholder = isFeatures ? `Caracter\xEDstica o beneficio ${idx + 1}...` : `Entregable o punto clave ${idx + 1}...`;
|
|
2431
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
2432
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-mono font-bold text-slate-400 w-6 text-right shrink-0", children: [
|
|
2433
|
+
idx + 1,
|
|
2434
|
+
"."
|
|
2435
|
+
] }),
|
|
2436
|
+
/* @__PURE__ */ jsx(
|
|
2437
|
+
"input",
|
|
2438
|
+
{
|
|
2439
|
+
type: "text",
|
|
2440
|
+
value: String(item ?? ""),
|
|
2441
|
+
placeholder,
|
|
2442
|
+
onChange: (e) => {
|
|
2443
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
2444
|
+
arr[idx] = e.target.value;
|
|
2445
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2446
|
+
},
|
|
2447
|
+
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all bg-white"
|
|
2448
|
+
}
|
|
2449
|
+
),
|
|
2450
|
+
/* @__PURE__ */ jsx(
|
|
2451
|
+
"button",
|
|
2452
|
+
{
|
|
2453
|
+
type: "button",
|
|
2454
|
+
onClick: () => {
|
|
2455
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
2456
|
+
arr.splice(idx, 1);
|
|
2457
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2458
|
+
},
|
|
2459
|
+
className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors cursor-pointer",
|
|
2460
|
+
title: "Eliminar elemento",
|
|
2461
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
|
|
2462
|
+
}
|
|
2463
|
+
)
|
|
2464
|
+
] }, idx);
|
|
2465
|
+
}),
|
|
2466
|
+
/* @__PURE__ */ jsxs(
|
|
2025
2467
|
"button",
|
|
2026
2468
|
{
|
|
2027
2469
|
type: "button",
|
|
2028
2470
|
onClick: () => {
|
|
2029
2471
|
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
2030
|
-
arr.
|
|
2472
|
+
arr.push("");
|
|
2031
2473
|
setEditing({ ...editing, [f.id]: arr });
|
|
2032
2474
|
},
|
|
2033
|
-
className: "
|
|
2034
|
-
children:
|
|
2475
|
+
className: "inline-flex items-center gap-1.5 px-3.5 py-2 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 text-xs font-bold rounded-xl border border-indigo-100 transition-colors cursor-pointer",
|
|
2476
|
+
children: [
|
|
2477
|
+
/* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
|
|
2478
|
+
" ",
|
|
2479
|
+
f.id === "features" || f.label.toLowerCase().includes("caracter\xEDstica") ? "Agregar caracter\xEDstica uno a uno" : "Agregar entregable / punto uno a uno"
|
|
2480
|
+
]
|
|
2035
2481
|
}
|
|
2036
2482
|
)
|
|
2037
|
-
] },
|
|
2038
|
-
|
|
2039
|
-
|
|
2483
|
+
] }) : f.type === "link" ? /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
2484
|
+
/* @__PURE__ */ jsx(
|
|
2485
|
+
Input,
|
|
2486
|
+
{
|
|
2487
|
+
size: "large",
|
|
2488
|
+
value: String(editing[f.id] ?? ""),
|
|
2489
|
+
readOnly: f.readOnly || f.autoIncrement && !isCreatingEntry,
|
|
2490
|
+
disabled: f.readOnly,
|
|
2491
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
2492
|
+
placeholder: f.label,
|
|
2493
|
+
className: "flex-1 rounded-xl"
|
|
2494
|
+
}
|
|
2495
|
+
),
|
|
2496
|
+
Boolean(editing[f.id]) && String(editing[f.id]).startsWith("http") ? /* @__PURE__ */ jsxs(
|
|
2497
|
+
"a",
|
|
2498
|
+
{
|
|
2499
|
+
href: String(editing[f.id]),
|
|
2500
|
+
target: "_blank",
|
|
2501
|
+
rel: "noopener noreferrer",
|
|
2502
|
+
className: "inline-flex items-center gap-1.5 px-3 py-2 bg-blue-50 text-blue-600 hover:bg-blue-100 rounded-xl text-xs font-bold border border-blue-200 transition-colors shrink-0",
|
|
2503
|
+
children: [
|
|
2504
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "w-3.5 h-3.5" }),
|
|
2505
|
+
String(editing[f.id]).includes("maps") ? "Ver en Mapa" : "Abrir"
|
|
2506
|
+
]
|
|
2507
|
+
}
|
|
2508
|
+
) : null
|
|
2509
|
+
] }) : /* @__PURE__ */ jsx(
|
|
2510
|
+
Input,
|
|
2040
2511
|
{
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
className: "
|
|
2048
|
-
children: [
|
|
2049
|
-
/* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
|
|
2050
|
-
" Add Item"
|
|
2051
|
-
]
|
|
2512
|
+
size: "large",
|
|
2513
|
+
value: String(editing[f.id] ?? ""),
|
|
2514
|
+
readOnly: f.readOnly || f.autoIncrement && !isCreatingEntry,
|
|
2515
|
+
disabled: f.readOnly,
|
|
2516
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
2517
|
+
placeholder: f.label,
|
|
2518
|
+
className: "w-full rounded-xl"
|
|
2052
2519
|
}
|
|
2053
2520
|
)
|
|
2054
|
-
] })
|
|
2055
|
-
|
|
2056
|
-
{
|
|
2057
|
-
value: String(editing[f.id] ?? ""),
|
|
2058
|
-
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
2059
|
-
className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
2060
|
-
}
|
|
2061
|
-
)
|
|
2062
|
-
] }, f.id)) }) }),
|
|
2521
|
+
] }, f.id);
|
|
2522
|
+
}) }) }),
|
|
2063
2523
|
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 justify-end gap-3 border-t border-slate-200 bg-white px-6 py-4", children: [
|
|
2064
2524
|
/* @__PURE__ */ jsx(
|
|
2065
|
-
|
|
2525
|
+
Button,
|
|
2066
2526
|
{
|
|
2527
|
+
size: "large",
|
|
2067
2528
|
onClick: () => setEditing(null),
|
|
2068
2529
|
disabled: saving,
|
|
2069
|
-
className: "rounded-xl
|
|
2070
|
-
children:
|
|
2530
|
+
className: "rounded-xl font-medium",
|
|
2531
|
+
children: t.cancel
|
|
2071
2532
|
}
|
|
2072
2533
|
),
|
|
2073
2534
|
/* @__PURE__ */ jsx(
|
|
2074
|
-
|
|
2535
|
+
Button,
|
|
2075
2536
|
{
|
|
2537
|
+
size: "large",
|
|
2538
|
+
type: "primary",
|
|
2076
2539
|
onClick: save,
|
|
2077
|
-
|
|
2078
|
-
className: "
|
|
2079
|
-
children:
|
|
2080
|
-
/* @__PURE__ */ jsxs("svg", { className: "animate-spin h-4 w-4 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
2081
|
-
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
2082
|
-
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
|
|
2083
|
-
] }),
|
|
2084
|
-
"Saving..."
|
|
2085
|
-
] }) : "Save Entry"
|
|
2540
|
+
loading: saving,
|
|
2541
|
+
className: "min-w-[140px] rounded-xl font-bold shadow-sm bg-blue-600 hover:bg-blue-700",
|
|
2542
|
+
children: collection.submitLabel || (isCreatingEntry ? t.create.toUpperCase() : t.save.toUpperCase())
|
|
2086
2543
|
}
|
|
2087
2544
|
)
|
|
2088
2545
|
] })
|
|
2089
|
-
] })
|
|
2546
|
+
] }) })
|
|
2090
2547
|
}
|
|
2091
2548
|
),
|
|
2092
2549
|
/* @__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: [
|
|
2093
2550
|
/* @__PURE__ */ jsx("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
2094
2551
|
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)),
|
|
2095
|
-
/* @__PURE__ */ jsx("th", { className: "px-6 py-4 text-right text-xs font-bold text-slate-500 uppercase tracking-wider sticky right-0 bg-slate-50 border-l border-slate-200 z-10", children:
|
|
2552
|
+
/* @__PURE__ */ jsx("th", { className: "px-6 py-4 text-right text-xs font-bold text-slate-500 uppercase tracking-wider sticky right-0 bg-slate-50 border-l border-slate-200 z-10", children: t.actions })
|
|
2096
2553
|
] }) }),
|
|
2097
2554
|
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-slate-100", children: loadingEntries ? (
|
|
2098
2555
|
// Loading skeleton rows
|
|
@@ -2104,13 +2561,29 @@ function CollectionEditor({ collection }) {
|
|
|
2104
2561
|
(() => {
|
|
2105
2562
|
let res = entries;
|
|
2106
2563
|
if (search && collection.searchBy?.length) {
|
|
2107
|
-
const q = search.toLowerCase();
|
|
2108
|
-
res = res.filter((e) =>
|
|
2564
|
+
const q = search.toLowerCase().trim();
|
|
2565
|
+
res = res.filter((e) => {
|
|
2566
|
+
return collection.searchBy.some((field) => {
|
|
2567
|
+
const val = String(e[field] ?? "").toLowerCase();
|
|
2568
|
+
if (!val) return false;
|
|
2569
|
+
if (val.includes(q)) return true;
|
|
2570
|
+
const normVal = val.replace(/-/g, "/");
|
|
2571
|
+
const normQ = q.replace(/-/g, "/");
|
|
2572
|
+
return normVal.includes(normQ);
|
|
2573
|
+
});
|
|
2574
|
+
});
|
|
2109
2575
|
}
|
|
2110
2576
|
if (Object.keys(filters).length > 0) {
|
|
2111
2577
|
res = res.filter((e) => {
|
|
2112
2578
|
for (const [k, v] of Object.entries(filters)) {
|
|
2113
|
-
if (v
|
|
2579
|
+
if (!v) continue;
|
|
2580
|
+
const entryVal = String(e[k] ?? "").trim();
|
|
2581
|
+
const filterVal = String(v).trim();
|
|
2582
|
+
const normEntry = entryVal.replace(/-/g, "/");
|
|
2583
|
+
const normFilter = filterVal.replace(/-/g, "/");
|
|
2584
|
+
if (normEntry !== normFilter && !normEntry.includes(normFilter)) {
|
|
2585
|
+
return false;
|
|
2586
|
+
}
|
|
2114
2587
|
}
|
|
2115
2588
|
return true;
|
|
2116
2589
|
});
|
|
@@ -2126,10 +2599,22 @@ function CollectionEditor({ collection }) {
|
|
|
2126
2599
|
onDragEnd,
|
|
2127
2600
|
className: `hover:bg-slate-50/50 transition-colors group cursor-grab active:cursor-grabbing ${deletingId === e.id ? "opacity-50" : ""} ${dragOverIdx === idx ? "border-t-2 border-t-indigo-500" : ""}`,
|
|
2128
2601
|
children: [
|
|
2129
|
-
visibleFields.map((f) => /* @__PURE__ */ jsx("td", { className: "px-6 py-4 text-slate-700 max-w-[200px] truncate", children: f.type === "branch-settings" ? /* @__PURE__ */ jsx(BranchSettingsSummary, { value: e[f.id] }) : f.type === "boolean" ? e[f.id] ? /* @__PURE__ */ jsx("span", { className: "inline-flex px-2 py-1 rounded bg-green-100 text-green-700 text-xs font-bold", children: "Yes" }) : /* @__PURE__ */ jsx("span", { className: "inline-flex px-2 py-1 rounded bg-slate-100 text-slate-500 text-xs font-bold", children: "No" }) : f.type === "image" && (Array.isArray(e[f.id]) ? e[f.id].length > 0 : !!e[f.id]) ? /* @__PURE__ */ jsx("img", { src: Array.isArray(e[f.id]) ? String(e[f.id][0]) : String(e[f.id]), alt: "", className: "h-8 w-8 object-cover rounded shadow-sm ring-1 ring-slate-200" }) : f.type === "image" ? /* @__PURE__ */ jsx("div", { className: "h-8 w-8 rounded bg-slate-100 ring-1 ring-slate-200/50 flex items-center justify-center text-slate-300", children: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) }) : (f.
|
|
2602
|
+
visibleFields.map((f) => /* @__PURE__ */ jsx("td", { className: "px-6 py-4 text-slate-700 max-w-[200px] truncate", children: f.type === "branch-settings" ? /* @__PURE__ */ jsx(BranchSettingsSummary, { value: e[f.id] }) : f.type === "boolean" ? e[f.id] ? /* @__PURE__ */ jsx("span", { className: "inline-flex px-2 py-1 rounded bg-green-100 text-green-700 text-xs font-bold", children: "Yes" }) : /* @__PURE__ */ jsx("span", { className: "inline-flex px-2 py-1 rounded bg-slate-100 text-slate-500 text-xs font-bold", children: "No" }) : f.type === "image" && (Array.isArray(e[f.id]) ? e[f.id].length > 0 : !!e[f.id]) ? /* @__PURE__ */ jsx("img", { src: Array.isArray(e[f.id]) ? String(e[f.id][0]) : String(e[f.id]), alt: "", className: "h-8 w-8 object-cover rounded shadow-sm ring-1 ring-slate-200" }) : f.type === "image" ? /* @__PURE__ */ jsx("div", { className: "h-8 w-8 rounded bg-slate-100 ring-1 ring-slate-200/50 flex items-center justify-center text-slate-300", children: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) }) : (f.id === "status" || f.id === "estado") && e[f.id] ? /* @__PURE__ */ jsx("span", { className: `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-semibold ${String(e[f.id]) === "Terminado" || String(e[f.id]) === "Terminada" || String(e[f.id]).includes("Entregado") ? "bg-emerald-50 text-emerald-700 border border-emerald-200" : String(e[f.id]) === "Proceso" || String(e[f.id]).includes("Preparaci\xF3n") ? "bg-amber-50 text-amber-700 border border-amber-200" : String(e[f.id]) === "Cancelado" || String(e[f.id]).includes("Cancelado") ? "bg-rose-50 text-rose-700 border border-rose-200" : "bg-blue-50 text-blue-700 border border-blue-200"}`, children: String(e[f.id]) }) : (f.type === "reference" || f.type === "select" && f.collection) && e[f.id] ? e.clienteNombre && f.id === "clienteId" ? /* @__PURE__ */ jsx("span", { className: "font-medium text-slate-800", children: String(e.clienteNombre) }) : e.empleadoNombre && f.id === "empleadoId" ? /* @__PURE__ */ jsx("span", { className: "font-medium text-slate-800", children: String(e.empleadoNombre) }) : /* @__PURE__ */ jsx(ReferenceTableCell, { collectionId: f.collection, entryId: e[f.id], displayField: f.displayField, valueField: f.valueField, multiple: f.multiple }) : f.type === "signature" && e[f.id] ? /* @__PURE__ */ jsx(Image, { src: String(e[f.id]), alt: "Firma", className: "h-7 max-w-[80px] object-contain rounded bg-white border border-slate-200 p-0.5 inline-block shadow-xs cursor-pointer", preview: { mask: "Ver" } }) : f.type === "number" && e[f.id] !== void 0 && e[f.id] !== null && String(e[f.id]) !== "" ? f.id.toLowerCase().includes("price") || f.id.toLowerCase().includes("precio") || f.label.toLowerCase().includes("precio") || f.label.includes("$") || f.id.toLowerCase().includes("amount") || f.id.toLowerCase().includes("total") ? /* @__PURE__ */ jsxs("span", { className: "font-semibold text-slate-800", children: [
|
|
2130
2603
|
"$ ",
|
|
2131
2604
|
Number(e[f.id]).toLocaleString("es-CO")
|
|
2132
|
-
] }) : /* @__PURE__ */ jsx("span", { children: Number(e[f.id]).toLocaleString("es-CO") }) :
|
|
2605
|
+
] }) : /* @__PURE__ */ jsx("span", { children: Number(e[f.id]).toLocaleString("es-CO") }) : f.type === "link" || typeof e[f.id] === "string" && String(e[f.id]).startsWith("http") ? /* @__PURE__ */ jsxs(
|
|
2606
|
+
"a",
|
|
2607
|
+
{
|
|
2608
|
+
href: String(e[f.id]),
|
|
2609
|
+
target: "_blank",
|
|
2610
|
+
rel: "noopener noreferrer",
|
|
2611
|
+
className: "inline-flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800 underline font-medium",
|
|
2612
|
+
children: [
|
|
2613
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "w-3 h-3" }),
|
|
2614
|
+
String(e[f.id]).includes("maps") ? "Ver mapa" : "Abrir"
|
|
2615
|
+
]
|
|
2616
|
+
}
|
|
2617
|
+
) : String(e[f.id] ?? "") }, f.id)),
|
|
2133
2618
|
/* @__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-2", children: [
|
|
2134
2619
|
/* @__PURE__ */ jsx("div", { className: "p-2 text-slate-300 cursor-grab active:cursor-grabbing", title: "Drag to reorder", children: /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "w-4 h-4", children: /* @__PURE__ */ jsx("path", { d: "M5.5 3C6.32843 3 7 3.67157 7 4.5C7 5.32843 6.32843 6 5.5 6C4.67157 6 4 5.32843 4 4.5C4 3.67157 4.67157 3 5.5 3ZM9.5 3C10.3284 3 11 3.67157 11 4.5C11 5.32843 10.3284 6 9.5 6C8.67157 6 8 5.32843 8 4.5C8 3.67157 8.67157 3 9.5 3ZM5.5 7.5C6.32843 7.5 7 8.17157 7 9C7 9.82843 6.32843 10.5 5.5 10.5C4.67157 10.5 4 9.82843 4 9C4 8.17157 4.67157 7.5 5.5 7.5ZM9.5 7.5C10.3284 7.5 11 8.17157 11 9C11 9.82843 10.3284 10.5 9.5 10.5C8.67157 10.5 8 9.82843 8 9C8 8.17157 8.67157 7.5 9.5 7.5ZM5.5 12C6.32843 12 7 12.6716 7 13.5C7 14.3284 6.32843 15 5.5 15C4.67157 15 4 14.3284 4 13.5C4 12.6716 4.67157 12 5.5 12ZM9.5 12C10.3284 12 11 12.6716 11 13.5C11 14.3284 10.3284 15 9.5 15C8.67157 15 8 14.3284 8 13.5C8 12.6716 8.67157 12 9.5 12Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }) }),
|
|
2135
2620
|
/* @__PURE__ */ jsx(
|
|
@@ -2137,7 +2622,7 @@ function CollectionEditor({ collection }) {
|
|
|
2137
2622
|
{
|
|
2138
2623
|
onClick: () => setEditing(e),
|
|
2139
2624
|
className: "p-2 rounded-lg text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 transition-colors",
|
|
2140
|
-
title:
|
|
2625
|
+
title: t.edit,
|
|
2141
2626
|
children: /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4" })
|
|
2142
2627
|
}
|
|
2143
2628
|
),
|
|
@@ -2147,7 +2632,7 @@ function CollectionEditor({ collection }) {
|
|
|
2147
2632
|
onClick: () => remove(e.id),
|
|
2148
2633
|
disabled: deletingId === e.id,
|
|
2149
2634
|
className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors disabled:opacity-50",
|
|
2150
|
-
title:
|
|
2635
|
+
title: t.delete,
|
|
2151
2636
|
children: deletingId === e.id ? /* @__PURE__ */ jsxs("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
2152
2637
|
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
2153
2638
|
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
|
|
@@ -2167,7 +2652,7 @@ function CollectionEditor({ collection }) {
|
|
|
2167
2652
|
className: "px-6 py-12 text-center text-slate-500",
|
|
2168
2653
|
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
2169
2654
|
/* @__PURE__ */ jsx(Boxes, { className: "h-10 w-10 text-slate-300 mb-3" }),
|
|
2170
|
-
/* @__PURE__ */ jsx("p", { children:
|
|
2655
|
+
/* @__PURE__ */ jsx("p", { children: t.noRecords })
|
|
2171
2656
|
] })
|
|
2172
2657
|
}
|
|
2173
2658
|
) })
|
|
@@ -2188,7 +2673,7 @@ function CollectionEditor({ collection }) {
|
|
|
2188
2673
|
return true;
|
|
2189
2674
|
});
|
|
2190
2675
|
}
|
|
2191
|
-
return `${res.length}
|
|
2676
|
+
return `${res.length} ${t.entries}`;
|
|
2192
2677
|
})() }),
|
|
2193
2678
|
(() => {
|
|
2194
2679
|
let res = entries;
|
|
@@ -2668,79 +3153,143 @@ function Row({
|
|
|
2668
3153
|
function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
2669
3154
|
const [open, setOpen] = useState(false);
|
|
2670
3155
|
const [search, setSearch] = useState("");
|
|
2671
|
-
const
|
|
2672
|
-
const
|
|
3156
|
+
const btnRef = useRef(null);
|
|
3157
|
+
const [coords, setCoords] = useState({
|
|
3158
|
+
top: 0,
|
|
3159
|
+
left: 0,
|
|
3160
|
+
width: 250
|
|
3161
|
+
});
|
|
3162
|
+
const updateCoords = useCallback(() => {
|
|
3163
|
+
if (btnRef.current) {
|
|
3164
|
+
const rect = btnRef.current.getBoundingClientRect();
|
|
3165
|
+
const dropdownHeight = 280;
|
|
3166
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
3167
|
+
const opensUp = spaceBelow < dropdownHeight && rect.top > dropdownHeight;
|
|
3168
|
+
setCoords({
|
|
3169
|
+
top: opensUp ? Math.max(10, rect.top - dropdownHeight - 6) : rect.bottom + 6,
|
|
3170
|
+
left: Math.max(10, Math.min(rect.left, window.innerWidth - rect.width - 10)),
|
|
3171
|
+
width: rect.width
|
|
3172
|
+
});
|
|
3173
|
+
}
|
|
3174
|
+
}, []);
|
|
3175
|
+
const handleToggle = () => {
|
|
3176
|
+
if (!open) {
|
|
3177
|
+
updateCoords();
|
|
3178
|
+
}
|
|
3179
|
+
setOpen((prev) => !prev);
|
|
3180
|
+
setSearch("");
|
|
3181
|
+
};
|
|
3182
|
+
useEffect(() => {
|
|
3183
|
+
if (!open) return;
|
|
3184
|
+
const handleScrollOrResize = () => {
|
|
3185
|
+
updateCoords();
|
|
3186
|
+
};
|
|
3187
|
+
window.addEventListener("scroll", handleScrollOrResize, true);
|
|
3188
|
+
window.addEventListener("resize", handleScrollOrResize);
|
|
3189
|
+
return () => {
|
|
3190
|
+
window.removeEventListener("scroll", handleScrollOrResize, true);
|
|
3191
|
+
window.removeEventListener("resize", handleScrollOrResize);
|
|
3192
|
+
};
|
|
3193
|
+
}, [open, updateCoords]);
|
|
3194
|
+
const filtered = options.filter(
|
|
3195
|
+
(o) => o.toLowerCase().includes(search.toLowerCase())
|
|
3196
|
+
);
|
|
3197
|
+
const capped = filtered.slice(0, 100);
|
|
2673
3198
|
const SelectedIcon = iconMap && value ? iconMap[value] : null;
|
|
2674
3199
|
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2675
3200
|
/* @__PURE__ */ jsxs(
|
|
2676
3201
|
"button",
|
|
2677
3202
|
{
|
|
3203
|
+
ref: btnRef,
|
|
2678
3204
|
type: "button",
|
|
2679
|
-
onClick:
|
|
2680
|
-
|
|
2681
|
-
setSearch("");
|
|
2682
|
-
},
|
|
2683
|
-
className: "w-full flex items-center justify-between rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm hover:border-slate-300 focus:border-indigo-500 bg-white transition-colors",
|
|
3205
|
+
onClick: handleToggle,
|
|
3206
|
+
className: "w-full flex items-center justify-between rounded-xl border border-slate-200 px-3.5 py-2.5 text-sm text-slate-800 shadow-sm hover:border-slate-300 focus:border-indigo-500 bg-white transition-colors cursor-pointer",
|
|
2684
3207
|
children: [
|
|
2685
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 truncate", children: [
|
|
2686
|
-
SelectedIcon && /* @__PURE__ */ jsx(
|
|
2687
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: value || placeholder || "
|
|
3208
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2.5 truncate", children: [
|
|
3209
|
+
SelectedIcon && /* @__PURE__ */ jsx("span", { className: "w-5 h-5 flex items-center justify-center rounded bg-slate-100 text-indigo-600 shrink-0", children: /* @__PURE__ */ jsx(SelectedIcon, { className: "w-3.5 h-3.5" }) }),
|
|
3210
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: value || placeholder || "Seleccionar icono..." })
|
|
2688
3211
|
] }),
|
|
2689
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: `w-4 h-4 text-slate-400 transition-transform shrink-0 ${open ? "rotate-180" : ""}` })
|
|
2690
|
-
]
|
|
2691
|
-
}
|
|
2692
|
-
),
|
|
2693
|
-
open && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2694
|
-
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-[100]", onClick: () => setOpen(false) }),
|
|
2695
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute z-[101] mt-1 w-full rounded-xl border border-slate-200 bg-white shadow-2xl max-h-72 flex flex-col overflow-hidden animate-in fade-in slide-in-from-top-1 duration-150", children: [
|
|
2696
|
-
/* @__PURE__ */ jsxs("div", { className: "p-2 border-b border-slate-100 flex items-center gap-2", children: [
|
|
2697
|
-
/* @__PURE__ */ jsx(Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
|
|
2698
3212
|
/* @__PURE__ */ jsx(
|
|
2699
|
-
|
|
3213
|
+
ChevronDown,
|
|
2700
3214
|
{
|
|
2701
|
-
|
|
2702
|
-
type: "text",
|
|
2703
|
-
className: "w-full text-sm outline-none bg-transparent text-slate-800 placeholder:text-slate-400",
|
|
2704
|
-
placeholder: "Type to search\u2026",
|
|
2705
|
-
value: search,
|
|
2706
|
-
onChange: (e) => setSearch(e.target.value)
|
|
3215
|
+
className: `w-4 h-4 text-slate-400 transition-transform shrink-0 ${open ? "rotate-180" : ""}`
|
|
2707
3216
|
}
|
|
2708
|
-
)
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
3217
|
+
)
|
|
3218
|
+
]
|
|
3219
|
+
}
|
|
3220
|
+
),
|
|
3221
|
+
open && typeof document !== "undefined" && createPortal(
|
|
3222
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3223
|
+
/* @__PURE__ */ jsx(
|
|
3224
|
+
"div",
|
|
3225
|
+
{
|
|
3226
|
+
className: "fixed inset-0 z-[99998] cursor-default",
|
|
3227
|
+
onClick: () => setOpen(false)
|
|
3228
|
+
}
|
|
3229
|
+
),
|
|
3230
|
+
/* @__PURE__ */ jsxs(
|
|
3231
|
+
"div",
|
|
3232
|
+
{
|
|
3233
|
+
style: {
|
|
3234
|
+
position: "fixed",
|
|
3235
|
+
top: `${coords.top}px`,
|
|
3236
|
+
left: `${coords.left}px`,
|
|
3237
|
+
width: `${coords.width}px`
|
|
3238
|
+
},
|
|
3239
|
+
className: "z-[99999] rounded-2xl border border-slate-200 bg-white shadow-2xl max-h-72 flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-150",
|
|
3240
|
+
children: [
|
|
3241
|
+
/* @__PURE__ */ jsxs("div", { className: "p-2.5 border-b border-slate-100 flex items-center gap-2 bg-slate-50/50", children: [
|
|
3242
|
+
/* @__PURE__ */ jsx(Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
|
|
3243
|
+
/* @__PURE__ */ jsx(
|
|
3244
|
+
"input",
|
|
3245
|
+
{
|
|
3246
|
+
autoFocus: true,
|
|
3247
|
+
type: "text",
|
|
3248
|
+
className: "w-full text-sm outline-none bg-transparent text-slate-800 placeholder:text-slate-400",
|
|
3249
|
+
placeholder: "Buscar icono por nombre (ej: LuCode, LuServer)...",
|
|
3250
|
+
value: search,
|
|
3251
|
+
onChange: (e) => setSearch(e.target.value)
|
|
3252
|
+
}
|
|
3253
|
+
),
|
|
3254
|
+
search && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-slate-400 bg-slate-200 px-1.5 py-0.5 rounded-full shrink-0 tabular-nums", children: filtered.length })
|
|
3255
|
+
] }),
|
|
3256
|
+
/* @__PURE__ */ jsxs("div", { className: "overflow-y-auto flex-1 p-1.5", children: [
|
|
3257
|
+
filtered.length === 0 && /* @__PURE__ */ jsxs("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
|
|
3258
|
+
'No se encontraron iconos para "',
|
|
3259
|
+
search,
|
|
3260
|
+
'"'
|
|
3261
|
+
] }),
|
|
3262
|
+
capped.map((opt) => {
|
|
3263
|
+
const OptIcon = iconMap ? iconMap[opt] : null;
|
|
3264
|
+
return /* @__PURE__ */ jsxs(
|
|
3265
|
+
"button",
|
|
3266
|
+
{
|
|
3267
|
+
type: "button",
|
|
3268
|
+
className: `w-full flex items-center gap-2.5 text-left px-2.5 py-2 text-sm rounded-xl transition-colors cursor-pointer ${value === opt ? "bg-indigo-50 text-indigo-700 font-semibold" : "text-slate-700 hover:bg-slate-50"}`,
|
|
3269
|
+
onClick: () => {
|
|
3270
|
+
onChange(opt);
|
|
3271
|
+
setOpen(false);
|
|
3272
|
+
},
|
|
3273
|
+
children: [
|
|
3274
|
+
OptIcon && /* @__PURE__ */ jsx("span", { className: "w-6 h-6 flex items-center justify-center rounded-lg bg-slate-100 text-indigo-600 shrink-0", children: /* @__PURE__ */ jsx(OptIcon, { className: "w-4 h-4" }) }),
|
|
3275
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: opt })
|
|
3276
|
+
]
|
|
3277
|
+
},
|
|
3278
|
+
opt
|
|
3279
|
+
);
|
|
3280
|
+
}),
|
|
3281
|
+
filtered.length > 100 && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 text-[10px] text-slate-400 text-center border-t border-slate-100 mt-1", children: [
|
|
3282
|
+
"Mostrando 100 de ",
|
|
3283
|
+
filtered.length,
|
|
3284
|
+
" \u2014 escribe en el buscador para filtrar"
|
|
3285
|
+
] })
|
|
3286
|
+
] })
|
|
3287
|
+
]
|
|
3288
|
+
}
|
|
3289
|
+
)
|
|
3290
|
+
] }),
|
|
3291
|
+
document.body
|
|
3292
|
+
)
|
|
2744
3293
|
] });
|
|
2745
3294
|
}
|
|
2746
3295
|
function PasswordField({ value, onChange }) {
|
|
@@ -2774,6 +3323,197 @@ function PasswordField({ value, onChange }) {
|
|
|
2774
3323
|
)
|
|
2775
3324
|
] });
|
|
2776
3325
|
}
|
|
3326
|
+
function SignatureInput({
|
|
3327
|
+
value,
|
|
3328
|
+
onChange,
|
|
3329
|
+
label
|
|
3330
|
+
}) {
|
|
3331
|
+
const t = useAdminI18n();
|
|
3332
|
+
const [modalOpen, setModalOpen] = useState(false);
|
|
3333
|
+
const canvasRef = useRef(null);
|
|
3334
|
+
const isDrawingRef = useRef(false);
|
|
3335
|
+
const fileInputRef = useRef(null);
|
|
3336
|
+
const sigVal = typeof value === "string" ? value : "";
|
|
3337
|
+
const displayLabel = label || t.signatureRegistered;
|
|
3338
|
+
const startDrawing = (e) => {
|
|
3339
|
+
const canvas = canvasRef.current;
|
|
3340
|
+
if (!canvas) return;
|
|
3341
|
+
const ctx = canvas.getContext("2d");
|
|
3342
|
+
if (!ctx) return;
|
|
3343
|
+
isDrawingRef.current = true;
|
|
3344
|
+
const rect = canvas.getBoundingClientRect();
|
|
3345
|
+
const x = "touches" in e ? e.touches[0].clientX - rect.left : e.clientX - rect.left;
|
|
3346
|
+
const y = "touches" in e ? e.touches[0].clientY - rect.top : e.clientY - rect.top;
|
|
3347
|
+
ctx.beginPath();
|
|
3348
|
+
ctx.moveTo(x, y);
|
|
3349
|
+
};
|
|
3350
|
+
const draw = (e) => {
|
|
3351
|
+
if (!isDrawingRef.current) return;
|
|
3352
|
+
const canvas = canvasRef.current;
|
|
3353
|
+
if (!canvas) return;
|
|
3354
|
+
const ctx = canvas.getContext("2d");
|
|
3355
|
+
if (!ctx) return;
|
|
3356
|
+
const rect = canvas.getBoundingClientRect();
|
|
3357
|
+
const x = "touches" in e ? e.touches[0].clientX - rect.left : e.clientX - rect.left;
|
|
3358
|
+
const y = "touches" in e ? e.touches[0].clientY - rect.top : e.clientY - rect.top;
|
|
3359
|
+
ctx.lineTo(x, y);
|
|
3360
|
+
ctx.stroke();
|
|
3361
|
+
};
|
|
3362
|
+
const stopDrawing = () => {
|
|
3363
|
+
isDrawingRef.current = false;
|
|
3364
|
+
};
|
|
3365
|
+
const clearCanvas = () => {
|
|
3366
|
+
const canvas = canvasRef.current;
|
|
3367
|
+
if (!canvas) return;
|
|
3368
|
+
const ctx = canvas.getContext("2d");
|
|
3369
|
+
if (!ctx) return;
|
|
3370
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
3371
|
+
};
|
|
3372
|
+
const saveDrawnSignature = () => {
|
|
3373
|
+
const canvas = canvasRef.current;
|
|
3374
|
+
if (!canvas) return;
|
|
3375
|
+
const dataUrl = canvas.toDataURL("image/png");
|
|
3376
|
+
onChange(dataUrl);
|
|
3377
|
+
setModalOpen(false);
|
|
3378
|
+
};
|
|
3379
|
+
const handleFileUpload = (e) => {
|
|
3380
|
+
const file = e.target.files?.[0];
|
|
3381
|
+
if (!file) return;
|
|
3382
|
+
const reader = new FileReader();
|
|
3383
|
+
reader.onload = (evt) => {
|
|
3384
|
+
if (typeof evt.target?.result === "string") {
|
|
3385
|
+
onChange(evt.target.result);
|
|
3386
|
+
}
|
|
3387
|
+
};
|
|
3388
|
+
reader.readAsDataURL(file);
|
|
3389
|
+
e.target.value = "";
|
|
3390
|
+
};
|
|
3391
|
+
useEffect(() => {
|
|
3392
|
+
if (modalOpen) {
|
|
3393
|
+
setTimeout(() => {
|
|
3394
|
+
const canvas = canvasRef.current;
|
|
3395
|
+
if (!canvas) return;
|
|
3396
|
+
const ctx = canvas.getContext("2d");
|
|
3397
|
+
if (ctx) {
|
|
3398
|
+
ctx.strokeStyle = "#0f172a";
|
|
3399
|
+
ctx.lineWidth = 2.5;
|
|
3400
|
+
ctx.lineCap = "round";
|
|
3401
|
+
ctx.lineJoin = "round";
|
|
3402
|
+
}
|
|
3403
|
+
}, 50);
|
|
3404
|
+
}
|
|
3405
|
+
}, [modalOpen]);
|
|
3406
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
3407
|
+
sigVal ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-3 rounded-xl border border-slate-200 bg-slate-50/70", children: [
|
|
3408
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3409
|
+
/* @__PURE__ */ jsx(
|
|
3410
|
+
Image,
|
|
3411
|
+
{
|
|
3412
|
+
src: sigVal,
|
|
3413
|
+
alt: displayLabel,
|
|
3414
|
+
className: "h-16 max-w-[220px] object-contain rounded bg-white p-1 border border-slate-200 shadow-sm cursor-pointer hover:border-blue-500",
|
|
3415
|
+
preview: {
|
|
3416
|
+
mask: /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold", children: t.previewMask })
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
),
|
|
3420
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
3421
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-emerald-700 bg-emerald-50 border border-emerald-200 px-2.5 py-0.5 rounded-full w-fit", children: t.signatureRegistered }),
|
|
3422
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-slate-500", children: t.viewLarger })
|
|
3423
|
+
] })
|
|
3424
|
+
] }),
|
|
3425
|
+
/* @__PURE__ */ jsx(
|
|
3426
|
+
Button,
|
|
3427
|
+
{
|
|
3428
|
+
danger: true,
|
|
3429
|
+
type: "text",
|
|
3430
|
+
icon: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" }),
|
|
3431
|
+
onClick: () => onChange(""),
|
|
3432
|
+
className: "hover:bg-red-50 text-red-600 font-medium",
|
|
3433
|
+
children: t.delete
|
|
3434
|
+
}
|
|
3435
|
+
)
|
|
3436
|
+
] }) : null,
|
|
3437
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
3438
|
+
/* @__PURE__ */ jsx(
|
|
3439
|
+
Button,
|
|
3440
|
+
{
|
|
3441
|
+
type: "primary",
|
|
3442
|
+
size: "large",
|
|
3443
|
+
onClick: () => {
|
|
3444
|
+
clearCanvas();
|
|
3445
|
+
setModalOpen(true);
|
|
3446
|
+
},
|
|
3447
|
+
className: "w-full bg-blue-600 hover:bg-blue-700 font-bold uppercase rounded-xl h-11 text-xs tracking-wider shadow-sm",
|
|
3448
|
+
children: sigVal ? t.replaceSignature : t.addSignature
|
|
3449
|
+
}
|
|
3450
|
+
),
|
|
3451
|
+
/* @__PURE__ */ jsx(
|
|
3452
|
+
Button,
|
|
3453
|
+
{
|
|
3454
|
+
type: "primary",
|
|
3455
|
+
size: "large",
|
|
3456
|
+
onClick: () => fileInputRef.current?.click(),
|
|
3457
|
+
className: "w-full bg-blue-600 hover:bg-blue-700 font-bold uppercase rounded-xl h-11 text-xs tracking-wider shadow-sm",
|
|
3458
|
+
children: sigVal ? t.uploadNewImage : t.uploadImage
|
|
3459
|
+
}
|
|
3460
|
+
),
|
|
3461
|
+
/* @__PURE__ */ jsx(
|
|
3462
|
+
"input",
|
|
3463
|
+
{
|
|
3464
|
+
type: "file",
|
|
3465
|
+
ref: fileInputRef,
|
|
3466
|
+
accept: "image/*",
|
|
3467
|
+
onChange: handleFileUpload,
|
|
3468
|
+
className: "hidden"
|
|
3469
|
+
}
|
|
3470
|
+
)
|
|
3471
|
+
] }),
|
|
3472
|
+
/* @__PURE__ */ jsx(
|
|
3473
|
+
Modal,
|
|
3474
|
+
{
|
|
3475
|
+
open: modalOpen,
|
|
3476
|
+
title: /* @__PURE__ */ jsx("span", { className: "font-bold text-slate-800", children: t.signOnScreen }),
|
|
3477
|
+
onCancel: () => setModalOpen(false),
|
|
3478
|
+
centered: true,
|
|
3479
|
+
width: 560,
|
|
3480
|
+
footer: [
|
|
3481
|
+
/* @__PURE__ */ jsx(Button, { onClick: clearCanvas, className: "rounded-xl font-medium", children: t.clear }, "clear"),
|
|
3482
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => setModalOpen(false), className: "rounded-xl font-medium", children: t.cancel }, "cancel"),
|
|
3483
|
+
/* @__PURE__ */ jsx(
|
|
3484
|
+
Button,
|
|
3485
|
+
{
|
|
3486
|
+
type: "primary",
|
|
3487
|
+
onClick: saveDrawnSignature,
|
|
3488
|
+
className: "bg-blue-600 hover:bg-blue-700 font-bold rounded-xl",
|
|
3489
|
+
children: t.saveSignature
|
|
3490
|
+
},
|
|
3491
|
+
"save"
|
|
3492
|
+
)
|
|
3493
|
+
],
|
|
3494
|
+
children: /* @__PURE__ */ jsxs("div", { className: "py-2 space-y-2", children: [
|
|
3495
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-slate-500", children: t.signInstructions }),
|
|
3496
|
+
/* @__PURE__ */ jsx("div", { className: "border-2 border-dashed border-slate-300 rounded-2xl bg-white overflow-hidden touch-none", children: /* @__PURE__ */ jsx(
|
|
3497
|
+
"canvas",
|
|
3498
|
+
{
|
|
3499
|
+
ref: canvasRef,
|
|
3500
|
+
width: 500,
|
|
3501
|
+
height: 220,
|
|
3502
|
+
onMouseDown: startDrawing,
|
|
3503
|
+
onMouseMove: draw,
|
|
3504
|
+
onMouseUp: stopDrawing,
|
|
3505
|
+
onMouseLeave: stopDrawing,
|
|
3506
|
+
onTouchStart: startDrawing,
|
|
3507
|
+
onTouchMove: draw,
|
|
3508
|
+
onTouchEnd: stopDrawing,
|
|
3509
|
+
className: "w-full h-[220px] cursor-crosshair block"
|
|
3510
|
+
}
|
|
3511
|
+
) })
|
|
3512
|
+
] })
|
|
3513
|
+
}
|
|
3514
|
+
)
|
|
3515
|
+
] });
|
|
3516
|
+
}
|
|
2777
3517
|
function FormattedNumberInput({
|
|
2778
3518
|
value,
|
|
2779
3519
|
onChange,
|
|
@@ -3456,11 +4196,80 @@ function ReferenceSelect({
|
|
|
3456
4196
|
searchable = false,
|
|
3457
4197
|
max,
|
|
3458
4198
|
value,
|
|
3459
|
-
onChange
|
|
4199
|
+
onChange,
|
|
4200
|
+
onSelectRecord
|
|
3460
4201
|
}) {
|
|
3461
4202
|
const ctx = useCmsContext();
|
|
4203
|
+
const t = useAdminI18n();
|
|
3462
4204
|
const [options, setOptions] = useState([]);
|
|
3463
4205
|
const [loading, setLoading] = useState(true);
|
|
4206
|
+
const [clientModalOpen, setClientModalOpen] = useState(false);
|
|
4207
|
+
const [creatingClient, setCreatingClient] = useState(false);
|
|
4208
|
+
const [clientError, setClientError] = useState("");
|
|
4209
|
+
const [newClient, setNewClient] = useState({
|
|
4210
|
+
tipo: "Persona",
|
|
4211
|
+
tipoDocumento: "C\xE9dula de ciudadan\xEDa",
|
|
4212
|
+
id: "",
|
|
4213
|
+
sucursal: "",
|
|
4214
|
+
nombre: "",
|
|
4215
|
+
email: "",
|
|
4216
|
+
telefono: "",
|
|
4217
|
+
ciudad: "",
|
|
4218
|
+
direccion: ""
|
|
4219
|
+
});
|
|
4220
|
+
const handleSaveClient = async () => {
|
|
4221
|
+
setClientError("");
|
|
4222
|
+
if (!newClient.id.trim()) {
|
|
4223
|
+
setClientError(t.idRequired);
|
|
4224
|
+
return;
|
|
4225
|
+
}
|
|
4226
|
+
if (!newClient.nombre.trim()) {
|
|
4227
|
+
setClientError(t.nameRequired);
|
|
4228
|
+
return;
|
|
4229
|
+
}
|
|
4230
|
+
setCreatingClient(true);
|
|
4231
|
+
try {
|
|
4232
|
+
const entry = {
|
|
4233
|
+
...newClient,
|
|
4234
|
+
id: newClient.id.trim(),
|
|
4235
|
+
nombre: newClient.nombre.trim()
|
|
4236
|
+
};
|
|
4237
|
+
await ctx.adapter.putEntry("clients", entry);
|
|
4238
|
+
const res = await ctx.adapter.listEntries("clients");
|
|
4239
|
+
const fromCollection = (res || []).map((r) => {
|
|
4240
|
+
const val = valueField && r[valueField] !== void 0 ? String(r[valueField]) : r.name ? String(r.name) : r.id;
|
|
4241
|
+
const fullName = r.apellido ? `${r.nombre || r.name || ""} ${r.apellido}`.trim() : "";
|
|
4242
|
+
const lab = fullName || String(r[displayField] || r.name || r.id);
|
|
4243
|
+
return {
|
|
4244
|
+
value: val,
|
|
4245
|
+
label: val && val !== lab ? `${lab} (${val})` : lab,
|
|
4246
|
+
raw: r
|
|
4247
|
+
};
|
|
4248
|
+
});
|
|
4249
|
+
setOptions(fromCollection);
|
|
4250
|
+
onChange(entry.id);
|
|
4251
|
+
if (onSelectRecord) {
|
|
4252
|
+
onSelectRecord(entry);
|
|
4253
|
+
}
|
|
4254
|
+
setClientModalOpen(false);
|
|
4255
|
+
setNewClient({
|
|
4256
|
+
tipo: "Persona",
|
|
4257
|
+
tipoDocumento: "C\xE9dula de ciudadan\xEDa",
|
|
4258
|
+
id: "",
|
|
4259
|
+
sucursal: "",
|
|
4260
|
+
nombre: "",
|
|
4261
|
+
email: "",
|
|
4262
|
+
telefono: "",
|
|
4263
|
+
ciudad: "",
|
|
4264
|
+
direccion: ""
|
|
4265
|
+
});
|
|
4266
|
+
message.success(t.clientCreatedSuccess);
|
|
4267
|
+
} catch (err) {
|
|
4268
|
+
setClientError(err?.message || "Error al crear cliente.");
|
|
4269
|
+
} finally {
|
|
4270
|
+
setCreatingClient(false);
|
|
4271
|
+
}
|
|
4272
|
+
};
|
|
3464
4273
|
useEffect(() => {
|
|
3465
4274
|
if (!collectionId) {
|
|
3466
4275
|
if (fallbackOptions && fallbackOptions.length > 0) {
|
|
@@ -3471,65 +4280,279 @@ function ReferenceSelect({
|
|
|
3471
4280
|
}
|
|
3472
4281
|
setLoading(true);
|
|
3473
4282
|
ctx.adapter.listEntries(collectionId).then((res) => {
|
|
3474
|
-
const fromCollection = res.map((r) => {
|
|
4283
|
+
const fromCollection = (res || []).map((r) => {
|
|
3475
4284
|
const val = valueField && r[valueField] !== void 0 ? String(r[valueField]) : r.name ? String(r.name) : r.id;
|
|
3476
|
-
const
|
|
3477
|
-
|
|
4285
|
+
const fullName = r.apellido ? `${r.nombre || r.name || ""} ${r.apellido}`.trim() : "";
|
|
4286
|
+
const lab = fullName || String(r[displayField] || r.name || r.id);
|
|
4287
|
+
return {
|
|
4288
|
+
value: val,
|
|
4289
|
+
label: val && val !== lab ? `${lab} (${val})` : lab,
|
|
4290
|
+
raw: r
|
|
4291
|
+
};
|
|
3478
4292
|
});
|
|
3479
|
-
|
|
3480
|
-
(opt) => typeof opt === "string" ? { value: opt, label: opt } : opt
|
|
3481
|
-
);
|
|
3482
|
-
const combined = [...fromCollection];
|
|
3483
|
-
for (const fb of fallbackList) {
|
|
3484
|
-
if (!combined.some((c) => c.value === fb.value || c.label === fb.label)) {
|
|
3485
|
-
combined.push(fb);
|
|
3486
|
-
}
|
|
3487
|
-
}
|
|
3488
|
-
setOptions(combined);
|
|
4293
|
+
setOptions(fromCollection);
|
|
3489
4294
|
setLoading(false);
|
|
3490
4295
|
}).catch(() => {
|
|
3491
|
-
|
|
3492
|
-
setOptions(fallbackOptions.map((opt) => typeof opt === "string" ? { value: opt, label: opt } : opt));
|
|
3493
|
-
}
|
|
4296
|
+
setOptions([]);
|
|
3494
4297
|
setLoading(false);
|
|
3495
4298
|
});
|
|
3496
|
-
}, [collectionId, displayField, valueField, fallbackOptions, ctx.adapter]);
|
|
4299
|
+
}, [collectionId, displayField, valueField, fallbackOptions, ctx.adapter, ctx.collectionChangedAt]);
|
|
3497
4300
|
if (multiple) {
|
|
3498
4301
|
const selectedList = Array.isArray(value) ? value.map(String) : typeof value === "string" && value.trim() ? value.split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
3499
4302
|
return /* @__PURE__ */ jsx(
|
|
3500
|
-
|
|
4303
|
+
Select,
|
|
3501
4304
|
{
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
onChange,
|
|
4305
|
+
size: "large",
|
|
4306
|
+
mode: "multiple",
|
|
3505
4307
|
loading,
|
|
3506
|
-
searchable,
|
|
4308
|
+
showSearch: searchable,
|
|
3507
4309
|
placeholder: "Seleccionar opciones...",
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
4310
|
+
filterOption: (input, option) => {
|
|
4311
|
+
if (!input) return true;
|
|
4312
|
+
const q = input.toLowerCase();
|
|
4313
|
+
const label = String(option?.label ?? "").toLowerCase();
|
|
4314
|
+
const val = String(option?.value ?? "").toLowerCase();
|
|
4315
|
+
return label.includes(q) || val.includes(q);
|
|
4316
|
+
},
|
|
4317
|
+
maxCount: max,
|
|
4318
|
+
value: selectedList,
|
|
4319
|
+
onChange,
|
|
4320
|
+
options,
|
|
4321
|
+
className: "w-full"
|
|
3511
4322
|
}
|
|
3512
4323
|
);
|
|
3513
4324
|
}
|
|
3514
|
-
const singleVal =
|
|
4325
|
+
const singleVal = value !== void 0 && value !== null && value !== "" ? String(value) : void 0;
|
|
3515
4326
|
const displayOptions = [...options];
|
|
3516
4327
|
if (singleVal && !displayOptions.some((o) => o.value === singleVal)) {
|
|
3517
4328
|
displayOptions.unshift({ value: singleVal, label: singleVal });
|
|
3518
4329
|
}
|
|
3519
|
-
return /* @__PURE__ */ jsxs(
|
|
3520
|
-
/* @__PURE__ */ jsxs(
|
|
3521
|
-
"
|
|
4330
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4331
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4332
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
4333
|
+
Select,
|
|
4334
|
+
{
|
|
4335
|
+
size: "large",
|
|
4336
|
+
loading,
|
|
4337
|
+
showSearch: searchable,
|
|
4338
|
+
placeholder: loading ? t.loadingOptions : t.selectOption,
|
|
4339
|
+
allowClear: true,
|
|
4340
|
+
filterOption: (input, option) => {
|
|
4341
|
+
if (!input) return true;
|
|
4342
|
+
const q = input.toLowerCase();
|
|
4343
|
+
const label = String(option?.label ?? "").toLowerCase();
|
|
4344
|
+
const val = String(option?.value ?? "").toLowerCase();
|
|
4345
|
+
return label.includes(q) || val.includes(q);
|
|
4346
|
+
},
|
|
4347
|
+
value: singleVal,
|
|
4348
|
+
onChange: (v) => {
|
|
4349
|
+
onChange(v || "");
|
|
4350
|
+
if (onSelectRecord) {
|
|
4351
|
+
const found = options.find((o) => o.value === v);
|
|
4352
|
+
if (found?.raw) onSelectRecord(found.raw);
|
|
4353
|
+
}
|
|
4354
|
+
},
|
|
4355
|
+
options: displayOptions,
|
|
4356
|
+
dropdownRender: (menu) => /* @__PURE__ */ jsxs("div", { children: [
|
|
4357
|
+
menu,
|
|
4358
|
+
collectionId === "clients" && /* @__PURE__ */ jsxs("div", { className: "p-2 border-t border-slate-100 flex items-center justify-between bg-slate-50", children: [
|
|
4359
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-slate-500 font-medium", children: t.cantFindClient }),
|
|
4360
|
+
/* @__PURE__ */ jsx(
|
|
4361
|
+
Button,
|
|
4362
|
+
{
|
|
4363
|
+
type: "primary",
|
|
4364
|
+
size: "small",
|
|
4365
|
+
icon: /* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5" }),
|
|
4366
|
+
onClick: () => {
|
|
4367
|
+
setClientError("");
|
|
4368
|
+
setClientModalOpen(true);
|
|
4369
|
+
},
|
|
4370
|
+
className: "bg-blue-600 hover:bg-blue-700 text-xs font-semibold rounded-lg shadow-sm",
|
|
4371
|
+
children: t.createClient
|
|
4372
|
+
}
|
|
4373
|
+
)
|
|
4374
|
+
] })
|
|
4375
|
+
] }),
|
|
4376
|
+
className: "w-full"
|
|
4377
|
+
}
|
|
4378
|
+
) }),
|
|
4379
|
+
collectionId === "clients" && /* @__PURE__ */ jsx(
|
|
4380
|
+
Button,
|
|
4381
|
+
{
|
|
4382
|
+
type: "primary",
|
|
4383
|
+
size: "large",
|
|
4384
|
+
icon: /* @__PURE__ */ jsx(Plus, { className: "w-4 h-4" }),
|
|
4385
|
+
onClick: () => {
|
|
4386
|
+
setClientError("");
|
|
4387
|
+
setClientModalOpen(true);
|
|
4388
|
+
},
|
|
4389
|
+
className: "bg-blue-600 hover:bg-blue-700 font-bold rounded-xl shrink-0 h-10 px-4 text-xs uppercase tracking-wider",
|
|
4390
|
+
children: t.newBtn
|
|
4391
|
+
}
|
|
4392
|
+
)
|
|
4393
|
+
] }),
|
|
4394
|
+
collectionId === "clients" && /* @__PURE__ */ jsx(
|
|
4395
|
+
Modal,
|
|
3522
4396
|
{
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
4397
|
+
open: clientModalOpen,
|
|
4398
|
+
title: /* @__PURE__ */ jsx("span", { className: "text-xl font-bold text-slate-900 font-display", children: t.basicDetails }),
|
|
4399
|
+
onCancel: () => setClientModalOpen(false),
|
|
4400
|
+
centered: true,
|
|
4401
|
+
width: 650,
|
|
4402
|
+
footer: null,
|
|
4403
|
+
children: /* @__PURE__ */ jsxs("div", { className: "pt-2 space-y-4", children: [
|
|
4404
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
4405
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4406
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs font-bold text-slate-700 mb-1", children: t.clientType }),
|
|
4407
|
+
/* @__PURE__ */ jsx(
|
|
4408
|
+
Select,
|
|
4409
|
+
{
|
|
4410
|
+
size: "large",
|
|
4411
|
+
value: newClient.tipo,
|
|
4412
|
+
onChange: (val) => {
|
|
4413
|
+
setNewClient((prev) => ({
|
|
4414
|
+
...prev,
|
|
4415
|
+
tipo: val,
|
|
4416
|
+
tipoDocumento: val === "Empresa" ? "Nit" : "C\xE9dula de ciudadan\xEDa"
|
|
4417
|
+
}));
|
|
4418
|
+
},
|
|
4419
|
+
options: [
|
|
4420
|
+
{ label: "Persona", value: "Persona" },
|
|
4421
|
+
{ label: "Empresa", value: "Empresa" }
|
|
4422
|
+
],
|
|
4423
|
+
className: "w-full"
|
|
4424
|
+
}
|
|
4425
|
+
)
|
|
4426
|
+
] }),
|
|
4427
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4428
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs font-bold text-slate-700 mb-1", children: t.clientDocType }),
|
|
4429
|
+
/* @__PURE__ */ jsx(
|
|
4430
|
+
Select,
|
|
4431
|
+
{
|
|
4432
|
+
size: "large",
|
|
4433
|
+
value: newClient.tipoDocumento,
|
|
4434
|
+
onChange: (val) => setNewClient((prev) => ({ ...prev, tipoDocumento: val })),
|
|
4435
|
+
options: newClient.tipo === "Persona" ? [
|
|
4436
|
+
{ label: "C\xE9dula de ciudadan\xEDa", value: "C\xE9dula de ciudadan\xEDa" },
|
|
4437
|
+
{ label: "C\xE9dula de extranjer\xEDa", value: "C\xE9dula de extranjer\xEDa" },
|
|
4438
|
+
{ label: "Pasaporte", value: "Pasaporte" }
|
|
4439
|
+
] : [{ label: "Nit", value: "Nit" }],
|
|
4440
|
+
className: "w-full"
|
|
4441
|
+
}
|
|
4442
|
+
)
|
|
4443
|
+
] })
|
|
4444
|
+
] }),
|
|
4445
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
4446
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4447
|
+
/* @__PURE__ */ jsxs("label", { className: "block text-xs font-bold text-slate-700 mb-1", children: [
|
|
4448
|
+
t.clientIdentification,
|
|
4449
|
+
" *"
|
|
4450
|
+
] }),
|
|
4451
|
+
/* @__PURE__ */ jsx(
|
|
4452
|
+
Input,
|
|
4453
|
+
{
|
|
4454
|
+
size: "large",
|
|
4455
|
+
placeholder: t.clientIdentification,
|
|
4456
|
+
value: newClient.id,
|
|
4457
|
+
onChange: (e) => setNewClient((prev) => ({ ...prev, id: e.target.value }))
|
|
4458
|
+
}
|
|
4459
|
+
)
|
|
4460
|
+
] }),
|
|
4461
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4462
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs font-bold text-slate-700 mb-1", children: t.clientBranch }),
|
|
4463
|
+
/* @__PURE__ */ jsx(
|
|
4464
|
+
Input,
|
|
4465
|
+
{
|
|
4466
|
+
size: "large",
|
|
4467
|
+
placeholder: t.clientBranch,
|
|
4468
|
+
value: newClient.sucursal,
|
|
4469
|
+
onChange: (e) => setNewClient((prev) => ({ ...prev, sucursal: e.target.value }))
|
|
4470
|
+
}
|
|
4471
|
+
)
|
|
4472
|
+
] })
|
|
4473
|
+
] }),
|
|
4474
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
4475
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4476
|
+
/* @__PURE__ */ jsxs("label", { className: "block text-xs font-bold text-slate-700 mb-1", children: [
|
|
4477
|
+
t.clientName,
|
|
4478
|
+
" *"
|
|
4479
|
+
] }),
|
|
4480
|
+
/* @__PURE__ */ jsx(
|
|
4481
|
+
Input,
|
|
4482
|
+
{
|
|
4483
|
+
size: "large",
|
|
4484
|
+
placeholder: t.clientName,
|
|
4485
|
+
value: newClient.nombre,
|
|
4486
|
+
onChange: (e) => setNewClient((prev) => ({ ...prev, nombre: e.target.value }))
|
|
4487
|
+
}
|
|
4488
|
+
)
|
|
4489
|
+
] }),
|
|
4490
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4491
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs font-bold text-slate-700 mb-1", children: t.clientEmail }),
|
|
4492
|
+
/* @__PURE__ */ jsx(
|
|
4493
|
+
Input,
|
|
4494
|
+
{
|
|
4495
|
+
size: "large",
|
|
4496
|
+
placeholder: t.clientEmail,
|
|
4497
|
+
value: newClient.email,
|
|
4498
|
+
onChange: (e) => setNewClient((prev) => ({ ...prev, email: e.target.value }))
|
|
4499
|
+
}
|
|
4500
|
+
)
|
|
4501
|
+
] })
|
|
4502
|
+
] }),
|
|
4503
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
4504
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4505
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs font-bold text-slate-700 mb-1", children: t.clientPhone }),
|
|
4506
|
+
/* @__PURE__ */ jsx(
|
|
4507
|
+
Input,
|
|
4508
|
+
{
|
|
4509
|
+
size: "large",
|
|
4510
|
+
placeholder: t.clientPhone,
|
|
4511
|
+
value: newClient.telefono,
|
|
4512
|
+
onChange: (e) => setNewClient((prev) => ({ ...prev, telefono: e.target.value }))
|
|
4513
|
+
}
|
|
4514
|
+
)
|
|
4515
|
+
] }),
|
|
4516
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4517
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs font-bold text-slate-700 mb-1", children: t.clientCity }),
|
|
4518
|
+
/* @__PURE__ */ jsx(
|
|
4519
|
+
Input,
|
|
4520
|
+
{
|
|
4521
|
+
size: "large",
|
|
4522
|
+
placeholder: t.clientCity,
|
|
4523
|
+
value: newClient.ciudad,
|
|
4524
|
+
onChange: (e) => setNewClient((prev) => ({ ...prev, ciudad: e.target.value }))
|
|
4525
|
+
}
|
|
4526
|
+
)
|
|
4527
|
+
] })
|
|
4528
|
+
] }),
|
|
4529
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4530
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs font-bold text-slate-700 mb-1", children: t.clientAddress }),
|
|
4531
|
+
/* @__PURE__ */ jsx(
|
|
4532
|
+
Input,
|
|
4533
|
+
{
|
|
4534
|
+
size: "large",
|
|
4535
|
+
placeholder: t.clientAddress,
|
|
4536
|
+
value: newClient.direccion,
|
|
4537
|
+
onChange: (e) => setNewClient((prev) => ({ ...prev, direccion: e.target.value }))
|
|
4538
|
+
}
|
|
4539
|
+
)
|
|
4540
|
+
] }),
|
|
4541
|
+
clientError && /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold text-red-600 bg-red-50 p-2.5 rounded-lg border border-red-200", children: clientError }),
|
|
4542
|
+
/* @__PURE__ */ jsx(
|
|
4543
|
+
Button,
|
|
4544
|
+
{
|
|
4545
|
+
type: "primary",
|
|
4546
|
+
size: "large",
|
|
4547
|
+
loading: creatingClient,
|
|
4548
|
+
onClick: handleSaveClient,
|
|
4549
|
+
className: "w-full bg-blue-600 hover:bg-blue-700 font-bold uppercase rounded-xl h-11 text-xs tracking-wider shadow-sm mt-2",
|
|
4550
|
+
children: t.create.toUpperCase()
|
|
4551
|
+
}
|
|
4552
|
+
)
|
|
4553
|
+
] })
|
|
3530
4554
|
}
|
|
3531
|
-
)
|
|
3532
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
|
|
4555
|
+
)
|
|
3533
4556
|
] });
|
|
3534
4557
|
}
|
|
3535
4558
|
function ReferenceTableCell({
|