feat: refs #6643 create VnUserLink
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-01-10 11:21:02 +01:00
parent 7b8ad3720e
commit 2555d2b2d1
19 changed files with 118 additions and 121 deletions

View File

@ -12,8 +12,8 @@ import { useValidator } from 'src/composables/useValidator';
import VnAvatar from '../ui/VnAvatar.vue';
import VnJsonValue from '../common/VnJsonValue.vue';
import FetchData from '../FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnSelectFilter from './VnSelectFilter.vue';
import VnUserLink from '../ui/VnUserLink.vue';
const stateStore = useStateStore();
const validationsStore = useValidator();
@ -421,15 +421,15 @@ setLogTree();
>
<div class="timeline">
<div class="user-avatar">
<VnUserLink v-if="userLog.user.image" :worker-id="userLog.user.id">
<template #link>
<VnAvatar
class="cursor-pointer"
:worker="userLog.user.id"
:class="{ 'cursor-pointer': userLog.user.id }"
:worker-id="userLog.user.id"
:title="userLog.user.nickname"
/>
<WorkerDescriptorProxy
v-if="userLog.user.image"
:id="userLog.user.id"
/>
</template>
</VnUserLink>
</div>
<div class="arrow bg-panel" v-if="byRecord"></div>
<div class="line"></div>
@ -704,7 +704,7 @@ setLogTree();
class="q-pa-xs row items-center"
>
<QItemSection class="col-3 items-center">
<VnAvatar :worker="opt.id" />
<VnAvatar :worker-id="opt.id" />
</QItemSection>
<QItemSection class="col-9 justify-center">
<span>{{ opt.name }}</span>

View File

@ -1,10 +1,9 @@
<script setup>
import { useSession } from 'src/composables/useSession';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
const $props = defineProps({
worker: { type: Number, required: true },
workerId: { type: Number, required: true },
description: { type: String, default: null },
clickable: { type: Boolean, default: false },
});
const session = useSession();
const token = session.getToken();
@ -13,7 +12,7 @@ const token = session.getToken();
<div class="avatar-picture column items-center">
<QAvatar color="orange">
<QImg
:src="`/api/Images/user/160x160/${$props.worker}/download?access_token=${token}`"
:src="`/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`"
spinner-color="white"
/>
</QAvatar>
@ -24,6 +23,5 @@ const token = session.getToken();
</p>
</slot>
</div>
<WorkerDescriptorProxy :v-if="$props.clickable" :id="$props.worker" />
</div>
</template>

View File

