Feat: Agregar botones de copia a componentes de Totales
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 50s
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 50s
Implementa botones "Copiar Texto" y "Copiar JSON" en los tres componentes de totales del informe de ingresos: - TotalesIngresoCompra: Exporta datos de Uva, Mojado, Oreado y totales - TotalesMonetarios: Exporta inversiones, precios promedio y restantes - TotalesVerde: Exporta métricas de café verde Cada componente incluye: - Formato de texto con emojis para compartir en WhatsApp - Formato JSON para integración con sistemas - Alertas de confirmación al copiar Todos los componentes de datos del informe ahora tienen funcionalidad de exportación consistente.
This commit is contained in:
@@ -1,7 +1,29 @@
|
||||
<template>
|
||||
<UCard class="brand-card border border-transparent">
|
||||
<template #header>
|
||||
<h2 class="text-xl font-bold brand-section-title">Totales de Ingreso y Compra</h2>
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-xl font-bold brand-section-title">Totales de Ingreso y Compra</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="space-y-6">
|
||||
@@ -165,4 +187,37 @@ const formatNumber = (value: number) => {
|
||||
maximumFractionDigits: 2
|
||||
}).format(value)
|
||||
}
|
||||
|
||||
async function copiarTexto() {
|
||||
const texto = `☕ TOTALES DE INGRESO Y COMPRA
|
||||
|
||||
🍇 UVA:
|
||||
Ingresada: ${formatNumber(props.data.total_lb_uva_ingresada)} lb (${formatNumber(props.data.total_qq_seco_uva_ingresado)} QQ seco)
|
||||
Pagada: ${formatNumber(props.data.total_lb_uva_pagada)} lb (${formatNumber(props.data.total_qq_seco_uva_pagado)} QQ seco)
|
||||
En Depósito: ${formatNumber(props.data.total_lb_uva_deposito)} lb (${formatNumber(qqSecoUvaDeposito.value)} QQ seco)
|
||||
|
||||
💧 MOJADO:
|
||||
Ingresado: ${formatNumber(props.data.total_qq_seco_mojado_ingresado)} QQ seco
|
||||
Pagado: ${formatNumber(props.data.total_qq_seco_mojado_pagado)} QQ seco
|
||||
En Depósito: ${formatNumber(props.data.total_qq_mojado_deposito)} QQ
|
||||
|
||||
🌬️ OREADO:
|
||||
Ingresado: ${formatNumber(props.data.total_qq_seco_oreado_ingresado)} QQ seco
|
||||
Pagado: ${formatNumber(props.data.total_qq_seco_oreado_pagado)} QQ seco
|
||||
En Depósito: ${formatNumber(props.data.total_qq_oreado_deposito)} QQ
|
||||
|
||||
📊 TOTALES GENERALES:
|
||||
QQ Seco Ingresado: ${formatNumber(props.data.total_qq_seco_ingresado)} QQ
|
||||
QQ Seco Comprado: ${formatNumber(props.data.total_qq_seco_comprado)} QQ
|
||||
QQ Seco en Depósito: ${formatNumber(props.data.total_qq_seco_deposito)} QQ`
|
||||
|
||||
await navigator.clipboard.writeText(texto)
|
||||
alert('✅ Totales de Ingreso y Compra copiados al portapapeles')
|
||||
}
|
||||
|
||||
async function copiarJSON() {
|
||||
const json = JSON.stringify(props.data, null, 2)
|
||||
await navigator.clipboard.writeText(json)
|
||||
alert('✅ JSON copiado al portapapeles')
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,29 @@
|
||||
<template>
|
||||
<UCard class="brand-card border border-transparent">
|
||||
<template #header>
|
||||
<h2 class="text-xl font-bold brand-section-title">Totales Monetarios</h2>
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-xl font-bold brand-section-title">Totales Monetarios</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="space-y-6">
|
||||
@@ -130,4 +152,35 @@ const formatCurrency = (value: number) => {
|
||||
maximumFractionDigits: 2
|
||||
}).format(value).replace('HNL', 'L')
|
||||
}
|
||||
|
||||
async function copiarTexto() {
|
||||
const texto = `💰 TOTALES MONETARIOS
|
||||
|
||||
💵 INVERSIÓN HASTA LA FECHA:
|
||||
Inversión Uva: ${formatCurrency(props.data.inversion_uva)}
|
||||
Inversión Mojado: ${formatCurrency(props.data.inversion_mojado)}
|
||||
Inversión Oreado: ${formatCurrency(props.data.inversion_oreado)}
|
||||
Total Invertido: ${formatCurrency(props.data.total_invertido)}
|
||||
|
||||
📊 PRECIOS PROMEDIO PONDERADOS:
|
||||
Uva: ${formatCurrency(props.data.precio_promedio_uva_por_lb)}/lb (${formatCurrency(props.data.precio_promedio_uva_por_qq)}/QQ)
|
||||
Mojado: ${formatCurrency(props.data.precio_promedio_mojado_por_qq)}/QQ
|
||||
Oreado: ${formatCurrency(props.data.precio_promedio_oreado_por_qq)}/QQ
|
||||
Global QQ Seco: ${formatCurrency(props.data.precio_promedio_qq_seco)}/QQ
|
||||
|
||||
⏳ INVERSIÓN RESTANTE ESPERADA:
|
||||
Restante Uva: ${formatCurrency(props.data.inversion_restante_uva)}
|
||||
Restante Mojado: ${formatCurrency(props.data.inversion_restante_mojado)}
|
||||
Restante Oreado: ${formatCurrency(props.data.inversion_restante_oreado)}
|
||||
Total Restante: ${formatCurrency(props.data.inversion_restante_esperada)}`
|
||||
|
||||
await navigator.clipboard.writeText(texto)
|
||||
alert('✅ Totales Monetarios copiados al portapapeles')
|
||||
}
|
||||
|
||||
async function copiarJSON() {
|
||||
const json = JSON.stringify(props.data, null, 2)
|
||||
await navigator.clipboard.writeText(json)
|
||||
alert('✅ JSON copiado al portapapeles')
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,29 @@
|
||||
<template>
|
||||
<UCard class="brand-card border border-transparent">
|
||||
<template #header>
|
||||
<h2 class="text-xl font-bold brand-section-title">Café Verde</h2>
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-xl font-bold brand-section-title">Café Verde</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-3 gap-4">
|
||||
@@ -78,4 +100,27 @@ const formatCurrency = (value: number) => {
|
||||
maximumFractionDigits: 2
|
||||
}).format(value).replace('HNL', 'L')
|
||||
}
|
||||
|
||||
async function copiarTexto() {
|
||||
const texto = `🌱 CAFÉ VERDE
|
||||
|
||||
📊 TOTALES:
|
||||
LB Neto Verde Total: ${formatNumber(props.data.total_lb_neto_verde)} lb
|
||||
LB Neto Comprado: ${formatNumber(props.data.total_lb_neto_comprado_verde)} lb
|
||||
LB Neto en Depósito: ${formatNumber(props.data.total_lb_neto_verde_deposito)} lb
|
||||
|
||||
💵 FINANCIERO:
|
||||
Precio Promedio Pagado: ${formatCurrency(props.data.precio_promedio_verde_pagado)}/lb
|
||||
Inversión Hasta la Fecha: ${formatCurrency(props.data.inversion_verde_hasta_fecha)}
|
||||
Inversión Restante: ${formatCurrency(props.data.inversion_restante_verde)}`
|
||||
|
||||
await navigator.clipboard.writeText(texto)
|
||||
alert('✅ Totales de Café Verde copiados al portapapeles')
|
||||
}
|
||||
|
||||
async function copiarJSON() {
|
||||
const json = JSON.stringify(props.data, null, 2)
|
||||
await navigator.clipboard.writeText(json)
|
||||
alert('✅ JSON copiado al portapapeles')
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user