95 lines
3.1 KiB
Vue
95 lines
3.1 KiB
Vue
<script setup>
|
|
import { ref, computed, onMounted } from 'vue';
|
|
import { useRoute } from 'vue-router';
|
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
|
import VnLv from 'src/components/ui/VnLv.vue';
|
|
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
|
import VnImg from 'src/components/ui/VnImg.vue';
|
|
import filter from './AccountFilter.js';
|
|
import useHasAccount from 'src/composables/useHasAccount.js';
|
|
|
|
const $props = defineProps({ id: { type: Number, default: null } });
|
|
|
|
const route = useRoute();
|
|
const entityId = computed(() => $props.id || route.params.id);
|
|
const hasAccount = ref();
|
|
|
|
onMounted(async () => {
|
|
hasAccount.value = await useHasAccount(entityId.value);
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<CardDescriptor
|
|
ref="descriptor"
|
|
:url="`VnUsers/preview`"
|
|
:filter="filter"
|
|
module="Account"
|
|
data-key="Account"
|
|
title="nickname"
|
|
>
|
|
<template #menu>
|
|
<AccountDescriptorMenu :entity-id="entityId" />
|
|
</template>
|
|
<template #before>
|
|
<VnImg :id="entityId" collection="user" resolution="520x520" class="photo">
|
|
<template #error>
|
|
<div
|
|
class="absolute-full picture text-center q-pa-md flex flex-center"
|
|
>
|
|
<div>
|
|
<div class="text-grey-5" style="opacity: 0.4; font-size: 5vh">
|
|
<QIcon name="vn:claims" />
|
|
</div>
|
|
<div class="text-grey-5" style="opacity: 0.4">
|
|
{{ $t('account.imageNotFound') }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</VnImg>
|
|
</template>
|
|
<template #body="{ entity }">
|
|
<VnLv :label="$t('account.card.nickname')" :value="entity.name" />
|
|
<VnLv :label="$t('account.card.role')" :value="entity.role?.name" />
|
|
</template>
|
|
<template #actions="{ entity }">
|
|
<QCardActions class="q-gutter-x-md">
|
|
<QIcon
|
|
v-if="!entity.active"
|
|
color="primary"
|
|
name="vn:disabled"
|
|
flat
|
|
round
|
|
size="sm"
|
|
class="fill-icon"
|
|
>
|
|
<QTooltip>{{ $t('account.card.deactivated') }}</QTooltip>
|
|
</QIcon>
|
|
<QIcon
|
|
color="primary"
|
|
name="contact_mail"
|
|
v-if="hasAccount"
|
|
flat
|
|
round
|
|
size="sm"
|
|
class="fill-icon"
|
|
>
|
|
<QTooltip>{{ $t('account.card.enabled') }}</QTooltip>
|
|
</QIcon>
|
|
</QCardActions>
|
|
</template>
|
|
</CardDescriptor>
|
|
</template>
|
|
<style scoped>
|
|
.q-item__label {
|
|
margin-top: 0;
|
|
}
|
|
</style>
|
|
<i18n>
|
|
en:
|
|
accountRate: Claming rate
|
|
es:
|
|
accountRate: Ratio de reclamación
|
|
</i18n>
|