mandant-crm/frontend/components/client/ClientCard.vue
Tim Stollberg 570f17e8b8 feat(frontend): commit uncommitted settings, custom fields, and import work
This local working tree had accumulated a substantial amount of
finished-but-never-committed frontend work: custom client fields
(replacing the old static ClientFields with a dynamic
ClientCustomFieldCard + useCustomFields), CSV import
(useImport + settings/import page), history type management
(useHistoryTypes + settings/history-types page), an admin-only route
middleware, several new icon components, a shared useApiFetch
composable, and a client detail page restructure ([id].vue ->
[id]/index.vue). None of it had ever been pushed, so production was
running a stale build that was already linking to routes/components
that didn't exist server-side (missing IconSettings, 404s on
/settings/import, etc). This commit brings the repo in line with
local state.
2026-07-18 16:27:19 +07:00

37 lines
1.1 KiB
Vue

<script setup lang="ts">
import type { Client } from '~/types'
const props = defineProps<{ client: Client }>()
const daysAgo = (iso: string): number => {
const diffMs = Date.now() - new Date(iso).getTime()
return Math.max(0, Math.floor(diffMs / 86_400_000))
}
const info = computed(() => {
const count = props.client.history_count
if (count == null || count === 0) return null
const updates = `${count} Verlauf-Update${count > 1 ? 's' : ''}`
const last = props.client.last_history_at
if (!last) return updates
const d = daysAgo(last)
const when =
d === 0 ? 'heute' : `vor ${d} ${d === 1 ? 'Tag' : 'Tagen'}`
return `${updates} · zuletzt ${when}`
})
</script>
<template>
<NuxtLink
:to="`/clients/${client.id}`"
class="block border border-gray-200 bg-white px-4 py-3 hover:bg-blue-50 cursor-pointer"
>
<div class="flex items-baseline gap-4">
<span class="text-sm font-mono text-gray-500 w-20 shrink-0">{{ client.client_number }}</span>
<span class="text-sm font-medium text-gray-900">{{ client.name }}</span>
</div>
<p v-if="info" class="mt-1 pl-24 text-xs text-gray-400">{{ info }}</p>
</NuxtLink>
</template>