refactor: refs #8322 changed Route component to use VnSection/VnCardBeta
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
PAU ROVIRA ROSALENY 2024-12-27 13:43:33 +01:00
parent 93047ab179
commit a0b19f8e79
5 changed files with 109 additions and 106 deletions

View File

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

View File

@ -3,17 +3,16 @@ import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { toHour } from 'src/filters';
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.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 VnTable from 'components/VnTable/VnTable.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnSection from 'src/components/common/VnSection.vue';
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const tableRef = ref([]);
const dataKey = 'RouteList';
const routeFilter = {
include: [
{
@ -110,21 +109,28 @@ const columns = computed(() => [
]);
</script>
<template>
<RouteSearchbar />
<RightMenu>
<template #right-panel>
<VnSection
:data-key="dataKey"
:columns="columns"
prefix="route"
:array-data-props="{
url: 'Routes/filter',
order: 'id DESC',
exprBuilder,
}"
>
<template #rightMenu>
<RouteFilter data-key="RouteList" />
</template>
</RightMenu>
<template #body>
<VnTable
data-key="RouteList"
url="Routes/filter"
:data-key="dataKey"
:columns="columns"
:right-search="false"
:filter="routeFilter"
redirect="route"
:create="{
urlCreate: 'Routes',
urlCreate: 'Routes/create',
title: t('route.createRoute'),
onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: {},
@ -139,3 +145,5 @@ const columns = computed(() => [
</template>
</VnTable>
</template>
</VnSection>
</template>

View File

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

View File

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

View File

@ -1,41 +1,87 @@
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 {
path: '/route',
name: 'Route',
path: '/route',
meta: {
title: 'routes',
icon: 'vn:delivery',
moduleName: 'Route',
menu: ['RouteList', 'RouteExtendedList', 'RouteAutonomous', 'RouteRoadmap', 'CmrList', 'AgencyList'],
},
component: RouterView,
redirect: { name: 'RouteMain' },
menus: {
main: [
'RouteList',
'RouteExtendedList',
'RouteAutonomous',
'RouteRoadmap',
'CmrList',
'AgencyList',
],
card: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
},
children: [
{
path: '/route',
name: 'RouteMain',
path: '',
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: [
{
path: 'list',
name: 'RouteList',
path: 'list',
meta: {
title: 'RouteList',
title: 'list',
icon: 'view_list',
},
component: () => import('src/pages/Route/RouteList.vue'),
},
routeCard,
]
},
{
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'),
},
],
},
],
};