refs #6339 clipboard

This commit is contained in:
Carlos Satorres 2024-01-18 13:33:14 +01:00
parent 6304776fac
commit 339d6609aa
7 changed files with 36 additions and 7 deletions

View File

@ -1,6 +1,8 @@
<script setup>
import { computed } from 'vue';
import { dashIfEmpty } from 'src/filters';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
const $props = defineProps({
label: { type: String, default: null },
@ -10,8 +12,20 @@ const $props = defineProps({
},
info: { type: String, default: null },
dash: { type: Boolean, default: true },
copy: { type: Boolean, default: false },
});
const { t } = useI18n();
const isBooleanValue = computed(() => typeof $props.value === 'boolean');
const quasar = useQuasar();
function copyText() {
navigator.clipboard.writeText($props.value);
quasar.notify({
type: 'positive',
message: t('components.VnLv.copyText', {
copyValue: $props.value,
}),
});
}
</script>
<style scoped>
.label,
@ -48,5 +62,16 @@ const isBooleanValue = computed(() => typeof $props.value === 'boolean');
</QTooltip>
</QIcon>
</div>
<div class="copy" v-if="$props.copy && $props.value" @click="copyText()">
<QIcon name="Content_Copy" color="primary" />
</div>
</div>
</template>
<style lang="scss" scoped>
.copy {
&:hover {
cursor: pointer;
}
}
</style>

View File

@ -936,5 +936,8 @@ export default {
addToPinned: 'Add to pinned',
removeFromPinned: 'Remove from pinned',
},
VnLv: {
copyText: '{copyValue} has been copied to the clipboard',
},
},
};

View File

@ -935,5 +935,8 @@ export default {
addToPinned: 'Añadir a fijados',
removeFromPinned: 'Eliminar de fijados',
},
VnLv: {
copyText: '{copyValue} se ha copiado al portapepeles',
},
},
};

View File

@ -81,7 +81,7 @@ const creditWarning = computed(() => {
<VnLinkPhone :phone-number="entity.mobile" />
</template>
</VnLv>
<VnLv :label="t('customer.summary.email')" :value="entity.email" />
<VnLv :label="t('customer.summary.email')" :value="entity.email" copy />
<VnLv
:label="t('customer.summary.salesPerson')"
:value="entity?.salesPersonUser?.name"

View File

@ -90,17 +90,15 @@ const removeDepartment = () => {
</QItem>
</template>
<template #body="{ entity }">
<VnLv :label="t('department.chat')" :value="entity.chatName" dash />
<VnLv :label="t('department.email')" :value="entity.notificationEmail" dash />
<VnLv :label="t('department.chat')" :value="entity.chatName" />
<VnLv :label="t('department.email')" :value="entity.notificationEmail" copy />
<VnLv
:label="t('department.selfConsumptionCustomer')"
:value="entity.client?.name"
dash
/>
<VnLv
:label="t('department.bossDepartment')"
:value="entity.worker?.user?.name"
dash
/>
</template>
<template #actions>

View File

@ -101,7 +101,7 @@ const setData = (entity) => {
</template>
<template #body="{ entity }">
<VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" />
<VnLv :label="t('worker.card.email')" :value="entity.user?.email"> </VnLv>
<VnLv :label="t('worker.card.email')" :value="entity.user?.email" copy />
<VnLv
:label="t('worker.list.department')"
:value="entity.department ? entity.department.department.name : null"

View File

@ -80,7 +80,7 @@ const filter = {
:label="t('worker.list.department')"
:value="worker.department.department.name"
/>
<VnLv :label="t('worker.list.email')" :value="worker.user.email" />
<VnLv :label="t('worker.list.email')" :value="worker.user.email" copy />
<VnLv :label="t('worker.summary.boss')" link>
<template #value>
<VnUserLink