- Reemplazar colores hardcoded del tema café con variables --brand-* - #c08040 → var(--brand-primary-strong) - #d99a56 → var(--brand-primary) - #f0c07c → var(--brand-accent) - #1c140c → var(--brand-surface) - #3a2a16 → var(--brand-border) - #1b1209, #14100b → var(--brand-bg) - Reemplazar colores de tipos de café con variables --coffee-* - #a855f7 → var(--coffee-uva) - #f97316 → var(--coffee-oreado) - #06b6d4 → var(--coffee-mojado) - #22c55e → var(--coffee-verde) - Reemplazar clases gray-scale de Tailwind con variables de tema - text-gray-400, text-gray-500 → text-[var(--brand-text-muted)] - bg-gray-700/30 → bg-[var(--brand-surface)] - Todos los componentes ahora responden dinámicamente a cambios de tema Archivos adaptados: - Páginas: error, informe-ingresos, panorama, explorer, metabase-debug, profile, notifications, settings - Componentes de ingresos: GraficaSerieIngresos, GraficaSerieInversion, GraficaDinamicaPagadoDeposito, GraficaAcumuladoresUva, TotalesIngresoCompra, TotalesMonetarios, TotalesVerde, SecosVendidos, TopClientes, VistaTablaIngresos, VistaTablaIngresosConClientes, FiltrosActivos - Componentes de comparativa: CosechasHeatmap, CosechasPorTipo, CosechasEvolucion, CosechasTotales - Componentes de UI: ClienteSelector, DateRangeSelector, MetadatosCard, MaintenanceMode - Componentes de auth: UserAvatar, UserMetadata - Componentes de clientes: ClienteCard, VistaTablaClientes - Componentes de rechazos: RechazoCard, RechazosRechazoCard, RechazosSubproductos - Componentes de metabase: MetabaseCardDisplay, MetabaseCardsTable
133 lines
4.8 KiB
Vue
133 lines
4.8 KiB
Vue
<template>
|
|
<UCard class="brand-card border border-transparent">
|
|
<template #header>
|
|
<div class="flex items-center justify-between">
|
|
<h2 class="text-xl font-bold brand-section-title">Café Seco - Inventario y Proyecciones</h2>
|
|
<div class="flex items-center gap-2">
|
|
<UButton
|
|
size="xs"
|
|
color="gray"
|
|
variant="soft"
|
|
icon="i-lucide-copy"
|
|
@click="copiarTexto"
|
|
>
|
|
Copiar Texto
|
|
</UButton>
|
|
<UButton
|
|
size="xs"
|
|
color="gray"
|
|
variant="soft"
|
|
icon="i-lucide-braces"
|
|
@click="copiarJSON"
|
|
>
|
|
Copiar JSON
|
|
</UButton>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
|
<div class="rounded-lg border border-[var(--brand-border)] bg-[var(--brand-surface)] px-4 py-3">
|
|
<div class="text-xs text-[var(--brand-text-muted)] uppercase tracking-wide mb-1">QQ Seco por Vender</div>
|
|
<div class="text-2xl font-bold text-[var(--brand-text)]">
|
|
{{ formatNumber(data.total_qq_seco_por_vender) }} QQ
|
|
</div>
|
|
</div>
|
|
|
|
<div class="rounded-lg border border-[var(--brand-border)] bg-[var(--brand-surface)] px-4 py-3">
|
|
<div class="text-xs text-[var(--brand-text-muted)] uppercase tracking-wide mb-1">Precio Venta Promedio/QQ</div>
|
|
<div class="text-2xl font-bold text-green-400">
|
|
{{ formatCurrency(data.precio_venta_promedio_por_qq) }}
|
|
</div>
|
|
<div v-if="data.precio_venta_promedio_por_qq === 0" class="text-xs text-[var(--brand-text-muted)] mt-1">
|
|
Sin ventas registradas
|
|
</div>
|
|
</div>
|
|
|
|
<div class="rounded-lg border border-[var(--brand-border)] bg-[var(--brand-surface)] px-4 py-3">
|
|
<div class="text-xs text-[var(--brand-text-muted)] uppercase tracking-wide mb-1">Precio Compra Promedio/QQ</div>
|
|
<div class="text-2xl font-bold text-[var(--brand-text)]">
|
|
{{ formatCurrency(data.precio_compra_promedio_por_qq) }}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="rounded-lg border border-[var(--brand-border)] bg-[var(--brand-surface)] px-4 py-3">
|
|
<div class="text-xs text-[var(--brand-text-muted)] uppercase tracking-wide mb-1">Margen de Ganancia/QQ</div>
|
|
<div class="text-2xl font-bold" :class="margenColor">
|
|
{{ formatCurrency(data.margen_ganancia_por_qq) }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</UCard>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const props = defineProps<{
|
|
data: {
|
|
total_qq_seco_por_vender: number
|
|
precio_venta_promedio_por_qq: number
|
|
precio_compra_promedio_por_qq: number
|
|
margen_ganancia_por_qq: number
|
|
}
|
|
conteos?: {
|
|
ingresos_total?: number
|
|
ingresos_filtrados?: number
|
|
rechazos_total?: number
|
|
rechazos_filtrados?: number
|
|
}
|
|
rangoLegible?: string
|
|
lastUpdated?: string
|
|
}>()
|
|
|
|
const margenColor = computed(() => {
|
|
if (props.data.margen_ganancia_por_qq > 0) return 'text-green-400'
|
|
if (props.data.margen_ganancia_por_qq < 0) return 'text-red-400'
|
|
return 'text-[var(--brand-text)]'
|
|
})
|
|
|
|
const formatNumber = (value: number) => {
|
|
return new Intl.NumberFormat('es-HN', {
|
|
minimumFractionDigits: 2,
|
|
maximumFractionDigits: 2
|
|
}).format(value)
|
|
}
|
|
|
|
const formatCurrency = (value: number) => {
|
|
if (!value) return 'L 0.00'
|
|
return new Intl.NumberFormat('es-HN', {
|
|
style: 'currency',
|
|
currency: 'HNL',
|
|
minimumFractionDigits: 2,
|
|
maximumFractionDigits: 2
|
|
}).format(value).replace('HNL', 'L')
|
|
}
|
|
|
|
async function copiarTexto() {
|
|
const footer = props.rangoLegible && props.lastUpdated ? `
|
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
📊 RESUMEN
|
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
📅 Rango: ${props.rangoLegible}
|
|
📦 Ingresos: ${props.conteos?.ingresos_filtrados || 0} de ${props.conteos?.ingresos_total || 0} registros
|
|
📦 Rechazos: ${props.conteos?.rechazos_filtrados || 0} de ${props.conteos?.rechazos_total || 0} registros
|
|
🕐 Generado: ${props.lastUpdated}` : ''
|
|
|
|
const texto = `☕ CAFÉ SECO - INVENTARIO Y PROYECCIONES
|
|
|
|
📊 DATOS:
|
|
QQ Seco por Vender: ${formatNumber(props.data.total_qq_seco_por_vender)} QQ
|
|
Precio Venta Promedio/QQ: ${formatCurrency(props.data.precio_venta_promedio_por_qq)}
|
|
Precio Compra Promedio/QQ: ${formatCurrency(props.data.precio_compra_promedio_por_qq)}
|
|
Margen de Ganancia/QQ: ${formatCurrency(props.data.margen_ganancia_por_qq)}${footer}`
|
|
|
|
await navigator.clipboard.writeText(texto)
|
|
alert('✅ Café Seco - Inventario y Proyecciones copiado al portapapeles')
|
|
}
|
|
|
|
async function copiarJSON() {
|
|
const json = JSON.stringify(props.data, null, 2)
|
|
await navigator.clipboard.writeText(json)
|
|
alert('✅ JSON copiado al portapapeles')
|
|
}
|
|
</script>
|