WIP: #7925 remove redirect #897

Draft
jorgep wants to merge 4 commits from 7925-removeRedirect into dev
24 changed files with 12 additions and 28 deletions

View File

@ -274,7 +274,7 @@ const rowCtrlClickFunction = computed(() => {
});
function redirectFn(id) {
router.push({ path: `/${$props.redirect}/${id}` });
router.push({ path: `/${$props.redirect}/${id}/summary` });
}
function stopEventPropagation(event) {
@ -599,7 +599,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
<template #item="{ row, colsMap }">
<component
:is="$props.redirect ? 'router-link' : 'span'"
:to="`/${$props.redirect}/` + row.id"
:to="`/${$props.redirect}/${row.id}/summary`"
>
<QCard
bordered

View File

@ -260,11 +260,17 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
});
const { matched: matches } = router.currentRoute.value;
const { path } = matches.at(-1);
const rowsNumber = store.data.length;
const to =
store?.data?.length === 1
? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`)
: path.replace(/:id.*/, '');
let to;
if (path.includes(':id') && !rowsNumber) {
return router.push({ name: 'NotFound' });
} else if (rowsNumber === 1) {
to = path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`);
if (!to.includes('summary')) to += '/summary';
} else {
to = path.replace(/:id.*/, '');
}
if (route.path != to) {
const pushUrl = { path: to };

View File

@ -57,7 +57,6 @@ export default {
name: 'SupplierCard',
path: ':id',
component: () => import('src/pages/Supplier/Card/SupplierCard.vue'),
redirect: { name: 'SupplierSummary' },
children: [
{
name: 'SupplierSummary',

View File

@ -124,7 +124,6 @@ export default {
name: 'AccountCard',
path: ':id',
component: () => import('src/pages/Account/Card/AccountCard.vue'),
redirect: { name: 'AccountSummary' },
children: [
{
name: 'AccountSummary',

View File

@ -19,7 +19,6 @@ export default {
path: '/agency/:id',
name: 'AgencyCard',
component: () => import('src/pages/Route/Agency/Card/AgencyCard.vue'),
redirect: { name: 'AgencySummary' },
children: [
{
name: 'AgencySummary',

View File

@ -45,7 +45,6 @@ export default {
name: 'ClaimCard',
path: ':id',
component: () => import('src/pages/Claim/Card/ClaimCard.vue'),
redirect: { name: 'ClaimSummary' },
children: [
{
name: 'ClaimSummary',

View File

@ -98,7 +98,6 @@ export default {
name: 'CustomerCard',
path: ':id',
component: () => import('src/pages/Customer/Card/CustomerCard.vue'),
redirect: { name: 'CustomerSummary' },
children: [
{
name: 'CustomerSummary',

View File

@ -19,7 +19,6 @@ export default {
name: 'DepartmentCard',
path: 'department/:id',
component: () => import('src/pages/Department/Card/DepartmentCard.vue'),
redirect: { name: 'DepartmentSummary' },
children: [
{
name: 'DepartmentSummary',

View File

@ -88,7 +88,6 @@ export default {
name: 'EntryCard',
path: ':id',
component: () => import('src/pages/Entry/Card/EntryCard.vue'),
redirect: { name: 'EntrySummary' },
children: [
{
name: 'EntrySummary',

View File

@ -62,7 +62,6 @@ export default {
name: 'InvoiceInCard',
path: ':id',
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
redirect: { name: 'InvoiceInSummary' },
beforeEnter: async (to, from, next) => {
await setRectificative(to);
next();

View File

@ -55,7 +55,6 @@ export default {
name: 'InvoiceOutCard',
path: ':id',
component: () => import('src/pages/InvoiceOut/Card/InvoiceOutCard.vue'),
redirect: { name: 'InvoiceOutSummary' },
children: [
{
name: 'InvoiceOutSummary',

View File

@ -103,7 +103,6 @@ export default {
name: 'ItemCard',
path: ':id',
component: () => import('src/pages/Item/Card/ItemCard.vue'),
redirect: { name: 'ItemSummary' },
children: [
{
name: 'ItemSummary',

View File

@ -19,7 +19,6 @@ export default {
name: 'ItemTypeCard',
path: ':id',
component: () => import('src/pages/Item/ItemType/Card/ItemTypeCard.vue'),
redirect: { name: 'ItemTypeSummary' },
children: [
{
name: 'ItemTypeSummary',

View File

@ -19,7 +19,6 @@ export default {
name: 'AliasCard',
path: ':id',
component: () => import('src/pages/Account/Alias/Card/AliasCard.vue'),
redirect: { name: 'AliasSummary' },
children: [
{
name: 'AliasSummary',

View File

@ -46,7 +46,6 @@ export default {
name: 'OrderCard',
path: ':id',
component: () => import('src/pages/Order/Card/OrderCard.vue'),
redirect: { name: 'OrderSummary' },
children: [
{
name: 'OrderSummary',

View File

@ -19,7 +19,6 @@ export default {
path: '/parking/:id',
name: 'ParkingCard',
component: () => import('src/pages/Parking/Card/ParkingCard.vue'),
redirect: { name: 'ParkingSummary' },
children: [
{
name: 'ParkingSummary',

View File

@ -18,7 +18,6 @@ export default {
name: 'RouteRoadmapCard',
path: ':id',
component: () => import('src/pages/Route/Roadmap/RoadmapCard.vue'),
redirect: { name: 'RoadmapSummary' },
children: [
{
name: 'RoadmapSummary',

View File

@ -19,7 +19,6 @@ export default {
name: 'RoleCard',
path: ':id',
component: () => import('src/pages/Account/Role/Card/RoleCard.vue'),
redirect: { name: 'RoleSummary' },
children: [
{
name: 'RoleSummary',

View File

@ -26,7 +26,6 @@ export default {
path: '/route',
name: 'RouteMain',
component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'RouteList' },
children: [
{
path: 'list',

View File

@ -60,7 +60,6 @@ export default {
name: 'ShelvingLayout',
path: ':id',
component: () => import('pages/Shelving/Card/ShelvingCard.vue'),
redirect: { name: 'ShelvingSummary' },
children: [
{
name: 'ShelvingSummary',

View File

@ -90,7 +90,6 @@ export default {
name: 'TicketCard',
path: ':id',
component: () => import('src/pages/Ticket/Card/TicketCard.vue'),
redirect: { name: 'TicketSummary' },
children: [
{
path: 'summary',

View File

@ -54,7 +54,6 @@ export default {
name: 'TravelCard',
path: ':id',
component: () => import('src/pages/Travel/Card/TravelCard.vue'),
redirect: { name: 'TravelSummary' },
children: [
{
name: 'TravelSummary',

View File

@ -70,7 +70,6 @@ export default {
name: 'WorkerCard',
path: ':id',
component: () => import('src/pages/Worker/Card/WorkerCard.vue'),
redirect: { name: 'WorkerSummary' },
children: [
{
name: 'WorkerSummary',

View File

@ -66,7 +66,6 @@ export default {
name: 'ZoneCard',
path: ':id',
component: () => import('src/pages/Zone/Card/ZoneCard.vue'),
redirect: { name: 'ZoneSummary' },
children: [
{
name: 'ZoneSummary',