0
0
Fork 0

feat: CustomerBalance

This commit is contained in:
Javier Segarra 2024-08-29 15:29:57 +02:00
parent c727e5f669
commit b66ff783be
4 changed files with 46 additions and 19 deletions

View File

@ -1,20 +1,18 @@
<script setup>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { useI18n } from 'vue-i18n';
const $props = defineProps({
defineProps({
name: { type: String, default: null },
tag: { 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 :class="{ link: workerId }">
{{ defaultName ? name ?? $t('globals.system') : tag ?? name }}
</span>
</slot>
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" />
<WorkerDescriptorProxy v-if="workerId" :id="workerId" />
</template>

View File

@ -95,12 +95,7 @@ const columns = computed(() => [
label: t('Employee'),
columnField: {
component: 'userLink',
attrs: ({ row }) => {
return {
workerId: row.workerFk,
name: row.userName,
};
},
attrs: ({ row }) => ({ workerId: row.workerFk, tag: row.userName }),
},
cardVisible: true,
},

View File

@ -2,6 +2,7 @@
import { ref, computed, markRaw } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import VnLocation from 'src/components/common/VnLocation.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
@ -69,7 +70,7 @@ const columns = computed(() => [
optionFilter: 'firstName',
useLike: false,
},
create: true,
create: false,
columnField: {
component: null,
},
@ -195,6 +196,8 @@ const columns = computed(() => [
component: 'select',
attrs: {
url: 'BusinessTypes',
fields: ['code', 'description'],
sortBy: 'description ASC ',
optionLabel: 'description',
optionValue: 'code',
},
@ -357,7 +360,7 @@ const columns = computed(() => [
isPrimary: true,
},
{
title: t('Client ticket list'),
title: t('Preview'),
icon: 'preview',
isPrimary: true,
action: (row) => viewSummary(row.id, CustomerSummary),
@ -400,7 +403,7 @@ function handleLocation(data, location) {
url="Clients/filter"
:create="{
urlCreate: 'Clients/createWithUser',
title: 'Create client',
title: t('globals.pageTitles.customerCreate'),
onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: {
active: true,
@ -413,6 +416,39 @@ function handleLocation(data, location) {
auto-load
>
<template #more-create-dialog="{ data }">
<VnSelect
url="Workers/search"
v-model="data.salesPersonFk"
:label="t('customer.basicData.salesPerson')"
:params="{
departmentCodes: ['VT', 'shopping'],
}"
:fields="['id', 'nickname']"
sort-by="nickname ASC"
:use-like="false"
emit-value
auto-load
>
<template #prepend>
<VnAvatar
:worker-id="data.salesPersonFk"
color="primary"
:title="title"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption
>{{ scope.opt?.nickname }},
{{ scope.opt?.code }}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnLocation
:roles-allowed-to-create="['deliveryAssistant']"
v-model="data.location"

View File

@ -12,7 +12,6 @@ import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
// import FetchData from 'components/FetchData.vue';
import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
@ -96,8 +95,7 @@ const columns = computed(() => [
{
title: t('Client ticket list'),
icon: 'vn:lines',
action: ({ id }) =>
router.push({ params: { id }, name: 'TicketSummary' }),
action: ({ id }) => router.push({ params: { id }, name: 'TicketSale' }),
isPrimary: true,
},
{