refactor: #8322 changed Route component to use VnSection/VnCardBeta #1141

Open
provira wants to merge 13 commits from 8322-route into dev
5 changed files with 107 additions and 106 deletions

View File

@ -1,19 +1,8 @@
<script setup> <script setup>
import VnCard from 'components/common/VnCard.vue';
import RouteDescriptor from 'pages/Route/Card/RouteDescriptor.vue'; import RouteDescriptor from 'pages/Route/Card/RouteDescriptor.vue';
import RouteFilter from './RouteFilter.vue'; import VnCardBeta from 'src/components/common/VnCardBeta.vue';
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
</script> </script>
<template> <template>
<VnCard <VnCardBeta data-key="Route" base-url="Routes" :descriptor="RouteDescriptor" />
data-key="Route"
base-url="Routes"
:descriptor="RouteDescriptor"
:filter-panel="RouteFilter"
search-data-key="RouteList"
>
<template #searchbar>
<RouteSearchbar />
</template>
</VnCard>
</template> </template>

View File

@ -3,17 +3,16 @@ import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { toHour } from 'src/filters'; import { toHour } from 'src/filters';
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
import RouteSummary from 'pages/Route/Card/RouteSummary.vue'; import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import RouteFilter from 'pages/Route/Card/RouteFilter.vue'; import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnSection from 'src/components/common/VnSection.vue';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const tableRef = ref([]); const tableRef = ref([]);
const dataKey = 'RouteList';
const routeFilter = { const routeFilter = {
include: [ include: [
{ {
@ -110,18 +109,23 @@ const columns = computed(() => [
]); ]);
</script> </script>
<template> <template>
<RouteSearchbar /> <VnSection
<RightMenu> :data-key="dataKey"
<template #right-panel> :columns="columns"
prefix="route"
:array-data-props="{
url: 'Routes/filter',
userFilter: routeFilter,
Outdated
Review

No existe

No existe

done👍

done👍
Outdated
Review

userFilter

userFilter
}"
>
<template #rightMenu>
<RouteFilter data-key="RouteList" /> <RouteFilter data-key="RouteList" />
</template> </template>
</RightMenu> <template #body>
<VnTable <VnTable
data-key="RouteList" :data-key="dataKey"
url="Routes/filter"
:columns="columns" :columns="columns"
:right-search="false" :right-search="false"
:filter="routeFilter"
redirect="route" redirect="route"
Outdated
Review

Este filter deber ir en array-data-props

Este filter deber ir en array-data-props

arreglado

arreglado
:create="{ :create="{
urlCreate: 'Routes', urlCreate: 'Routes',
@ -139,3 +143,5 @@ const columns = computed(() => [
</template> </template>
</VnTable> </VnTable>
</template> </template>
</VnSection>
</template>

View File

@ -37,6 +37,8 @@ route:
Summary: Summary Summary: Summary
Route is closed: Route is closed Route is closed: Route is closed
Route is not served: Route is not served Route is not served: Route is not served
search: Search route
searchInfo: You can search by route reference
cmr: cmr:
list: list:
results: results results: results

View File

@ -37,6 +37,8 @@ route:
Summary: Resumen Summary: Resumen
Route is closed: La ruta está cerrada Route is closed: La ruta está cerrada
Route is not served: La ruta no está servida Route is not served: La ruta no está servida
search: Buscar rutas
searchInfo: Puedes buscar por referencia de la ruta
cmr: cmr:
list: list:
results: resultados results: resultados

View File

@ -1,41 +1,87 @@
import { RouterView } from 'vue-router'; import { RouterView } from 'vue-router';
const routeCard = {
name: 'RouteCard',
path: ':id',
component: () => import('src/pages/Route/Card/RouteCard.vue'),
redirect: { name: 'RouteSummary' },
meta: {
menu: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
},
children: [
{
name: 'RouteBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('pages/Route/Card/RouteForm.vue'),
},
{
name: 'RouteSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'open_in_new',
},
component: () => import('pages/Route/Card/RouteSummary.vue'),
},
{
path: 'tickets',
name: 'RouteTickets',
meta: {
title: 'tickets',
icon: 'vn:ticket',
},
component: () => import('src/pages/Route/RouteTickets.vue'),
},
{
path: 'log',
name: 'RouteLog',
meta: {
title: 'log',
icon: 'vn:History',
},
component: () => import('src/pages/Route/RouteLog.vue'),
},
]
};
export default { export default {
path: '/route',
name: 'Route', name: 'Route',
path: '/route',
meta: { meta: {
title: 'routes', title: 'routes',
icon: 'vn:delivery', icon: 'vn:delivery',
moduleName: 'Route', moduleName: 'Route',
menu: ['RouteList', 'RouteExtendedList', 'RouteAutonomous', 'RouteRoadmap', 'CmrList', 'AgencyList'],
}, },
component: RouterView, component: RouterView,
redirect: { name: 'RouteMain' }, redirect: { name: 'RouteMain' },
menus: {
main: [
'RouteList',
'RouteExtendedList',
'RouteAutonomous',
'RouteRoadmap',
'CmrList',
'AgencyList',
],
card: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
},
children: [ children: [
{ {
path: '/route',
name: 'RouteMain', name: 'RouteMain',
path: '',
component: () => import('src/components/common/VnModule.vue'), component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'RouteList' }, redirect: { name: 'RouteIndexMain' },
children: [
{
path: '',
name: 'RouteIndexMain',
redirect: { name: 'RouteList' },
component: () => import('src/pages/Route/RouteList.vue'),
children: [ children: [
{ {
path: 'list',
name: 'RouteList', name: 'RouteList',
path: 'list',
meta: { meta: {
title: 'RouteList', title: 'list',
icon: 'view_list', icon: 'view_list',
}, },
component: () => import('src/pages/Route/RouteList.vue'), },
routeCard,
]
}, },
{ {
path: 'extended-list', path: 'extended-list',
@ -100,49 +146,5 @@ export default {
}, },
], ],
}, },
{
name: 'RouteCard',
path: ':id',
component: () => import('src/pages/Route/Card/RouteCard.vue'),
redirect: { name: 'RouteSummary' },
children: [
{
name: 'RouteBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('pages/Route/Card/RouteForm.vue'),
},
{
name: 'RouteSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'open_in_new',
},
component: () => import('pages/Route/Card/RouteSummary.vue'),
},
{
path: 'tickets',
name: 'RouteTickets',
meta: {
title: 'tickets',
icon: 'vn:ticket',
},
component: () => import('src/pages/Route/RouteTickets.vue'),
},
{
path: 'log',
name: 'RouteLog',
meta: {
title: 'log',
icon: 'vn:History',
},
component: () => import('src/pages/Route/RouteLog.vue'),
},
],
},
], ],
}; };