refactor: refs #8322 changed Travel component to use VnSection/VnCardBeta

This commit is contained in:
PAU ROVIRA ROSALENY 2025-01-15 08:14:33 +01:00
parent 494b8440d6
commit c1e2e434ac
5 changed files with 185 additions and 207 deletions

View File

@ -765,6 +765,9 @@ supplier:
consumption:
entry: Entry
travel:
search: Search travel
searchInfo: You can search by travel id or name
id: Id
travelList:
tableVisibleColumns:
ref: Reference

View File

@ -757,6 +757,9 @@ supplier:
consumption:
entry: Entrada
travel:
search: Buscar envío
searchInfo: Buscar envío por id o nombre
id: Id
travelList:
tableVisibleColumns:
ref: Referencia

View File

@ -1,48 +1,7 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import TravelDescriptor from './TravelDescriptor.vue';
import TravelFilter from '../TravelFilter.vue';
const filter = {
fields: [
'id',
'ref',
'shipped',
'landed',
'totalEntries',
'warehouseInFk',
'warehouseOutFk',
'cargoSupplierFk',
'agencyModeFk',
],
include: [
{
relation: 'warehouseIn',
scope: {
fields: ['name'],
},
},
{
relation: 'warehouseOut',
scope: {
fields: ['name'],
},
},
],
};
import VnCardBeta from 'src/components/common/VnCardBeta.vue';
</script>
<template>
<VnCard
data-key="Travel"
base-url="Travels"
search-data-key="TravelList"
:filter="filter"
:descriptor="TravelDescriptor"
:filter-panel="TravelFilter"
:searchbar-props="{
url: 'Travels/filter',
searchUrl: 'table',
label: 'Search travel',
}"
/>
<VnCardBeta data-key="Travel" base-url="Travels" :descriptor="TravelDescriptor" />
</template>

View File

@ -5,18 +5,18 @@ import { useRouter, useRoute } from 'vue-router';
import VnTable from 'components/VnTable/VnTable.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import TravelSummary from './Card/TravelSummary.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { toDate } from 'src/filters';
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
import RightMenu from 'src/components/common/RightMenu.vue';
import TravelFilter from './TravelFilter.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import VnSection from 'src/components/common/VnSection.vue';
const { viewSummary } = useSummaryDialog();
const router = useRouter();
const { t } = useI18n();
const route = useRoute();
const tableRef = ref();
const dataKey = 'TravelList';
const $props = defineProps({
id: {
type: Number,
@ -189,21 +189,22 @@ const columns = computed(() => [
</script>
<template>
<VnSearchbar
:info="t('You can search by travel id or name')"
:label="t('Search travel')"
data-key="TravelList"
/>
<RightMenu>
<template #right-panel>
<VnSection
:data-key="dataKey"
:columns="columns"
prefix="travel"
:array-data-props="{
url: 'Travels/filter',
order: ['landed DESC'],
}"
>
<template #rightMenu>
<TravelFilter data-key="TravelList" />
</template>
</RightMenu>
<template #body>
<VnTable
ref="tableRef"
data-key="TravelList"
url="Travels/filter"
redirect="travel"
:data-key="dataKey"
:create="{
urlCreate: 'Travels',
title: t('Create Travels'),
@ -214,7 +215,8 @@ const columns = computed(() => [
}"
:right-search="false"
:user-params="{ daysOnward: 7 }"
order="landed DESC"
redirect="travel"
:columns="columns"
:is-editable="false"
>
@ -273,6 +275,8 @@ const columns = computed(() => [
/>
</template>
</VnTable>
</template>
</VnSection>
</template>
<i18n>
en:

View File

@ -1,60 +1,13 @@
import { RouterView } from 'vue-router';
export default {
path: '/travel',
name: 'Travel',
meta: {
title: 'travel',
icon: 'local_airport',
moduleName: 'Travel',
},
component: RouterView,
redirect: { name: 'TravelMain' },
menus: {
main: ['TravelList', 'ExtraCommunity'],
card: ['TravelBasicData', 'TravelHistory', 'TravelThermographs'],
},
children: [
{
path: '',
name: 'TravelMain',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'TravelList' },
children: [
{
path: 'list',
name: 'TravelList',
meta: {
title: 'list',
icon: 'view_list',
},
component: () => import('src/pages/Travel/TravelList.vue'),
},
{
path: 'extra-community',
name: 'ExtraCommunity',
meta: {
title: 'extraCommunity',
icon: 'vn:shipment',
},
component: () => import('src/pages/Travel/ExtraCommunity.vue'),
},
{
path: 'create',
name: 'TravelCreate',
meta: {
title: 'travelCreate',
icon: 'add',
},
component: () => import('src/pages/Travel/TravelCreate.vue'),
},
],
},
{
const travelCard = {
name: 'TravelCard',
path: ':id',
component: () => import('src/pages/Travel/Card/TravelCard.vue'),
redirect: { name: 'TravelSummary' },
meta: {
menu: ['TravelBasicData', 'TravelHistory', 'TravelThermographs'],
},
children: [
{
name: 'TravelSummary',
@ -119,6 +72,62 @@ export default {
},
],
},
]
};
export default {
path: '/travel',
name: 'Travel',
meta: {
title: 'travel',
icon: 'local_airport',
moduleName: 'Travel',
menu: ['TravelList', 'ExtraCommunity'],
},
component: RouterView,
redirect: { name: 'TravelMain' },
children: [
{
path: '',
name: 'TravelMain',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'TravelIndexMain' },
children: [
{
path: '',
name: 'TravelIndexMain',
redirect: { name: 'TravelList' },
component: () => import('src/pages/Travel/TravelList.vue'),
children: [
{
name: 'TravelList',
path: 'list',
meta: {
title: 'list',
icon: 'view_list',
},
},
travelCard,
],
},
{
path: 'extra-community',
name: 'ExtraCommunity',
meta: {
title: 'extraCommunity',
icon: 'vn:shipment',
},
component: () => import('src/pages/Travel/ExtraCommunity.vue'),
},
{
path: 'create',
name: 'TravelCreate',
meta: {
title: 'travelCreate',
icon: 'add',
},
component: () => import('src/pages/Travel/TravelCreate.vue'),
},
],
},
],