@ -1,11 +1,11 @@
<script setup>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue';
import { toDateHour } from 'src/filters';
import { ref } from 'vue';
import axios from 'axios';
import { useI18n } from 'vue-i18n';
import VnPaginate from './VnPaginate.vue';
import VnUserLink from '../ui/VnUserLink.vue';
const $props = defineProps({
id: { type: String, required: true },
@ -42,13 +42,14 @@ async function insert() {
<QCard class="q-pa-md q-mb-md" v-for="(note, index) in rows" :key="index">
<QCardSection horizontal>
<slot name="picture">
<VnAvatar :worker="note.workerFk" />
<VnAvatar :descriptor="false" :worker-id="note.workerFk" />
</slot>
<QItem class="full-width justify-between items-start">
<span class="link">
{{ `${note.worker.firstName} ${note.worker.lastName}` }}
<WorkerDescriptorProxy :id="note.worker.id" />
</span>
<VnUserLink
:name="`${note.worker.firstName} ${note.worker.lastName}`"
:worker-id="note.worker.id"
/>
<slot name="actions">
{{ toDateHour(note.created) }}
</slot>

View File

@ -3,6 +3,7 @@ import { onBeforeMount } from 'vue';
import { date } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnAvatar from '../ui/VnAvatar.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({
url: { type: String, default: null },
@ -63,12 +64,15 @@ function formatNumber(number) {
>
<QItem>
<QItemSection side top>
<VnUserLink :worker-id="row.sms?.senderFk">
<template #link>
<VnAvatar
:worker-id="row.sms?.senderFk"
class="cursor-pointer"
:worker="row.sms.senderFk"
:title="row.sms.sender.name"
:clickable="true"
:title="row.sms?.sender?.name"
/>
</template>
</VnUserLink>
</QItemSection>
<QSeparator />
<QItemSection>

View File

@ -0,0 +1,21 @@
<script setup>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { useI18n } from 'vue-i18n';
const $props = defineProps({
name: { type: String, default: null },
workerId: { type: Number, default: null },
defaultName: { type: Boolean, default: false },
});
const { t } = useI18n();
</script>
<template>
<slot name="link">
<span :class="{ link: $props.workerId }">
{{ $props.defaultName ? $props.name ?? t('globals.system') : $props.name }}
</span>
</slot>
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" />
</template>
<style scoped></style>

View File

@ -63,6 +63,7 @@ export default {
selectRows: 'Select all { numberRows } row(s)',
allRows: 'All { numberRows } row(s)',
markAll: 'Mark all',
system: 'System',
},
errors: {
statusUnauthorized: 'Access denied',

View File

@ -62,6 +62,7 @@ export default {
selectRows: 'Seleccionar las { numberRows } filas(s)',
allRows: 'Todo { numberRows } filas(s)',
markAll: 'Marcar todo',
system: 'Sistema',
},
errors: {
statusUnauthorized: 'Acceso denegado',

View File

@ -4,14 +4,12 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { toDate } from 'src/filters';
import { useState } from 'src/composables/useState';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({
id: {
@ -118,18 +116,18 @@ const setData = (entity) => {
:value="entity.worker.user.name"
>
<template #value>
<span class="link">
{{ entity.worker.user.name }}
<WorkerDescriptorProxy :id="entity.worker.user.id" />
</span>
<VnUserLink
:name="entity.worker.user.name"
:worker-id="entity.worker.id"
/>
</template>
</VnLv>
<VnLv :label="t('claim.card.commercial')">
<template #value>
<span class="link">
{{ entity.client?.salesPersonUser?.name }}
<WorkerDescriptorProxy :id="entity.client?.salesPersonFk" />
</span>
<VnUserLink
:name="entity.client?.salesPersonUser?.name"
:worker-id="entity.client?.salesPersonFk"
/>
</template>
</VnLv>
<VnLv

View File

@ -7,9 +7,9 @@ import CardSummary from 'components/ui/CardSummary.vue';
import FetchData from 'components/FetchData.vue';
import { getUrl } from 'src/composables/getUrl';
import { useSession } from 'src/composables/useSession';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import ClaimNotes from 'src/pages/Claim/Card/ClaimNotes.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const route = useRoute();
const { t } = useI18n();
@ -196,18 +196,18 @@ function openDialog(dmsId) {
</VnLv>
<VnLv :label="t('claim.summary.assignedTo')">
<template #value>
<span class="link">
{{ claim.worker.user.nickname }}
<WorkerDescriptorProxy :id="claim.workerFk" />
</span>
<VnUserLink
:name="claim.worker?.user?.nickname"
:worker-id="claim.workerFk"
/>
</template>
</VnLv>
<VnLv :label="t('claim.summary.attendedBy')">
<template #value>
<span class="link">
{{ claim.client.salesPersonUser.name }}
<WorkerDescriptorProxy :id="claim.client.salesPersonFk" />
</span>
<VnUserLink
:name="claim.client?.salesPersonUser?.name"
:worker-id="claim.client?.salesPersonFk"
/>
</template>
</VnLv>
</QCard>
@ -313,20 +313,6 @@ function openDialog(dmsId) {
/>
</div>
</QCard>
<!-- <QCardSection class="q-pa-md" v-if="observations.length > 0">
<h6>{{ t('claim.summary.notes') }}</h6>
<div class="note-list" v-for="note in observations" :key="note.id">
<div class="note-caption">
<span
>{{ note.worker.firstName }} {{ note.worker.lastName }}
</span>
<span>{{ toDate(note.created) }}</span>
</div>
<div class="note-text">
<span>{{ note.text }}</span>
</div>
</div>
</QCardSection> -->
<QDialog
v-model="multimediaDialog"
transition-show="slide-up"

View File

@ -11,7 +11,7 @@ import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
import ClaimSummaryDialog from './Card/ClaimSummaryDialog.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const stateStore = useStateStore();
const router = useRouter();
@ -98,10 +98,10 @@ function viewSummary(id) {
</VnLv>
<VnLv :label="t('claim.list.assignedTo')" @click.stop>
<template #value>
<span class="link">
{{ row.workerName }}
<WorkerDescriptorProxy :id="row.workerFk" />
</span>
<VnUserLink
:name="row.workerName"
:worker-id="row.workerFk"
/>
</template>
</VnLv>
<VnLv

View File

@ -4,9 +4,9 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { toCurrency } from 'src/filters';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({
id: {
@ -44,10 +44,10 @@ const setData = (entity) => (data.value = useCardDescription(entity.name, entity
<template #body="{ entity }">
<VnLv v-if="entity.salesPersonUser" :label="t('customer.card.salesPerson')">
<template #value>
<span class="link">
{{ entity.salesPersonUser.name }}
<WorkerDescriptorProxy :id="entity.salesPersonFk" />
</span>
<VnUserLink
:name="entity.salesPersonUser?.name"
:worker-id="entity.salesPersonFk"
/>
</template>
</VnLv>
<VnLv :label="t('customer.card.credit')" :value="toCurrency(entity.credit)" />

View File

@ -7,6 +7,7 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { useArrayData } from 'src/composables/useArrayData';
import { onMounted, watch } from 'vue';
import { useRoute } from 'vue-router';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore();
const { t } = useI18n();
@ -74,11 +75,7 @@ onMounted(async () => {
</QDrawer>
<QPageContainer>
<QPage>
<QToolbar class="bg-vn-dark justify-end">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<VnSubToolbar />
<div class="q-pa-md"><RouterView></RouterView></div>
</QPage>
</QPageContainer>

View File

@ -2,12 +2,12 @@
import { onMounted, ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import invoiceOutService from 'src/services/invoiceOut.service';
import { toCurrency } from 'src/filters';
import { QCheckbox, QBtn } from 'quasar';
import { useInvoiceOutGlobalStore } from 'src/stores/invoiceOutGlobal.js';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const invoiceOutGlobalStore = useInvoiceOutGlobalStore();
@ -345,9 +345,9 @@ onMounted(() => refresh());
v-if="props.col.name === 'clientId'"
:id="selectedCustomerId"
/>
<WorkerDescriptorProxy
<VnUserLink
v-if="props.col.name === 'comercial'"
:id="selectedWorkerId"
:worker-id="selectedWorkerId"
/>
</component>
</QTd>

View File

@ -5,8 +5,8 @@ import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'components/ui/VnLv.vue';
import useCardDescription from 'composables/useCardDescription';
import WorkerDescriptorProxy from "pages/Worker/Card/WorkerDescriptorProxy.vue";
import ShelvingDescriptorMenu from "pages/Shelving/Card/ShelvingDescriptorMenu.vue";
import ShelvingDescriptorMenu from 'pages/Shelving/Card/ShelvingDescriptorMenu.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({
id: {
@ -57,10 +57,10 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
<VnLv :label="t('shelving.summary.parking')" :value="entity.parking?.code" />
<VnLv v-if="entity.worker" :label="t('shelving.summary.worker')">
<template #value>
<span class="link">
{{ entity.worker?.user?.nickname }}
<WorkerDescriptorProxy :id="entity.worker?.id" />
</span>
<VnUserLink
:name="entity.worker?.user?.nickname"
:worker-id="entity.worker?.id"
/>
</template>
</VnLv>
</template>

View File

@ -3,11 +3,11 @@ import { onMounted, ref, computed, onUpdated } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import { getUrl } from 'src/composables/getUrl';
import { useRole } from 'src/composables/useRole';
import { dashIfEmpty } from 'src/filters';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
onUpdated(() => summaryRef.value.fetch());
@ -71,13 +71,10 @@ const isAdministrative = computed(() => {
<VnLv label="Alias" :value="supplier.nickname" />
<VnLv :label="t('supplier.summary.responsible')">
<template #value>
<span class="link">
{{ dashIfEmpty(supplier.worker?.user?.nickname) }}
<WorkerDescriptorProxy
v-if="supplier.worker?.user?.id"
:id="supplier.worker?.user?.id"
<VnUserLink
:name="dashIfEmpty(supplier.worker?.user?.nickname)"
:worker-id="supplier.worker?.user?.id"
/>
</span>
</template>
</VnLv>
<VnLv :label="t('supplier.summary.notes')" class="q-mb-xs">

View File

@ -8,7 +8,7 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({
id: {
@ -106,13 +106,10 @@ const setData = (entity) =>
</VnLv>
<VnLv :label="t('ticket.summary.salesPerson')">
<template #value>
<span class="link">
{{ entity.client.salesPersonUser.name }}
<WorkerDescriptorProxy
:id="entity.client.salesPersonFk"
v-if="entity.client.salesPersonFk"
<VnUserLink
:name="entity.client.salesPersonUser?.name"
:worker-id="entity.client.salesPersonFk"
/>
</span>
</template>
</VnLv>
<VnLv :label="t('ticket.card.warehouse')" :value="entity.warehouse?.name" />

View File

@ -8,10 +8,10 @@ import CardSummary from 'components/ui/CardSummary.vue';
import FetchData from 'components/FetchData.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import { getUrl } from 'src/composables/getUrl';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
onUpdated(() => summaryRef.value.fetch());
@ -160,13 +160,10 @@ async function changeState(value) {
</VnLv>
<VnLv :label="t('ticket.summary.salesPerson')">
<template #value>
<span class="link">
{{ ticket.client?.salesPersonUser?.name }}
<WorkerDescriptorProxy
:id="ticket.client.salesPersonFk"
v-if="ticket.client.salesPersonFk"
<VnUserLink
:name="ticket.client?.salesPersonUser?.name"
:worker-id="ticket.client?.salesPersonFk"
/>
</span>
</template>
</VnLv>
<VnLv

View File

@ -2,12 +2,12 @@
import { ref, onMounted, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import { dashIfEmpty } from 'src/filters';
import { getUrl } from 'src/composables/getUrl';
import VnLv from 'src/components/ui/VnLv.vue';
import WorkerDescriptorProxy from './WorkerDescriptorProxy.vue';
import { dashIfEmpty } from 'src/filters';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import CardSummary from 'components/ui/CardSummary.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const route = useRoute();
const { t } = useI18n();
@ -83,13 +83,11 @@ const filter = {
<VnLv :label="t('worker.list.email')" :value="worker.user.email" />
<VnLv :label="t('worker.summary.boss')" link>
<template #value>
<span class="link">
{{ dashIfEmpty(worker.boss?.name) }}
<WorkerDescriptorProxy
:id="worker.bossFk"
<VnUserLink
v-if="worker.boss"
:name="dashIfEmpty(worker.boss?.name)"
:worker-id="worker.bossFk"
/>
</span>
</template>
</VnLv>
<VnLv :value="worker.mobileExtension">

View File

@ -36,6 +36,7 @@ export const useStateStore = defineStore('stateStore', () => {
}
function isSubToolbarShown() {
console.log('ye', subToolbar.value);
return subToolbar.value;
}