feat(preview): refs #6475 add preview icon on descriptor
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Pablo Natek 2023-11-24 09:41:57 +01:00
parent 222a970a26
commit 0114de4db5
2 changed files with 33 additions and 22 deletions

View File

@ -1,9 +1,10 @@
<script setup> <script setup>
import { onMounted, useSlots, ref, watch } from 'vue'; import { onMounted, useSlots, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import axios from 'axios'; import axios from 'axios';
import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue'; import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
import CustomerSummaryDialog from '../../pages/Customer/Card/CustomerSummaryDialog.vue';
const $props = defineProps({ const $props = defineProps({
url: { url: {
type: String, type: String,
@ -25,8 +26,12 @@ const $props = defineProps({
type: Number, type: Number,
default: 0, default: 0,
}, },
preview: {
type: Boolean,
default: false,
},
}); });
const quasar = useQuasar();
const slots = useSlots(); const slots = useSlots();
const { t } = useI18n(); const { t } = useI18n();
const entity = ref(); const entity = ref();
@ -52,27 +57,36 @@ watch($props, async () => {
entity.value = null; entity.value = null;
await fetch(); await fetch();
}); });
function viewSummary(id) {
quasar.dialog({
component: CustomerSummaryDialog,
componentProps: {
id,
},
});
}
</script> </script>
<template> <template>
<div class="descriptor"> <div class="descriptor">
<template v-if="entity"> <template v-if="entity">
<div class="header bg-primary q-pa-sm"> <div class="header bg-primary q-pa-sm justify-between">
<RouterLink :to="{ name: `${module}List` }">
<QBtn <QBtn
@click.stop="viewSummary(entity.id)"
round round
flat flat
dense dense
size="md" size="md"
icon="view_list" icon="preview"
color="white" color="white"
class="link" class="link"
v-if="preview"
> >
<QTooltip> <QTooltip>
{{ t('components.cardDescriptor.mainList') }} {{ t('components.smartCard.openSummary') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</RouterLink>
<RouterLink :to="{ name: `${module}Summary`, params: { id: entity.id } }"> <RouterLink :to="{ name: `${module}Summary`, params: { id: entity.id } }">
<QBtn <QBtn
round round
@ -88,7 +102,6 @@ watch($props, async () => {
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</RouterLink> </RouterLink>
<QBtn <QBtn
v-if="slots.menu" v-if="slots.menu"
size="md" size="md"
@ -211,8 +224,6 @@ watch($props, async () => {
width: 256px; width: 256px;
.header { .header {
display: flex; display: flex;
justify-content: space-between;
align-items: stretch;
} }
.icons { .icons {
margin: 0 10px; margin: 0 10px;

View File

@ -10,6 +10,6 @@ const $props = defineProps({
</script> </script>
<template> <template>
<QPopupProxy> <QPopupProxy>
<CustomerDescriptor v-if="$props.id" :id="$props.id" /> <CustomerDescriptor v-if="$props.id" :id="$props.id" :preview="true" />
</QPopupProxy> </QPopupProxy>
</template> </template>