Merge pull request 'refactor: #8322 changed Travel component to use VnSection/VnCardBeta' (!1220) from 8322-travel into dev
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1220
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Alex Moreno 2025-01-24 09:14:18 +00:00
commit cfcbb8bce5
6 changed files with 188 additions and 176 deletions

View File

@ -12,6 +12,7 @@ const props = defineProps({
baseUrl: { type: String, default: undefined }, baseUrl: { type: String, default: undefined },
customUrl: { type: String, default: undefined }, customUrl: { type: String, default: undefined },
filter: { type: Object, default: () => {} }, filter: { type: Object, default: () => {} },
userFilter: { type: Object, default: () => {} },
descriptor: { type: Object, required: true }, descriptor: { type: Object, required: true },
filterPanel: { type: Object, default: undefined }, filterPanel: { type: Object, default: undefined },
searchDataKey: { type: String, default: undefined }, searchDataKey: { type: String, default: undefined },
@ -32,6 +33,7 @@ const url = computed(() => {
const arrayData = useArrayData(props.dataKey, { const arrayData = useArrayData(props.dataKey, {
url: url.value, url: url.value,
filter: props.filter, filter: props.filter,
userFilter: props.userFilter,
}); });
onBeforeMount(async () => { onBeforeMount(async () => {

View File

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

View File

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

View File

@ -1,9 +1,8 @@
<script setup> <script setup>
import VnCard from 'components/common/VnCard.vue';
import TravelDescriptor from './TravelDescriptor.vue'; import TravelDescriptor from './TravelDescriptor.vue';
import TravelFilter from '../TravelFilter.vue'; import VnCardBeta from 'src/components/common/VnCardBeta.vue';
const filter = { const userFilter = {
fields: [ fields: [
'id', 'id',
'ref', 'ref',
@ -35,17 +34,10 @@ const filter = {
}; };
</script> </script>
<template> <template>
<VnCard <VnCardBeta
data-key="Travel" data-key="Travel"
base-url="Travels" base-url="Travels"
search-data-key="TravelList"
:filter="filter"
:descriptor="TravelDescriptor" :descriptor="TravelDescriptor"
:filter-panel="TravelFilter" :user-filter="userFilter"
:searchbar-props="{
url: 'Travels/filter',
searchUrl: 'table',
label: 'Search travel',
}"
/> />
</template> </template>

View File

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

View File

@ -1,60 +1,13 @@
import { RouterView } from 'vue-router'; import { RouterView } from 'vue-router';
export default { const travelCard = {
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'),
},
],
},
{
name: 'TravelCard', name: 'TravelCard',
path: ':id', path: ':id',
component: () => import('src/pages/Travel/Card/TravelCard.vue'), component: () => import('src/pages/Travel/Card/TravelCard.vue'),
redirect: { name: 'TravelSummary' }, redirect: { name: 'TravelSummary' },
meta: {
menu: ['TravelBasicData', 'TravelHistory', 'TravelThermographs'],
},
children: [ children: [
{ {
name: 'TravelSummary', 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'),
},
], ],
}, },
], ],