forked from verdnatura/salix-front
refs #6339 clipboard
This commit is contained in:
parent
6304776fac
commit
339d6609aa
|
@ -1,6 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
label: { type: String, default: null },
|
label: { type: String, default: null },
|
||||||
|
@ -10,8 +12,20 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
info: { type: String, default: null },
|
info: { type: String, default: null },
|
||||||
dash: { type: Boolean, default: true },
|
dash: { type: Boolean, default: true },
|
||||||
|
copy: { type: Boolean, default: false },
|
||||||
});
|
});
|
||||||
|
const { t } = useI18n();
|
||||||
const isBooleanValue = computed(() => typeof $props.value === 'boolean');
|
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>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.label,
|
.label,
|
||||||
|
@ -48,5 +62,16 @@ const isBooleanValue = computed(() => typeof $props.value === 'boolean');
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="copy" v-if="$props.copy && $props.value" @click="copyText()">
|
||||||
|
<QIcon name="Content_Copy" color="primary" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.copy {
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -936,5 +936,8 @@ export default {
|
||||||
addToPinned: 'Add to pinned',
|
addToPinned: 'Add to pinned',
|
||||||
removeFromPinned: 'Remove from pinned',
|
removeFromPinned: 'Remove from pinned',
|
||||||
},
|
},
|
||||||
|
VnLv: {
|
||||||
|
copyText: '{copyValue} has been copied to the clipboard',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -935,5 +935,8 @@ export default {
|
||||||
addToPinned: 'Añadir a fijados',
|
addToPinned: 'Añadir a fijados',
|
||||||
removeFromPinned: 'Eliminar de fijados',
|
removeFromPinned: 'Eliminar de fijados',
|
||||||
},
|
},
|
||||||
|
VnLv: {
|
||||||
|
copyText: '{copyValue} se ha copiado al portapepeles',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,7 +81,7 @@ const creditWarning = computed(() => {
|
||||||
<VnLinkPhone :phone-number="entity.mobile" />
|
<VnLinkPhone :phone-number="entity.mobile" />
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :label="t('customer.summary.email')" :value="entity.email" />
|
<VnLv :label="t('customer.summary.email')" :value="entity.email" copy />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.salesPerson')"
|
:label="t('customer.summary.salesPerson')"
|
||||||
:value="entity?.salesPersonUser?.name"
|
:value="entity?.salesPersonUser?.name"
|
||||||
|
|
|
@ -90,17 +90,15 @@ const removeDepartment = () => {
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('department.chat')" :value="entity.chatName" dash />
|
<VnLv :label="t('department.chat')" :value="entity.chatName" />
|
||||||
<VnLv :label="t('department.email')" :value="entity.notificationEmail" dash />
|
<VnLv :label="t('department.email')" :value="entity.notificationEmail" copy />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('department.selfConsumptionCustomer')"
|
:label="t('department.selfConsumptionCustomer')"
|
||||||
:value="entity.client?.name"
|
:value="entity.client?.name"
|
||||||
dash
|
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('department.bossDepartment')"
|
:label="t('department.bossDepartment')"
|
||||||
:value="entity.worker?.user?.name"
|
:value="entity.worker?.user?.name"
|
||||||
dash
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
|
|
|
@ -101,7 +101,7 @@ const setData = (entity) => {
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" />
|
<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
|
<VnLv
|
||||||
:label="t('worker.list.department')"
|
:label="t('worker.list.department')"
|
||||||
:value="entity.department ? entity.department.department.name : null"
|
:value="entity.department ? entity.department.department.name : null"
|
||||||
|
|
|
@ -80,7 +80,7 @@ const filter = {
|
||||||
:label="t('worker.list.department')"
|
:label="t('worker.list.department')"
|
||||||
:value="worker.department.department.name"
|
: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>
|
<VnLv :label="t('worker.summary.boss')" link>
|
||||||
<template #value>
|
<template #value>
|
||||||
<VnUserLink
|
<VnUserLink
|
||||||
|
|
Loading…
Reference in New Issue