2022-04-28 12:04:55 +05:30
|
|
|
import ChartOfAccounts from 'src/pages/ChartOfAccounts.vue';
|
2023-02-21 11:51:32 +05:30
|
|
|
import CommonForm from 'src/pages/CommonForm/CommonForm.vue';
|
2022-04-20 12:08:47 +05:30
|
|
|
import Dashboard from 'src/pages/Dashboard/Dashboard.vue';
|
2022-04-25 16:07:25 +05:30
|
|
|
import GetStarted from 'src/pages/GetStarted.vue';
|
2023-02-21 11:51:32 +05:30
|
|
|
import ImportWizard from 'src/pages/ImportWizard.vue';
|
2022-04-27 17:32:43 +05:30
|
|
|
import ListView from 'src/pages/ListView/ListView.vue';
|
2022-05-02 11:01:11 +05:30
|
|
|
import PrintView from 'src/pages/PrintView/PrintView.vue';
|
2022-04-27 17:32:43 +05:30
|
|
|
import QuickEditForm from 'src/pages/QuickEditForm.vue';
|
2022-05-12 20:29:56 +05:30
|
|
|
import Report from 'src/pages/Report.vue';
|
2022-04-26 15:42:33 +05:30
|
|
|
import Settings from 'src/pages/Settings/Settings.vue';
|
2023-03-06 11:56:54 +05:30
|
|
|
import TemplateBuilder from 'src/pages/TemplateBuilder/TemplateBuilder.vue';
|
|
|
|
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
|
2023-05-09 09:55:11 +05:30
|
|
|
import { historyState } from './utils/refs';
|
2018-06-27 20:06:42 +05:30
|
|
|
|
2022-04-20 16:11:27 +05:30
|
|
|
const routes: RouteRecordRaw[] = [
|
2019-07-25 15:20:48 +05:30
|
|
|
{
|
|
|
|
path: '/',
|
2021-11-24 14:38:13 +05:30
|
|
|
component: Dashboard,
|
2019-07-25 15:20:48 +05:30
|
|
|
},
|
2019-12-21 20:16:50 +05:30
|
|
|
{
|
|
|
|
path: '/get-started',
|
2021-11-24 14:38:13 +05:30
|
|
|
component: GetStarted,
|
2019-12-21 20:16:50 +05:30
|
|
|
},
|
2023-04-14 13:22:13 +05:30
|
|
|
{
|
|
|
|
path: `/edit/:schemaName/:name`,
|
|
|
|
name: `CommonForm`,
|
|
|
|
components: {
|
|
|
|
default: CommonForm,
|
|
|
|
edit: QuickEditForm,
|
|
|
|
},
|
|
|
|
props: {
|
2023-04-17 09:59:12 +05:30
|
|
|
default: (route) => ({
|
|
|
|
schemaName: route.params.schemaName,
|
|
|
|
name: route.params.name,
|
|
|
|
}),
|
2023-04-14 13:22:13 +05:30
|
|
|
edit: (route) => route.query,
|
|
|
|
},
|
|
|
|
},
|
2019-10-11 15:25:50 +05:30
|
|
|
{
|
2023-01-04 17:53:42 +05:30
|
|
|
path: '/list/:schemaName/:pageTitle?',
|
2018-10-11 00:21:03 +05:30
|
|
|
name: 'ListView',
|
2019-10-11 15:25:50 +05:30
|
|
|
components: {
|
|
|
|
default: ListView,
|
2021-11-24 14:38:13 +05:30
|
|
|
edit: QuickEditForm,
|
2019-10-05 01:48:10 +05:30
|
|
|
},
|
2019-10-11 15:25:50 +05:30
|
|
|
props: {
|
2021-11-24 14:38:13 +05:30
|
|
|
default: (route) => {
|
2023-01-04 17:53:42 +05:30
|
|
|
const { schemaName } = route.params;
|
|
|
|
const pageTitle = route.params.pageTitle ?? '';
|
2022-04-20 16:11:27 +05:30
|
|
|
|
2023-01-04 17:53:42 +05:30
|
|
|
const filters = {};
|
|
|
|
const filterString = route.query.filters;
|
|
|
|
if (typeof filterString === 'string') {
|
|
|
|
Object.assign(filters, JSON.parse(filterString));
|
2022-03-10 12:06:37 +05:30
|
|
|
}
|
|
|
|
|
2019-10-11 15:25:50 +05:30
|
|
|
return {
|
2022-04-27 17:32:43 +05:30
|
|
|
schemaName,
|
2021-11-24 14:38:13 +05:30
|
|
|
filters,
|
2023-01-04 17:53:42 +05:30
|
|
|
pageTitle,
|
2019-10-11 15:25:50 +05:30
|
|
|
};
|
|
|
|
},
|
2023-04-17 09:59:12 +05:30
|
|
|
edit: (route) => route.query,
|
2021-11-24 14:38:13 +05:30
|
|
|
},
|
2018-06-27 20:06:42 +05:30
|
|
|
},
|
2018-10-15 17:35:01 +05:30
|
|
|
{
|
2022-05-01 10:15:47 +05:30
|
|
|
path: '/print/:schemaName/:name',
|
2018-10-15 17:35:01 +05:30
|
|
|
name: 'PrintView',
|
|
|
|
component: PrintView,
|
2021-11-24 14:38:13 +05:30
|
|
|
props: true,
|
2018-10-22 23:40:22 +05:30
|
|
|
},
|
2018-06-27 20:06:42 +05:30
|
|
|
{
|
2022-05-18 12:34:33 +05:30
|
|
|
path: '/report/:reportClassName',
|
2018-06-27 20:06:42 +05:30
|
|
|
name: 'Report',
|
|
|
|
component: Report,
|
2021-11-24 14:38:13 +05:30
|
|
|
props: true,
|
2018-10-10 16:02:56 +05:30
|
|
|
},
|
2019-02-18 11:12:04 +05:30
|
|
|
{
|
2019-12-23 13:56:41 +05:30
|
|
|
path: '/chart-of-accounts',
|
2019-02-18 11:12:04 +05:30
|
|
|
name: 'Chart Of Accounts',
|
2019-10-14 02:48:18 +05:30
|
|
|
components: {
|
|
|
|
default: ChartOfAccounts,
|
2021-11-24 14:38:13 +05:30
|
|
|
edit: QuickEditForm,
|
2019-10-14 02:48:18 +05:30
|
|
|
},
|
|
|
|
props: {
|
|
|
|
default: true,
|
2021-11-24 14:38:13 +05:30
|
|
|
edit: (route) => route.query,
|
|
|
|
},
|
|
|
|
},
|
2023-02-02 13:42:09 +05:30
|
|
|
{
|
|
|
|
path: '/import-wizard',
|
|
|
|
name: 'Import Wizard',
|
|
|
|
component: ImportWizard,
|
|
|
|
},
|
2023-02-22 14:15:59 +05:30
|
|
|
{
|
2023-02-22 15:51:20 +05:30
|
|
|
path: '/template-builder/:name',
|
2023-02-22 14:15:59 +05:30
|
|
|
name: 'Template Builder',
|
|
|
|
component: TemplateBuilder,
|
2023-02-22 15:51:20 +05:30
|
|
|
props: true,
|
2023-02-22 14:15:59 +05:30
|
|
|
},
|
2022-05-05 16:14:26 +05:30
|
|
|
{
|
2021-11-24 14:38:13 +05:30
|
|
|
path: '/settings',
|
|
|
|
name: 'Settings',
|
2022-10-12 14:05:18 +05:30
|
|
|
components: {
|
|
|
|
default: Settings,
|
|
|
|
edit: QuickEditForm,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
default: true,
|
|
|
|
edit: (route) => route.query,
|
|
|
|
},
|
2021-11-24 14:38:13 +05:30
|
|
|
},
|
2018-10-11 00:21:03 +05:30
|
|
|
];
|
2018-06-27 20:06:42 +05:30
|
|
|
|
2022-04-20 12:08:47 +05:30
|
|
|
const router = createRouter({ routes, history: createWebHistory() });
|
2023-05-09 09:55:11 +05:30
|
|
|
|
|
|
|
router.afterEach(() => {
|
2023-05-30 10:21:48 +05:30
|
|
|
historyState.forward = !!history.state?.forward;
|
|
|
|
historyState.back = !!history.state?.back;
|
2023-05-09 09:55:11 +05:30
|
|
|
});
|
|
|
|
|
2019-10-03 19:16:12 +05:30
|
|
|
export default router;
|