All checks were successful
Build Docker Image / build (push) Successful in 4m42s
- 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
69 lines
1.7 KiB
Vue
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>
|