All files / src/components/feature PolicyCard.vue

100% Statements 9/9
100% Branches 2/2
100% Functions 1/1
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31                  11x       11x       11x   5x     2x 2x   2x 2x 2x      
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { formatDetailMoney } from '@/utils/money'
import type { Policy } from '@/api/types'
 
defineProps<{
  policy: Policy
}>()
 
const emit = defineEmits<{
  (e: 'select', policyNo: string): void
}>()
 
const { t } = useI18n()
</script>
 
<template>
  <button
    class="flex w-full items-center justify-between rounded-2xl border border-silver-200 bg-white p-4 text-left shadow-card transition-all hover:border-silver-300 hover:shadow-soft active:scale-[0.99]"
    @click="emit('select', policy.policyNo)"
  >
    <div>
      <div class="text-sm font-medium tracking-tight">{{ policy.policyNo }}</div>
      <div class="mt-1 text-xs text-slate-500">{{ policy.productName }}</div>
    </div>
    <div class="text-right">
      <div class="tnum text-sm font-medium">{{ formatDetailMoney(policy.fullPremium, policy.currency) }}</div>
      <div class="mt-1 text-xs text-slate-400">{{ t('policies.myRatio') }} {{ policy.myRatio }}</div>
    </div>
  </button>
</template>