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
|
|
|
|
2018-10-10 18:51:03 +00:00
|
|
|
import ListView from '../pages/ListView';
|
|
|
|
import FormView from '../pages/FormView';
|
2018-10-15 12:05:01 +00:00
|
|
|
import PrintView from '../pages/PrintView';
|
2018-06-01 12:35:51 +00:00
|
|
|
|
2018-06-27 14:36:42 +00:00
|
|
|
import Report from 'frappejs/ui/pages/Report';
|
|
|
|
import reportViewConfig from '../../reports/view';
|
2018-06-01 12:35:51 +00:00
|
|
|
|
2018-10-10 10:32:56 +00:00
|
|
|
import DataImport from '../pages/DataImport';
|
|
|
|
|
2018-06-27 14:36:42 +00:00
|
|
|
Vue.use(Router);
|
|
|
|
|
2018-10-10 18:51:03 +00:00
|
|
|
const routes = [
|
2018-06-27 14:36:42 +00:00
|
|
|
{
|
2018-10-22 20:32:37 +00:00
|
|
|
path: '/list/:listName',
|
2018-10-10 18:51:03 +00:00
|
|
|
name: 'ListView',
|
|
|
|
component: ListView,
|
|
|
|
props: true
|
2018-06-27 14:36:42 +00:00
|
|
|
},
|
|
|
|
{
|
2018-10-10 18:51:03 +00:00
|
|
|
path: '/edit/:doctype/:name',
|
|
|
|
name: 'FormView',
|
|
|
|
component: FormView,
|
|
|
|
props: true
|
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,
|
|
|
|
props: (route) => {
|
|
|
|
const { reportName } = route.params;
|
|
|
|
return {
|
|
|
|
reportName,
|
2018-07-14 14:30:42 +00:00
|
|
|
reportConfig: reportViewConfig[reportName] || null,
|
|
|
|
filters: route.query
|
2018-06-27 14:36:42 +00:00
|
|
|
};
|
2018-06-01 12:35:51 +00:00
|
|
|
}
|
2018-10-10 10:32:56 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/data-import',
|
|
|
|
name: 'Data Import',
|
|
|
|
component: DataImport
|
2018-06-27 14:36:42 +00:00
|
|
|
}
|
2018-10-10 18:51:03 +00:00
|
|
|
];
|
2018-06-27 14:36:42 +00:00
|
|
|
|
|
|
|
export default new Router({ routes });
|