diff --git a/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue b/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue index be5defa..96c5cec 100644 --- a/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue +++ b/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue @@ -242,7 +242,11 @@ function initializeParameters() { for (const [tagName, tagConfig] of Object.entries(templateTags.value)) { const config = tagConfig as any if (config.type === 'boolean') { + // Para boolean, el default viene como array [false] o [true] params[tagName] = config.default?.[0] ?? false + } else if (config.type === 'text' && (tagName.toLowerCase().includes('fecha') || config?.['display-name']?.toLowerCase().includes('fecha'))) { + // Para campos de fecha tipo text, inicializar con string vacĂ­o + params[tagName] = config.default ?? '' } else { params[tagName] = config.default ?? '' } @@ -275,7 +279,14 @@ const exportItems = [[ function getParameterType(key: string): string { const config = templateTags.value[key] as any - return config?.type || 'text' + const type = config?.type || 'text' + + // Si es tipo text pero el nombre incluye "fecha", tratar como date + if (type === 'text' && (key.toLowerCase().includes('fecha') || config?.['display-name']?.toLowerCase().includes('fecha'))) { + return 'date' + } + + return type } function getParameterLabel(key: string): string { @@ -321,8 +332,12 @@ async function executeQuery() { paramType = 'date/single' paramValue = parameterValues.value[tagName] || null } else if (config.type === 'boolean') { - paramType = 'category' - paramValue = [parameterValues.value[tagName]] + paramType = 'boolean' + paramValue = parameterValues.value[tagName] + } else if (config.type === 'text' && (tagName.toLowerCase().includes('fecha') || config?.['display-name']?.toLowerCase().includes('fecha'))) { + // Si es tipo text pero parece una fecha, enviar como text + paramType = 'text' + paramValue = parameterValues.value[tagName] || '' } parameters.push({