2018-06-27 14:36:42 +00:00
|
|
|
import Vue from 'vue';
|
|
|
|
import Router from 'vue-router';
|
2018-06-01 12:35:51 +00:00
|
|
|
|
2019-12-21 14:46:50 +00:00
|
|
|
// standard views
|
2019-11-22 17:43:32 +00:00
|
|
|
import Dashboard from '@/pages/Dashboard/Dashboard';
|
2019-12-21 14:46:50 +00:00
|
|
|
import ListView from '@/pages/ListView/ListView';
|
2019-11-27 18:37:38 +00:00
|
|
|
import PrintView from '@/pages/PrintView/PrintView';
|
2019-10-13 12:03:01 +00:00
|
|
|
import QuickEditForm from '@/pages/QuickEditForm';
|
2019-12-21 15:55:42 +00:00
|
|
|
import Report from '@/pages/Report';
|
2018-06-01 12:35:51 +00:00
|
|
|
|
2019-12-21 14:46:50 +00:00
|
|
|
// custom views
|
|
|
|
import GetStarted from '@/pages/GetStarted';
|
2019-10-13 12:03:01 +00:00
|
|
|
import ChartOfAccounts from '@/pages/ChartOfAccounts';
|
2019-10-11 09:55:50 +00:00
|
|
|
import InvoiceForm from '@/pages/InvoiceForm';
|
2019-11-19 19:10:01 +00:00
|
|
|
import JournalEntryForm from '@/pages/JournalEntryForm';
|
2019-10-11 09:55:50 +00:00
|
|
|
|
2018-06-27 14:36:42 +00:00
|
|
|
Vue.use(Router);
|
|
|
|
|
2018-10-10 18:51:03 +00:00
|
|
|
const routes = [
|
2019-07-25 09:50:48 +00:00
|
|
|
{
|
|
|
|
path: '/',
|
2019-08-01 11:52:58 +00:00
|
|
|
component: Dashboard
|
2019-07-25 09:50:48 +00:00
|
|
|
},
|
2019-12-21 14:46:50 +00:00
|
|
|
{
|
|
|
|
path: '/get-started',
|
|
|
|
component: GetStarted
|
|
|
|
},
|
2019-11-19 19:10:01 +00:00
|
|
|
{
|
|
|
|
path: '/edit/JournalEntry/:name',
|
|
|
|
name: 'JournalEntryForm',
|
|
|
|
components: {
|
|
|
|
default: JournalEntryForm,
|
|
|
|
edit: QuickEditForm
|
|
|
|
},
|
|
|
|
props: {
|
2019-12-21 14:46:50 +00:00
|
|
|
default: route => {
|
|
|
|
// for sidebar item active state
|
|
|
|
route.params.doctype = 'JournalEntry';
|
|
|
|
return {
|
|
|
|
doctype: 'JournalEntry',
|
|
|
|
name: route.params.name
|
|
|
|
};
|
|
|
|
},
|
2019-11-19 19:10:01 +00:00
|
|
|
edit: route => route.query
|
|
|
|
}
|
|
|
|
},
|
2018-06-27 14:36:42 +00:00
|
|
|
{
|
2019-10-13 21:56:20 +00:00
|
|
|
path: '/edit/:doctype/:name',
|
2019-10-11 09:55:50 +00:00
|
|
|
name: 'InvoiceForm',
|
|
|
|
components: {
|
|
|
|
default: InvoiceForm,
|
|
|
|
edit: QuickEditForm
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
default: true,
|
|
|
|
edit: route => route.query
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/list/:doctype',
|
2018-10-10 18:51:03 +00:00
|
|
|
name: 'ListView',
|
2019-10-11 09:55:50 +00:00
|
|
|
components: {
|
|
|
|
default: ListView,
|
|
|
|
edit: QuickEditForm
|
2019-10-04 20:18:10 +00:00
|
|
|
},
|
2019-10-11 09:55:50 +00:00
|
|
|
props: {
|
|
|
|
default: route => {
|
2019-12-11 12:24:02 +00:00
|
|
|
const { doctype, filters } = route.params;
|
2019-10-11 09:55:50 +00:00
|
|
|
return {
|
|
|
|
doctype,
|
2019-12-11 12:24:02 +00:00
|
|
|
filters
|
2019-10-11 09:55:50 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
edit: route => route.query
|
|
|
|
}
|
2018-06-27 14:36:42 +00:00
|
|
|
},
|
2018-10-15 12:05:01 +00:00
|
|
|
{
|
|
|
|
path: '/print/:doctype/:name',
|
|
|
|
name: 'PrintView',
|
|
|
|
component: PrintView,
|
|
|
|
props: true
|
2018-10-22 18:10:22 +00:00
|
|
|
},
|
2018-06-27 14:36:42 +00:00
|
|
|
{
|
|
|
|
path: '/report/:reportName',
|
|
|
|
name: 'Report',
|
|
|
|
component: Report,
|
2019-10-13 21:56:20 +00:00
|
|
|
props: true
|
2018-10-10 10:32:56 +00:00
|
|
|
},
|
2019-02-18 05:42:04 +00:00
|
|
|
{
|
2019-12-23 08:26:41 +00:00
|
|
|
path: '/chart-of-accounts',
|
2019-02-18 05:42:04 +00:00
|
|
|
name: 'Chart Of Accounts',
|
2019-10-13 21:18:18 +00:00
|
|
|
components: {
|
|
|
|
default: ChartOfAccounts,
|
|
|
|
edit: QuickEditForm
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
default: true,
|
|
|
|
edit: route => route.query
|
|
|
|
}
|
2019-07-18 10:45:44 +00:00
|
|
|
}
|
2018-10-10 18:51:03 +00:00
|
|
|
];
|
2018-06-27 14:36:42 +00:00
|
|
|
|
2019-10-03 13:46:12 +00:00
|
|
|
let router = new Router({ routes });
|
|
|
|
|
2019-10-26 14:46:04 +00:00
|
|
|
if (process.env.NODE_ENV === 'development') {
|
2019-11-19 19:10:01 +00:00
|
|
|
window.router = router;
|
2019-10-26 14:46:04 +00:00
|
|
|
}
|
|
|
|
|
2019-10-03 13:46:12 +00:00
|
|
|
export default router;
|