Files
analiticaNucleo/nuxt4-app/app/components/rechazos/RechazoCard.vue

53 lines
1.8 KiB
Vue

<template>
<div class="bg-[#1c140c] rounded-lg p-4 border-l-4" :class="borderColor">
<h3 class="text-lg font-semibold mb-3 capitalize text-[var(--brand-text)]">{{ title }}</h3>
<div class="space-y-2">
<div class="flex justify-between items-center">
<span class="text-[var(--brand-text-muted)] text-sm">Total {{ unidad }}:</span>
<span class="font-medium text-[var(--brand-text)]">{{ metrics.value.totalCantidad.toFixed(2) }} {{ unidad }}</span>
</div>
<div class="flex justify-between items-center">
<span class="text-[var(--brand-text-muted)] text-sm">Precio promedio:</span>
<span class="font-medium text-[var(--brand-text)]">{{ formatCurrency(metrics.value.precioPromedio) }}</span>
</div>
<div class="flex justify-between items-center pt-2 border-t border-[#3a2a16]">
<span class="text-[var(--brand-text)] font-semibold">Total cobrado:</span>
<span class="font-bold text-green-400">{{ formatCurrency(metrics.value.totalCobrado) }}</span>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import type { RechazoMetrics } from '~/composables/useRechazosMetrics'
interface Props {
title: string
metrics: ComputedRef<RechazoMetrics>
unidad: 'libras' | 'galones'
color?: 'blue' | 'green' | 'yellow' | 'red' | 'purple' | 'pink'
}
const props = withDefaults(defineProps<Props>(), {
color: 'blue'
})
const borderColor = computed(() => {
const colors = {
blue: 'border-blue-500',
green: 'border-green-500',
yellow: 'border-yellow-500',
red: 'border-red-500',
purple: 'border-purple-500',
pink: 'border-pink-500'
}
return colors[props.color]
})
const formatCurrency = (value: number) => {
return new Intl.NumberFormat('es-GT', {
style: 'currency',
currency: 'GTQ'
}).format(value)
}
</script>