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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | 58x 2x 1x 2x 2x 2x 2x 2x 2x 2x 2x 111x 2x 55x 58x 55x 55x | <template>
<div
class="card h-100 position-relative card-clickable"
@click="$router.push(`/entities/${entity.id}`)"
>
<!-- Action buttons (top-right) -->
<div v-if="entity?.tenantId === currentTenant" class="card-actions">
<button
class="btn btn-sm btn-secondary action-icon"
:title="t('entity.editEntity')"
@click.stop="$emit('edit', entity)"
>
<font-awesome-icon icon="fa-solid fa-pen" />
</button>
<button
class="btn btn-sm btn-danger action-icon"
:title="t('common.delete')"
@click.stop="$emit('delete', entity.id)"
>
<font-awesome-icon icon="fa-solid fa-trash" />
</button>
</div>
<!-- Entity Picture -->
<div class="entity-picture-container">
<ImageField
v-if="entity?.picture"
:model-value="entity.picture"
:field="{ name: 'picture', type: 'image', fieldId: 'picture' }"
:is-editing="false"
:entity-id="entity.id"
:item-id="entity.id"
object-fit="cover"
no-thumbnail
:clickable="false"
no-wrapper
/>
<div v-else class="default-picture">
<font-awesome-icon icon="fa-solid fa-image" class="text-muted" />
</div>
</div>
<div class="card-body">
<div class="d-flex align-items-start justify-content-between mb-3">
<div class="d-flex align-items-center gap-2">
<div v-if="entity?.icon" class="entity-icon-container">
<ImageField
:model-value="entity.icon"
:field="{ name: 'icon', type: 'image', fieldId: 'icon' }"
:is-editing="false"
:entity-id="entity.id"
:item-id="entity.id"
object-fit="contain"
:clickable="false"
no-wrapper
no-thumbnail
/>
</div>
<font-awesome-icon
v-else
icon="fa-solid fa-database"
class="text-primary"
style="font-size: 1.5rem"
/>
<h5 class="card-title mb-0">
{{ getTranslation(entity.name) }}
</h5>
</div>
<span
v-if="entity?.visibility === 'public'"
class="badge bg-success"
:title="t('entity.visibilityTooltipPublic')"
>
🌍 {{ t('entity.visibilityPublic') }}
</span>
<span
v-else-if="entity?.visibility === 'restricted'"
class="badge bg-warning text-dark"
:title="t('entity.visibilityTooltipRestricted')"
>
🔐 {{ t('entity.visibilityRestricted') }}
</span>
<span v-else class="badge bg-primary" :title="t('entity.visibilityTooltipMembers')">
👥 {{ t('entity.visibilityMembers') }}
</span>
</div>
<p v-if="entity.description" class="card-text text-muted small mb-3">
{{ getTranslation(entity.description) }}
</p>
<div class="mb-3">
<div class="text-muted small mb-1">
{{ t('entity.fields') }} ({{ entity?.fields?.length || 0 }})
</div>
<div v-if="(entity?.fields?.length ?? 0) > 0" class="d-flex flex-wrap gap-1">
<span
v-for="(field, index) in (entity.fields || []).slice(0, 5)"
:key="index"
class="badge bg-light text-dark border"
>
{{ getTranslation(field.name) }}
<span v-if="field.mandatory" class="text-danger">*</span>
</span>
<span v-if="(entity?.fields?.length ?? 0) > 5" class="badge bg-light text-muted border">
{{ t('entity.moreFields').replace('{count}', String(entity.fields.length - 5)) }}
</span>
</div>
<div v-else class="text-muted small fst-italic">{{ t('entity.noFieldsDefined') }}</div>
</div>
<div class="text-muted small mb-3">
{{ t('entity.created') }}:
{{ entity?.createdAt ? new Date(entity.createdAt).toLocaleDateString() : 'N/A' }}
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import type { Entity } from '@/stores/entities'
import ImageField from '@/components/ImageField.vue'
import { useAuthStore } from '@/stores/auth'
import { useLanguage } from '@/composables/useLanguage'
import { useUILanguage } from '@/composables/useUILanguage'
defineProps<{
entity: Entity
}>()
defineEmits<{
edit: [entity: Entity]
delete: [id: string]
}>()
const authStore = useAuthStore()
const currentTenant = computed(() => authStore.currentTenant)
const { getTranslation } = useLanguage()
const { t } = useUILanguage()
</script>
<style scoped>
.card-clickable {
cursor: pointer;
transition:
transform 0.2s,
box-shadow 0.2s,
background-color 0.2s;
}
.card-clickable::before {
opacity: 0 !important;
}
.card-clickable:hover {
transform: scale(1.02);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.card-clickable:hover::before {
opacity: 0 !important;
}
.card-actions {
position: absolute;
top: 8px;
right: 8px;
z-index: 10;
display: flex;
gap: 4px;
}
.action-icon {
padding: 0.25rem 0.5rem;
font-size: 0.875rem;
border-radius: 4px;
opacity: 0.9;
}
.action-icon:hover {
opacity: 1;
}
.entity-picture-container {
width: 100%;
height: 150px;
overflow: hidden;
border-bottom: 1px solid #dee2e6;
background: #f8f9fa;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
}
.entity-picture-container img {
display: block;
}
.default-picture {
font-size: 3rem;
color: #dee2e6;
}
.entity-icon-container {
width: 2rem;
height: 2rem;
overflow: hidden;
border-radius: 4px;
flex-shrink: 0;
background: #f8f9fa;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
}
.entity-icon-container img {
display: block;
}
@media (max-width: 767px) {
.card-clickable {
cursor: default;
}
.card-clickable:hover {
transform: none;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.card-actions {
display: none !important;
}
}
</style>
|