Files
webapp/app/components/catalog/OfferResultCard.vue
Ruslan Bakiev 0337cebc63
All checks were successful
Build Docker Image / build (push) Successful in 4m42s
Simplify OfferResultCard and use daisyUI Steps
- Remove sourceName, latitude, longitude props from OfferResultCard
- Remove LocationMiniMap component (not needed, main map is on the side)
- Convert RouteStepper to use daisyUI steps-horizontal
- Update hub page and CalcResultContent to remove unused props
2026-01-15 00:33:17 +07:00

69 lines
1.7 KiB
Vue

<template>
<Card padding="md" interactive @click="$emit('select')">
<!-- Header: Location + Price -->
<div class="flex items-start justify-between mb-3">
<div>
<Text weight="semibold">{{ locationName || 'Локация' }}</Text>
<Text v-if="productName" tone="muted" size="sm">{{ productName }}</Text>
</div>
<Text v-if="priceDisplay" weight="semibold" class="text-primary text-lg">
{{ priceDisplay }}
</Text>
</div>
<!-- Route stepper -->
<RouteStepper v-if="stages.length > 0" :stages="stages" />
</Card>
</template>
<script setup lang="ts">
import type { RouteStage } from './RouteStepper.vue'
const props = withDefaults(defineProps<{
locationName?: string
productName?: string
pricePerUnit?: number | null
currency?: string | null
unit?: string | null
stages?: RouteStage[]
}>(), {
stages: () => []
})
defineEmits<{
select: []
}>()
const priceDisplay = computed(() => {
if (!props.pricePerUnit) return null
const currSymbol = getCurrencySymbol(props.currency)
const unitName = getUnitName(props.unit)
const formattedPrice = props.pricePerUnit.toLocaleString()
return `${currSymbol}${formattedPrice}/${unitName}`
})
const getCurrencySymbol = (currency?: string | null) => {
switch (currency?.toUpperCase()) {
case 'USD': return '$'
case 'EUR': return '€'
case 'RUB': return '₽'
case 'CNY': return '¥'
default: return '$'
}
}
const getUnitName = (unit?: string | null) => {
switch (unit?.toLowerCase()) {
case 'т':
case 'ton':
case 'tonne':
return 'тонна'
case 'кг':
case 'kg':
return 'кг'
default:
return 'тонна'
}
}
</script>